Testing SIOCADDMULTI?
John Baldwin
jhb at freebsd.org
Mon Jan 28 18:58:22 UTC 2013
On Sunday, January 27, 2013 1:51:12 am Tim Kientzle wrote:
>
> On Jan 26, 2013, at 3:56 PM, Tim Kientzle wrote:
>
> > My next TODO items for this network driver is to implement
> > the SIOCADDMULTI and SIOCDELMULTI ioctls.
>
> Looking through other drivers (and net/if.c), I've
> managed to implement ADDMULTI by adding
> the multicast ethernet address to the list maintained
> by the controller.
>
> DELMULTI seems trickier. Since if.c does not pass
> the specific address being removed down to the
> driver, it looks like I have no choice but to remove
> every multicast address from the controller and then
> re-insert all of the ones that are still valid.
>
> (This controller doesn't use a hash filter; it uses
> a list of valid multicast addresses.)
>
> Is there a better approach?
You should always reprogram the full table while holding if_maddr_rlock().
All the ioctl's tell you is that an entry was added or removed from that
list. There is currently no race-free way for the stack to tell you which
specific address to add or remove.
> > I'm not quite sure what they do, though, and have
> > no idea how to test them to see if they are working
> > correctly.
>
> Would still appreciate any suggestions for how to test these.
You can write a simple app to listen for UDP packets and have it join a
multicast group and have another machine on the same network write a packet to
the multicast group.
However, a simpler test is to toggle the sysctl to enable multicast ping
replies and to ping a multicast address from another machine after joining it
on the test machine using mtest.
--
John Baldwin
More information about the freebsd-hackers
mailing list