Skip to content

Commit b472311

Browse files
committed
dhcpv6: use IAID function from libubox
Replace hash_ifname() with new network_generate_iface_iaid() function from libubox, which is based on MD5. Link: openwrt#150 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
1 parent 8abb450 commit b472311

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/dhcpv6.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <fcntl.h>
2020
#include <inttypes.h>
2121
#include <libubox/md5.h>
22+
#include <libubox/network.h>
2223
#include <limits.h>
2324
#include <netinet/in.h>
2425
#include <net/if.h>
@@ -544,12 +545,6 @@ void dhcpv6_reset_stats(void)
544545
memset(&dhcpv6_stats, 0, sizeof(dhcpv6_stats));
545546
}
546547

547-
uint32_t hash_ifname(const char *s) {
548-
uint32_t h = 0;
549-
while (*s) h = h * 31 + *s++;
550-
return h;
551-
}
552-
553548
int init_dhcpv6(const char *ifname)
554549
{
555550
config_dhcp = config_dhcp_get();
@@ -574,7 +569,7 @@ int init_dhcpv6(const char *ifname)
574569
if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0)
575570
goto failure;
576571

577-
ifname_hash_iaid = hash_ifname(ifname);
572+
ifname_hash_iaid = network_generate_iface_iaid(ifname);
578573

579574
ifindex = ifr.ifr_ifindex;
580575

0 commit comments

Comments
 (0)