diff options
author | Tom Gundersen <teg@jklm.no> | 2015-10-26 17:04:57 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-10-30 12:32:48 +0100 |
commit | 86655331bc28887def7998d321b14ef8fccbeaf9 (patch) | |
tree | ee9688d449630e5366f0dbe6d5a002cba29ae005 /src/network | |
parent | 2ce409569093f7c2c6732246978a901a27f2bce3 (diff) |
networkd: route - clean up confusion between 'metric' and 'priority'
Different tools use different terms for the same concept, let's try
to stick with 'priority', as that is what the netlink API uses.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-dhcp4.c | 6 | ||||
-rw-r--r-- | src/network/networkd-ipv4ll.c | 4 | ||||
-rw-r--r-- | src/network/networkd-network.c | 2 | ||||
-rw-r--r-- | src/network/networkd-route.c | 11 | ||||
-rw-r--r-- | src/network/networkd-route.h | 3 |
5 files changed, 12 insertions, 14 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 4f7f595adc..05a16f4033 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -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) diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c index 2fdb77ef6c..59abb1e8d4 100644 --- a/src/network/networkd-ipv4ll.c +++ b/src/network/networkd-ipv4ll.c @@ -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) diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index c73d68201b..14c201e9a5 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -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; } diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 5674e0493b..078d9c1618 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -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; diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h index 2c0b705402..b1ed5d1085 100644 --- a/src/network/networkd-route.h +++ b/src/network/networkd-route.h @@ -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; |