tcpreplay icon indicating copy to clipboard operation
tcpreplay copied to clipboard

Allow to select different types of raw sockets

Open do11 opened this issue 7 years ago • 2 comments

You are using PF_PACKET socket by default, but they are bypassing Linux IP stack, iptables, etc. It would be more useful if you allow user to select type of socket which is used to sink packets, such as PF_INET sockets. See http://lists.netfilter.org/pipermail/netfilter-devel/2003-March/010845.html

For example, I ping other box and iptables sees this packet. I capture this packet on source host with tcpdump -w and then tcpreplay it on the same host, this time iptables does not see the packet.

do11 avatar Feb 09 '18 23:02 do11

I suspected that this wouldn't work, but proved it in PR #511. I'm unable to get the stack to send raw packets that are not decorated with proper source mac/IP.

Here is how far I got ...

sudo src/tcpreplay -i ens33 -v --multiplier=10 --raw -K ping_reply.pcap                                    Enhancement_#469_POC_raw_sockets ✭ ◼
File Cache is enabled
reading from file -, link-type EN10MB (Ethernet)
13:41:40.1540154500 IP 172.16.230.1 > 172.16.230.200: ICMP echo reply, id 50176, seq 10, length 64
Warning in send_packets.c:send_packets() line 646:
Unable to send packet: Error with PF_PACKET send() [1]: Destination address required (errno = 89)
13:41:45.1540154505 IP 172.16.230.1 > 172.16.230.200: ICMP echo reply, id 50176, seq 11, length 64
Warning in send_packets.c:send_packets() line 646:
Unable to send packet: Error with PF_PACKET send() [2]: Destination address required (errno = 89)
13:41:50.1540154510 IP 172.16.230.1 > 172.16.230.200: ICMP echo reply, id 50176, seq 12, length 64
Warning in send_packets.c:send_packets() line 646:
Unable to send packet: Error with PF_PACKET send() [3]: Destination address required (errno = 89)
^C User interrupt...
sendpacket_abort
tcpdump: pcap_loop: error reading dump file: Interrupted system call

fklassen avatar Oct 24 '18 22:10 fklassen

Reopen as per discussion in pr #511. Looking for help to test feature, document and to volunteer for support. Some dev work to help debug and enhance the feature would also be appreciated.

fklassen avatar Oct 26 '18 20:10 fklassen