-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add RFC 8335 (Probe) Request and Response Functionality #328
base: master
Are you sure you want to change the base?
Conversation
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.
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?
// 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")); |
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.
This doesn't seem necessary.
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