]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: make neighbor_hash_func() handle the same data as neighbor_compare_func()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 17 Sep 2019 17:13:09 +0000 (19:13 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 17 Sep 2019 17:13:09 +0000 (19:13 +0200)
In practice this probably makes little difference, because we only use AF_INET
and AF_INET6, but it's cleaner to use the same logic in both places.

src/network/networkd-neighbor.c

index 537f6be9e16c7b9cd4bea5083e5b4b3830a5bb1a..fd61ebd5d37b12d02a50fccfd2e769397bc51c70 100644 (file)
@@ -209,18 +209,20 @@ static void neighbor_hash_func(const Neighbor *neighbor, struct siphash *state)
         assert(neighbor);
 
         siphash24_compress(&neighbor->family, sizeof(neighbor->family), state);
+        siphash24_compress(&neighbor->lladdr_size, sizeof(neighbor->lladdr_size), state);
 
         switch (neighbor->family) {
         case AF_INET:
         case AF_INET6:
                 /* Equality of neighbors are given by the pair (addr,lladdr) */
                 siphash24_compress(&neighbor->in_addr, FAMILY_ADDRESS_SIZE(neighbor->family), state);
-                siphash24_compress(&neighbor->lladdr, neighbor->lladdr_size, state);
                 break;
         default:
                 /* treat any other address family as AF_UNSPEC */
                 break;
         }
+
+        siphash24_compress(&neighbor->lladdr, neighbor->lladdr_size, state);
 }
 
 static int neighbor_compare_func(const Neighbor *a, const Neighbor *b) {