Changeset 798
- Timestamp:
- 10/09/05 22:49:04 (3 years ago)
- Files:
-
- trunk/wifidog/ChangeLog (modified) (1 diff)
- trunk/wifidog/src/auth.c (modified) (2 diffs)
- trunk/wifidog/src/http.c (modified) (5 diffs)
- trunk/wifidog/src/util.c (modified) (4 diffs)
- trunk/wifidog/src/wdctl_thread.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog/ChangeLog
r793 r798 1 1 # $Header$ 2 2005-10-09 Philippe April <philippe@ilesansfil.org> 3 * Changed html pages, added info to wdctl status 4 2 5 2005-10-07 Philippe April <philippe@ilesansfil.org> 3 6 * Released 1.1.3_beta1 trunk/wifidog/src/auth.c
r490 r798 47 47 #include "firewall.h" 48 48 #include "client_list.h" 49 #include "util.h" 49 50 50 51 /* Defined in clientlist.c */ 51 52 extern pthread_mutex_t client_list_mutex; 53 54 /* Defined in util.c */ 55 extern long served_this_session; 52 56 53 57 /** Launches a thread that periodically checks if any of the connections has timed out … … 206 210 client->fw_connection_state = FW_MARK_KNOWN; 207 211 fw_allow(client->ip, client->mac, FW_MARK_KNOWN); 212 served_this_session++; 208 213 safe_asprintf(&newlocation, "Location: %s://%s:%d%sportal/?gw_id=%s", 209 214 protocol, trunk/wifidog/src/http.c
r506 r798 79 79 if (!is_online()) { 80 80 /* The internet connection is down at the moment - apologize and do not redirect anywhere */ 81 http_wifidog_header(r, "Uh oh! Internet access unavailable"); 82 httpdOutput(r, "We apologize, but it seems that the internet connection that powers this hotspot is temporarily unavailable."); 83 httpdOutput(r, "<p>"); 84 httpdOutput(r, "If at all possible, please notify the owners of this hotspot that the internet connection is out of service."); 85 httpdOutput(r, "<p>"); 86 httpdOutput(r, "The maintainers of this network are aware of this disruption. We hope that this situation will be resolved soon."); 87 httpdOutput(r, "<p>"); 88 httpdPrintf(r, "In a while please <a href='%s'>click here</a> to try your request again.", tmp_url); 81 http_wifidog_header(r, "<h2>Uh oh! Internet access unavailable</h2>"); 82 httpdOutput(r, "<p>We apologize, but it seems that the internet connection that powers this hotspot is temporarily unavailable.</p>"); 83 httpdOutput(r, "<p>If at all possible, please notify the owners of this hotspot that the internet connection is out of service.</p>"); 84 httpdOutput(r, "<p>The maintainers of this network are aware of this disruption. We hope that this situation will be resolved soon.</p>"); 85 httpdPrintf(r, "<p>In a while please <a href='%s'>click here</a> to try your request again.</p>", tmp_url); 89 86 http_wifidog_footer(r); 90 87 debug(LOG_INFO, "Sent %s an apology since I am not online - no point sending them to auth server", r->clientAddr); … … 92 89 else if (!is_auth_online()) { 93 90 /* The auth server is down at the moment - apologize and do not redirect anywhere */ 94 http_wifidog_header(r, "Uh oh! Login screen unavailable"); 95 httpdOutput(r, "We apologize, but it seems that we are currently unable to re-direct you to the login screen."); 96 httpdOutput(r, "<p>"); 97 httpdOutput(r, "The maintainers of this network are aware of this disruption. We hope that this situation will be resolved soon."); 98 httpdOutput(r, "<p>"); 99 httpdPrintf(r, "In a couple of minutes please <a href='%s'>click here</a> to try your request again.", tmp_url); 91 http_wifidog_header(r, "<h2>Uh oh! Login screen unavailable</h2>"); 92 httpdOutput(r, "<p>We apologize, but it seems that we are currently unable to re-direct you to the login screen.</p>"); 93 httpdOutput(r, "<p>The maintainers of this network are aware of this disruption. We hope that this situation will be resolved soon.</p>"); 94 httpdPrintf(r, "<p>In a couple of minutes please <a href='%s'>click here</a> to try your request again.</p>", tmp_url); 100 95 http_wifidog_footer(r); 101 96 debug(LOG_INFO, "Sent %s an apology since auth server not online - no point sending them to auth server", r->clientAddr); … … 136 131 { 137 132 http_wifidog_header(r, "WiFiDog"); 138 httpdOutput(r, "Please use the menu on the leftto navigate the features of this WiFiDog installation.");133 httpdOutput(r, "Please use the menu to navigate the features of this WiFiDog installation."); 139 134 http_wifidog_footer(r); 140 135 } … … 204 199 http_wifidog_header(request *r, char *title) 205 200 { 206 httpdOutput(r, "<html>\n"); 207 httpdOutput(r, "<head>\n"); 208 httpdPrintf(r, "<title>%s</title>\n", title); 209 httpdOutput(r, "<meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>\n"); 210 httpdOutput(r, "</head>\n"); 211 httpdOutput(r, "<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 bgcolor=white text=#628C53 link=blue alink=blue vlink=blue>\n"); 212 213 httpdOutput(r, "<table width=100%% height=100%% border=0 cellpadding=12 cellspacing=5>\n"); 214 215 httpdOutput(r, "<tr>\n"); 216 217 httpdOutput(r, "<td valign=top align=right width=30%% bgcolor=#e1f5da>\n"); 218 httpdOutput(r, " <p>\n"); 219 httpdOutput(r, " <p>\n"); 220 httpdOutput(r, "<a href='/wifidog/status'>WiFiDog Status</a>\n"); 221 httpdOutput(r, "<p>\n"); 222 httpdOutput(r, "<a href='/wifidog/about'>About WiFiDog</a>\n"); 223 httpdOutput(r, "<p>\n"); 224 httpdOutput(r, "<a href='http://www.ilesansfil.org/wiki/WiFiDog'>WiFiDog's homepage</a>\n"); 225 httpdOutput(r, "</td>\n"); 226 227 httpdOutput(r, "<td valign=top align=left>\n"); 228 httpdPrintf(r, "<h1>%s</h1>\n", title); 229 httpdOutput(r, "<hr>\n"); 230 201 httpdOutput(r, "<html>\n"); 202 httpdOutput(r, "<head>\n"); 203 httpdPrintf(r, "<title>%s</title>\n", title); 204 httpdOutput(r, "<meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>\n"); 205 206 httpdOutput(r, "<style>\n"); 207 httpdOutput(r, "body {\n"); 208 httpdOutput(r, " margin: 10px 60px 0 60px; \n"); 209 httpdOutput(r, " font-family : bitstream vera sans, sans-serif;\n"); 210 httpdOutput(r, " color: #46a43a;\n"); 211 httpdOutput(r, "}\n"); 212 213 httpdOutput(r, "a {\n"); 214 httpdOutput(r, " color: #46a43a;\n"); 215 httpdOutput(r, "}\n"); 216 217 httpdOutput(r, "a:active {\n"); 218 httpdOutput(r, " color: #46a43a;\n"); 219 httpdOutput(r, "}\n"); 220 221 httpdOutput(r, "a:link {\n"); 222 httpdOutput(r, " color: #46a43a;\n"); 223 httpdOutput(r, "}\n"); 224 225 httpdOutput(r, "a:visited {\n"); 226 httpdOutput(r, " color: #46a43a;\n"); 227 httpdOutput(r, "}\n"); 228 229 httpdOutput(r, "#header {\n"); 230 httpdOutput(r, " height: 30px;\n"); 231 httpdOutput(r, " background-color: #B4F663;\n"); 232 httpdOutput(r, " padding: 20px;\n"); 233 httpdOutput(r, " font-size: 20pt;\n"); 234 httpdOutput(r, " text-align: center;\n"); 235 httpdOutput(r, " border: 2px solid #46a43a;\n"); 236 httpdOutput(r, " border-bottom: 0;\n"); 237 httpdOutput(r, "}\n"); 238 239 httpdOutput(r, "#menu {\n"); 240 httpdOutput(r, " width: 200px;\n"); 241 httpdOutput(r, " float: right;\n"); 242 httpdOutput(r, " background-color: #B4F663;\n"); 243 httpdOutput(r, " border: 2px solid #46a43a;\n"); 244 httpdOutput(r, " font-size: 80%;\n"); 245 httpdOutput(r, " min-height: 300px;\n"); 246 httpdOutput(r, "}\n"); 247 248 httpdOutput(r, "#menu h2 {\n"); 249 httpdOutput(r, " margin: 0;\n"); 250 httpdOutput(r, " background-color: #46a43a;\n"); 251 httpdOutput(r, " text-align: center;\n"); 252 httpdOutput(r, " color: #B4F663;\n"); 253 httpdOutput(r, "}\n"); 254 255 httpdOutput(r, "#copyright {\n"); 256 httpdOutput(r, "}\n"); 257 258 httpdOutput(r, "#content {\n"); 259 httpdOutput(r, " padding: 20px;\n"); 260 httpdOutput(r, " border: 2px solid #46a43a;\n"); 261 httpdOutput(r, " min-height: 300px;\n"); 262 httpdOutput(r, "}\n"); 263 httpdOutput(r, "</style>\n"); 264 265 httpdOutput(r, "</head>\n"); 266 267 httpdOutput(r, "<body\n"); 268 269 httpdOutput(r, "<div id=\"header\">\n"); 270 httpdPrintf(r, " %s\n", title); 271 httpdOutput(r, "</div>\n"); 272 273 httpdOutput(r, "<div id=\"menu\">\n"); 274 275 276 httpdOutput(r, " <h2>Info</h2>\n"); 277 httpdOutput(r, " <ul>\n"); 278 httpdOutput(r, " <li>Version: " VERSION "\n"); 279 httpdPrintf(r, " <li>Node ID: %s\n", config_get_config()->gw_id); 280 httpdOutput(r, " </ul>\n"); 281 httpdOutput(r, " <br>\n"); 282 283 httpdOutput(r, " <h2>Menu</h2>\n"); 284 httpdOutput(r, " <ul>\n"); 285 httpdOutput(r, " <li><a href='/wifidog/status'>WiFiDog Status</a>\n"); 286 httpdOutput(r, " <li><a href='/wifidog/about'>About WiFiDog</a>\n"); 287 httpdOutput(r, " <li><a href='http://www.wifidog.org'>WiFiDog's homepage</a>\n"); 288 httpdOutput(r, " </ul>\n"); 289 httpdOutput(r, "</div>\n"); 290 291 httpdOutput(r, "<div id=\"content\">\n"); 292 httpdPrintf(r, "<h2>%s</h2>\n", title); 231 293 } 232 294 … … 234 296 http_wifidog_footer(request *r) 235 297 { 236 httpdOutput(r, "</td>\n"); 237 238 httpdOutput(r, "</tr>\n"); 239 240 httpdOutput(r, "<tr>\n"); 241 242 httpdOutput(r, "<td colspan=2 height=1 valign=bottom align=center>\n"); 243 httpdOutput(r, "<hr>\n"); 244 httpdOutput(r, "<font size=1>\n"); 245 httpdOutput(r, "Copyright (C) 2004-2005. This software is released under the GNU GPL license.\n"); 246 httpdOutput(r, "</font>\n"); 247 httpdOutput(r, "</td>\n"); 248 249 httpdOutput(r, "</tr>\n"); 250 251 httpdOutput(r, "</table>\n"); 298 httpdOutput(r, "</div>\n"); 299 300 httpdOutput(r, "<div id=\"copyright\">\n"); 301 httpdOutput(r, "Copyright (C) 2004-2005. This software is released under the GNU GPL license.\n"); 302 httpdOutput(r, "</div>\n"); 303 252 304 253 305 httpdOutput(r, "</body>\n"); trunk/wifidog/src/util.c
r765 r798 56 56 #include "debug.h" 57 57 58 #include "../config.h" 59 58 60 static pthread_mutex_t ghbn_mutex = PTHREAD_MUTEX_INITIALIZER; 59 61 … … 73 75 static time_t last_auth_online_time = 0; 74 76 static time_t last_auth_offline_time = 0; 77 78 long served_this_session = 0; 75 79 76 80 /** Fork a child and execute a shell command, the parent … … 327 331 seconds = uptime; 328 332 333 snprintf((buffer + len), (sizeof(buffer) - len), "Version: " VERSION "\n"); 334 len = strlen(buffer); 335 329 336 snprintf((buffer + len), (sizeof(buffer) - len), "Uptime: %ud %uh %um %us\n", days, hours, minutes, seconds); 330 337 len = strlen(buffer); 331 338 332 snprintf((buffer + len), (sizeof(buffer) - len), " Restarted: ");339 snprintf((buffer + len), (sizeof(buffer) - len), "Has been restarted: "); 333 340 len = strlen(buffer); 334 341 if (restarted) { 335 snprintf((buffer + len), (sizeof(buffer) - len), " Yes (from PID %d)\n", restarted);342 snprintf((buffer + len), (sizeof(buffer) - len), "yes (from PID %d)\n", restarted); 336 343 len = strlen(buffer); 337 344 } 338 345 else { 339 snprintf((buffer + len), (sizeof(buffer) - len), "No\n"); 340 len = strlen(buffer); 341 } 342 343 snprintf((buffer + len), (sizeof(buffer) - len), "is_online: %s\n", (is_online() ? "yes" : "no")); 344 len = strlen(buffer); 345 346 snprintf((buffer + len), (sizeof(buffer) - len), "is_auth_online: %s\n\n", (is_auth_online() ? "yes" : "no")); 346 snprintf((buffer + len), (sizeof(buffer) - len), "no\n"); 347 len = strlen(buffer); 348 } 349 350 snprintf((buffer + len), (sizeof(buffer) - len), "Internet Connectivity: %s\n", (is_online() ? "yes" : "no")); 351 len = strlen(buffer); 352 353 snprintf((buffer + len), (sizeof(buffer) - len), "Auth server reachable: %s\n", (is_auth_online() ? "yes" : "no")); 354 len = strlen(buffer); 355 356 snprintf((buffer + len), (sizeof(buffer) - len), "Clients served this session: %lu\n\n", served_this_session); 347 357 len = strlen(buffer); 348 358 … … 369 379 count = 0; 370 380 while (first != NULL) { 371 snprintf((buffer + len), (sizeof(buffer) - len), "Client %d\t" 372 "Ip: %s\tMac: %s\tToken: %s\n", count, 373 first->ip, first->mac, first->token); 374 len = strlen(buffer); 375 376 snprintf((buffer + len), (sizeof(buffer) - len), "\tIn: %llu\t" 377 "Out: %llu\n" , first->counters.incoming, 378 first->counters.outgoing); 381 snprintf((buffer + len), (sizeof(buffer) - len), "\nClient %d\n", count); 382 len = strlen(buffer); 383 384 snprintf((buffer + len), (sizeof(buffer) - len), " IP: %s MAC: %s\n", first->ip, first->mac); 385 len = strlen(buffer); 386 387 snprintf((buffer + len), (sizeof(buffer) - len), " Token: %s\n", first->token); 388 len = strlen(buffer); 389 390 snprintf((buffer + len), (sizeof(buffer) - len), " Downloaded: %llu\n Uploaded: %llu\n" , first->counters.incoming, first->counters.outgoing); 379 391 len = strlen(buffer); 380 392 trunk/wifidog/src/wdctl_thread.c
r765 r798 72 72 { 73 73 int sock, 74 fd, 75 len; 74 fd; 76 75 char *sock_name; 77 76 struct sockaddr_un sa_un; 78 77 int result; 79 78 pthread_t tid; 79 socklen_t len; 80 80 81 81 debug(LOG_DEBUG, "Starting wdctl."); … … 232 232 { 233 233 int sock, 234 fd, 235 len; 234 fd; 236 235 char *sock_name; 237 236 struct sockaddr_un sa_un; … … 242 241 pid_t pid; 243 242 ssize_t written; 243 socklen_t len; 244 244 245 245 conf = config_get_config();
