mirror of
https://github.com/opnsense/src.git
synced 2026-04-22 14:49:36 -04:00
Mirror IPv4 pcb locking into in6_setsockaddr() and in6_setpeeraddr():
acquire inpcb lock when reading inpcb port+address in order to prevent races with other threads that may be changing them. MFC after: 3 months
This commit is contained in:
parent
992879a026
commit
086dafc15b
1 changed files with 4 additions and 0 deletions
|
|
@ -520,8 +520,10 @@ in6_setsockaddr(so, nam)
|
|||
inp = sotoinpcb(so);
|
||||
KASSERT(inp != NULL, ("in6_setsockaddr: inp == NULL"));
|
||||
|
||||
INP_LOCK(inp);
|
||||
port = inp->inp_lport;
|
||||
addr = inp->in6p_laddr;
|
||||
INP_UNLOCK(inp);
|
||||
|
||||
*nam = in6_sockaddr(port, &addr);
|
||||
return 0;
|
||||
|
|
@ -539,8 +541,10 @@ in6_setpeeraddr(so, nam)
|
|||
inp = sotoinpcb(so);
|
||||
KASSERT(inp != NULL, ("in6_setpeeraddr: inp == NULL"));
|
||||
|
||||
INP_LOCK(inp);
|
||||
port = inp->inp_fport;
|
||||
addr = inp->in6p_faddr;
|
||||
INP_UNLOCK(inp);
|
||||
|
||||
*nam = in6_sockaddr(port, &addr);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue