Skip to content

Commit

Permalink
don't assume IPV6_RECVPKTINFO
Browse files Browse the repository at this point in the history
  • Loading branch information
itojun committed Jul 30, 2000
1 parent aae6d06 commit 6abd154
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kame/kame/dhcp6/dhcp6relay.c
Expand Up @@ -319,11 +319,19 @@ relay6_init()
/* NOTREACHED */
}
freeaddrinfo(res);
#ifdef IPV6_RECVPKTINFO
if (setsockopt(csock, IPPROTO_IPV6, IPV6_RECVPKTINFO,
&on, sizeof(on)) < 0) {
err(1, "setsockopt(IPV6_RECVPKTINFO)");
/* NOTREACHED */
}
#else
if (setsockopt(csock, IPPROTO_IPV6, IPV6_PKTINFO,
&on, sizeof(on)) < 0) {
err(1, "setsockopt(IPV6_PKTINFO)");
/* NOTREACHED */
}
#endif

hints.ai_flags = 0;
error = getaddrinfo(DH6ADDR_ALLAGENT, 0, &hints, &res2);
Expand Down Expand Up @@ -374,11 +382,19 @@ relay6_init()
err(1, "setsockopt(ssock, IPV6_MULTICAST_HOPS(%d))", mhops);
/* NOTREACHED */
}
#ifdef IPV6_RECVPKTINFO
if (setsockopt(ssock, IPPROTO_IPV6, IPV6_RECVPKTINFO,
&on, sizeof(on)) < 0) {
err(1, "setsockopt(IPV6_RECVPKTINFO)");
/* NOTREACHED */
}
#else
if (setsockopt(ssock, IPPROTO_IPV6, IPV6_PKTINFO,
&on, sizeof(on)) < 0) {
err(1, "setsockopt(IPV6_PKTINFO)");
/* NOTREACHED */
}
#endif

/*
* Setup a socket to receive ICMPv6 errors.
Expand Down
7 changes: 7 additions & 0 deletions kame/kame/dhcp6/dhcp6s.c
Expand Up @@ -271,10 +271,17 @@ server6_init()
err(1, "socket(insock)");
/* NOTREACHED */
}
#ifdef IPV6_RECVPKTINFO
if (setsockopt(insock, IPPROTO_IPV6, IPV6_RECVPKTINFO,
&on, sizeof(on)) < 0) {
err(1, "setsockopt(IPV6_RECVPKTINFO)");
}
#else
if (setsockopt(insock, IPPROTO_IPV6, IPV6_PKTINFO,
&on, sizeof(on)) < 0) {
err(1, "setsockopt(IPV6_PKTINFO)");
}
#endif
if (bind(insock, res->ai_addr, res->ai_addrlen) < 0) {
err(1, "bind(insock)");
/* NOTREACHED */
Expand Down

0 comments on commit 6abd154

Please sign in to comment.