[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201007051426.52758.michal.humpula@web4u.cz>
Date: Mon, 5 Jul 2010 14:26:52 +0200
From: Michal Humpula <michal.humpula@...4u.cz>
To: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next-2.6] ipv6: adding ip_nonlocal_bind option from ipv4
On Monday 05 of July 2010 12:13:42 YOSHIFUJI Hideaki wrote:
> Hello.
>
> Michal Humpula wrote:
> > Adds ability to bind non-local IPv6 address the same way as for IPv4
> >
> > Signed-off-by: Michal Humpula <michal.humpula@...4u.cz>
> >
> > diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
> > index e830cd4..55b3552 100644
> > --- a/net/ipv6/af_inet6.c
> > +++ b/net/ipv6/af_inet6.c
> >
> > @@ -252,6 +252,8 @@ out_rcu_unlock:
> > goto out;
> >
> > }
> >
> > +int sysctl_ipv6_nonlocal_bind __read_mostly;
> > +EXPORT_SYMBOL(sysctl_ipv6_nonlocal_bind);
> >
> > /* bind for INET6 API */
> > int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int
> >
> > addr_len)
> > @@ -345,8 +347,10 @@ int inet6_bind(struct socket *sock, struct
> > sockaddr *uaddr, int addr_len)
> >
> > if (!(addr_type &I do think i IPV6_ADDR_MULTICAST)) {
> >
> > if (!ipv6_chk_addr(net, &addr->sin6_addr,
> >
> > dev, 0)) {
> >
> > - err = -EADDRNOTAVAIL;
> > - goto out_unlock;
> > + if (!sysctl_ipv6_nonlocal_bind) {
> > + err = -EADDRNOTAVAIL;
> > + goto out_unlock;
> > + }
> >
> > }
> >
> > }
> > rcu_read_unlock();
> >
> > diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
> > index fa1d8f4..56bfe76 100644
> > --- a/net/ipv6/sysctl_net_ipv6.c
> > +++ b/net/ipv6/sysctl_net_ipv6.c
> > @@ -35,6 +35,13 @@ static ctl_table ipv6_table_template[] = {
> >
> > .mode = 0644,When you try to send packets / connect to
>
> remote address,
>
> > .proc_handler = proc_dointvec
> >
> > }, so far.
> >
> > + {
> > + .procname = "ipv6_nonlocal_bind",
> > + .data = &sysctl_ipv6_nonlocal_bind,
> > + .maxlen = sizeof(int),
> > + .mode = 0644,
> > + .proc_handler = proc_dointvec
> > + },
> >
> > { }
> >
> > };
>
> This is not sufficient.
>
> In IPv4, even if you do non-local bind, you cannot connect/send
> packets from that address until the admin really assigns that
> address on the node. Local address is checked when you try to
> connect (or to send), and this is important thing to do.
>
> But in IPv6, it is not checked, and it is very bad to open
> this "hole".
>
> --yoshfuji
Thanks again for review. Could you please point me to part, where the check is done?
Is there a reason why is the check not done in IPv6 too?
--
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