Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2013 11:09:24 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Tim Kientzle <kientzle@freebsd.org>
Subject:   Re: Testing SIOCADDMULTI?
Message-ID:  <201301281109.24879.jhb@freebsd.org>
In-Reply-To: <7A0E9B71-0232-4808-B5D4-5B0D811B353C@kientzle.com>
References:  <AE65AFB2-A767-4457-B30A-007956A7D216@freebsd.org> <7A0E9B71-0232-4808-B5D4-5B0D811B353C@kientzle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301281109.24879.jhb>