X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fodhcpd.h;h=b0801a44b27285a7a48e6f9c8017b10d1d4ac458;hp=1803a413326247e15ed22f81d72c6ea6ccf85cfa;hb=1a313f9052e315571f42e9888d7bc8e443c5bb56;hpb=ab7813e71ca43397071b11250bd40007b116e224 diff --git a/src/odhcpd.h b/src/odhcpd.h index 1803a41..b0801a4 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -42,8 +41,6 @@ #define ND_OPT_DNS_SEARCH 31 #define RELAYD_BUFFER_SIZE 8192 -#define RELAYD_MAX_PREFIXES 8 -#define RELAYD_MAX_ADDRS 8 #define INFINITE_VALID(x) ((x) == 0) @@ -71,13 +68,22 @@ struct odhcpd_event { void (*recv_msgs)(struct odhcpd_event *e); }; +union if_addr { + struct in_addr in; + struct in6_addr in6; +}; struct odhcpd_ipaddr { - struct in6_addr addr; + union if_addr addr; uint8_t prefix; - uint8_t dprefix; uint32_t preferred; uint32_t valid; + + /* ipv6 only */ + uint8_t dprefix; + + /* ipv4 only */ + struct in_addr broadcast; }; enum odhcpd_mode { @@ -118,13 +124,15 @@ struct interface { struct list_head head; int ifindex; - char ifname[IF_NAMESIZE]; - char name[IF_NAMESIZE]; + char *ifname; + const char *name; // Runtime data struct uloop_timeout timer_rs; struct list_head ia_assignments; - struct odhcpd_ipaddr ia_addr[RELAYD_MAX_ADDRS]; + struct odhcpd_ipaddr *addr4; + size_t addr4_len; + struct odhcpd_ipaddr *ia_addr; size_t ia_addr_len; // DHCPv4 @@ -157,7 +165,7 @@ struct interface { // RA int learn_routes; int default_router; - int managed; + int ra_managed; int route_preference; int ra_maxinterval; int ra_mininterval; @@ -182,8 +190,10 @@ struct interface { uint8_t *search; size_t search_len; + // DHCPV6 void *dhcpv6_raw; size_t dhcpv6_raw_len; + bool dhcpv6_assignall; char *upstream; size_t upstream_len; @@ -193,8 +203,9 @@ struct interface { extern struct list_head interfaces; -#define RELAYD_MANAGED_MFLAG 1 -#define RELAYD_MANAGED_NO_AFLAG 2 +#define RA_MANAGED_NO_MFLAG 0 +#define RA_MANAGED_MFLAG 1 +#define RA_MANAGED_NO_AFLAG 2 // Exported main functions @@ -206,8 +217,8 @@ struct nl_sock *odhcpd_create_nl_socket(int protocol); ssize_t odhcpd_send(int socket, struct sockaddr_in6 *dest, struct iovec *iov, size_t iov_len, const struct interface *iface); -ssize_t odhcpd_get_interface_addresses(int ifindex, - struct odhcpd_ipaddr *addrs, size_t cnt); +ssize_t odhcpd_get_interface_addresses(int ifindex, bool v6, + struct odhcpd_ipaddr **addrs); int odhcpd_get_interface_dns_addr(const struct interface *iface, struct in6_addr *addr); struct interface* odhcpd_get_interface_by_name(const char *name); @@ -232,9 +243,6 @@ void odhcpd_bmemcpy(void *av, const void *bv, size_t bits); int config_parse_interface(void *data, size_t len, const char *iname, bool overwrite); -void ndp_handle_addr6_dump(void); -void ndp_rqs_addr6_dump(void); - #ifdef WITH_UBUS int init_ubus(void); const char* ubus_get_ifname(const char *name);