1*c2c26c8bSAndroid Build Coastguard Worker /* dnsmasq is Copyright (c) 2000-2009 Simon Kelley 2*c2c26c8bSAndroid Build Coastguard Worker 3*c2c26c8bSAndroid Build Coastguard Worker This program is free software; you can redistribute it and/or modify 4*c2c26c8bSAndroid Build Coastguard Worker it under the terms of the GNU General Public License as published by 5*c2c26c8bSAndroid Build Coastguard Worker the Free Software Foundation; version 2 dated June, 1991, or 6*c2c26c8bSAndroid Build Coastguard Worker (at your option) version 3 dated 29 June, 2007. 7*c2c26c8bSAndroid Build Coastguard Worker 8*c2c26c8bSAndroid Build Coastguard Worker This program is distributed in the hope that it will be useful, 9*c2c26c8bSAndroid Build Coastguard Worker but WITHOUT ANY WARRANTY; without even the implied warranty of 10*c2c26c8bSAndroid Build Coastguard Worker MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11*c2c26c8bSAndroid Build Coastguard Worker GNU General Public License for more details. 12*c2c26c8bSAndroid Build Coastguard Worker 13*c2c26c8bSAndroid Build Coastguard Worker You should have received a copy of the GNU General Public License 14*c2c26c8bSAndroid Build Coastguard Worker along with this program. If not, see <http://www.gnu.org/licenses/>. 15*c2c26c8bSAndroid Build Coastguard Worker */ 16*c2c26c8bSAndroid Build Coastguard Worker 17*c2c26c8bSAndroid Build Coastguard Worker #define COPYRIGHT "Copyright (C) 2000-2009 Simon Kelley" 18*c2c26c8bSAndroid Build Coastguard Worker 19*c2c26c8bSAndroid Build Coastguard Worker #ifndef NO_LARGEFILE 20*c2c26c8bSAndroid Build Coastguard Worker /* Ensure we can use files >2GB (log files may grow this big) */ 21*c2c26c8bSAndroid Build Coastguard Worker #define _LARGEFILE_SOURCE 1 22*c2c26c8bSAndroid Build Coastguard Worker #define _FILE_OFFSET_BITS 64 23*c2c26c8bSAndroid Build Coastguard Worker #endif 24*c2c26c8bSAndroid Build Coastguard Worker 25*c2c26c8bSAndroid Build Coastguard Worker /* Get linux C library versions. */ 26*c2c26c8bSAndroid Build Coastguard Worker #ifdef __linux__ 27*c2c26c8bSAndroid Build Coastguard Worker #ifndef __ANDROID__ 28*c2c26c8bSAndroid Build Coastguard Worker #define _GNU_SOURCE 29*c2c26c8bSAndroid Build Coastguard Worker #endif 30*c2c26c8bSAndroid Build Coastguard Worker #include <features.h> 31*c2c26c8bSAndroid Build Coastguard Worker #endif 32*c2c26c8bSAndroid Build Coastguard Worker 33*c2c26c8bSAndroid Build Coastguard Worker /* get these before config.h for IPv6 stuff... */ 34*c2c26c8bSAndroid Build Coastguard Worker #include <netinet/in.h> 35*c2c26c8bSAndroid Build Coastguard Worker #include <sys/socket.h> 36*c2c26c8bSAndroid Build Coastguard Worker #include <sys/types.h> 37*c2c26c8bSAndroid Build Coastguard Worker 38*c2c26c8bSAndroid Build Coastguard Worker #ifdef __APPLE__ 39*c2c26c8bSAndroid Build Coastguard Worker #include <arpa/nameser_compat.h> 40*c2c26c8bSAndroid Build Coastguard Worker #include <nameser.h> 41*c2c26c8bSAndroid Build Coastguard Worker #else 42*c2c26c8bSAndroid Build Coastguard Worker #ifdef __ANDROID__ 43*c2c26c8bSAndroid Build Coastguard Worker #include "nameser.h" 44*c2c26c8bSAndroid Build Coastguard Worker #else 45*c2c26c8bSAndroid Build Coastguard Worker #include <arpa/nameser.h> 46*c2c26c8bSAndroid Build Coastguard Worker #endif 47*c2c26c8bSAndroid Build Coastguard Worker #endif 48*c2c26c8bSAndroid Build Coastguard Worker 49*c2c26c8bSAndroid Build Coastguard Worker /* and this. */ 50*c2c26c8bSAndroid Build Coastguard Worker #include <getopt.h> 51*c2c26c8bSAndroid Build Coastguard Worker 52*c2c26c8bSAndroid Build Coastguard Worker #include "config.h" 53*c2c26c8bSAndroid Build Coastguard Worker 54*c2c26c8bSAndroid Build Coastguard Worker #define gettext_noop(S) (S) 55*c2c26c8bSAndroid Build Coastguard Worker #ifndef LOCALEDIR 56*c2c26c8bSAndroid Build Coastguard Worker #define _(S) (S) 57*c2c26c8bSAndroid Build Coastguard Worker #else 58*c2c26c8bSAndroid Build Coastguard Worker #include <libintl.h> 59*c2c26c8bSAndroid Build Coastguard Worker #include <locale.h> 60*c2c26c8bSAndroid Build Coastguard Worker #define _(S) gettext(S) 61*c2c26c8bSAndroid Build Coastguard Worker #endif 62*c2c26c8bSAndroid Build Coastguard Worker 63*c2c26c8bSAndroid Build Coastguard Worker #include <arpa/inet.h> 64*c2c26c8bSAndroid Build Coastguard Worker #include <ctype.h> 65*c2c26c8bSAndroid Build Coastguard Worker #include <errno.h> 66*c2c26c8bSAndroid Build Coastguard Worker #include <fcntl.h> 67*c2c26c8bSAndroid Build Coastguard Worker #include <grp.h> 68*c2c26c8bSAndroid Build Coastguard Worker #include <limits.h> 69*c2c26c8bSAndroid Build Coastguard Worker #include <net/if.h> 70*c2c26c8bSAndroid Build Coastguard Worker #include <pwd.h> 71*c2c26c8bSAndroid Build Coastguard Worker #include <signal.h> 72*c2c26c8bSAndroid Build Coastguard Worker #include <stdarg.h> 73*c2c26c8bSAndroid Build Coastguard Worker #include <stddef.h> 74*c2c26c8bSAndroid Build Coastguard Worker #include <stdio.h> 75*c2c26c8bSAndroid Build Coastguard Worker #include <stdlib.h> 76*c2c26c8bSAndroid Build Coastguard Worker #include <string.h> 77*c2c26c8bSAndroid Build Coastguard Worker #include <sys/ioctl.h> 78*c2c26c8bSAndroid Build Coastguard Worker #include <sys/select.h> 79*c2c26c8bSAndroid Build Coastguard Worker #include <sys/stat.h> 80*c2c26c8bSAndroid Build Coastguard Worker #include <sys/time.h> 81*c2c26c8bSAndroid Build Coastguard Worker #include <sys/un.h> 82*c2c26c8bSAndroid Build Coastguard Worker #include <sys/wait.h> 83*c2c26c8bSAndroid Build Coastguard Worker #include <time.h> 84*c2c26c8bSAndroid Build Coastguard Worker #include <unistd.h> 85*c2c26c8bSAndroid Build Coastguard Worker #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__sun__) || defined(__sun) || \ 86*c2c26c8bSAndroid Build Coastguard Worker defined(__ANDROID__) 87*c2c26c8bSAndroid Build Coastguard Worker #include <netinet/if_ether.h> 88*c2c26c8bSAndroid Build Coastguard Worker #else 89*c2c26c8bSAndroid Build Coastguard Worker #include <net/ethernet.h> 90*c2c26c8bSAndroid Build Coastguard Worker #endif 91*c2c26c8bSAndroid Build Coastguard Worker #include <dirent.h> 92*c2c26c8bSAndroid Build Coastguard Worker #include <net/if_arp.h> 93*c2c26c8bSAndroid Build Coastguard Worker #include <netinet/in_systm.h> 94*c2c26c8bSAndroid Build Coastguard Worker #include <netinet/ip.h> 95*c2c26c8bSAndroid Build Coastguard Worker #include <netinet/ip_icmp.h> 96*c2c26c8bSAndroid Build Coastguard Worker #include <sys/uio.h> 97*c2c26c8bSAndroid Build Coastguard Worker #include <syslog.h> 98*c2c26c8bSAndroid Build Coastguard Worker #ifndef HAVE_LINUX_NETWORK 99*c2c26c8bSAndroid Build Coastguard Worker #include <net/if_dl.h> 100*c2c26c8bSAndroid Build Coastguard Worker #endif 101*c2c26c8bSAndroid Build Coastguard Worker 102*c2c26c8bSAndroid Build Coastguard Worker #if defined(HAVE_LINUX_NETWORK) 103*c2c26c8bSAndroid Build Coastguard Worker #include <linux/capability.h> 104*c2c26c8bSAndroid Build Coastguard Worker /* There doesn't seem to be a universally-available 105*c2c26c8bSAndroid Build Coastguard Worker userpace header for these. */ 106*c2c26c8bSAndroid Build Coastguard Worker extern int capset(cap_user_header_t header, cap_user_data_t data); 107*c2c26c8bSAndroid Build Coastguard Worker extern int capget(cap_user_header_t header, cap_user_data_t data); 108*c2c26c8bSAndroid Build Coastguard Worker #define LINUX_CAPABILITY_VERSION_1 0x19980330 109*c2c26c8bSAndroid Build Coastguard Worker #define LINUX_CAPABILITY_VERSION_2 0x20071026 110*c2c26c8bSAndroid Build Coastguard Worker #define LINUX_CAPABILITY_VERSION_3 0x20080522 111*c2c26c8bSAndroid Build Coastguard Worker 112*c2c26c8bSAndroid Build Coastguard Worker #include <sys/prctl.h> 113*c2c26c8bSAndroid Build Coastguard Worker #endif 114*c2c26c8bSAndroid Build Coastguard Worker 115*c2c26c8bSAndroid Build Coastguard Worker /* daemon is function in the C library.... */ 116*c2c26c8bSAndroid Build Coastguard Worker #define daemon dnsmasq_daemon 117*c2c26c8bSAndroid Build Coastguard Worker 118*c2c26c8bSAndroid Build Coastguard Worker /* Async event queue */ 119*c2c26c8bSAndroid Build Coastguard Worker struct event_desc { 120*c2c26c8bSAndroid Build Coastguard Worker int event, data; 121*c2c26c8bSAndroid Build Coastguard Worker }; 122*c2c26c8bSAndroid Build Coastguard Worker 123*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_RELOAD 1 124*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_DUMP 2 125*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_ALARM 3 126*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_TERM 4 127*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_CHILD 5 128*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_REOPEN 6 129*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_EXITED 7 130*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_KILLED 8 131*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_EXEC_ERR 9 132*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_PIPE_ERR 10 133*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_USER_ERR 11 134*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_CAP_ERR 12 135*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_PIDFILE 13 136*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_HUSER_ERR 14 137*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_GROUP_ERR 15 138*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_DIE 16 139*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_LOG_ERR 17 140*c2c26c8bSAndroid Build Coastguard Worker #define EVENT_FORK_ERR 18 141*c2c26c8bSAndroid Build Coastguard Worker 142*c2c26c8bSAndroid Build Coastguard Worker /* Exit codes. */ 143*c2c26c8bSAndroid Build Coastguard Worker #define EC_GOOD 0 144*c2c26c8bSAndroid Build Coastguard Worker #define EC_BADCONF 1 145*c2c26c8bSAndroid Build Coastguard Worker #define EC_BADNET 2 146*c2c26c8bSAndroid Build Coastguard Worker #define EC_FILE 3 147*c2c26c8bSAndroid Build Coastguard Worker #define EC_NOMEM 4 148*c2c26c8bSAndroid Build Coastguard Worker #define EC_MISC 5 149*c2c26c8bSAndroid Build Coastguard Worker #define EC_INIT_OFFSET 10 150*c2c26c8bSAndroid Build Coastguard Worker 151*c2c26c8bSAndroid Build Coastguard Worker /* Min buffer size: we check after adding each record, so there must be 152*c2c26c8bSAndroid Build Coastguard Worker memory for the largest packet, and the largest record so the 153*c2c26c8bSAndroid Build Coastguard Worker min for DNS is PACKETSZ+MAXDNAME+RRFIXEDSZ which is < 1000. 154*c2c26c8bSAndroid Build Coastguard Worker This might be increased is EDNS packet size if greater than the minimum. 155*c2c26c8bSAndroid Build Coastguard Worker */ 156*c2c26c8bSAndroid Build Coastguard Worker #define DNSMASQ_PACKETSZ PACKETSZ + MAXDNAME + RRFIXEDSZ 157*c2c26c8bSAndroid Build Coastguard Worker 158*c2c26c8bSAndroid Build Coastguard Worker #define OPT_BOGUSPRIV (1u << 0) 159*c2c26c8bSAndroid Build Coastguard Worker #define OPT_FILTER (1u << 1) 160*c2c26c8bSAndroid Build Coastguard Worker #define OPT_LOG (1u << 2) 161*c2c26c8bSAndroid Build Coastguard Worker #define OPT_SELFMX (1u << 3) 162*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NO_HOSTS (1u << 4) 163*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NO_POLL (1u << 5) 164*c2c26c8bSAndroid Build Coastguard Worker #define OPT_DEBUG (1u << 6) 165*c2c26c8bSAndroid Build Coastguard Worker #define OPT_ORDER (1u << 7) 166*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NO_RESOLV (1u << 8) 167*c2c26c8bSAndroid Build Coastguard Worker #define OPT_EXPAND (1u << 9) 168*c2c26c8bSAndroid Build Coastguard Worker #define OPT_LOCALMX (1u << 10) 169*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NO_NEG (1u << 11) 170*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NODOTS_LOCAL (1u << 12) 171*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NOWILD (1u << 13) 172*c2c26c8bSAndroid Build Coastguard Worker #define OPT_RESOLV_DOMAIN (1u << 15) 173*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NO_FORK (1u << 16) 174*c2c26c8bSAndroid Build Coastguard Worker #define OPT_AUTHORITATIVE (1u << 17) 175*c2c26c8bSAndroid Build Coastguard Worker #define OPT_LOCALISE (1u << 18) 176*c2c26c8bSAndroid Build Coastguard Worker #define OPT_DBUS (1u << 19) 177*c2c26c8bSAndroid Build Coastguard Worker #define OPT_DHCP_FQDN (1u << 20) 178*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NO_PING (1u << 21) 179*c2c26c8bSAndroid Build Coastguard Worker #define OPT_LEASE_RO (1u << 22) 180*c2c26c8bSAndroid Build Coastguard Worker #define OPT_ALL_SERVERS (1u << 23) 181*c2c26c8bSAndroid Build Coastguard Worker #define OPT_RELOAD (1u << 24) 182*c2c26c8bSAndroid Build Coastguard Worker #define OPT_TFTP (1u << 25) 183*c2c26c8bSAndroid Build Coastguard Worker #define OPT_TFTP_SECURE (1u << 26) 184*c2c26c8bSAndroid Build Coastguard Worker #define OPT_TFTP_NOBLOCK (1u << 27) 185*c2c26c8bSAndroid Build Coastguard Worker #define OPT_LOG_OPTS (1u << 28) 186*c2c26c8bSAndroid Build Coastguard Worker #define OPT_TFTP_APREF (1u << 29) 187*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NO_OVERRIDE (1u << 30) 188*c2c26c8bSAndroid Build Coastguard Worker #define OPT_NO_REBIND (1u << 31) 189*c2c26c8bSAndroid Build Coastguard Worker 190*c2c26c8bSAndroid Build Coastguard Worker /* extra flags for my_syslog, we use a couple of facilities since they are known 191*c2c26c8bSAndroid Build Coastguard Worker not to occupy the same bits as priorities, no matter how syslog.h is set up. */ 192*c2c26c8bSAndroid Build Coastguard Worker #define MS_TFTP LOG_USER 193*c2c26c8bSAndroid Build Coastguard Worker #define MS_DHCP LOG_DAEMON 194*c2c26c8bSAndroid Build Coastguard Worker 195*c2c26c8bSAndroid Build Coastguard Worker struct all_addr { 196*c2c26c8bSAndroid Build Coastguard Worker union { 197*c2c26c8bSAndroid Build Coastguard Worker struct in_addr addr4; 198*c2c26c8bSAndroid Build Coastguard Worker #ifdef HAVE_IPV6 199*c2c26c8bSAndroid Build Coastguard Worker struct in6_addr addr6; 200*c2c26c8bSAndroid Build Coastguard Worker #endif 201*c2c26c8bSAndroid Build Coastguard Worker } addr; 202*c2c26c8bSAndroid Build Coastguard Worker }; 203*c2c26c8bSAndroid Build Coastguard Worker 204*c2c26c8bSAndroid Build Coastguard Worker struct bogus_addr { 205*c2c26c8bSAndroid Build Coastguard Worker struct in_addr addr; 206*c2c26c8bSAndroid Build Coastguard Worker struct bogus_addr* next; 207*c2c26c8bSAndroid Build Coastguard Worker }; 208*c2c26c8bSAndroid Build Coastguard Worker 209*c2c26c8bSAndroid Build Coastguard Worker /* dns doctor param */ 210*c2c26c8bSAndroid Build Coastguard Worker struct doctor { 211*c2c26c8bSAndroid Build Coastguard Worker struct in_addr in, end, out, mask; 212*c2c26c8bSAndroid Build Coastguard Worker struct doctor* next; 213*c2c26c8bSAndroid Build Coastguard Worker }; 214*c2c26c8bSAndroid Build Coastguard Worker 215*c2c26c8bSAndroid Build Coastguard Worker struct mx_srv_record { 216*c2c26c8bSAndroid Build Coastguard Worker char *name, *target; 217*c2c26c8bSAndroid Build Coastguard Worker int issrv, srvport, priority, weight; 218*c2c26c8bSAndroid Build Coastguard Worker unsigned int offset; 219*c2c26c8bSAndroid Build Coastguard Worker struct mx_srv_record* next; 220*c2c26c8bSAndroid Build Coastguard Worker }; 221*c2c26c8bSAndroid Build Coastguard Worker 222*c2c26c8bSAndroid Build Coastguard Worker struct naptr { 223*c2c26c8bSAndroid Build Coastguard Worker char *name, *replace, *regexp, *services, *flags; 224*c2c26c8bSAndroid Build Coastguard Worker unsigned int order, pref; 225*c2c26c8bSAndroid Build Coastguard Worker struct naptr* next; 226*c2c26c8bSAndroid Build Coastguard Worker }; 227*c2c26c8bSAndroid Build Coastguard Worker 228*c2c26c8bSAndroid Build Coastguard Worker struct txt_record { 229*c2c26c8bSAndroid Build Coastguard Worker char *name, *txt; 230*c2c26c8bSAndroid Build Coastguard Worker unsigned short class, len; 231*c2c26c8bSAndroid Build Coastguard Worker struct txt_record* next; 232*c2c26c8bSAndroid Build Coastguard Worker }; 233*c2c26c8bSAndroid Build Coastguard Worker 234*c2c26c8bSAndroid Build Coastguard Worker struct ptr_record { 235*c2c26c8bSAndroid Build Coastguard Worker char *name, *ptr; 236*c2c26c8bSAndroid Build Coastguard Worker struct ptr_record* next; 237*c2c26c8bSAndroid Build Coastguard Worker }; 238*c2c26c8bSAndroid Build Coastguard Worker 239*c2c26c8bSAndroid Build Coastguard Worker struct cname { 240*c2c26c8bSAndroid Build Coastguard Worker char *alias, *target; 241*c2c26c8bSAndroid Build Coastguard Worker struct cname* next; 242*c2c26c8bSAndroid Build Coastguard Worker }; 243*c2c26c8bSAndroid Build Coastguard Worker 244*c2c26c8bSAndroid Build Coastguard Worker struct interface_name { 245*c2c26c8bSAndroid Build Coastguard Worker char* name; /* domain name */ 246*c2c26c8bSAndroid Build Coastguard Worker char* intr; /* interface name */ 247*c2c26c8bSAndroid Build Coastguard Worker struct interface_name* next; 248*c2c26c8bSAndroid Build Coastguard Worker }; 249*c2c26c8bSAndroid Build Coastguard Worker 250*c2c26c8bSAndroid Build Coastguard Worker union bigname { 251*c2c26c8bSAndroid Build Coastguard Worker char name[MAXDNAME]; 252*c2c26c8bSAndroid Build Coastguard Worker union bigname* next; /* freelist */ 253*c2c26c8bSAndroid Build Coastguard Worker }; 254*c2c26c8bSAndroid Build Coastguard Worker 255*c2c26c8bSAndroid Build Coastguard Worker struct crec { 256*c2c26c8bSAndroid Build Coastguard Worker struct crec *next, *prev, *hash_next; 257*c2c26c8bSAndroid Build Coastguard Worker time_t ttd; /* time to die */ 258*c2c26c8bSAndroid Build Coastguard Worker int uid; 259*c2c26c8bSAndroid Build Coastguard Worker union { 260*c2c26c8bSAndroid Build Coastguard Worker struct all_addr addr; 261*c2c26c8bSAndroid Build Coastguard Worker struct { 262*c2c26c8bSAndroid Build Coastguard Worker struct crec* cache; 263*c2c26c8bSAndroid Build Coastguard Worker int uid; 264*c2c26c8bSAndroid Build Coastguard Worker } cname; 265*c2c26c8bSAndroid Build Coastguard Worker } addr; 266*c2c26c8bSAndroid Build Coastguard Worker unsigned short flags; 267*c2c26c8bSAndroid Build Coastguard Worker union { 268*c2c26c8bSAndroid Build Coastguard Worker char sname[SMALLDNAME]; 269*c2c26c8bSAndroid Build Coastguard Worker union bigname* bname; 270*c2c26c8bSAndroid Build Coastguard Worker char* namep; 271*c2c26c8bSAndroid Build Coastguard Worker } name; 272*c2c26c8bSAndroid Build Coastguard Worker }; 273*c2c26c8bSAndroid Build Coastguard Worker 274*c2c26c8bSAndroid Build Coastguard Worker #define F_IMMORTAL 1 275*c2c26c8bSAndroid Build Coastguard Worker #define F_CONFIG 2 276*c2c26c8bSAndroid Build Coastguard Worker #define F_REVERSE 4 277*c2c26c8bSAndroid Build Coastguard Worker #define F_FORWARD 8 278*c2c26c8bSAndroid Build Coastguard Worker #define F_DHCP 16 279*c2c26c8bSAndroid Build Coastguard Worker #define F_NEG 32 280*c2c26c8bSAndroid Build Coastguard Worker #define F_HOSTS 64 281*c2c26c8bSAndroid Build Coastguard Worker #define F_IPV4 128 282*c2c26c8bSAndroid Build Coastguard Worker #define F_IPV6 256 283*c2c26c8bSAndroid Build Coastguard Worker #define F_BIGNAME 512 284*c2c26c8bSAndroid Build Coastguard Worker #define F_UPSTREAM 1024 285*c2c26c8bSAndroid Build Coastguard Worker #define F_SERVER 2048 286*c2c26c8bSAndroid Build Coastguard Worker #define F_NXDOMAIN 4096 287*c2c26c8bSAndroid Build Coastguard Worker #define F_QUERY 8192 288*c2c26c8bSAndroid Build Coastguard Worker #define F_CNAME 16384 289*c2c26c8bSAndroid Build Coastguard Worker #define F_NOERR 32768 290*c2c26c8bSAndroid Build Coastguard Worker 291*c2c26c8bSAndroid Build Coastguard Worker /* struct sockaddr is not large enough to hold any address, 292*c2c26c8bSAndroid Build Coastguard Worker and specifically not big enough to hold an IPv6 address. 293*c2c26c8bSAndroid Build Coastguard Worker Blech. Roll our own. */ 294*c2c26c8bSAndroid Build Coastguard Worker union mysockaddr { 295*c2c26c8bSAndroid Build Coastguard Worker struct sockaddr sa; 296*c2c26c8bSAndroid Build Coastguard Worker struct sockaddr_in in; 297*c2c26c8bSAndroid Build Coastguard Worker #if defined(HAVE_IPV6) 298*c2c26c8bSAndroid Build Coastguard Worker struct sockaddr_in6 in6; 299*c2c26c8bSAndroid Build Coastguard Worker #endif 300*c2c26c8bSAndroid Build Coastguard Worker }; 301*c2c26c8bSAndroid Build Coastguard Worker 302*c2c26c8bSAndroid Build Coastguard Worker #define SERV_FROM_RESOLV 1 /* 1 for servers from resolv, 0 for command line. */ 303*c2c26c8bSAndroid Build Coastguard Worker #define SERV_NO_ADDR 2 /* no server, this domain is local only */ 304*c2c26c8bSAndroid Build Coastguard Worker #define SERV_LITERAL_ADDRESS 4 /* addr is the answer, not the server */ 305*c2c26c8bSAndroid Build Coastguard Worker #define SERV_HAS_DOMAIN 8 /* server for one domain only */ 306*c2c26c8bSAndroid Build Coastguard Worker #define SERV_HAS_SOURCE 16 /* source address defined */ 307*c2c26c8bSAndroid Build Coastguard Worker #define SERV_FOR_NODOTS 32 /* server for names with no domain part only */ 308*c2c26c8bSAndroid Build Coastguard Worker #define SERV_WARNED_RECURSIVE 64 /* avoid warning spam */ 309*c2c26c8bSAndroid Build Coastguard Worker #define SERV_FROM_DBUS 128 /* 1 if source is DBus */ 310*c2c26c8bSAndroid Build Coastguard Worker #define SERV_MARK 256 /* for mark-and-delete */ 311*c2c26c8bSAndroid Build Coastguard Worker #define SERV_TYPE (SERV_HAS_DOMAIN | SERV_FOR_NODOTS) 312*c2c26c8bSAndroid Build Coastguard Worker #define SERV_COUNTED 512 /* workspace for log code */ 313*c2c26c8bSAndroid Build Coastguard Worker 314*c2c26c8bSAndroid Build Coastguard Worker struct serverfd { 315*c2c26c8bSAndroid Build Coastguard Worker int fd; 316*c2c26c8bSAndroid Build Coastguard Worker union mysockaddr source_addr; 317*c2c26c8bSAndroid Build Coastguard Worker char interface[IF_NAMESIZE + 1]; 318*c2c26c8bSAndroid Build Coastguard Worker struct serverfd* next; 319*c2c26c8bSAndroid Build Coastguard Worker uint32_t mark; 320*c2c26c8bSAndroid Build Coastguard Worker }; 321*c2c26c8bSAndroid Build Coastguard Worker 322*c2c26c8bSAndroid Build Coastguard Worker struct randfd { 323*c2c26c8bSAndroid Build Coastguard Worker int fd; 324*c2c26c8bSAndroid Build Coastguard Worker unsigned short refcount, family; 325*c2c26c8bSAndroid Build Coastguard Worker }; 326*c2c26c8bSAndroid Build Coastguard Worker 327*c2c26c8bSAndroid Build Coastguard Worker struct server { 328*c2c26c8bSAndroid Build Coastguard Worker union mysockaddr addr, source_addr; 329*c2c26c8bSAndroid Build Coastguard Worker char interface[IF_NAMESIZE + 1]; 330*c2c26c8bSAndroid Build Coastguard Worker struct serverfd* sfd; 331*c2c26c8bSAndroid Build Coastguard Worker char* domain; /* set if this server only handles a domain. */ 332*c2c26c8bSAndroid Build Coastguard Worker int flags, tcpfd; 333*c2c26c8bSAndroid Build Coastguard Worker unsigned int queries, failed_queries; 334*c2c26c8bSAndroid Build Coastguard Worker uint32_t mark; 335*c2c26c8bSAndroid Build Coastguard Worker struct server* next; 336*c2c26c8bSAndroid Build Coastguard Worker }; 337*c2c26c8bSAndroid Build Coastguard Worker 338*c2c26c8bSAndroid Build Coastguard Worker struct irec { 339*c2c26c8bSAndroid Build Coastguard Worker union mysockaddr addr; 340*c2c26c8bSAndroid Build Coastguard Worker struct in_addr netmask; /* only valid for IPv4 */ 341*c2c26c8bSAndroid Build Coastguard Worker int dhcp_ok, mtu; 342*c2c26c8bSAndroid Build Coastguard Worker struct irec* next; 343*c2c26c8bSAndroid Build Coastguard Worker }; 344*c2c26c8bSAndroid Build Coastguard Worker 345*c2c26c8bSAndroid Build Coastguard Worker struct listener { 346*c2c26c8bSAndroid Build Coastguard Worker int fd, tcpfd, family; 347*c2c26c8bSAndroid Build Coastguard Worker struct irec* iface; /* only valid for non-wildcard */ 348*c2c26c8bSAndroid Build Coastguard Worker struct listener* next; 349*c2c26c8bSAndroid Build Coastguard Worker }; 350*c2c26c8bSAndroid Build Coastguard Worker 351*c2c26c8bSAndroid Build Coastguard Worker /* interface and address parms from command line. */ 352*c2c26c8bSAndroid Build Coastguard Worker struct iname { 353*c2c26c8bSAndroid Build Coastguard Worker char* name; 354*c2c26c8bSAndroid Build Coastguard Worker union mysockaddr addr; 355*c2c26c8bSAndroid Build Coastguard Worker int isloop, used; 356*c2c26c8bSAndroid Build Coastguard Worker struct iname* next; 357*c2c26c8bSAndroid Build Coastguard Worker }; 358*c2c26c8bSAndroid Build Coastguard Worker 359*c2c26c8bSAndroid Build Coastguard Worker /* resolv-file parms from command-line */ 360*c2c26c8bSAndroid Build Coastguard Worker struct resolvc { 361*c2c26c8bSAndroid Build Coastguard Worker struct resolvc* next; 362*c2c26c8bSAndroid Build Coastguard Worker int is_default, logged; 363*c2c26c8bSAndroid Build Coastguard Worker time_t mtime; 364*c2c26c8bSAndroid Build Coastguard Worker char* name; 365*c2c26c8bSAndroid Build Coastguard Worker }; 366*c2c26c8bSAndroid Build Coastguard Worker 367*c2c26c8bSAndroid Build Coastguard Worker /* adn-hosts parms from command-line */ 368*c2c26c8bSAndroid Build Coastguard Worker #define AH_DIR 1 369*c2c26c8bSAndroid Build Coastguard Worker #define AH_INACTIVE 2 370*c2c26c8bSAndroid Build Coastguard Worker struct hostsfile { 371*c2c26c8bSAndroid Build Coastguard Worker struct hostsfile* next; 372*c2c26c8bSAndroid Build Coastguard Worker int flags; 373*c2c26c8bSAndroid Build Coastguard Worker char* fname; 374*c2c26c8bSAndroid Build Coastguard Worker int index; /* matches to cache entries for logging */ 375*c2c26c8bSAndroid Build Coastguard Worker }; 376*c2c26c8bSAndroid Build Coastguard Worker 377*c2c26c8bSAndroid Build Coastguard Worker struct frec { 378*c2c26c8bSAndroid Build Coastguard Worker union mysockaddr source; 379*c2c26c8bSAndroid Build Coastguard Worker struct all_addr dest; 380*c2c26c8bSAndroid Build Coastguard Worker struct server* sentto; /* NULL means free */ 381*c2c26c8bSAndroid Build Coastguard Worker struct randfd* rfd4; 382*c2c26c8bSAndroid Build Coastguard Worker #ifdef HAVE_IPV6 383*c2c26c8bSAndroid Build Coastguard Worker struct randfd* rfd6; 384*c2c26c8bSAndroid Build Coastguard Worker #endif 385*c2c26c8bSAndroid Build Coastguard Worker unsigned int iface; 386*c2c26c8bSAndroid Build Coastguard Worker unsigned short orig_id, new_id; 387*c2c26c8bSAndroid Build Coastguard Worker int fd, forwardall; 388*c2c26c8bSAndroid Build Coastguard Worker unsigned int crc; 389*c2c26c8bSAndroid Build Coastguard Worker time_t time; 390*c2c26c8bSAndroid Build Coastguard Worker struct frec* next; 391*c2c26c8bSAndroid Build Coastguard Worker }; 392*c2c26c8bSAndroid Build Coastguard Worker 393*c2c26c8bSAndroid Build Coastguard Worker /* actions in the daemon->helper RPC */ 394*c2c26c8bSAndroid Build Coastguard Worker #define ACTION_DEL 1 395*c2c26c8bSAndroid Build Coastguard Worker #define ACTION_OLD_HOSTNAME 2 396*c2c26c8bSAndroid Build Coastguard Worker #define ACTION_OLD 3 397*c2c26c8bSAndroid Build Coastguard Worker #define ACTION_ADD 4 398*c2c26c8bSAndroid Build Coastguard Worker 399*c2c26c8bSAndroid Build Coastguard Worker #define DHCP_CHADDR_MAX 16 400*c2c26c8bSAndroid Build Coastguard Worker 401*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_lease { 402*c2c26c8bSAndroid Build Coastguard Worker int clid_len; /* length of client identifier */ 403*c2c26c8bSAndroid Build Coastguard Worker unsigned char* clid; /* clientid */ 404*c2c26c8bSAndroid Build Coastguard Worker char *hostname, *fqdn; /* name from client-hostname option or config */ 405*c2c26c8bSAndroid Build Coastguard Worker char* old_hostname; /* hostname before it moved to another lease */ 406*c2c26c8bSAndroid Build Coastguard Worker char auth_name; /* hostname came from config, not from client */ 407*c2c26c8bSAndroid Build Coastguard Worker char new; /* newly created */ 408*c2c26c8bSAndroid Build Coastguard Worker char changed; /* modified */ 409*c2c26c8bSAndroid Build Coastguard Worker char aux_changed; /* CLID or expiry changed */ 410*c2c26c8bSAndroid Build Coastguard Worker time_t expires; /* lease expiry */ 411*c2c26c8bSAndroid Build Coastguard Worker #ifdef HAVE_BROKEN_RTC 412*c2c26c8bSAndroid Build Coastguard Worker unsigned int length; 413*c2c26c8bSAndroid Build Coastguard Worker #endif 414*c2c26c8bSAndroid Build Coastguard Worker int hwaddr_len, hwaddr_type; 415*c2c26c8bSAndroid Build Coastguard Worker unsigned char hwaddr[DHCP_CHADDR_MAX]; 416*c2c26c8bSAndroid Build Coastguard Worker struct in_addr addr, override, giaddr; 417*c2c26c8bSAndroid Build Coastguard Worker unsigned char *vendorclass, *userclass, *supplied_hostname; 418*c2c26c8bSAndroid Build Coastguard Worker unsigned int vendorclass_len, userclass_len, supplied_hostname_len; 419*c2c26c8bSAndroid Build Coastguard Worker int last_interface; 420*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_lease* next; 421*c2c26c8bSAndroid Build Coastguard Worker }; 422*c2c26c8bSAndroid Build Coastguard Worker 423*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid { 424*c2c26c8bSAndroid Build Coastguard Worker char* net; 425*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid* next; 426*c2c26c8bSAndroid Build Coastguard Worker }; 427*c2c26c8bSAndroid Build Coastguard Worker 428*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid_list { 429*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid* list; 430*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid_list* next; 431*c2c26c8bSAndroid Build Coastguard Worker }; 432*c2c26c8bSAndroid Build Coastguard Worker 433*c2c26c8bSAndroid Build Coastguard Worker struct hwaddr_config { 434*c2c26c8bSAndroid Build Coastguard Worker int hwaddr_len, hwaddr_type; 435*c2c26c8bSAndroid Build Coastguard Worker unsigned char hwaddr[DHCP_CHADDR_MAX]; 436*c2c26c8bSAndroid Build Coastguard Worker unsigned int wildcard_mask; 437*c2c26c8bSAndroid Build Coastguard Worker struct hwaddr_config* next; 438*c2c26c8bSAndroid Build Coastguard Worker }; 439*c2c26c8bSAndroid Build Coastguard Worker 440*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_config { 441*c2c26c8bSAndroid Build Coastguard Worker unsigned int flags; 442*c2c26c8bSAndroid Build Coastguard Worker int clid_len; /* length of client identifier */ 443*c2c26c8bSAndroid Build Coastguard Worker unsigned char* clid; /* clientid */ 444*c2c26c8bSAndroid Build Coastguard Worker char *hostname, *domain; 445*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid netid; 446*c2c26c8bSAndroid Build Coastguard Worker struct in_addr addr; 447*c2c26c8bSAndroid Build Coastguard Worker time_t decline_time; 448*c2c26c8bSAndroid Build Coastguard Worker unsigned int lease_time; 449*c2c26c8bSAndroid Build Coastguard Worker struct hwaddr_config* hwaddr; 450*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_config* next; 451*c2c26c8bSAndroid Build Coastguard Worker }; 452*c2c26c8bSAndroid Build Coastguard Worker 453*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_DISABLE 1 454*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_CLID 2 455*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_TIME 8 456*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_NAME 16 457*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_ADDR 32 458*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_NETID 64 459*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_NOCLID 128 460*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_ADDR_HOSTS 512 /* address added by from /etc/hosts */ 461*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_DECLINED 1024 /* address declined by client */ 462*c2c26c8bSAndroid Build Coastguard Worker #define CONFIG_BANK 2048 /* from dhcp hosts file */ 463*c2c26c8bSAndroid Build Coastguard Worker 464*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_opt { 465*c2c26c8bSAndroid Build Coastguard Worker int opt, len, flags; 466*c2c26c8bSAndroid Build Coastguard Worker union { 467*c2c26c8bSAndroid Build Coastguard Worker int encap; 468*c2c26c8bSAndroid Build Coastguard Worker unsigned int wildcard_mask; 469*c2c26c8bSAndroid Build Coastguard Worker unsigned char* vendor_class; 470*c2c26c8bSAndroid Build Coastguard Worker } u; 471*c2c26c8bSAndroid Build Coastguard Worker unsigned char* val; 472*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid* netid; 473*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_opt* next; 474*c2c26c8bSAndroid Build Coastguard Worker }; 475*c2c26c8bSAndroid Build Coastguard Worker 476*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_ADDR 1 477*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_STRING 2 478*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_ENCAPSULATE 4 479*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_ENCAP_MATCH 8 480*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_FORCE 16 481*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_BANK 32 482*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_ENCAP_DONE 64 483*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_MATCH 128 484*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_VENDOR 256 485*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_HEX 512 486*c2c26c8bSAndroid Build Coastguard Worker #define DHOPT_VENDOR_MATCH 1024 487*c2c26c8bSAndroid Build Coastguard Worker 488*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_boot { 489*c2c26c8bSAndroid Build Coastguard Worker char *file, *sname; 490*c2c26c8bSAndroid Build Coastguard Worker struct in_addr next_server; 491*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid* netid; 492*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_boot* next; 493*c2c26c8bSAndroid Build Coastguard Worker }; 494*c2c26c8bSAndroid Build Coastguard Worker 495*c2c26c8bSAndroid Build Coastguard Worker struct pxe_service { 496*c2c26c8bSAndroid Build Coastguard Worker unsigned short CSA, type; 497*c2c26c8bSAndroid Build Coastguard Worker char *menu, *basename; 498*c2c26c8bSAndroid Build Coastguard Worker struct in_addr server; 499*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid* netid; 500*c2c26c8bSAndroid Build Coastguard Worker struct pxe_service* next; 501*c2c26c8bSAndroid Build Coastguard Worker }; 502*c2c26c8bSAndroid Build Coastguard Worker 503*c2c26c8bSAndroid Build Coastguard Worker #define MATCH_VENDOR 1 504*c2c26c8bSAndroid Build Coastguard Worker #define MATCH_USER 2 505*c2c26c8bSAndroid Build Coastguard Worker #define MATCH_CIRCUIT 3 506*c2c26c8bSAndroid Build Coastguard Worker #define MATCH_REMOTE 4 507*c2c26c8bSAndroid Build Coastguard Worker #define MATCH_SUBSCRIBER 5 508*c2c26c8bSAndroid Build Coastguard Worker 509*c2c26c8bSAndroid Build Coastguard Worker /* vendorclass, userclass, remote-id or cicuit-id */ 510*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_vendor { 511*c2c26c8bSAndroid Build Coastguard Worker int len, match_type, option; 512*c2c26c8bSAndroid Build Coastguard Worker char* data; 513*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid netid; 514*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_vendor* next; 515*c2c26c8bSAndroid Build Coastguard Worker }; 516*c2c26c8bSAndroid Build Coastguard Worker 517*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_mac { 518*c2c26c8bSAndroid Build Coastguard Worker unsigned int mask; 519*c2c26c8bSAndroid Build Coastguard Worker int hwaddr_len, hwaddr_type; 520*c2c26c8bSAndroid Build Coastguard Worker unsigned char hwaddr[DHCP_CHADDR_MAX]; 521*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid netid; 522*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_mac* next; 523*c2c26c8bSAndroid Build Coastguard Worker }; 524*c2c26c8bSAndroid Build Coastguard Worker 525*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_bridge { 526*c2c26c8bSAndroid Build Coastguard Worker char iface[IF_NAMESIZE]; 527*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_bridge *alias, *next; 528*c2c26c8bSAndroid Build Coastguard Worker }; 529*c2c26c8bSAndroid Build Coastguard Worker 530*c2c26c8bSAndroid Build Coastguard Worker struct cond_domain { 531*c2c26c8bSAndroid Build Coastguard Worker char* domain; 532*c2c26c8bSAndroid Build Coastguard Worker struct in_addr start, end; 533*c2c26c8bSAndroid Build Coastguard Worker struct cond_domain* next; 534*c2c26c8bSAndroid Build Coastguard Worker }; 535*c2c26c8bSAndroid Build Coastguard Worker 536*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_context { 537*c2c26c8bSAndroid Build Coastguard Worker unsigned int lease_time, addr_epoch; 538*c2c26c8bSAndroid Build Coastguard Worker struct in_addr netmask, broadcast; 539*c2c26c8bSAndroid Build Coastguard Worker struct in_addr local, router; 540*c2c26c8bSAndroid Build Coastguard Worker struct in_addr start, end; /* range of available addresses */ 541*c2c26c8bSAndroid Build Coastguard Worker int flags; 542*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid netid, *filter; 543*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_context *next, *current; 544*c2c26c8bSAndroid Build Coastguard Worker }; 545*c2c26c8bSAndroid Build Coastguard Worker 546*c2c26c8bSAndroid Build Coastguard Worker #define CONTEXT_STATIC 1 547*c2c26c8bSAndroid Build Coastguard Worker #define CONTEXT_NETMASK 2 548*c2c26c8bSAndroid Build Coastguard Worker #define CONTEXT_BRDCAST 4 549*c2c26c8bSAndroid Build Coastguard Worker #define CONTEXT_PROXY 8 550*c2c26c8bSAndroid Build Coastguard Worker 551*c2c26c8bSAndroid Build Coastguard Worker typedef unsigned char u8; 552*c2c26c8bSAndroid Build Coastguard Worker typedef unsigned short u16; 553*c2c26c8bSAndroid Build Coastguard Worker typedef unsigned int u32; 554*c2c26c8bSAndroid Build Coastguard Worker 555*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_packet { 556*c2c26c8bSAndroid Build Coastguard Worker u8 op, htype, hlen, hops; 557*c2c26c8bSAndroid Build Coastguard Worker u32 xid; 558*c2c26c8bSAndroid Build Coastguard Worker u16 secs, flags; 559*c2c26c8bSAndroid Build Coastguard Worker struct in_addr ciaddr, yiaddr, siaddr, giaddr; 560*c2c26c8bSAndroid Build Coastguard Worker u8 chaddr[DHCP_CHADDR_MAX], sname[64], file[128]; 561*c2c26c8bSAndroid Build Coastguard Worker u8 options[312]; 562*c2c26c8bSAndroid Build Coastguard Worker }; 563*c2c26c8bSAndroid Build Coastguard Worker 564*c2c26c8bSAndroid Build Coastguard Worker struct ping_result { 565*c2c26c8bSAndroid Build Coastguard Worker struct in_addr addr; 566*c2c26c8bSAndroid Build Coastguard Worker time_t time; 567*c2c26c8bSAndroid Build Coastguard Worker struct ping_result* next; 568*c2c26c8bSAndroid Build Coastguard Worker }; 569*c2c26c8bSAndroid Build Coastguard Worker 570*c2c26c8bSAndroid Build Coastguard Worker extern struct daemon { 571*c2c26c8bSAndroid Build Coastguard Worker /* datastuctures representing the command-line and 572*c2c26c8bSAndroid Build Coastguard Worker config file arguments. All set (including defaults) 573*c2c26c8bSAndroid Build Coastguard Worker in option.c */ 574*c2c26c8bSAndroid Build Coastguard Worker 575*c2c26c8bSAndroid Build Coastguard Worker unsigned int options; 576*c2c26c8bSAndroid Build Coastguard Worker struct resolvc default_resolv, *resolv_files; 577*c2c26c8bSAndroid Build Coastguard Worker time_t last_resolv; 578*c2c26c8bSAndroid Build Coastguard Worker struct mx_srv_record* mxnames; 579*c2c26c8bSAndroid Build Coastguard Worker struct naptr* naptr; 580*c2c26c8bSAndroid Build Coastguard Worker struct txt_record* txt; 581*c2c26c8bSAndroid Build Coastguard Worker struct ptr_record* ptr; 582*c2c26c8bSAndroid Build Coastguard Worker struct cname* cnames; 583*c2c26c8bSAndroid Build Coastguard Worker struct interface_name* int_names; 584*c2c26c8bSAndroid Build Coastguard Worker char* mxtarget; 585*c2c26c8bSAndroid Build Coastguard Worker char* lease_file; 586*c2c26c8bSAndroid Build Coastguard Worker char *username, *groupname, *scriptuser; 587*c2c26c8bSAndroid Build Coastguard Worker int group_set, osport; 588*c2c26c8bSAndroid Build Coastguard Worker char* domain_suffix; 589*c2c26c8bSAndroid Build Coastguard Worker struct cond_domain* cond_domain; 590*c2c26c8bSAndroid Build Coastguard Worker char* runfile; 591*c2c26c8bSAndroid Build Coastguard Worker char* lease_change_command; 592*c2c26c8bSAndroid Build Coastguard Worker struct iname *if_names, *if_addrs, *if_except, *dhcp_except; 593*c2c26c8bSAndroid Build Coastguard Worker struct bogus_addr* bogus_addr; 594*c2c26c8bSAndroid Build Coastguard Worker struct server* servers; 595*c2c26c8bSAndroid Build Coastguard Worker int log_fac; /* log facility */ 596*c2c26c8bSAndroid Build Coastguard Worker char* log_file; /* optional log file */ 597*c2c26c8bSAndroid Build Coastguard Worker int max_logs; /* queue limit */ 598*c2c26c8bSAndroid Build Coastguard Worker int cachesize, ftabsize; 599*c2c26c8bSAndroid Build Coastguard Worker int port, query_port, min_port; 600*c2c26c8bSAndroid Build Coastguard Worker unsigned long local_ttl, neg_ttl; 601*c2c26c8bSAndroid Build Coastguard Worker struct hostsfile* addn_hosts; 602*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_context* dhcp; 603*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_config* dhcp_conf; 604*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_opt *dhcp_opts, *dhcp_match; 605*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_vendor* dhcp_vendors; 606*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_mac* dhcp_macs; 607*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_boot* boot_config; 608*c2c26c8bSAndroid Build Coastguard Worker struct pxe_service* pxe_services; 609*c2c26c8bSAndroid Build Coastguard Worker int enable_pxe; 610*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid_list *dhcp_ignore, *dhcp_ignore_names, *force_broadcast, *bootp_dynamic; 611*c2c26c8bSAndroid Build Coastguard Worker char *dhcp_hosts_file, *dhcp_opts_file; 612*c2c26c8bSAndroid Build Coastguard Worker int dhcp_max; 613*c2c26c8bSAndroid Build Coastguard Worker int dhcp_server_port, dhcp_client_port; 614*c2c26c8bSAndroid Build Coastguard Worker unsigned int min_leasetime; 615*c2c26c8bSAndroid Build Coastguard Worker struct doctor* doctors; 616*c2c26c8bSAndroid Build Coastguard Worker unsigned short edns_pktsz; 617*c2c26c8bSAndroid Build Coastguard Worker uint32_t listen_mark; 618*c2c26c8bSAndroid Build Coastguard Worker 619*c2c26c8bSAndroid Build Coastguard Worker /* globally used stuff for DNS */ 620*c2c26c8bSAndroid Build Coastguard Worker char* packet; /* packet buffer */ 621*c2c26c8bSAndroid Build Coastguard Worker int packet_buff_sz; /* size of above */ 622*c2c26c8bSAndroid Build Coastguard Worker char* namebuff; /* MAXDNAME size buffer */ 623*c2c26c8bSAndroid Build Coastguard Worker unsigned int local_answer, queries_forwarded; 624*c2c26c8bSAndroid Build Coastguard Worker struct frec* frec_list; 625*c2c26c8bSAndroid Build Coastguard Worker struct serverfd* sfds; 626*c2c26c8bSAndroid Build Coastguard Worker struct irec* interfaces; 627*c2c26c8bSAndroid Build Coastguard Worker struct listener* listeners; 628*c2c26c8bSAndroid Build Coastguard Worker struct server* last_server; 629*c2c26c8bSAndroid Build Coastguard Worker time_t forwardtime; 630*c2c26c8bSAndroid Build Coastguard Worker int forwardcount; 631*c2c26c8bSAndroid Build Coastguard Worker struct server* srv_save; /* Used for resend on DoD */ 632*c2c26c8bSAndroid Build Coastguard Worker size_t packet_len; /* " " */ 633*c2c26c8bSAndroid Build Coastguard Worker struct randfd* rfd_save; /* " " */ 634*c2c26c8bSAndroid Build Coastguard Worker pid_t tcp_pids[MAX_PROCS]; 635*c2c26c8bSAndroid Build Coastguard Worker struct randfd randomsocks[RANDOM_SOCKS]; 636*c2c26c8bSAndroid Build Coastguard Worker 637*c2c26c8bSAndroid Build Coastguard Worker /* DHCP state */ 638*c2c26c8bSAndroid Build Coastguard Worker int dhcpfd, helperfd; 639*c2c26c8bSAndroid Build Coastguard Worker int netlinkfd; 640*c2c26c8bSAndroid Build Coastguard Worker struct iovec dhcp_packet; 641*c2c26c8bSAndroid Build Coastguard Worker char *dhcp_buff, *dhcp_buff2; 642*c2c26c8bSAndroid Build Coastguard Worker struct ping_result* ping_results; 643*c2c26c8bSAndroid Build Coastguard Worker FILE* lease_stream; 644*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_bridge* bridges; 645*c2c26c8bSAndroid Build Coastguard Worker 646*c2c26c8bSAndroid Build Coastguard Worker } * daemon; 647*c2c26c8bSAndroid Build Coastguard Worker 648*c2c26c8bSAndroid Build Coastguard Worker /* cache.c */ 649*c2c26c8bSAndroid Build Coastguard Worker void cache_init(void); 650*c2c26c8bSAndroid Build Coastguard Worker void log_query(unsigned short flags, char* name, struct all_addr* addr, char* arg); 651*c2c26c8bSAndroid Build Coastguard Worker char* record_source(int index); 652*c2c26c8bSAndroid Build Coastguard Worker void querystr(char* str, unsigned short type); 653*c2c26c8bSAndroid Build Coastguard Worker struct crec* cache_find_by_addr(struct crec* crecp, struct all_addr* addr, time_t now, 654*c2c26c8bSAndroid Build Coastguard Worker unsigned short prot); 655*c2c26c8bSAndroid Build Coastguard Worker struct crec* cache_find_by_name(struct crec* crecp, char* name, time_t now, unsigned short prot); 656*c2c26c8bSAndroid Build Coastguard Worker void cache_end_insert(void); 657*c2c26c8bSAndroid Build Coastguard Worker void cache_start_insert(void); 658*c2c26c8bSAndroid Build Coastguard Worker struct crec* cache_insert(char* name, struct all_addr* addr, time_t now, unsigned long ttl, 659*c2c26c8bSAndroid Build Coastguard Worker unsigned short flags); 660*c2c26c8bSAndroid Build Coastguard Worker void cache_reload(void); 661*c2c26c8bSAndroid Build Coastguard Worker void cache_add_dhcp_entry(char* host_name, struct in_addr* host_address, time_t ttd); 662*c2c26c8bSAndroid Build Coastguard Worker void cache_unhash_dhcp(void); 663*c2c26c8bSAndroid Build Coastguard Worker void dump_cache(time_t now); 664*c2c26c8bSAndroid Build Coastguard Worker char* cache_get_name(struct crec* crecp); 665*c2c26c8bSAndroid Build Coastguard Worker char* get_domain(struct in_addr addr); 666*c2c26c8bSAndroid Build Coastguard Worker 667*c2c26c8bSAndroid Build Coastguard Worker /* rfc1035.c */ 668*c2c26c8bSAndroid Build Coastguard Worker unsigned short extract_request(HEADER* header, size_t qlen, char* name, unsigned short* typep); 669*c2c26c8bSAndroid Build Coastguard Worker size_t setup_reply(HEADER* header, size_t qlen, struct all_addr* addrp, unsigned short flags, 670*c2c26c8bSAndroid Build Coastguard Worker unsigned long local_ttl); 671*c2c26c8bSAndroid Build Coastguard Worker int extract_addresses(HEADER* header, size_t qlen, char* namebuff, time_t now); 672*c2c26c8bSAndroid Build Coastguard Worker size_t answer_request(HEADER* header, char* limit, size_t qlen, struct in_addr local_addr, 673*c2c26c8bSAndroid Build Coastguard Worker struct in_addr local_netmask, time_t now); 674*c2c26c8bSAndroid Build Coastguard Worker int check_for_bogus_wildcard(HEADER* header, size_t qlen, char* name, struct bogus_addr* addr, 675*c2c26c8bSAndroid Build Coastguard Worker time_t now); 676*c2c26c8bSAndroid Build Coastguard Worker unsigned char* find_pseudoheader(HEADER* header, size_t plen, size_t* len, unsigned char** p, 677*c2c26c8bSAndroid Build Coastguard Worker int* is_sign); 678*c2c26c8bSAndroid Build Coastguard Worker int check_for_local_domain(char* name, time_t now); 679*c2c26c8bSAndroid Build Coastguard Worker unsigned int questions_crc(HEADER* header, size_t plen, char* buff); 680*c2c26c8bSAndroid Build Coastguard Worker size_t resize_packet(HEADER* header, size_t plen, unsigned char* pheader, size_t hlen); 681*c2c26c8bSAndroid Build Coastguard Worker 682*c2c26c8bSAndroid Build Coastguard Worker /* util.c */ 683*c2c26c8bSAndroid Build Coastguard Worker void rand_init(void); 684*c2c26c8bSAndroid Build Coastguard Worker unsigned short rand16(void); 685*c2c26c8bSAndroid Build Coastguard Worker int legal_hostname(char* c); 686*c2c26c8bSAndroid Build Coastguard Worker char* canonicalise(char* s, int* nomem); 687*c2c26c8bSAndroid Build Coastguard Worker unsigned char* do_rfc1035_name(unsigned char* p, char* sval, char *limit); 688*c2c26c8bSAndroid Build Coastguard Worker void* safe_malloc(size_t size); 689*c2c26c8bSAndroid Build Coastguard Worker void safe_pipe(int* fd, int read_noblock); 690*c2c26c8bSAndroid Build Coastguard Worker void* whine_malloc(size_t size); 691*c2c26c8bSAndroid Build Coastguard Worker int sa_len(union mysockaddr* addr); 692*c2c26c8bSAndroid Build Coastguard Worker int sockaddr_isequal(union mysockaddr* s1, union mysockaddr* s2); 693*c2c26c8bSAndroid Build Coastguard Worker int hostname_isequal(char* a, char* b); 694*c2c26c8bSAndroid Build Coastguard Worker time_t dnsmasq_time(void); 695*c2c26c8bSAndroid Build Coastguard Worker int is_same_net(struct in_addr a, struct in_addr b, struct in_addr mask); 696*c2c26c8bSAndroid Build Coastguard Worker int retry_send(void); 697*c2c26c8bSAndroid Build Coastguard Worker int parse_addr(int family, const char* addrstr, union mysockaddr* addr); 698*c2c26c8bSAndroid Build Coastguard Worker void prettyprint_time(char* buf, unsigned int t); 699*c2c26c8bSAndroid Build Coastguard Worker int prettyprint_addr(const union mysockaddr* addr, char* buf); 700*c2c26c8bSAndroid Build Coastguard Worker int parse_hex(char* in, unsigned char* out, int maxlen, unsigned int* wildcard_mask, int* mac_type); 701*c2c26c8bSAndroid Build Coastguard Worker int memcmp_masked(unsigned char* a, unsigned char* b, int len, unsigned int mask); 702*c2c26c8bSAndroid Build Coastguard Worker int expand_buf(struct iovec* iov, size_t size); 703*c2c26c8bSAndroid Build Coastguard Worker char* print_mac(char* buff, unsigned char* mac, int len); 704*c2c26c8bSAndroid Build Coastguard Worker void bump_maxfd(int fd, int* max); 705*c2c26c8bSAndroid Build Coastguard Worker int read_write(int fd, unsigned char* packet, int size, int rw); 706*c2c26c8bSAndroid Build Coastguard Worker 707*c2c26c8bSAndroid Build Coastguard Worker /* log.c */ 708*c2c26c8bSAndroid Build Coastguard Worker void die(char* message, char* arg1, int exit_code); 709*c2c26c8bSAndroid Build Coastguard Worker int log_start(struct passwd* ent_pw, int errfd); 710*c2c26c8bSAndroid Build Coastguard Worker int log_reopen(char* log_file); 711*c2c26c8bSAndroid Build Coastguard Worker void my_syslog(int priority, const char* format, ...); 712*c2c26c8bSAndroid Build Coastguard Worker void set_log_writer(fd_set* set, int* maxfdp); 713*c2c26c8bSAndroid Build Coastguard Worker void check_log_writer(fd_set* set); 714*c2c26c8bSAndroid Build Coastguard Worker void flush_log(void); 715*c2c26c8bSAndroid Build Coastguard Worker 716*c2c26c8bSAndroid Build Coastguard Worker /* option.c */ 717*c2c26c8bSAndroid Build Coastguard Worker void read_opts(int argc, char** argv, char* compile_opts); 718*c2c26c8bSAndroid Build Coastguard Worker char* option_string(unsigned char opt, int* is_ip, int* is_name); 719*c2c26c8bSAndroid Build Coastguard Worker void reread_dhcp(void); 720*c2c26c8bSAndroid Build Coastguard Worker 721*c2c26c8bSAndroid Build Coastguard Worker /* forward.c */ 722*c2c26c8bSAndroid Build Coastguard Worker void reply_query(int fd, int family, time_t now); 723*c2c26c8bSAndroid Build Coastguard Worker void receive_query(struct listener* listen, time_t now); 724*c2c26c8bSAndroid Build Coastguard Worker unsigned char* tcp_request(int confd, time_t now, struct in_addr local_addr, struct in_addr netmask); 725*c2c26c8bSAndroid Build Coastguard Worker void server_gone(struct server* server); 726*c2c26c8bSAndroid Build Coastguard Worker struct frec* get_new_frec(time_t now, int* wait); 727*c2c26c8bSAndroid Build Coastguard Worker 728*c2c26c8bSAndroid Build Coastguard Worker /* network.c */ 729*c2c26c8bSAndroid Build Coastguard Worker int indextoname(int fd, int index, char* name); 730*c2c26c8bSAndroid Build Coastguard Worker int local_bind(int fd, union mysockaddr* addr, char* intname, uint32_t mark, int is_tcp); 731*c2c26c8bSAndroid Build Coastguard Worker int random_sock(int family); 732*c2c26c8bSAndroid Build Coastguard Worker void pre_allocate_sfds(void); 733*c2c26c8bSAndroid Build Coastguard Worker int reload_servers(char* fname); 734*c2c26c8bSAndroid Build Coastguard Worker #ifdef __ANDROID__ 735*c2c26c8bSAndroid Build Coastguard Worker int set_servers(const char* servers); 736*c2c26c8bSAndroid Build Coastguard Worker void set_interfaces(const char* interfaces); 737*c2c26c8bSAndroid Build Coastguard Worker #endif 738*c2c26c8bSAndroid Build Coastguard Worker void check_servers(void); 739*c2c26c8bSAndroid Build Coastguard Worker int enumerate_interfaces(); 740*c2c26c8bSAndroid Build Coastguard Worker struct listener* create_wildcard_listeners(void); 741*c2c26c8bSAndroid Build Coastguard Worker struct listener* create_bound_listeners(void); 742*c2c26c8bSAndroid Build Coastguard Worker int iface_check(int family, struct all_addr* addr, char* name, int* indexp); 743*c2c26c8bSAndroid Build Coastguard Worker int fix_fd(int fd); 744*c2c26c8bSAndroid Build Coastguard Worker struct in_addr get_ifaddr(char* intr); 745*c2c26c8bSAndroid Build Coastguard Worker 746*c2c26c8bSAndroid Build Coastguard Worker /* dhcp.c */ 747*c2c26c8bSAndroid Build Coastguard Worker #ifdef HAVE_DHCP 748*c2c26c8bSAndroid Build Coastguard Worker void dhcp_init(void); 749*c2c26c8bSAndroid Build Coastguard Worker void dhcp_packet(time_t now); 750*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_context* address_available(struct dhcp_context* context, struct in_addr addr, 751*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid* netids); 752*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_context* narrow_context(struct dhcp_context* context, struct in_addr taddr, 753*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_netid* netids); 754*c2c26c8bSAndroid Build Coastguard Worker int match_netid(struct dhcp_netid* check, struct dhcp_netid* pool, int negonly); 755*c2c26c8bSAndroid Build Coastguard Worker int address_allocate(struct dhcp_context* context, struct in_addr* addrp, unsigned char* hwaddr, 756*c2c26c8bSAndroid Build Coastguard Worker int hw_len, struct dhcp_netid* netids, time_t now); 757*c2c26c8bSAndroid Build Coastguard Worker int config_has_mac(struct dhcp_config* config, unsigned char* hwaddr, int len, int type); 758*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_config* find_config(struct dhcp_config* configs, struct dhcp_context* context, 759*c2c26c8bSAndroid Build Coastguard Worker unsigned char* clid, int clid_len, unsigned char* hwaddr, 760*c2c26c8bSAndroid Build Coastguard Worker int hw_len, int hw_type, char* hostname); 761*c2c26c8bSAndroid Build Coastguard Worker void dhcp_update_configs(struct dhcp_config* configs); 762*c2c26c8bSAndroid Build Coastguard Worker void check_dhcp_hosts(int fatal); 763*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_config* config_find_by_address(struct dhcp_config* configs, struct in_addr addr); 764*c2c26c8bSAndroid Build Coastguard Worker char* strip_hostname(char* hostname); 765*c2c26c8bSAndroid Build Coastguard Worker char* host_from_dns(struct in_addr addr); 766*c2c26c8bSAndroid Build Coastguard Worker char* get_domain(struct in_addr addr); 767*c2c26c8bSAndroid Build Coastguard Worker #endif 768*c2c26c8bSAndroid Build Coastguard Worker 769*c2c26c8bSAndroid Build Coastguard Worker /* lease.c */ 770*c2c26c8bSAndroid Build Coastguard Worker #ifdef HAVE_DHCP 771*c2c26c8bSAndroid Build Coastguard Worker void lease_update_file(time_t now); 772*c2c26c8bSAndroid Build Coastguard Worker void lease_update_dns(); 773*c2c26c8bSAndroid Build Coastguard Worker void lease_init(time_t now); 774*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_lease* lease_allocate(struct in_addr addr); 775*c2c26c8bSAndroid Build Coastguard Worker void lease_set_hwaddr(struct dhcp_lease* lease, unsigned char* hwaddr, unsigned char* clid, 776*c2c26c8bSAndroid Build Coastguard Worker int hw_len, int hw_type, int clid_len); 777*c2c26c8bSAndroid Build Coastguard Worker void lease_set_hostname(struct dhcp_lease* lease, char* name, int auth); 778*c2c26c8bSAndroid Build Coastguard Worker void lease_set_expires(struct dhcp_lease* lease, unsigned int len, time_t now); 779*c2c26c8bSAndroid Build Coastguard Worker void lease_set_interface(struct dhcp_lease* lease, int interface); 780*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_lease* lease_find_by_client(unsigned char* hwaddr, int hw_len, int hw_type, 781*c2c26c8bSAndroid Build Coastguard Worker unsigned char* clid, int clid_len); 782*c2c26c8bSAndroid Build Coastguard Worker struct dhcp_lease* lease_find_by_addr(struct in_addr addr); 783*c2c26c8bSAndroid Build Coastguard Worker void lease_prune(struct dhcp_lease* target, time_t now); 784*c2c26c8bSAndroid Build Coastguard Worker void lease_update_from_configs(void); 785*c2c26c8bSAndroid Build Coastguard Worker int do_script_run(time_t now); 786*c2c26c8bSAndroid Build Coastguard Worker void rerun_scripts(void); 787*c2c26c8bSAndroid Build Coastguard Worker #endif 788*c2c26c8bSAndroid Build Coastguard Worker 789*c2c26c8bSAndroid Build Coastguard Worker /* rfc2131.c */ 790*c2c26c8bSAndroid Build Coastguard Worker #ifdef HAVE_DHCP 791*c2c26c8bSAndroid Build Coastguard Worker size_t dhcp_reply(struct dhcp_context* context, char* iface_name, int int_index, size_t sz, 792*c2c26c8bSAndroid Build Coastguard Worker time_t now, int unicast_dest, int* is_inform); 793*c2c26c8bSAndroid Build Coastguard Worker unsigned char* extended_hwaddr(int hwtype, int hwlen, unsigned char* hwaddr, int clid_len, 794*c2c26c8bSAndroid Build Coastguard Worker unsigned char* clid, int* len_out); 795*c2c26c8bSAndroid Build Coastguard Worker #endif 796*c2c26c8bSAndroid Build Coastguard Worker 797*c2c26c8bSAndroid Build Coastguard Worker /* dnsmasq.c */ 798*c2c26c8bSAndroid Build Coastguard Worker #ifdef HAVE_DHCP 799*c2c26c8bSAndroid Build Coastguard Worker int make_icmp_sock(void); 800*c2c26c8bSAndroid Build Coastguard Worker int icmp_ping(struct in_addr addr); 801*c2c26c8bSAndroid Build Coastguard Worker #endif 802*c2c26c8bSAndroid Build Coastguard Worker void send_event(int fd, int event, int data); 803*c2c26c8bSAndroid Build Coastguard Worker void clear_cache_and_reload(time_t now); 804*c2c26c8bSAndroid Build Coastguard Worker 805*c2c26c8bSAndroid Build Coastguard Worker /* netlink.c */ 806*c2c26c8bSAndroid Build Coastguard Worker #ifdef HAVE_LINUX_NETWORK 807*c2c26c8bSAndroid Build Coastguard Worker void netlink_init(void); 808*c2c26c8bSAndroid Build Coastguard Worker void netlink_multicast(void); 809*c2c26c8bSAndroid Build Coastguard Worker #endif 810*c2c26c8bSAndroid Build Coastguard Worker 811*c2c26c8bSAndroid Build Coastguard Worker /* bpf.c or netlink.c */ 812*c2c26c8bSAndroid Build Coastguard Worker int iface_enumerate(void* parm, int (*ipv4_callback)(), int (*ipv6_callback)()); 813*c2c26c8bSAndroid Build Coastguard Worker 814*c2c26c8bSAndroid Build Coastguard Worker /* helper.c */ 815*c2c26c8bSAndroid Build Coastguard Worker #if defined(HAVE_DHCP) && !defined(NO_FORK) 816*c2c26c8bSAndroid Build Coastguard Worker int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd); 817*c2c26c8bSAndroid Build Coastguard Worker void helper_write(void); 818*c2c26c8bSAndroid Build Coastguard Worker void queue_script(int action, struct dhcp_lease* lease, char* hostname, time_t now); 819*c2c26c8bSAndroid Build Coastguard Worker int helper_buf_empty(void); 820*c2c26c8bSAndroid Build Coastguard Worker #endif 821