Date: Wed, 24 Aug 2011 19:01:38 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225150 - user/hrs/ipv6/usr.sbin/rtsold Message-ID: <201108241901.p7OJ1cdR066752@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Wed Aug 24 19:01:37 2011 New Revision: 225150 URL: http://svn.freebsd.org/changeset/base/225150 Log: Fix -F flag handling to support receiving RAs even when ip6.forwarding=1. Modified: user/hrs/ipv6/usr.sbin/rtsold/rtsold.c Modified: user/hrs/ipv6/usr.sbin/rtsold/rtsold.c ============================================================================== --- user/hrs/ipv6/usr.sbin/rtsold/rtsold.c Wed Aug 24 18:44:05 2011 (r225149) +++ user/hrs/ipv6/usr.sbin/rtsold/rtsold.c Wed Aug 24 19:01:37 2011 (r225150) @@ -225,6 +225,7 @@ main(int argc, char **argv) srandom((u_long)time(NULL)); #endif +#if (__FreeBSD_version < 900000) if (Fflag) { setinet6sysctl(IPV6CTL_FORWARDING, 0); } else { @@ -232,6 +233,7 @@ main(int argc, char **argv) if (getinet6sysctl(IPV6CTL_FORWARDING)) warnx("kernel is configured as a router, not a host"); } +#endif #ifndef SMALL /* initialization to dump internal status to a file */ @@ -411,6 +413,32 @@ ifconfig(char *ifname) return (-1); } + if (Fflag) { + struct in6_ndireq nd; + int s; + + if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { + warnmsg(LOG_ERR, __func__, "socket() failed."); + return (-1); + } + memset(&nd, 0, sizeof(nd)); + strlcpy(nd.ifname, ifname, sizeof(nd.ifname)); + if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0) { + warnmsg(LOG_ERR, __func__, + "cannot get accept_rtadv flag"); + close(s); + return (-1); + } + nd.ndi.flags |= ND6_IFF_ACCEPT_RTADV; + if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&nd) < 0) { + warnmsg(LOG_ERR, __func__, + "cannot set accept_rtadv flag"); + close(s); + return (-1); + } + close(s); + } + if ((ifi = malloc(sizeof(*ifi))) == NULL) { warnmsg(LOG_ERR, __func__, "memory allocation failed"); free(sdl);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108241901.p7OJ1cdR066752>