Of all the gin joints in all the towns in all the world, Garrett Wollman
had to walk into mine and say:
> < said:
>
> > a struct sockaddr_dl will be used. However, the user is supposed to
> > pass the address using a struct ifreq, and struct ifreq uses struct
> > sockaddr, not struct sockaddr_dl.
>
> This is called ``poor man's inheritance''.
>
> I believe it is an error for any code to use AF_UNSPEC for any purpose
> other than masks (where it makes sense since the address family is
> normally not included in the mask). A `sockaddr_dl', while by default
> longer than a `sockaddr', in this case will fit withing the structure
> allotted.
>
> In the future, I fully expect that `sockaddr' will be of maximal
> length (we need this for IPv6).
There's still one small problem: the code as it stands now can return
success and still not update the multicast filter. If you pass a structure
with AF_LINK as the family but with the length set to 0, if_addmulti()
falsely detects that the entry already matches an existing one and
returns success (it the equal() macro equates to a bcmp(), which tries
to compare 0 bytes worth of data and returns success). In my opinion,
this is a bug: either the equal() macro should return false, or the
zero length field should be detected by a sanity check and the function
should return EINVAL.
> > The patches included with this post change /sys/net/if.c and
> > /sys/net/if_ethersubr.c so that adding a mutlicast address with
> > SIOCADDMULTI using a struct sockaddr and AF_UNSPEC works again. I would
> > like Those Who Know More Than I (tm) to review these changes and offer
> > criticisms and comments.
>
> There are two things which should be done here.
>
> First, the kernel AppleTalk code should be fixed to join the necessary
> multicast groups when an interface is first configured for AppleTalk.
> (By preference the AARP implementation should be entirely in the
> kernel as well, but that's more of a challenge.) Second, the generic
> ether_resolvemulti function should be enhanced to know about AppleTalk
> multicast addresses.
The Columbia Appletalk code is not the same as netatalk: it's implemented
entirely in user space and uses BPF as well as manually joining multicast
groups. The existing Columbia Appletalk port, which works on 2.2.x, uses
SIOCADDMULTI with a family of AF_UNSPEC. I rifled through a bunch of
man pages in 3.0-RELEASE trying to find the Right Way To Do This (tm)
but came up empty. If the right way to do this is to cast the struct
sockaddr to a struct sockaddr_dl and use AF_LINK, then this should be
documented somewhere. (If it is documented and I missed it, feel free
to slap me around and point me in the right direction.)
-Bill
--
=
-Bill Paul(212) 854-6020 | System Manager, Master of Unix-Fu
Work: wp...@ctr.columbia.edu | Center for Telecommunications Research
Home: wp...@skynet.ctr.columbia.edu | Columbia University, New York City
=
"It is not I who am crazy; it is I who am mad!" - Ren Hoek, "Space Madness"
=
To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message