[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080618174907.GA31937@pingi.kke.suse.de>
Date: Wed, 18 Jun 2008 19:49:07 +0200
From: Karsten Keil <kkeil@...e.de>
To: netdev@...r.kernel.org
Subject: Re: [PATCH] [IPv6] Do not use loopback as source address on other interfaces
Hi Yoshfuji,
On Wed, Jun 18, 2008 at 11:36:07PM +0900, YOSHIFUJI Hideaki / 吉藤英明 wrote:
Verified that this patch fix the TAHI issue and that ping6 ::1 still works.
So this should go in.
...
> ipv6: Drop packets for loopback address from outside of the box.
>
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
>
> --
> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
> index e0a612b..f422f72 100644
> --- a/include/net/ipv6.h
> +++ b/include/net/ipv6.h
> @@ -367,6 +367,12 @@ static inline int ipv6_addr_any(const struct in6_addr *a)
> a->s6_addr32[2] | a->s6_addr32[3] ) == 0);
> }
>
> +static inline int ipv6_addr_loopback(const struct in6_addr *a)
> +{
> + return ((a->s6_addr32[0] | a->s6_addr32[1] |
> + a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0);
> +}
> +
> static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
> {
> return ((a->s6_addr32[0] | a->s6_addr32[1] |
> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index 4e5c861..17eb48b 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -102,6 +102,15 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
> if (hdr->version != 6)
> goto err;
>
> + /*
> + * RFC4291 2.5.3
> + * A packet received on an interface with a destination address
> + * of loopback must be dropped.
> + */
> + if (!(dev->flags & IFF_LOOPBACK) &&
> + ipv6_addr_loopback(&hdr->daddr))
> + goto err;
> +
> skb->transport_header = skb->network_header + sizeof(*hdr);
> IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
>
>
>
> --yoshfuji
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists