[Bug 270559] if_bridge: do not forward packets properly for vlan 1

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 31 Mar 2023 04:29:38 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270559

            Bug ID: 270559
           Summary: if_bridge: do not forward packets properly for vlan 1
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: zlei@FreeBSD.org

A simple setup:

          jail0                         br0                       jail1         

+-----------------------+      +------------------+     
+------------------------+                              
|                       |      |                  |      |                     
  |                              
|   +------+    +-----+ |      | +-----+  +-----+ |      |  +-----+    +------+
  |                              
|   |vlan1 ------ep0b ------------ ep0a|  |ep1a -------------ep1b ------ vlan1|
  |                              
|   +------+    +-----+ |      | +-----+  +-----+ |      |  +-----+    +------+
  |                              
|192.168.1.1/24         |      |                  |      |         
192.168.1.2/24|                              
+-----------------------+      +------------------+     
+------------------------+ 


The test script:
```
#/bin/sh

# vlan id 1 is expected to fail this test
vid=1

ep0a=$( ifconfig epair create )
ep0b=${ep0a%a}b

ep1a=$( ifconfig epair create )
ep1b=${ep1a%a}b

br0=$( ifconfig bridge create )
ifconfig $br0 addm $ep0a addm $ep1a

ifconfig $ep0a up
ifconfig $ep1a up
ifconfig $br0 up

j0=$( jail -ic vnet persist )
j1=$( jail -ic vnet persist )

ifconfig $ep0b vnet $j0
ifconfig $ep1b vnet $j1

# load if_vlan.ko if not built into kernel
kldload -nq if_vlan

jexec $j0 ifconfig $ep0b up
jexec $j1 ifconfig $ep1b up

jexec $j0 ifconfig ${ep0b}.${vid} create
jexec $j1 ifconfig ${ep1b}.${vid} create

# Set ether address of $ep0b (untagged) same with ${ep1b}.${vid}
jexec $j1 ifconfig ${ep1b}.${vid} ether 02:09:a2:78:9a:bc
jexec $j0 ifconfig ${ep0b}        ether 02:09:a2:78:9a:bc
jexec $j0 ifconfig ${ep0b}.${vid} ether 02:09:a2:12:34:56

# Add ip address, will also populate $br0's fowarding table, by ARP
announcement
jexec $j0 ifconfig ${ep0b}.${vid} inet 192.168.1.1/24
jexec $j1 ifconfig ${ep1b}.${vid} inet 192.168.1.2/24

sleep 0.5
echo "======== jail $j0 ===================="
jexec $j0 ifconfig
echo "======== jail $j1 ===================="
jexec $j1 ifconfig

echo "======== learned addresses on $br0 ========"
ifconfig $br0 addr

echo "==== check contection ===="
jexec $j0 ping -t5 -c3 192.168.1.2

# This will trigger a mac flap (by ARP announcement)
jexec $j0 ifconfig $ep0b inet 192.168.2.1/24

sleep 0.5

echo "======== learned addresses on $br0 , after mac flap ===="
ifconfig $br0 addr

echo "======== re-check contection ========"
jexec $j0 ping -t5 -c3 192.168.1.2
rval=$?

jail -R $j1
jail -R $j0
ifconfig $br0 destroy
ifconfig $ep1a destroy
ifconfig $ep0a destroy

exit $rval
```

-- 
You are receiving this mail because:
You are the assignee for the bug.