diff options
author | Tom Gundersen <teg@jklm.no> | 2014-07-03 10:52:42 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-07-03 11:00:36 +0200 |
commit | 4826dd6850478ddec604787756db26c1ab2c106f (patch) | |
tree | bc0f27a1465cc81ff6774277236d4dfe4570a84c /src/network/networkd-tunnel.c | |
parent | 30ae9dfda3788cdfaf1b84d124dbc7feb638c77b (diff) |
networkd: tunnels - make tunnel address parsing generic
It had a bug in the typing, fix that and also make it save the address family so we
can print proper error messages.
Diffstat (limited to 'src/network/networkd-tunnel.c')
-rw-r--r-- | src/network/networkd-tunnel.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/network/networkd-tunnel.c b/src/network/networkd-tunnel.c index cffa5644ca..bd12259420 100644 --- a/src/network/networkd-tunnel.c +++ b/src/network/networkd-tunnel.c @@ -43,6 +43,8 @@ static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) { netdev = link->network->tunnel; + assert(netdev->family == AF_INET); + r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname); if (r < 0) { log_error_netdev(netdev, @@ -96,7 +98,7 @@ static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } - r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &netdev->local); + r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &netdev->local.in); if (r < 0) { log_error_netdev(netdev, "Could not append IFLA_IPTUN_LOCAL attribute: %s", @@ -104,7 +106,7 @@ static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } - r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &netdev->remote); + r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &netdev->remote.in); if (r < 0) { log_error_netdev(netdev, "Could not append IFLA_IPTUN_REMOTE attribute: %s", @@ -150,6 +152,8 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { netdev = link->network->tunnel; + assert(netdev->family == AF_INET); + r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname); if (r < 0) { log_error_netdev(netdev, @@ -203,7 +207,7 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } - r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &netdev->local); + r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &netdev->local.in); if (r < 0) { log_error_netdev(netdev, "Could not append IFLA_IPTUN_LOCAL attribute: %s", @@ -211,7 +215,7 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } - r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &netdev->remote); + r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &netdev->remote.in); if (r < 0) { log_error_netdev(netdev, "Could not append IFLA_IPTUN_REMOTE attribute: %s", @@ -265,6 +269,8 @@ static int netdev_fill_ipgre_rtnl_message(Link *link, sd_rtnl_message *m) { netdev = link->network->tunnel; + assert(netdev->family == AF_INET); + r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname); if (r < 0) { log_error_netdev(netdev, @@ -318,7 +324,7 @@ static int netdev_fill_ipgre_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } - r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_LOCAL, &netdev->local); + r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_LOCAL, &netdev->local.in); if (r < 0) { log_error_netdev(netdev, "Could not append IFLA_GRE_LOCAL attribute: %s", @@ -326,7 +332,7 @@ static int netdev_fill_ipgre_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } - r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_REMOTE, &netdev->remote); + r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_REMOTE, &netdev->remote.in); if (r < 0) { log_error_netdev(netdev, "Could not append IFLA_GRE_REMOTE attribute: %s", @@ -380,6 +386,8 @@ static int netdev_fill_vti_rtnl_message(Link *link, sd_rtnl_message *m) { netdev = link->network->tunnel; + assert(netdev->family == AF_INET); + r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname); if (r < 0) { log_error_netdev(netdev, @@ -433,7 +441,7 @@ static int netdev_fill_vti_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } - r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_LOCAL, &netdev->local); + r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_LOCAL, &netdev->local.in); if (r < 0) { log_error_netdev(netdev, "Could not append IFLA_IPTUN_LOCAL attribute: %s", @@ -441,7 +449,7 @@ static int netdev_fill_vti_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } - r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_REMOTE, &netdev->remote); + r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_REMOTE, &netdev->remote.in); if (r < 0) { log_error_netdev(netdev, "Could not append IFLA_IPTUN_REMOTE attribute: %s", |