netdev
[Top] [All Lists]

Re: Source Specific Query of MLDv2 [PATCH]

To: Takashi Hibi <hibi665@xxxxxxx>
Subject: Re: Source Specific Query of MLDv2 [PATCH]
From: David Stevens <dlstevens@xxxxxxxxxx>
Date: Fri, 6 Feb 2004 18:01:37 -0700
Cc: netdev@xxxxxxxxxxx, davem@xxxxxxxxxx
In-reply-to: <20040115221841.7e7cc78d%hibi665@xxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx

Takashi,
Below is a patch that allows MLD ICMP types without
applying the interface filters to them.

+-DLS
[in-line & attached]

diff -ruN linux-2.6.2/include/net/addrconf.h linux-2.6.2F1/include/net/addrconf.h
--- linux-2.6.2/include/net/addrconf.h 2004-02-03 19:44:17.000000000 -0800
+++ linux-2.6.2F1/include/net/addrconf.h 2004-02-06 16:03:34.000000000 -0800
@@ -98,6 +98,7 @@

extern int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group,
struct in6_addr *src_addr);
+extern int is_mld(struct sk_buff *skb);

extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len);

diff -ruN linux-2.6.2/net/ipv6/ip6_input.c linux-2.6.2F1/net/ipv6/ip6_input.c
--- linux-2.6.2/net/ipv6/ip6_input.c 2004-02-03 19:44:14.000000000 -0800
+++ linux-2.6.2F1/net/ipv6/ip6_input.c 2004-02-06 16:04:00.000000000 -0800
@@ -168,11 +168,19 @@

smp_read_barrier_depends();
if (ipprot->flags & INET6_PROTO_FINAL) {
+ struct ipv6hdr *hdr;
+
if (!cksum_sub && skb->ip_summed == CHECKSUM_HW) {
skb->csum = csum_sub(skb->csum,
csum_partial(skb->nh.raw, skb->h.raw-skb->nh.raw, 0));
cksum_sub++;
}
+ hdr = skb->nh.ipv6h;
+ if (ipv6_addr_is_multicast(&hdr->daddr) &&
+ !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
+ &hdr->saddr) &&
+ !is_mld(skb))
+ goto discard;
}
if (!(ipprot->flags & INET6_PROTO_NOPOLICY) &&
!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb))
@@ -211,16 +219,11 @@

int ip6_mc_input(struct sk_buff *skb)
{
- struct ipv6hdr *hdr;
- int deliver = 0;
+ int deliver = 1;
int discard = 1;

IP6_INC_STATS_BH(Ip6InMcastPkts);

- hdr = skb->nh.ipv6h;
- if (ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, &hdr->saddr))
- deliver = 1;
-
/*
* IPv6 multicast router mode isnt currently supported.
*/
diff -ruN linux-2.6.2/net/ipv6/mcast.c linux-2.6.2F1/net/ipv6/mcast.c
--- linux-2.6.2/net/ipv6/mcast.c 2004-02-03 19:44:28.000000000 -0800
+++ linux-2.6.2F1/net/ipv6/mcast.c 2004-02-06 16:04:25.000000000 -0800
@@ -901,6 +901,25 @@
}

/*
+ * identify MLD packets for MLD filter exceptions
+ */
+int is_mld(struct sk_buff *skb)
+{
+ struct icmp6hdr *pic = (struct icmp6hdr *)skb->h.raw;
+
+ switch (pic->icmp6_type) {
+ case ICMPV6_MGM_QUERY:
+ case ICMPV6_MGM_REPORT:
+ case ICMPV6_MGM_REDUCTION:
+ case ICMPV6_MLD2_REPORT:
+ return 1;
+ default:
+ break;
+ }
+ return 0;
+}
+
+/*
* check if the interface/address pair is valid
*/
int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group,

(See attached file: mldx.patch)

Attachment: mldx.patch
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>