Bug 246108

Summary: uether (ue0) does not capture packets in promisc mode w/o IP address assigned
Product: Base System Reporter: Ed Maste <emaste>
Component: usbAssignee: freebsd-usb (Nobody) <usb>
Status: New ---    
Severity: Affects Only Me CC: tomek
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Ed Maste freebsd_committer freebsd_triage 2020-05-01 21:32:13 UTC
From dmesg:

ugen0.7: <ASIX Elec. Corp. AX88178> at usbus0
axe0 on uhub2
axe0: <0> on usbus0
miibus0: <MII bus> on axe0
rgephy0: <RTL8169S/8110S/8211 1000BASE-T media interface> PHY 1 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
ue0: <USB Ethernet> on axe0
ue0: Ethernet address: ##:##:##:##:##:##
ue0: link state changed to DOWN

The USB-Ethernet interface is connected to a source (HDMI-IP extender) that is continuously generating packets. Bring interface up:

# ifconfig ue0 up; ifconfig ue0
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80008<VLAN_MTU,LINKSTATE>
        ether 00:50:b6:1a:15:80
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Attempt to capture traffic for a few seconds, observe no packets received:

# tcpdump -ni ue0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue0, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

Assign an address:

# ifconfig ue0 10.0.0.1/24

Observe packets received by tcpdump:

# tcpdump -ni ue0 -c 5
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue0, link-type EN10MB (Ethernet), capture size 262144 bytes
17:31:03.055453 IP 192.168.1.238.5004 > 239.255.42.42.5004: UDP, length 0
17:31:03.056452 IP 192.168.1.238.5004 > 239.255.42.42.5004: UDP, length 0
17:31:03.057453 IP 192.168.1.238.5004 > 239.255.42.42.5004: UDP, length 0
17:31:03.058499 IP 192.168.1.238.5004 > 239.255.42.42.5004: UDP, length 0
17:31:03.059483 IP 192.168.1.238.5004 > 239.255.42.42.5004: UDP, length 0
5 packets captured
5 packets received by filter
0 packets dropped by kernel

amd64 on Lenovo X1 Carbon 7th gen, r360105+a579cace6430-c268079
Comment 1 Ed Maste freebsd_committer freebsd_triage 2020-05-02 01:16:10 UTC
Also reproducible with another ue:

muge0 on uhub3
muge0: <Microchip LAN7800, rev 3.10/3.00, addr 15> on usbus0
muge0: Chip ID 0x7800 rev 0002
miibus0: <MII bus> on muge0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto
ue0: <USB Ethernet> on muge0
ue0: Ethernet address: ##:##:##:##:##:##
Comment 2 Tomasz "CeDeROM" CEDRO 2020-05-02 12:24:38 UTC
Hello world :-)

The problem seems to be with IF UP and IF IP assignment:
* Onboard Ethernet can tcpdump after ifconfig up (no IP assigned).
* USB Ethernet needs to have IP assigned in addition to ifconfig up to tcpdump.
* Setting ifconfig em/ue ip also brings the interface up without "up" parameter!!!


root@0xCFMX4:~ # uname -a
FreeBSD 0xCFMX4 12.1-RELEASE-p3 FreeBSD 12.1-RELEASE-p3 GENERIC  amd64


1. Onboard Intel - looks like it needs to be only up, no IP assigned tcpdumps packets.

root@0xCFMX4:~ # dmesg|grep em0
em0: <Intel(R) PRO/1000 Network Connection> port 0xf080-0xf09f mem 0xf7300000-0xf731ffff,0xf7344000-0xf7344fff irq 20 at device 25.0 on pci0
em0: Using 1024 TX descriptors and 1024 RX descriptors
em0: Using an MSI interrupt
em0: Ethernet address: XXX
em0: netmap queues/slots: TX 1/1024, RX 1/1024
em0: link state changed to UP
em0: link state changed to DOWN
em0: link state changed to UP

root@0xCFMX4:~ # ifconfig em0 down delete
root@0xCFMX4:~ # ifconfig em0
em0: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=81249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER>
        ether XXX
        inet6 XXX%em0 prefixlen 64 tentative scopeid 0x1
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

root@0xCFMX4:~ # tcpdump -ni em0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on em0, link-type EN10MB (Ethernet), capture size 262144 bytes

