Repository navigation
Conversation
nmeyerhans
reviewed
Apr 30, 2021
nmeyerhans
left a comment
Contributor
There was a problem hiding this comment.
At first glance it looks OK.
One question: When I run this code and inspect the transmitted packets using wireshark, I see the expected interface identification object, but then another unknown object:
ICMP Multi-Part Extensions
Version: 2
.... 0000 0011 1000 = Reserved: 0x038
[Checksum: [missing]]
[Checksum Status: Not present]
Interface Identification Object
Length: 8
Class: Interface Identification Object (3)
C-Type: 2 (Identifies Interface By Index)
Interface Index: 2
Unknown object (139/96) (truncated)
Length: 50720
Class: Unknown (139)
C-Type: 96
Data: 0000000071d10200000000001c1d1e1f202122232425262728292a2b2c2d2e2f30313233…
What is the second object? Is it expected?
Comment on lines
+2067
to
+2092
| // return; | ||
| // static int once; | ||
| // static struct sock_filter insns[] = { | ||
| // BPF_STMT(BPF_LDX | BPF_B | BPF_MSH, 0), /* Skip IP header due BSD, see ping6. */ | ||
| // BPF_STMT(BPF_LD | BPF_H | BPF_IND, 4), /* Load icmp echo ident */ | ||
| // BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0xAAAA, 0, 1), /* Ours? */ | ||
| // BPF_STMT(BPF_RET | BPF_K, ~0U), /* Yes, it passes. */ | ||
| // BPF_STMT(BPF_LD | BPF_B | BPF_IND, 0), /* Load icmp type */ | ||
| // BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ICMP_ECHOREPLY, 1, 0), /* Echo? */ | ||
| // BPF_STMT(BPF_RET | BPF_K, 0xFFFFFFF), /* No. It passes. */ | ||
| // BPF_STMT(BPF_RET | BPF_K, 0) /* Echo with wrong ident. Reject. */ | ||
| // }; | ||
| // static struct sock_fprog filter = { | ||
| // sizeof insns / sizeof(insns[0]), | ||
| // insns | ||
| // }; | ||
|
|
||
| // if (once) | ||
| // return; | ||
| // once = 1; | ||
|
|
||
| // /* Patch bpflet for current identifier. */ | ||
| // insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htons(rts->ident), 0, 1); | ||
|
|
||
| // if (setsockopt(sock->fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter))) | ||
| // error(0, errno, _("WARNING: failed to install socket filter")); |
Contributor
There was a problem hiding this comment.
This doesn't seem necessary.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
RFC 8335 describes the use of extended echo requests to probe specific network interfaces. This PR adds the -e flag to the ping command to probe specific interfaces and receive responses from those interfaces. Functionality for RFC 8335 was recently included in Linux net-next.
Usage:
ping -4 -e [interface] [address]
Interface can be specified by name, index, or address.
Example:
ping -4 -e 1 192.168.1.201
PING 192.168.1.201 (192.168.1.201) 56(84) bytes of data.
64 bytes from 192.168.1.201: icmp_seq=263 ttl=64
64 bytes from 192.168.1.201: icmp_seq=519 ttl=64
64 bytes from 192.168.1.201: icmp_seq=775 ttl=64
--- 192.168.1.201 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss