Netdev List
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Vincent Li <vincent.mc.li@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: socket bind to local address ::ffff:127.0.0.1 question
Date: Sat, 15 Feb 2014 18:10:41 +0100	[thread overview]
Message-ID: <20140215171041.GE8634@order.stressinduktion.org> (raw)
In-Reply-To: <CAK3+h2zzx5AocGeJxu9cW0kNkiRew6GNDMrbsNq-7H8co=T0_Q@mail.gmail.com>

On Wed, Feb 12, 2014 at 12:41:21PM -0800, Vincent Li wrote:
> we have a traffic path like <BIGIP monitor userland process on Linux>
> <------> router<------->pool/real server
> 
> there is a  weird issue that intermittently, a socket is bound to
> loopback address '::ffff:127.0.0.1' which caused issue for us because
> remote end host can't SYN+ACK the SYN source from 127.0.0.1, strace
> the userland process shows:
> 
> 6797  12:36:48.815296 connect(11, {sa_family=AF_INET6,
> sin6_port=htons(8180), inet_pton(AF_INET6, "::ffff:172.16.3.165",
> &sin6_addr), sin6_flowinfo=0, sin6_scope_id=875638834}, 28) = -1
> EINPROGRESS (Operation now in progress)

Have you checked the connect operation completed successfully in this
case? Error state would be interesting to see (SO_ERROR).

> 6797  12:36:48.815464 gettimeofday({1391744208, 815499}, NULL) = 0
> 6797  12:36:48.815552 time(NULL)        = 1391744208
> 6797  12:36:48.815657 stat64("/etc/localtime", {st_mode=S_IFREG|0644,
> st_size=331, ...}) = 0
> ...................
> 6797  12:36:48.816948 getsockname(11, {sa_family=AF_INET6,
> sin6_port=htons(45621), inet_pton(AF_INET6, "::ffff:127.0.0.1",
> &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0},
> [18433145657494601756]) = 0
   ^^^
Urks!

What kernel version are you using?

Do you have a reproducer, sample code in C where this problem sometimes
happens or could you expand the strace listings a bit (maybe setsockopts,
bindv6only settings)?

Also you seem to not initialize your struct sockaddr_in6 given to connect, as
the sin6_scope_id seems bogus (uninitialized memory?). But should not
matter with v4mapped addresses though.

Greetings,

  Hannes

  reply	other threads:[~2014-02-15 17:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 20:41 socket bind to local address ::ffff:127.0.0.1 question Vincent Li
2014-02-15 17:10 ` Hannes Frederic Sowa [this message]
2014-02-17 18:32   ` Vincent Li
2014-02-18 22:14     ` Vincent Li
2014-02-18 22:19       ` Vincent Li

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=20140215171041.GE8634@order.stressinduktion.org \
    --to=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    --cc=vincent.mc.li@gmail.com \
    /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