add data link layer multicast join/drop for Linux and BSD
Add SetMulticast(b bool, addr net.Addr) to Linux and BSD. Stub in others with ErrNotImplemented.
Linux implementation through setsockopt(), as such any multicast groups joined will automatically be dropped on socket close.
BSD implementation though dummy syscall.Socket and ioctl. Each multicast group joined/dropped is added/deleted to/from a net.HardwareAddr slice inside the Addr structure. This keeps track of the number of added hardware addresses at the time of Conn.Close(). Inside the .Close() function any remaining hardware addresses are dropped prior to exiting.
Forgot to migrate to accepting net.HardwareAddr for the function. Let me know what you think about the rest and i'll update the PR with net.HardwareAddr when i have a free moment if its not already done by the time you review.
-edit- updated PR
How would you like me to update the PR, I can squash my commits with a local reset and forced push to my branch so it appears as one concise commit for this PR, or I can push individual commits to the PR as we continue to review.
Thanks for all the comments this is super helpful, apologies on the typos.
Either is fine I suppose since I can just squash and merge if I want to later anyway. Separate commits could be handy for review purposes.
Thank you again for all of your hard work on this. This is open source at its finest!
I'll be traveling for the next week or so and will have limited or zero time for further review, unfortunately. I should be available again on August 14th if nothing else.
Forgive the delay; I'm running into a very small hurtle. Trying to determine how best to abstract out the OS specifics. Unsure if creating an interface or just moving the entire SetMulticast function to OS specific build files. That aside I have tested FreeBSD and OpenBSD framework, once I solve for abstraction I will test of other platforms.
An interface for the BSD family feels reasonable to me.