^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig em0 1.2.3.4 up
root@0xCFMX4:~ # tcpdump -ni em0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on em0, link-type EN10MB (Ethernet), capture size 262144 bytes
13:37:29.046739 STP 802.1w, Rapid STP, Flags [Proposal], bridge-id 8000.XXX.8007, length 43
13:37:29.896857 IP XXX.5678 > 255.255.255.255.5678: UDP, length 120
13:37:29.896867 CDPv1, ttl: 120s, Device-ID 'XXX', length 87
13:37:29.896868 LLDP, length 105: XXX
^C
4 packets captured
4 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig em0 down delete
root@0xCFMX4:~ # tcpdump -ni em0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on em0, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig em0 up
root@0xCFMX4:~ # ifconfig em0
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=81249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER>
        ether XXX
        inet6 XXX%em0 prefixlen 64 scopeid 0x1
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
root@0xCFMX4:~ # tcpdump -ni em0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on em0, link-type EN10MB (Ethernet), capture size 262144 bytes
13:38:53.971397 STP 802.1w, Rapid STP, Flags [Learn, Forward], bridge-id 8000.XXX.8007, length 43
13:38:55.972179 STP 802.1w, Rapid STP, Flags [Learn, Forward], bridge-id 8000.XXX.8007, length 43
^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig em0 down delete
ifconfig: ioctl (SIOCDIFADDR): Can't assign requested address
root@0xCFMX4:~ # tcpdump -ni em0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on em0, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel
root@0xCFMX4:~ # ifconfig em0 1.2.3.4
root@0xCFMX4:~ # tcpdump -ni em0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on em0, link-type EN10MB (Ethernet), capture size 262144 bytes
14:16:44.987838 STP 802.1w, Rapid STP, Flags [Proposal], bridge-id 8000.XXX.8007, length 43
^C
1 packet captured
1 packet received by filter
0 packets dropped by kernel
root@0xCFMX4:~ # ifconfig em0
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=81249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER>
        ether XXX
        inet6 XXX%em0 prefixlen 64 scopeid 0x1
        inet 1.2.3.4 netmask 0xff000000 broadcast 1.255.255.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>



2. USB RTL driver GigaBit UNITEK 3xUSB3.0 HUB + GBE - needs an IP to tcpdump.

root@0xCFMX4:~ # usbconfig
(..)
ugen0.9: <Generic 4-Port USB 3.0 Hub> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.10: <Realtek USB 10/100/1000 LAN> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (72mA)


root@0xCFMX4:~ # dmesg|grep ue0
ue0: <USB Ethernet> on ure0
ue0: Ethernet address: XXX
ue0: link state changed to DOWN
ue0: link state changed to UP

root@0xCFMX4:~ # ifconfig ue0 down delete
root@0xCFMX4:~ # ifconfig ue0
ue0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether XXX
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

root@0xCFMX4:~ # tcpdump -ni ue0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue0, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue0 1.2.3.4 up
root@0xCFMX4:~ # tcpdump -ni ue0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue0, link-type EN10MB (Ethernet), capture size 262144 bytes
13:47:02.430378 STP 802.1w, Rapid STP, Flags [Learn, Forward], bridge-id 8000.XXX.8008, length 43
^C
1 packet captured
1 packet received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue0 down delete
root@0xCFMX4:~ # ifconfig ue0 up
root@0xCFMX4:~ # tcpdump -ni ue0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue0, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue0 1.2.3.4
root@0xCFMX4:~ # tcpdump -ni ue0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue0, link-type EN10MB (Ethernet), capture size 262144 bytes
13:47:56.477440 STP 802.1w, Rapid STP, Flags [Learn, Forward], bridge-id 8000.XXX.8008, length 43
^C
1 packet captured
1 packet received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue0 down delete
root@0xCFMX4:~ # ifconfig ue0 1.2.3.4
root@0xCFMX4:~ # tcpdump -ni ue0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue0, link-type EN10MB (Ethernet), capture size 262144 bytes
14:03:26.008995 STP 802.1w, Rapid STP, Flags [Proposal], bridge-id 8000.XXX.8008, length 43
^C
1 packet captured
1 packet received by filter
0 packets dropped by kernel
root@0xCFMX4:~ # ifconfig ue0
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether XXX
        inet 1.2.3.4 netmask 0xff000000 broadcast 1.255.255.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>




3. USB GBE AXGE "Manhattan USB 3.0 Gigabit Ethernet Adapter" - also needs IP to tcpdump.

