]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/net/pkt_cls.h
net: Move prototype declaration to header file include/net/datalink.h from net/ipx...
[karo-tx-linux.git] / include / net / pkt_cls.h
index 50ea07969c0999b1307b6c4ef053958f13af4b34..a2441fb1428f3f2e181df63319ca2b3fdc15dc4e 100644 (file)
@@ -338,27 +338,27 @@ static inline int tcf_valid_offset(const struct sk_buff *skb,
 #include <net/net_namespace.h>
 
 static inline int
-tcf_change_indev(struct tcf_proto *tp, char *indev, struct nlattr *indev_tlv)
+tcf_change_indev(struct net *net, struct nlattr *indev_tlv)
 {
+       char indev[IFNAMSIZ];
+       struct net_device *dev;
+
        if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ)
                return -EINVAL;
-       return 0;
+       dev = __dev_get_by_name(net, indev);
+       if (!dev)
+               return -ENODEV;
+       return dev->ifindex;
 }
 
-static inline int
-tcf_match_indev(struct sk_buff *skb, char *indev)
+static inline bool
+tcf_match_indev(struct sk_buff *skb, int ifindex)
 {
-       struct net_device *dev;
-
-       if (indev[0]) {
-               if  (!skb->skb_iif)
-                       return 0;
-               dev = __dev_get_by_index(dev_net(skb->dev), skb->skb_iif);
-               if (!dev || strcmp(indev, dev->name))
-                       return 0;
-       }
-
-       return 1;
+       if (!ifindex)
+               return true;
+       if  (!skb->skb_iif)
+               return false;
+       return ifindex == skb->skb_iif;
 }
 #endif /* CONFIG_NET_CLS_IND */