Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/rtadvd Set the hoplimit of 255 as specified in RFC ...
details: https://anonhg.NetBSD.org/src/rev/28193e0e1896
branches: trunk
changeset: 338711:28193e0e1896
user: roy <roy%NetBSD.org@localhost>
date: Fri Jun 05 14:15:41 2015 +0000
description:
Set the hoplimit of 255 as specified in RFC 4861 section 4.2
using the IPV6_MULTICAST_HOPS socket option rather than using CMSG
when constructing each message.
diffstat:
usr.sbin/rtadvd/rtadvd.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diffs (42 lines):
diff -r 94fcc49f83ab -r 28193e0e1896 usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c Fri Jun 05 14:09:20 2015 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c Fri Jun 05 14:15:41 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtadvd.c,v 1.47 2015/06/05 14:09:20 roy Exp $ */
+/* $NetBSD: rtadvd.c,v 1.48 2015/06/05 14:15:41 roy Exp $ */
/* $KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $ */
/*
@@ -1518,6 +1518,14 @@
exit(1);
}
+ /* RFC 4861 Section 4.2 */
+ on = 255;
+ if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &on,
+ sizeof(on)) == -1) {
+ syslog(LOG_ERR, "<%s> IPV6_MULTICAST_HOPS: %m", __func__);
+ exit(1);
+ }
+
/* specify to tell receiving interface */
on = 1;
#ifdef IPV6_RECVPKTINFO
@@ -1693,17 +1701,6 @@
memset(&pi->ipi6_addr, 0, sizeof(pi->ipi6_addr)); /*XXX*/
pi->ipi6_ifindex = rai->ifindex;
- /* specify the hop limit of the packet */
- {
- int hoplimit = 255;
-
- cm = CMSG_NXTHDR(&sndmhdr, cm);
- cm->cmsg_level = IPPROTO_IPV6;
- cm->cmsg_type = IPV6_HOPLIMIT;
- cm->cmsg_len = CMSG_LEN(sizeof(int));
- memcpy(CMSG_DATA(cm), &hoplimit, sizeof(int));
- }
-
syslog(LOG_DEBUG,
"<%s> send RA on %s, # of waitings = %d",
__func__, rai->ifname, rai->waiting);
Home |
Main Index |
Thread Index |
Old Index