svn commit: r223150 - user/hrs/ipv6/usr.sbin/rtadvd
Hiroki Sato
hrs at FreeBSD.org
Thu Jun 16 12:57:34 UTC 2011
Author: hrs
Date: Thu Jun 16 12:57:33 2011
New Revision: 223150
URL: http://svn.freebsd.org/changeset/base/223150
Log:
- Check RTM_VERSION.
- Fix WARNS.
Modified:
user/hrs/ipv6/usr.sbin/rtadvd/Makefile
user/hrs/ipv6/usr.sbin/rtadvd/if.c
user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c
Modified: user/hrs/ipv6/usr.sbin/rtadvd/Makefile
==============================================================================
--- user/hrs/ipv6/usr.sbin/rtadvd/Makefile Thu Jun 16 12:41:37 2011 (r223149)
+++ user/hrs/ipv6/usr.sbin/rtadvd/Makefile Thu Jun 16 12:57:33 2011 (r223150)
@@ -23,6 +23,6 @@ LDADD= -lutil
CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DROUTEINFO
-WARNS?= 6
+WARNS?= 3
.include <bsd.prog.mk>
Modified: user/hrs/ipv6/usr.sbin/rtadvd/if.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/rtadvd/if.c Thu Jun 16 12:41:37 2011 (r223149)
+++ user/hrs/ipv6/usr.sbin/rtadvd/if.c Thu Jun 16 12:57:33 2011 (r223150)
@@ -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);
Modified: user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c Thu Jun 16 12:41:37 2011 (r223149)
+++ user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c Thu Jun 16 12:57:33 2011 (r223150)
@@ -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:
More information about the svn-src-user
mailing list