X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fnetwork%2Fnetworkd-route.c;h=46a4537196aae3695a938446f61a6d12ad815904;hb=12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3;hp=83dad655db19658d5434c4191881afae439c21bd;hpb=b3070dc0258831c7e2b13624f75fa3dbd80d9833;p=elogind.git diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 83dad655d..46a453719 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -47,6 +47,8 @@ int route_new_static(Network *network, unsigned section, Route **ret) { if (!route) return -ENOMEM; + route->family = AF_UNSPEC; + route->network = network; LIST_PREPEND(static_routes, network->static_routes, route); @@ -69,6 +71,8 @@ int route_new_dynamic(Route **ret) { if (!route) return -ENOMEM; + route->family = AF_UNSPEC; + *ret = route; route = NULL; @@ -92,7 +96,7 @@ void route_free(Route *route) { int route_configure(Route *route, Link *link, sd_rtnl_message_handler_t callback) { - _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL; + _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL; int r; assert(link); @@ -101,7 +105,8 @@ int route_configure(Route *route, Link *link, assert(link->ifindex > 0); assert(route->family == AF_INET || route->family == AF_INET6); - r = sd_rtnl_message_route_new(RTM_NEWROUTE, route->family, &req); + r = sd_rtnl_message_new_route(link->manager->rtnl, &req, + RTM_NEWROUTE, route->family); if (r < 0) { log_error("Could not create RTM_NEWROUTE message: %s", strerror(-r)); return r; @@ -231,7 +236,7 @@ int config_parse_destination(const char *unit, return log_oom(); } - r = net_parse_inaddr(address, &n->dst_family, &n->dst_addr); + r = net_parse_inaddr(address, &n->family, &n->dst_addr); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Destination is invalid, ignoring assignment: %s", address); @@ -252,7 +257,7 @@ int config_parse_destination(const char *unit, n->dst_prefixlen = (unsigned char) i; } else { - switch (n->dst_family) { + switch (n->family) { case AF_INET: n->dst_prefixlen = 32; break;