dial-reference
dial-reference copied to clipboard
Fix several issues in server's get_local_address()
Implementation of get_local_address() has several issues:
- It resets the IP address (
ip_addr) for every interface event if it's not the matching one. Solution - store address in a temporary variable (required because every next call toioctl()will resetifc.ifc_req[i]) and use it only for correct interface. - It terminates on every
ioctl()error, although it is not guaranteed thatioctl()will always return 0. E.g. some interface might fail withDevice not configured. Solution - just skip the interface instead of terminating. - It accepts all interfaces, event turned off or unplugged. No check whether interface supports multicast is performed. Solution - introduce corresponding filtering