X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fdhcpv6-ia.c;h=6568c69446655d8922aeb4ae74a0923ad8df2a26;hp=04d92fe918524be0199782cff16b581a3ee11509;hb=24cdc1b59f00a065dd1cf0a04145ca6aaf6f23f1;hpb=ff5020d9c0474c6a76ee30e499983a4d3a9f27b7 diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 04d92fe..6568c69 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -53,7 +53,7 @@ int dhcpv6_ia_init(void) return 0; } -int setup_dhcpv6_ia_interface(struct interface *iface, bool enable) +int dhcpv6_setup_ia_interface(struct interface *iface, bool enable) { if (!enable && iface->ia_assignments.next) { struct dhcpv6_assignment *c; @@ -64,7 +64,7 @@ int setup_dhcpv6_ia_interface(struct interface *iface, bool enable) } } - if (enable && iface->dhcpv6 == RELAYD_SERVER) { + if (enable && iface->dhcpv6 == MODE_SERVER) { if (!iface->ia_assignments.next) INIT_LIST_HEAD(&iface->ia_assignments); @@ -347,11 +347,11 @@ void dhcpv6_write_statefile(void) ctxt.buf_len = sizeof(leasebuf); list_for_each_entry(ctxt.iface, &interfaces, head) { - if (ctxt.iface->dhcpv6 != RELAYD_SERVER && - ctxt.iface->dhcpv4 != RELAYD_SERVER) + if (ctxt.iface->dhcpv6 != MODE_SERVER && + ctxt.iface->dhcpv4 != MODE_SERVER) continue; - if (ctxt.iface->dhcpv6 == RELAYD_SERVER && + if (ctxt.iface->dhcpv6 == MODE_SERVER && ctxt.iface->ia_assignments.next) { list_for_each_entry(ctxt.c, &ctxt.iface->ia_assignments, head) { if (!(ctxt.c->flags & OAF_BOUND) || ctxt.c->managed_size < 0) @@ -379,7 +379,7 @@ void dhcpv6_write_statefile(void) } } - if (ctxt.iface->dhcpv4 == RELAYD_SERVER && + if (ctxt.iface->dhcpv4 == MODE_SERVER && ctxt.iface->dhcpv4_assignments.next) { struct dhcpv4_assignment *c; list_for_each_entry(c, &ctxt.iface->dhcpv4_assignments, head) { @@ -397,9 +397,9 @@ void dhcpv6_write_statefile(void) (c->valid_until > now ? (c->valid_until - now + wall_time) : (INFINITE_VALID(c->valid_until) ? -1 : 0)), - c->addr); + ntohl(c->addr)); - struct in_addr addr = {htonl(c->addr)}; + struct in_addr addr = {.s_addr = c->addr}; inet_ntop(AF_INET, &addr, ipbuf, sizeof(ipbuf) - 1); if (c->hostname) { @@ -454,7 +454,7 @@ static void apply_lease(struct interface *iface, struct dhcpv6_assignment *a, bo struct in6_addr prefix = addrs[i].addr.in6; prefix.s6_addr32[1] |= htonl(a->assigned); prefix.s6_addr32[2] = prefix.s6_addr32[3] = 0; - odhcpd_setup_route(&prefix, (a->managed_size) ? addrs[i].prefix : a->length, + netlink_setup_route(&prefix, (a->managed_size) ? addrs[i].prefix : a->length, iface, &a->peer.sin6_addr, 1024, add); } } @@ -657,7 +657,7 @@ static bool assign_na(struct interface *iface, struct dhcpv6_assignment *assign) void dhcpv6_ia_preupdate(struct interface *iface) { - if (iface->dhcpv6 != RELAYD_SERVER) + if (iface->dhcpv6 != MODE_SERVER) return; struct dhcpv6_assignment *c, *border = list_last_entry( @@ -701,7 +701,7 @@ static void stop_reconf(struct dhcpv6_assignment *a) void dhcpv6_ia_postupdate(struct interface *iface) { - if (iface->dhcpv6 != RELAYD_SERVER) + if (iface->dhcpv6 != MODE_SERVER) return; time_t now = odhcpd_time(); @@ -762,7 +762,7 @@ static void valid_until_cb(struct uloop_timeout *event) time_t now = odhcpd_time(); struct interface *iface; list_for_each_entry(iface, &interfaces, head) { - if (iface->dhcpv6 != RELAYD_SERVER || iface->ia_assignments.next == NULL) + if (iface->dhcpv6 != MODE_SERVER || iface->ia_assignments.next == NULL) continue; struct dhcpv6_assignment *a, *n;