• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/odhcpd/src/odhcpd.h

  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 #ifndef _ODHCPD_H_
 16 #define _ODHCPD_H_
 17 
 18 #include <netinet/in.h>
 19 #include <netinet/icmp6.h>
 20 #include <netinet/ether.h>
 21 #include <stdbool.h>
 22 #include <syslog.h>
 23 
 24 #include <libubox/avl.h>
 25 #include <libubox/blobmsg.h>
 26 #include <libubox/list.h>
 27 #include <libubox/uloop.h>
 28 #include <libubox/avl.h>
 29 #include <libubox/ustream.h>
 30 #include <libubox/vlist.h>
 31 
 32 #define min(a, b) (((a) < (b)) ? (a) : (b))
 33 #define max(a, b) (((a) > (b)) ? (a) : (b))
 34 
 35 /* RFC 1035, §2.3.4, with one extra byte for buffers */
 36 #define DNS_MAX_NAME_LEN 256
 37 #define DNS_MAX_LABEL_LEN 63
 38 
 39 // RFC 6106 defines this router advertisement option
 40 #define ND_OPT_ROUTE_INFO 24
 41 #define ND_OPT_RECURSIVE_DNS 25
 42 #define ND_OPT_DNS_SEARCH 31
 43 
 44 // RFC 8910 defines captive portal option
 45 #define ND_OPT_CAPTIVE_PORTAL 37
 46 
 47 // RFC 8781 defines PREF64 option
 48 #define ND_OPT_PREF64 38
 49 
 50 // RFC9096 defines recommended option lifetimes configuration values
 51 #define ND_PREFERRED_LIMIT 2700
 52 #define ND_VALID_LIMIT 5400
 53 
 54 // RFC 9463 - Discovery of Network-designated Resolvers (DNR)
 55 #define ND_OPT_DNR 144
 56 
 57 #define INFINITE_VALID(x) ((x) == 0)
 58 
 59 #ifndef _o_fallthrough
 60 #define _o_fallthrough __attribute__((__fallthrough__))
 61 #endif /* _o_fallthrough */
 62 
 63 #ifndef _o_packed
 64 #define _o_packed __attribute__((packed))
 65 #endif /* _o_packed */
 66 
 67 #ifndef _o_unused
 68 #define _o_unused __attribute__((unused))
 69 #endif /* _o_unused */
 70 
 71 #ifndef _o_noreturn
 72 #define _o_noreturn __attribute__((__noreturn__))
 73 #endif /* _o_noreturn */
 74 
 75 #define ALL_IPV6_NODES "ff02::1"
 76 #define ALL_IPV6_ROUTERS "ff02::2"
 77 
 78 #define NTP_SUBOPTION_SRV_ADDR 1
 79 #define NTP_SUBOPTION_MC_ADDR 2
 80 #define NTP_SUBOPTION_SRV_FQDN 3
 81 #define IPV6_ADDR_LEN 16
 82 
 83 #define IN6_IS_ADDR_ULA(a) (((a)->s6_addr32[0] & htonl(0xfe000000)) == htonl(0xfc000000))
 84 
 85 #define ADDR_MATCH_PIO_FILTER(_addr, iface) (odhcpd_bmemcmp(&(_addr)->addr, \
 86                                                             &(iface)->pio_filter_addr, \
 87                                                             (iface)->pio_filter_length) != 0 || \
 88                                              (_addr)->prefix_len < (iface)->pio_filter_length)
 89 
 90 struct interface;
 91 struct nl_sock;
 92 extern struct config config;
 93 extern struct sys_conf sys_conf;
 94 
 95 void __iflog(int lvl, const char *fmt, ...);
 96 #define debug(fmt, ...) __iflog(LOG_DEBUG, fmt __VA_OPT__(, ) __VA_ARGS__)
 97 #define info(fmt, ...) __iflog(LOG_INFO, fmt __VA_OPT__(, ) __VA_ARGS__)
 98 #define notice(fmt, ...) __iflog(LOG_NOTICE, fmt __VA_OPT__(, ) __VA_ARGS__)
 99 #define warn(fmt, ...) __iflog(LOG_WARNING, fmt __VA_OPT__(, ) __VA_ARGS__)
