if_ovpn: reject non-UDP sockets
We must ensure that the fd provided by userspace is really for a UDP socket. If it's not we'll panic in udp_set_kernel_tunneling(). Reported by: Gert Doering <gert@greenie.muc.de> Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
parent
0b6d133c08
commit
fd6b3bede5
@ -559,6 +559,12 @@ ovpn_new_peer(struct ifnet *ifp, const nvlist_t *nvl)
|
||||
goto error_locked;
|
||||
}
|
||||
|
||||
/* Make sure this is really a UDP socket. */
|
||||
if (so->so_type != SOCK_DGRAM || so->so_proto->pr_type != SOCK_DGRAM) {
|
||||
ret = EPROTOTYPE;
|
||||
goto error_locked;
|
||||
}
|
||||
|
||||
/* Must be the same socket as for other peers on this interface. */
|
||||
if (sc->so != NULL && so != sc->so)
|
||||
goto error_locked;
|
||||
|
Loading…
x
Reference in New Issue
Block a user