4 Copyright (C) 2006-2010 Jonathan Zarate
10 #include <sys/sysinfo.h>
12 #include <sys/types.h>
13 #include <sys/socket.h>
14 #include <arpa/inet.h>
18 // #define DEBUG_NOEXECSERVICE
19 #define DEBUG_NVRAMSET(k, v) _dprintf("nvram set %s=%s\n", k, v);
22 char *post_buf
= NULL
;
26 static void asp_css(int argc
, char **argv
);
27 static void asp_resmsg(int argc
, char **argv
);
30 static void wo_tomato(char *url
);
31 static void wo_update(char *url
);
32 static void wo_service(char *url
);
33 static void wo_shutdown(char *url
);
34 static void wo_nvcommit(char *url
);
35 // static void wo_logout(char *url);
38 // ----------------------------------------------------------------------------
41 void exec_service(const char *action
)
45 _dprintf("exec_service: %s\n", action
);
48 while ((!nvram_match("action_service", "")) && (i
-- > 0)) {
49 _dprintf("%s: waiting before %d\n", __FUNCTION__
, i
);
53 nvram_set("action_service", action
);
57 while ((nvram_match("action_service", (char *)action
)) && (i
-- > 0)) {
58 _dprintf("%s: waiting after %d\n", __FUNCTION__
, i
);
63 if (atoi(webcgi_safeget("_service_wait", ""))) {
65 while ((nvram_match("action_service", (char *)action)) && (i-- > 0)) {
66 _dprintf("%s: waiting after %d\n", __FUNCTION__, i);
73 static void wi_generic_noid(char *url
, int len
, char *boundary
)
76 if (len
>= (32 * 1024)) {
77 // syslog(LOG_WARNING, "POST max");
81 if (post_buf
) free(post_buf
);
82 if ((post_buf
= malloc(len
+ 1)) == NULL
) {
83 // syslog(LOG_CRIT, "Unable to allocate post buffer");
87 if (web_read_x(post_buf
, len
) != len
) {
91 webcgi_init(post_buf
);
95 void wi_generic(char *url
, int len
, char *boundary
)
97 wi_generic_noid(url
, len
, boundary
);
101 // !!TB - CGI Support
102 void wi_cgi_bin(char *url
, int len
, char *boundary
)
104 if (post_buf
) free(post_buf
);
108 if (len
>= (128 * 1024)) {
109 syslog(LOG_WARNING
, "POST length exceeded maximum allowed");
114 if ((post_buf
= malloc(len
+ 1)) == NULL
) {
117 if (web_read_x(post_buf
, len
) != len
) {
125 static void _execute_command(char *url
, char *command
, char *query
, wofilter_t wof
)
127 char webExecFile
[] = "/tmp/.wxXXXXXX";
128 char webQueryFile
[] = "/tmp/.wqXXXXXX";
129 char cmd
[sizeof(webExecFile
) + 10];
133 if ((fe
= mkstemp(webExecFile
)) < 0)
136 if ((fq
= mkstemp(webQueryFile
)) < 0) {
143 if ((f
= fdopen(fe
, "wb")) != NULL
) {
146 "export REQUEST_METHOD=\"%s\"\n"
150 post
? "POST" : "GET", getenv("PATH"),
151 command
? "" : "./", command
? command
: url
,
152 query
? "<" : "", query
? webQueryFile
: "");
160 unlink(webQueryFile
);
164 chmod(webExecFile
, 0700);
167 if ((f
= fdopen(fq
, "wb")) != NULL
) {
168 fprintf(f
, "%s\n", query
);
174 unlink(webQueryFile
);
179 sprintf(cmd
, "%s 2>&1", webExecFile
);
180 web_pipecmd(cmd
, wof
);
181 unlink(webQueryFile
);
185 static void wo_cgi_bin(char *url
)
187 if (!header_sent
) send_header(200, NULL
, mime_html
, 0);
188 _execute_command(url
, NULL
, post_buf
, WOF_NONE
);
195 static void wo_shell(char *url
)
197 web_puts("\ncmdresult = '");
198 _execute_command(NULL
, webcgi_get("command"), NULL
, WOF_JAVASCRIPT
);
202 static void wo_blank(char *url
)
204 web_puts("\n\n\n\n");
207 static void wo_cfe(char *url
)
209 do_file(MTD_DEV(0ro
));
212 static void wo_nvram(char *url
)
214 web_pipecmd("nvram show", WOF_NONE
);
217 static void wo_iptables(char *url
)
219 web_pipecmd("iptables -nvL; echo; iptables -t nat -nvL; echo; iptables -t mangle -nvL", WOF_NONE
);
223 static void wo_ip6tables(char *url
)
225 web_pipecmd("ip6tables -nvL; echo; ip6tables -t mangle -nvL", WOF_NONE
);
230 static void wo_spin(char *url)
234 strlcpy(s, nvram_safe_get("web_css"), sizeof(s));
235 strlcat(s, "_spin.gif", sizeof(s));
236 if (f_exists(s)) do_file(s);
237 else do_file("_spin.gif");
241 void common_redirect(void)
243 if (atoi(webcgi_safeget("_ajax", ""))) {
244 send_header(200, NULL
, mime_html
, 0);
248 redirect(webcgi_safeget("_redirect", "/"));
252 // ----------------------------------------------------------------------------
254 const struct mime_handler mime_handlers
[] = {
255 { "update.cgi", mime_javascript
, 0, wi_generic
, wo_update
, 1 },
256 { "tomato.cgi", NULL
, 0, wi_generic
, wo_tomato
, 1 },
258 { "debug.js", mime_javascript
, 12, wi_generic_noid
, wo_blank
, 1 }, // while debugging
259 { "cfe/*.bin", mime_binary
, 0, wi_generic
, wo_cfe
, 1 },
260 { "nvram/*.txt", mime_binary
, 0, wi_generic
, wo_nvram
, 1 },
261 { "ipt/*.txt", mime_binary
, 0, wi_generic
, wo_iptables
, 1 },
263 { "ip6t/*.txt", mime_binary
, 0, wi_generic
, wo_ip6tables
, 1 },
265 { "cfg/*.cfg", NULL
, 0, wi_generic
, wo_backup
, 1 },
266 { "cfg/restore.cgi", mime_html
, 0, wi_restore
, wo_restore
, 1 },
267 { "cfg/defaults.cgi", NULL
, 0, wi_generic
, wo_defaults
, 1 },
269 { "bwm/*.gz", NULL
, 0, wi_generic
, wo_bwmbackup
, 1 },
270 { "bwm/restore.cgi", NULL
, 0, wi_bwmrestore
, wo_bwmrestore
, 1 },
272 { "ipt/*.gz", NULL
, 0, wi_generic
, wo_iptbackup
, 1 },
273 { "ipt/restore.cgi", NULL
, 0, wi_iptrestore
, wo_iptrestore
, 1 },
275 { "logs/view.cgi", NULL
, 0, wi_generic
, wo_viewlog
, 1 },
276 { "logs/*.txt", NULL
, 0, wi_generic
, wo_syslog
, 1 },
277 { "webmon_**", NULL
, 0, wi_generic
, wo_syslog
, 1 },
279 { "logout.asp", NULL
, 0, wi_generic
, wo_asp
, 1 },
280 { "clearcookies.asp", NULL
, 0, wi_generic
, wo_asp
, 1 },
282 // { "spin.gif", NULL, 0, wi_generic_noid, wo_spin, 1 },
284 { "**.asp", NULL
, 0, wi_generic_noid
, wo_asp
, 1 },
285 { "**.css", "text/css", 12, wi_generic_noid
, do_file
, 1 },
286 { "**.htm|**.html", mime_html
, 2, wi_generic_noid
, do_file
, 1 },
287 { "**.gif", "image/gif", 12, wi_generic_noid
, do_file
, 1 },
288 { "**.jpg", "image/jpeg", 12, wi_generic_noid
, do_file
, 1 },
289 { "**.png", "image/png", 12, wi_generic_noid
, do_file
, 1 },
290 { "**.js", mime_javascript
, 12, wi_generic_noid
, do_file
, 1 },
291 { "**.jsx", mime_javascript
, 0, wi_generic
, wo_asp
, 1 },
292 { "**.svg", "image/svg+xml", 12, wi_generic_noid
, do_file
, 1 },
293 { "**.txt", mime_plain
, 2, wi_generic_noid
, do_file
, 1 },
294 { "**.bin", mime_binary
, 0, wi_generic_noid
, do_file
, 1 },
295 { "**.bino", mime_octetstream
, 0, wi_generic_noid
, do_file
, 1 },
296 { "favicon.ico", "image/x-icon", 24, wi_generic_noid
, do_file
, 1 },
297 // !!TB - CGI Support, enable downloading archives
298 { "**/cgi-bin/**|**.sh", NULL
, 0, wi_cgi_bin
, wo_cgi_bin
, 1 },
299 { "**.tar|**.gz", mime_binary
, 0, wi_generic_noid
, do_file
, 1 },
300 { "shell.cgi", mime_javascript
, 0, wi_generic
, wo_shell
, 1 },
301 { "wpad.dat|proxy.pac", "application/x-ns-proxy-autoconfig", 0, wi_generic_noid
, do_file
, 0 },
303 { "webmon.cgi", mime_javascript
, 0, wi_generic
, wo_webmon
, 1 },
304 { "dhcpc.cgi", NULL
, 0, wi_generic
, wo_dhcpc
, 1 },
305 { "dhcpd.cgi", mime_javascript
, 0, wi_generic
, wo_dhcpd
, 1 },
306 { "nvcommit.cgi", NULL
, 0, wi_generic
, wo_nvcommit
, 1 },
307 { "ping.cgi", mime_javascript
, 0, wi_generic
, wo_ping
, 1 },
308 { "trace.cgi", mime_javascript
, 0, wi_generic
, wo_trace
, 1 },
309 { "upgrade.cgi", mime_html
, 0, wi_upgrade
, wo_flash
, 1 },
310 { "upnp.cgi", NULL
, 0, wi_generic
, wo_upnp
, 1 },
311 { "wakeup.cgi", NULL
, 0, wi_generic
, wo_wakeup
, 1 },
312 { "wlmnoise.cgi", mime_html
, 0, wi_generic
, wo_wlmnoise
, 1 },
313 { "wlradio.cgi", NULL
, 0, wi_generic
, wo_wlradio
, 1 },
314 { "resolve.cgi", mime_javascript
, 0, wi_generic
, wo_resolve
, 1 },
315 { "expct.cgi", mime_html
, 0, wi_generic
, wo_expct
, 1 },
316 { "service.cgi", NULL
, 0, wi_generic
, wo_service
, 1 },
317 // { "logout.cgi", NULL, 0, wi_generic, wo_logout, 0 },
319 { "shutdown.cgi", mime_html
, 0, wi_generic
, wo_shutdown
, 1 },
320 #ifdef TCONFIG_OPENVPN
321 { "vpnstatus.cgi", mime_javascript
, 0, wi_generic
, wo_vpn_status
, 1 },
324 { "pptpd.cgi", mime_javascript
, 0, wi_generic
, wo_pptpdcmd
, 1 }, //!!AB - PPTPD
327 { "usbcmd.cgi", mime_javascript
, 0, wi_generic
, wo_usbcommand
, 1 }, //!!TB - USB
330 { "blackhole.cgi", NULL
, 0, wi_blackhole
, NULL
, 1 },
333 { "uploadsplash.cgi", NULL
, 0, wi_uploadsplash
, wo_uploadsplash
, 1 },
334 { "ext/uploadsplash.cgi", NULL
, 0, wi_uploadsplash
, wo_uploadsplash
, 1 },
336 { NULL
, NULL
, 0, NULL
, NULL
, 1 }
339 const aspapi_t aspapi
[] = {
340 { "activeroutes", asp_activeroutes
},
341 { "arplist", asp_arplist
},
342 { "bandwidth", asp_bandwidth
},
343 { "build_time", asp_build_time
},
344 { "cgi_get", asp_cgi_get
},
345 { "compmac", asp_compmac
},
346 { "ctcount", asp_ctcount
},
347 { "ctdump", asp_ctdump
},
348 { "ctrate", asp_ctrate
},
349 { "ddnsx", asp_ddnsx
},
350 { "devlist", asp_devlist
},
351 { "webmon", asp_webmon
},
352 { "dhcpc_time", asp_dhcpc_time
},
354 { "ident", asp_ident
},
355 { "lanip", asp_lanip
},
356 { "layer7", asp_layer7
},
357 { "link_uptime", asp_link_uptime
},
358 { "lipp", asp_lipp
},
359 { "netdev", asp_netdev
},
361 { "iptraffic", asp_iptraffic
},
362 { "iptmon", asp_iptmon
},
363 { "ipt_bandwidth", asp_ipt_bandwidth
},
365 { "notice", asp_notice
},
367 { "nvram", asp_nvram
},
368 { "nvramseq", asp_nvramseq
},
369 { "nvstat", asp_nvstat
},
370 { "psup", asp_psup
},
371 { "qrate", asp_qrate
},
372 { "resmsg", asp_resmsg
},
373 { "rrule", asp_rrule
},
374 { "statfs", asp_statfs
},
375 { "sysinfo", asp_sysinfo
},
376 { "time", asp_time
},
377 { "upnpinfo", asp_upnpinfo
},
378 { "version", asp_version
},
379 { "wanstatus", asp_wanstatus
},
380 { "wanup", asp_wanup
},
382 { "pptpd_userol", asp_pptpd_userol
},
384 { "wlstats", asp_wlstats
},
385 { "wlclient", asp_wlclient
},
386 { "wlnoise", asp_wlnoise
},
387 { "wlscan", asp_wlscan
},
388 { "wlchannels", asp_wlchannels
}, //!!TB
389 { "wlcountries", asp_wlcountries
},
390 { "wlifaces", asp_wlifaces
},
391 { "wlbands", asp_wlbands
},
393 { "usbdevices", asp_usbdevices
}, //!!TB - USB Support
396 { "mmcid", asp_mmcid
}, //MMC Support
398 { "etherstates", asp_etherstates
}, //Ethernet States
399 { "anonupdate", asp_anonupdate
}, //Tomato update notification system
401 { "calc6rdlocalprefix", asp_calc6rdlocalprefix
},
408 // -----------------------------------------------------------------------------
410 static void asp_css(int argc
, char **argv
)
412 const char *css
= nvram_safe_get("web_css");
413 const char *ttb
= nvram_safe_get("ttb_css");
415 if( nvram_match( "web_css", "online" ) ) {
416 web_printf("<link rel='stylesheet' type='text/css' href='ext/%s.css'>", ttb
);
418 if (strcmp(css
, "tomato") != 0) {
419 web_printf("<link rel='stylesheet' type='text/css' href='%s.css'>", css
);
424 // -----------------------------------------------------------------------------
426 const char *resmsg_get(void)
428 return webcgi_safeget("resmsg", "");
431 void resmsg_set(const char *msg
)
433 webcgi_set("resmsg", strdup(msg
)); // m ok
436 int resmsg_fread(const char *fname
)
441 f_read_string(fname
, s
, sizeof(s
));
442 if ((p
= strchr(s
, '\n')) != NULL
) *p
= 0;
450 static void asp_resmsg(int argc
, char **argv
)
454 if ((p
= js_string(webcgi_safeget("resmsg", (argc
> 0) ? argv
[0] : ""))) == NULL
) return;
455 web_printf("\nresmsg='%s';\n", p
);
459 // ----------------------------------------------------------------------------
461 // verification... simple sanity checks. UI should verify all fields.
463 // todo: move and re-use for filtering - zzz
474 VT_NONE
, // no checking
475 VT_LENGTH
, // check length of string
476 VT_TEXT
, // strip \r, check length of string
477 VT_RANGE
, // expect an integer, check range
478 VT_IP
, // expect an ip address
479 VT_MAC
, // expect a mac address
481 VT_IPV6
, // expect an ipv6 address
483 VT_TEMP
// no checks, no commit
490 #define V_NONE VT_NONE, { }, { }
491 #define V_01 VT_RANGE, { .l = 0 }, { .l = 1 }
492 #define V_PORT VT_RANGE, { .l = 2 }, { .l = 65535 }
493 #define V_ONOFF VT_LENGTH, { .i = 2 }, { .i = 3 }
494 #define V_WORD VT_LENGTH, { .i = 1 }, { .i = 16 }
495 #define V_LENGTH(min, max) VT_LENGTH, { .i = min }, { .i = max }
496 #define V_TEXT(min, max) VT_TEXT, { .i = min }, { .i = max }
497 #define V_RANGE(min, max) VT_RANGE, { .l = min }, { .l = max }
498 #define V_IP VT_IP, { }, { }
499 #define V_OCTET VT_RANGE, { .l = 0 }, { .l = 255 }
500 #define V_NUM VT_RANGE, { .l = 0 }, { .l = 0x7FFFFFFF }
501 #define V_TEMP VT_TEMP, { }, { }
503 #define V_IPV6(required) VT_IPV6, { .i = required }, { }
506 static const nvset_t nvset_list
[] = {
509 { "router_name", V_LENGTH(0, 32) },
510 { "wan_hostname", V_LENGTH(0, 32) },
511 { "wan_domain", V_LENGTH(0, 32) },
514 { "tm_tz", V_LENGTH(1, 64) }, // PST8PDT
515 { "tm_sel", V_LENGTH(1, 64) }, // PST8PDT
517 { "ntp_updates", V_RANGE(-1, 24) },
518 { "ntp_tdod", V_01
},
519 { "ntp_server", V_LENGTH(1, 150) }, // x y z
520 { "ntp_kiss", V_LENGTH(0, 255) },
523 { "dhcpd_static", V_LENGTH(0, 108*251) }, // 108 (max chars per entry) x 250 entries
524 { "dhcpd_static_only", V_01
},
527 { "ddnsx0", V_LENGTH(0, 2048) },
528 { "ddnsx1", V_LENGTH(0, 2048) },
529 { "ddnsx0_cache", V_LENGTH(0, 1) }, // only to clear
530 { "ddnsx1_cache", V_LENGTH(0, 1) },
531 { "ddnsx_ip", V_LENGTH(0, 32) },
532 { "ddnsx_save", V_01
},
533 { "ddnsx_refresh", V_RANGE(0, 365) },
537 { "wan_proto", V_LENGTH(1, 16) }, // disabled, dhcp, static, pppoe, pptp, l2tp
538 { "wan_ipaddr", V_IP
},
539 { "wan_netmask", V_IP
},
540 { "wan_gateway", V_IP
},
541 { "hb_server_ip", V_LENGTH(0, 32) },
542 { "wan_l2tp_server_ip", V_LENGTH(0, 128) },
543 { "wan_pptp_server_ip", V_LENGTH(0, 128) },
544 { "wan_pptp_dhcp", V_01
},
545 { "wan_ppp_username", V_LENGTH(0, 60) },
546 { "wan_ppp_passwd", V_LENGTH(0, 60) },
547 { "wan_ppp_service", V_LENGTH(0, 50) },
548 { "wan_ppp_demand", V_01
},
549 { "wan_ppp_custom", V_LENGTH(0, 256) },
550 { "wan_ppp_idletime", V_RANGE(0, 1440) },
551 { "wan_ppp_redialperiod", V_RANGE(1, 86400) },
552 { "wan_ppp_mlppp", V_01
},
553 { "wan_mtu_enable", V_01
},
554 { "wan_mtu", V_RANGE(576, 1500) },
555 { "wan_islan", V_01
},
556 { "wan_modem_ipaddr", V_IP
},
557 { "wan_pppoe_lei", V_RANGE(1, 60) },
558 { "wan_pppoe_lef", V_RANGE(1, 10) },
559 { "wan_sta", V_LENGTH(0, 10) },
560 { "wan_dns", V_LENGTH(0, 50) }, // ip ip ip
561 { "wan_ckmtd", V_LENGTH(1, 2) }, // check method: 1 - ping, 2 - traceroute
563 #ifdef TCONFIG_MULTIWAN
564 { "mwan_num", V_RANGE(1, 4) },
566 { "mwan_num", V_RANGE(1, 2) },
568 { "mwan_init", V_01
},
569 { "mwan_cktime", V_RANGE(0, 3600) },
570 { "mwan_ckdst", V_LENGTH(0, 64) },
571 { "pbr_rules", V_LENGTH(0, 2048) },
573 { "wan_weight", V_RANGE(0, 256) },
574 { "wan_dns_auto", V_01
},
576 { "wan2_proto", V_LENGTH(1, 16) }, // disabled, dhcp, static, pppoe, pptp, l2tp
577 { "wan2_weight", V_RANGE(0, 256) },
578 { "wan2_ipaddr", V_IP
},
579 { "wan2_netmask", V_IP
},
580 { "wan2_gateway", V_IP
},
581 { "wan2_l2tp_server_ip", V_LENGTH(0, 128) },
582 { "wan2_pptp_server_ip", V_LENGTH(0, 128) },
583 { "wan2_pptp_dhcp", V_01
},
584 { "wan2_ppp_username", V_LENGTH(0, 60) },
585 { "wan2_ppp_passwd", V_LENGTH(0, 60) },
586 { "wan2_ppp_service", V_LENGTH(0, 50) },
587 { "wan2_ppp_demand", V_01
},
588 { "wan2_ppp_custom", V_LENGTH(0, 256) },
589 { "wan2_ppp_idletime", V_RANGE(0, 1440) },
590 { "wan2_ppp_redialperiod", V_RANGE(1, 86400) },
591 { "wan2_ppp_mlppp", V_01
},
592 { "wan2_mtu_enable", V_01
},
593 { "wan2_mtu", V_RANGE(576, 1500) },
594 { "wan2_islan", V_01
},
595 { "wan2_modem_ipaddr", V_IP
},
596 { "wan2_pppoe_lei", V_RANGE(1, 60) },
597 { "wan2_pppoe_lef", V_RANGE(1, 10) },
598 { "wan2_sta", V_LENGTH(0, 10) },
599 { "wan2_dns", V_LENGTH(0, 50) }, // ip ip ip
600 { "wan2_dns_auto", V_01
},
601 { "wan2_ckmtd", V_LENGTH(1, 2) }, // check method: 1 - ping, 2 - traceroute
603 #ifdef TCONFIG_MULTIWAN
604 { "wan3_proto", V_LENGTH(1, 16) }, // disabled, dhcp, static, pppoe, pptp, l2tp
605 { "wan3_weight", V_RANGE(0, 256) },
606 { "wan3_ipaddr", V_IP
},
607 { "wan3_netmask", V_IP
},
608 { "wan3_gateway", V_IP
},
609 { "wan3_l2tp_server_ip", V_LENGTH(0, 128) },
610 { "wan3_pptp_server_ip", V_LENGTH(0, 128) },
611 { "wan3_pptp_dhcp", V_01
},
612 { "wan3_ppp_username", V_LENGTH(0, 60) },
613 { "wan3_ppp_passwd", V_LENGTH(0, 60) },
614 { "wan3_ppp_service", V_LENGTH(0, 50) },
615 { "wan3_ppp_demand", V_01
},
616 { "wan3_ppp_custom", V_LENGTH(0, 256) },
617 { "wan3_ppp_idletime", V_RANGE(0, 1440) },
618 { "wan3_ppp_redialperiod", V_RANGE(1, 86400) },
619 { "wan3_ppp_mlppp", V_01
},
620 { "wan3_mtu_enable", V_01
},
621 { "wan3_mtu", V_RANGE(576, 1500) },
622 { "wan3_islan", V_01
},
623 { "wan3_modem_ipaddr", V_IP
},
624 { "wan3_pppoe_lei", V_RANGE(1, 60) },
625 { "wan3_pppoe_lef", V_RANGE(1, 10) },
626 { "wan3_sta", V_LENGTH(0, 10) },
627 { "wan3_dns", V_LENGTH(0, 50) }, // ip ip ip
628 { "wan3_dns_auto", V_01
},
629 { "wan3_ckmtd", V_LENGTH(1, 2) }, // check method: 1 - ping, 2 - traceroute
631 { "wan4_proto", V_LENGTH(1, 16) }, // disabled, dhcp, static, pppoe, pptp, l2tp
632 { "wan4_weight", V_RANGE(0, 256) },
633 { "wan4_ipaddr", V_IP
},
634 { "wan4_netmask", V_IP
},
635 { "wan4_gateway", V_IP
},
636 { "wan4_l2tp_server_ip", V_LENGTH(0, 128) },
637 { "wan4_pptp_server_ip", V_LENGTH(0, 128) },
638 { "wan4_pptp_dhcp", V_01
},
639 { "wan4_ppp_username", V_LENGTH(0, 60) },
640 { "wan4_ppp_passwd", V_LENGTH(0, 60) },
641 { "wan4_ppp_service", V_LENGTH(0, 50) },
642 { "wan4_ppp_demand", V_01
},
643 { "wan4_ppp_custom", V_LENGTH(0, 256) },
644 { "wan4_ppp_idletime", V_RANGE(0, 1440) },
645 { "wan4_ppp_redialperiod", V_RANGE(1, 86400) },
646 { "wan4_ppp_mlppp", V_01
},
647 { "wan4_mtu_enable", V_01
},
648 { "wan4_mtu", V_RANGE(576, 1500) },
649 { "wan4_islan", V_01
},
650 { "wan4_modem_ipaddr", V_IP
},
651 { "wan4_pppoe_lei", V_RANGE(1, 60) },
652 { "wan4_pppoe_lef", V_RANGE(1, 10) },
653 { "wan4_sta", V_LENGTH(0, 10) },
654 { "wan4_dns", V_LENGTH(0, 50) }, // ip ip ip
655 { "wan4_dns_auto", V_01
},
656 { "wan4_ckmtd", V_LENGTH(1, 2) }, // check method: 1 - ping, 2 - traceroute
660 { "lan_ipaddr", V_IP
},
661 { "lan_netmask", V_IP
},
662 { "lan_gateway", V_IP
},
663 { "lan_dns", V_LENGTH(0, 50) }, // ip ip ip
665 #ifdef TCONFIG_DNSSEC
666 { "dnssec_enable", V_01
},
669 #ifdef TCONFIG_DNSCRYPT
670 { "dnscrypt_proxy", V_01
},
671 { "dnscrypt_priority", V_RANGE(0, 2) }, // 0=none, 1=preferred, 2=exclusive
672 { "dnscrypt_port", V_PORT
},
673 { "dnscrypt_resolver", V_LENGTH(0, 40) },
674 { "dnscrypt_log", V_RANGE(0, 99) },
675 { "dnscrypt_manual", V_01
},
676 { "dnscrypt_provider_name", V_LENGTH(0, 60) },
677 { "dnscrypt_provider_key", V_LENGTH(0, 80) },
678 { "dnscrypt_resolver_address", V_LENGTH(0, 50) },
680 { "lan_state", V_01
},
681 { "lan_desc", V_01
},
682 { "lan_invert", V_01
},
683 { "lan_proto", V_WORD
}, // static, dhcp
684 { "dhcp_start", V_LENGTH(0, 15) }, // remove !
685 { "dhcp_num", V_LENGTH(0, 4) }, // remove !
686 { "dhcpd_startip", V_LENGTH(0, 15) },
687 { "dhcpd_endip", V_LENGTH(0, 15) },
688 { "dhcp_lease", V_LENGTH(0, 5) },
689 { "wan_wins", V_IP
},
693 { "wan_modem_pin", V_LENGTH(0,6) },
694 { "wan_modem_dev", V_LENGTH(0,8) },
695 { "wan_modem_init", V_LENGTH(0,25) },
696 { "wan_modem_apn", V_LENGTH(0,25) },
697 { "wan_modem_speed", V_LENGTH(0,6) },
699 { "wan2_modem_pin", V_LENGTH(0,6) },
700 { "wan2_modem_dev", V_LENGTH(0,8) },
701 { "wan2_modem_init", V_LENGTH(0,25) },
702 { "wan2_modem_apn", V_LENGTH(0,25) },
703 { "wan2_modem_speed", V_LENGTH(0,6) },
705 #ifdef TCONFIG_MULTIWAN
706 { "wan3_modem_pin", V_LENGTH(0,6) },
707 { "wan3_modem_dev", V_LENGTH(0,8) },
708 { "wan3_modem_init", V_LENGTH(0,25) },
709 { "wan3_modem_apn", V_LENGTH(0,25) },
710 { "wan3_modem_speed", V_LENGTH(0,6) },
712 { "wan4_modem_pin", V_LENGTH(0,6) },
713 { "wan4_modem_dev", V_LENGTH(0,8) },
714 { "wan4_modem_init", V_LENGTH(0,25) },
715 { "wan4_modem_apn", V_LENGTH(0,25) },
716 { "wan4_modem_speed", V_LENGTH(0,6) },
721 { "lan_ifname", V_LENGTH(0, 5) },
723 { "lan1_ifname", V_LENGTH(0, 5) },
724 { "lan1_ifnames", V_TEXT(0,64) },
725 { "lan1_ipaddr", V_LENGTH(0, 15) },
726 { "lan1_netmask", V_LENGTH(0, 15) },
727 { "lan1_proto", V_LENGTH(0, 6) },
728 { "lan1_stp", V_LENGTH(0, 1) },
729 { "dhcp1_start", V_LENGTH(0, 15) },
730 { "dhcp1_num", V_LENGTH(0, 4) },
731 { "dhcpd1_startip", V_LENGTH(0, 15) },
732 { "dhcpd1_endip", V_LENGTH(0, 15) },
733 { "dhcp1_lease", V_LENGTH(0, 5) },
735 { "lan2_ifname", V_LENGTH(0, 5) },
736 { "lan2_ifnames", V_TEXT(0,64) },
737 { "lan2_ipaddr", V_LENGTH(0, 15) },
738 { "lan2_netmask", V_LENGTH(0, 15) },
739 { "lan2_proto", V_LENGTH(0, 6) },
740 { "lan2_stp", V_LENGTH(0, 1) },
741 { "dhcp2_start", V_LENGTH(0, 15) },
742 { "dhcp2_num", V_LENGTH(0, 4) },
743 { "dhcpd2_startip", V_LENGTH(0, 15) },
744 { "dhcpd2_endip", V_LENGTH(0, 15) },
745 { "dhcp2_lease", V_LENGTH(0, 5) },
747 { "lan3_ifname", V_LENGTH(0, 5) },
748 { "lan3_ifnames", V_TEXT(0,64) },
749 { "lan3_ipaddr", V_LENGTH(0, 15) },
750 { "lan3_netmask", V_LENGTH(0, 15) },
751 { "lan3_proto", V_LENGTH(0, 6) },
752 { "lan3_stp", V_LENGTH(0, 1) },
753 { "dhcp3_start", V_LENGTH(0, 15) },
754 { "dhcp3_num", V_LENGTH(0, 4) },
755 { "dhcpd3_startip", V_LENGTH(0, 15) },
756 { "dhcpd3_endip", V_LENGTH(0, 15) },
757 { "dhcp3_lease", V_LENGTH(0, 5) },
760 { "wl_radio", V_01
},
761 { "wl_mode", V_LENGTH(2, 3) }, // ap, sta, wet, wds
762 { "wl_net_mode", V_LENGTH(5, 8) }, // disabled, mixed, b-only, g-only, bg-mixed, n-only [speedbooster]
763 { "wl_ssid", V_LENGTH(1, 32) },
764 { "wl_closed", V_01
},
765 { "wl_channel", V_RANGE(0, 216) },
767 { "wl_vifs", V_LENGTH(0, 64) }, // multiple/virtual BSSIDs
769 { "nas_alternate", V_01
}, // only meaningful for ND/K24 builds
772 { "wl_security_mode", V_LENGTH(1, 32) }, // disabled, radius, wep, wpa_personal, wpa_enterprise, wpa2_personal, wpa2_enterprise
773 { "wl_radius_ipaddr", V_IP
},
774 { "wl_radius_port", V_PORT
},
775 { "wl_radius_key", V_LENGTH(1, 64) },
776 { "wl_wep_bit", V_RANGE(64, 128) }, // 64 or 128
777 { "wl_passphrase", V_LENGTH(0, 20) },
778 { "wl_key", V_RANGE(1, 4) },
779 { "wl_key1", V_LENGTH(0, 26) },
780 { "wl_key2", V_LENGTH(0, 26) },
781 { "wl_key3", V_LENGTH(0, 26) },
782 { "wl_key4", V_LENGTH(0, 26) },
783 { "wl_crypto", V_LENGTH(3, 8) }, // tkip, aes, tkip+aes
784 { "wl_wpa_psk", V_LENGTH(8, 64) },
785 { "wl_wpa_gtk_rekey", V_RANGE(60, 7200) },
787 { "wl_lazywds", V_01
},
788 { "wl_wds", V_LENGTH(0, 180) }, // mac mac mac (x 10)
790 { "wl_wds_enable", V_01
},
791 { "wl_gmode", V_RANGE(-1, 6) },
792 { "wl_wep", V_LENGTH(1, 32) }, // off, on, restricted,tkip,aes,tkip+aes
793 { "wl_akm", V_LENGTH(0, 32) }, // wpa, wpa2, psk, psk2, wpa wpa2, psk psk2, ""
794 { "wl_auth_mode", V_LENGTH(4, 6) }, // none, radius
796 { "wl_nmode", V_NONE
},
797 { "wl_nband", V_RANGE(0, 2) }, // 2 - 2.4GHz, 1 - 5GHz, 0 - Auto
798 { "wl_nreqd", V_NONE
},
799 { "wl_nbw_cap", V_RANGE(0, 2) }, // 0 - 20MHz, 1 - 40MHz, 2 - Auto
800 { "wl_nbw", V_NONE
},
801 { "wl_mimo_preamble", V_WORD
}, // 802.11n Preamble: mm/gf/auto/gfbcm
802 { "wl_nctrlsb", V_NONE
}, // none, lower, upper
806 { "ipv6_service", V_LENGTH(0, 16) }, // '', native, native-pd, 6to4, sit, other
807 { "ipv6_prefix", V_IPV6(0) },
808 { "ipv6_prefix_length", V_RANGE(3, 127) },
809 { "ipv6_rtr_addr", V_IPV6(0) },
810 { "ipv6_radvd", V_01
},
811 { "ipv6_dhcpd", V_01
},
812 { "ipv6_accept_ra", V_NUM
},
813 { "ipv6_tun_addr", V_IPV6(1) },
814 { "ipv6_tun_addrlen", V_RANGE(3, 127) },
815 { "ipv6_ifname", V_LENGTH(0, 8) },
816 { "ipv6_tun_v4end", V_IP
},
817 { "ipv6_relay", V_RANGE(1, 254) },
818 { "ipv6_tun_mtu", V_NUM
}, // Tunnel MTU
819 { "ipv6_tun_ttl", V_NUM
}, // Tunnel TTL
820 { "ipv6_dns", V_LENGTH(0, 40*3) }, // ip6 ip6 ip6
821 { "ipv6_6rd_prefix", V_IPV6(0) },
822 { "ipv6_6rd_prefix_length", V_RANGE(3, 127) },
823 { "ipv6_6rd_borderrelay", V_IP
},
824 { "ipv6_6rd_ipv4masklen", V_RANGE(0, 32) },
825 { "ipv6_vlan", V_RANGE(0, 7) }, // Enable IPv6 on 1=LAN1 2=LAN2 4=LAN3
826 { "ipv6_pdonly", V_01
}, // Request DHCPv6 Prefix Delegation Only
827 { "ipv6_ipsec", V_01
}, // Enable Incoming IPv6 IPSec
831 { "wl_macmode", V_NONE
}, // allow, deny, disabled
832 { "wl_maclist", V_LENGTH(0, 18*201) }, // 18 x 200 (11:22:33:44:55:66 ...)
833 { "macnames", V_LENGTH(0, 62*201) }, // 62 (12+1+48+1) x 50 (112233445566<..>) todo: re-use -- zzz
837 { "ct_tcp_timeout", V_LENGTH(20, 70) },
838 { "ct_udp_timeout", V_LENGTH(5, 15) },
839 { "ct_timeout", V_LENGTH(5, 15) },
840 { "nf_ttl", V_LENGTH(1, 6) },
844 { "ct_hashsize", V_NUM
},
852 { "dhcpd_slt", V_RANGE(-1, 43200) }, // -1=infinite, 0=follow normal lease time, >=1 custom
853 { "dhcpd_dmdns", V_01
},
854 { "dhcpd_lmax", V_NUM
},
855 { "dhcpd_gwmode", V_NUM
},
856 { "dns_addget", V_01
},
857 { "dns_intcpt", V_01
},
858 { "dhcpc_minpkt", V_01
},
859 { "dhcpc_custom", V_LENGTH(0, 80) },
860 { "dns_norebind", V_01
},
861 { "dnsmasq_debug", V_01
},
862 { "dnsmasq_custom", V_TEXT(0, 2048) },
863 { "dnsmasq_q", V_RANGE(0,7) }, //bitfield quiet bit0=dhcp, 1=dhcp6, 2=ra
864 // { "dnsmasq_norw", V_01 },
867 { "block_wan", V_01
},
868 { "block_wan_limit", V_01
},
869 { "block_wan_limit_icmp", V_RANGE(1, 300) },
870 { "block_wan_limit_tr", V_RANGE(1, 300) },
871 { "multicast_pass", V_01
},
872 { "multicast_lan", V_01
},
873 { "multicast_lan1", V_01
},
874 { "multicast_lan2", V_01
},
875 { "multicast_lan3", V_01
},
876 { "block_loopback", V_01
},
877 { "udpxy_enable", V_01
},
878 { "udpxy_stats", V_01
},
879 { "udpxy_clients", V_RANGE(1, 5000) },
880 { "udpxy_port", V_RANGE(0, 65535) },
881 { "nf_loopback", V_NUM
},
882 { "ne_syncookies", V_01
},
883 { "DSCP_fix_enable", V_01
},
885 { "dhcp_pass", V_01
},
887 { "emf_entry", V_NONE
},
888 { "emf_uffp_entry", V_NONE
},
889 { "emf_rtport_entry", V_NONE
},
890 { "emf_enable", V_01
},
894 { "adblock_enable", V_01
},
895 { "adblock_blacklist", V_LENGTH(0, 4096) },
896 { "adblock_blacklist_custom", V_LENGTH(0, 4096) },
897 { "adblock_whitelist", V_LENGTH(0, 4096) },
900 { "wait_time", V_RANGE(3, 20) },
901 { "wan_speed", V_RANGE(0, 4) },
902 { "jumbo_frame_enable", V_01
}, // Jumbo Frames support (for RT-N16/WNR3500L)
903 { "jumbo_frame_size", V_RANGE(1, 9720) },
905 { "ctf_disable", V_01
},
908 { "vlan0ports", V_TEXT(0,16) },
909 { "vlan1ports", V_TEXT(0,16) },
910 { "vlan2ports", V_TEXT(0,16) },
911 { "vlan3ports", V_TEXT(0,16) },
912 { "vlan4ports", V_TEXT(0,16) },
913 { "vlan5ports", V_TEXT(0,16) },
914 { "vlan6ports", V_TEXT(0,16) },
915 { "vlan7ports", V_TEXT(0,16) },
916 { "vlan8ports", V_TEXT(0,16) },
917 { "vlan9ports", V_TEXT(0,16) },
918 { "vlan10ports", V_TEXT(0,16) },
919 { "vlan11ports", V_TEXT(0,16) },
920 { "vlan12ports", V_TEXT(0,16) },
921 { "vlan13ports", V_TEXT(0,16) },
922 { "vlan14ports", V_TEXT(0,16) },
923 { "vlan15ports", V_TEXT(0,16) },
924 { "vlan0hwname", V_TEXT(0,8) },
925 { "vlan1hwname", V_TEXT(0,8) },
926 { "vlan2hwname", V_TEXT(0,8) },
927 { "vlan3hwname", V_TEXT(0,8) },
928 { "vlan4hwname", V_TEXT(0,8) },
929 { "vlan5hwname", V_TEXT(0,8) },
930 { "vlan6hwname", V_TEXT(0,8) },
931 { "vlan7hwname", V_TEXT(0,8) },
932 { "vlan8hwname", V_TEXT(0,8) },
933 { "vlan9hwname", V_TEXT(0,8) },
934 { "vlan10hwname", V_TEXT(0,8) },
935 { "vlan11hwname", V_TEXT(0,8) },
936 { "vlan12hwname", V_TEXT(0,8) },
937 { "vlan13hwname", V_TEXT(0,8) },
938 { "vlan14hwname", V_TEXT(0,8) },
939 { "vlan15hwname", V_TEXT(0,8) },
940 { "wan_ifnameX", V_TEXT(0,8) },
941 { "wan2_ifnameX", V_TEXT(0,8) },
942 { "wan3_ifnameX", V_TEXT(0,8) },
943 { "wan4_ifnameX", V_TEXT(0,8) },
944 { "lan_ifnames", V_TEXT(0,64) },
945 { "manual_boot_nv", V_01
},
946 { "trunk_vlan_so", V_01
},
947 { "vlan0tag", V_TEXT(0,5) },
948 { "vlan0vid", V_TEXT(0,5) },
949 { "vlan1vid", V_TEXT(0,5) },
950 { "vlan2vid", V_TEXT(0,5) },
951 { "vlan3vid", V_TEXT(0,5) },
952 { "vlan4vid", V_TEXT(0,5) },
953 { "vlan5vid", V_TEXT(0,5) },
954 { "vlan6vid", V_TEXT(0,5) },
955 { "vlan7vid", V_TEXT(0,5) },
956 { "vlan8vid", V_TEXT(0,5) },
957 { "vlan9vid", V_TEXT(0,5) },
958 { "vlan10vid", V_TEXT(0,5) },
959 { "vlan11vid", V_TEXT(0,5) },
960 { "vlan12vid", V_TEXT(0,5) },
961 { "vlan13vid", V_TEXT(0,5) },
962 { "vlan14vid", V_TEXT(0,5) },
963 { "vlan15vid", V_TEXT(0,5) },
966 { "wan_mac", V_LENGTH(0, 17) },
967 { "wan2_mac", V_LENGTH(0, 17) },
968 #ifdef TCONFIG_MULTIWAN
969 { "wan3_mac", V_LENGTH(0, 17) },
970 { "wan4_mac", V_LENGTH(0, 17) },
972 { "wl_macaddr", V_LENGTH(0, 17) },
973 { "wl_hwaddr", V_LENGTH(0, 17) },
976 { "routes_static", V_LENGTH(0, 2048) },
977 { "dhcp_routes", V_01
},
978 { "lan_stp", V_RANGE(0, 1) },
979 { "wk_mode", V_LENGTH(1, 32) }, // gateway, router
981 { "dr_setting", V_RANGE(0, 3) },
982 { "dr_lan_tx", V_LENGTH(0, 32) },
983 { "dr_lan_rx", V_LENGTH(0, 32) },
984 { "dr_lan1_tx", V_LENGTH(0, 32) },
985 { "dr_lan1_rx", V_LENGTH(0, 32) },
986 { "dr_lan2_tx", V_LENGTH(0, 32) },
987 { "dr_lan2_rx", V_LENGTH(0, 32) },
988 { "dr_lan3_tx", V_LENGTH(0, 32) },
989 { "dr_lan3_rx", V_LENGTH(0, 32) },
990 { "dr_wan_tx", V_LENGTH(0, 32) },
991 { "dr_wan_rx", V_LENGTH(0, 32) },
995 { "lan_access", V_LENGTH(0, 4096) },
998 { "wl_country", V_LENGTH(0, 64) }, // !!TB - Country code
999 { "wl_country_code", V_LENGTH(0, 4) }, // !!TB - Country code
1000 { "wl_btc_mode", V_RANGE(0, 2) }, // !!TB - BT Coexistence Mode: 0 (disable), 1 (enable), 2 (preemption)
1001 { "wl_afterburner", V_LENGTH(2, 4) }, // off, on, auto
1002 { "wl_auth", V_01
},
1003 { "wl_rateset", V_LENGTH(2, 7) }, // all, default, 12
1004 { "wl_rate", V_RANGE(0, 54 * 1000 * 1000) },
1005 { "wl_mrate", V_RANGE(0, 54 * 1000 * 1000) },
1006 { "wl_gmode_protection",V_LENGTH(3, 4) }, // off, auto
1007 { "wl_frameburst", V_ONOFF
}, // off, on
1008 { "wl_bcn", V_RANGE(1, 65535) },
1009 { "wl_dtim", V_RANGE(1, 255) },
1010 { "wl_frag", V_RANGE(256, 2346) },
1011 { "wl_rts", V_RANGE(0, 2347) },
1012 { "wl_ap_isolate", V_01
},
1013 { "wl_plcphdr", V_LENGTH(4, 5) }, // long, short
1014 { "wl_antdiv", V_RANGE(0, 3) },
1015 { "wl_txant", V_RANGE(0, 3) },
1016 { "wl_txpwr", V_RANGE(0, 400) },
1017 { "wl_wme", V_WORD
}, // auto, off, on
1018 { "wl_wme_no_ack", V_ONOFF
}, // off, on
1019 { "wl_wme_apsd", V_ONOFF
}, // off, on
1020 { "wl_maxassoc", V_RANGE(0, 255) },
1021 { "wl_distance", V_LENGTH(0, 5) }, // "", 1-99999
1022 { "wlx_hpamp", V_01
},
1023 { "wlx_hperx", V_01
},
1024 { "wl_reg_mode", V_LENGTH(1, 3) }, // !!TB - Regulatory: off, h, d
1025 { "wl_mitigation", V_RANGE(0, 4) }, // Interference Mitigation Mode (0|1|2|3|4)
1027 { "wl_nmode_protection", V_WORD
, }, // off, auto
1028 { "wl_nmcsidx", V_RANGE(-2, 32), }, // -2 - 32
1029 { "wl_obss_coex", V_01
},
1030 { "wl_wmf_bss_enable", V_01
}, // Toastman
1033 { "dmz_enable", V_01
},
1034 { "dmz_ipaddr", V_LENGTH(0, 15) },
1035 { "dmz_sip", V_LENGTH(0, 512) },
1036 { "dmz_ifname", V_LENGTH(0, 5) },
1040 { "upnp_enable", V_NUM
},
1041 { "upnp_secure", V_01
},
1042 { "upnp_port", V_RANGE(0, 65535) },
1043 { "upnp_ssdp_interval", V_RANGE(10, 9999) },
1044 { "upnp_mnp", V_01
},
1045 { "upnp_clean", V_01
},
1046 { "upnp_clean_interval", V_RANGE(60, 65535) },
1047 { "upnp_clean_threshold", V_RANGE(0, 9999) },
1048 { "upnp_min_port_int", V_PORT
},
1049 { "upnp_max_port_int", V_PORT
},
1050 { "upnp_min_port_ext", V_PORT
},
1051 { "upnp_max_port_ext", V_PORT
},
1052 { "upnp_lan", V_01
},
1053 { "upnp_lan1", V_01
},
1054 { "upnp_lan2", V_01
},
1055 { "upnp_lan3", V_01
},
1056 { "upnp_custom", V_TEXT(0, 2048) },
1059 { "portforward", V_LENGTH(0, 4096) },
1062 // forward-basic-ipv6
1063 { "ipv6_portforward", V_LENGTH(0, 4096) },
1066 // forward-triggered
1067 { "trigforward", V_LENGTH(0, 4096) },
1070 // access restriction
1071 { "rruleN", V_RANGE(0, 99) },
1072 // { "rrule##", V_LENGTH(0, 2048) }, // in save_variables()
1075 { "http_enable", V_01
},
1076 { "https_enable", V_01
},
1077 { "https_crt_save", V_01
},
1078 { "https_crt_cn", V_LENGTH(0, 64) },
1079 { "https_crt_gen", V_TEMP
},
1080 { "remote_management", V_01
},
1081 { "remote_mgt_https", V_01
},
1082 { "http_lanport", V_PORT
},
1083 { "https_lanport", V_PORT
},
1084 { "web_wl_filter", V_01
},
1085 { "web_css", V_LENGTH(1, 32) },
1086 { "web_dir", V_LENGTH(1, 32) },
1087 { "ttb_css", V_LENGTH(0, 128) },
1088 { "web_mx", V_LENGTH(0, 128) },
1089 { "http_wanport", V_PORT
},
1090 { "telnetd_eas", V_01
},
1091 { "telnetd_port", V_PORT
},
1092 { "sshd_eas", V_01
},
1093 { "sshd_pass", V_01
},
1094 { "sshd_port", V_PORT
},
1095 { "sshd_remote", V_01
},
1096 { "sshd_motd", V_01
},
1097 { "sshd_forwarding", V_01
},
1098 { "sshd_rport", V_PORT
},
1099 { "sshd_authkeys", V_TEXT(0, 4096) },
1100 { "rmgt_sip", V_LENGTH(0, 512) },
1101 { "ne_shlimit", V_TEXT(1, 50) },
1102 { "http_username", V_LENGTH(0, 32) },
1103 { "http_root", V_01
},
1106 { "rstats_enable", V_01
},
1107 { "rstats_path", V_LENGTH(0, 48) },
1108 { "rstats_stime", V_RANGE(1, 168) },
1109 { "rstats_offset", V_RANGE(1, 31) },
1110 { "rstats_exclude", V_LENGTH(0, 64) },
1111 { "rstats_sshut", V_01
},
1112 { "rstats_bak", V_01
},
1115 { "cstats_enable", V_01
},
1116 { "cstats_path", V_LENGTH(0, 48) },
1117 { "cstats_stime", V_RANGE(1, 168) },
1118 { "cstats_offset", V_RANGE(1, 31) },
1119 { "cstats_labels", V_RANGE(0, 2) },
1120 { "cstats_exclude", V_LENGTH(0, 512) },
1121 { "cstats_include", V_LENGTH(0, 2048) },
1122 { "cstats_all", V_01
},
1123 { "cstats_sshut", V_01
},
1124 { "cstats_bak", V_01
},
1127 { "sesx_led", V_RANGE(0, 255) }, // amber, white, aoss
1128 { "sesx_b0", V_RANGE(0, 5) }, // 0-5: toggle wireless, reboot, shutdown, script, usb unmount
1129 { "sesx_b1", V_RANGE(0, 5) }, // "
1130 { "sesx_b2", V_RANGE(0, 5) }, // "
1131 { "sesx_b3", V_RANGE(0, 5) }, // "
1132 { "sesx_script", V_TEXT(0, 1024) }, //
1133 { "script_brau", V_TEXT(0, 1024) }, //
1136 { "debug_nocommit", V_01
},
1137 { "debug_cprintf", V_01
},
1138 { "debug_cprintf_file", V_01
},
1139 // { "debug_keepfiles", V_01 },
1140 { "debug_ddns", V_01
},
1141 { "debug_norestart", V_TEXT(0, 128) },
1142 { "console_loglevel", V_RANGE(1, 8) },
1143 { "t_cafree", V_01
},
1144 { "t_hidelr", V_01
},
1147 { "sch_rboot", V_TEXT(0, 64) },
1148 { "sch_rcon", V_TEXT(0, 64) },
1149 { "sch_c1", V_TEXT(0, 64) },
1150 { "sch_c1_cmd", V_TEXT(0, 2048) },
1151 { "sch_c2", V_TEXT(0, 64) },
1152 { "sch_c2_cmd", V_TEXT(0, 2048) },
1153 { "sch_c3", V_TEXT(0, 64) },
1154 { "sch_c3_cmd", V_TEXT(0, 2048) },
1155 { "sch_c4", V_TEXT(0, 64) },
1156 { "sch_c4_cmd", V_TEXT(0, 2048) },
1157 { "sch_c5", V_TEXT(0, 64) },
1158 { "sch_c5_cmd", V_TEXT(0, 2048) },
1161 { "script_init", V_TEXT(0, 4096) },
1162 { "script_shut", V_TEXT(0, 4096) },
1163 { "script_fire", V_TEXT(0, 8192) },
1164 { "script_wanup", V_TEXT(0, 4096) },
1167 { "log_remote", V_01
},
1168 { "log_remoteip", V_LENGTH(0, 512) },
1169 { "log_remoteport", V_PORT
},
1170 { "log_file", V_01
},
1171 { "log_file_custom", V_01
},
1172 { "log_file_path", V_TEXT(0, 4096) },
1173 { "log_file_size", V_RANGE(0, 99999) },
1174 { "log_file_keep", V_RANGE(0, 99) },
1175 { "log_limit", V_RANGE(0, 2400) },
1176 { "log_in", V_RANGE(0, 3) },
1177 { "log_out", V_RANGE(0, 3) },
1178 { "log_mark", V_RANGE(0, 99999) },
1179 { "log_events", V_TEXT(0, 32) }, // "acre,crond,ntp"
1181 // admin-log-webmonitor
1183 { "log_wmtype", V_RANGE(0, 2) },
1184 { "log_wmip", V_LENGTH(0, 512) },
1185 { "log_wmdmax", V_RANGE(0, 9999) },
1186 { "log_wmsmax", V_RANGE(0, 9999) },
1187 { "webmon_bkp", V_01
},
1188 { "webmon_dir", V_LENGTH(0, 256) },
1189 { "webmon_shrink", V_01
},
1193 { "cifs1", V_LENGTH(1, 1024) },
1194 { "cifs2", V_LENGTH(1, 1024) },
1197 { "jffs2_on", V_01
},
1198 { "jffs2_exec", V_LENGTH(0, 64) },
1199 { "jffs2_format", V_01
},
1204 { "mmc_cs", V_RANGE(1, 7) }, // GPIO pin
1205 { "mmc_clk", V_RANGE(1, 7) }, // GPIO pin
1206 { "mmc_din", V_RANGE(1, 7) }, // GPIO pin
1207 { "mmc_dout", V_RANGE(1, 7) }, // GPIO pin
1208 { "mmc_fs_partition", V_RANGE(1, 4) }, // partition number in partition table
1209 { "mmc_fs_type", V_LENGTH(4, 4) }, // ext2, ext3, vfat
1210 { "mmc_exec_mount", V_LENGTH(0, 64) },
1211 { "mmc_exec_umount", V_LENGTH(0, 64) },
1215 { "tomatoanon_answer", V_RANGE(0, 1) },
1216 { "tomatoanon_enable", V_RANGE(-1, 1) },
1217 { "tomatoanon_id", V_LENGTH(0, 32) },
1218 { "tomatoanon_notify", V_01
},
1222 { "usb_enable", V_01
},
1223 { "usb_uhci", V_RANGE(-1, 1) }, // -1 - disabled, 0 - off, 1 - on
1224 { "usb_ohci", V_RANGE(-1, 1) },
1225 { "usb_usb2", V_RANGE(-1, 1) },
1226 { "usb_irq_thresh", V_RANGE(0, 6) },
1227 { "usb_storage", V_01
},
1228 { "usb_printer", V_01
},
1229 { "usb_printer_bidirect", V_01
},
1230 { "usb_fs_ext3", V_01
},
1231 { "usb_fs_fat", V_01
},
1233 { "usb_fs_ntfs", V_01
},
1236 { "usb_apcupsd", V_01
},
1239 { "usb_fs_hfs", V_01
}, //!Victek
1241 { "usb_automount", V_01
},
1242 { "script_usbhotplug", V_TEXT(0, 2048) },
1243 { "script_usbmount", V_TEXT(0, 2048) },
1244 { "script_usbumount", V_TEXT(0, 2048) },
1245 { "idle_enable", V_01
},
1251 { "ftp_enable", V_RANGE(0, 2) },
1252 { "ftp_super", V_01
},
1253 { "ftp_anonymous", V_RANGE(0, 3) },
1254 { "ftp_dirlist", V_RANGE(0, 2) },
1255 { "ftp_port", V_PORT
},
1256 { "ftp_max", V_RANGE(0, 12) },
1257 { "ftp_ipmax", V_RANGE(0, 12) },
1258 { "ftp_staytimeout", V_RANGE(0, 65535) },
1259 { "ftp_rate", V_RANGE(0, 99999) },
1260 { "ftp_anonrate", V_RANGE(0, 99999) },
1261 { "ftp_anonroot", V_LENGTH(0, 256) },
1262 { "ftp_pubroot", V_LENGTH(0, 256) },
1263 { "ftp_pvtroot", V_LENGTH(0, 256) },
1264 { "ftp_users", V_LENGTH(0, 4096) },
1265 { "ftp_custom", V_TEXT(0, 2048) },
1266 { "ftp_sip", V_LENGTH(0, 512) },
1267 { "ftp_limit", V_TEXT(1, 50) },
1268 { "log_ftp", V_01
},
1272 { "snmp_enable", V_RANGE(0, 1) },
1273 { "snmp_port", V_RANGE(1, 65535) },
1274 { "snmp_remote", V_RANGE(0, 1) },
1275 { "snmp_remote_sip", V_LENGTH(0, 512) },
1276 { "snmp_location", V_LENGTH(0, 40) },
1277 { "snmp_contact", V_LENGTH(0, 40) },
1278 { "snmp_ro", V_LENGTH(0, 40) },
1281 #ifdef TCONFIG_SAMBASRV
1283 { "smbd_enable", V_RANGE(0, 2) },
1284 { "smbd_wgroup", V_LENGTH(0, 20) },
1285 { "smbd_master", V_01
},
1286 { "smbd_wins", V_01
},
1287 { "smbd_cpage", V_LENGTH(0, 4) },
1288 { "smbd_cset", V_LENGTH(0, 20) },
1289 { "smbd_custom", V_TEXT(0, 2048) },
1290 { "smbd_autoshare", V_RANGE(0, 3) },
1291 { "smbd_shares", V_LENGTH(0, 4096) },
1292 { "smbd_user", V_LENGTH(0, 50) },
1293 { "smbd_passwd", V_LENGTH(0, 50) },
1294 { "smbd_ifnames", V_LENGTH(0, 50) },
1297 #ifdef TCONFIG_MEDIA_SERVER
1299 { "ms_enable", V_01
},
1300 { "ms_dirs", V_LENGTH(0, 1024) },
1301 { "ms_port", V_RANGE(0, 65535) },
1302 { "ms_dbdir", V_LENGTH(0, 256) },
1303 { "ms_ifname", V_LENGTH(0, 256) },
1304 { "ms_tivo", V_01
},
1305 { "ms_stdlna", V_01
},
1306 { "ms_rescan", V_01
},
1311 { "qos_enable", V_01
},
1312 { "qos_ack", V_01
},
1313 { "qos_syn", V_01
},
1314 { "qos_fin", V_01
},
1315 { "qos_rst", V_01
},
1316 { "qos_icmp", V_01
},
1317 { "qos_udp", V_01
},
1318 { "qos_reset", V_01
},
1319 { "qos_pfifo", V_01
}, // !!TB
1320 { "wan_qos_obw", V_RANGE(10, 999999) },
1321 { "wan_qos_ibw", V_RANGE(10, 999999) },
1322 { "wan2_qos_obw", V_RANGE(10, 999999) },
1323 { "wan2_qos_ibw", V_RANGE(10, 999999) },
1324 #ifdef TCONFIG_MULTIWAN
1325 { "wan3_qos_obw", V_RANGE(10, 999999) },
1326 { "wan3_qos_ibw", V_RANGE(10, 999999) },
1327 { "wan4_qos_obw", V_RANGE(10, 999999) },
1328 { "wan4_qos_ibw", V_RANGE(10, 999999) },
1331 { "qos_orules", V_LENGTH(0, 4096) },
1332 { "qos_default", V_RANGE(0, 9) },
1333 { "qos_irates", V_LENGTH(0, 128) },
1334 { "qos_orates", V_LENGTH(0, 128) },
1335 { "qos_classnames", V_LENGTH(10, 128) }, // !!TOASTMAN
1336 { "atm_overhead", V_RANGE(-127, 128) },
1337 { "ne_vegas", V_01
},
1338 { "ne_valpha", V_NUM
},
1339 { "ne_vbeta", V_NUM
},
1340 { "ne_vgamma", V_NUM
},
1343 { "new_qoslimit_enable", V_01
},
1344 { "new_qoslimit_rules", V_LENGTH(0, 4096) },
1345 { "qosl_enable", V_01
},
1346 { "qosl_ulr", V_RANGE(0, 999999) },
1347 { "qosl_ulc", V_RANGE(0, 999999) },
1348 { "qosl_dlr", V_RANGE(0, 999999) },
1349 { "qosl_dlc", V_RANGE(0, 999999) },
1350 { "qosl_tcp", V_RANGE(0, 1000) },
1351 { "qosl_udp", V_RANGE(0, 100) },
1352 { "limit_br0_prio", V_RANGE(0, 5) },
1353 { "limit_br1_enable", V_01
},
1354 { "limit_br1_ulr", V_RANGE(0, 999999) },
1355 { "limit_br1_ulc", V_RANGE(0, 999999) },
1356 { "limit_br1_dlr", V_RANGE(0, 999999) },
1357 { "limit_br1_dlc", V_RANGE(0, 999999) },
1358 { "limit_br1_prio", V_RANGE(0, 5) },
1359 { "limit_br2_enable", V_01
},
1360 { "limit_br2_ulr", V_RANGE(0, 999999) },
1361 { "limit_br2_ulc", V_RANGE(0, 999999) },
1362 { "limit_br2_dlr", V_RANGE(0, 999999) },
1363 { "limit_br2_dlc", V_RANGE(0, 999999) },
1364 { "limit_br2_prio", V_RANGE(0, 5) },
1365 { "limit_br3_enable", V_01
},
1366 { "limit_br3_ulr", V_RANGE(0, 999999) },
1367 { "limit_br3_ulc", V_RANGE(0, 999999) },
1368 { "limit_br3_dlr", V_RANGE(0, 999999) },
1369 { "limit_br3_dlc", V_RANGE(0, 999999) },
1370 { "limit_br3_prio", V_RANGE(0, 5) },
1375 { "bt_enable", V_01
},
1376 { "bt_binary", V_LENGTH(0, 50) },
1377 { "bt_binary_custom", V_LENGTH(0, 50) },
1378 { "bt_custom", V_TEXT(0, 2048) },
1379 { "bt_port", V_PORT
},
1380 { "bt_dir", V_LENGTH(0, 50) },
1381 { "bt_settings", V_LENGTH(0, 50) },
1382 { "bt_settings_custom", V_LENGTH(0, 50) },
1383 { "bt_incomplete", V_01
},
1384 { "bt_rpc_enable", V_01
},
1385 { "bt_rpc_wan", V_01
},
1386 { "bt_auth", V_01
},
1387 { "bt_login", V_LENGTH(0, 50) },
1388 { "bt_password", V_LENGTH(0, 50) },
1389 { "bt_port_gui", V_PORT
},
1390 { "bt_dl_enable", V_01
},
1391 { "bt_ul_enable", V_01
},
1392 { "bt_dl", V_RANGE(0, 999999) },
1393 { "bt_ul", V_RANGE(0, 999999) },
1394 { "bt_peer_limit_global", V_RANGE(10, 1000) },
1395 { "bt_peer_limit_per_torrent", V_RANGE(1, 200) },
1396 { "bt_ul_slot_per_torrent", V_RANGE(1, 50) },
1397 { "bt_ratio_enable", V_01
},
1398 { "bt_ratio", V_LENGTH(0, 999999) },
1399 { "bt_ratio_idle_enable", V_01
},
1400 { "bt_ratio_idle", V_RANGE(1, 55) },
1405 { "bt_blocklist", V_01
},
1406 { "bt_blocklist_url", V_LENGTH(0, 80) },
1407 { "bt_sleep", V_RANGE(1, 60) },
1408 { "bt_check", V_01
},
1409 { "bt_check_time", V_RANGE(1, 55) },
1410 { "bt_dl_queue_enable", V_01
},
1411 { "bt_dl_queue_size", V_RANGE(1, 30) },
1412 { "bt_ul_queue_enable", V_01
},
1413 { "bt_ul_queue_size", V_RANGE(1, 30) },
1414 { "bt_message", V_RANGE(0, 3) },
1416 { "bt_log_path", V_LENGTH(0, 50) },
1421 { "nfs_enable", V_01
},
1422 { "nfs_exports", V_LENGTH(0, 4096) },
1425 //NotCatSplash. Victek.
1426 #ifdef TCONFIG_NOCAT
1427 { "NC_enable", V_01
},
1428 { "NC_Verbosity", V_RANGE(0, 10) },
1429 { "NC_GatewayName", V_LENGTH(0, 255) },
1430 { "NC_GatewayPort", V_PORT
},
1431 { "NC_ForcedRedirect", V_01
},
1432 { "NC_HomePage", V_LENGTH(0, 255) },
1433 { "NC_DocumentRoot", V_LENGTH(0, 255) },
1434 { "NC_SplashURL", V_LENGTH(0, 255) },
1435 { "NC_LoginTimeout", V_RANGE(0, 86400000) },
1436 { "NC_IdleTimeout", V_RANGE(0, 86400000) },
1437 { "NC_MaxMissedARP", V_RANGE(0, 10) },
1438 { "NC_PeerChecktimeout", V_RANGE(0, 60) },
1439 { "NC_ExcludePorts", V_LENGTH(0, 255) },
1440 { "NC_IncludePorts", V_LENGTH(0, 255) },
1441 { "NC_AllowedWebHosts", V_LENGTH(0, 255) },
1442 { "NC_MACWhiteList", V_LENGTH(0, 255) },
1443 { "NC_SplashFile", V_LENGTH(0, 8192) },
1444 { "NC_BridgeLAN", V_LENGTH(0, 50) },
1447 // NGinX Roadkill-Victek
1448 #ifdef TCONFIG_NGINX
1449 {"nginx_enable", V_01
}, // NGinX enabled
1450 {"nginx_php", V_01
}, // PHP enabled
1451 {"nginx_keepconf", V_01
}, // NGinX configuration files overwrite flag
1452 {"nginx_docroot", V_LENGTH(0, 255) }, // root files path
1453 {"nginx_port", V_PORT
}, // listening port
1454 {"nginx_fqdn", V_LENGTH(0, 255) }, // server name
1455 {"nginx_upload", V_LENGTH(1, 1000) }, // upload file size limit
1456 {"nginx_remote", V_01
},
1457 {"nginx_priority", V_LENGTH(0, 255) }, // server priority
1458 {"nginx_custom", V_TEXT(0, 4096) }, // user window to add parameters to nginx.conf
1459 {"nginx_httpcustom", V_TEXT(0, 4096) }, // user window to add parameters to nginx.conf
1460 {"nginx_servercustom", V_TEXT(0, 4096) }, // user window to add parameters to nginx.conf
1461 {"nginx_phpconf", V_TEXT(0, 4096) }, // user window to add parameters to php.ini
1462 {"nginx_user", V_LENGTH(0, 255) }, // user used to start nginx and spawn-fcgi
1463 {"nginx_override", V_01
},
1464 {"nginx_overridefile", V_TEXT(0, 4096) },
1467 { "mysql_enable", V_01
},
1468 { "mysql_sleep", V_RANGE(1,60) },
1469 { "mysql_check", V_01
},
1470 { "mysql_check_time", V_RANGE(1,55) },
1471 { "mysql_binary", V_LENGTH(0, 50) },
1472 { "mysql_binary_custom", V_LENGTH(0, 50) },
1473 { "mysql_usb_enable", V_01
},
1474 { "mysql_dlroot", V_LENGTH(0,50) },
1475 { "mysql_datadir", V_LENGTH(0,64) },
1476 { "mysql_tmpdir", V_LENGTH(0,64) },
1477 { "mysql_server_custom", V_TEXT(0,1024) },
1478 { "mysql_port", V_PORT
},
1479 { "mysql_allow_anyhost", V_01
},
1480 { "mysql_init_rootpass", V_01
},
1481 { "mysql_username", V_TEXT(0,50) }, // mysqladmin username
1482 { "mysql_passwd", V_TEXT(0,50) }, // mysqladmin password
1483 { "mysql_key_buffer", V_RANGE(0,1024) }, // MB
1484 { "mysql_max_allowed_packet", V_RANGE(0,1024) }, // MB
1485 { "mysql_thread_stack", V_RANGE(0,1024000) }, // KB
1486 { "mysql_thread_cache_size", V_RANGE(0,999999) },
1487 { "mysql_init_priv", V_01
},
1488 { "mysql_table_open_cache", V_RANGE(1,999999) },
1489 { "mysql_sort_buffer_size", V_RANGE(0,1024000) }, //KB
1490 { "mysql_read_buffer_size", V_RANGE(0,1024000) }, //KB
1491 { "mysql_query_cache_size", V_RANGE(0,1024) }, //MB
1492 { "mysql_read_rnd_buffer_size", V_RANGE(0,1024000) }, //KB
1493 { "mysql_net_buffer_length", V_RANGE(0,1024) }, //K
1494 { "mysql_max_connections", V_RANGE(0,999999) },
1497 #ifdef TCONFIG_OPENVPN
1499 { "vpn_debug", V_01
},
1500 { "vpn_server_eas", V_NONE
},
1501 { "vpn_server_dns", V_NONE
},
1502 { "vpn_server1_poll", V_RANGE(0, 1440) },
1503 { "vpn_server1_if", V_TEXT(3, 3) }, // tap, tun
1504 { "vpn_server1_proto", V_TEXT(3, 10) }, // udp, tcp-server
1505 { "vpn_server1_port", V_PORT
},
1506 { "vpn_server1_firewall", V_TEXT(0, 8) }, // auto, external, custom
1507 { "vpn_server1_crypt", V_TEXT(0, 6) }, // tls, secret, custom
1508 { "vpn_server1_comp", V_TEXT(0, 8) }, // yes, no, adaptive
1509 { "vpn_server1_cipher", V_TEXT(0, 16) },
1510 { "vpn_server1_dhcp", V_01
},
1511 { "vpn_server1_r1", V_IP
},
1512 { "vpn_server1_r2", V_IP
},
1513 { "vpn_server1_sn", V_IP
},
1514 { "vpn_server1_nm", V_IP
},
1515 { "vpn_server1_local", V_IP
},
1516 { "vpn_server1_remote", V_IP
},
1517 { "vpn_server1_reneg", V_RANGE(-1,2147483647)},
1518 { "vpn_server1_hmac", V_RANGE(-1, 2) },
1519 { "vpn_server1_plan", V_01
},
1520 { "vpn_server1_ccd", V_01
},
1521 { "vpn_server1_c2c", V_01
},
1522 { "vpn_server1_ccd_excl", V_01
},
1523 { "vpn_server1_ccd_val", V_NONE
},
1524 { "vpn_server1_pdns", V_01
},
1525 { "vpn_server1_rgw", V_01
},
1526 { "vpn_server1_userpass", V_01
},
1527 { "vpn_server1_nocert", V_01
},
1528 { "vpn_server1_users_val",V_NONE
},
1529 { "vpn_server1_custom", V_NONE
},
1530 { "vpn_server1_static", V_NONE
},
1531 { "vpn_server1_ca", V_NONE
},
1532 { "vpn_server1_crt", V_NONE
},
1533 { "vpn_server1_key", V_NONE
},
1534 { "vpn_server1_dh", V_NONE
},
1535 { "vpn_server1_br", V_LENGTH(0, 50) },
1536 { "vpn_server1_route", V_01
},
1537 { "vpn_server1_routing_val", V_NONE
},
1538 { "vpn_server2_poll", V_RANGE(0, 1440) },
1539 { "vpn_server2_if", V_TEXT(3, 3) }, // tap, tun
1540 { "vpn_server2_proto", V_TEXT(3, 10) }, // udp, tcp-server
1541 { "vpn_server2_port", V_PORT
},
1542 { "vpn_server2_firewall", V_TEXT(0, 8) }, // auto, external, custom
1543 { "vpn_server2_crypt", V_TEXT(0, 6) }, // tls, secret, custom
1544 { "vpn_server2_comp", V_TEXT(0, 8) }, // yes, no, adaptive
1545 { "vpn_server2_cipher", V_TEXT(0, 16) },
1546 { "vpn_server2_dhcp", V_01
},
1547 { "vpn_server2_r1", V_IP
},
1548 { "vpn_server2_r2", V_IP
},
1549 { "vpn_server2_sn", V_IP
},
1550 { "vpn_server2_nm", V_IP
},
1551 { "vpn_server2_local", V_IP
},
1552 { "vpn_server2_remote", V_IP
},
1553 { "vpn_server2_reneg", V_RANGE(-1,2147483647)},
1554 { "vpn_server2_hmac", V_RANGE(-1, 2) },
1555 { "vpn_server2_plan", V_01
},
1556 { "vpn_server2_pdns", V_01
},
1557 { "vpn_server2_rgw", V_01
},
1558 { "vpn_server2_userpass", V_01
},
1559 { "vpn_server2_nocert", V_01
},
1560 { "vpn_server2_users_val",V_NONE
},
1561 { "vpn_server2_custom", V_NONE
},
1562 { "vpn_server2_ccd", V_01
},
1563 { "vpn_server2_c2c", V_01
},
1564 { "vpn_server2_ccd_excl", V_01
},
1565 { "vpn_server2_ccd_val", V_NONE
},
1566 { "vpn_server2_static", V_NONE
},
1567 { "vpn_server2_ca", V_NONE
},
1568 { "vpn_server2_crt", V_NONE
},
1569 { "vpn_server2_key", V_NONE
},
1570 { "vpn_server2_dh", V_NONE
},
1571 { "vpn_server2_br", V_LENGTH(0, 50) },
1572 { "vpn_server2_route", V_01
},
1573 { "vpn_server2_routing_val", V_NONE
},
1574 { "vpn_client_eas", V_NONE
},
1575 { "vpn_client1_poll", V_RANGE(0, 1440) },
1576 { "vpn_client1_if", V_TEXT(3, 3) }, // tap, tun
1577 { "vpn_client1_bridge", V_01
},
1578 { "vpn_client1_nat", V_01
},
1579 { "vpn_client1_proto", V_TEXT(3, 10) }, // udp, tcp-server
1580 { "vpn_client1_addr", V_NONE
},
1581 { "vpn_client1_port", V_PORT
},
1582 { "vpn_client1_retry", V_RANGE(-1,32767) }, // -1 infinite, 0 disabled, >= 1 custom
1583 { "vpn_client1_firewall", V_TEXT(0, 6) }, // auto, custom
1584 { "vpn_client1_crypt", V_TEXT(0, 6) }, // tls, secret, custom
1585 { "vpn_client1_comp", V_TEXT(0, 8) }, // yes, no, adaptive
1586 { "vpn_client1_cipher", V_TEXT(0, 16) },
1587 { "vpn_client1_local", V_IP
},
1588 { "vpn_client1_remote", V_IP
},
1589 { "vpn_client1_nm", V_IP
},
1590 { "vpn_client1_reneg", V_RANGE(-1,2147483647)},
1591 { "vpn_client1_hmac", V_RANGE(-1, 2) },
1592 { "vpn_client1_adns", V_RANGE(0, 3) },
1593 { "vpn_client1_rgw", V_01
},
1594 { "vpn_client1_gw", V_TEXT(0, 15) },
1595 { "vpn_client1_custom", V_NONE
},
1596 { "vpn_client1_static", V_NONE
},
1597 { "vpn_client1_ca", V_NONE
},
1598 { "vpn_client1_crt", V_NONE
},
1599 { "vpn_client1_key", V_NONE
},
1600 { "vpn_client1_userauth", V_01
},
1601 { "vpn_client1_username", V_TEXT(0,50) },
1602 { "vpn_client1_password", V_TEXT(0,50) },
1603 { "vpn_client1_useronly", V_01
},
1604 { "vpn_client1_tlsremote",V_01
},
1605 { "vpn_client1_cn", V_NONE
},
1606 { "vpn_client1_br", V_LENGTH(0, 50) },
1607 { "vpn_client1_nopull", V_01
},
1608 { "vpn_client1_route", V_01
},
1609 { "vpn_client1_routing_val", V_NONE
},
1610 { "vpn_client2_poll", V_RANGE(0, 1440) },
1611 { "vpn_client2_if", V_TEXT(3, 3) }, // tap, tun
1612 { "vpn_client2_bridge", V_01
},
1613 { "vpn_client2_nat", V_01
},
1614 { "vpn_client2_proto", V_TEXT(3, 10) }, // udp, tcp-server
1615 { "vpn_client2_addr", V_NONE
},
1616 { "vpn_client2_port", V_PORT
},
1617 { "vpn_client2_retry", V_RANGE(-1,32767) }, // -1 infinite, 0 disabled, >= 1 custom
1618 { "vpn_client2_firewall", V_TEXT(0, 6) }, // auto, custom
1619 { "vpn_client2_crypt", V_TEXT(0, 6) }, // tls, secret, custom
1620 { "vpn_client2_comp", V_TEXT(0, 8) }, // yes, no, adaptive
1621 { "vpn_client2_cipher", V_TEXT(0, 16) },
1622 { "vpn_client2_local", V_IP
},
1623 { "vpn_client2_remote", V_IP
},
1624 { "vpn_client2_nm", V_IP
},
1625 { "vpn_client2_reneg", V_RANGE(-1,2147483647)},
1626 { "vpn_client2_hmac", V_RANGE(-1, 2) },
1627 { "vpn_client2_adns", V_RANGE(0, 3) },
1628 { "vpn_client2_rgw", V_01
},
1629 { "vpn_client2_gw", V_TEXT(0, 15) },
1630 { "vpn_client2_custom", V_NONE
},
1631 { "vpn_client2_static", V_NONE
},
1632 { "vpn_client2_ca", V_NONE
},
1633 { "vpn_client2_crt", V_NONE
},
1634 { "vpn_client2_key", V_NONE
},
1635 { "vpn_client2_userauth", V_01
},
1636 { "vpn_client2_username", V_TEXT(0,50) },
1637 { "vpn_client2_password", V_TEXT(0,50) },
1638 { "vpn_client2_useronly", V_01
},
1639 { "vpn_client2_tlsremote",V_01
},
1640 { "vpn_client2_cn", V_NONE
},
1641 { "vpn_client2_br", V_LENGTH(0, 50) },
1642 { "vpn_client2_nopull", V_01
},
1643 { "vpn_client2_route", V_01
},
1644 { "vpn_client2_routing_val", V_NONE
},
1647 #ifdef TCONFIG_PPTPD
1649 { "pptpd_enable", V_01
},
1650 { "pptpd_remoteip", V_TEXT(0,24) },
1651 { "pptpd_forcemppe", V_01
},
1652 { "pptpd_users", V_TEXT(0, 67*16) },
1653 { "pptpd_broadcast", V_TEXT(0,8) },
1654 { "pptpd_dns1", V_TEXT(0, 15) },
1655 { "pptpd_dns2", V_TEXT(0, 15) },
1656 { "pptpd_wins1", V_TEXT(0, 15) },
1657 { "pptpd_wins2", V_TEXT(0, 15) },
1658 { "pptpd_mtu", V_RANGE(576, 1500) },
1659 { "pptpd_mru", V_RANGE(576, 1500) },
1660 { "pptpd_custom", V_TEXT(0, 2048) },
1664 {"tinc_wanup", V_RANGE(0, 1) },
1665 {"tinc_name", V_LENGTH(0, 30) },
1666 {"tinc_devicetype", V_TEXT(3, 3) }, // tun, tap
1667 {"tinc_mode", V_TEXT(3, 6) }, // switch, hub
1668 {"tinc_vpn_netmask", V_IP
},
1669 {"tinc_private_rsa", V_NONE
},
1670 {"tinc_private_ed25519", V_NONE
},
1671 {"tinc_custom", V_NONE
},
1672 {"tinc_hosts", V_NONE
},
1673 {"tinc_manual_firewall", V_RANGE(0, 2) },
1674 {"tinc_manual_tinc_up", V_RANGE(0, 1) },
1676 {"tinc_tinc_up", V_NONE
},
1677 {"tinc_tinc_down", V_NONE
},
1678 {"tinc_host_up", V_NONE
},
1679 {"tinc_host_down", V_NONE
},
1680 {"tinc_subnet_up", V_NONE
},
1681 {"tinc_subnet_down", V_NONE
},
1682 {"tinc_firewall", V_NONE
},
1686 { "tor_enable", V_01
},
1687 { "tor_socksport", V_RANGE(1,65535) },
1688 { "tor_transport", V_RANGE(1,65535) },
1689 { "tor_dnsport", V_RANGE(1,65535) },
1690 { "tor_datadir", V_TEXT(0,24) },
1691 { "tor_iface", V_LENGTH(0, 50) },
1692 { "tor_users", V_LENGTH(0, 4096) },
1693 { "tor_ports", V_LENGTH(0, 50) },
1694 { "tor_ports_custom", V_LENGTH(0, 4096) },
1695 { "tor_custom", V_TEXT(0, 2048) },
1717 port_flow_control_1 0,1
1718 port_rate_limit_1 0-8
1720 port_flow_control_2 0,1
1721 port_rate_limit_2 0-8
1723 port_flow_control_3 0,1
1724 port_rate_limit_3 0-8
1726 port_flow_control_4 0,1
1727 port_rate_limit_4 0-8
1731 #ifdef TCONFIG_PPTPD
1732 { "pptp_client_enable", V_01
},
1733 { "pptp_client_peerdns", V_RANGE(0,2) },
1734 { "pptp_client_mtuenable",V_01
},
1735 { "pptp_client_mtu", V_RANGE(576, 1500) },
1736 { "pptp_client_mruenable",V_01
},
1737 { "pptp_client_mru", V_RANGE(576, 1500) },
1738 { "pptp_client_nat", V_01
},
1739 { "pptp_client_srvip", V_NONE
},
1740 { "pptp_client_srvsub", V_IP
},
1741 { "pptp_client_srvsubmsk",V_IP
},
1742 { "pptp_client_username", V_TEXT(0,50) },
1743 { "pptp_client_passwd", V_TEXT(0,50) },
1744 { "pptp_client_crypt", V_RANGE(0, 3) },
1745 { "pptp_client_custom", V_NONE
},
1746 { "pptp_client_dfltroute",V_01
},
1747 { "pptp_client_stateless",V_01
},
1754 static int webcgi_nvram_set(const nvset_t
*v
, const char *name
, int write
)
1763 struct in6_addr addr
;
1766 if ((p
= webcgi_get((char*)name
)) == NULL
) return 0;
1768 _dprintf("[%s] %s=%s\n", v
->name
, (char*)name
, p
);
1773 p
= unix_string(p
); // NOTE: p = malloc'd
1777 if ((n
< v
->va
.i
) || (n
> v
->vb
.i
)) ok
= 0;
1780 l
= strtol(p
, &e
, 10);
1781 if ((p
== e
) || (*e
) || (l
< v
->va
.l
) || (l
> v
->vb
.l
)) ok
= 0;
1784 if ((sscanf(p
, "%3u.%3u.%3u.%3u", &u
[0], &u
[1], &u
[2], &u
[3]) != 4) ||
1785 (u
[0] > 255) || (u
[1] > 255) || (u
[2] > 255) || (u
[3] > 255)) ok
= 0;
1788 if ((sscanf(p
, "%2x:%2x:%2x:%2x:%2x:%2x", &u
[0], &u
[1], &u
[2], &u
[3], &u
[4], &u
[5]) != 6) ||
1789 (u
[0] > 255) || (u
[1] > 255) || (u
[2] > 255) || (u
[3] > 255) || (u
[4] > 255) || (u
[5] > 255)) ok
= 0;
1793 if (strlen(p
) > 0 || v
->va
.i
) {
1794 if (inet_pton(AF_INET6
, p
, &addr
) != 1) ok
= 0;
1803 if (v
->vtype
== VT_TEXT
) free(p
);
1807 if (!nvram_match((char *)name
, p
)) {
1808 if (v
->vtype
!= VT_TEMP
) dirty
= 1;
1809 DEBUG_NVRAMSET(name
, p
);
1813 if (v
->vtype
== VT_TEXT
) free(p
);
1824 static int nv_wl_find(int idx
, int unit
, int subunit
, void *param
)
1826 nv_list_t
*p
= param
;
1828 int ok
= webcgi_nvram_set(p
->v
, wl_nvname(p
->v
->name
+ 3, unit
, subunit
), p
->write
);
1837 static int save_variables(int write
)
1845 static const char *msgf
= "The field \"%s\" is invalid. Please report this problem.";
1850 for (v
= nvset_list
; v
->name
; ++v
) {
1851 ok
= webcgi_nvram_set(v
, v
->name
, write
);
1853 if ((ok
>= 0) && (strncmp(v
->name
, "wl_", 3) == 0)) {
1856 if (foreach_wif(1, &nv
, nv_wl_find
) == 0)
1863 sprintf(s
, msgf
, v
->name
);
1873 if (((p1
= webcgi_get("set_password_1")) != NULL
) && (strcmp(p1
, "**********") != 0)) {
1874 if (((p2
= webcgi_get("set_password_2")) != NULL
) && (strcmp(p1
, p2
) == 0)) {
1875 if ((write
) && (!nvram_match("http_passwd", p1
))) {
1877 nvram_set("http_passwd", p1
);
1881 sprintf(s
, msgf
, "password");
1887 for (n
= 0; n
< 50; ++n
) {
1888 sprintf(s
, "rrule%d", n
);
1889 if ((p
= webcgi_get(s
)) != NULL
) {
1890 if (strlen(p
) > 2048) {
1891 sprintf(s
, msgf
, s
);
1895 if ((write
) && (!nvram_match(s
, p
))) {
1897 DEBUG_NVRAMSET(s
, p
);
1903 return (write
) ? dirty
: 1;
1906 static void wo_tomato(char *url
)
1916 // _dprintf("tomato.cgi\n");
1918 red
= webcgi_safeget("_redirect", "");
1919 if (!*red
) send_header(200, NULL
, mime_html
, 0);
1921 commit
= atoi(webcgi_safeget("_commit", "1"));
1922 force_commit
= atoi(webcgi_safeget("_force_commit", "0"));
1923 ajax
= atoi(webcgi_safeget("_ajax", "0"));
1925 nvset
= atoi(webcgi_safeget("_nvset", "1"));
1927 if (!save_variables(0)) {
1929 web_printf("@msg:%s", resmsg_get());
1932 parse_asp("error.asp");
1936 commit
= save_variables(1) && commit
;
1938 resmsg_set("Settings saved.");
1941 rboot
= atoi(webcgi_safeget("_reboot", "0"));
1943 parse_asp("reboot.asp");
1947 web_printf("@msg:%s", resmsg_get());
1949 else if (atoi(webcgi_safeget("_moveip", "0"))) {
1950 parse_asp("saved-moved.asp");
1953 parse_asp("saved.asp");
1957 if (commit
|| force_commit
) {
1958 _dprintf("commit from tomato.cgi\n");
1962 if ((v
= webcgi_get("_service")) != NULL
&& *v
!= 0) {
1964 if (ajax
) web_printf(" Some services are being restarted...");
1977 for (i
= atoi(webcgi_safeget("_sleep", "0")); i
> 0; --i
) sleep(1);
1979 if (*red
) redirect(red
);
1989 // ----------------------------------------------------------------------------
1992 static void wo_update(char *url
)
1994 const aspapi_t
*api
;
2000 if ((name
= webcgi_get("exec")) != NULL
) {
2001 for (api
= aspapi
; api
->name
; ++api
) {
2002 if (strcmp(api
->name
, name
) == 0) {
2003 for (argc
= 0; argc
< 16; ++argc
) {
2004 sprintf(s
, "arg%d", argc
);
2005 if ((argv
[argc
] = (char *)webcgi_get(s
)) == NULL
) break;
2007 api
->exec(argc
, argv
);
2014 static void wo_service(char *url
)
2018 exec_service(webcgi_safeget("_service", ""));
2020 if ((n
= atoi(webcgi_safeget("_sleep", "2"))) <= 0) n
= 2;
2026 static void wo_shutdown(char *url
)
2028 parse_asp("shutdown.asp");
2035 static void wo_nvcommit(char *url
)
2037 parse_asp("saved.asp");