netfilter: pkttype: unnecessary to check ipv6 multicast address
authorLiping Zhang <zlpnobody@gmail.com>
Sat, 7 Jan 2017 13:33:54 +0000 (21:33 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 18 Jan 2017 19:32:43 +0000 (20:32 +0100)
Since there's no broadcast address in IPV6, so in ipv6 family, the
PACKET_LOOPBACK must be multicast packets, there's no need to check
it again.

Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_meta.c
net/netfilter/xt_pkttype.c

index 66c7f4b4c49bda596d9151d162bc68d95d957560..9a22b24346b8be7b6a135b27b1bc9b9e3de42e79 100644 (file)
@@ -154,10 +154,7 @@ void nft_meta_get_eval(const struct nft_expr *expr,
                                *dest = PACKET_BROADCAST;
                        break;
                case NFPROTO_IPV6:
-                       if (ipv6_hdr(skb)->daddr.s6_addr[0] == 0xFF)
-                               *dest = PACKET_MULTICAST;
-                       else
-                               *dest = PACKET_BROADCAST;
+                       *dest = PACKET_MULTICAST;
                        break;
                default:
                        WARN_ON(1);
index 57efb703ff18019ec0f341c56062f9a6b264cd79..1ef99151b3ba98da41e8af2bfbb5d85948608701 100644 (file)
@@ -33,8 +33,7 @@ pkttype_mt(const struct sk_buff *skb, struct xt_action_param *par)
        else if (xt_family(par) == NFPROTO_IPV4 &&
            ipv4_is_multicast(ip_hdr(skb)->daddr))
                type = PACKET_MULTICAST;
-       else if (xt_family(par) == NFPROTO_IPV6 &&
-           ipv6_hdr(skb)->daddr.s6_addr[0] == 0xFF)
+       else if (xt_family(par) == NFPROTO_IPV6)
                type = PACKET_MULTICAST;
        else
                type = PACKET_BROADCAST;