https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198211
Bug ID: 198211 Summary: tcpreplay not working for lo0 Product: Base System Version: 10.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: hol...@freyther.de Attachment #153698 maintainer-approval? Flags: Created attachment 153698 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=153698&action=edit Check for pseudo_AF_HDRCMPLT to allow tcpreplay on loopback Capturing a pcap file for loopback/null encapsulation and then replaying with tcpreplay doesn't work. Reproduce: * Capture a trace on lo0 e.g. tcpdump -i lo0 -s 0 -n -w loopback.pcap * echo "bla" | nc localhost 1234 * Stop the capture. It has two packages.. the UDP message and ICMP * Install tcpreplay with pkg install tcpreplay * Monitor loopback for traffic tcpdump -i lo0 -s 0 -n -X * Replay with tcpreplay --intf1=lo0 loopback.pcap Expectation: * Replayed packets arriving on the loopback device Outcome: * $ dmesg looutput: af=31 unexpected looutput: af=31 unexpected Reason: tcpreplay is using libpcap for replay and is setting the complete header field open("/dev/bpf0",O_RDWR,00) = 3 (0x3) ioctl(3,BIOCVERSION,0xbfbfe7c8) = 0 (0x0) ioctl(3,BIOCSETIF,0xbfbfe7d0) = 0 (0x0) ioctl(3,BIOCGDLT,0xbfbfe7c4) = 0 (0x0) ioctl(3,BIOCSHDRCMPLT,0xbfbfe7c0) = 0 (0x0) ioctl(3,BIOCGDLT,0xbfbfe808) = 0 (0x0) This means that in bpf.c:bpfwrite if (d->bd_hdrcmplt) dst.sa_family = pseudo_AF_HDRCMPLT; will be executed but in if_loop.c:looutput /* BPF writes need to be handled specially. */ if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else af = dst->sa_family; will be checked. This means that the local variable "af" will contain pseudo_AF_HDRCMPLT which is not handled in the switch. Proposal. Change the check from AF_UNSPEC to pseudo_AF_HDRCMPLT or at least check for pseudo_AF_HDRCMPLT as well. -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"