alsmith / multicast-relay

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

Incorrect source address/port in logs (SSDP) #48

Closed vvd170501 closed 3 years ago

vvd170501 commented 3 years ago

If multicast-relay is used with the --ssdpUnicastAddr option, all relayed SSDP multicast packets are logged with ssdpUnicastAddr:SSDP_UNICAST_PORT as source instead of the original address and port.

Steps to reproduce: run multicast-relay.py --verbose --foreground --interfaces $IFACE1 $IFACE2 --ssdpUnicastAddr $IFACE1_ADDR, send SSDP multicast packets from another machine connected to the same network

Expected behaviour: original source address is logged

Actual behaviour: $IFACE1_ADDR is logged instead of original address

Relevant part of code: https://github.com/alsmith/multicast-relay/blob/74a0fc165e393e2ff11d6d3137d791935bb7eab7/multicast-relay.py#L684-L689

Log example (with options --interfaces eth0 eth1 --ssdpUnicastAddr 192.168.0.123)

...
INFO: Last SSDP search source: 10.0.0.11:43028
INFO: [SSDP] Relayed 125 bytes from 192.168.0.123:1901 on eth1 [ttl 1] to 239.255.255.250:1900 via eth0/192.168.0.123
...
INFO: Last SSDP search source: 192.168.1.100:1900
INFO: [SSDP] Relayed 409 bytes from 192.168.0.123:1901 on eth0 [ttl 4] to 239.255.255.250:1900 via eth1/10.0.0.123

Log example (678bafb, same options)

Last SSDP search source: 10.0.0.11:40074
INFO: [SSDP] Relayed 125 bytes from 10.0.0.11(192.168.0.123):1901 on eth1 [ttl 1] to 239.255.255.250:1900 via eth0/192.168.0.123

Possible solutions: