Page MenuHomeFreeBSD

ping: tests: Add test for D59556
AcceptedPublic

Authored by jlduran on Fri, Sep 11, 3:25 AM.
Tags
None
Referenced Files
F172319743: D59582.id186419.diff
Thu, Sep 17, 5:16 PM
F172221652: D59582.diff
Wed, Sep 16, 11:49 PM
F172221635: D59582.diff
Wed, Sep 16, 11:49 PM
F172221417: D59582.diff
Wed, Sep 16, 11:46 PM
Unknown Object (File)
Tue, Sep 15, 8:41 PM
Unknown Object (File)
Tue, Sep 15, 3:28 AM
Unknown Object (File)
Mon, Sep 14, 8:24 PM
Unknown Object (File)
Mon, Sep 14, 1:08 PM
Subscribers

Details

Reviewers
maxim

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76761
Build 73644: arc lint + arc unit

Event Timeline

Hi Jose,

Appreciate your help on this!

I published a kernel patch here (it seems it is not possible to upload a random file here): https://maximk.net/stuff/ip_icmp.c.diff

After you recompile and reinstalled the kernel please do the following:

sysctl net.inet.icmp.maskrepl=1
sysctl net.inet.icmp.debug_trunclen=60
ping -c1 -v -Mm 127.0.0.1
sysctl net.inet.icmp.debug_trunclen=68
ping -c1 -v -Mt 127.0.0.1

trunclen here means how many bytes we are going to strip from the end of the icmp reply. With a standard payload of 56 bytes and trunclen = 60 we are going to remove the payload and 4 bytes that store a mask. trunclen 68 will remove the same 56 bytes of the payload + 4 bytes * 3 timeval's. In this case you will see some stack garbage in the output, e.g.,

$ ping -c1 -v -Mm 127.0.0.1
ICMP_MASKREQ
PING 127.0.0.1 (127.0.0.1): 56 data bytes
8 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=806371.399 ms mask=96.146.7.33
wrong total length 28 instead of 88

!--- 127.0.0.1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 806371.399/806371.399/806371.399/0.000 ms

You can notice a weird mask (hope it doesn't reveal any sensitive info from my testing box!) and also timing stats is corrupted as we stripped the payload.

$ sudo sysctl net.inet.icmp.debug_trunclen=68
net.inet.icmp.debug_trunclen: 60 -> 68

$ ping -c1 -v -Mt 127.0.0.1
ICMP_TSTAMP
PING 127.0.0.1 (127.0.0.1): 56 data bytes
8 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=1162811.427 ms tso=971:40:31 tsr=37:16:57 tst=48:01:57
wrong total length 28 instead of 96

!--- 127.0.0.1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1162811.427/1162811.427/1162811.427/0.000 ms

Same stuff but garbage tso/tsr/tst and broken timing stats.

A fixed ping does something like that:

$ ping-fixed -c1 -v -M t 127.0.0.1
ICMP_TSTAMP
PING 127.0.0.1 (127.0.0.1): 56 data bytes
ping-fixed: truncated timestamp reply (8 bytes) from 127.0.0.1
^C
!--- 127.0.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss

Please ping me (a pun intended) if you need any help with that, I am happy to help.

Please don't run this patch in production.

Maxim

This revision is now accepted and ready to land.Thu, Sep 17, 12:36 AM