networkd: always prefer dhcp routes over ipv4ll routes
authorLennart Poettering <lennart@poettering.net>
Thu, 10 Jul 2014 19:32:44 +0000 (21:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 10 Jul 2014 19:32:44 +0000 (21:32 +0200)
src/network/networkd-link.c
src/network/networkd.h

index 6257372..3e35090 100644 (file)
@@ -427,7 +427,7 @@ static int link_set_dhcp_routes(Link *link) {
                 route->in_addr.in = static_routes[i].gw_addr;
                 route->dst_addr.in = static_routes[i].dst_addr;
                 route->dst_prefixlen = static_routes[i].dst_prefixlen;
-                route->metrics = DHCP_STATIC_ROUTE_METRIC;
+                route->metrics = DHCP_ROUTE_METRIC;
 
                 r = route_configure(route, link, &route_handler);
                 if (r < 0) {
@@ -491,7 +491,7 @@ static int link_enter_set_routes(Link *link) {
 
                         route->family = AF_INET;
                         route->scope = RT_SCOPE_LINK;
-                        route->metrics = 99;
+                        route->metrics = IPV4LL_ROUTE_METRIC;
 
                         r = route_configure(route, link, &route_handler);
                         if (r < 0) {
@@ -539,7 +539,7 @@ static int link_enter_set_routes(Link *link) {
                         route_gw->dst_addr.in = gateway;
                         route_gw->dst_prefixlen = 32;
                         route_gw->scope = RT_SCOPE_LINK;
-                        route_gw->metrics = DHCP_STATIC_ROUTE_METRIC;
+                        route_gw->metrics = DHCP_ROUTE_METRIC;
 
                         r = route_configure(route_gw, link, &route_handler);
                         if (r < 0) {
@@ -552,7 +552,7 @@ static int link_enter_set_routes(Link *link) {
 
                         route->family = AF_INET;
                         route->in_addr.in = gateway;
-                        route->metrics = DHCP_STATIC_ROUTE_METRIC;
+                        route->metrics = DHCP_ROUTE_METRIC;
 
                         r = route_configure(route, link, &route_handler);
                         if (r < 0) {
index c39d221..9132e70 100644 (file)
@@ -42,7 +42,8 @@
 
 #define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
 #define VXLAN_VID_MAX (1u << 24) - 1
-#define DHCP_STATIC_ROUTE_METRIC 1024
+#define DHCP_ROUTE_METRIC 1024
+#define IPV4LL_ROUTE_METRIC 2048
 
 typedef struct NetDev NetDev;
 typedef struct Network Network;