return 0;
}
-int dhcpv6_setup_ia_interface(struct interface *iface, bool enable)
+int dhcpv6_ia_setup_interface(struct interface *iface, bool enable)
{
if (!enable && iface->ia_assignments.next) {
struct dhcp_assignment *c;
return odhcpd_send(iface->dhcpv6_event.uloop.fd, &assign->peer, &iov, 1, iface);
}
-void dhcpv6_enum_ia_addrs(struct interface *iface, struct dhcp_assignment *c,
+void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c,
time_t now, dhcpv6_binding_cb_handler_t func, void *arg)
{
struct odhcpd_ipaddr *addrs = (c->managed) ? c->managed : iface->addr6;
"%s/%d ", ipbuf, prefix);
}
-void dhcpv6_write_statefile(void)
+void dhcpv6_ia_write_statefile(void)
{
struct write_ctxt ctxt;
ctxt.c->assigned, (unsigned)ctxt.c->length);
if (INFINITE_VALID(ctxt.c->valid_until) || ctxt.c->valid_until > now)
- dhcpv6_enum_ia_addrs(ctxt.iface, ctxt.c, now,
+ dhcpv6_ia_enum_addrs(ctxt.iface, ctxt.c, now,
dhcpv6_write_ia_addr, &ctxt);
ctxt.buf[ctxt.buf_idx - 1] = '\n';
}
}
- dhcpv6_write_statefile();
+ dhcpv6_ia_write_statefile();
}
static void reconf_timeout_cb(struct uloop_timeout *event)
.buf_len = sizeof(leasebuf),
.buf_idx = 0 };
- dhcpv6_enum_ia_addrs(iface, a, now, dhcpv6_log_ia_addr, &ctxt);
+ dhcpv6_ia_enum_addrs(iface, a, now, dhcpv6_log_ia_addr, &ctxt);
}
syslog(LOG_WARNING, "DHCPV6 %s %s from %s on %s: %s %s", type, (is_pd) ? "IA_PD" : "IA_NA",
return onlink;
}
-ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface,
+ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *iface,
const struct sockaddr_in6 *addr, const void *data, const uint8_t *end)
{
time_t now = odhcpd_time();
break;
}
- dhcpv6_write_statefile();
+ dhcpv6_ia_write_statefile();
out:
return response_len;
odhcpd_register(&iface->dhcpv6_event);
}
- ret = dhcpv6_setup_ia_interface(iface, enable);
+ ret = dhcpv6_ia_setup_interface(iface, enable);
out:
if (ret < 0 && iface->dhcpv6_event.uloop.fd > 0) {
}
if (hdr->msg_type != DHCPV6_MSG_INFORMATION_REQUEST) {
- ssize_t ialen = dhcpv6_handle_ia(pdbuf, sizeof(pdbuf), iface, addr, data, opts_end);
+ ssize_t ialen = dhcpv6_ia_handle_IAs(pdbuf, sizeof(pdbuf), iface, addr, data, opts_end);
iov[IOV_PDBUF].iov_len = ialen;
if (ialen < 0 ||
struct in6_addr addr;
};
-typedef void (*dhcpv6_binding_cb_handler_t)(struct in6_addr *addr, int prefix,
- uint32_t pref, uint32_t valid,
- void *arg);
-
#define dhcpv6_for_each_option(start, end, otype, olen, odata)\
for (uint8_t *_o = (uint8_t*)(start); _o + 4 <= (end) &&\
((otype) = _o[0] << 8 | _o[1]) && ((odata) = (void*)&_o[4]) &&\
((olen) = _o[2] << 8 | _o[3]) + (odata) <= (end); \
_o += 4 + (_o[2] << 8 | _o[3]))
-
-int dhcpv6_init_ia(struct interface *iface, int socket);
-ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface,
- const struct sockaddr_in6 *addr, const void *data, const uint8_t *end);
-int dhcpv6_ia_init(void);
-int dhcpv6_setup_ia_interface(struct interface *iface, bool enable);
-void dhcpv6_enum_ia_addrs(struct interface *iface, struct dhcp_assignment *c, time_t now,
- dhcpv6_binding_cb_handler_t func, void *arg);
-void dhcpv6_write_statefile(void);
void (*recv_msgs)(struct odhcpd_event *e);
};
+typedef void (*dhcpv6_binding_cb_handler_t)(struct in6_addr *addr, int prefix,
+ uint32_t pref, uint32_t valid,
+ void *arg);
+
union if_addr {
struct in_addr in;
struct in6_addr in6;
const struct in_addr *addr, const char *name, const char *interface);
#endif
+ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *iface,
+ const struct sockaddr_in6 *addr, const void *data, const uint8_t *end);
+int dhcpv6_ia_init(void);
+int dhcpv6_ia_setup_interface(struct interface *iface, bool enable);
+void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, time_t now,
+ dhcpv6_binding_cb_handler_t func, void *arg);
+void dhcpv6_ia_write_statefile(void);
+
int netlink_add_netevent_handler(struct netevent_handler *hdlr);
ssize_t netlink_get_interface_addrs(const int ifindex, bool v6,
struct odhcpd_ipaddr **addrs);
blobmsg_close_array(&b, m);
m = blobmsg_open_array(&b, a->length == 128 ? "ipv6-addr": "ipv6-prefix");
- dhcpv6_enum_ia_addrs(iface, a, now, dhcpv6_blobmsg_ia_addr, NULL);
+ dhcpv6_ia_enum_addrs(iface, a, now, dhcpv6_blobmsg_ia_addr, NULL);
blobmsg_close_table(&b, m);
blobmsg_add_u32(&b, "valid", INFINITE_VALID(a->valid_until) ?