diff options
author | ume <ume@FreeBSD.org> | 2003-08-17 16:08:56 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2003-08-17 16:08:56 +0000 |
commit | 99b1b224da3bbe545ff4eef3c4665170a0fa06e4 (patch) | |
tree | 5de686db3979a1e1925cbfb4e39a00ae71dd81e4 /usr.sbin/route6d | |
parent | a5bff9b8e21d62bda77bd14358e42788d813d854 (diff) | |
download | FreeBSD-src-99b1b224da3bbe545ff4eef3c4665170a0fa06e4.zip FreeBSD-src-99b1b224da3bbe545ff4eef3c4665170a0fa06e4.tar.gz |
set IPV6_V6ONLY.
Obtained from: KAME
MFC after: 1 week
Diffstat (limited to 'usr.sbin/route6d')
-rw-r--r-- | usr.sbin/route6d/route6d.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 6d7fddd..769799c 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -585,7 +585,8 @@ ripalarm() void init() { - int i, int0, int255, error; + int error; + const int int0 = 0, int1 = 1, int255 = 255; struct addrinfo hints, *res; char port[10]; @@ -609,12 +610,18 @@ init() /*NOTREACHED*/ } - int0 = 0; int255 = 255; ripsock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (ripsock < 0) { fatal("rip socket"); /*NOTREACHED*/ } +#ifdef IPV6_V6ONLY + if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_V6ONLY, + &int1, sizeof(int1)) < 0) { + fatal("rip IPV6_V6ONLY"); + /*NOTREACHED*/ + } +#endif if (bind(ripsock, res->ai_addr, res->ai_addrlen) < 0) { fatal("rip bind"); /*NOTREACHED*/ @@ -630,16 +637,15 @@ init() /*NOTREACHED*/ } - i = 1; #ifdef IPV6_RECVPKTINFO - if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &i, - sizeof(i)) < 0) { + if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, + &int1, sizeof(int1)) < 0) { fatal("rip IPV6_RECVPKTINFO"); /*NOTREACHED*/ } #else /* old adv. API */ - if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_PKTINFO, &i, - sizeof(i)) < 0) { + if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_PKTINFO, + &int1, sizeof(int1)) < 0) { fatal("rip IPV6_PKTINFO"); /*NOTREACHED*/ } |