# Add multicast group membership to an interface



## koverskeid (Oct 31, 2022)

I'm using netmap and a tap interface to manipulate network traffic with a c-program. Everything works fine when the physical interface is in promiscuous mode, but I want to avoid that. 

The problem is that I'm not receiving multicast frames on the physical interface because the programs listening to multicast adds multicast group membership on the tap interface.

I have two options as far as i can understand:
1) set the physical interface in all-multicast mode, but this is not supported from user programs and it seems like I cannot set it with ifconfig either...
2) check the multicast group membership on the two interfaces continuously and copy changes on the tap interface to the physical interface.

I have tried the latter alternative by using ioctl and the SIOCADDMULTI command, but can't find any good examples on how to do this.

Does anyone have a good suggestion? A working example would be awesome!


----------

