X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fodhcpd.c;h=fafa3f68642781e82fcfeb459c443fe14ad81a90;hb=7798d502f4c2e89a2493c0ea7a800a9359ee0bbc;hp=8a6114892d5e38018ef3c90c6d736a86a440c291;hpb=f21a0a7bbc31ff8b519e566087e5b425c39480c6;p=oweals%2Fodhcpd.git diff --git a/src/odhcpd.c b/src/odhcpd.c index 8a61148..fafa3f6 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -291,31 +291,23 @@ int odhcpd_get_interface_dns_addr(const struct interface *iface, struct in6_addr struct interface* odhcpd_get_interface_by_index(int ifindex) { struct interface *iface; - list_for_each_entry(iface, &interfaces, head) - if (iface->ifindex == ifindex) - return iface; - return NULL; -} - - -struct interface* odhcpd_get_interface_by_name(const char *name) -{ - struct interface *iface; - list_for_each_entry(iface, &interfaces, head) - if (!strcmp(iface->ifname, name)) + avl_for_each_element(&interfaces, iface, avl) { + if (iface->ifindex == ifindex) return iface; + } return NULL; } - struct interface* odhcpd_get_master_interface(void) { struct interface *iface; - list_for_each_entry(iface, &interfaces, head) + + avl_for_each_element(&interfaces, iface, avl) { if (iface->master) return iface; + } return NULL; } @@ -417,7 +409,8 @@ static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even return; } else if (destiface != 0) { struct interface *iface; - list_for_each_entry(iface, &interfaces, head) { + + avl_for_each_element(&interfaces, iface, avl) { if (iface->ifindex != destiface) continue;