From nobody Mon Jun 14 02:41:04 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E438811CD52F for ; Mon, 14 Jun 2021 02:41:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G3G0c62xTz3lF5 for ; Mon, 14 Jun 2021 02:41:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8F484CBE for ; Mon, 14 Jun 2021 02:41:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 15E2f4XW016460 for ; Mon, 14 Jun 2021 02:41:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 15E2f47S016459 for bugs@FreeBSD.org; Mon, 14 Jun 2021 02:41:04 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 256587] tcpreplay not working for if_tun (tun0) Date: Mon, 14 Jun 2021 02:41:04 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: micolous+fbsd@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D256587 Bug ID: 256587 Summary: tcpreplay not working for if_tun (tun0) Product: Base System Version: 13.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: micolous+fbsd@gmail.com Created attachment 225789 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D225789&action= =3Dedit Packet captures from reproducing this issue (cap1.pcap, cap3.pcap, loopback.pcap) This is a repeat of Bug #198211. It appears that one cannot send packets t= o an if_tun interface using /dev/bpf. This was previously considered a possibility in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D198211#c1 and https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D198211#c3, but it does = not appear that any fix similar to https://cgit.freebsd.org/src/commit/?h=3Dstable/10&id=3D71ee29ab93aed361d27= 18ed46c557eeb0bfd88b8 was applied to if_tun.c (now if_tuntap.c): https://cgit.freebsd.org/src/tree/sys/net/if_tuntap.c?h=3Dstable/13#n1402 I think that applying the same fix to if_tuntap.c will fix this issue. ## Steps to reproduce: 1. Install tcpreplay with: pkg install tcpreplay 2. Start up a tunnel on tun0 where the remote side responds to ICMP echo requests. My tunnel was configured as: tun0: flags=3D8051 metric 0 mtu 1500 options=3D80000 inet 192.0.2.1 --> 192.0.2.2 netmask 0xffffff00 groups: tun nd6 options=3D29 Opened by PID 1144 3. Capture a trace on tun0: tcpdump -i tun0 -s 0 -n -w loopback.pcap 4. Generate some traffic on tun0: eg: ping -c3 192.0.2.2 5. Stop the capture, it should have some ICMP packets inside 6. Monitor traffic on tun0: tcpdump -i tun0 -s 0 -n -X 7. Replay the ICMP traffic with: tcpreplay --intf1=3Dtun0 loopback.pcap ## Expected behaviour: * All ICMP packets are correctly replayed through tun0 ## Actual behaviour: * One packet is sent with af=3D31 (pseudo_AF_HDRCMPLT), which is invalid (s= ee attached cap1.pcap) * tcpreplay reports several warnings: Warning: Unable to process unsupported DLT type: BSD loopback (0x0) Warning: Unable to send packet: Error with bpf send() [1]: Address family= not supported by protocol family (errno =3D 47) ## Attachments (in tun-tcpreplay.zip) * cap1.pcap: packet capture at reproduction step 5, using tun0 =E2=80=93 a = single packet is sent out the tun0 interface with af=3D31 * cap3.pcap: packet capture reproduction at step 5, but using lo0 =E2=80=93= this looks correct, but still issues the "unsupported DLT type" warning * loopback.pcap: packet capture at reproduction step 2 using tun0 =E2=80=93= three pairs of ICMP Echo requests and replies 192.0.2.1 -> 192.0.2.2 ## Versions: * FreeBSD 13.0 RELEASE on amd64 * tcpdump 4.9.3 * libpcap 1.9.1 * tcpreplay 4.3.3 --=20 You are receiving this mail because: You are the assignee for the bug.=