netlink: rework handling of netlink messages
[oweals/odhcpd.git] / src / odhcpd.h
index 423deaa1c5c7ed55994af882e734b583e520ab47..f32f34b035e644b6c710bd893e553974ca87d6a5 100644 (file)
 #include <syslog.h>
 
 #include <libubox/blobmsg.h>
-
-#ifndef typeof
-#define typeof __typeof
-#endif
-
-#ifndef container_of
-#define container_of(ptr, type, member) (           \
-    (type *)( (char *)ptr - offsetof(type,member) ))
-#endif
-
 #include <libubox/list.h>
 #include <libubox/uloop.h>
+#include <libubox/avl.h>
 
 // RFC 6106 defines this router advertisement option
 #define ND_OPT_ROUTE_INFO 24
@@ -155,7 +146,7 @@ struct lease {
 
 
 struct interface {
-       struct list_head head;
+       struct avl_node avl;
 
        int ifindex;
        char *ifname;
@@ -203,6 +194,7 @@ struct interface {
        bool ra_not_onlink;
        bool ra_advrouter;
        bool ra_useleasetime;
+       bool ra_dns;
        bool no_dynamic_dhcp;
        uint8_t pio_filter_length;
        struct in6_addr pio_filter_addr;
@@ -245,6 +237,8 @@ struct interface {
        void *dhcpv6_raw;
        size_t dhcpv6_raw_len;
        bool dhcpv6_assignall;
+       bool dhcpv6_pd;
+       bool dhcpv6_na;
 
        char *upstream;
        size_t upstream_len;
@@ -252,7 +246,7 @@ struct interface {
        char *filter_class;
 };
 
-extern struct list_head interfaces;
+extern struct avl_tree interfaces;
 
 #define RA_MANAGED_NO_MFLAG    0
 #define RA_MANAGED_MFLAG       1
@@ -269,7 +263,6 @@ ssize_t odhcpd_send(int socket, struct sockaddr_in6 *dest,
                const struct interface *iface);
 int odhcpd_get_interface_dns_addr(const struct interface *iface,
                struct in6_addr *addr);
-struct interface* odhcpd_get_interface_by_name(const char *name);
 int odhcpd_get_interface_config(const char *ifname, const char *what);
 int odhcpd_get_mac(const struct interface *iface, uint8_t mac[6]);
 struct interface* odhcpd_get_interface_by_index(int ifindex);