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.
This commit is contained in:
Tim Kourt 2019-07-02 16:14:50 -07:00 committed by Denis Kenzior
parent bd4446070f
commit 20466cd735
4 changed files with 90 additions and 2 deletions

View File

@ -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)

View File

@ -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;
}

58
src/resolve.c Normal file
View File

@ -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 <config.h>
#endif
#include <errno.h>
#include <ell/ell.h>
#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)

24
src/resolve.h Normal file
View File

@ -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);