From: Jamal Hadi Salim <[EMAIL PROTECTED]>
Date: Mon, 25 Jul 2005 09:50:33 -0400

> ----
>  if (!skb->input_dev) 
>               skb->input_dev = skb->dev->ifindex;
> -----
> 
> We get rid of the printk and all other places that set input_dev except
> for mirred.
> Any new actions can continue to set it if they wish to. I will adapt 
> some of the actions i have not yet submitted to this scheme.

Ok, so can we agree on the following patch?  ing_filter() should
never see a NULL ->input_dev, and we could add a BUG() check
there for that invariant if you want.

It seems like the skb->input_dev NULL check in act_api.c could
be eliminated, but I'm not so sure of that, can't that code get
called in the output path as well?

diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1786,7 +1786,6 @@ isdn_net_receive(struct net_device *ndev
                lp->stats.rx_bytes += skb->len;
        }
        skb->dev = ndev;
-       skb->input_dev = ndev;
        skb->pkt_type = PACKET_HOST;
        skb->mac.raw = skb->data;
 #ifdef ISDN_DEBUG_NET_DUMP
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -1177,7 +1177,6 @@ isdn_ppp_push_higher(isdn_net_dev * net_
                mlp->huptimer = 0;
 #endif /* CONFIG_IPPP_FILTER */
        skb->dev = dev;
-       skb->input_dev = dev;
        skb->mac.raw = skb->data;
        netif_rx(skb);
        /* net_dev->local->stats.rx_packets++; done in isdn_net.c */
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1657,7 +1657,6 @@ ppp_receive_nonmp_frame(struct ppp *ppp,
                        skb->dev = ppp->dev;
                        skb->protocol = htons(npindex_to_ethertype[npi]);
                        skb->mac.raw = skb->data;
-                       skb->input_dev = ppp->dev;
                        netif_rx(skb);
                        ppp->dev->last_rx = jiffies;
                }
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -352,10 +352,10 @@ tcf_change_indev(struct tcf_proto *tp, c
 static inline int
 tcf_match_indev(struct sk_buff *skb, char *indev)
 {
-       if (0 != indev[0]) {
-               if  (NULL == skb->input_dev)
+       if (indev[0]) {
+               if  (!skb->input_dev)
                        return 0;
-               else if (0 != strcmp(indev, skb->input_dev->name))
+               if (strcmp(indev, skb->input_dev->name))
                        return 0;
        }
 
diff --git a/include/net/x25device.h b/include/net/x25device.h
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -8,7 +8,6 @@
 static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device 
*dev)
 {
        skb->mac.raw = skb->data;
-       skb->input_dev = skb->dev = dev;
        skb->pkt_type = PACKET_HOST;
        
        return htons(ETH_P_X25);
diff --git a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1537,17 +1537,14 @@ static int ing_filter(struct sk_buff *sk
                __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd);
                if (MAX_RED_LOOP < ttl++) {
                        printk("Redir loop detected Dropping packet (%s->%s)\n",
-                               
skb->input_dev?skb->input_dev->name:"??",skb->dev->name);
+                               skb->input_dev->name, skb->dev->name);
                        return TC_ACT_SHOT;
                }
 
                skb->tc_verd = SET_TC_RTTL(skb->tc_verd,ttl);
 
                skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS);
-               if (NULL == skb->input_dev) {
-                       skb->input_dev = skb->dev;
-                       printk("ing_filter:  fixed  %s out 
%s\n",skb->input_dev->name,skb->dev->name);
-               }
+
                spin_lock(&dev->ingress_lock);
                if ((q = dev->qdisc_ingress) != NULL)
                        result = q->enqueue(skb, q);
@@ -1573,6 +1570,9 @@ int netif_receive_skb(struct sk_buff *sk
        if (!skb->stamp.tv_sec)
                net_timestamp(&skb->stamp);
 
+       if (!skb->input_dev)
+               skb->input_dev = skb->dev;
+
        orig_dev = skb_bond(skb);
 
        __get_cpu_var(netdev_rx_stat).total++;
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -163,7 +163,6 @@ __be16 eth_type_trans(struct sk_buff *sk
        skb->mac.raw=skb->data;
        skb_pull(skb,ETH_HLEN);
        eth = eth_hdr(skb);
-       skb->input_dev = dev;
        
        if(*eth->h_dest&1)
        {
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to