router: improve error checking
[project/odhcpd.git] / src / odhcpd.h
index 45badd3c012acbf553f773ce536e342132ca5117..91fdcbfe27ead984cebd2c69e3dbd44a7ec2a06c 100644 (file)
 #define _unused __attribute__((unused))
 #define _packed __attribute__((packed))
 
-
-#define ALL_IPV6_NODES {{{0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}}
-
-#define ALL_IPV6_ROUTERS {{{0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}}}
+#define ALL_IPV6_NODES "ff02::1"
+#define ALL_IPV6_ROUTERS "ff02::2"
 
 #define IN6_IS_ADDR_ULA(a) (((a)->s6_addr32[0] & htonl(0xfe000000)) == htonl(0xfc000000))
 
@@ -133,8 +129,9 @@ enum odhcpd_mode {
 
 
 enum odhcpd_assignment_flags {
-       OAF_BOUND       = (1 << 0),
-       OAF_STATIC      = (1 << 1),
+       OAF_TENTATIVE   = (1 << 0),
+       OAF_BOUND       = (1 << 1),
+       OAF_STATIC      = (1 << 2),
 };
 
 struct config {
@@ -208,6 +205,8 @@ struct interface {
        bool ra_advrouter;
        bool ra_useleasetime;
        bool no_dynamic_dhcp;
+       uint8_t pio_filter_length;
+       struct in6_addr pio_filter_addr;
 
        // RA
        int learn_routes;
@@ -282,6 +281,7 @@ void odhcpd_run(void);
 time_t odhcpd_time(void);
 ssize_t odhcpd_unhexlify(uint8_t *dst, size_t len, const char *src);
 void odhcpd_hexlify(char *dst, const uint8_t *src, size_t len);
+const char *odhcpd_print_mac(const uint8_t *mac, const size_t len);
 
 int odhcpd_bmemcmp(const void *av, const void *bv, size_t bits);
 void odhcpd_bmemcpy(void *av, const void *bv, size_t bits);
@@ -296,6 +296,8 @@ int ubus_init(void);
 const char* ubus_get_ifname(const char *name);
 void ubus_apply_network(void);
 bool ubus_has_prefix(const char *name, const char *ifname);
+void ubus_bcast_dhcp_event(const char *type, const uint8_t *mac, const size_t mac_len,
+               const struct in_addr *addr, const char *name, const char *interface);
 #endif
 
 int netlink_add_netevent_handler(struct netevent_handler *hdlr);