netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Grover <agrover@redhat.com>
To: target-devel <target-devel@vger.kernel.org>
Cc: netdev@vger.kernel.org
Subject: IP_FREEBIND and binding to in-use addr:ports
Date: Wed, 06 Feb 2013 16:47:20 -0800	[thread overview]
Message-ID: <5112F998.8050605@redhat.com> (raw)

OK, this is weird:

https://bugzilla.redhat.com/show_bug.cgi?id=908368

It appears you can listen on the same address:port if you do it from a 
different iscsi target, or even a different tpg (so there are no 
configfs name collisions). I believe this is because we are setting 
IP_FREEBIND sockopt, so we can configure listening on iscsi portals (aka 
ip:port) before the IP is assigned.

from ip(7):
IP_FREEBIND (since Linux 2.4)
If enabled, this boolean option allows binding to an IP address that is
nonlocal or does not (yet) exist.  This permits listening on a socket,
without requiring the underlying network interface or the specified
dynamic IP address to be up at the time that the application is trying
to bind to it.  This option is the per-socket equivalent of the
ip_nonlocal_bind /proc interface described below.

This doesn't say anything about if the address:port is already in use. 
Dave/netdev, should the network stack be returning an error when 
attempting to bind to an address:port already in use even if IP_FREEBIND 
is set, or should the caller be checking for this before trying to 
kernel_bind()?

Or is something else the issue?

Thanks -- Regards -- Andy

p.s. see drivers/target/iscsi/iscsi_target_login.c line ~846 for caller 
code.

             reply	other threads:[~2013-02-07  0:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-07  0:47 Andy Grover [this message]
2013-02-07 18:42 ` IP_FREEBIND and binding to in-use addr:ports Andy Grover
2013-02-08 23:05   ` [PATCH] Don't allow multiple TPGs or targets to share a portal Andy Grover
2013-02-13 20:31     ` Nicholas A. Bellinger
2013-02-13 22:09       ` Andy Grover
2013-02-15 15:46         ` Nicholas A. Bellinger
2013-02-18 22:41           ` Andy Grover
2013-02-19  4:34             ` Nicholas A. Bellinger

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=5112F998.8050605@redhat.com \
    --to=agrover@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=target-devel@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).