root@0xCFMX4:~ # usbconfig
(..)
ugen0.11: <ASIX Elec. Corp. AX88179> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (124mA)


root@0xCFMX4:~ # dmesg|grep ue1
ue1: <USB Ethernet> on axge0
ue1: Ethernet address: XXX
ue1: link state changed to DOWN


root@0xCFMX4:~ # ifconfig ue1 down delete
ifconfig: ioctl (SIOCDIFADDR): Can't assign requested address
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue1 1.2.3.4 up
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
13:54:09.022119 STP 802.1w, Rapid STP, Flags [Proposal], bridge-id 8000.XXX.8008, length 47
13:54:10.573592 IP XXX.5678 > 255.255.255.255.5678: UDP, length 120
13:54:10.573601 CDPv1, ttl: 120s, Device-ID 'XXX'[|cdp]
13:54:10.573602 LLDP, length 109: XXX
13:54:10.845218 STP 802.1w, Rapid STP, Flags [Proposal], bridge-id 8000.XXX.8008, length 47
^C
5 packets captured
5 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue1 down delete
root@0xCFMX4:~ # ifconfig ue1 up
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
^V^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue1 1.2.3.4
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
13:55:34.931786 STP 802.1w, Rapid STP, Flags [Learn, Forward], bridge-id 8000.XXX.8008, length 47
^C
1 packet captured
1 packet received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue1 down delete
root@0xCFMX4:~ # ifconfig ue1 1.2.3.4
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
14:01:42.011043 STP 802.1w, Rapid STP, Flags [Proposal], bridge-id 8000.XXX.8008, length 47
14:01:42.140449 IP XXX.5678 > 255.255.255.255.5678: UDP, length 120
14:01:42.140459 CDPv1, ttl: 120s, Device-ID 'XXX'[|cdp]
14:01:42.140459 LLDP, length 109: XXX
^C
4 packets captured
4 packets received by filter
0 packets dropped by kernel
root@0xCFMX4:~ # ifconfig ue1
ue1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE>
        ether XXX
        inet 1.2.3.4 netmask 0xff000000 broadcast 1.255.255.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>



4. USB ASX "UNITEK USB2.0 GigaBit LAN" - also needs to have IP assigned to tcpdump.

root@0xCFMX4:~ # usbconfig
(..)
ugen0.11: <ASIX Elec. Corp. AX88178> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (250mA)

root@0xCFMX4:~ # ifconfig ue1 down delete
ifconfig: ioctl (SIOCDIFADDR): Can't assign requested address
root@0xCFMX4:~ # ifconfig ue1
ue1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80008<VLAN_MTU,LINKSTATE>
        ether XXX
        media: Ethernet autoselect (10baseT/UTP <half-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue1 1.2.3.4 up
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
14:08:10.001078 STP 802.1w, Rapid STP, Flags [none], bridge-id 8000.XXX.8008, length 43
14:08:10.110409 IP XXX > 255.255.255.255.5678: UDP, length 120
14:08:10.110665 CDPv1, ttl: 120s, Device-ID 'XXX', length 87
14:08:10.110669 LLDP, length 105: XXX
^C
4 packets captured
4 packets received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue1 down delete
root@0xCFMX4:~ # ifconfig ue1 up
^[[A^[[Aroot@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel
root@0xCFMX4:~ # ifconfig ue1 1.2.3.4
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
14:09:27.744604 STP 802.1w, Rapid STP, Flags [Learn, Forward], bridge-id 8000.XXX.8008, length 43
^C
1 packet captured
1 packet received by filter
0 packets dropped by kernel

root@0xCFMX4:~ # ifconfig ue1 down delete
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel
root@0xCFMX4:~ # ifconfig ue1 1.2.3.4
root@0xCFMX4:~ # tcpdump -ni ue1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ue1, link-type EN10MB (Ethernet), capture size 262144 bytes
14:10:25.127034 IP XXX > 255.255.255.255.5678: UDP, length 120
14:10:25.127276 CDPv1, ttl: 120s, Device-ID 'XXX', length 87
14:10:25.127278 LLDP, length 105: XXX
^C
3 packets captured
3 packets received by filter
0 packets dropped by kernel
root@0xCFMX4:~ # ifconfig ue1
ue1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80008<VLAN_MTU,LINKSTATE>
        ether XXX
        inet 1.2.3.4 netmask 0xff000000 broadcast 1.255.255.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>