Did you notice this strange output with bridge and span on 15.0-RELEASE?

Hi,

I noticed that when you add a span interface to a bridge, ifconfig doesn't display the bridge members anymore.

Under 14.3-RELEASE:
Code:
# ifconfig bridge0 create
# ifconfig bridge0 addm re0 span vr0
# ifconfig bridge0
bridge0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    options=0
    ether 58:9c:fc:10:d2:2f
    id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
    maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
    root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
    member: re0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 1 priority 128 path cost 55
    member: vr0 flags=8<SPAN>
            ifmaxaddr 0 port 2 priority 128 path cost 55
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>
#

Under 15.0-RELEASE:
Code:
# ifconfig bridge0 create
# ifconfig bridge0 addm re0
# ifconfig bridge0
bridge0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    options=10<VLAN_HWTAGGING>
    ether 44:8a:5b:59:8b:35
    id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
    maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
    root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
    bridge flags=0<>
    member: re0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            port 1 priority 128 path cost 55 vlan protocol 802.1q
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>
# ifconfig bridge0 span vr0
# ifconfig bridge0
bridge0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    options=10<VLAN_HWTAGGING>
    ether 44:8a:5b:59:8b:35
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>
#

You can also see the strange bridge flags=0<> when there is just a normal member in the bridge.

