From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
To: davem@davemloft.net
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] ipv6: Use ipv6_is_mld() in ip6_mc_input().
Date: Sun, 13 Jan 2013 17:43:44 +0900 [thread overview]
Message-ID: <50F273C0.6080901@linux-ipv6.org> (raw)
In-Reply-To: <50F27111.9020001@linux-ipv6.org>
YOSHIFUJI Hideaki wrote:
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
> include/net/addrconf.h | 2 +-
> net/ipv6/ip6_input.c | 21 +++------------------
> net/ipv6/mcast.c | 4 ++--
> 3 files changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/include/net/addrconf.h b/include/net/addrconf.h
> index df4ef94..59f14ab 100644
> --- a/include/net/addrconf.h
> +++ b/include/net/addrconf.h
> @@ -150,7 +150,7 @@ extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
> extern bool ipv6_chk_mcast_addr(struct net_device *dev,
> const struct in6_addr *group,
> const struct in6_addr *src_addr);
> -extern bool ipv6_is_mld(struct sk_buff *skb, int nexthdr);
> +extern bool ipv6_is_mld(struct sk_buff *skb, int nexthdr, int offset);
>
> extern void addrconf_prefix_rcv(struct net_device *dev,
> u8 *opt, int len, bool sllao);
> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index a52d864..6de509e 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -212,7 +212,7 @@ resubmit:
> if (ipv6_addr_is_multicast(&hdr->daddr) &&
> !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
> &hdr->saddr) &&
> - !ipv6_is_mld(skb, nexthdr))
> + !ipv6_is_mld(skb, nexthdr, 0))
> goto discard;
> }
> if (!(ipprot->flags & INET6_PROTO_NOPOLICY) &&
> @@ -283,7 +283,6 @@ int ip6_mc_input(struct sk_buff *skb)
> if (unlikely(opt->ra)) {
> /* Check if this is a mld message */
> u8 *ptr = skb_network_header(skb) + opt->ra;
> - struct icmp6hdr *icmp6;
> u8 nexthdr = hdr->nexthdr;
> __be16 frag_off;
> int offset;
> @@ -303,24 +302,10 @@ int ip6_mc_input(struct sk_buff *skb)
> if (offset < 0)
> goto out;
>
> - if (nexthdr != IPPROTO_ICMPV6)
> + if (!ipv6_is_mld(skb, offset, nexthdr))
> goto out;
>
> - if (!pskb_may_pull(skb, (skb_network_header(skb) +
> - offset + 1 - skb->data)))
> - goto out;
> -
> - icmp6 = (struct icmp6hdr *)(skb_network_header(skb) + offset);
> -
> - switch (icmp6->icmp6_type) {
> - case ICMPV6_MGM_QUERY:
> - case ICMPV6_MGM_REPORT:
> - case ICMPV6_MGM_REDUCTION:
> - case ICMPV6_MLD2_REPORT:
> - deliver = true;
> - break;
> - }
> - goto out;
> + deliver = true;
> }
> /* unknown RA - process it normally */
> }
> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
> index 28dfa5f..b529c27 100644
> --- a/net/ipv6/mcast.c
> +++ b/net/ipv6/mcast.c
> @@ -937,14 +937,14 @@ int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr)
> /*
> * identify MLD packets for MLD filter exceptions
> */
> -bool ipv6_is_mld(struct sk_buff *skb, int nexthdr)
> +bool ipv6_is_mld(struct sk_buff *skb, int nexthdr, int offset)
> {
> struct icmp6hdr *pic;
>
> if (nexthdr != IPPROTO_ICMPV6)
> return false;
>
> - if (!pskb_may_pull(skb, sizeof(struct icmp6hdr)))
> + if (!pskb_may_pull(skb, offset + sizeof(struct icmp6hdr)))
> return false;
>
> pic = icmp6_hdr(skb);
>
Sorry I found some bugs, I'll repost.
--yoshfuji
next prev parent reply other threads:[~2013-01-13 8:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-13 8:32 [PATCH net-next] ipv6: Use ipv6_is_mld() in ip6_mc_input() YOSHIFUJI Hideaki
2013-01-13 8:43 ` YOSHIFUJI Hideaki [this message]
2013-01-13 13:18 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50F273C0.6080901@linux-ipv6.org \
--to=yoshfuji@linux-ipv6.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).