summaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 05:20:03 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 05:20:03 +0100
commitb2e576bb172fcce419e639216393126c94fc99fa (patch)
tree959818b9660ba8957b5d211e6067e10c2774fc62 /src/config.c
parent2c6147d4d47e68301e13545fc0a95bd3a16f0e30 (diff)
downloadfastd-b2e576bb172fcce419e639216393126c94fc99fa.tar
fastd-b2e576bb172fcce419e639216393126c94fc99fa.zip
Improve ifname configuration handling
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/config.c b/src/config.c
index 725c4e4..511d4e7 100644
--- a/src/config.c
+++ b/src/config.c
@@ -98,6 +98,18 @@ void fastd_config_method(fastd_peer_group_t *group, const char *name) {
*method = fastd_string_stack_dup(name);
}
+bool fastd_config_ifname(fastd_peer_t *peer, const char *ifname) {
+ if (strchr(ifname, '/'))
+ return false;
+
+ char **name = peer ? &peer->ifname : &conf.ifname;
+
+ free(*name);
+ *name = fastd_strdup(ifname);
+
+ return true;
+}
+
/** Handles the configuration of a cipher implementation */
void fastd_config_cipher(const char *name, const char *impl) {
if (!fastd_cipher_config(name, impl))
@@ -533,11 +545,6 @@ void fastd_configure(int argc, char *const argv[]) {
/** Performs some basic checks on the configuration */
static void config_check_base(void) {
- if (conf.ifname) {
- if (strchr(conf.ifname, '/'))
- exit_error("config error: invalid interface name");
- }
-
#ifndef USE_PACKET_MARK
if (conf.packet_mark)
exit_error("config error: setting a packet mark is not supported on this system");