diff options
| -rw-r--r-- | net/netfilter/xt_pkttype.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/net/netfilter/xt_pkttype.c b/net/netfilter/xt_pkttype.c index 3ac703b5cb8f..d2f5320a80bf 100644 --- a/net/netfilter/xt_pkttype.c +++ b/net/netfilter/xt_pkttype.c | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | #include <linux/skbuff.h> | 9 | #include <linux/skbuff.h> |
| 10 | #include <linux/if_ether.h> | 10 | #include <linux/if_ether.h> |
| 11 | #include <linux/if_packet.h> | 11 | #include <linux/if_packet.h> |
| 12 | #include <linux/in.h> | ||
| 13 | #include <linux/ip.h> | ||
| 12 | 14 | ||
| 13 | #include <linux/netfilter/xt_pkttype.h> | 15 | #include <linux/netfilter/xt_pkttype.h> |
| 14 | #include <linux/netfilter/x_tables.h> | 16 | #include <linux/netfilter/x_tables.h> |
| @@ -28,9 +30,17 @@ static int match(const struct sk_buff *skb, | |||
| 28 | unsigned int protoff, | 30 | unsigned int protoff, |
| 29 | int *hotdrop) | 31 | int *hotdrop) |
| 30 | { | 32 | { |
| 33 | u_int8_t type; | ||
| 31 | const struct xt_pkttype_info *info = matchinfo; | 34 | const struct xt_pkttype_info *info = matchinfo; |
| 32 | 35 | ||
| 33 | return (skb->pkt_type == info->pkttype) ^ info->invert; | 36 | if (skb->pkt_type == PACKET_LOOPBACK) |
| 37 | type = (MULTICAST(skb->nh.iph->daddr) | ||
| 38 | ? PACKET_MULTICAST | ||
| 39 | : PACKET_BROADCAST); | ||
| 40 | else | ||
| 41 | type = skb->pkt_type; | ||
| 42 | |||
| 43 | return (type == info->pkttype) ^ info->invert; | ||
| 34 | } | 44 | } |
| 35 | 45 | ||
| 36 | static struct xt_match pkttype_match = { | 46 | static struct xt_match pkttype_match = { |
