Changeset 286
- Timestamp:
- 11/21/04 16:07:50 (4 years ago)
- Files:
-
- branches/WIFIDOG_1_0_X/wifidog/ChangeLog (modified) (1 diff)
- branches/WIFIDOG_1_0_X/wifidog/src/conf.h (modified) (1 diff)
- branches/WIFIDOG_1_0_X/wifidog/src/fw_iptables.c (modified) (4 diffs)
- branches/WIFIDOG_1_0_X/wifidog/src/ping_thread.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/WIFIDOG_1_0_X/wifidog/ChangeLog
r285 r286 1 1 # $Header$ 2 3 2004-11-21 Alexandre Carmel-Veilleux <acv@acv.ca> 4 * src/fw_iptables.c: reverted phil's change and fixed it properly 5 * src/ping_thread.c: this is where ntoa should've been. 6 * src/*: Fixed the problems with inet_ntoa. Don't ask me to explain! 7 2 8 2004-11-21 Philippe April <philippe@philippeapril.com> 3 9 * src/fw_iptables.c: changed call to iptables to use IP address instead of branches/WIFIDOG_1_0_X/wifidog/src/conf.h
r278 r286 62 62 listens on */ 63 63 int authserv_use_ssl; /**< @brief Use SSL or not */ 64 struct in_addr *last_ip; /**< @brief Last IP of the authserver */64 char *last_ip; /**< @brief Last IP of the authserver */ 65 65 struct _auth_serv_t *next; 66 66 } t_auth_serv; branches/WIFIDOG_1_0_X/wifidog/src/fw_iptables.c
r285 r286 37 37 #include <netinet/in.h> 38 38 39 #include "conf.h"40 39 #include "fw_iptables.h" 41 40 #include "firewall.h" … … 43 42 #include "util.h" 44 43 #include "client_list.h" 44 #include "conf.h" 45 45 46 46 static int iptables_do_command(char *format, ...); … … 85 85 s_config *config; 86 86 t_auth_serv *auth_server; 87 char *ip; 88 void *bs; 89 struct in_addr *tmp; 87 90 88 91 config = config_get_config(); … … 93 96 for (auth_server = config->auth_servers; auth_server != NULL; 94 97 auth_server = auth_server->next) { 95 if (auth_server->last_ip && strcmp(inet_ntoa(auth_server->last_ip->s_addr), "0.0.0.0") != 0) {96 iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", inet_ntoa(auth_server->last_ip->s_addr));98 if (auth_server->last_ip) { 99 iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->last_ip); 97 100 } else { 98 101 iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->authserv_hostname); branches/WIFIDOG_1_0_X/wifidog/src/ping_thread.c
r280 r286 97 97 i; 98 98 t_auth_serv *auth_server; 99 char request[MAX_BUF]; 99 char request[MAX_BUF], 100 *tmp_addr; 100 101 struct in_addr *h_addr; 101 102 struct sockaddr_in their_addr; … … 127 128 128 129 if (auth_server->last_ip == NULL) { 129 auth_server->last_ip = (struct in_addr *)malloc( 130 sizeof(struct in_addr)); 130 auth_server->last_ip = strdup(inet_ntoa(*h_addr)); 131 131 if (auth_server->last_ip == NULL) { 132 132 debug(LOG_CRIT, "Could not allocate memory, Banzai!"); 133 133 exit(-1); 134 134 } 135 memcpy(auth_server->last_ip, h_addr, sizeof(struct in_addr));136 135 } else { 137 for (i = 0; i < sizeof(struct in_addr) 138 && (*((char *)auth_server->last_ip + i) 139 == *((char *)h_addr + i)); i++); 140 if (i < sizeof(struct in_addr)) { 141 memcpy(auth_server->last_ip, h_addr, sizeof(struct in_addr)); 136 tmp_addr = strdup(inet_ntoa(*h_addr)); 137 if (strcmp(tmp_addr, auth_server->last_ip) != 0) { 138 free(auth_server->last_ip); 139 auth_server->last_ip = tmp_addr; 142 140 fw_clear_authservers(); 143 141 fw_set_authservers();
