X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fnetwork%2Fnetworkd-netdev-tunnel.c;h=174fe234fd40406afce30e69322c3f96a8e73ae2;hp=4561f8d0a9544da173d2bb45e78acd0f357e986e;hb=9fdaa9925e1919b766fe1e095228fe663c583923;hpb=aa9f11405829fd4755fef28602a7167dba3ddc89 diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c index 4561f8d0a..174fe234f 100644 --- a/src/network/networkd-netdev-tunnel.c +++ b/src/network/networkd-netdev-tunnel.c @@ -27,6 +27,7 @@ #include "sd-rtnl.h" #include "networkd-netdev-tunnel.h" +#include "networkd-link.h" #include "network-internal.h" #include "util.h" #include "missing.h" @@ -114,7 +115,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl); if (r < 0) { log_error_netdev(netdev, - "Could not append IFLA_IPTUN_TTL attribute: %s", + "Could not append IFLA_IPTUN_TTL attribute: %s", strerror(-r)); return r; } @@ -266,21 +267,28 @@ int config_parse_tunnel_address(const char *unit, void *data, void *userdata) { Tunnel *t = userdata; - union in_addr_union *addr = data; - int r; + union in_addr_union *addr = data, buffer; + int r, f; assert(filename); assert(lvalue); assert(rvalue); assert(data); - r = net_parse_inaddr(rvalue, &t->family, addr); + r = in_addr_from_string_auto(rvalue, &f, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Tunnel address is invalid, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Tunnel address is invalid, ignoring assignment: %s", rvalue); + return 0; + } + + if (t->family != AF_UNSPEC && t->family != f) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Tunnel addresses incompatible, ignoring assignment: %s", rvalue); return 0; } + t->family = f; + *addr = buffer; + return 0; }