Replace option sol_max_rt by inf_max_rt in reply response to information request
[project/odhcpd.git] / src / dhcpv6.c
1 /**
2  * Copyright (C) 2012-2013 Steven Barth <steven@midlink.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License v2 as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  *
14  */
15
16 #include <errno.h>
17 #include <unistd.h>
18 #include <stddef.h>
19 #include <resolv.h>
20 #include <sys/timerfd.h>
21
22 #include "odhcpd.h"
23 #include "dhcpv6.h"
24
25
26 static void relay_client_request(struct sockaddr_in6 *source,
27                 const void *data, size_t len, struct interface *iface);
28 static void relay_server_response(uint8_t *data, size_t len);
29
30 static void handle_dhcpv6(void *addr, void *data, size_t len,
31                 struct interface *iface, void *dest);
32 static void handle_client_request(void *addr, void *data, size_t len,
33                 struct interface *iface, void *dest_addr);
34
35
36
37 // Create socket and register events
38 int init_dhcpv6(void)
39 {
40         dhcpv6_ia_init();
41         return 0;
42 }
43
44
45 int setup_dhcpv6_interface(struct interface *iface, bool enable)
46 {
47         if (iface->dhcpv6_event.uloop.fd > 0) {
48                 uloop_fd_delete(&iface->dhcpv6_event.uloop);
49                 close(iface->dhcpv6_event.uloop.fd);
50                 iface->dhcpv6_event.uloop.fd = -1;
51         }
52
53         // Configure multicast settings
54         if (enable && iface->dhcpv6 && !iface->master) {
55                 int sock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP);
56                 if (sock < 0) {
57                         syslog(LOG_ERR, "Failed to create DHCPv6 server socket: %s",
58                                         strerror(errno));
59                         return -1;
60                 }
61
62                 // Basic IPv6 configuration
63                 setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, iface->ifname, strlen(iface->ifname));
64
65                 int val = 1;
66                 setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof(val));
67                 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
68                 setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val, sizeof(val));
69
70                 val = DHCPV6_HOP_COUNT_LIMIT;
71                 setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val, sizeof(val));
72
73                 val = 0;
74                 setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val, sizeof(val));
75
76                 struct sockaddr_in6 bind_addr = {AF_INET6, htons(DHCPV6_SERVER_PORT),
77                                         0, IN6ADDR_ANY_INIT, 0};
78
79                 if (bind(sock, (struct sockaddr*)&bind_addr, sizeof(bind_addr))) {
80                         syslog(LOG_ERR, "Failed to open DHCPv6 server socket: %s",
81                                         strerror(errno));
82                         return -1;
83                 }
84
85                 struct ipv6_mreq relay = {ALL_DHCPV6_RELAYS, iface->ifindex};
86                 struct ipv6_mreq server = {ALL_DHCPV6_SERVERS, iface->ifindex};
87                 setsockopt(sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &relay, sizeof(relay));
88
89                 if (iface->dhcpv6 == RELAYD_SERVER)
90                         setsockopt(sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &server, sizeof(server));
91
92                 iface->dhcpv6_event.uloop.fd = sock;
93                 iface->dhcpv6_event.handle_dgram = handle_dhcpv6;
94                 odhcpd_register(&iface->dhcpv6_event);
95         }
96
97         return setup_dhcpv6_ia_interface(iface, enable);
98 }
99
100 enum {
101         IOV_NESTED = 0,
102         IOV_DEST,
103         IOV_MAXRT,
104 #define IOV_STAT IOV_MAXRT
105         IOV_DNS,
106         IOV_DNS_ADDR,
107         IOV_SEARCH,
108         IOV_SEARCH_DOMAIN,
109         IOV_PDBUF,
110 #define IOV_REFRESH IOV_PDBUF
111         IOV_CERID,
112         IOV_DHCPV6_RAW,
113         IOV_RELAY_MSG,
114         IOV_TOTAL
115 };
116
117 static void handle_nested_message(uint8_t *data, size_t len,
118                 uint8_t **opts, uint8_t **end, struct iovec iov[IOV_TOTAL - 1])
119 {
120         struct dhcpv6_relay_header *hdr = (struct dhcpv6_relay_header*)data;
121         if (iov[IOV_NESTED].iov_base == NULL) {
122                 iov[IOV_NESTED].iov_base = data;
123                 iov[IOV_NESTED].iov_len = len;
124         }
125
126         if (len < sizeof(struct dhcpv6_client_header))
127                 return;
128
129         if (hdr->msg_type != DHCPV6_MSG_RELAY_FORW) {
130                 iov[IOV_NESTED].iov_len = data - (uint8_t*)iov[IOV_NESTED].iov_base;
131                 struct dhcpv6_client_header *hdr = (void*)data;
132                 *opts = (uint8_t*)&hdr[1];
133                 *end = data + len;
134                 return;
135         }
136
137         uint16_t otype, olen;
138         uint8_t *odata;
139         dhcpv6_for_each_option(hdr->options, data + len, otype, olen, odata) {
140                 if (otype == DHCPV6_OPT_RELAY_MSG) {
141                         iov[IOV_RELAY_MSG].iov_base = odata + olen;
142                         iov[IOV_RELAY_MSG].iov_len = (((uint8_t*)iov[IOV_NESTED].iov_base) + 
143                                         iov[IOV_NESTED].iov_len) - (odata + olen);
144                         handle_nested_message(odata, olen, opts, end, iov);
145                         return;
146                 }
147         }
148 }
149
150
151 static void update_nested_message(uint8_t *data, size_t len, ssize_t pdiff)
152 {
153         struct dhcpv6_relay_header *hdr = (struct dhcpv6_relay_header*)data;
154         if (hdr->msg_type != DHCPV6_MSG_RELAY_FORW)
155                 return;
156
157         hdr->msg_type = DHCPV6_MSG_RELAY_REPL;
158
159         uint16_t otype, olen;
160         uint8_t *odata;
161         dhcpv6_for_each_option(hdr->options, data + len, otype, olen, odata) {
162                 if (otype == DHCPV6_OPT_RELAY_MSG) {
163                         olen += pdiff;
164                         odata[-2] = (olen >> 8) & 0xff;
165                         odata[-1] = olen & 0xff;
166                         update_nested_message(odata, olen - pdiff, pdiff);
167                         return;
168                 }
169         }
170 }
171
172 // Simple DHCPv6-server for information requests
173 static void handle_client_request(void *addr, void *data, size_t len,
174                 struct interface *iface, void *dest_addr)
175 {
176         struct dhcpv6_client_header *hdr = data;
177
178         if (len < sizeof(*hdr))
179                 return;
180
181         syslog(LOG_NOTICE, "Got DHCPv6 request");
182
183         // Construct reply message
184         struct __attribute__((packed)) {
185                 uint8_t msg_type;
186                 uint8_t tr_id[3];
187                 uint16_t serverid_type;
188                 uint16_t serverid_length;
189                 uint16_t duid_type;
190                 uint16_t hardware_type;
191                 uint8_t mac[6];
192                 uint16_t clientid_type;
193                 uint16_t clientid_length;
194                 uint8_t clientid_buf[130];
195         } dest = {
196                 .msg_type = DHCPV6_MSG_REPLY,
197                 .serverid_type = htons(DHCPV6_OPT_SERVERID),
198                 .serverid_length = htons(10),
199                 .duid_type = htons(3),
200                 .hardware_type = htons(1),
201                 .clientid_type = htons(DHCPV6_OPT_CLIENTID),
202                 .clientid_buf = {0}
203         };
204         odhcpd_get_mac(iface, dest.mac);
205
206         struct __attribute__((packed)) {
207                 uint16_t type;
208                 uint16_t len;
209                 uint32_t value;
210         } maxrt = {htons(DHCPV6_OPT_SOL_MAX_RT), htons(sizeof(maxrt) - 4),
211                         htonl(60)};
212
213         struct __attribute__((packed)) {
214                 uint16_t type;
215                 uint16_t len;
216                 uint16_t value;
217         } stat = {htons(DHCPV6_OPT_STATUS), htons(sizeof(stat) - 4),
218                         htons(DHCPV6_STATUS_USEMULTICAST)};
219
220         struct __attribute__((packed)) {
221                 uint16_t type;
222                 uint16_t len;
223                 uint32_t value;
224         } refresh = {htons(DHCPV6_OPT_INFO_REFRESH), htons(sizeof(uint32_t)),
225                         htonl(600)};
226
227         struct odhcpd_ipaddr ipaddr;
228         struct in6_addr *dns_addr = iface->dns;
229         size_t dns_cnt = iface->dns_cnt;
230
231         if (dns_cnt == 0 && odhcpd_get_interface_addresses(iface->ifindex, &ipaddr, 1) == 1) {
232                 dns_addr = &ipaddr.addr;
233                 dns_cnt = 1;
234         }
235
236         struct {
237                 uint16_t type;
238                 uint16_t len;
239         } dns = {htons(DHCPV6_OPT_DNS_SERVERS), htons(dns_cnt * sizeof(*dns_addr))};
240
241
242
243         // DNS Search options
244         uint8_t search_buf[256], *search_domain = iface->search;
245         size_t search_len = iface->search_len;
246
247         if (!search_domain && !res_init() && _res.dnsrch[0] && _res.dnsrch[0][0]) {
248                 int len = dn_comp(_res.dnsrch[0], search_buf,
249                                 sizeof(search_buf), NULL, NULL);
250                 if (len > 0) {
251                         search_domain = search_buf;
252                         search_len = len;
253                 }
254         }
255
256         struct {
257                 uint16_t type;
258                 uint16_t len;
259         } search = {htons(DHCPV6_OPT_DNS_DOMAIN), htons(search_len)};
260
261
262         struct dhcpv6_cer_id cerid = {
263 #ifdef EXT_CER_ID
264                 .type = htons(EXT_CER_ID),
265 #endif
266                 .len = htons(36),
267                 .addr = iface->dhcpv6_pd_cer,
268         };
269
270
271         uint8_t pdbuf[512];
272         struct iovec iov[IOV_TOTAL] = {
273                 [IOV_NESTED] = {NULL, 0},
274                 [IOV_DEST] = {&dest, (uint8_t*)&dest.clientid_type - (uint8_t*)&dest},
275                 [IOV_MAXRT] = {&maxrt, sizeof(maxrt)},
276                 [IOV_DNS] = {&dns, (dns_cnt) ? sizeof(dns) : 0},
277                 [IOV_DNS_ADDR] = {dns_addr, dns_cnt * sizeof(*dns_addr)},
278                 [IOV_SEARCH] = {&search, (search_len) ? sizeof(search) : 0},
279                 [IOV_SEARCH_DOMAIN] = {search_domain, search_len},
280                 [IOV_PDBUF] = {pdbuf, 0},
281                 [IOV_CERID] = {&cerid, 0},
282                 [IOV_DHCPV6_RAW] = {iface->dhcpv6_raw, iface->dhcpv6_raw_len},
283                 [IOV_RELAY_MSG] = {NULL, 0}
284         };
285
286         uint8_t *opts = (uint8_t*)&hdr[1], *opts_end = (uint8_t*)data + len;
287         if (hdr->msg_type == DHCPV6_MSG_RELAY_FORW)
288                 handle_nested_message(data, len, &opts, &opts_end, iov);
289
290         memcpy(dest.tr_id, &opts[-3], sizeof(dest.tr_id));
291
292         if (opts[-4] == DHCPV6_MSG_ADVERTISE || opts[-4] == DHCPV6_MSG_REPLY || opts[-4] == DHCPV6_MSG_RELAY_REPL)
293                 return;
294
295         if (!IN6_IS_ADDR_MULTICAST((struct in6_addr *)dest_addr) && iov[IOV_NESTED].iov_len == 0 &&
296                 (opts[-4] == DHCPV6_MSG_SOLICIT || opts[-4] == DHCPV6_MSG_CONFIRM ||
297                  opts[-4] == DHCPV6_MSG_REBIND || opts[-4] == DHCPV6_MSG_INFORMATION_REQUEST))
298                 return;
299
300         if (opts[-4] == DHCPV6_MSG_SOLICIT) {
301                 dest.msg_type = DHCPV6_MSG_ADVERTISE;
302         } else if (opts[-4] == DHCPV6_MSG_INFORMATION_REQUEST) {
303                 iov[IOV_REFRESH].iov_base = &refresh;
304                 iov[IOV_REFRESH].iov_len = sizeof(refresh);
305
306                 // Return inf max rt option in reply to information request
307                 maxrt.type = htons(DHCPV6_OPT_INF_MAX_RT);
308         }
309
310         // Go through options and find what we need
311         uint16_t otype, olen;
312         uint8_t *odata;
313         dhcpv6_for_each_option(opts, opts_end, otype, olen, odata) {
314                 if (otype == DHCPV6_OPT_CLIENTID && olen <= 130) {
315                         dest.clientid_length = htons(olen);
316                         memcpy(dest.clientid_buf, odata, olen);
317                         iov[IOV_DEST].iov_len += 4 + olen;
318                 } else if (otype == DHCPV6_OPT_SERVERID) {
319                         if (olen != ntohs(dest.serverid_length) ||
320                                         memcmp(odata, &dest.duid_type, olen))
321                                 return; // Not for us
322                 } else if (iface->filter_class && otype == DHCPV6_OPT_USER_CLASS) {
323                         uint8_t *c = odata, *cend = &odata[olen];
324                         for (; &c[2] <= cend && &c[2 + (c[0] << 8) + c[1]] <= cend; c = &c[2 + (c[0] << 8) + c[1]]) {
325                                 size_t elen = strlen(iface->filter_class);
326                                 if (((((size_t)c[0]) << 8) | c[1]) == elen && !memcmp(&c[2], iface->filter_class, elen))
327                                         return; // Ignore from homenet
328                         }
329                 } else if (otype == DHCPV6_OPT_IA_PD) {
330 #ifdef EXT_CER_ID
331                         iov[IOV_CERID].iov_len = sizeof(cerid);
332
333                         if (IN6_IS_ADDR_UNSPECIFIED(&cerid.addr)) {
334                                 struct odhcpd_ipaddr addrs[32];
335                                 ssize_t len = odhcpd_get_interface_addresses(0, addrs,
336                                                 sizeof(addrs) / sizeof(*addrs));
337
338                                 for (ssize_t i = 0; i < len; ++i)
339                                         if (IN6_IS_ADDR_UNSPECIFIED(&cerid.addr)
340                                                         || memcmp(&addrs[i].addr, &cerid.addr, sizeof(cerid.addr)) < 0)
341                                                 cerid.addr = addrs[i].addr;
342                         }
343 #endif
344                 }
345         }
346
347         if (!IN6_IS_ADDR_MULTICAST((struct in6_addr *)dest_addr) && iov[IOV_NESTED].iov_len == 0 &&
348                 (opts[-4] == DHCPV6_MSG_REQUEST || opts[-4] == DHCPV6_MSG_RENEW ||
349                  opts[-4] == DHCPV6_MSG_RELEASE || opts[-4] == DHCPV6_MSG_DECLINE)) {
350                 iov[IOV_STAT].iov_base = &stat;
351                 iov[IOV_STAT].iov_len = sizeof(stat);
352
353                 for (ssize_t i = IOV_STAT + 1; i < IOV_TOTAL; ++i)
354                         iov[i].iov_len = 0;
355
356                 odhcpd_send(iface->dhcpv6_event.uloop.fd, addr, iov, ARRAY_SIZE(iov), iface);
357                 return;
358         }
359
360         if (opts[-4] != DHCPV6_MSG_INFORMATION_REQUEST) {
361                 ssize_t ialen = dhcpv6_handle_ia(pdbuf, sizeof(pdbuf), iface, addr, &opts[-4], opts_end);
362                 iov[IOV_PDBUF].iov_len = ialen;
363                 if (ialen < 0 || (ialen == 0 && (opts[-4] == DHCPV6_MSG_REBIND || opts[-4] == DHCPV6_MSG_CONFIRM)))
364                         return;
365         }
366
367         if (iov[IOV_NESTED].iov_len > 0) // Update length
368                 update_nested_message(data, len, iov[IOV_DEST].iov_len + iov[IOV_MAXRT].iov_len +
369                                 iov[IOV_DNS].iov_len + iov[IOV_DNS_ADDR].iov_len +
370                                 iov[IOV_SEARCH].iov_len + iov[IOV_SEARCH_DOMAIN].iov_len +
371                                 iov[IOV_PDBUF].iov_len + iov[IOV_CERID].iov_len +
372                                 iov[IOV_DHCPV6_RAW].iov_len - (4 + opts_end - opts));
373
374         odhcpd_send(iface->dhcpv6_event.uloop.fd, addr, iov, ARRAY_SIZE(iov), iface);
375 }
376
377
378 // Central DHCPv6-relay handler
379 static void handle_dhcpv6(void *addr, void *data, size_t len,
380                 struct interface *iface, void *dest_addr)
381 {
382         if (iface->dhcpv6 == RELAYD_SERVER) {
383                 handle_client_request(addr, data, len, iface, dest_addr);
384         } else if (iface->dhcpv6 == RELAYD_RELAY) {
385                 if (iface->master)
386                         relay_server_response(data, len);
387                 else
388                         relay_client_request(addr, data, len, iface);
389         }
390 }
391
392
393 // Relay server response (regular relay server handling)
394 static void relay_server_response(uint8_t *data, size_t len)
395 {
396         // Information we need to gather
397         uint8_t *payload_data = NULL;
398         size_t payload_len = 0;
399         int32_t ifaceidx = 0;
400         struct sockaddr_in6 target = {AF_INET6, htons(DHCPV6_CLIENT_PORT),
401                 0, IN6ADDR_ANY_INIT, 0};
402
403         syslog(LOG_NOTICE, "Got a DHCPv6-reply");
404
405         int otype, olen;
406         uint8_t *odata, *end = data + len;
407
408         // Relay DHCPv6 reply from server to client
409         struct dhcpv6_relay_header *h = (void*)data;
410         if (len < sizeof(*h) || h->msg_type != DHCPV6_MSG_RELAY_REPL)
411                 return;
412
413         memcpy(&target.sin6_addr, &h->peer_address,
414                         sizeof(struct in6_addr));
415
416         // Go through options and find what we need
417         dhcpv6_for_each_option(h->options, end, otype, olen, odata) {
418                 if (otype == DHCPV6_OPT_INTERFACE_ID
419                                 && olen == sizeof(ifaceidx)) {
420                         memcpy(&ifaceidx, odata, sizeof(ifaceidx));
421                 } else if (otype == DHCPV6_OPT_RELAY_MSG) {
422                         payload_data = odata;
423                         payload_len = olen;
424                 }
425         }
426
427         // Invalid interface-id or basic payload
428         struct interface *iface = odhcpd_get_interface_by_index(ifaceidx);
429         if (!iface || iface->master || !payload_data || payload_len < 4)
430                 return;
431
432         bool is_authenticated = false;
433         struct in6_addr *dns_ptr = NULL;
434         size_t dns_count = 0;
435
436         // If the payload is relay-reply we have to send to the server port
437         if (payload_data[0] == DHCPV6_MSG_RELAY_REPL) {
438                 target.sin6_port = htons(DHCPV6_SERVER_PORT);
439         } else { // Go through the payload data
440                 struct dhcpv6_client_header *h = (void*)payload_data;
441                 end = payload_data + payload_len;
442
443                 dhcpv6_for_each_option(&h[1], end, otype, olen, odata) {
444                         if (otype == DHCPV6_OPT_DNS_SERVERS && olen >= 16) {
445                                 dns_ptr = (struct in6_addr*)odata;
446                                 dns_count = olen / 16;
447                         } else if (otype == DHCPV6_OPT_AUTH) {
448                                 is_authenticated = true;
449                         }
450                 }
451         }
452
453         // Rewrite DNS servers if requested
454         if (iface->always_rewrite_dns && dns_ptr && dns_count > 0) {
455                 if (is_authenticated)
456                         return; // Impossible to rewrite
457
458                 struct odhcpd_ipaddr ip;
459                 const struct in6_addr *rewrite = iface->dns;
460                 size_t rewrite_cnt = iface->dns_cnt;
461
462                 if (rewrite_cnt == 0) {
463                         if (odhcpd_get_interface_addresses(iface->ifindex, &ip, 1) < 1)
464                                 return; // Unable to get interface address
465
466                         rewrite = &ip.addr;
467                         rewrite_cnt = 1;
468                 }
469
470                 // Copy over any other addresses
471                 for (size_t i = 0; i < dns_count; ++i) {
472                         size_t j = (i < rewrite_cnt) ? i : rewrite_cnt - 1;
473                         memcpy(&dns_ptr[i], &rewrite[j], sizeof(*rewrite));
474                 }
475         }
476
477         struct iovec iov = {payload_data, payload_len};
478         odhcpd_send(iface->dhcpv6_event.uloop.fd, &target, &iov, 1, iface);
479 }
480
481
482 // Relay client request (regular DHCPv6-relay)
483 static void relay_client_request(struct sockaddr_in6 *source,
484                 const void *data, size_t len, struct interface *iface)
485 {
486         struct interface *master = odhcpd_get_master_interface();
487         const struct dhcpv6_relay_header *h = data;
488         if (!master || master->dhcpv6 != RELAYD_RELAY ||
489                         h->msg_type == DHCPV6_MSG_RELAY_REPL ||
490                         h->msg_type == DHCPV6_MSG_RECONFIGURE ||
491                         h->msg_type == DHCPV6_MSG_REPLY ||
492                         h->msg_type == DHCPV6_MSG_ADVERTISE)
493                 return; // Invalid message types for client
494
495         syslog(LOG_NOTICE, "Got a DHCPv6-request");
496
497         // Construct our forwarding envelope
498         struct dhcpv6_relay_forward_envelope hdr = {
499                 .msg_type = DHCPV6_MSG_RELAY_FORW,
500                 .hop_count = 0,
501                 .interface_id_type = htons(DHCPV6_OPT_INTERFACE_ID),
502                 .interface_id_len = htons(sizeof(uint32_t)),
503                 .relay_message_type = htons(DHCPV6_OPT_RELAY_MSG),
504                 .relay_message_len = htons(len),
505         };
506
507         if (h->msg_type == DHCPV6_MSG_RELAY_FORW) { // handle relay-forward
508                 if (h->hop_count >= DHCPV6_HOP_COUNT_LIMIT)
509                         return; // Invalid hop count
510                 else
511                         hdr.hop_count = h->hop_count + 1;
512         }
513
514         // use memcpy here as the destination fields are unaligned
515         uint32_t ifindex = iface->ifindex;
516         memcpy(&hdr.peer_address, &source->sin6_addr, sizeof(struct in6_addr));
517         memcpy(&hdr.interface_id_data, &ifindex, sizeof(ifindex));
518
519         // Detect public IP of slave interface to use as link-address
520         struct odhcpd_ipaddr ip;
521         if (odhcpd_get_interface_addresses(iface->ifindex, &ip, 1) < 1) {
522                 // No suitable address! Is the slave not configured yet?
523                 // Detect public IP of master interface and use it instead
524                 // This is WRONG and probably violates the RFC. However
525                 // otherwise we have a hen and egg problem because the
526                 // slave-interface cannot be auto-configured.
527                 if (odhcpd_get_interface_addresses(master->ifindex, &ip, 1) < 1)
528                         return; // Could not obtain a suitable address
529         }
530         memcpy(&hdr.link_address, &ip.addr, sizeof(hdr.link_address));
531
532         struct sockaddr_in6 dhcpv6_servers = {AF_INET6,
533                         htons(DHCPV6_SERVER_PORT), 0, ALL_DHCPV6_SERVERS, 0};
534         struct iovec iov[2] = {{&hdr, sizeof(hdr)}, {(void*)data, len}};
535         odhcpd_send(iface->dhcpv6_event.uloop.fd, &dhcpv6_servers, iov, 2, master);
536 }