diff options
-rw-r--r-- | include/linux/filter.h | 3 | ||||
-rw-r--r-- | net/core/filter.c | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index 673e5677ebcc..b6ea9aa9e853 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -121,7 +121,8 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */ | |||
121 | #define SKF_AD_PROTOCOL 0 | 121 | #define SKF_AD_PROTOCOL 0 |
122 | #define SKF_AD_PKTTYPE 4 | 122 | #define SKF_AD_PKTTYPE 4 |
123 | #define SKF_AD_IFINDEX 8 | 123 | #define SKF_AD_IFINDEX 8 |
124 | #define SKF_AD_MAX 12 | 124 | #define SKF_AD_NLATTR 12 |
125 | #define SKF_AD_MAX 16 | ||
125 | #define SKF_NET_OFF (-0x100000) | 126 | #define SKF_NET_OFF (-0x100000) |
126 | #define SKF_LL_OFF (-0x200000) | 127 | #define SKF_LL_OFF (-0x200000) |
127 | 128 | ||
diff --git a/net/core/filter.c b/net/core/filter.c index bbb53c69857c..f5f3cf603064 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/if_packet.h> | 27 | #include <linux/if_packet.h> |
28 | #include <net/ip.h> | 28 | #include <net/ip.h> |
29 | #include <net/protocol.h> | 29 | #include <net/protocol.h> |
30 | #include <net/netlink.h> | ||
30 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
31 | #include <net/sock.h> | 32 | #include <net/sock.h> |
32 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
@@ -303,6 +304,22 @@ load_b: | |||
303 | case SKF_AD_IFINDEX: | 304 | case SKF_AD_IFINDEX: |
304 | A = skb->dev->ifindex; | 305 | A = skb->dev->ifindex; |
305 | continue; | 306 | continue; |
307 | case SKF_AD_NLATTR: { | ||
308 | struct nlattr *nla; | ||
309 | |||
310 | if (skb_is_nonlinear(skb)) | ||
311 | return 0; | ||
312 | if (A > skb->len - sizeof(struct nlattr)) | ||
313 | return 0; | ||
314 | |||
315 | nla = nla_find((struct nlattr *)&skb->data[A], | ||
316 | skb->len - A, X); | ||
317 | if (nla) | ||
318 | A = (void *)nla - (void *)skb->data; | ||
319 | else | ||
320 | A = 0; | ||
321 | continue; | ||
322 | } | ||
306 | default: | 323 | default: |
307 | return 0; | 324 | return 0; |
308 | } | 325 | } |