diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-10-12 09:10:53 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-10-12 09:10:53 +0000 |
commit | c5c4ce195851796e1d8b4490e7682babbffb7ad5 (patch) | |
tree | ae20af05a36c16bfd4d5b28ecd34fb5292bec496 /sys/net | |
parent | fdf53a98b5cc88460ad83c4b1b01217153d4d012 (diff) |
Fix a singed vs unsigned comparison resulting in an overflow of the
routing socket.
When clang became the default compiler, `if_flags' from `struct ifnet'
was changed from "short" to "unsigned short", to silence a warning.
Sadly the copy of these flags on the stack was still a "short" which
made the flags comparison always true, which in turn made ifioctl()
generates a RTM_INFO message for many ioctl(2).
Since my last commit, the flag comparison is done for every ioctl(2).
This made the kernel generate at least one routing message per ioctl,
resulting in a lot of RTM_DESYNC.
RTM_DESYNC problem reported by krw@ thanks to dhclient(8)'s noisiness!
ok krw@, patrick@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 784a0fc71d1..da3d6dbb97f 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.514 2017/10/11 07:57:27 mpi Exp $ */ +/* $OpenBSD: if.c,v 1.515 2017/10/12 09:10:52 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1823,7 +1823,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) char ifrtlabelbuf[RTLABEL_LEN]; int s, error = 0, oif_xflags; size_t bytesdone; - short oif_flags; + unsigned short oif_flags; const char *label; switch (cmd) { |