1 /* 2 * 3 * chilli - ChilliSpot.org. A Wireless LAN Access Point Controller. 4 * Copyright (C) 2003, 2004, 2005 Mondru AB. 5 * Copyright (C) 2006 PicoPoint B.V. 6 * Copyright (c) 2006-2007 David Bird <david@coova.com> 7 * 8 * The contents of this file may be used under the terms of the GNU 9 * General Public License Version 2, provided that the above copyright 10 * notice and this permission notice is included in all copies or 11 * substantial portions of the software. 12 * 13 * The initial developer of the original code is 14 * Jens Jakobsen <jj@chillispot.org> 15 * 16 */ 17 18 #ifndef _OPTIONS_H 19 #define _OPTIONS_H 20 21 #include "pkt.h" 22 #include "garden.h" 23 24 struct options_t { 25 int initialized; 26 int foreground; 27 int debug; 28 /* conf */ 29 int interval; 30 char *pidfile; 31 char *statedir; 32 33 /* TUN parameters */ 34 struct in_addr net; /* Network IP address */ 35 char netc[OPT_IPADDRLEN]; 36 struct in_addr mask; /* Network mask */ 37 char maskc[OPT_IPADDRLEN]; 38 39 char * tundev; 40 char * dynip; /* Dynamic IP address pool */ 41 char * statip; /* Static IP address pool */ 42 int allowdyn; /* Allow dynamic address allocation */ 43 int allowstat; /* Allow static address allocation */ 44 struct in_addr dns1; /* Primary DNS server IP address */ 45 struct in_addr dns2; /* Secondary DNS server IP address */ 46 char * domain; /* Domain to use for DNS lookups */ 47 char * ipup; /* Script to run after link-up */ 48 char * ipdown; /* Script to run after link-down */ 49 char * conup; /* Script to run after session/connection-up */ 50 char * condown; /* Script to run after session/connection-down */ 51 int txqlen; 52 53 /* Radius parameters */ 54 struct in_addr radiuslisten; /* IP address to listen to */ 55 struct in_addr radiusserver1; /* IP address of radius server 1 */ 56 struct in_addr radiusserver2; /* IP address of radius server 2 */ 57 uint16_t radiusauthport; /* Authentication UDP port */ 58 uint16_t radiusacctport; /* Accounting UDP port */ 59 char* radiussecret; /* Radius shared secret */ 60 char* radiusnasid; /* Radius NAS-Identifier */ 61 char* radiuslocationid; /* WISPr location ID */ 62 char* radiuslocationname; /* WISPr location name */ 63 char* locationname; /* Location name */ 64 int radiusnasporttype; /* NAS-Port-Type */ 65 uint16_t coaport; /* UDP port to listen to */ 66 int coanoipcheck; /* Allow disconnect from any IP */ 67 int logfacility; 68 int radiustimeout; /* Retry timeout in milli seconds */ 69 int radiusretry; /* Total amount of retries */ 70 int radiusretrysec; /* Amount of retries after we switch to secondary */ 71 72 /* Radius proxy parameters */ 73 struct in_addr proxylisten; /* IP address to listen to */ 74 int proxyport; /* UDP port to listen to */ 75 struct in_addr proxyaddr; /* IP address of proxy client(s) */ 76 struct in_addr proxymask; /* IP mask of proxy client(s) */ 77 char* proxysecret; /* Proxy shared secret */ 78 79 struct in_addr postauth_proxyip; /* IP address to proxy http to */ 80 int postauth_proxyport; /* TCP port to proxy to */ 81 82 /* DHCP parameters */ 83 char *dhcpif; /* Interface: eth1 */ 84 char *routeif; /* Interface: eth0 (optional) */ 85 unsigned char dhcpmac[PKT_ETH_ALEN]; /* Interface MAC address */ 86 int dhcpusemac; /* Use given MAC or interface default */ 87 struct in_addr dhcplisten; /* IP address to listen to */ 88 int lease; /* DHCP lease time */ 89 int dhcpstart; 90 int dhcpend; 91 92 struct in_addr dhcprelayip; /* IP address of DHCP relay header (default to uamlisten) */ 93 struct in_addr dhcpgwip; /* IP address of DHCP gateway to relay to */ 94 uint16_t dhcpgwport; /* Port of DHCP gateway to relay to */ 95 96 97 /* UAM parameters */ 98 struct in_addr uamserver[UAMSERVER_MAX]; /* IP address of UAM server */ 99 int uamserverlen; /* Number of UAM servers */ 100 int uamserverport; /* Port of UAM server */ 101 char* uamsecret; /* Shared secret */ 102 char* uamurl; /* URL of authentication server */ 103 char* uamhomepage; /* URL of redirection homepage */ 104 char* wisprlogin; /* Specific WISPr login url */ 105 int uamhomepageport; /* Port of redirection homepage */ 106 107 struct in_addr uamlisten; /* IP address of local authentication */ 108 int uamport; /* TCP port to listen to */ 109 int uamuiport; /* TCP port to listen to */ 110 111 struct in_addr uamlogout; /* IP address of HTTP auto-logout */ 112 113 114 /* booleans */ 115 uint8_t usetap:1; 116 uint8_t eapolenable:1; /* Use eapol */ 117 uint8_t swapoctets:1; 118 uint8_t usestatusfile:1; 119 uint8_t chillixml:1; 120 uint8_t pap_always_ok:1; 121 uint8_t uamanydns:1; /* Allow any dns server */ 122 uint8_t uamanyip:1; /* Allow any ip address */ 123 uint8_t dnsparanoia:1; /* Filter DNS for questionable content (dns tunnels) */ 124 uint8_t no_uamsuccess:1; /* Do not send redirect back to UAM on success */ 125 uint8_t no_uamwispr:1; /* Do not have ChilliSpot return WISPr blocks */ 126 uint8_t acct_update:1; 127 uint8_t wpaguests:1; /* Allow WPS "Guest" access */ 128 uint8_t openidauth:1; /* Allow OpenID authentication */ 129 uint8_t macauth:1; /* Use MAC authentication */ 130 uint8_t macauthdeny:1; /* Deny any access to those given Access-Reject */ 131 uint8_t macallowlocal:1; /* Do not use RADIUS for authenticating the macallowed */ 132 uint8_t radiusoriginalurl:1; /* Send ChilliSpot-OriginalURL in AccessRequest */ 133 uint8_t dhcpradius:1; /* Send certain DHCP options in RADIUS attributes */ 134 /* */ 135 136 pass_through pass_throughs[MAX_PASS_THROUGHS]; 137 size_t num_pass_throughs; 138 139 char** uamdomains; 140 141 /* MAC Authentication */ 142 unsigned char macok[MACOK_MAX][PKT_ETH_ALEN]; /* Allowed MACs */ 143 int macoklen; /* Number of MAC addresses */ 144 char* macsuffix; /* Suffix to add to MAC address */ 145 char* macpasswd; /* Password to use for MAC authentication */ 146 147 unsigned long defsessiontimeout; 148 unsigned int defbandwidthmaxdown; 149 unsigned int defbandwidthmaxup; 150 unsigned int defidletimeout; 151 unsigned short definteriminterval; 152 153 /* local content */ 154 char *wwwdir; 155 char *wwwbin; 156 char *uamui; 157 char *localusers; 158 159 /* Admin RADIUS Authentication & Configuration */ 160 char *adminuser; 161 char *adminpasswd; 162 163 /* Location-awareness */ 164 char *ssid; 165 char *nasmac; 166 char *nasip; 167 168 /* Command-Socket */ 169 char *cmdsocket; 170 }; 171 172 extern struct options_t options; 173 174 int option_aton(struct in_addr *addr, struct in_addr *mask, char *pool, int number); 175 int process_options(int argc, char **argv, int minimal); 176 void reprocess_options(int argc, char **argv); 177 178 #endif /*_OPTIONS_H */ 179