Browse Source

TT#157801 support "any" interface config

Allow usage of "any" as interface config option to configure any and all
locally present network address, except loopback. This allows us to ship
a working default config file.

Change-Id: Ic13efd5f668e3bb317948b226c5700331f95a708
pull/1430/head
Richard Fuchs 4 years ago
parent
commit
aad3fb3130
2 changed files with 11 additions and 2 deletions
  1. +6
    -1
      daemon/main.c
  2. +5
    -1
      daemon/rtpengine.pod

+ 6
- 1
daemon/main.c View File

@ -180,8 +180,13 @@ static void __find_if_name(char *s, struct ifaddrs *ifas, GQueue *addrs) {
sockaddr_t *addr; sockaddr_t *addr;
for (struct ifaddrs *ifa = ifas; ifa; ifa = ifa->ifa_next) { for (struct ifaddrs *ifa = ifas; ifa; ifa = ifa->ifa_next) {
if (strcmp(ifa->ifa_name, s))
if (!strcmp(s, "any")) {
if ((ifa->ifa_flags & IFF_LOOPBACK))
continue;
}
else if (strcmp(ifa->ifa_name, s))
continue; continue;
if (!(ifa->ifa_flags & IFF_UP)) if (!(ifa->ifa_flags & IFF_UP))
continue; continue;
if (!ifa->ifa_addr) if (!ifa->ifa_addr)


+ 5
- 1
daemon/rtpengine.pod View File

@ -1016,7 +1016,7 @@ B<interface> config file option, specify local network interfaces for RTP.
At least one must be given, but multiple can be specified. At least one must be given, but multiple can be specified.
The format of the value is [I<NAME>B</>]I<IP>[!I<IP>] with I<IP> being The format of the value is [I<NAME>B</>]I<IP>[!I<IP>] with I<IP> being
either an IPv4 address, an IPv6 address, the name of a system network interface either an IPv4 address, an IPv6 address, the name of a system network interface
(such as I<eth0>), or a DNS host name (such as I<test.example.com>).
(such as I<eth0>), a DNS host name (such as I<test.example.com>), or B<any>.
The possibility of configuring a network interface by name rather than The possibility of configuring a network interface by name rather than
by address should not be confused with the logical interface name used by address should not be confused with the logical interface name used
@ -1033,6 +1033,10 @@ must be an actual network address and cannot be an interface name.)
If DNS host names are used instead of addresses or interface names, the lookup If DNS host names are used instead of addresses or interface names, the lookup
will be done only once during daemon start-up. will be done only once during daemon start-up.
The special keyword B<any> can be used to listen on any and all available local
interface addresses except from loopback devices. This keyword should only be
given once in place of a more explicit interface configuration.
To configure multiple interfaces using the command-line options, To configure multiple interfaces using the command-line options,
simply present multiple B<-i> or B<--interface> options. simply present multiple B<-i> or B<--interface> options.
When using the config file, only use a single B<interface> line, When using the config file, only use a single B<interface> line,


Loading…
Cancel
Save