Ticket #501: patch_501_benoitg_2010_03_02.patch

File patch_501_benoitg_2010_03_02.patch, 3.0 KB (added by benoitg, 2 years ago)
  • src/fw_iptables.c

     
    555555                                        debug(LOG_DEBUG, "%s - Updated counter.outgoing to %llu bytes.  Updated last_updated to %d", ip, counter, p1->counters.last_updated); 
    556556                                } 
    557557                        } else { 
    558                                 debug(LOG_ERR, "Could not find %s in client list", ip); 
     558                                debug(LOG_ERR, "iptables_fw_counters_update(): Could not find %s in client list, this should not happen unless if the gateway crashed", ip); 
     559                                debug(LOG_ERR, "Preventively deleting firewall rules for %s in table %s", ip, TABLE_WIFIDOG_OUTGOING); 
     560                                iptables_fw_destroy_mention("mangle", TABLE_WIFIDOG_OUTGOING, ip); 
     561                                debug(LOG_ERR, "Preventively deleting firewall rules for %s in table %s", ip, TABLE_WIFIDOG_INCOMING); 
     562                                iptables_fw_destroy_mention("mangle", TABLE_WIFIDOG_INCOMING, ip); 
    559563                        } 
    560564                        UNLOCK_CLIENT_LIST(); 
    561565                } 
     
    593597                                        debug(LOG_DEBUG, "%s - Updated counter.incoming to %llu bytes", ip, counter); 
    594598                                } 
    595599                        } else { 
    596                                 debug(LOG_ERR, "Could not find %s in client list", ip); 
     600                                debug(LOG_ERR, "iptables_fw_counters_update(): Could not find %s in client list, this should not happen unless if the gateway crashed", ip); 
     601                                debug(LOG_ERR, "Preventively deleting firewall rules for %s in table %s", ip, TABLE_WIFIDOG_OUTGOING); 
     602                                iptables_fw_destroy_mention("mangle", TABLE_WIFIDOG_OUTGOING, ip); 
     603                                debug(LOG_ERR, "Preventively deleting firewall rules for %s in table %s", ip, TABLE_WIFIDOG_INCOMING); 
     604                                iptables_fw_destroy_mention("mangle", TABLE_WIFIDOG_INCOMING, ip); 
    597605                        } 
    598606                        UNLOCK_CLIENT_LIST(); 
    599607                } 
  • src/auth.c

     
    106106        client = client_list_find_by_ip(r->clientAddr); 
    107107 
    108108        if (client == NULL) { 
    109                 debug(LOG_ERR, "Could not find client for %s", r->clientAddr); 
     109                debug(LOG_ERR, "authenticate_client(): Could not find client for %s", r->clientAddr); 
    110110                UNLOCK_CLIENT_LIST(); 
    111111                return; 
    112112        } 
     
    129129        client = client_list_find(r->clientAddr, mac); 
    130130         
    131131        if (client == NULL) { 
    132                 debug(LOG_ERR, "Could not find client node for %s (%s)", r->clientAddr, mac); 
     132                debug(LOG_ERR, "authenticate_client(): Could not find client node for %s (%s)", r->clientAddr, mac); 
    133133                UNLOCK_CLIENT_LIST(); 
    134134                free(token); 
    135135                free(mac); 
     
    153153 
    154154        case AUTH_DENIED: 
    155155                /* Central server said invalid token */ 
    156                 debug(LOG_INFO, "Got DENIED from central server authenticating token %s from %s at %s - redirecting them to denied message", client->token, client->ip, client->mac); 
     156                debug(LOG_INFO, "Got DENIED from central server authenticating token %s from %s at %s - deleting from firewall and redirecting them to denied message", client->token, client->ip, client->mac); 
     157                fw_deny(client->ip, client->mac, FW_MARK_KNOWN); 
    157158                safe_asprintf(&urlFragment, "%smessage=%s", 
    158159                        auth_server->authserv_msg_script_path_fragment, 
    159160                        GATEWAY_MESSAGE_DENIED