Quote:
Originally Posted by shroman
Thank you, but the same behavior.
If I run tcpdump -w /home/user/test.txt -A -c 1 -Q in udp port 8012 in terminal, tcpdump captures 1-st packet. But runned from xinetd captures only second packet.
|
Hi,
the reason the 1st packet is not being captured is that you are discarding it

The 1st packet makes xinetd call your script, which in turn fires up tcpdump on default interface waiting to capture a total of 1 packet.
Meanwhile, the 1st packet is on STDIN, waiting to be used, but you are not telling anyone to use it, you are just preparing tcpdump ... for the
next packet, which arrives shortly after, causing:
- the 1st tcpdump process to capture on eth0, and write to file
- another tcpdump process to spawn, ready for yet another packet (what will be the 3rd packet)
Also, xinetd will actually mask all the connection details, giving you (on STD-in!)
only the payload.
So if you want to still use xinetd and inspect the payload, you might want to use simply this in your script:
Code:
#!/bin/bash
cat - >> /home/user/test.txt
HTH!
Bye!