From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
To: Michal Humpula <michal.humpula@web4u.cz>,
netdev@vger.kernel.org, yoshfuji@linux-ipv6.org
Subject: Re: [PATCH net-next-2.6] ipv6: adding ip_nonlocal_bind option from ipv4
Date: Mon, 05 Jul 2010 19:13:42 +0900 [thread overview]
Message-ID: <1278324822.19358.24.camel@sylph.linux-ipv6.org> (raw)
In-Reply-To: <201007032238.28344.michal.humpula@web4u.cz>
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@web4u.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
next prev parent reply other threads:[~2010-07-05 10:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-03 20:38 [PATCH net-next-2.6] ipv6: adding ip_nonlocal_bind option from ipv4 Michal Humpula
2010-07-05 2:03 ` Simon Horman
2010-07-05 6:56 ` Michal Humpula
2010-07-05 10:13 ` YOSHIFUJI Hideaki [this message]
2010-07-05 12:26 ` Michal Humpula
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=1278324822.19358.24.camel@sylph.linux-ipv6.org \
--to=yoshfuji@linux-ipv6.org \
--cc=michal.humpula@web4u.cz \
--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).