metal3d / idok

A simple command line to stream media to kodi (aka xbmc). Stream youtube, gstreamer output, livestreamer output, and many other media stream.
BSD 3-Clause "New" or "Revised" License
62 stars 9 forks source link

Fix local IP addr lookup #17

Open cFire opened 4 years ago

cFire commented 4 years ago

In cases where the default subnet for an IPv4 private network does not match the locally configured subnet on the interface, the local IP lookup would fail.

Example: local ip 10.0.0.100/24, but the default subnet for this private range is 10.0.0.0/8.

It would also fail for any IPv6 lookups since no default mask is defined for private IPv6 ranges.

This mehtod of checking if the target IP address lies within the subnet configured on the interface fixes both of those problems by not reying on the default subnet at all but by reading the configured subnet from the interfaces.