From 20466cd735d44c978fe544cddf2d91053b0290f3 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Tue, 2 Jul 2019 16:14:50 -0700 Subject: [PATCH] resolve: Introduce resolve module The module is responsible for the configuration of the address resolution services. It will consist of the multiple service specific plugins such as: systemd-resolved plugin, dnsmasq plugin, etc. --- Makefile.am | 1 + src/netconfig.c | 9 ++++++-- src/resolve.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ src/resolve.h | 24 ++++++++++++++++++++ 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 src/resolve.c create mode 100644 src/resolve.h diff --git a/Makefile.am b/Makefile.am index 5eabb7dd..d03f7e3a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -207,6 +207,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \ src/auth-proto.h \ src/anqp.h src/anqp.c \ src/netconfig.h src/netconfig.c\ + src/resolve.h src/resolve.c\ src/hotspot.h src/hotspot.c \ $(eap_sources) \ $(builtin_sources) diff --git a/src/netconfig.c b/src/netconfig.c index 195b6625..25fc2c63 100644 --- a/src/netconfig.c +++ b/src/netconfig.c @@ -38,6 +38,7 @@ #include "src/common.h" #include "src/network.h" #include "src/rtnlutil.h" +#include "src/resolve.h" #include "src/netconfig.h" struct netconfig { @@ -277,7 +278,9 @@ static bool netconfig_install_addresses(struct netconfig *netconfig, } gateway: - /* TODO: Add the routes and domain name servers. */ + /* TODO: Add the routes. */ + + resolve_add_dns(netconfig->ifindex, ifaddr->family, dns); return true; } @@ -299,7 +302,9 @@ static bool netconfig_uninstall_addresses(struct netconfig *netconfig, } gateway: - /* TODO: Remove the routes and domain name servers. */ + /* TODO: Remove the routes. */ + + resolve_remove(netconfig->ifindex); return true; } diff --git a/src/resolve.c b/src/resolve.c new file mode 100644 index 00000000..3b45087a --- /dev/null +++ b/src/resolve.c @@ -0,0 +1,58 @@ +/* + * + * Wireless daemon for Linux + * + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include + +#include "src/iwd.h" +#include "src/resolve.h" + +void resolve_add_dns(uint32_t ifindex, uint8_t type, char **dns_list) +{ +} + +void resolve_remove(uint32_t ifindex) +{ +} + +static int resolve_init(void) +{ + bool enabled; + + if (!l_settings_get_bool(iwd_get_config(), "General", + "enable_network_config", &enabled) || + !enabled) + return 0; + + return 0; +} + +static void resolve_exit(void) +{ +} + +IWD_MODULE(resolve, resolve_init, resolve_exit) diff --git a/src/resolve.h b/src/resolve.h new file mode 100644 index 00000000..b0335868 --- /dev/null +++ b/src/resolve.h @@ -0,0 +1,24 @@ +/* + * + * Wireless daemon for Linux + * + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +void resolve_add_dns(uint32_t ifindex, uint8_t type, char **dns_list); +void resolve_remove(uint32_t ifindex);