From: 'Marcelo Ricardo Leitner' <marcelo.leitner@gmail.com>
To: linux-sctp@vger.kernel.org
Subject: Re: Multiple connections from the same source address.
Date: Fri, 08 Sep 2017 15:11:23 +0000 [thread overview]
Message-ID: <20170908151123.GB4529@localhost.localdomain> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD0071271@AcuExch.aculab.com>
On Fri, Sep 08, 2017 at 03:01:22PM +0000, David Laight wrote:
> From: Marcelo Ricardo Leitner
> > Sent: 08 September 2017 15:50
> > On Fri, Sep 08, 2017 at 09:03:31AM +0000, David Laight wrote:
> > > Can anyone think how to create multiple outgoing connections
> > > from the same subset of local IP addresses and the same port?
> > >
> > > We bind() to the first IP address and port, then use
> > > SCTP_SOCKOPT_BINDX_ADD to add the second IP address.
> > > But even with IP_REUASADDR set you can't repeat that on
> > > a second socket.
> >
> > When did you set IP_REUSEADDR? Checking the code, seems you have to set
> > it before any binding, because then the port entry will be created and
> > such flag will be initialized with that state.
>
> Indeed, otherwise it has no effect.
>
For both sockets, right? I'll debug this if yes.
> The point is that (IIRC) IP_REUSEADDR only lets you bind the same
> port number to 2 sockets - the IP addresses have to be different.
I'm not seeing where this could be happening. I see this:
if (pp->fastreuse && sk->sk_reuse &&
sk->sk_state != SCTP_SS_LISTENING)
goto success;
Meaning that if the port allows reusing and so does the new socket, and
it's not in listening state, it would be allowed.
> Code that does this for TCP (like the old ftp data connection)
> only worked because the address it was binding was IN_ADDR_ANY
> and the existing socket had a local IP address.
> It always had to retry because two sockets couldn't be bound to
> the port and IN_ADDR_ANY either.
>
> > > It is possible to bind a second socket by reversing the
> > > order of the IP addresses (this might be deemed to be a bug!)
> >
> > Interesting. It does seem like a bug. Probably related to the above
> > behavior.
>
> More likely the duplicate check is in some generic code that
> doesn't look at the extra addresses.
Can be.
Marcelo
next prev parent reply other threads:[~2017-09-08 15:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 9:03 Multiple connections from the same source address David Laight
2017-09-08 9:29 ` Michael Tuexen
2017-09-08 9:37 ` David Laight
2017-09-08 14:49 ` Marcelo Ricardo Leitner
2017-09-08 15:01 ` David Laight
2017-09-08 15:11 ` 'Marcelo Ricardo Leitner' [this message]
2017-09-08 15:28 ` Michael Tuexen
2017-09-08 15:40 ` David Laight
2017-09-08 15:42 ` David Laight
2017-09-08 17:04 ` Michael Tuexen
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=20170908151123.GB4529@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=linux-sctp@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.