Can anyone confirm this weird behaviour (as for me, it's a bug)?

Note: you can create some tap and use them if you don't want to touch the physical interfaces.
 
I'm disappointed that no one took the time to verify this problem. I guess that few people use span interfaces.

Anyway, I made a PR 292634 and wrote a patch for solving this issue. It's probably a very ancient (and more serious than I was thinking) bug. I see it just now because of the VLAN update on the FreeBSD network stack.
 
Hello Emrion,
I do confirm you analysis using FreeBSD 15.0-RELEASE-p5 FreeBSD 15.0-RELEASE-p5 GENERIC amd64. I used /etc/rc.conf

ifconfig_bridge0="addm igb1 addm igb2 up"
ifconfig_igb1="up"
ifconfig_igb2="up"
#ifconfig_bridge0="span igb3"

as long as :
ifconfig_bridge0="span igb3"

I have :
# ifconfig bridge0
bridge0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=10<VLAN_HWTAGGING>
ether 58:9c:fc:10:d3:f9
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
bridge flags=0<>
member: igb2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
port 3 priority 128 path cost 20000 vlan protocol 802.1q
member: igb1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
port 2 priority 128 path cost 20000 vlan protocol 802.1q
groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>

when I activate the span I get :
# ifconfig bridge0 span igb3
# ifconfig bridge0
bridge0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=10<VLAN_HWTAGGING>
ether 58:9c:fc:10:d3:f9
groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>

Using tcpdump on "igb2" does not show the right traffic anymore.

I modified the if_bridge.c source
# ls -alt /usr/src/sys/net/if_bridge.c
-rw-r--r-- 1 root wheel 114602 Apr 18 11:01 /usr/src/sys/net/if_bridge.c

I recompiled the module
# ls -alt /usr/obj/usr/src/amd64.amd64/sys/modules/if_bridge
total 160
drwxrwxr-x 2 root wheel 512 Apr 18 11:07 .
-rw-r--r-- 1 root wheel 68104 Apr 18 11:07 if_bridge.ko
-rw-r--r-- 1 root wheel 0 Apr 18 11:07 export_syms
-rw-r--r-- 1 root wheel 62192 Apr 18 11:07 if_bridge.o

I copied the if_bridge.ko module to /boot/kernel
/boot/kernel # ls -alt if_bri*
-r--r--r-- 2 root wheel 68104 Apr 18 13:45 if_bridge.ko
-r--r--r-- 1 root wheel 90424 Apr 18 13:45 if_bridge.ko.old
-rw-r--r-- 1 root wheel 68104 Apr 18 13:44 if_bridge.ko.new

but the issue is still the there
/boot/kernel # ifconfig bridge0
bridge0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=10<VLAN_HWTAGGING>
ether 58:9c:fc:10:d3:f9
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
bridge flags=0<>
member: igb2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
port 3 priority 128 path cost 20000 vlan protocol 802.1q
member: igb1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
port 2 priority 128 path cost 20000 vlan protocol 802.1q
groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>
root@apu6b4-01:/boot/kernel # Apr 18 13:46:34 apu6b4-01 syslogd: last message repeated 1 times

/boot/kernel # ifconfig bridge0 span igb3
/boot/kernel # ifconfig bridge0
bridge0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=10<VLAN_HWTAGGING>
ether 58:9c:fc:10:d3:f9
groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>

and the bridge stops working as soon as the "span" is issued.
 
You modified the source but how, with the patch I put on the PR?
Because, it works well on my test machine. So, you made a mistake somewhere.
Did you reboot?

Code:
$ ifconfig bridgeLOCAL
bridgeLOCAL: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    options=10<VLAN_HWTAGGING>
    ether 44:8a:5b:59:8b:35
    inet 192.168.5.9 netmask 0xffffff00 broadcast 192.168.5.255
    id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
    maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
    root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
    bridge flags=0<>
    member: re0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            port 1 priority 128 path cost 55 vlan protocol 802.1q
    member: vr0 flags=8<SPAN>
            port 2 priority 128 path cost 55 vlan protocol 802.1q
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>
 
On a genuine 15.0-RELEASE-p5, before patching:
Code:
# ifconfig bridge create
bridge0
# ifconfig tap create
tap0
# ifconfig bridge0 addm em0
# ifconfig bridge0
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=10<VLAN_HWTAGGING>
        ether 58:9c:fc:10:ab:d7
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0
        bridge flags=0<>
        member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                port 1 priority 128 path cost 20000 vlan protocol 802.1q
        groups: bridge
        nd6 options=9<PERFORMNUD,IFDISABLED>
# ifconfig bridge0 span tap0
# ifconfig bridge0
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=10<VLAN_HWTAGGING>
        ether 58:9c:fc:10:ab:d7
        groups: bridge
        nd6 options=9<PERFORMNUD,IFDISABLED>

Applying the patch:
Code:
# cd /usr/src
# git apply 0001-modifi-sys-net-if_bridge.c.patch
# cd sys/modules/if_bridge
# make
# cp /boot/kernel/if_bridge.ko /boot/kernel/if_bridge.ko.sav
# cd /usr/obj/usr/src/amd64.amd64/sys/modules/if_bridge
# cp if_bridge.ko /boot/kernel/

Load the new module (or reboot):
Code:
# ifconfig bridge0 destroy
# kldunload if_bridge
# kldload if_bridge
# ifconfig bridge0 create
# ifconfig bridge0 addm em0 span tap0
# ifconfig bridge0
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=10<VLAN_HWTAGGING>
        ether 58:9c:fc:10:ab:d7
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0
        bridge flags=0<>
        member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                port 1 priority 128 path cost 20000 vlan protocol 802.1q
        member: tap0 flags=8<SPAN>
                port 4 priority 128 path cost 20000 vlan protocol 802.1q
        groups: bridge
        nd6 options=9<PERFORMNUD,IFDISABLED>

By the way, this patch never get committed. Sure, the display of ifconfig isn't that important, but the bug is more insidious than that. For the moment, a span member isn't a member from the driver point of view... :oops:
 
Pretty sad to see this uncommitted. There seems to be a problem with PR's on FreeBSD.
Nobody gives two hoots.

Then on top of a providing a patch you are requested to do something else. Then it still does not get committed.

To make it easier for committers to apply the patches and merge them, please use git and run `git format-patch @~1`, that makes it most convenient.

I have seen this with multiple PR's. Add more work then don't commit it. Very poor form. It is very discouraging to people submitting bug patches.
 
Note that a commit in branch main now fix this bug, but not the way I did. Dev prefers to leave the driver code untouched. Instead, no VLAN config is done on span members (which is a good thing, I think).

It remains the ambiguity of what is a bridge member for the driver. On one side, the driver accepts span members, but if you ask if it is a member, it answer no (well, NULL in fact).
 
Back
Top