diff options
Diffstat (limited to 'include/net/pkt_cls.h')
-rw-r--r-- | include/net/pkt_cls.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 50ea07969c09..a2441fb1428f 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -338,27 +338,27 @@ static inline int tcf_valid_offset(const struct sk_buff *skb, | |||
338 | #include <net/net_namespace.h> | 338 | #include <net/net_namespace.h> |
339 | 339 | ||
340 | static inline int | 340 | static inline int |
341 | tcf_change_indev(struct tcf_proto *tp, char *indev, struct nlattr *indev_tlv) | 341 | tcf_change_indev(struct net *net, struct nlattr *indev_tlv) |
342 | { | 342 | { |
343 | char indev[IFNAMSIZ]; | ||
344 | struct net_device *dev; | ||
345 | |||
343 | if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) | 346 | if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) |
344 | return -EINVAL; | 347 | return -EINVAL; |
345 | return 0; | 348 | dev = __dev_get_by_name(net, indev); |
349 | if (!dev) | ||
350 | return -ENODEV; | ||
351 | return dev->ifindex; | ||
346 | } | 352 | } |
347 | 353 | ||
348 | static inline int | 354 | static inline bool |
349 | tcf_match_indev(struct sk_buff *skb, char *indev) | 355 | tcf_match_indev(struct sk_buff *skb, int ifindex) |
350 | { | 356 | { |
351 | struct net_device *dev; | 357 | if (!ifindex) |
352 | 358 | return true; | |
353 | if (indev[0]) { | 359 | if (!skb->skb_iif) |
354 | if (!skb->skb_iif) | 360 | return false; |
355 | return 0; | 361 | return ifindex == skb->skb_iif; |
356 | dev = __dev_get_by_index(dev_net(skb->dev), skb->skb_iif); | ||
357 | if (!dev || strcmp(indev, dev->name)) | ||
358 | return 0; | ||
359 | } | ||
360 | |||
361 | return 1; | ||
362 | } | 362 | } |
363 | #endif /* CONFIG_NET_CLS_IND */ | 363 | #endif /* CONFIG_NET_CLS_IND */ |
364 | 364 | ||