alsmith / multicast-relay

Relay multicast and broadcast packets between interfaces.
GNU General Public License v3.0
304 stars 47 forks source link

Not all broadcast addresses are accepted #68

Closed joshuaspence closed 8 months ago

joshuaspence commented 2 years ago

I am trying to relay broadcasts to 192.168.1.255 but these are rejected because the code is only allowing 255.255.255.255 as the broadcast address. According to Wikipedia:

The broadcast address for any IPv4 host can be obtained by taking the bit complement (bitwise NOT) of the subnet mask and then performing a bitwise OR operation with the host's IP address. A shortcut to this process (for common masks using only 0 and 1 bit placements) is to simply take the host's IP address and set all bits in the host identifier portion of the address (any bit positions which hold a 0 in the subnet mask) to 1.