Changeset 308 for trunk/wifidog/src/fw_iptables.c
- Timestamp:
- 01/06/05 09:44:41 (8 years ago)
- Files:
-
- 1 modified
-
trunk/wifidog/src/fw_iptables.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog/src/fw_iptables.c
r303 r308 161 161 LOCK_CONFIG(); 162 162 163 iptables_do_command("-t nat -N " TABLE_WIFIDOG_AUTHSERVERS); 164 for (auth_server = config->auth_servers; auth_server != NULL; 165 auth_server = auth_server->next) { 166 if (auth_server->last_ip == NULL || 167 strcmp(auth_server->last_ip, "0.0.0.0") == 0) { 168 iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->authserv_hostname); 169 } else { 170 iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->last_ip); 171 } 163 for (auth_server = config->auth_servers; auth_server != NULL; auth_server = auth_server->next) { 164 if (auth_server->last_ip == NULL || strcmp(auth_server->last_ip, "0.0.0.0") == 0) { 165 iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->authserv_hostname); 166 } else { 167 iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->last_ip); 168 } 172 169 } 173 170 … … 185 182 fw_quiet = 0; 186 183 184 /* Create authservers table here instead of in iptables_fw_set_authservers 185 * so we only have to flush it and not destroy/create every time */ 186 iptables_do_command("-t nat -N " TABLE_WIFIDOG_AUTHSERVERS); 187 187 188 iptables_fw_set_authservers(); 188 189 … … 211 212 iptables_load_ruleset("unknown-users", TABLE_WIFIDOG_UNKNOWN); 212 213 LOCK_CONFIG(); 214 213 215 /* XXX If there's a rule in global for port 80, it overrides this. */ 214 216 iptables_do_command("-t nat -A " TABLE_WIFIDOG_UNKNOWN " -p tcp --dport 80 -j REDIRECT --to-ports %d", config->gw_port); 215 217 UNLOCK_CONFIG(); 216 iptables_do_command("-t nat -A " TABLE_WIFIDOG_UNKNOWN " -j REJECT");218 iptables_do_command("-t nat -A " TABLE_WIFIDOG_UNKNOWN " -j DROP"); 217 219 218 220 iptables_do_command("-t nat -N " TABLE_WIFIDOG_KNOWN); 219 /* *Insert global rules BEFORE the "defaults" */221 /* Insert global rules BEFORE the "defaults" */ 220 222 iptables_load_ruleset("global", TABLE_WIFIDOG_KNOWN); 221 223 iptables_load_ruleset("known-users", TABLE_WIFIDOG_KNOWN);
