]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: expose hash and compare functions
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 19 May 2021 01:49:05 +0000 (10:49 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Jun 2021 21:33:27 +0000 (06:33 +0900)
src/network/networkd-neighbor.c
src/network/networkd-neighbor.h
src/network/networkd-nexthop.c
src/network/networkd-nexthop.h
src/network/networkd-routing-policy-rule.c
src/network/networkd-routing-policy-rule.h

index b10c08dec4ca01c94c1b9b37b9a71c5bcf72a017..147dca7ef3b7e1632d2f837fbdd45898148f4aea 100644 (file)
@@ -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);
index 7ac2f90eb388e33e0b5bbad4f8e00c6a507c001d..8feb515e05d7bedfba59cd4ee85c0c1be34f9627 100644 (file)
@@ -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);
index 2bd1cec0bd59fe92cc3f56c6e9ef83b415d5812d..954790f832c9218f8a145ab748ce71e27d86879b 100644 (file)
@@ -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);
index fee186aed2411cd9a39daac019f67956f8fb6eaa..9904ab8ff1acf202d22d445fc31c0fb4a4728455 100644 (file)
@@ -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);
index 3860f6df30f2c7ecd2a0dead02b648848a7efa16..a319a6fbe3a16285c637eec47c1bcbfae8434925 100644 (file)
@@ -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);
index 69b053565928d5ccd456516fa680d84afba52459..aed37b00d21d7689c92f7b1efd257beb0df4048c 100644 (file)
@@ -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);