Thread (87 messages) 87 messages, 6 authors, 2006-07-09

Re: [PATCH 2/3] [VLAN]: Update iif when receiving via VLAN device

From: jamal <hidden>
Date: 2006-06-30 21:09:30

Ok, I think found the last patch you posted, comments below (I have to
run off soon):

On Fri, 2006-30-06 at 19:13 +0200, Thomas Graf wrote:
There you go, leaves ifb broken as-is, at least prevents it
from crashing randomly when the input_dev disappears.
I hope the above comment does show up in the logs ;->
[NET]: Use interface index to keep input device information
quoted hunk ↗ jump to hunk
===================================================================
--- net-2.6.git.orig/include/net/pkt_cls.h
+++ net-2.6.git/include/net/pkt_cls.h
@@ -352,14 +352,19 @@ tcf_change_indev(struct tcf_proto *tp, c
 static inline int
 tcf_match_indev(struct sk_buff *skb, char *indev)
 {
+	int ret = 1;
+
 	if (indev[0]) {
-		if  (!skb->input_dev)
-			return 0;
-		if (strcmp(indev, skb->input_dev->name))
+		struct net_device *dev;
+
+		dev = dev_get_by_index(skb->iif);
+		if  (!dev)
 			return 0;
+		ret = !strcmp(indev, dev->name);
+		dev_put(dev);
 	}
 
[..]
quoted hunk ↗ jump to hunk
Index: net-2.6.git/drivers/net/ifb.c
===================================================================
--- net-2.6.git.orig/drivers/net/ifb.c
+++ net-2.6.git/drivers/net/ifb.c
@@ -158,19 +158,23 @@ static int ifb_xmit(struct sk_buff *skb,
 	stats->tx_packets++;
 	stats->tx_bytes+=skb->len;
 
-	if (!from || !skb->input_dev) {
+	if (!from || !skb->iif) {
Can you have something similar to what you did in
tcf_match_indev above?

i.e grab dev by skb->iif so as to increment refcount - if it doesnt
exist it becomes equivalent to !skb->input_dev and if it exists you drop
the ref inside the else below after changing input_dev 
 		dev_kfree_skb(skb);
 		stats->rx_dropped++;
 		return ret;
 	} else {
+		struct net_device *iif;
 		/* 
 		 * note we could be going
 		 * ingress -> egress or
 		 * egress -> ingress
 		*/
-		skb->dev = skb->input_dev;
-		skb->input_dev = dev;
+		iif = __dev_get_by_index(skb->iif);
+		if (!iif)
+			goto dropped;
+		skb->dev = iif;
+		skb->iif = dev->ifindex;
 		if (from & AT_INGRESS) {
 			skb_pull(skb, skb->dev->hard_header_len);
 		} else {
-
cheers,
jamal
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help