]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[NETFILTER]: xt_pkttype: IPv6 multicast address recognition
authorJan Engelhardt <jengelh@computergmbh.de>
Tue, 15 Jan 2008 07:41:50 +0000 (23:41 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:02:25 +0000 (15:02 -0800)
Signed-off-by: Jan Engelhart <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/xt_pkttype.c

index 080f3246eee7d7b9d4bc1745b5023f25849c0d46..cbcb8ea3b8d20228521596c3e054edd2d8d229d5 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/if_packet.h>
 #include <linux/in.h>
 #include <linux/ip.h>
+#include <linux/ipv6.h>
 
 #include <linux/netfilter/xt_pkttype.h>
 #include <linux/netfilter/x_tables.h>
@@ -27,16 +28,19 @@ pkttype_mt(const struct sk_buff *skb, const struct net_device *in,
            const void *matchinfo, int offset, unsigned int protoff,
            bool *hotdrop)
 {
-       u_int8_t type;
        const struct xt_pkttype_info *info = matchinfo;
+       u_int8_t type;
 
-       if (skb->pkt_type == PACKET_LOOPBACK)
-               type = match->family == AF_INET &&
-                      ipv4_is_multicast(ip_hdr(skb)->daddr)
-                       ? PACKET_MULTICAST
-                       : PACKET_BROADCAST;
-       else
+       if (skb->pkt_type != PACKET_LOOPBACK)
                type = skb->pkt_type;
+       else if (match->family == AF_INET &&
+           ipv4_is_multicast(ip_hdr(skb)->daddr))
+               type = PACKET_MULTICAST;
+       else if (match->family == AF_INET6 &&
+           ipv6_hdr(skb)->daddr.s6_addr[0] == 0xFF)
+               type = PACKET_MULTICAST;
+       else
+               type = PACKET_BROADCAST;
 
        return (type == info->pkttype) ^ info->invert;
 }