unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Greg Troxel <gdt@ir.bbn.com>
Subject: Re: doc getsockopt, setsockopt
Date: 03 Oct 2005 19:46:39 -0400	[thread overview]
Message-ID: <rmir7b29na8.fsf@fnord.ir.bbn.com> (raw)
In-Reply-To: <87k6gv8kxz.fsf@zip.com.au>

Kevin Ryde <user42@zip.com.au> writes:

> There's a note in "Network Address Conversion" where ipv4 addrs are
> described.  Hopefully a cross reference to it is enough, unless
> there's something especially zany happening.

Sounds good.  These calls aren't odd from the htonl viewpoint.

> About IP_ADD_MEMBERSHIP: In linux I see there's a separate imr_ifindex
> in struct ip_mreqn for an interface index.  Do you need/want to do
> anything with that?  (I've never used this stuff, so I've got no idea
> if it's good for anything or what it should look like.)

It is useful, but complex.  Here's the full story:

 When joining a multicast group, you have to specify the group
(straightforward), and some way to specify the interface.  The struct
ip_mreq dates from BSD long long ago (multicast patches to 4.3 in late
80s I think).  The second IP address is INADDR_ANY for "use the
default interface (found by looking up the group in the routing table,
almost always hitting the default route)", or an address used to find
an interface, usually by it being an address of some interface.  At
some point the BSDs added the convention that 0.0.0.x would refer to
the interface with ifindex x, and this follows RFC1724, which provides
for this method of referring to unnumered interfaces in the RIPv2 MIB.
This was added to NetBSD in early 2001:
  http://mail-index.netbsd.org/tech-net/2001/01/13/0003.html

Specifying by ifindex is useful for unnumbered interfaces, for example
joining the ospf all routers group on a ppp link with no IPv4
addresses, or addresses reused from some other interface.  Normal
programs don't do this - it's typically a routing protocol
implementation  issue.

My understanding is that Linux has an additional field to specify by
ifindex (the imr_ifindex you mention).  So, the right thing to do for
guile is to either

  follow the BSD way, and translate 0.0.0.x/8 in the second arg into
  setting imr_ifindex on Linux.

  follow the Linux way, and make it a vector of 3 and translate back
  into the 0.0.0.x/8 on BSD.

I prefer the first way, since this is orginally a BSD interface and
because it's less burdensome to those who are blissfully unaware of
this complexity, as I suspect you wish you still were.

The code I submitted just puts the two addresses in the two fields;
someone could spiff it up for ifindex support on Linux if they were so
inclined.  I suspect the need will not arise, given how long guile
went without being able to join groups at all.

-- 
        Greg Troxel <gdt@ir.bbn.com>


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2005-10-03 23:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-28 21:31 doc getsockopt, setsockopt Kevin Ryde
2005-09-30 15:58 ` Greg Troxel
2005-09-30 23:06   ` Kevin Ryde
2005-10-02 23:09     ` Greg Troxel
2005-10-03  1:10       ` Kevin Ryde
2005-10-03 23:46         ` Greg Troxel [this message]
2005-10-11 22:54           ` Kevin Ryde
2005-10-12 14:30             ` Greg Troxel

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=rmir7b29na8.fsf@fnord.ir.bbn.com \
    --to=gdt@ir.bbn.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).