VirtualBox

Ignore:
Timestamp:
Oct 31, 2013 2:08:05 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
90356
Message:

NAT: Use RW critsect to protect the handler chain list against concurrent access

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/libalias/alias_mod.c

    r40423 r49347  
    115115#else /* VBOX */
    116116# define LIBALIAS_WLOCK_ASSERT() ;
    117 # define LIBALIAS_RLOCK() ;
    118 # define LIBALIAS_RUNLOCK() ;
    119 # define LIBALIAS_WLOCK() ;
    120 # define LIBALIAS_WUNLOCK() ;
     117# define LIBALIAS_RLOCK() \
     118    do { \
     119        int rc = RTCritSectRwEnterShared(&pData->CsRwHandlerChain); \
     120        AssertRC(rc); \
     121    } while (0)
     122# define LIBALIAS_RUNLOCK() \
     123    do { \
     124        int rc = RTCritSectRwLeaveShared(&pData->CsRwHandlerChain); \
     125        AssertRC(rc); \
     126    } while (0)
     127# define LIBALIAS_WLOCK() \
     128    do { \
     129        int rc = RTCritSectRwEnterExcl(&pData->CsRwHandlerChain); \
     130        AssertRC(rc); \
     131    } while (0)
     132# define LIBALIAS_WUNLOCK() \
     133    do { \
     134        int rc = RTCritSectRwLeaveExcl(&pData->CsRwHandlerChain); \
     135        AssertRC(rc); \
     136    } while (0)
    121137# define _handler_chain_init() ;
    122138# define _handler_chain_destroy() ;
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r48947 r49347  
    309309    pData->netmask = u32Netmask;
    310310
     311    rc = RTCritSectRwInit(&pData->CsRwHandlerChain);
     312    if (RT_FAILURE(rc))
     313        return rc;
     314
    311315    /* sockets & TCP defaults */
    312316    pData->socket_rcv = 64 * _1K;
     
    555559#endif
    556560#endif
     561    RTCritSectRwDelete(&pData->CsRwHandlerChain);
    557562    RTMemFree(pData);
    558563}
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r48526 r49347  
    286286    struct libalias *dns_alias;
    287287    LIST_HEAD(handler_chain, proto_handler) handler_chain;
     288    /** Critical R/W section to protect the handler chain list. */
     289    RTCRITSECTRW CsRwHandlerChain;
    288290    struct port_forward_rule_list port_forward_rule_head;
    289291    int cRedirectionsActive;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette