netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] IPv6: enable TCP to use an anycast address
@ 2014-01-11 12:07 Francois-Xavier Le Bail
  2014-01-11 12:46 ` Alexey Kuznetsov
  0 siblings, 1 reply; 14+ messages in thread
From: Francois-Xavier Le Bail @ 2014-01-11 12:07 UTC (permalink / raw)
  To: netdev
  Cc: Hannes Frederic Sowa, David S. Miller, Alexey Kuznetsov,
	James Morris, Hideaki Yoshifuji, Patrick McHardy,
	Francois-Xavier Le Bail

- Use ipv6_anycast_destination() in tcp_v6_send_reset() and
  tcp_v6_conn_request().

Signed-off-by: Francois-Xavier Le Bail <fx.lebail@yahoo.com>
---
Tested with link-local and global anycast addresses.
Tested with SOCK_STREAM socket, bind and TCP traffic OK.

 net/ipv6/tcp_ipv6.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index ffd5fa8..85297b8 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -832,7 +832,8 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
 	if (th->rst)
 		return;
 
-	if (!ipv6_unicast_destination(skb))
+	if (!ipv6_unicast_destination(skb) &&
+	    !ipv6_anycast_destination(skb))
 		return;
 
 #ifdef CONFIG_TCP_MD5SIG
@@ -963,7 +964,8 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
 	if (skb->protocol == htons(ETH_P_IP))
 		return tcp_v4_conn_request(sk, skb);
 
-	if (!ipv6_unicast_destination(skb))
+	if (!ipv6_unicast_destination(skb) &&
+	    !ipv6_anycast_destination(skb))
 		goto drop;
 
 	if ((sysctl_tcp_syncookies == 2 ||

^ permalink raw reply related	[flat|nested] 14+ messages in thread
* Re: [PATCH net-next] IPv6: enable TCP to use an anycast address
@ 2014-01-11 14:07 François-Xavier Le Bail
  0 siblings, 0 replies; 14+ messages in thread
From: François-Xavier Le Bail @ 2014-01-11 14:07 UTC (permalink / raw)
  To: Christoph Paasch
  Cc: Alexey Kuznetsov, netdev, Hannes Frederic Sowa, David S. Miller,
	James Morris, Hideaki Yoshifuji, Patrick McHardy

On Sat, 1/11/14, Christoph Paasch <christoph.paasch@uclouvain.be> wrote:

>> On 11/01/14 - 05:06:10, François-Xavier Le Bail wrote:
>> On Sat, 1/11/14, Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> wrote:
>> As said in http://tools.ietf.org/html/draft-iab-anycast-arch-implications-12.html#section-2.1
>> (this informational draft is in RCF queue)

> This draft does not say that TCP should be used with anycast
> addresses. Rather the opposite:

> "  This document does not treat in any depth
>   the fact that there are deployed services with TCP transport using
>   anycast today.  Evidence exists to suggest that such practice is not
>   "safe" in the traditional and architectural sense (as described in
>   Section 4.2). "

> And Section 4.2 gives more information.
> http://tools.ietf.org/html/draft-iab-anycast-arch-implications-12.html#section-4.2

The draft say there are use cases for TCP with anycast services.
The DNS use case is widely deployed in real word.

I think enabled such possibility in Linux kernel is useful.

It's only a possibility for such use cases and it's dont break usual TCP usage.

Francois-Xavier

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH net-next] IPv6: enable TCP to use an anycast address
@ 2014-01-12 14:53 François-Xavier Le Bail
  2014-01-13  1:11 ` Hannes Frederic Sowa
  0 siblings, 1 reply; 14+ messages in thread
From: François-Xavier Le Bail @ 2014-01-12 14:53 UTC (permalink / raw)
  To: Alexey Kuznetsov, Hannes Frederic Sowa
  Cc: netdev, David S. Miller, James Morris, Hideaki Yoshifuji,
	Patrick McHardy

On Sat, 1/11/14, Hannes Frederic Sowa <hannes@stressinduktion.org> wrote:

> On Sat, Jan 11, 2014 at 05:38:27PM +0400, Alexey Kuznetsov wrote:
> > On Sat, Jan 11, 2014 at 5:06 PM, François-Xavier Le Bail
> > <fx.lebail@yahoo.com> wrote:
> > > Many DNS root-servers use TCP with anycast (IPv4 and IPV6).
> > 
> > Actually, I was alerted by reset processing in your patch, it cannot be right.
> > 
> > Do not you think this must not be enabled for common use? At least
> > some separate sysctl disabled by default.

> The idea I had, was, that if a socket does knowingly bind to an anycast
> address, it is allowed to do so and process queries on it with both TCP and
> UDP. I don't think we need a sysctl for that? Anycast addresses are either
> pre-defined (e.g. the subnet router anycast address) or specified by a flag
> when the administrator adds one. Currently one can only add anycast addresses
> either by forwarding and gets the per-subnet anycast address or with a
> setsockopt IPV6_JOIN_ANYCAST.

> So the problem is what should be allowed when the socket listens on an any
> address? Maybe this should be protected by a sysctl?

Hi,

TCP case:
With my two patches (the one for bind and this one for tcp), when a
SOCK_STREAM socket listen to in6addr_any, the server is able to 
send TCP reply with unicast or anycast source address, according
to the destination address used by the client.

dest request unicast => src reply unicast (current behavior)
dest resquet anycast => src reply anycast (new)

So, I don't think there is a need for a sysctl.

UDP case:
By default (no socket option), the server program don't know the
destination address of the request. The ipv6_dev_get_saddr() is 
used for choosing the unicast source address of the reply.

I am not sure a change is needed here.

When using IPV6_RECVPKTINFO, a server is able to know
the destination address of the request and can use it as source
address for the reply.
To enable anycast for this (don't get EINVAL), there is need for
a patch like the one I posted ("IPv6: add option to use anycast
addresses as source addresses for datagrams").
I am working on a v2.

With the appropriate change:
dest request unicast => src reply unicast (current behavior)
dest resquet anycast => src reply anycast (new)

I don't think, there either, there is a need for a sysctl.

What do you think about it?

BR,
Francois-Xavier

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH net-next] IPv6: enable TCP to use an anycast address
@ 2014-01-22 14:32 François-Xavier Le Bail
  2014-01-22 21:11 ` Alexey Kuznetsov
  0 siblings, 1 reply; 14+ messages in thread
From: François-Xavier Le Bail @ 2014-01-22 14:32 UTC (permalink / raw)
  To: Alexey Kuznetsov
  Cc: netdev, David Stevens, Hannes Frederic Sowa, David Miller,
	Hideaki Yoshifuji

Hello,

> Actually, I was alerted by reset processing in your patch, it cannot be right.

Perhaps, I missed something.

My tests were:
1) enable anycast in tcp_v6_conn_request().
So, a client-serveur exchange with anycast destination address is possible.

2) try to connect with a port not listen by the server.
With unicast destination address, the client got a reset.
With anycast destination address, no reset, the client try several syn and give up.

3) enable anycast in tcp_v6_send_reset().
With anycast destination address, the client got a reset.
So unicast and anycast behave the same.

Do you see any problem with this behaviour ?

> Do not you think this must not be enabled for common use? At least
> some separate sysctl disabled by default.

We could indeed use a sysctl, disabled by default.

But my goal was to enable anycast address usage transparently, if possible.

It's only a possibility for some use cases and if it's dont break unicast TCP usage,
like I think it, I propose to enable this change without sysctl.

So, my proposals for the TCP case, in descending order of preference are:

1) No sysctl.
2) A sysctl disabled par default, used in tcp_v6_conn_request() and tcp_v6_send_reset().
3) A sysctl disabled par default, used in tcp_v6_send_reset(), if problem only here.

Greetings,
Francois-Xavier

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-01-22 21:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-11 12:07 [PATCH net-next] IPv6: enable TCP to use an anycast address Francois-Xavier Le Bail
2014-01-11 12:46 ` Alexey Kuznetsov
2014-01-11 13:06   ` François-Xavier Le Bail
2014-01-11 13:38     ` Alexey Kuznetsov
2014-01-11 14:16       ` François-Xavier Le Bail
2014-01-11 14:26       ` Hannes Frederic Sowa
2014-01-11 13:46     ` Christoph Paasch
  -- strict thread matches above, loose matches on Subject: below --
2014-01-11 14:07 François-Xavier Le Bail
2014-01-12 14:53 François-Xavier Le Bail
2014-01-13  1:11 ` Hannes Frederic Sowa
2014-01-14 23:14   ` David Miller
2014-01-22 14:32 François-Xavier Le Bail
2014-01-22 21:11 ` Alexey Kuznetsov
2014-01-22 21:59   ` Hannes Frederic Sowa

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).