Skip to content
This repository was archived by the owner on May 24, 2025. It is now read-only.

Commit 39c472d

Browse files
committed
(to squash) set the hop limit to 255
1 parent e6d01e1 commit 39c472d

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

doc/router-advert-feature-guide.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Output of `tcpdump` on the interface shows the RA message:
4545

4646
sudo tcpdump -n -i wpan1 icmp6 -vv -X
4747

48-
11:01:58.991522 IP6 (flowlabel 0xba663, hlim 1, next-header ICMPv6 (58) payload length: 40) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 40
48+
11:01:58.991522 IP6 (flowlabel 0xba663, hlim 255, next-header ICMPv6 (58) payload length: 40) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 40
4949
hop limit 255, Flags [none], pref medium, router lifetime 0s, reachable time 3600s, retrans time 0s
5050
source link-address option (1), length 8 (1): 00:00:00:00:00:00
5151
0x0000: 0000 0000 0000
@@ -70,7 +70,7 @@ We can add or remove interface names to `RouterAdvert:Netifs` property. The RA m
7070

7171
sudo tcpdump -n -i eno1 icmp6 -vv -X
7272

73-
11:22:23.785865 IP6 (flowlabel 0xbcd66, hlim 1, next-header ICMPv6 (58) payload length: 40) fe80::6d87:d70b:c949:762a > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 40
73+
11:22:23.785865 IP6 (flowlabel 0xbcd66, hlim 255, next-header ICMPv6 (58) payload length: 40) fe80::6d87:d70b:c949:762a > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 40
7474
hop limit 255, Flags [none], pref medium, router lifetime 0s, reachable time 3600s, retrans time 0s
7575
source link-address option (1), length 8 (1): ec:b1:d7:2f:7c:b9
7676
0x0000: ecb1 d72f 7cb9
@@ -114,7 +114,7 @@ When a route is added/removed (state changes), a new RA is sent immediately.
114114

115115
`tcpdump` output now contains two route info options and is sent every 4 seconds:
116116

117-
11:07:04.441659 IP6 (flowlabel 0xba663, hlim 1, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
117+
11:07:04.441659 IP6 (flowlabel 0xba663, hlim 255, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
118118
hop limit 255, Flags [none], pref medium, router lifetime 0s, reachable time 3600s, retrans time 0s
119119
source link-address option (1), length 8 (1): 00:00:00:00:00:00
120120
0x0000: 0000 0000 0000
@@ -129,7 +129,7 @@ When a route is added/removed (state changes), a new RA is sent immediately.
129129
0x0040: 1802 3000 0000 0e10 fd00 baba cafe 0000 ..0.............
130130
0x0050: 1802 4000 0000 0e10 fd00 1234 0000 0000 [email protected]....
131131

132-
11:07:08.445622 IP6 (flowlabel 0xba663, hlim 1, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
132+
11:07:08.445622 IP6 (flowlabel 0xba663, hlim 255, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
133133
hop limit 255, Flags [none], pref medium, router lifetime 0s, reachable time 3600s, retrans time 0s
134134
source link-address option (1), length 8 (1): 00:00:00:00:00:00
135135
0x0000: 0000 0000 0000
@@ -149,7 +149,7 @@ The property `RouterAdvert:DefaultRoute:Lifetime` specifies the lifetime value i
149149

150150
wpanctl:wpan1> set RouterAdvert:DefaultRoute:Lifetime 1000
151151

152-
11:10:05.929627 IP6 (flowlabel 0xba663, hlim 1, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
152+
11:10:05.929627 IP6 (flowlabel 0xba663, hlim 255, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
153153
hop limit 255, Flags [none], pref medium, router lifetime 1000s, reachable time 3600s, retrans time 0s
154154
source link-address option (1), length 8 (1): 00:00:00:00:00:00
155155
0x0000: 0000 0000 0000
@@ -158,12 +158,12 @@ The property `RouterAdvert:DefaultRoute:Preference` determines default route pre
158158

159159
wpanctl:wpan1> set RouterAdvert:DefaultRoute:Preference 1
160160

161-
11:12:19.989599 IP6 (flowlabel 0xba663, hlim 1, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
161+
11:12:19.989599 IP6 (flowlabel 0xba663, hlim 255, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
162162
hop limit 255, Flags [none], pref high, router lifetime 1000s, reachable time 3600s, retrans time 0s
163163

164164
wpanctl:wpan1> set RouterAdvert:DefaultRoute:Preference -v -1
165165

166-
11:13:08.078489 IP6 (flowlabel 0xba663, hlim 1, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
166+
11:13:08.078489 IP6 (flowlabel 0xba663, hlim 255, next-header ICMPv6 (58) payload length: 56) fe80::4801:7e22:7895:a656 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 56
167167
hop limit 255, Flags [none], pref low, router lifetime 1000s, reachable time 3600s, retrans time 0s
168168

169169
Limitations:

src/wpantund/ICMP6RouterAdvertiser.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ nl::wpantund::ICMP6RouterAdvertiser::ICMP6RouterAdvertiser(NCPInstanceBase* inst
5454
, mStateChanged(false)
5555
{
5656
mSocket = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
57+
58+
if (mSocket >= 0) {
59+
int hop_limit = 255;
60+
61+
if (setsockopt(mSocket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hop_limit, sizeof(hop_limit)) < 0) {
62+
syslog(LOG_WARNING, "Failed to set muticast hops on socket");
63+
}
64+
}
5765
}
5866

5967
nl::wpantund::ICMP6RouterAdvertiser::~ICMP6RouterAdvertiser(void)

0 commit comments

Comments
 (0)