summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2011-06-16 12:57:33 +0000
committerhrs <hrs@FreeBSD.org>2011-06-16 12:57:33 +0000
commit90aa2cef03ff2efa8e9af771632eb3d02d0df168 (patch)
tree490da30e581b1db427eed8cad599ad60ed7b443a /usr.sbin
parent941fea0834d05ab32f6422648f2ce94a76e13a48 (diff)
downloadFreeBSD-src-90aa2cef03ff2efa8e9af771632eb3d02d0df168.zip
FreeBSD-src-90aa2cef03ff2efa8e9af771632eb3d02d0df168.tar.gz
- Check RTM_VERSION.
- Fix WARNS.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rtadvd/Makefile2
-rw-r--r--usr.sbin/rtadvd/if.c6
-rw-r--r--usr.sbin/rtadvd/rtadvd.c7
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:
OpenPOWER on IntegriCloud