From: Jan Engelhardt Date: Tue, 15 Jan 2008 07:41:50 +0000 (-0800) Subject: [NETFILTER]: xt_pkttype: IPv6 multicast address recognition X-Git-Tag: MMI-PSA29.97-13-9~37648^2~728 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=57de0abbffa9724e2a89860a49725d805bfc07ca;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [NETFILTER]: xt_pkttype: IPv6 multicast address recognition Signed-off-by: Jan Engelhart Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- 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 @@ #include #include #include +#include #include #include @@ -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; }