From: Yu Watanabe Date: Wed, 19 May 2021 01:49:05 +0000 (+0900) Subject: network: expose hash and compare functions X-Git-Tag: v249-rc1~76^2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f33159190229099c9572a062f8996726225a1ac;p=thirdparty%2Fsystemd.git network: expose hash and compare functions --- diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c index b10c08dec4c..147dca7ef3b 100644 --- a/src/network/networkd-neighbor.c +++ b/src/network/networkd-neighbor.c @@ -69,7 +69,7 @@ static int neighbor_new_static(Network *network, const char *filename, unsigned return 0; } -static void neighbor_hash_func(const Neighbor *neighbor, struct siphash *state) { +void neighbor_hash_func(const Neighbor *neighbor, struct siphash *state) { assert(neighbor); siphash24_compress(&neighbor->family, sizeof(neighbor->family), state); @@ -89,7 +89,7 @@ static void neighbor_hash_func(const Neighbor *neighbor, struct siphash *state) siphash24_compress(&neighbor->lladdr, neighbor->lladdr_size, state); } -static int neighbor_compare_func(const Neighbor *a, const Neighbor *b) { +int neighbor_compare_func(const Neighbor *a, const Neighbor *b) { int r; r = CMP(a->family, b->family); diff --git a/src/network/networkd-neighbor.h b/src/network/networkd-neighbor.h index 7ac2f90eb38..8feb515e05d 100644 --- a/src/network/networkd-neighbor.h +++ b/src/network/networkd-neighbor.h @@ -33,6 +33,9 @@ typedef struct Neighbor { Neighbor *neighbor_free(Neighbor *neighbor); +void neighbor_hash_func(const Neighbor *neighbor, struct siphash *state); +int neighbor_compare_func(const Neighbor *a, const Neighbor *b); + void network_drop_invalid_neighbors(Network *network); int link_drop_neighbors(Link *link); diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index 2bd1cec0bd5..954790f832c 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -104,7 +104,7 @@ static int nexthop_new_static(Network *network, const char *filename, unsigned s return 0; } -static void nexthop_hash_func(const NextHop *nexthop, struct siphash *state) { +void nexthop_hash_func(const NextHop *nexthop, struct siphash *state) { assert(nexthop); siphash24_compress(&nexthop->protocol, sizeof(nexthop->protocol), state); @@ -124,7 +124,7 @@ static void nexthop_hash_func(const NextHop *nexthop, struct siphash *state) { } } -static int nexthop_compare_func(const NextHop *a, const NextHop *b) { +int nexthop_compare_func(const NextHop *a, const NextHop *b) { int r; r = CMP(a->protocol, b->protocol); diff --git a/src/network/networkd-nexthop.h b/src/network/networkd-nexthop.h index fee186aed24..9904ab8ff1a 100644 --- a/src/network/networkd-nexthop.h +++ b/src/network/networkd-nexthop.h @@ -37,6 +37,9 @@ typedef struct NextHop { NextHop *nexthop_free(NextHop *nexthop); +void nexthop_hash_func(const NextHop *nexthop, struct siphash *state); +int nexthop_compare_func(const NextHop *a, const NextHop *b); + void network_drop_invalid_nexthops(Network *network); int link_drop_nexthops(Link *link); diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index 3860f6df30f..a319a6fbe3a 100644 --- a/src/network/networkd-routing-policy-rule.c +++ b/src/network/networkd-routing-policy-rule.c @@ -143,7 +143,7 @@ static int routing_policy_rule_dup(const RoutingPolicyRule *src, RoutingPolicyRu return 0; } -static void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct siphash *state) { +void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct siphash *state) { assert(rule); siphash24_compress(&rule->family, sizeof(rule->family), state); @@ -183,7 +183,7 @@ static void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct } } -static int routing_policy_rule_compare_func(const RoutingPolicyRule *a, const RoutingPolicyRule *b) { +int routing_policy_rule_compare_func(const RoutingPolicyRule *a, const RoutingPolicyRule *b) { int r; r = CMP(a->family, b->family); diff --git a/src/network/networkd-routing-policy-rule.h b/src/network/networkd-routing-policy-rule.h index 69b05356592..aed37b00d21 100644 --- a/src/network/networkd-routing-policy-rule.h +++ b/src/network/networkd-routing-policy-rule.h @@ -52,6 +52,9 @@ typedef struct RoutingPolicyRule { RoutingPolicyRule *routing_policy_rule_free(RoutingPolicyRule *rule); +void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct siphash *state); +int routing_policy_rule_compare_func(const RoutingPolicyRule *a, const RoutingPolicyRule *b); + void network_drop_invalid_routing_policy_rules(Network *network); int link_request_static_routing_policy_rules(Link *link);