summaryrefslogtreecommitdiff
path: root/src/network/networkd-tunnel.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-07-03 10:55:59 +0200
committerTom Gundersen <teg@jklm.no>2014-07-03 11:00:36 +0200
commit6ef892fc05791a6609489df7b5d1b081819c5de9 (patch)
tree994309eb9ccd4b857ca64cf6a3f09b82517ca59c /src/network/networkd-tunnel.c
parent4826dd6850478ddec604787756db26c1ab2c106f (diff)
networkd: netdev - move tunnel address parsing to networkd-tunnel.c
Diffstat (limited to 'src/network/networkd-tunnel.c')
-rw-r--r--src/network/networkd-tunnel.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/network/networkd-tunnel.c b/src/network/networkd-tunnel.c
index bd12259420..7341487795 100644
--- a/src/network/networkd-tunnel.c
+++ b/src/network/networkd-tunnel.c
@@ -30,6 +30,7 @@
#include "network-internal.h"
#include "util.h"
#include "missing.h"
+#include "conf-parser.h"
static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) {
@@ -535,3 +536,32 @@ int netdev_create_tunnel(NetDev *netdev, Link *link, sd_rtnl_message_handler_t c
return 0;
}
+
+int config_parse_tunnel_address(const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+ NetDev *n = userdata;
+ union in_addr_union *addr = data;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ r = net_parse_inaddr(rvalue, &n->family, addr);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Tunnel address is invalid, ignoring assignment: %s", rvalue);
+ return 0;
+ }
+
+ return 0;
+}