A distribution overlay for Raspbian and similar systems to create a JACK-based embedded system for audio processing and streaming. Contract work for [mn] medianet. https://www.medianet-home.de
Other
11
stars
2
forks
source link
Enable host name lookup in network-related mn_* services #128
Currently, we use multicast groups for convenience and ease of setup even when not strictly necessary.
With uncompressed video streaming, the network load penalty has become too high, so we need to make unicast just as straightforward.
It is already possible to use unicast IPv4 addresses in network services in config.json.
But: We don't want to assume fixed and known IP addresses. Instead, we want to give our medianet nodes functional host names and use those.
So we need a way to reliably look up names. Currently, several things can go and are going wrong when using hostnames naively:
On the sender, an implicit lookup can yield either an IPv6 or an IPv4 address. It is not clear that the receiver is listening on both.
On the receiver, the "source" host is not the sender, but rather the receiving host itself. The IP is required to determine which network interface to bind to. Here, things usually break because one's own hostname usually resolves to 127.0.0.1 or ::1.
So it's time to write a library function that can be re-used by all network-related services, and place it neatly in /medianet/overlay/usr/local/lib/systemd/scripts.
On a UDP sender, we need to do the following:
if the input is a multicast address, keep it
if the input is a unicast IPv4 address, keep it (but we don't really want have to use it!)
if the input is a hostname (local or fully qualified), perform an A record lookup and substitute its IPv4 address
On a UDP receiver:
if the input is a multicast address, keep it
if the input is one of our own IP addresses, make the service bind to that interface
if the input is textual, check if
it's one of our own hostnames, then bind to that interface
if it's an interface name (such as "medianet0"), bind to that
Currently, we use multicast groups for convenience and ease of setup even when not strictly necessary. With uncompressed video streaming, the network load penalty has become too high, so we need to make unicast just as straightforward.
It is already possible to use unicast IPv4 addresses in network services in config.json. But: We don't want to assume fixed and known IP addresses. Instead, we want to give our medianet nodes functional host names and use those.
So we need a way to reliably look up names. Currently, several things can go and are going wrong when using hostnames naively:
So it's time to write a library function that can be re-used by all network-related services, and place it neatly in /medianet/overlay/usr/local/lib/systemd/scripts.
On a UDP sender, we need to do the following:
On a UDP receiver: