patch-2.0.4 linux/net/bridge/br.c

Next file: linux/net/ipv4/af_inet.c
Previous file: linux/net/Config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.3/linux/net/bridge/br.c linux/net/bridge/br.c
@@ -1052,6 +1052,7 @@
 int br_receive_frame(struct sk_buff *skb)	/* 3.5 */
 {
 	int port;
+	int i;
 	
 	if (br_stats.flags & BR_DEBUG)
 		printk("br_receive_frame: ");
@@ -1130,6 +1131,8 @@
 					port_info[port].dev->dev_addr, 
 					ETH_ALEN) == 0) 
 			{
+				/* Packet is for us */
+				skb->pkt_type = PACKET_HOST;
 				return(0);	/* pass frame up our stack (this will */
 						/* happen in net_bh() in dev.c) */
 			}
@@ -1159,6 +1162,13 @@
 		printk(KERN_CRIT "br_tx_frame: no skb!\n");
 		return(0);
 	}
+	
+	if (!skb->dev)
+	{
+		printk(KERN_CRIT "br_tx_frame: no dev!\n");
+		return(0);
+	}
+	
 	/* check for loopback */
 	if (skb->dev->flags & IFF_LOOPBACK)
 		return(0);
@@ -1289,7 +1299,7 @@
 		/*
 		 *	Send flood and drop.
 		 */
-		if (!f | !(f->flags & FDB_ENT_VALID)) {
+		if (!f || !(f->flags & FDB_ENT_VALID)) {
 		 	/* not found; flood all ports */
 			br_flood(skb, port);
 			return(br_dev_drop(skb));
@@ -1354,9 +1364,15 @@
 		if (port_info[i].state == Forwarding) 
 		{
 			nskb = skb_clone(skb, GFP_ATOMIC);
+			if(nskb==NULL)
+				continue;
 			/* mark that's we've been here... */
 			nskb->pkt_bridged = IS_BRIDGED;
-			nskb->arp = skb->arp;
+			/* Send to each port in turn */
+			nskb->dev= port_info[i].dev;
+			/* To get here we must have done ARP already,
+			   or have a received valid MAC header */
+			nskb->arp = 1;
 			
 /*			printk("Flood to port %d\n",i);*/
 			nskb->h.raw = nskb->data + ETH_HLEN;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov