-
Notifications
You must be signed in to change notification settings - Fork 870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICMPv6: Recognise ND option 38 (PREF64) #1109
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
1 2023-12-04 20:18:21.401201 IP6 (flowlabel 0x9fc72, hlim 255, next-header ICMPv6 (58), payload length 72) fe80::e015:81ff:feb4:b945 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 72 | ||
hop limit 80, Flags [other stateful], pref medium, router lifetime 500s, reachable time 0ms, retrans timer 0ms | ||
source link-address option (1), length 8 (1): e2:15:81:b4:b9:45 | ||
prefix info option (3), length 32 (4): 2001:db8:cc:dd::/64, Flags [onlink], valid time 3600s, pref. time 1800s | ||
pref64 option (38), length 16 (2): 2001:db8:1:64:ff9b::/96 (plc 0), lifetime 0s | ||
2 2023-12-04 20:18:24.401773 IP6 (flowlabel 0x9fc72, hlim 255, next-header ICMPv6 (58), payload length 72) fe80::e015:81ff:feb4:b945 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 72 | ||
hop limit 80, Flags [other stateful], pref medium, router lifetime 500s, reachable time 0ms, retrans timer 0ms | ||
source link-address option (1), length 8 (1): e2:15:81:b4:b9:45 | ||
prefix info option (3), length 32 (4): 2001:db8:cc:dd::/64, Flags [onlink], valid time 3600s, pref. time 1800s | ||
pref64 option (38), length 16 (2): 2001:db8:0:64:ff9b::/?? (plc 6), lifetime 1800s | ||
3 2023-12-04 20:18:27.402345 IP6 (flowlabel 0x9fc72, hlim 255, next-header ICMPv6 (58), payload length 72) fe80::e015:81ff:feb4:b945 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 72 | ||
hop limit 80, Flags [other stateful], pref medium, router lifetime 500s, reachable time 0ms, retrans timer 0ms | ||
source link-address option (1), length 8 (1): e2:15:81:b4:b9:45 | ||
prefix info option (3), length 32 (4): 2a00:f480:cc:dd::/64, Flags [onlink], valid time 3600s, pref. time 1800s | ||
pref64 option (38), length 16 (2): 2001:db8:0:64:ff9b::/96 (plc 0), lifetime 1800s | ||
4 2023-12-04 20:18:30.402917 IP6 (flowlabel 0x9fc72, hlim 255, next-header ICMPv6 (58), payload length 72) fe80::e015:81ff:feb4:b945 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 72 | ||
hop limit 80, Flags [other stateful], pref medium, router lifetime 500s, reachable time 0ms, retrans timer 0ms | ||
source link-address option (1), length 8 (1): e2:15:81:b4:b9:45 | ||
prefix info option (3), length 32 (4): 2001:db8:cc:dd::/64, Flags [onlink], valid time 3600s, pref. time 1800s | ||
pref64 option (38), length 16 (2): 2001:db8:0:64:ff9b::/96 (plc 0), lifetime 65528s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
1 2023-12-04 20:18:21.401201 IP6 (flowlabel 0x9fc72, hlim 255, next-header ICMPv6 (58), payload length 72) fe80::e015:81ff:feb4:b945 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 72 | ||
hop limit 80, Flags [other stateful], pref medium, router lifetime 500s, reachable time 0ms, retrans timer 0ms | ||
source link-address option (1), length 8 (1): e2:15:81:b4:b9:45 | ||
0x0000: e215 81b4 b945 | ||
prefix info option (3), length 32 (4): 2001:db8:cc:dd::/64, Flags [onlink], valid time 3600s, pref. time 1800s | ||
0x0000: 4080 0000 0e10 0000 0708 0000 0000 2001 | ||
0x0010: 0db8 00cc 00dd 0000 0000 0000 0000 | ||
pref64 option (38), length 16 (2): 2001:db8:1:64:ff9b::/96 (plc 0), lifetime 0s | ||
0x0000: 0000 2001 0db8 0001 0064 ff9b 0000 | ||
2 2023-12-04 20:18:24.401773 IP6 (flowlabel 0x9fc72, hlim 255, next-header ICMPv6 (58), payload length 72) fe80::e015:81ff:feb4:b945 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 72 | ||
hop limit 80, Flags [other stateful], pref medium, router lifetime 500s, reachable time 0ms, retrans timer 0ms | ||
source link-address option (1), length 8 (1): e2:15:81:b4:b9:45 | ||
0x0000: e215 81b4 b945 | ||
prefix info option (3), length 32 (4): 2001:db8:cc:dd::/64, Flags [onlink], valid time 3600s, pref. time 1800s | ||
0x0000: 4080 0000 0e10 0000 0708 0000 0000 2001 | ||
0x0010: 0db8 00cc 00dd 0000 0000 0000 0000 | ||
pref64 option (38), length 16 (2): 2001:db8:0:64:ff9b::/?? (plc 6), lifetime 1800s | ||
0x0000: 070e 2001 0db8 0000 0064 ff9b 0000 | ||
3 2023-12-04 20:18:27.402345 IP6 (flowlabel 0x9fc72, hlim 255, next-header ICMPv6 (58), payload length 72) fe80::e015:81ff:feb4:b945 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 72 | ||
hop limit 80, Flags [other stateful], pref medium, router lifetime 500s, reachable time 0ms, retrans timer 0ms | ||
source link-address option (1), length 8 (1): e2:15:81:b4:b9:45 | ||
0x0000: e215 81b4 b945 | ||
prefix info option (3), length 32 (4): 2a00:f480:cc:dd::/64, Flags [onlink], valid time 3600s, pref. time 1800s | ||
0x0000: 4080 0000 0e10 0000 0708 0000 0000 2a00 | ||
0x0010: f480 00cc 00dd 0000 0000 0000 0000 | ||
pref64 option (38), length 16 (2): 2001:db8:0:64:ff9b::/96 (plc 0), lifetime 1800s | ||
0x0000: 0708 2001 0db8 0000 0064 ff9b 0000 | ||
4 2023-12-04 20:18:30.402917 IP6 (flowlabel 0x9fc72, hlim 255, next-header ICMPv6 (58), payload length 72) fe80::e015:81ff:feb4:b945 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 72 | ||
hop limit 80, Flags [other stateful], pref medium, router lifetime 500s, reachable time 0ms, retrans timer 0ms | ||
source link-address option (1), length 8 (1): e2:15:81:b4:b9:45 | ||
0x0000: e215 81b4 b945 | ||
prefix info option (3), length 32 (4): 2001:db8:cc:dd::/64, Flags [onlink], valid time 3600s, pref. time 1800s | ||
0x0000: 4080 0000 0e10 0000 0708 0000 0000 2001 | ||
0x0010: 0db8 00cc 00dd 0000 0000 0000 0000 | ||
pref64 option (38), length 16 (2): 2001:db8:0:64:ff9b::/96 (plc 0), lifetime 65528s | ||
0x0000: fff8 2001 0db8 0000 0064 ff9b 0000 |
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a little odd to have the
w & 0x0007
both insideget_pref64_len_repr()
and in the ND_PRINT args. It might be more clear to use a temp variable, maybe namedplc
, and then pass that to bothget_pref64_len_repr()
and in the ND_PRINT arg list. Obviously this is pretty minor.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arg of
get_pref64_len_repr()
is eventually used to index memory, so IMHO the mask should not be removed fromget_pref64_len_repr()
anyway; it should be local to the array member access. Otherwise, in the case where the compiler does not inline the call, we would not be far from introducing a gadget to read garbage memory; it would take a single human error. In my view, the resulting code would be harder to maintain.A temporary variable declaration five screens away, only useful for opt 38, does not address the point above.
One way to reduce repetition would be to abstract
"%s/%u (plc %u)"
into its own function instead ofget_pref64_len_repr()
:..., and then use it in
icmp6_opt_print()
. Or, maybe, even print the lifetime in here.The mask is local to the memory access, so it is hard to make a mistake. We do not have to write
w & 0x0007
twice.That might or might not be easier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes the cure is worse than the disease. While the two masks jumped out at me as unusual, I don't think it's a blocker. Thanks for humoring me.