The example uses sendmmsg() to send out a string "onetwo"
on a first datagram, where both halves originate from
distinct buffers and a second datagram contains "three",
coming from a single buffer.
Tested with netcat listening:
root@ubuntu:~# nc -l -u -p 1234
onetwothree
And tcpdump peeking:
root@ubuntu:~# tcpdump -c 2 -s 0 -X -ni lo tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
18:45:16.632134 IP 127.0.0.1.34715 > 127.0.0.1.1234: UDP, length 6
0x0000: 4500 0022 c21c 4000 4011 7aac 7f00 0001 E.."..@.@.z.....
0x0010: 7f00 0001 879b 04d2 000e fe21 6f6e 6574 ...........!onet
0x0020: 776f wo
18:45:16.633267 IP 127.0.0.1.34715 > 127.0.0.1.1234: UDP, length 5
0x0000: 4500 0021 c21d 4000 4011 7aac 7f00 0001 E..!..@.@.z.....
0x0010: 7f00 0001 879b 04d2 000d fe20 7468 7265 ............thre
0x0020: 65 e
2 packets captured
4 packets received by filter
0 packets dropped by kernel
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Some pieces inspired by an initial attempt by Stephan Mueller.
Reported-by: Stephan Mueller <stephan.mueller@atsec.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>