Changeset 964

Show
Ignore:
Timestamp:
02/23/06 11:16:16 (3 years ago)
Author:
papril
Message:

* src/fw_iptables.c:
* Changed order in the filter.FORWARD chain
* Added TCPMSS rule
* Fixed deleting the rules on shutdown

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog/ChangeLog

    r944 r964  
    11# $Id$ 
     22006-02-23 Philippe April <philippe@ilesansfil.org> 
     3        * src/fw_iptables.c: 
     4        * Changed order in the filter.FORWARD chain 
     5        * Added TCPMSS rule 
     6        * Fixed deleting the rules on shutdown 
     7 
    282006-02-06 Benoit Gr�ire  <bock@step.polymtl.ca> 
    39        * src/fw_iptables.c: Fix deleting the rules on shutdown. 
  • trunk/wifidog/src/fw_iptables.c

    r944 r964  
    265265 
    266266                        /* Assign links and rules to these new chains */ 
    267                         iptables_do_command("-t filter -A FORWARD -i %s -j " TABLE_WIFIDOG_WIFI_TO_INTERNET, gw_interface); 
     267 
     268            /* Insert at the beginning */ 
     269                        iptables_do_command("-t filter -I FORWARD -i %s -j " TABLE_WIFIDOG_WIFI_TO_INTERNET, gw_interface); 
     270 
     271            /* TCPMSS rule for PPPoE */ 
     272                        iptables_do_command("-t filter -A FORWARD -m state --state INVALID -j DROP"); 
     273                        iptables_do_command("-t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT"); 
     274                        iptables_do_command("-t filter -A FORWARD -i %s -m state --state NEW,INVALID -j DROP", gw_interface); 
     275                        iptables_do_command("-t filter -A FORWARD -o %s -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu", gw_interface); 
     276 
    268277                        iptables_do_command("-t filter -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -j " TABLE_WIFIDOG_AUTHSERVERS); 
    269278                        iptables_fw_set_authservers(); 
     
    336345    iptables_do_command("-t nat -X " TABLE_WIFIDOG_WIFI_TO_ROUTER); 
    337346    iptables_do_command("-t nat -X " TABLE_WIFIDOG_WIFI_TO_INTERNET); 
     347    iptables_do_command("-t nat -X " TABLE_WIFIDOG_GLOBAL); 
    338348    iptables_do_command("-t nat -X " TABLE_WIFIDOG_UNKNOWN); 
    339349 
  • trunk/wifidog/src/util.c

    r935 r964  
    217217} 
    218218 
     219char *get_gw_iface (void) { 
     220#ifdef __linux__ 
     221    FILE *input; 
     222    char *device, *gw; 
     223 
     224    device = (char *)malloc(16); 
     225    gw = (char *)malloc(16); 
     226 
     227    input = fopen("/proc/net/route", "r"); 
     228    while (!feof(input)) { 
     229        fscanf(input, "%s %s %*s %*s %*s %*s %*s %*s %*s %*s %*s\n", device, gw); 
     230        if (strcmp(gw, "00000000") == 0) { 
     231            free(gw); 
     232            return device; 
     233        } 
     234    } 
     235    fclose(input); 
     236 
     237    free(device); 
     238    free(gw); 
     239#endif 
     240    return NULL; 
     241} 
     242 
    219243void mark_online() { 
    220244        int before;