From: Yu Watanabe Date: Fri, 19 Jan 2024 10:24:45 +0000 (+0900) Subject: local-addresses: rename metric -> priority X-Git-Tag: v256-rc1~1074^2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37359b1c8181efa98a2bd8a07f3d55c0db42a3c3;p=thirdparty%2Fsystemd.git local-addresses: rename metric -> priority To make it consistent with the netlink attribute RTA_PRIORITY. --- diff --git a/src/shared/local-addresses.c b/src/shared/local-addresses.c index a1577de0df2..216f5388c75 100644 --- a/src/shared/local-addresses.c +++ b/src/shared/local-addresses.c @@ -25,7 +25,7 @@ static int address_compare(const struct local_address *a, const struct local_add if (r != 0) return r; - r = CMP(a->metric, b->metric); + r = CMP(a->priority, b->priority); if (r != 0) return r; @@ -180,7 +180,7 @@ static int add_local_gateway( size_t *n_list, int af, int ifindex, - uint32_t metric, + uint32_t priority, const RouteVia *via) { assert(list); @@ -195,7 +195,7 @@ static int add_local_gateway( (*list)[(*n_list)++] = (struct local_address) { .ifindex = ifindex, - .metric = metric, + .priority = priority, .family = via->family, .address = via->address, }; @@ -249,7 +249,7 @@ int local_gateways( union in_addr_union gateway; uint16_t type; unsigned char dst_len, src_len, table; - uint32_t ifi = 0, metric = 0; + uint32_t ifi = 0, priority = 0; size_t rta_len; int family; RouteVia via; @@ -283,7 +283,7 @@ int local_gateways( if (table != RT_TABLE_MAIN) continue; - r = sd_netlink_message_read_u32(m, RTA_PRIORITY, &metric); + r = sd_netlink_message_read_u32(m, RTA_PRIORITY, &priority); if (r < 0 && r != -ENODATA) return r; @@ -308,7 +308,7 @@ int local_gateways( if (r >= 0) { via.family = family; via.address = gateway; - r = add_local_gateway(&list, &n_list, af, ifi, metric, &via); + r = add_local_gateway(&list, &n_list, af, ifi, priority, &via); if (r < 0) return r; @@ -322,7 +322,7 @@ int local_gateways( if (r < 0 && r != -ENODATA) return r; if (r >= 0) { - r = add_local_gateway(&list, &n_list, af, ifi, metric, &via); + r = add_local_gateway(&list, &n_list, af, ifi, priority, &via); if (r < 0) return r; @@ -344,7 +344,7 @@ int local_gateways( if (ifindex > 0 && mr->ifindex != ifindex) continue; - r = add_local_gateway(&list, &n_list, af, ifi, metric, &mr->gateway); + r = add_local_gateway(&list, &n_list, af, ifi, priority, &mr->gateway); if (r < 0) return r; } diff --git a/src/shared/local-addresses.h b/src/shared/local-addresses.h index 38a17d233e6..42bed2ba0d5 100644 --- a/src/shared/local-addresses.h +++ b/src/shared/local-addresses.h @@ -6,9 +6,10 @@ #include "in-addr-util.h" struct local_address { - int family, ifindex; + int ifindex; unsigned char scope; - uint32_t metric; + uint32_t priority; + int family; union in_addr_union address; }; diff --git a/src/test/test-local-addresses.c b/src/test/test-local-addresses.c index bad47bc088a..c9ed7bf77d1 100644 --- a/src/test/test-local-addresses.c +++ b/src/test/test-local-addresses.c @@ -10,8 +10,8 @@ static void print_local_addresses(const struct local_address *a, size_t n) { FOREACH_ARRAY(i, a, n) - log_debug("%s ifindex=%i scope=%u metric=%"PRIu32" address=%s", - af_to_name(i->family), i->ifindex, i->scope, i->metric, + log_debug("%s ifindex=%i scope=%u priority=%"PRIu32" address=%s", + af_to_name(i->family), i->ifindex, i->scope, i->priority, IN_ADDR_TO_STRING(i->family, &i->address)); }