Skip to content

Add RFC 8335 (Probe) Request and Response Functionality - #328

Open
slang21 wants to merge 1 commit into
iputils:masterfrom
Juniper-Clinic-2020:master_rebase
Open

slang21 wants to merge 1 commit into
iputils:masterfrom
Juniper-Clinic-2020:master_rebase

Conversation

@slang21

@slang21 slang21 commented Apr 29, 2021

Copy link
Copy Markdown

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

@nmeyerhans nmeyerhans left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread ping/ping.c
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"));

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants