]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: route - clean up confusion between 'metric' and 'priority'
authorTom Gundersen <teg@jklm.no>
Mon, 26 Oct 2015 16:04:57 +0000 (17:04 +0100)
committerTom Gundersen <teg@jklm.no>
Fri, 30 Oct 2015 11:32:48 +0000 (12:32 +0100)
Different tools use different terms for the same concept, let's try
to stick with 'priority', as that is what the netlink API uses.

src/network/networkd-dhcp4.c
src/network/networkd-ipv4ll.c
src/network/networkd-network.c
src/network/networkd-route.c
src/network/networkd-route.h

index 4f7f595adccb038dee90b717b8280293341494c7..05a16f40334c5e59a204e4960bda49b1caf45059 100644 (file)
@@ -92,7 +92,7 @@ static int link_set_dhcp_routes(Link *link) {
                 route_gw->prefsrc.in = address;
                 route_gw->scope = RT_SCOPE_LINK;
                 route_gw->protocol = RTPROT_DHCP;
-                route_gw->metrics = link->network->dhcp_route_metric;
+                route_gw->priority = link->network->dhcp_route_metric;
 
                 r = route_configure(route_gw, link, &dhcp4_route_handler);
                 if (r < 0)
@@ -103,7 +103,7 @@ static int link_set_dhcp_routes(Link *link) {
                 route->family = AF_INET;
                 route->gw.in = gateway;
                 route->prefsrc.in = address;
-                route->metrics = link->network->dhcp_route_metric;
+                route->priority = link->network->dhcp_route_metric;
 
                 r = route_configure(route, link, &dhcp4_route_handler);
                 if (r < 0) {
@@ -133,7 +133,7 @@ static int link_set_dhcp_routes(Link *link) {
                 route->gw.in = static_routes[i].gw_addr;
                 route->dst.in = static_routes[i].dst_addr;
                 route->dst_prefixlen = static_routes[i].dst_prefixlen;
-                route->metrics = link->network->dhcp_route_metric;
+                route->priority = link->network->dhcp_route_metric;
 
                 r = route_configure(route, link, &dhcp4_route_handler);
                 if (r < 0)
index 2fdb77ef6c5a64e6f0e44d24f85d314742266e92..59abb1e8d4533f055a2f811e41420cc1db96c7a8 100644 (file)
@@ -63,7 +63,7 @@ static int ipv4ll_address_lost(Link *link) {
 
         route->family = AF_INET;
         route->scope = RT_SCOPE_LINK;
-        route->metrics = IPV4LL_ROUTE_METRIC;
+        route->priority = IPV4LL_ROUTE_METRIC;
 
         route_remove(route, link, &link_route_remove_handler);
 
@@ -156,7 +156,7 @@ static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) {
         route->family = AF_INET;
         route->scope = RT_SCOPE_LINK;
         route->protocol = RTPROT_STATIC;
-        route->metrics = IPV4LL_ROUTE_METRIC;
+        route->priority = IPV4LL_ROUTE_METRIC;
 
         r = route_configure(route, link, ipv4ll_route_handler);
         if (r < 0)
index c73d68201b458a3cf48aea60d6ca77916786d070..14c201e9a55ec6ba36f526422ddf718c65c3b932 100644 (file)
@@ -370,7 +370,7 @@ int network_apply(Manager *manager, Network *network, Link *link) {
                 route->family = AF_INET;
                 route->dst_prefixlen = 16;
                 route->scope = RT_SCOPE_LINK;
-                route->metrics = IPV4LL_ROUTE_METRIC;
+                route->priority = IPV4LL_ROUTE_METRIC;
                 route->protocol = RTPROT_STATIC;
         }
 
index 5674e0493b4114e4c04d5ef18d7be6c10afd0dbf..078d9c16184f4e25e1ba722c1198f25ff7a8ebaf 100644 (file)
@@ -134,7 +134,6 @@ static int route_compare_func(const void *_a, const void *_b) {
         switch (a->family) {
         case AF_INET:
         case AF_INET6:
-                //TODO: check IPv6 routes
                 if (a->dst_prefixlen < b->dst_prefixlen)
                         return -1;
                 if (a->dst_prefixlen > b->dst_prefixlen)
@@ -232,7 +231,7 @@ int route_remove(Route *route, Link *link,
         if (r < 0)
                 return log_error_errno(r, "Could not set scope: %m");
 
-        r = sd_netlink_message_append_u32(req, RTA_PRIORITY, route->metrics);
+        r = sd_netlink_message_append_u32(req, RTA_PRIORITY, route->priority);
         if (r < 0)
                 return log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m");
 
@@ -314,7 +313,7 @@ int route_configure(Route *route, Link *link,
         if (r < 0)
                 return log_error_errno(r, "Could not set scope: %m");
 
-        r = sd_netlink_message_append_u32(req, RTA_PRIORITY, route->metrics);
+        r = sd_netlink_message_append_u32(req, RTA_PRIORITY, route->priority);
         if (r < 0)
                 return log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m");
 
@@ -521,9 +520,9 @@ int config_parse_route_priority(const char *unit,
         if (r < 0)
                 return r;
 
-        r = config_parse_unsigned(unit, filename, line, section,
-                                  section_line, lvalue, ltype,
-                                  rvalue, &n->metrics, userdata);
+        r = config_parse_uint32(unit, filename, line, section,
+                                section_line, lvalue, ltype,
+                                rvalue, &n->priority, userdata);
         if (r < 0)
                 return r;
 
index 2c0b7054024628324fe624c56cd221475462f831..b1ed5d108542084dbb856613abe9df92476cd36f 100644 (file)
@@ -34,10 +34,9 @@ struct Route {
         unsigned char dst_prefixlen;
         unsigned char src_prefixlen;
         unsigned char scope;
-        uint32_t metrics;
         unsigned char protocol;  /* RTPROT_* */
         unsigned char tos;
-        unsigned char priority;
+        uint32_t priority; /* note that ip(8) calls this 'metric' */
         unsigned char table;
 
         union in_addr_union gw;