Changeset 13417
- Timestamp:
- 12/09/09 02:05:34 (3 years ago)
- Location:
- src/router/services/services
- Files:
-
- 1 added
- 11 edited
-
chillispot.c (modified) (7 diffs)
-
cron.c (modified) (1 diff)
-
hwmon.c (added)
-
l2tp.c (modified) (1 diff)
-
mmc.c (modified) (1 diff)
-
pppoe.c (modified) (4 diffs)
-
pptpclient.c (modified) (2 diffs)
-
services.c (modified) (5 diffs)
-
syslog.c (modified) (1 diff)
-
usb_hotplug.c (modified) (5 diffs)
-
vpn.c (modified) (2 diffs)
-
wifidog.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/router/services/services/chillispot.c
r13382 r13417 51 51 #ifdef HAVE_HOTSPOT 52 52 53 if (nvram_match("chilli_enable", "1") && nvram_match("chilli_def_enable", "0") 54 && !nvram_match("hotss_enable", "1")) { 53 if (nvram_match("chilli_enable", "1") 54 && nvram_match("chilli_def_enable", "0") 55 && !nvram_match("hotss_enable", "1")) { 55 56 nvram_set("chilli_enable", "0"); 56 57 return; 57 58 } 58 59 59 if (!nvram_match("chilli_enable", "1") && !nvram_match("hotss_enable", "1")) 60 return; 61 60 if (!nvram_match("chilli_enable", "1") 61 && !nvram_match("hotss_enable", "1")) 62 return; 63 62 64 if (nvram_match("hotss_enable", "1")) { 63 if (!nvram_match("chilli_enable", "1")) {64 nvram_set("chilli_enable", "1"); // to get care of firewall, network, etc.65 if (!nvram_match("chilli_enable", "1")) { 66 nvram_set("chilli_enable", "1"); // to get care of firewall, network, etc. 65 67 nvram_set("chilli_def_enable", "0"); 66 68 } 67 hotspotsys_config(); 68 } 69 else if (nvram_match("chilli_enable", "1")) { 70 nvram_unset("chilli_def_enable"); 71 chilli_config(); 72 } 73 69 hotspotsys_config(); 70 } else if (nvram_match("chilli_enable", "1")) { 71 nvram_unset("chilli_def_enable"); 72 chilli_config(); 73 } 74 74 #else 75 75 if (!nvram_match("chilli_enable", "1")) 76 76 return; 77 77 78 78 chilli_config(); 79 79 80 80 #endif 81 81 … … 105 105 FILE *fp; 106 106 int i; 107 107 108 108 #ifdef HAVE_CHILLILOCAL 109 109 … … 138 138 fprintf(fp, "radiusserver2 %s\n", nvram_get("chilli_backup")); 139 139 fprintf(fp, "radiussecret %s\n", nvram_get("chilli_pass")); 140 140 141 141 if (nvram_match("chilli_nowifibridge", "1")) 142 142 fprintf(fp, "dhcpif %s\n", nvram_safe_get("chilli_interface")); … … 214 214 fflush(fp); 215 215 fclose(fp); 216 217 return; 216 217 return; 218 218 } 219 220 219 221 220 #ifdef HAVE_HOTSPOT … … 229 228 int i; 230 229 231 232 230 if (!(fp = fopen("/tmp/chilli.conf", "w"))) { 233 231 perror("/tmp/chilli.conf"); … … 238 236 fprintf(fp, "radiusserver2 radius2.hotspotsystem.com\n"); 239 237 fprintf(fp, "radiussecret hotsys123\n"); 240 238 241 239 if (nvram_match("hotss_nowifibridge", "1")) 242 240 fprintf(fp, "dhcpif %s\n", nvram_safe_get("hotss_interface")); 243 241 else 244 242 fprintf(fp, "dhcpif br0\n"); 245 246 fprintf(fp, "uamserver https://www.hotspotsystem.com/customer/hotspotlogin.php\n"); 247 243 244 fprintf(fp, 245 "uamserver https://www.hotspotsystem.com/customer/hotspotlogin.php\n"); 246 248 247 if (nvram_invmatch("wan_get_dns", "0.0.0.0") 249 && nvram_invmatch("wan_get_dns", "")) { 250 dnslist = nvram_safe_get("wan_get_dns");251 i = 1;252 foreach(var, dnslist, next) {253 if (i > 2) break;254 fprintf(fp, "dns%d %s\n", i, var);255 i++;256 }257 }258 else if (nvram_invmatch("wan_dns", "0.0.0.0")259 && nvram_invmatch("wan_dns", "")) {260 dnslist = nvram_safe_get("wan_dns");261 i = 1;262 foreach(var, dnslist, next) {263 if (i > 2) break;264 fprintf(fp, "dns%d %s\n", i, var);265 i++;266 }267 }268 else if (nvram_invmatch("sv_localdns", "0.0.0.0")269 && nvram_invmatch("sv_localdns", "")) {270 fprintf(fp, "dns1 %s\n", nvram_get("sv_localdns"));248 && nvram_invmatch("wan_get_dns", "")) { 249 dnslist = nvram_safe_get("wan_get_dns"); 250 i = 1; 251 foreach(var, dnslist, next) { 252 if (i > 2) 253 break; 254 fprintf(fp, "dns%d %s\n", i, var); 255 i++; 256 } 257 } else if (nvram_invmatch("wan_dns", "0.0.0.0") 258 && nvram_invmatch("wan_dns", "")) { 259 dnslist = nvram_safe_get("wan_dns"); 260 i = 1; 261 foreach(var, dnslist, next) { 262 if (i > 2) 263 break; 264 fprintf(fp, "dns%d %s\n", i, var); 265 i++; 266 } 267 } else if (nvram_invmatch("sv_localdns", "0.0.0.0") 268 && nvram_invmatch("sv_localdns", "")) { 269 fprintf(fp, "dns1 %s\n", nvram_get("sv_localdns")); 271 270 } 272 271 273 272 fprintf(fp, "uamsecret hotsys123\n"); 274 273 fprintf(fp, "uamanydns\n"); 275 276 if (nvram_invmatch("hotss_uamallowed", "") && nvram_match("hotss_uamenable", "1")) 274 275 if (nvram_invmatch("hotss_uamallowed", "") 276 && nvram_match("hotss_uamenable", "1")) 277 277 fprintf(fp, "uamallowed %s\n", nvram_get("hotss_uamallowed")); 278 278 279 fprintf(fp, "radiusnasid %s_%s\n", nvram_get("hotss_operatorid"), nvram_get("hotss_locationid")); 280 281 fprintf(fp, "uamhomepage https://customer.hotspotsystem.com/customer/index.php?operator=%s&location=%s\n", nvram_get("hotss_operatorid"), nvram_get("hotss_locationid")); 279 fprintf(fp, "radiusnasid %s_%s\n", nvram_get("hotss_operatorid"), 280 nvram_get("hotss_locationid")); 281 282 fprintf(fp, 283 "uamhomepage https://customer.hotspotsystem.com/customer/index.php?operator=%s&location=%s\n", 284 nvram_get("hotss_operatorid"), nvram_get("hotss_locationid")); 282 285 fprintf(fp, "coaport 3799\n"); 283 286 fprintf(fp, "coanoipcheck\n"); 284 287 fprintf(fp, "domain key.chillispot.info\n"); 285 fprintf(fp, "uamallowed hotspotsystem.com,customer.hotspotsystem.com\n"); 286 fprintf(fp, "uamallowed 194.149.46.0/24,198.241.128.0/17,66.211.128.0/17,216.113.128.0/17\n"); 287 fprintf(fp, "uamallowed 70.42.128.0/17,128.242.125.0/24,216.52.17.0/24\n"); 288 fprintf(fp, "uamallowed 62.249.232.74,155.136.68.77,155.136.66.34,66.4.128.0/17,66.211.128.0/17,66.235.128.0/17\n"); 289 fprintf(fp, "uamallowed 88.221.136.146,195.228.254.149,195.228.254.152,203.211.140.157,203.211.150.204\n"); 288 fprintf(fp, 289 "uamallowed hotspotsystem.com,customer.hotspotsystem.com\n"); 290 fprintf(fp, 291 "uamallowed 194.149.46.0/24,198.241.128.0/17,66.211.128.0/17,216.113.128.0/17\n"); 292 fprintf(fp, 293 "uamallowed 70.42.128.0/17,128.242.125.0/24,216.52.17.0/24\n"); 294 fprintf(fp, 295 "uamallowed 62.249.232.74,155.136.68.77,155.136.66.34,66.4.128.0/17,66.211.128.0/17,66.235.128.0/17\n"); 296 fprintf(fp, 297 "uamallowed 88.221.136.146,195.228.254.149,195.228.254.152,203.211.140.157,203.211.150.204\n"); 290 298 fprintf(fp, "uamallowed www.paypal.com,www.paypalobjects.com\n"); 291 fprintf(fp, "uamallowed www.worldpay.com,select.worldpay.com,secure.ims.worldpay.com,www.rbsworldpay.com,secure.wp3.rbsworldpay.com\n"); 292 fprintf(fp, "uamallowed www.hotspotsystem.com,customer.hotspotsystem.com,tech.hotspotsystem.com\n"); 293 fprintf(fp, "uamallowed a1.hotspotsystem.com,a2.hotspotsystem.com,a3.hotspotsystem.com,a4.hotspotsystem.com,a5.hotspotsystem.com,a6.hotspotsystem.com\n"); 294 fprintf(fp, "uamallowed a7.hotspotsystem.com,a8.hotspotsystem.com,a9.hotspotsystem.com,a10.hotspotsystem.com\n"); 299 fprintf(fp, 300 "uamallowed www.worldpay.com,select.worldpay.com,secure.ims.worldpay.com,www.rbsworldpay.com,secure.wp3.rbsworldpay.com\n"); 301 fprintf(fp, 302 "uamallowed www.hotspotsystem.com,customer.hotspotsystem.com,tech.hotspotsystem.com\n"); 303 fprintf(fp, 304 "uamallowed a1.hotspotsystem.com,a2.hotspotsystem.com,a3.hotspotsystem.com,a4.hotspotsystem.com,a5.hotspotsystem.com,a6.hotspotsystem.com\n"); 305 fprintf(fp, 306 "uamallowed a7.hotspotsystem.com,a8.hotspotsystem.com,a9.hotspotsystem.com,a10.hotspotsystem.com\n"); 295 307 296 308 fprintf(fp, "interval 300\n"); … … 302 314 } 303 315 304 305 316 #endif /* HAVE_HOTSPOT */ 306 317 #endif /* HAVE_CHILLI */ -
src/router/services/services/cron.c
r13414 r13417 54 54 #include <syslog.h> 55 55 #include <services.h> 56 57 56 58 57 void start_cron(void) -
src/router/services/services/l2tp.c
r13414 r13417 54 54 #include <syslog.h> 55 55 #include <services.h> 56 57 56 58 57 #ifdef HAVE_L2TP -
src/router/services/services/mmc.c
r13233 r13417 95 95 sprintf(ddclk, "DDCLK=0x%X", 1 << mmc_clk); 96 96 sprintf(ddcs, "DDCS=0x%X", 1 << mmc_cs); 97 */ 97 */ 98 98 sprintf(dddi, "din=%d", mmc_di); 99 99 sprintf(dddo, "dout=%d", mmc_do); -
src/router/services/services/pppoe.c
r13414 r13417 60 60 #define sin_addr(s) (((struct sockaddr_in *)(s))->sin_addr) 61 61 62 63 62 // =========================================tallest============================================ 64 63 /* … … 142 141 return; 143 142 } 144 145 143 146 144 void start_pppoe(int pppoe_num) … … 265 263 return; 266 264 } 265 267 266 void stop_pppoe(void) 268 267 { … … 307 306 } 308 307 309 310 308 #endif 311 -
src/router/services/services/pptpclient.c
r13414 r13417 54 54 #include <syslog.h> 55 55 #include <services.h> 56 57 58 56 59 57 #ifdef HAVE_PPTP … … 293 291 294 292 #endif 295 -
src/router/services/services/services.c
r13414 r13417 60 60 #define TXPWR_DEFAULT 70 61 61 62 63 64 65 62 static int alreadyInHost(char *host) 66 63 { … … 106 103 } 107 104 108 109 105 /* 110 106 * AhMan March 18 2005 … … 239 235 } 240 236 241 242 243 244 237 #ifdef HAVE_IPV6 245 238 void start_ipv6(void) … … 284 277 285 278 // ===================================================================================================== 286 287 279 288 280 void stop_wland(void) … … 458 450 return; 459 451 } 460 461 #ifdef HAVE_CPUTEMP462 463 #ifdef HAVE_GATEWORX464 #define TEMP_PATH "/sys/devices/platform/IXP4XX-I2C.0/i2c-adapter:i2c-0/0-0028"465 // #define TEMP_PATH "/sys/devices/platform/IXP4XX-I2C.0/i2c-0/0-0028"466 #define TEMP_PREFIX "temp"467 #define TEMP_MUL 100468 #else469 #ifdef HAVE_X86470 #define TEMP_PATH "/sys/devices/platform/i2c-1/1-0048"471 #else472 #define TEMP_PATH "/sys/devices/platform/i2c-0/0-0048"473 #endif474 #define TEMP_PREFIX "temp1"475 #define TEMP_MUL 1000476 #endif477 478 void start_hwmon(void)479 {480 int temp_max = atoi(nvram_safe_get("hwmon_temp_max")) * TEMP_MUL;481 int temp_hyst = atoi(nvram_safe_get("hwmon_temp_hyst")) * TEMP_MUL;482 483 sysprintf("/bin/echo %d > %s/%s_max", temp_max, TEMP_PATH, TEMP_PREFIX);484 sysprintf("/bin/echo %d > %s/%s_max_hyst", temp_hyst, TEMP_PATH,485 TEMP_PREFIX);486 dd_syslog(LOG_INFO, "hwmon successfully started\n");487 }488 489 #endif -
src/router/services/services/syslog.c
r13414 r13417 55 55 #include <services.h> 56 56 57 58 57 #ifdef HAVE_SYSLOG 59 58 void start_syslog(void) -
src/router/services/services/usb_hotplug.c
r13304 r13417 30 30 int class, subclass, protocol; 31 31 32 33 32 if (!(nvram_match("usb_automnt", "1"))) 34 33 return; 35 36 34 37 35 if (!(action = getenv("ACTION")) || !(device = getenv("TYPE"))) … … 45 43 sscanf(interface, "%d/%d/%d", &class, &subclass, &protocol); 46 44 } 47 48 45 49 46 /* … … 131 128 int i, found = 0; 132 129 133 for (i = 1; i < 16; i++ ) {//it needs some time for disk to settle down and /dev/discs is created130 for (i = 1; i < 16; i++) { //it needs some time for disk to settle down and /dev/discs is created 134 131 if ((dir = opendir("/dev/discs")) != NULL) { 135 132 break; 136 } 137 else { 138 sleep (1); 139 } 140 } 141 if (i == 15) 142 return EINVAL; 133 } else { 134 sleep(1); 135 } 136 } 137 if (i == 15) 138 return EINVAL; 143 139 144 140 /* … … 146 142 */ 147 143 148 for (i = 1; i < 16; i++ ) {//it needs some time for disk to settle down and /dev/discs/discs%d is created144 for (i = 1; i < 16; i++) { //it needs some time for disk to settle down and /dev/discs/discs%d is created 149 145 while ((entry = readdir(dir)) != NULL) { 150 146 if ((strncmp(entry->d_name, "disc", 4))) … … 153 149 found = 1; 154 150 155 /*156 * Files created when the UFD is inserted are not removed when157 * it is removed. Verify the device is still inserted. Strip158 * the "disc" and pass the rest of the string.159 */160 161 if (usb_ufd_connected(entry->d_name + 4) == FALSE)162 continue;163 164 sprintf(path, "/dev/discs/%s/disc", entry->d_name);165 166 sysprintf("/usr/sbin/disktype %s > %s", path, DUMPFILE);167 168 /*169 * Check if it has file system170 */171 if ((fp = fopen(DUMPFILE, "r"))) {172 while (fgets(line, sizeof(line), fp) != NULL) {173 if (strstr(line, "Partition"))174 is_part = 1;175 176 if (strstr(line, "file system")) {177 if (strstr(line, "FAT")) {178 fs = "vfat";179 break;180 } else if (strstr(line, "Ext2")) {181 fs = "ext2";182 break;183 } else if (strstr(line, "Ext3")) {151 /* 152 * Files created when the UFD is inserted are not removed when 153 * it is removed. Verify the device is still inserted. Strip 154 * the "disc" and pass the rest of the string. 155 */ 156 157 if (usb_ufd_connected(entry->d_name + 4) == FALSE) 158 continue; 159 160 sprintf(path, "/dev/discs/%s/disc", entry->d_name); 161 162 sysprintf("/usr/sbin/disktype %s > %s", path, DUMPFILE); 163 164 /* 165 * Check if it has file system 166 */ 167 if ((fp = fopen(DUMPFILE, "r"))) { 168 while (fgets(line, sizeof(line), fp) != NULL) { 169 if (strstr(line, "Partition")) 170 is_part = 1; 171 172 if (strstr(line, "file system")) { 173 if (strstr(line, "FAT")) { 174 fs = "vfat"; 175 break; 176 } else if (strstr(line, "Ext2")) { 177 fs = "ext2"; 178 break; 179 } else if (strstr(line, "Ext3")) { 184 180 #ifdef HAVE_USB_ADVANCED 185 fs = "ext3";181 fs = "ext3"; 186 182 #else 187 fs = "ext2";183 fs = "ext2"; 188 184 #endif 189 break; 185 break; 186 } 190 187 } 188 191 189 } 192 193 } 194 fclose(fp); 195 } 196 197 if (fs) { 198 /* 199 * If it is partioned, mount first partition else raw disk 200 */ 201 if (is_part) { 202 partitions = 203 "part1 part2 part3 part4 part5 part6"; 204 foreach(part, partitions, next) { 205 sprintf(path, "/dev/discs/%s/%s", 206 entry->d_name, part); 207 if (stat(path, &tmp_stat)) 208 continue; 209 if (usb_process_path(path, fs) == 0) { 190 fclose(fp); 191 } 192 193 if (fs) { 194 /* 195 * If it is partioned, mount first partition else raw disk 196 */ 197 if (is_part) { 198 partitions = 199 "part1 part2 part3 part4 part5 part6"; 200 foreach(part, partitions, next) { 201 sprintf(path, 202 "/dev/discs/%s/%s", 203 entry->d_name, part); 204 if (stat(path, &tmp_stat)) 205 continue; 206 if (usb_process_path(path, fs) 207 == 0) { 208 is_mounted = 1; 209 break; 210 } 211 } 212 } else { 213 if (usb_process_path(path, fs) == 0) 210 214 is_mounted = 1; 211 break;212 }213 215 } 214 } else { 215 if (usb_process_path(path, fs) == 0) 216 is_mounted = 1; 217 } 218 219 } 220 221 if ((fp = fopen(DUMPFILE, "a"))) { 222 if (fs && is_mounted) 223 fprintf(fp, "Status: <b>Mounted on /%s</b>\n", 224 nvram_safe_get("usb_mntpoint")); 225 else if (fs) 226 fprintf(fp, "Status: <b>Not mounted</b>\n"); 227 else 228 fprintf(fp, 229 "Status: <b>Not mounted - Unsupported file system or disk not formated</b>\n"); 230 fclose(fp); 231 } 232 233 if (is_mounted && !nvram_match("usb_runonmount", "")) { 234 sprintf(path, "%s", nvram_safe_get("usb_runonmount")); 235 if (stat(path, &tmp_stat) == 0) //file exists 236 { 237 setenv("PATH", 238 "/sbin:/bin:/usr/sbin:/usr/bin:/jffs/sbin:/jffs/bin:/jffs/usr/sbin:/jffs/usr/bin:/mmc/sbin:/mmc/bin:/mmc/usr/sbin:/mmc/usr/bin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin", 239 1); 240 setenv("LD_LIBRARY_PATH", 241 "/lib:/usr/lib:/jffs/lib:/jffs/usr/lib:/mmc/lib:/mmc/usr/lib:/opt/lib:/opt/usr/lib", 242 1); 243 244 system(path); 245 } 246 } 247 248 if (is_mounted) { //temp. fix: only mount 1st mountable part, then exit 249 closedir (dir); 250 return 0; 251 } 252 } 253 if (!found) 254 sleep (1); 255 else 256 break; 257 } 258 closedir (dir); 216 217 } 218 219 if ((fp = fopen(DUMPFILE, "a"))) { 220 if (fs && is_mounted) 221 fprintf(fp, 222 "Status: <b>Mounted on /%s</b>\n", 223 nvram_safe_get("usb_mntpoint")); 224 else if (fs) 225 fprintf(fp, 226 "Status: <b>Not mounted</b>\n"); 227 else 228 fprintf(fp, 229 "Status: <b>Not mounted - Unsupported file system or disk not formated</b>\n"); 230 fclose(fp); 231 } 232 233 if (is_mounted && !nvram_match("usb_runonmount", "")) { 234 sprintf(path, "%s", 235 nvram_safe_get("usb_runonmount")); 236 if (stat(path, &tmp_stat) == 0) //file exists 237 { 238 setenv("PATH", 239 "/sbin:/bin:/usr/sbin:/usr/bin:/jffs/sbin:/jffs/bin:/jffs/usr/sbin:/jffs/usr/bin:/mmc/sbin:/mmc/bin:/mmc/usr/sbin:/mmc/usr/bin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin", 240 1); 241 setenv("LD_LIBRARY_PATH", 242 "/lib:/usr/lib:/jffs/lib:/jffs/usr/lib:/mmc/lib:/mmc/usr/lib:/opt/lib:/opt/usr/lib", 243 1); 244 245 system(path); 246 } 247 } 248 249 if (is_mounted) { //temp. fix: only mount 1st mountable part, then exit 250 closedir(dir); 251 return 0; 252 } 253 } 254 if (!found) 255 sleep(1); 256 else 257 break; 258 } 259 closedir(dir); 259 260 return 0; 260 261 } -
src/router/services/services/vpn.c
r13414 r13417 54 54 #include <syslog.h> 55 55 #include <services.h> 56 57 56 58 57 void start_vpn_modules(void) … … 117 116 #endif 118 117 } 119 -
src/router/services/services/wifidog.c
r13133 r13417 62 62 fprintf(fp, "HTTPPort %s\n", nvram_safe_get("wd_httpport")); 63 63 if (strlen(nvram_safe_get("wd_messagefile")) > 0) { 64 fprintf(fp, "HtmlMessageFile %s\n", nvram_safe_get("wd_messagefile")); 64 fprintf(fp, "HtmlMessageFile %s\n", 65 nvram_safe_get("wd_messagefile")); 65 66 } 66 if (nvram_match("wd_auth","1")) 67 { 68 if (strlen(nvram_safe_get("wd_realm")) > 0) 69 fprintf(fp, "HTTPDRealm %s\n", nvram_safe_get("wd_realm")); 70 fprintf(fp, "HTTPDUserName %s\n", nvram_safe_get("wd_username")); 71 fprintf(fp, "HTTPDPassword %s\n", nvram_safe_get("wd_password")); 72 } 67 if (nvram_match("wd_auth", "1")) { 68 if (strlen(nvram_safe_get("wd_realm")) > 0) 69 fprintf(fp, "HTTPDRealm %s\n", 70 nvram_safe_get("wd_realm")); 71 fprintf(fp, "HTTPDUserName %s\n", 72 nvram_safe_get("wd_username")); 73 fprintf(fp, "HTTPDPassword %s\n", 74 nvram_safe_get("wd_password")); 75 } 73 76 fprintf(fp, "Path %s\n", nvram_safe_get("wd_path")); 74 77 fprintf(fp, "}\n");
Note: See TracChangeset
for help on using the changeset viewer.
