9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] ape/bsd: Enable setting the local address with bind
Date: Sat, 16 Apr 2022 13:33:54 -0400	[thread overview]
Message-ID: <4E8DA25EACF13E3FFE406FE6B5FB9375@eigenstate.org> (raw)
In-Reply-To: <87pmp72rv5.fsf@turtle-trading.net>

Apologies for taking so long to respond. Life got busy, and
I forgot.

Quoth Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>:
> The current code ignores the address as passed to the BSD socket
> function bind().  It seems that that may not have been possible with
> earlier versions of the net API?  I discovered by reading the code and
> experimentation that this seems to work fine in the current net API, so
> this implements it for BSD sockets.
> I removed some previous code that did not make sense to me, so you may
> want to check that I did not screw up.  What I mean is "bind *" in
> bind() and about "bind 0" in listen().
> The handling when ports < 0 are specified is not consistent yet.  Either
> we should normalize the ports to be at least 0, or we should return an
> error condition for ports < 0.

This looks like it's attempting (incorrectly?) to implement INADDR_ANY,
binding to any ip address. However, INADDR_ANY is 0:

		#define	INADDR_ANY		(unsigned long)0x00000000

And I see no specification that describes what should be done with
negative ports in the sockets world, so I can only assume that this
is a bug. I don't think 'bind *' should be removed, since it seems
to me that it works as intended for binding to all addresses, but
the ape userspace for it is wrong.
> The documentation in the man page ip(3) for the control commands "bind"
> and "announce" does not mention the local address, should that be fixed,
> too?

Yes, that would be wonderful.

  parent reply	other threads:[~2022-04-16 17:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 20:00 Benjamin Riefenstahl
2022-01-21 14:22 ` [9front] " Benjamin Riefenstahl
2022-01-21 19:22   ` ori
2022-02-10 17:38 ` Benjamin Riefenstahl
2022-04-16 17:33 ` ori [this message]
2022-04-20 15:35   ` [9front] " Benjamin Riefenstahl
2022-06-10 15:14     ` Benjamin Riefenstahl
2022-06-10 15:16       ` Benjamin Riefenstahl
2022-06-11 17:13       ` ori
2022-06-11 18:31         ` Benjamin Riefenstahl

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E8DA25EACF13E3FFE406FE6B5FB9375@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    --subject='Re: [9front] ape/bsd: Enable setting the local address with bind' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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