diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-06-03 22:07:45 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-06-07 11:20:09 +0200 |
commit | 6c5a5c9f2a4202de7fcb3c742ae6346f75617f43 (patch) | |
tree | c352d44b811cada807124c9f0af488b5339644b1 | |
parent | ae763642d885dc8d8edc3890a2087bfddbaae635 (diff) | |
download | NetworkManager-6c5a5c9f2a4202de7fcb3c742ae6346f75617f43.tar.gz |
dns: remove nm-dns-utils.c and nm-dns-utils.h
The functions in the two files seem to belong to nm-dns-dnsmasq.c as
nobody else is using them.
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/dns-manager/nm-dns-dnsmasq.c | 71 | ||||
-rw-r--r-- | src/dns-manager/nm-dns-utils.c | 92 | ||||
-rw-r--r-- | src/dns-manager/nm-dns-utils.h | 30 |
4 files changed, 68 insertions, 127 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index e61e5aa9dd..5e289d9363 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -308,8 +308,6 @@ libNetworkManager_la_SOURCES = \ dns-manager/nm-dns-manager.h \ dns-manager/nm-dns-plugin.c \ dns-manager/nm-dns-plugin.h \ - dns-manager/nm-dns-utils.c \ - dns-manager/nm-dns-utils.h \ \ dnsmasq-manager/nm-dnsmasq-manager.c \ dnsmasq-manager/nm-dnsmasq-manager.h \ diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c index bde3427355..69b260687e 100644 --- a/src/dns-manager/nm-dns-dnsmasq.c +++ b/src/dns-manager/nm-dns-dnsmasq.c @@ -29,10 +29,11 @@ #include <linux/if.h> #include "nm-dns-dnsmasq.h" +#include "nm-core-internal.h" +#include "nm-platform.h" #include "nm-utils.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" -#include "nm-dns-utils.h" #include "nm-bus-manager.h" #include "NetworkManagerUtils.h" @@ -70,6 +71,70 @@ typedef struct { /*****************************************************************************/ +static char ** +get_ip4_rdns_domains (NMIP4Config *ip4) +{ + char **strv; + GPtrArray *domains = NULL; + int i; + + g_return_val_if_fail (ip4 != NULL, NULL); + + domains = g_ptr_array_sized_new (5); + + for (i = 0; i < nm_ip4_config_get_num_addresses (ip4); i++) { + const NMPlatformIP4Address *address = nm_ip4_config_get_address (ip4, i); + + nm_utils_get_reverse_dns_domains_ip4 (address->address, address->plen, domains); + } + + for (i = 0; i < nm_ip4_config_get_num_routes (ip4); i++) { + const NMPlatformIP4Route *route = nm_ip4_config_get_route (ip4, i); + + nm_utils_get_reverse_dns_domains_ip4 (route->network, route->plen, domains); + } + + /* Terminating NULL so we can use g_strfreev() to free it */ + g_ptr_array_add (domains, NULL); + + /* Free the array and return NULL if the only element was the ending NULL */ + strv = (char **) g_ptr_array_free (domains, (domains->len == 1)); + + return _nm_utils_strv_cleanup (strv, FALSE, FALSE, TRUE); +} + +static char ** +get_ip6_rdns_domains (NMIP6Config *ip6) +{ + char **strv; + GPtrArray *domains = NULL; + int i; + + g_return_val_if_fail (ip6 != NULL, NULL); + + domains = g_ptr_array_sized_new (5); + + for (i = 0; i < nm_ip6_config_get_num_addresses (ip6); i++) { + const NMPlatformIP6Address *address = nm_ip6_config_get_address (ip6, i); + + nm_utils_get_reverse_dns_domains_ip6 (&address->address, address->plen, domains); + } + + for (i = 0; i < nm_ip6_config_get_num_routes (ip6); i++) { + const NMPlatformIP6Route *route = nm_ip6_config_get_route (ip6, i); + + nm_utils_get_reverse_dns_domains_ip6 (&route->network, route->plen, domains); + } + + /* Terminating NULL so we can use g_strfreev() to free it */ + g_ptr_array_add (domains, NULL); + + /* Free the array and return NULL if the only element was the ending NULL */ + strv = (char **) g_ptr_array_free (domains, (domains->len == 1)); + + return _nm_utils_strv_cleanup (strv, FALSE, FALSE, TRUE); +} + static void add_dnsmasq_nameserver (NMDnsDnsmasq *self, GVariantBuilder *servers, @@ -139,7 +204,7 @@ add_ip4_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP4Config *ip4, /* Ensure reverse-DNS works by directing queries for in-addr.arpa * domains to the split domain's nameserver. */ - domains = nm_dns_utils_get_ip4_rdns_domains (ip4); + domains = get_ip4_rdns_domains (ip4); if (domains) { for (iter = domains; iter && *iter; iter++) add_dnsmasq_nameserver (self, servers, buf, *iter); @@ -253,7 +318,7 @@ add_ip6_config (NMDnsDnsmasq *self, GVariantBuilder *servers, NMIP6Config *ip6, /* Ensure reverse-DNS works by directing queries for ip6.arpa * domains to the split domain's nameserver. */ - domains = nm_dns_utils_get_ip6_rdns_domains (ip6); + domains = get_ip6_rdns_domains (ip6); if (domains) { for (iter = domains; iter && *iter; iter++) add_dnsmasq_nameserver (self, servers, buf, *iter); diff --git a/src/dns-manager/nm-dns-utils.c b/src/dns-manager/nm-dns-utils.c deleted file mode 100644 index f9bb79b65f..0000000000 --- a/src/dns-manager/nm-dns-utils.c +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2010 Red Hat, Inc. - * - */ - -#include "nm-default.h" - -#include <arpa/inet.h> -#include <string.h> - -#include "nm-dns-utils.h" -#include "nm-core-internal.h" -#include "nm-platform.h" -#include "nm-utils.h" - -char ** -nm_dns_utils_get_ip4_rdns_domains (NMIP4Config *ip4) -{ - char **strv; - GPtrArray *domains = NULL; - int i; - - g_return_val_if_fail (ip4 != NULL, NULL); - - domains = g_ptr_array_sized_new (5); - - for (i = 0; i < nm_ip4_config_get_num_addresses (ip4); i++) { - const NMPlatformIP4Address *address = nm_ip4_config_get_address (ip4, i); - - nm_utils_get_reverse_dns_domains_ip4 (address->address, address->plen, domains); - } - - for (i = 0; i < nm_ip4_config_get_num_routes (ip4); i++) { - const NMPlatformIP4Route *route = nm_ip4_config_get_route (ip4, i); - - nm_utils_get_reverse_dns_domains_ip4 (route->network, route->plen, domains); - } - - /* Terminating NULL so we can use g_strfreev() to free it */ - g_ptr_array_add (domains, NULL); - - /* Free the array and return NULL if the only element was the ending NULL */ - strv = (char **) g_ptr_array_free (domains, (domains->len == 1)); - - return _nm_utils_strv_cleanup (strv, FALSE, FALSE, TRUE); -} - -char ** -nm_dns_utils_get_ip6_rdns_domains (NMIP6Config *ip6) -{ - char **strv; - GPtrArray *domains = NULL; - int i; - - g_return_val_if_fail (ip6 != NULL, NULL); - - domains = g_ptr_array_sized_new (5); - - for (i = 0; i < nm_ip6_config_get_num_addresses (ip6); i++) { - const NMPlatformIP6Address *address = nm_ip6_config_get_address (ip6, i); - - nm_utils_get_reverse_dns_domains_ip6 (&address->address, address->plen, domains); - } - - for (i = 0; i < nm_ip6_config_get_num_routes (ip6); i++) { - const NMPlatformIP6Route *route = nm_ip6_config_get_route (ip6, i); - - nm_utils_get_reverse_dns_domains_ip6 (&route->network, route->plen, domains); - } - - /* Terminating NULL so we can use g_strfreev() to free it */ - g_ptr_array_add (domains, NULL); - - /* Free the array and return NULL if the only element was the ending NULL */ - strv = (char **) g_ptr_array_free (domains, (domains->len == 1)); - - return _nm_utils_strv_cleanup (strv, FALSE, FALSE, TRUE); -} diff --git a/src/dns-manager/nm-dns-utils.h b/src/dns-manager/nm-dns-utils.h deleted file mode 100644 index 2c484ac341..0000000000 --- a/src/dns-manager/nm-dns-utils.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2010 Red Hat, Inc. - * - */ - -#ifndef __NETWORKMANAGER_DNS_UTILS_H__ -#define __NETWORKMANAGER_DNS_UTILS_H__ - -#include "nm-ip4-config.h" -#include "nm-ip6-config.h" - -char **nm_dns_utils_get_ip4_rdns_domains (NMIP4Config *ip4); -char **nm_dns_utils_get_ip6_rdns_domains (NMIP6Config *ip6); - -#endif /* NM_DNS_UTILS_H */ - |