1
/* dnsmasq is Copyright (c) 2000-2013 Simon Kelley
1
/* dnsmasq is Copyright (c) 2000-2014 Simon Kelley
3
3
This program is free software; you can redistribute it and/or modify
4
4
it under the terms of the GNU General Public License as published by
24
24
int clid_len, iaid, ia_type, interface, hostname_auth, lease_allocate;
25
25
char *client_hostname, *hostname, *domain, *send_domain;
26
26
struct dhcp_context *context;
27
struct in6_addr *link_address, *fallback;
27
struct in6_addr *link_address, *fallback, *ll_addr, *ula_addr;
28
28
unsigned int xid, fqdn_flags;
30
30
void *packet_options, *end;
75
75
unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name,
76
struct in6_addr *fallback, size_t sz, struct in6_addr *client_addr, time_t now)
76
struct in6_addr *fallback, struct in6_addr *ll_addr, struct in6_addr *ula_addr,
77
size_t sz, struct in6_addr *client_addr, time_t now)
78
79
struct dhcp_vendor *vendor;
93
94
state.interface = interface;
94
95
state.iface_name = iface_name;
95
96
state.fallback = fallback;
97
state.ll_addr = ll_addr;
98
state.ula_addr = ula_addr;
97
100
state.tags = NULL;
98
101
state.link_address = NULL;
1272
if (opt_cfg->opt == OPTION6_DNS_SERVER)
1275
if (opt_cfg->len == 0)
1279
1275
if (opt_cfg->opt == OPTION6_REFRESH_TIME)
1280
1276
done_refresh = 1;
1282
o = new_opt6(opt_cfg->opt);
1283
1278
if (opt_cfg->flags & DHOPT_ADDR6)
1286
struct in6_addr *a = (struct in6_addr *)opt_cfg->val;
1287
for (j = 0; j < opt_cfg->len; j+=IN6ADDRSZ, a++)
1289
/* zero means "self" (but not in vendorclass options.) */
1290
if (IN6_IS_ADDR_UNSPECIFIED(a))
1292
if (!add_local_addrs(state->context))
1293
put_opt6(state->fallback, IN6ADDRSZ);
1283
if (opt_cfg->opt == OPTION6_DNS_SERVER)
1286
for (a = (struct in6_addr *)opt_cfg->val, len = opt_cfg->len, j = 0;
1287
j < opt_cfg->len; j += IN6ADDRSZ, a++)
1288
if ((IN6_IS_ADDR_ULA_ZERO(a) && IN6_IS_ADDR_UNSPECIFIED(state->ula_addr)) ||
1289
(IN6_IS_ADDR_LINK_LOCAL_ZERO(a) && IN6_IS_ADDR_UNSPECIFIED(state->ll_addr)))
1295
o = new_opt6(opt_cfg->opt);
1297
for (a = (struct in6_addr *)opt_cfg->val, j = 0; j < opt_cfg->len; j+=IN6ADDRSZ, a++)
1299
if (IN6_IS_ADDR_UNSPECIFIED(a))
1301
if (!add_local_addrs(state->context))
1302
put_opt6(state->fallback, IN6ADDRSZ);
1304
else if (IN6_IS_ADDR_ULA_ZERO(a))
1306
if (!IN6_IS_ADDR_UNSPECIFIED(state->ula_addr))
1307
put_opt6(state->ula_addr, IN6ADDRSZ);
1309
else if (IN6_IS_ADDR_LINK_LOCAL_ZERO(a))
1311
if (!IN6_IS_ADDR_UNSPECIFIED(state->ll_addr))
1312
put_opt6(state->ll_addr, IN6ADDRSZ);
1315
put_opt6(a, IN6ADDRSZ);
1296
put_opt6(a, IN6ADDRSZ);
1299
else if (opt_cfg->val)
1300
put_opt6(opt_cfg->val, opt_cfg->len);
1323
o = new_opt6(opt_cfg->opt);
1325
put_opt6(opt_cfg->val, opt_cfg->len);
1304
1330
if (daemon->port == NAMESERVER_PORT && !done_dns)