Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115918147
D45285.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45285.diff
View Options
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1715,10 +1715,20 @@
ifv->ifv_proto = proto;
if (ifv->ifv_vid != vid) {
+ int oldvid = ifv->ifv_vid;
+
/* Re-hash */
vlan_remhash(trunk, ifv);
ifv->ifv_vid = vid;
error = vlan_inshash(trunk, ifv);
+ if (error) {
+ int ret __diagused;
+
+ ifv->ifv_vid = oldvid;
+ /* Re-insert back where we found it. */
+ ret = vlan_inshash(trunk, ifv);
+ MPASS(ret == 0);
+ }
}
/* Will unlock */
goto done;
diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh
--- a/tests/sys/net/if_vlan.sh
+++ b/tests/sys/net/if_vlan.sh
@@ -297,6 +297,42 @@
vnet_cleanup
}
+atf_test_case "conflict_id" "cleanup"
+conflict_id_head()
+{
+ atf_set descr 'Test conflicting VLAN IDs, PR #279195'
+ atf_set require.user root
+}
+
+conflict_id_body()
+{
+ vnet_init
+
+ epair=$(vnet_mkepair)
+
+ vnet_mkjail alcatraz ${epair}b
+ vlan_a=$(jexec alcatraz ifconfig vlan create)
+ vlan_b=$(jexec alcatraz ifconfig vlan create)
+
+ jexec alcatraz ifconfig ${vlan_a} vlan 100 vlandev ${epair}b
+ jexec alcatraz ifconfig ${vlan_b} vlan 101 vlandev ${epair}b
+
+ atf_check -s exit:1 -o ignore -e ignore \
+ jexec alcatraz ifconfig ${vlan_a} vlan 101
+
+ atf_check -s exit:0 -o match:"vlan: 100" \
+ jexec alcatraz ifconfig ${vlan_a}
+
+ atf_check -s exit:0 -o ignore -e ignore \
+ jexec alcatraz ifconfig ${vlan_a} vlan 100
+}
+
+conflict_id_cleanup()
+{
+ vnet_cleanup
+
+}
+
atf_init_test_cases()
{
atf_add_test_case "basic"
@@ -306,4 +342,5 @@
atf_add_test_case "qinq_dot"
atf_add_test_case "qinq_setflags"
atf_add_test_case "bpf_pcp"
+ atf_add_test_case "conflict_id"
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 1, 9:52 AM (11 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17878897
Default Alt Text
D45285.diff (1 KB)
Attached To
Mode
D45285: if_vlan: handle VID conflicts
Attached
Detach File
Event Timeline
Log In to Comment