summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-07-22 16:54:47 -0500
committerTom Gundersen <teg@jklm.no>2014-07-23 09:19:32 +0200
commit28cc555d8504c9429776aedbbe1fee7101258578 (patch)
tree9b681a3243156df7113eaf82ad5811c8a6138a1f /src/network/networkd-link.c
parent82eb1e7efbe3ca8620d2b183af37c4fd34bf8bb3 (diff)
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']
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c16
1 files changed, 8 insertions, 8 deletions
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));