100 #define error(fmt, ...) __iflog(LOG_ERR, fmt __VA_OPT__(, ) __VA_ARGS__)
101 #define critical(fmt, ...) __iflog(LOG_CRIT, fmt __VA_OPT__(, ) __VA_ARGS__)
102 #define alert(fmt, ...) __iflog(LOG_ALERT, fmt __VA_OPT__(, ) __VA_ARGS__)
103 #define emergency(fmt, ...) __iflog(LOG_EMERG, fmt __VA_OPT__(, ) __VA_ARGS__)
104 
105 
106 struct odhcpd_event {
107         struct uloop_fd uloop;
108         void (*handle_dgram)(void *addr, void *data, size_t len,
109                         struct interface *iface, void *dest_addr);
110         void (*handle_error)(struct odhcpd_event *e, int error);
111         void (*recv_msgs)(struct odhcpd_event *e);
112 };
113 
114 typedef ssize_t (*send_reply_cb_t)(struct iovec *iov, size_t iov_len,
115                                    struct sockaddr *dest, socklen_t dest_len,
116                                    void *opaque);
117 
118 union in46_addr {
119         struct in_addr in;
120         struct in6_addr in6;
121 };
122 
123 struct netevent_handler_info {
124         struct interface *iface;
125         union {
126                 struct {
127                         union in46_addr dst;
128                         uint8_t dst_len;
129                         union in46_addr gateway;
130                 } rt;
131                 struct {
132                         union in46_addr dst;
133                         uint16_t state;
134                         uint8_t flags;
135                 } neigh;
136                 struct {
137                         struct odhcpd_ipaddr *addrs;
138                         size_t len;
139                 } addrs_old;
140                 union in46_addr addr;
141         };
142 };
143 
144 enum netevents {
145         NETEV_IFINDEX_CHANGE,
146         NETEV_ADDR_ADD,
147         NETEV_ADDR_DEL,
148         NETEV_ADDRLIST_CHANGE,
149         NETEV_ADDR6_ADD,
150         NETEV_ADDR6_DEL,
151         NETEV_ADDR6LIST_CHANGE,
152         NETEV_ROUTE6_ADD,
153         NETEV_ROUTE6_DEL,
154         NETEV_NEIGH6_ADD,
155         NETEV_NEIGH6_DEL,
156 };
157 
158 struct netevent_handler {
159         struct list_head head;
160         void (*cb) (unsigned long event, struct netevent_handler_info *info);
161 };
162 
163 struct odhcpd_ipaddr {
164         union in46_addr addr;
165         uint8_t prefix_len;
166         uint32_t preferred_lt;
167         uint32_t valid_lt;
168 
169         union {
170                 /* IPv6 only */
171                 struct {
172                         uint8_t dprefix_len;
173                         bool tentative;
174                 };
175 
176                 /* IPv4 only */
177                 struct {
178                         struct in_addr broadcast;
179                         in_addr_t netmask;
180                 };
181         };
182 };
183 
184 enum odhcpd_mode {
185         MODE_DISABLED,
186         MODE_SERVER,
187         MODE_RELAY,
188         MODE_HYBRID
189 };
190 
191 
192 enum odhcpd_assignment_flags {
193         OAF_DHCPV6_NA           = (1 << 0),
194         OAF_DHCPV6_PD           = (1 << 1),
195 };
196 
197 #define DHCPV6_OPT_HDR_SIZE 4
198 
199 /* 2-byte type + 128-byte DUID, RFC8415, §11.1 */
200 #define DUID_MAX_LEN 130
201 /* In theory, 2 (type only), or 7 (DUID-EN + 1-byte data), but be reasonable */
202 #define DUID_MIN_LEN 10
203 #define DUID_HEXSTRLEN (DUID_MAX_LEN * 2 + 1)
204 
205 enum duid_type {
206         DUID_TYPE_LLT = 1,
207         DUID_TYPE_EN = 2,
208         DUID_TYPE_LL = 3,
209         DUID_TYPE_UUID = 4,
210 };
211 
212 struct config {
213         bool enable_tz;
214         bool main_dhcpv4;
215         char *dhcp_cb;
216         bool use_ubus;
217 
218         char *dhcp_statefile;
219         int dhcp_statedir_fd;
220         char *dhcp_hostsdir;
221         int dhcp_hostsdir_fd;
222 
223         char *ra_piodir;
224         int ra_piodir_fd;
225 
226         char *uci_cfgdir;
227         int log_level;
228         bool log_level_cmdline;
229         bool log_syslog;
230 
231         uint8_t default_duid[DUID_MAX_LEN];
232         size_t default_duid_len;
233 };
234 
235 struct sys_conf {
236         uint8_t *posix_tz;
237         size_t posix_tz_len;
238         uint8_t *tzdb_tz;
239         size_t tzdb_tz_len;
240 };
241 
242 struct duid {
243         uint8_t len;
244         uint8_t id[DUID_MAX_LEN];
245         uint32_t iaid;
246         bool iaid_set;
247 };
248 
249 struct odhcpd_ref_ip;
250 
251 struct dhcpv4_lease {
252         struct avl_node iface_avl;              // struct interface->dhcpv4_leases
253 
254         struct interface *iface;                // assignment interface, non-null
255         struct lease_cfg *lease_cfg;            // host lease cfg, nullable
256 
257         struct in_addr ipv4;                    // client IPv4 address
258         bool bound;                             // the lease has been accepted by the client
259         time_t valid_until;                     // CLOCK_MONOTONIC time, 0 = inf
260         char *hostname;                         // client hostname
261         bool hostname_valid;                    // is the hostname one or more valid DNS labels?
262         size_t hwaddr_len;                      // hwaddr length
263         uint8_t hwaddr[ETH_ALEN];               // hwaddr (only MAC supported)
264 
265         // ForceRenew Nonce - RFC6704 §3.1.2
266         struct uloop_timeout fr_timer;          // FR message transmission timer
267         bool accept_fr_nonce;                   // FR client support
268         unsigned fr_cnt;                        // FR messages sent
269         uint8_t key[16];                        // FR nonce
270         struct odhcpd_ref_ip *fr_ip;            // FR message old serverid/IP
271 
272         // RFC4361
273         uint32_t iaid;
274         uint8_t duid_len;
275         uint8_t duid[];
276 };
277 
278 struct dhcpv6_lease {
279         struct list_head head;
280         struct list_head lease_cfg_list;
281 
282         struct interface *iface;
283         struct lease_cfg *lease_cfg;
284 
285         struct sockaddr_in6 peer;
286         time_t valid_until;
287         time_t preferred_until;
288 
289         // ForceRenew Nonce - RFC8415 §20.4, §21.11
290         struct uloop_timeout fr_timer;
291         bool accept_fr_nonce;
292         int fr_cnt;
293         uint8_t key[16];
294 
295         union {
296                 uint64_t assigned_host_id;
297                 uint32_t assigned_subnet_id;
298         };
299         uint8_t length; // length == 128 -> IA_NA, length <= 64 -> IA_PD
300 
301         unsigned int flags;
302         bool bound;                             // the lease has been accepted by the client
303         uint32_t leasetime;
304         char *hostname;
305         bool hostname_valid;                    // is the hostname one or more valid DNS labels?
306 
307         uint32_t iaid;
308         uint16_t duid_len;
309         uint8_t duid[];
310 };
311 
312 /* This corresponds to a UCI host section, i.e. a static lease cfg */
313 struct lease_cfg {
314         struct vlist_node node;
315         struct list_head dhcpv6_leases;
316         struct dhcpv4_lease *dhcpv4_lease;
317         struct in_addr ipv4;
318         uint64_t hostid;
319         size_t mac_count;
320         struct ether_addr *macs;
321         size_t duid_count;
322         struct duid *duids;
323         uint32_t leasetime;             // duration of granted leases, UINT32_MAX = inf
324         char *hostname;
325         bool ignore4;
326         bool ignore6;
327 };
328 
329 // DNR - RFC9463
330 struct dnr_options {
331         uint16_t priority;
332 
333         uint32_t lifetime;
334         bool lifetime_set;
335 
336         uint8_t *adn;
337         uint16_t adn_len;
338 
339         struct in_addr *addr4;
340         size_t addr4_cnt;
341         struct in6_addr *addr6;
342         size_t addr6_cnt;
343 
344         uint8_t *svc;
345         uint16_t svc_len;
346 };
347 
348 
349 // RA PIO - RFC9096
350 struct ra_pio {
351         struct in6_addr prefix;
352         uint8_t length;
353         time_t lifetime;
354 };
355 
356 
357 struct interface {
358         struct avl_node avl;
359 
360         int ifflags;
361         int ifindex;
362         char *ifname;
363         const char *name;
364         uint32_t if_mtu;
365         bool update_statefile;
366 
367         // IPv6 runtime data
368         struct odhcpd_ipaddr *addr6;
369         size_t addr6_len;
370 
371         // RA runtime data
372         struct odhcpd_event router_event;
373         struct uloop_timeout timer_rs;
374         uint32_t ra_sent;
375 
376         // DHCPv6 runtime data
377         struct odhcpd_event dhcpv6_event;
378         struct list_head ia_assignments;
379 
380         // NDP runtime data
381         struct odhcpd_event ndp_event;
382         int ndp_ping_fd;
383 
384         // IPv4 runtime data
385         struct odhcpd_ipaddr *oaddrs4;          // IPv4 addresses assigned to this interface
386         size_t oaddrs4_cnt;                     // Number of IPv4 addresses assigned to this interface
387 
388         // DHCPv4 runtime data
389         struct odhcpd_event dhcpv4_event;
390         struct avl_tree dhcpv4_leases;
391         struct list_head dhcpv4_fr_ips;
392 
393         /* NOTE: everything from this point is zeroed on odhcpd_reload() */
394 
395         // Services
396         enum odhcpd_mode ra;
397         enum odhcpd_mode dhcpv6;
398         enum odhcpd_mode ndp;
399         enum odhcpd_mode dhcpv4;
400 
401         // Config
402         bool inuse;
403         bool external;
404         bool master;
405         bool ignore;
406         bool always_rewrite_dns;
407         bool dns_service;
408 
409         // NDP
410         int learn_routes;
411         bool ndp_from_link_local;
412         struct in6_addr cached_linklocal_addr;
413         bool cached_linklocal_valid;
414 
415         // RA
416         uint8_t ra_flags;
417         bool ra_slaac;
418         bool ra_not_onlink;
419         bool ra_advrouter;
420         bool ra_dns;
421         uint8_t pref64_length;
422         uint8_t pref64_plc;
423         uint32_t pref64_prefix[3];
424         bool no_dynamic_dhcp;
425         bool have_link_local;
426         uint8_t pio_filter_length;
427         struct in6_addr pio_filter_addr;
428         int default_router;
429         int route_preference;
430         uint32_t ra_maxinterval;
431         uint32_t ra_mininterval;
432         uint32_t ra_lifetime;
433         uint32_t ra_reachabletime;
434         uint32_t ra_retranstime;
435         uint32_t ra_hoplimit;
436         uint32_t ra_mtu;
437         uint32_t max_preferred_lifetime;
438         uint32_t max_valid_lifetime;
439 
440         // DHCP
441         uint32_t dhcp_leasetime;
442 
443         // DHCPv4
444         uint32_t dhcpv4_pool_start;     // Offset to first dynamic address
445         uint32_t dhcpv4_pool_end;       // Offset to last dynamic address
446         struct in_addr dhcpv4_start_ip;
447         struct in_addr dhcpv4_end_ip;
448         struct odhcpd_ipaddr dhcpv4_own_ip;
449         struct in_addr *dhcpv4_routers; // IPv4 addresses for routers on this subnet
450         size_t dhcpv4_routers_cnt;      // Count of router addresses
451         bool dhcpv4_forcereconf;
452         uint32_t dhcpv4_v6only_wait;    // V6ONLY_WAIT for the IPv6-only preferred option (RFC8925)
453 
454         // DNS
455         struct in_addr *dns_addrs4;     // IPv4 DNS server addresses to announce
456         size_t dns_addrs4_cnt;          // Count of IPv4 DNS addresses
457         struct in6_addr *dns_addrs6;    // IPv6 DNS server addresses to announce
458         size_t dns_addrs6_cnt;          // Count of IPv6 DNS addresses
459         uint8_t *dns_search;            // DNS domain search list to announce (concatenated)
460         size_t dns_search_len;          // Length of the DNS domain search list (bytes)
461 
462         // DHCPV6
463         void *dhcpv6_raw;
464         size_t dhcpv6_raw_len;
465         bool dhcpv6_assignall;
466         bool dhcpv6_pd;
467         bool dhcpv6_pd_preferred;
468         bool dhcpv6_na;
469         uint32_t dhcpv6_hostid_len;
470         uint32_t dhcpv6_pd_min_len; // minimum delegated prefix length
471 
472         char *upstream;
473         size_t upstream_len;
474 
475         // NTP
476         struct in_addr *dhcpv4_ntp;
477         size_t dhcpv4_ntp_cnt;
478         uint8_t *dhcpv6_ntp;
479         uint16_t dhcpv6_ntp_len;
480         size_t dhcpv6_ntp_cnt;
481 
482         // SNTP
483         struct in6_addr *dhcpv6_sntp;
484         size_t dhcpv6_sntp_cnt;
485 
486         // DNR
487         struct dnr_options *dnr;
488         size_t dnr_cnt;
489 
490         // RA PIO - RFC9096
491         struct ra_pio *pios;
492         size_t pio_cnt;
493         bool pio_update;
494 
495         // RFC8910
496         char *captive_portal_uri;
497         size_t captive_portal_uri_len;
498 };
499 
500 extern struct avl_tree interfaces;
501 
502 enum {
503         LEASE_CFG_ATTR_IPV4,
504         LEASE_CFG_ATTR_MAC,
505         LEASE_CFG_ATTR_DUID,
506         LEASE_CFG_ATTR_HOSTID,
507         LEASE_CFG_ATTR_LEASETIME,
508         LEASE_CFG_ATTR_NAME,
509         LEASE_CFG_ATTR_MAX
510 };
511 extern const struct blobmsg_policy lease_cfg_attrs[LEASE_CFG_ATTR_MAX];
512 
513 inline static bool ra_pio_expired(const struct ra_pio *pio, time_t now)
514 {
515         return pio->lifetime && (now > pio->lifetime);
516 }
517 
518 inline static uint32_t ra_pio_lifetime(const struct ra_pio *pio, time_t now)
519 {
520         if (!pio->lifetime || now > pio->lifetime)
521                 return 0;
522 
523         return (uint32_t) (pio->lifetime - now);
524 }
525 
526 inline static bool ra_pio_stale(const struct ra_pio *pio)
527 {
528         return !!pio->lifetime;
529 }
530 
531 // Exported main functions
532 int odhcpd_register(struct odhcpd_event *event);
533 int odhcpd_deregister(struct odhcpd_event *event);
534 void odhcpd_process(struct odhcpd_event *event);
535 
536 ssize_t odhcpd_send_with_src(int socket, struct sockaddr_in6 *dest,
537                 struct iovec *iov, size_t iov_len,
538                 const struct interface *iface, const struct in6_addr *src_addr);
539 ssize_t odhcpd_send(int socket, struct sockaddr_in6 *dest,
540                 struct iovec *iov, size_t iov_len,
541                 const struct interface *iface);
542 ssize_t odhcpd_try_send_with_src(int socket, struct sockaddr_in6 *dest,
543                 struct iovec *iov, size_t iov_len,
544                 struct interface *iface);
545 int odhcpd_get_interface_dns_addr6(struct interface *iface,
546                                    struct in6_addr *dns_addr6);
547 int odhcpd_get_interface_linklocal_addr(struct interface *iface,
548                 struct in6_addr *addr);
549 int odhcpd_get_interface_config(const char *ifname, const char *what);
550 int odhcpd_get_mac(const struct interface *iface, uint8_t mac[6]);
551 int odhcpd_get_flags(const struct interface *iface);
552 struct interface* odhcpd_get_interface_by_index(int ifindex);
553 void odhcpd_urandom(void *data, size_t len);
554 
555 int odhcpd_run(void);
556 time_t odhcpd_time(void);
557 ssize_t odhcpd_unhexlify(uint8_t *dst, size_t len, const char *src);
558 void odhcpd_hexlify(char *dst, const uint8_t *src, size_t len);
559 const char *odhcpd_print_mac(const uint8_t *mac, const size_t len);
560 
561 int odhcpd_bmemcmp(const void *av, const void *bv, size_t bits);
562 void odhcpd_bmemcpy(void *av, const void *bv, size_t bits);
563 
564 typedef void (*odhcpd_enum_addr6_cb_t)(struct dhcpv6_lease *lease,
565                                        struct in6_addr *addr, uint8_t prefix_len,
566                                        uint32_t pref, uint32_t valid,
567                                        void *arg);
568 void odhcpd_enum_addr6(struct interface *iface, struct dhcpv6_lease *lease,
569                        time_t now, odhcpd_enum_addr6_cb_t func, void *arg);
570 int odhcpd_parse_addr6_prefix(const char *str, struct in6_addr *addr, uint8_t *prefix);
571 bool odhcpd_hostname_valid(const char *name);
572 
573 int config_parse_interface(void *data, size_t len, const char *iname, bool overwrite);
574 struct lease_cfg *config_find_lease_cfg_by_duid_and_iaid(const uint8_t *duid,
575                                                          const uint16_t len,
576                                                          const uint32_t iaid);
577 struct lease_cfg *config_find_lease_cfg_by_mac(const uint8_t *mac);
578 struct lease_cfg *config_find_lease_cfg_by_hostid(const uint64_t hostid);
579 struct lease_cfg *config_find_lease_cfg_by_ipv4(const struct in_addr ipv4);
580 int config_set_lease_cfg_from_blobmsg(struct blob_attr *ba);
581 
582 #ifdef WITH_UBUS
583 int ubus_init(void);
584 const char* ubus_get_ifname(const char *name);
585 void ubus_apply_network(void);
586 bool ubus_has_prefix(const char *name, const char *ifname);
587 void ubus_bcast_dhcpv4_event(const char *type, const char *iface,
588                              const struct dhcpv4_lease *lease);
589 #else
590 static inline int ubus_init(void)
591 {
592         return 0;
593 }
594 
595 static inline const char *ubus_get_ifname(const char *name)
596 {
597         return NULL;
598 }
599 
600 static inline void ubus_apply_network(void)
601 {
602         return;
603 }
604 
605 static inline bool ubus_has_prefix(const char *name, const char *ifname)
606 {
607         return false;
608 }
609 
610 static inline
611 void ubus_bcast_dhcpv4_event(const char *type, const char *iface,
612                              const struct dhcpv4_lease *lease)
613 {
614         return;
615 }
616 #endif /* WITH_UBUS */
617 
618 ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *iface,
619                 const struct sockaddr_in6 *addr, const void *data, const uint8_t *end);
620 int dhcpv6_ia_init(void);
621 int dhcpv6_ia_setup_interface(struct interface *iface, bool enable);
622 void dhcpv6_free_lease(struct dhcpv6_lease *lease);
623 
624 int netlink_add_netevent_handler(struct netevent_handler *hdlr);
625 ssize_t netlink_get_interface_addrs(const int ifindex, bool v6,
626                                     struct odhcpd_ipaddr **oaddrs);
627 ssize_t netlink_get_interface_linklocal(int ifindex, struct odhcpd_ipaddr **oaddrs);
628 int netlink_get_interface_proxy_neigh(int ifindex, const struct in6_addr *addr);
629 int netlink_setup_route(const struct in6_addr *addr, const int prefixlen,
630                         const int ifindex, const struct in6_addr *gw,
631                         const uint32_t metric, const bool add);
632 int netlink_setup_proxy_neigh(const struct in6_addr *addr,
633                               const int ifindex, const bool add);
634 int netlink_setup_addr(struct odhcpd_ipaddr *oaddr,
635                        const int ifindex, const bool v6, const bool add);
636 void netlink_dump_neigh_table(const bool proxy);
637 void netlink_dump_addr_table(const bool v6);
638 
639 // Exported module initializers
640 int netlink_init(void);
641 int router_init(void);
642 int dhcpv6_init(void);
643 int ndp_init(void);
644 
645 #ifdef DHCPV4_SUPPORT
646 int dhcpv4_init(void);
647 void dhcpv4_free_lease(struct dhcpv4_lease *a);
648 bool dhcpv4_setup_interface(struct interface *iface, bool enable);
649 void dhcpv4_handle_msg(void *addr, void *data, size_t len,
650                        struct interface *iface, _o_unused void *dest_addr,
651                        send_reply_cb_t send_reply, void *opaque);
652 #else
653 static inline bool dhcpv4_setup_interface(struct interface *iface, bool enable) {
654         return true;
655 }
656 
657 static inline void dhcpv4_free_lease(struct dhcpv4_lease *lease) {
658         error("Trying to free IPv4 assignment 0x%p", lease);
659 }
660 #endif /* DHCPV4_SUPPORT */
661 
662 int router_setup_interface(struct interface *iface, bool enable);
663 int dhcpv6_setup_interface(struct interface *iface, bool enable);
664 int ndp_setup_interface(struct interface *iface, bool enable);
665 void reload_services(struct interface *iface);
666 
667 void odhcpd_reload(void);
668 
669 #endif /* _ODHCPD_H_ */
670 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt