diff options
-rw-r--r-- | usr.sbin/rtadvd/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/rtadvd/if.c | 6 | ||||
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.c | 7 |
3 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/rtadvd/Makefile b/usr.sbin/rtadvd/Makefile index e34aa3c..5afb3bf 100644 --- a/usr.sbin/rtadvd/Makefile +++ b/usr.sbin/rtadvd/Makefile @@ -23,6 +23,6 @@ LDADD= -lutil CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DROUTEINFO -WARNS?= 6 +WARNS?= 3 .include <bsd.prog.mk> diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c index 302c334..8722a05 100644 --- a/usr.sbin/rtadvd/if.c +++ b/usr.sbin/rtadvd/if.c @@ -105,6 +105,12 @@ if_nametosdl(char *name) lim = buf + len; for (next = buf; next < lim; next += ifm->ifm_msglen) { ifm = (struct if_msghdr *)next; + if (ifm->ifm_version != RTM_VERSION) { + syslog(LOG_ERR, + "<%s> RTM_VERSION mismatch (%d != %d).", + __func__, ifm->ifm_version, RTM_VERSION); + continue; + } if (ifm->ifm_type == RTM_IFINFO) { sa = (struct sockaddr *)(ifm + 1); get_rtaddrs(ifm->ifm_addrs, sa, rti_info); diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index e9b212c..72fb46e 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -503,6 +503,13 @@ rtmsg_input(void) RTADV_TYPE2BITMASK(RTM_IFANNOUNCE)); if (len == 0) break; + if (((struct rt_msghdr *)next)->rtm_version != RTM_VERSION) { + syslog(LOG_ERR, + "<%s> RTM_VERSION mismatch (%d != %d).", + __func__, ((struct rt_msghdr *)next)->rtm_version, + RTM_VERSION); + continue; + } type = rtmsg_type(next); switch (type) { case RTM_ADD: |