From 28cc555d8504c9429776aedbbe1fee7101258578 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 22 Jul 2014 16:54:47 -0500 Subject: networkd: set route protocol All routes added by networkd are currently set RTPROT_BOOT, which according to the kernel means "Route installed during boot" (rtnetlink.h). But this is not always the case as networkd changes routing after boot too. Since the kernel gives more detailed protocols, use them. With this patch, user-configured static routes now use RTPROT_STATIC (which they are) and DHCP routes use RTPROT_DHCP. There is no define for IPv4LL yet, so those are installed as RTPROT_STATIC (though perhaps RTPROT_RA is better?). [tomegun: fixup src/network/networkd-link.c:972:33: error: too few arguments to function 'route_new_dynamic'] --- src/network/networkd-link.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/network/networkd-link.c') diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 0a6f52408f..86d4b83d3b 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -415,7 +415,7 @@ static int link_set_dhcp_routes(Link *link) { for (i = 0; i < n; i++) { _cleanup_route_free_ Route *route = NULL; - r = route_new_dynamic(&route); + r = route_new_dynamic(&route, RTPROT_DHCP); if (r < 0) { log_error_link(link, "Could not allocate route: %s", strerror(-r)); @@ -481,7 +481,7 @@ static int link_enter_set_routes(Link *link) { } if (r != -ENOENT) { - r = route_new_dynamic(&route); + r = route_new_dynamic(&route, RTPROT_STATIC); if (r < 0) { log_error_link(link, "Could not allocate route: %s", strerror(-r)); @@ -517,14 +517,14 @@ static int link_enter_set_routes(Link *link) { } if (r >= 0) { - r = route_new_dynamic(&route); + r = route_new_dynamic(&route, RTPROT_DHCP); if (r < 0) { log_error_link(link, "Could not allocate route: %s", strerror(-r)); return r; } - r = route_new_dynamic(&route_gw); + r = route_new_dynamic(&route_gw, RTPROT_DHCP); if (r < 0) { log_error_link(link, "Could not allocate route: %s", strerror(-r)); @@ -969,7 +969,7 @@ static int dhcp_lease_lost(Link *link) { for (i = 0; i < n; i++) { _cleanup_route_free_ Route *route = NULL; - r = route_new_dynamic(&route); + r = route_new_dynamic(&route, RTPROT_UNSPEC); if (r >= 0) { route->family = AF_INET; route->in_addr.in = routes[i].gw_addr; @@ -989,7 +989,7 @@ static int dhcp_lease_lost(Link *link) { _cleanup_route_free_ Route *route_gw = NULL; _cleanup_route_free_ Route *route = NULL; - r = route_new_dynamic(&route_gw); + r = route_new_dynamic(&route_gw, RTPROT_UNSPEC); if (r >= 0) { route_gw->family = AF_INET; route_gw->dst_addr.in = gateway; @@ -999,7 +999,7 @@ static int dhcp_lease_lost(Link *link) { route_drop(route_gw, link, &route_drop_handler); } - r = route_new_dynamic(&route); + r = route_new_dynamic(&route, RTPROT_UNSPEC); if (r >= 0) { route->family = AF_INET; route->in_addr.in = gateway; @@ -1316,7 +1316,7 @@ static int ipv4ll_address_lost(Link *link) { address_drop(address, link, &address_drop_handler); - r = route_new_dynamic(&route); + r = route_new_dynamic(&route, RTPROT_UNSPEC); if (r < 0) { log_error_link(link, "Could not allocate route: %s", strerror(-r)); -- cgit v1.2.3-54-g00ecf