aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/xt_pkttype.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/netfilter/xt_pkttype.c b/net/netfilter/xt_pkttype.c
index 080f3246eee7..cbcb8ea3b8d2 100644
--- a/net/netfilter/xt_pkttype.c
+++ b/net/netfilter/xt_pkttype.c
@@ -11,6 +11,7 @@
11#include <linux/if_packet.h> 11#include <linux/if_packet.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/ip.h> 13#include <linux/ip.h>
14#include <linux/ipv6.h>
14 15
15#include <linux/netfilter/xt_pkttype.h> 16#include <linux/netfilter/xt_pkttype.h>
16#include <linux/netfilter/x_tables.h> 17#include <linux/netfilter/x_tables.h>
@@ -27,16 +28,19 @@ pkttype_mt(const struct sk_buff *skb, const struct net_device *in,
27 const void *matchinfo, int offset, unsigned int protoff, 28 const void *matchinfo, int offset, unsigned int protoff,
28 bool *hotdrop) 29 bool *hotdrop)
29{ 30{
30 u_int8_t type;
31 const struct xt_pkttype_info *info = matchinfo; 31 const struct xt_pkttype_info *info = matchinfo;
32 u_int8_t type;
32 33
33 if (skb->pkt_type == PACKET_LOOPBACK) 34 if (skb->pkt_type != PACKET_LOOPBACK)
34 type = match->family == AF_INET &&
35 ipv4_is_multicast(ip_hdr(skb)->daddr)
36 ? PACKET_MULTICAST
37 : PACKET_BROADCAST;
38 else
39 type = skb->pkt_type; 35 type = skb->pkt_type;
36 else if (match->family == AF_INET &&
37 ipv4_is_multicast(ip_hdr(skb)->daddr))
38 type = PACKET_MULTICAST;
39 else if (match->family == AF_INET6 &&
40 ipv6_hdr(skb)->daddr.s6_addr[0] == 0xFF)
41 type = PACKET_MULTICAST;
42 else
43 type = PACKET_BROADCAST;
40 44
41 return (type == info->pkttype) ^ info->invert; 45 return (type == info->pkttype) ^ info->invert;
42} 46}