diff options
| author | 2016-04-29 11:40:27 +0000 | |
|---|---|---|
| committer | 2016-04-29 11:40:27 +0000 | |
| commit | 9b11a973df7f74cfe24c958e07183af205539b46 (patch) | |
| tree | 2f8933cf691d9c68e4ab05594655001f4e2599c8 /sys/netinet/ip_output.c | |
| parent | libotermcap was removed from the miniroots in 2013. Additionally, -lc (diff) | |
| download | wireguard-openbsd-9b11a973df7f74cfe24c958e07183af205539b46.tar.xz wireguard-openbsd-9b11a973df7f74cfe24c958e07183af205539b46.zip | |
Do not allow to change the routing table of a bound socket. This
is not intended and will behave unexpectedly if the address is
already used in another domain. It did not work anyway, as the PCB
ended in the wrong hash bucket after changing the rtable. Fail
with EBUSY if the socket is already bound and rehash the PCB if its
rtable changes.
input claudio@; OK mpi@
Diffstat (limited to 'sys/netinet/ip_output.c')
| -rw-r--r-- | sys/netinet/ip_output.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 6f47f429ca8..d0b15f8a93a 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.320 2016/04/18 12:10:34 mpi Exp $ */ +/* $OpenBSD: ip_output.c,v 1.321 2016/04/29 11:40:27 bluhm Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -1049,7 +1049,12 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, error = EINVAL; break; } + if (inp->inp_lport) { + error = EBUSY; + break; + } inp->inp_rtableid = rtid; + in_pcbrehash(inp); break; case IP_PIPEX: if (m != NULL && m->m_len == sizeof(int)) |
