guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: doc getsockopt, setsockopt


From: Greg Troxel
Subject: Re: doc getsockopt, setsockopt
Date: 03 Oct 2005 19:46:39 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Kevin Ryde <address@hidden> 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 <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]