[Bridge] [PATCH] Getting tagged frames through NF when untagged bridges exist

Bassem Armanyous <b_armanyous-/[email protected]>
Newsgroups gmane.linux.network.bridge,gmane.linux.network.bridge.ebtables.devel,gmane.linux.drivers.vlan
Message-ID <[email protected]>
Hello,

 This patch performs the same functionality of the patch I posted earlier in
the BRIDGE and VLAN mailing lists on Apr 5th, 2003. The earlier patch
reportedly caused an oops when running a kernel with vlan support compiled as a
module but not loaded. 

 I tested it against a 2.4.20 kernel patched with
ebtables-v2.0.003_vs_2.4.20.diff and bridge-nf-0.0.10-against-2.4.20.diff. I'll
try to create another patch against 2.4.22 patched with the latest
ebtables-brnf patch as soon as I can.

cheers,
B.


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

_______________________________________________
Bridge mailing list
Bridge-1hOE7TVs3WS9LbC4/[email protected]
http://www.math.leidenuniv.nl/mailman/listinfo/bridge
bridge-vlan-nf-0.0.2_vs_2.4.20.diff (application/octet-stream, 1.9 KB)
diff -urN linux-2.4.20-br-bds/net/8021q/vlan_dev.c linux-2.4.20-br-bds-patch/net/8021q/vlan_dev.c
--- linux-2.4.20-br-bds/net/8021q/vlan_dev.c	2002-11-29 01:53:15.000000000 +0200
+++ linux-2.4.20-br-bds-patch/net/8021q/vlan_dev.c	2003-08-19 01:22:43.000000000 +0300
@@ -37,6 +37,7 @@
 #include "vlanproc.h"
 #include <linux/if_vlan.h>
 #include <net/ip.h>
+#include <linux/if_bridge.h>
 
 /*
  *	Rebuild the Ethernet MAC header. This is called after an ARP
@@ -145,6 +146,17 @@
 	if (!skb->dev) {
 		spin_unlock_bh(&vlan_group_lock);
 
+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
+		/* check whether this frame should be bridged */
+		if (dev->br_port != NULL &&
+			br_handle_frame_hook != NULL) {
+
+			skb->dev = dev;
+			if (br_handle_frame_hook(skb) == 0)
+				return 0;
+		}
+#endif
+
 #ifdef VLAN_DEBUG
 		printk(VLAN_DBG "%s: ERROR: No net_device for VID: %i on dev: %s [%i]\n",
 			__FUNCTION__, (unsigned int)(vid), dev->name, dev->ifindex);
diff -urN linux-2.4.20-br-bds/net/core/dev.c linux-2.4.20-br-bds-patch/net/core/dev.c
--- linux-2.4.20-br-bds/net/core/dev.c	2003-04-06 00:30:03.000000000 +0200
+++ linux-2.4.20-br-bds-patch/net/core/dev.c	2003-08-19 01:45:45.000000000 +0300
@@ -91,6 +91,7 @@
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
 #include <linux/if_bridge.h>
+#include <linux/if_vlan.h>
 #include <linux/divert.h>
 #include <net/dst.h>
 #include <net/pkt_sched.h>
@@ -1452,10 +1453,13 @@
 	if (skb->dev->divert && skb->dev->divert->divert)
 		ret = handle_diverter(skb);
 #endif /* CONFIG_NET_DIVERT */
-			
+
 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
 	if (skb->dev->br_port != NULL &&
-	    br_handle_frame_hook != NULL) {
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+		(vlan_ioctl_hook == NULL || skb->protocol != __constant_ntohs(ETH_P_8021Q)) &&
+#endif
+		br_handle_frame_hook != NULL) {
 		int ret;
 
 		ret = handle_bridge(skb, pt_prev);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.