diff options
author | Pavel Reichl <preichl@redhat.com> | 2015-07-14 04:21:34 -0400 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-07-24 09:30:41 +0200 |
commit | 0a26e92fb2a4dd9704a0578f90241997e2aed269 (patch) | |
tree | e0da82d3b05c8e2287080b15ed7410101bbbdd2e /src/providers | |
parent | 038b9ba28a618e3e553803da632116a040b94034 (diff) | |
download | sssd-0a26e92fb2a4dd9704a0578f90241997e2aed269.tar.gz sssd-0a26e92fb2a4dd9704a0578f90241997e2aed269.tar.xz sssd-0a26e92fb2a4dd9704a0578f90241997e2aed269.zip |
DYNDNS: special value '*' for dyndns_iface option
Option dyndns_iface has now special value '*' which implies that IPs
from add interfaces should be sent during DDNS update.
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/dp_dyndns.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/providers/dp_dyndns.c b/src/providers/dp_dyndns.c index 76562840e..03389acfb 100644 --- a/src/providers/dp_dyndns.c +++ b/src/providers/dp_dyndns.c @@ -42,6 +42,9 @@ #define DYNDNS_TIMEOUT 15 #endif /* DYNDNS_TIMEOUT */ +/* MASK represents special value for matching all interfaces */ +#define MASK "*" + struct sss_iface_addr { struct sss_iface_addr *next; struct sss_iface_addr *prev; @@ -171,6 +174,16 @@ ok_for_dns(struct sockaddr *sa) return true; } +static bool supported_address_family(sa_family_t sa_family) +{ + return sa_family == AF_INET || sa_family == AF_INET6; +} + +static bool matching_name(const char *ifname, const char *ifname2) +{ + return (strcmp(MASK, ifname) == 0) || (strcasecmp(ifname, ifname2) == 0); +} + /* Collect IP addresses associated with an interface */ errno_t sss_iface_addr_list_get(TALLOC_CTX *mem_ctx, const char *ifname, @@ -200,10 +213,9 @@ sss_iface_addr_list_get(TALLOC_CTX *mem_ctx, const char *ifname, if (!ifa->ifa_addr) continue; /* Add IP addresses to the list */ - if ((ifa->ifa_addr->sa_family == AF_INET || - ifa->ifa_addr->sa_family == AF_INET6) && - strcasecmp(ifa->ifa_name, ifname) == 0 && - ok_for_dns(ifa->ifa_addr)) { + if (supported_address_family(ifa->ifa_addr->sa_family) + && matching_name(ifname, ifa->ifa_name) + && ok_for_dns(ifa->ifa_addr)) { /* Add this address to the IP address list */ address = talloc_zero(mem_ctx, struct sss_iface_addr); |