Провайдер, у которого я обслуживаю свою рабочую услугу, выдает абонентам роутеры в бесплатное пользование на период заключения договора.
Когда роутер выдан, механика его прошивает, вводя логин, пароль, айпи и настраивая wifi. И всё бы ничего, но есть особо умные пользователи, которые любят настраивать устройство, а на роутерах есть кнопка сброса к заводским настройкам, после манипуляций с которой либо абонент шёл в офис, либо к абоненту шёл механик для повторной настройки устройства.
Чаша терпения была на исходе и последней каплей стал TL-WR841N, большую партию которого закупил провайдер.
Мало того, что педаль сброса не утоплена (а, наоборот, расположена таким образом, что ее можно нажать витым кабелем или просто тем мусором, в котором иногда оказываются абонентские устройства), так еще производитель совместил WPS и RESET на одну кнопку, что мягко говоря замечательное решение.
Был еще один болевой момент - на родной прошивке TP-Link роутер не всегда восстанавливал соединение после потери соединения.
Конечно, у нашего решения есть и свои недостатки, такие как невозможность смены паролей, но мы готовы с этим мириться.
Что ж.
Начнем «лечение».
Я не испытываю большой любви к Linux, но сразу получить все необходимые инструменты под FreeBSD мне не удалось, а в ожидании возни с исходниками прошивки, заточенной под Linux, мне тоже не хотелось экспериментировать много на флэшке, поэтому все описанное ниже сделано под
Важным нюансом является x86_64 , но об этом позже.# uname -a Linux debian64 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux
Наша финальная задача — загрузить на роутер по умолчанию прошивку, содержащую пользовательские данные, которые будут восстановлены после сброса настроек до заводских.
При этом решаем проблему восстановления соединения после сбоя соединения.
Последняя проблема не возникает ДД-ВРТ , а наличие исходных кодов делает его особенно привлекательным.
Для начала просто выберите прошивка под нашей редакцией.
Загружаем его в роутер, делаем тестовые настройки и ищем, где они хранятся.
После небольшого прогрева root@DD-WRT:~# grep -rn test00 /etc
/etc/defaults.bin:160:
ppp_usernametest001
root@DD-WRT:~#
Выясняем, что они хранятся в файле /etc/defaults.bin, который мы и будем редактировать.
Отсюда берутся настройки по умолчанию.
Немного погуглив, находим варианты редактирования его шестнадцатеричным редактором, но возиться в шестнадцатеричном редакторе с исходниками - не наш метод. У нас есть три пути: — собрать всю прошивку из исходников; — собрать из исходников только defaults.bin и разобрать оригинальную прошивку и заменить ее; — создайте самостоятельно defaults.bin и снова замените его в оригинальной прошивке.
Все варианты жизнеспособны, и хотя мы пойдем по 3-му пути, затронем и первые 2. Для того, чтобы сделать прошивку из исходников, мы должны помнить, что нам нужно скомпилировать ее под архитектуру процессора, в нашем случае MIPS, и в этом случае мы автоматически получаем геморрой с кросс-компиляцией.
На сайте dd-wrt для этого есть готовые тулчейны, но все ссылки на них отвечают «404 Not Found».
Нам удалось их найти - ftp.dd-wrt.com/toolchains/toolchains.tar.xz .
Н.
Б.
: все тулчейны построены под x86_64, поэтому систему для экспериментов лучше изначально устанавливать на x86_64 Мы не будем останавливаться на кросс-компиляции; эта тема раскрыта в вики dd-wrt Но мы идем своим путем.
Начинаем с разборки прошивки.
Скачать Комплект модификации прошивки # git clone https://code.google.com/p/firmware-mod-kit/
Разберем нашу прошивку # firmware-mod-kit/extract-firmware.sh tl-wr841nd-webflash.bin .
/working_directory/
Теперь подготовим наш defaults.bin.
Получение исходников dd-wrt # svn co svn://svn.dd-wrt.com/DD-WRT
Собственно из всех исходников нам нужно всего 2 файла # find .
/src/router/services/ -name defaults.c .
/src/router/services/sysinit/defaults.c .
/src/router/services/bin/defaults.c
Первый из которых содержит заполненную структуру srouter_defaults, а второй загоняет ее в defaults.bin.
Давайте изменим эти файлы под себя:
Состав: defaults.c #include <epivers.h>
#include <string.h>
#include <bcmnvram.h>
#include <typedefs.h>
#include <wlioctl.h>
#include <stdio.h>
#include <ezc.h>
#include <code_pattern.h>
#include <cy_conf.h>
struct nvram_tuple srouter_defaults[] = {
{"nvram_ver", "3", 0},
{"router_style", "elegant", 0},
{"os_name", "", 0},
{"os_version", "4.150.10.5", 0},
{"os_date", "Jul 9 2014", 0},
{"ct_modules", "", 0},
{"wait_time", "5", 0},
{"timer_interval", "3600", 0},
{"time_zone", "Europe/Minsk", 0},
{"ntp_server", "", 0},
{"refresh_time", "3", 0},
{"auth_limit", "180", 0},
{"log_level", "0", 0},
{"ezc_enable", "1", 0},
{"ezc_version", "2", 0},
{"is_default", "1", 0},
{"os_server", "", 0},
{"stats_server", "", 0},
{"console_loglevel", "7", 0},
{"fw_disable", "0", 0},
{"log_enable", "0", 0},
{"log_ipaddr", "0", 0},
{"lan_ifname", "", 0},
{"lan_ifnames", "", 0},
{"lan_hwnames", "", 0},
{"lan_hwaddr", "", 0},
{"wl0_ifname", "eth1", 0},
{"lan_proto", "dhcp", 0},
{"lan_ipaddr", "192.168.1.1", 0},
{"lan_netmask", "255.255.255.0", 0},
{"lan_gateway", "0.0.0.0", 0},
{"sv_localdns", "0.0.0.0", 0},
{"lan_stp", "0", 0},
{"lan_wins", "", 0},
{"lan_domain", "", 0},
{"lan_lease", "86400", 0},
{"wan_dial", "0", 0},
{"wan_ifname", "", 0},
{"wan_ifname2", "", 0},
{"wan_ifnames", "", 0},
{"wan_default", "", 0},
{"wan_hwname", "", 0},
{"wan_hwaddr", "", 0},
{"wan_vdsl", "0", 0},
{"dtag_vlan8", "0", 0},
{"wan_proto", "pptp", 0},
{"wan_ipaddr", "10.34.1.231", 0},
{"wan_netmask", "255.255.240.0", 0},
{"wan_gateway", "10.34.1.1", 0},
{"pptp_wan_gateway", "10.34.1.1", 0},
{"l2tp_wan_gateway", "0.0.0.0", 0},
{"wan_dns", "77.88.8.8 8.8.8.8 8.8.4.4", 0},
{"wan_wins", "0.0.0.0", 0},
{"wan_dualaccess", "1", 0},
{"wan_hostname", "", 0},
{"wan_domain", "", 0},
{"wan_lease", "86400", 0},
{"static_route", "", 0},
{"static_route_name", "", 0},
{"ses_enable", "1", 0},
{"ses_event", "2", 0},
{"ses_button", "0", 0},
{"ses_script", "", 0},
{"wan_primary", "1", 0},
{"wan_unit", "0", 0},
{"filter_maclist", "", 0},
{"filter_macmode", "deny", 0},
{"filter_client0", "", 0},
{"filter_port", "", 0},
{"filter_rule1", "", 0},
{"filter_rule2", "", 0},
{"filter_rule3", "", 0},
{"filter_rule4", "", 0},
{"filter_rule5", "", 0},
{"filter_rule6", "", 0},
{"filter_rule7", "", 0},
{"filter_rule8", "", 0},
{"filter_rule9", "", 0},
{"filter_rule10", "", 0},
{"filter_tod1", "", 0},
{"filter_tod2", "", 0},
{"filter_tod3", "", 0},
{"filter_tod4", "", 0},
{"filter_tod5", "", 0},
{"filter_tod6", "", 0},
{"filter_tod7", "", 0},
{"filter_tod8", "", 0},
{"filter_tod9", "", 0},
{"filter_tod10", "", 0},
{"filter_tod_buf1", "", 0},
{"filter_tod_buf2", "", 0},
{"filter_tod_buf3", "", 0},
{"filter_tod_buf4", "", 0},
{"filter_tod_buf5", "", 0},
{"filter_tod_buf6", "", 0},
{"filter_tod_buf7", "", 0},
{"filter_tod_buf8", "", 0},
{"filter_tod_buf9", "", 0},
{"filter_tod_buf10", "", 0},
{"filter_ip_grp1", "", 0},
{"filter_ip_grp2", "", 0},
{"filter_ip_grp3", "", 0},
{"filter_ip_grp4", "", 0},
{"filter_ip_grp5", "", 0},
{"filter_ip_grp6", "", 0},
{"filter_ip_grp7", "", 0},
{"filter_ip_grp8", "", 0},
{"filter_ip_grp9", "", 0},
{"filter_ip_grp10", "", 0},
{"filter_mac_grp1", "", 0},
{"filter_mac_grp2", "", 0},
{"filter_mac_grp3", "", 0},
{"filter_mac_grp4", "", 0},
{"filter_mac_grp5", "", 0},
{"filter_mac_grp6", "", 0},
{"filter_mac_grp7", "", 0},
{"filter_mac_grp8", "", 0},
{"filter_mac_grp9", "", 0},
{"filter_mac_grp10", "", 0},
{"filter_web_host1", "", 0},
{"filter_web_host2", "", 0},
{"filter_web_host3", "", 0},
{"filter_web_host4", "", 0},
{"filter_web_host5", "", 0},
{"filter_web_host6", "", 0},
{"filter_web_host7", "", 0},
{"filter_web_host8", "", 0},
{"filter_web_host9", "", 0},
{"filter_web_host10", "", 0},
{"filter_web_host11", "", 0},
{"filter_web_host12", "", 0},
{"filter_web_host13", "", 0},
{"filter_web_host14", "", 0},
{"filter_web_url1", "", 0},
{"filter_web_url2", "", 0},
{"filter_web_url3", "", 0},
{"filter_web_url4", "", 0},
{"filter_web_url5", "", 0},
{"filter_web_url6", "", 0},
{"filter_web_url7", "", 0},
{"filter_web_url8", "", 0},
{"filter_web_url9", "", 0},
{"filter_web_url10", "", 0},
{"filter_web_url11", "", 0},
{"filter_web_url12", "", 0},
{"filter_web_url13", "", 0},
{"filter_web_url14", "", 0},
{"filter_web_url15", "", 0},
{"filter_port_grp1", "", 0},
{"filter_port_grp2", "", 0},
{"filter_port_grp3", "", 0},
{"filter_port_grp4", "", 0},
{"filter_port_grp5", "", 0},
{"filter_port_grp6", "", 0},
{"filter_port_grp7", "", 0},
{"filter_port_grp8", "", 0},
{"filter_port_grp9", "", 0},
{"filter_port_grp10", "", 0},
{"filter_dport_grp1", "", 0},
{"filter_dport_grp2", "", 0},
{"filter_dport_grp3", "", 0},
{"filter_dport_grp4", "", 0},
{"filter_dport_grp5", "", 0},
{"filter_dport_grp6", "", 0},
{"filter_dport_grp7", "", 0},
{"filter_dport_grp8", "", 0},
{"filter_dport_grp9", "", 0},
{"filter_dport_grp10", "", 0},
{"filter_services", "", 0},
{"filter_services_1", "", 0},
{"dmz_enable", "0", 0},
{"dmz_ipaddr", "0", 0},
{"autofw_port0", "", 0},
{"dhcp_start", "100", 0},
{"dhcp_num", "50", 0},
{"dhcp_lease", "1440", 0},
{"dhcp_domain", "wan", 0},
{"dhcp_wins", "wan", 0},
{"wan_get_dns", "", 0},
{"remote_ip_any", "0", 0},
{"remote_ip", "123.123.123.1 254", 0},
{"http_wanport", "8080", 0},
{"http_lanport", "80", 0},
{"http_enable", "1", 0},
{"http_method", "post", 0},
{"wl0_web_filter", "0", 0},
{"wl1_web_filter", "0", 0},
{"pppoe_ifname", "", 0},
{"ppp_username", "test001", 0},
{"ppp_passwd", "pass001", 0},
{"ppp_idletime", "5", 0},
{"ppp_keepalive", "0", 0},
{"ppp_demand", "0", 0},
{"ppp_redialperiod", "30", 0},
{"ppp_service", "", 0},
{"ppp_ac", "", 0},
{"ppp_static", "0", 0},
{"ppp_static_ip", "", 0},
{"ppp_get_ac", "", 0},
{"ppp_get_srv", "", 0},
{"ppp_compression", "0", 0},
{"ppp_mppe", "", 0},
{"ppp_mlppp", "0", 0},
{"wl0_nbw_cap", "1", 0},
{"wl1_nbw_cap", "1", 0},
{"wl0_nbw", "20", 0},
{"wl1_nbw", "20", 0},
{"wl0_bw_cap", "255", 0},
{"wl1_bw_cap", "255", 0},
{"wl0_nctrlsb", "lower", 0},
{"wl1_nctrlsb", "lower", 0},
{"wl0_nband", "0", 0},
{"wl1_nband", "0", 0},
{"wl0_nmcsidx", "-1", 0},
{"wl1_nmcsidx", "-1", 0},
{"wl0_nmode", "-1", 0},
{"wl1_nmode", "-1", 0},
{"wl0_nreqd", "0", 0},
{"wl1_nreqd", "0", 0},
{"wl0_vlan_prio_mode", "off", 0},
{"wl1_vlan_prio_mode", "off", 0},
{"wl0_leddc", "0x640000", 0},
{"wl_rxstreams", "0", 0},
{"wl_txstreams", "0", 0},
{"wl0_sta_retry_time", "5", 0},
{"wl_distance", "2000", 0},
{"wl_ifname", "", 0},
{"wl_hwaddr", "", 0},
{"wl_phytype", "g", 0},
{"wl_corerev", "", 0},
{"wl_phytypes", "", 0},
{"wl_radioids", "", 0},
{"wl_shortslot", "auto", 0},
{"wl1_shortslot", "auto", 0},
{"wl_ssid", "Nord dd-wrt", 0},
{"wl0_ssid", "Nord dd-wrt", 0},
{"wl1_ssid", "Nord dd-wrt", 0},
{"wl0.1_ssid", "", 0},
{"wl0.2_ssid", "", 0},
{"wl0.3_ssid", "", 0},
{"wl0_bridged", "1", 0},
{"wl0.1_bridged", "1", 0},
{"wl0.2_bridged", "1", 0},
{"wl0.3_bridged", "1", 0},
{"wl0_ipaddr", "0.0.0.0", 0},
{"wl0.1_ipaddr", "0.0.0.0", 0},
{"wl0.2_ipaddr", "0.0.0.0", 0},
{"wl0.3_ipaddr", "0.0.0.0", 0},
{"wl0_netmask", "0.0.0.0", 0},
{"wl0.1_netmask", "0.0.0.0", 0},
{"wl0.2_netmask", "0.0.0.0", 0},
{"wl0.3_netmask", "0.0.0.0", 0},
{"wl_radio", "1", 0},
{"wl0_radio", "1", 0},
{"wl0_closed", "0", 0},
{"wl0.1_closed", "0", 0},
{"wl0.2_closed", "0", 0},
{"wl0.3_closed", "0", 0},
{"wl_ap_isolate", "0", 0},
{"wl1_ap_isolate", "0", 0},
{"wl_mode", "ap", 0},
{"wl0_mode", "ap", 0},
{"wl1_mode", "ap", 0},
{"wl_lazywds", "0", 0},
{"wl_wds", "", 0},
{"wl_wep", "disabled", 0},
{"wl_crypto", "off", 0},
{"wl_auth", "0", 0},
{"wl0_crypto", "tkip+aes", 0},
{"ath0_crypto", "tkip+aes", 0},
{"wl0_auth", "0", 0},
{"wl1_auth", "0", 0},
{"wl0_key", "1", 0},
{"wl0_key1", "", 0},
{"wl0_key2", "", 0},
{"wl0_key3", "", 0},
{"wl0_key4", "", 0},
{"wl0.1_crypto", "off", 0},
{"wl0.1_auth", "0", 0},
{"wl0.1_key", "1", 0},
{"wl0.1_key1", "", 0},
{"wl0.1_key2", "", 0},
{"wl0.1_key3", "", 0},
{"wl0.1_key4", "", 0},
{"wl0.2_crypto", "off", 0},
{"wl0.2_auth", "0", 0},
{"wl0.2_key", "1", 0},
{"wl0.2_key1", "", 0},
{"wl0.2_key2", "", 0},
{"wl0.2_key3", "", 0},
{"wl0.2_key4", "", 0},
{"wl0.3_crypto", "off", 0},
{"wl0.3_auth", "0", 0},
{"wl0.3_key", "1", 0},
{"wl0.3_key1", "", 0},
{"wl0.3_key2", "", 0},
{"wl0.3_key3", "", 0},
{"wl0.3_key4", "", 0},
{"wl_macmode", "disabled", 0},
{"wl_macmode1", "disabled", 0},
{"wl0_channel", "6", 0},
{"wl_reg_mode", "off", 0},
{"wl_dfs_preism", "60", 0},
{"wl_dfs_postism", "60", 0},
{"wl_rate", "0", 0},
{"wl1_rate", "0", 0},
{"wl_mrate", "0", 0},
{"wl_rateset", "default", 0},
{"wl1_rateset", "default", 0},
{"wl_frag", "2346", 0},
{"wl1_frag", "2346", 0},
{"wl_rts", "2347", 0},
{"wl1_rts", "2347", 0},
{"wl_dtim", "1", 0},
{"wl1_dtim", "1", 0},
{"wl_bcn", "100", 0},
{"wl1_bcn", "100", 0},
{"wl_plcphdr", "long", 0},
{"wl1_plcphdr", "long", 0},
{"wl_net_mode", "mixed", 0},
{"wl0_net_mode", "mixed", 0},
{"wl1_net_mode", "mixed", 0},
{"wl0_gmode", "1", 0},
{"wl_gmode_protection", "auto", 0},
{"wl1_gmode_protection", "auto", 0},
{"wl_nmode_protection", "auto", 0},
{"wl_frameburst", "off", 0},
{"wl1_frameburst", "off", 0},
{"wl_infra", "1", 0},
{"wl_passphrase", "", 0},
{"wl_wep_bit", "64", 0},
{"wl_wep_buf", "", 0},
{"wl_wep_gen", "", 0},
{"wl_wep_last", "", 0},
{"wl_active_mac", "", 0},
{"wl_mac_list", "", 0},
{"wl_mac_deny", "", 0},
{"security_mode", "disabled", 0},
{"security_mode_last", "", 0},
{"wl0_auth_mode", "disabled", 0},
//{"wl0_akm", "disabled", 0},
{"wl0_akm", "psk psk2", 0},
{"ath0_akm", "psk psk2", 0},
{"wl0_wpa_psk", "1234567890", 0},
{"ath0_wpa_psk", "1234567890", 0},
{"wl0_wpa_gtk_rekey", "3600", 0},
{"wl0_radius_port", "1812", 0},
{"wl0_radius_ipaddr", "", 0},
{"wl0_radius_key", "", 0},
{"wl0_security_mode", "psk2", 0},
{"ath0_security_mode", "psk2", 0},
{"wl0.1_auth_mode", "disabled", 0},
{"wl0.1_akm", "disabled", 0},
{"wl0.1_wpa_psk", "", 0},
{"wl0.1_wpa_gtk_rekey", "3600", 0},
{"wl0.1_radius_port", "1812", 0},
{"wl0.1_radius_ipaddr", "", 0},
{"wl0.1_radius_key", "", 0},
{"wl0.2_auth_mode", "disabled", 0},
{"wl0.2_akm", "disabled", 0},
{"wl0.2_wpa_psk", "", 0},
{"wl0.2_wpa_gtk_rekey", "3600", 0},
{"wl0.2_radius_port", "1812", 0},
{"wl0.2_radius_ipaddr", "", 0},
{"wl0.2_radius_key", "", 0},
{"wl0.3_auth_mode", "disabled", 0},
{"wl0.3_akm", "disabled", 0},
{"wl0.3_wpa_psk", "", 0},
{"wl0.3_wpa_gtk_rekey", "3600", 0},
{"wl0.3_radius_port", "1812", 0},
{"wl0.3_radius_ipaddr", "", 0},
{"wl0.3_radius_key", "", 0},
{"wl0_radius_override", "1", 0},
{"wl0_max_unauth_users", "0", 0},
{"wl0_radmacpassword", "0", 0},
{"wl_afterburner", "off", 0},
{"wl1_afterburner", "off", 0},
{"wl_unit", "0", 0},
{"restore_defaults", "0", 0},
{"router_name", "DD-WRT", 0},
{"ntp_mode", "auto", 0},
{"pptp_server_ip", "", 0},
{"pptp_get_ip", "", 0},
{"filter", "on", 0},
{"block_wan", "1", 0},
{"block_ident", "1", 0},
{"block_proxy", "0", 0},
{"block_java", "0", 0},
{"block_activex", "0", 0},
{"block_cookie", "0", 0},
{"block_multicast", "1", 0},
{"block_loopback", "0", 0},
{"block_snmp", "1", 0},
{"ipsec_pass", "1", 0},
{"pptp_pass", "1", 0},
{"l2tp_pass", "1", 0},
{"limit_ssh", "0", 0},
{"limit_telnet", "0", 0},
{"limit_pptp", "0", 0},
{"remote_management", "1", 0},
{"mtu_enable", "0", 0},
{"wan_mtu", "1500", 0},
{"forward_port", "", 0},
{"forward_spec", "", 0},
{"port_trigger", "", 0},
{"wk_mode", "gateway", 0},
{"dr_setting", "0", 0},
{"dr_lan_tx", "0", 0},
{"dr_lan_rx", "0", 0},
{"dr_wan_tx", "0", 0},
{"dr_wan_rx", "0", 0},
{"mac_clone_enable", "0", 0},
{"def_hwaddr", "00:00:00:00:00:00", 0},
{"port_swap", "0", 0},
{"ddns_enable", "0", 0},
{"ddns_wan_ip", "1", 0},
{"ddns_username", "", 0},
{"ddns_passwd", "", 0},
{"ddns_hostname", "", 0},
{"ddns_dyndnstype", "", 0},
{"ddns_wildcard", "", 0},
{"ddns_username_2", "", 0},
{"ddns_passwd_2", "", 0},
{"ddns_hostname_2", "", 0},
{"ddns_username_3", "", 0},
{"ddns_passwd_3", "", 0},
{"ddns_hostname_3", "", 0},
{"ddns_username_4", "", 0},
{"ddns_passwd_4", "", 0},
{"ddns_hostname_4", "", 0},
{"ddns_username_5", "", 0},
{"ddns_passwd_5", "", 0},
{"ddns_hostname_5", "", 0},
{"ddns_custom_5", "", 0},
{"ddns_conf", "", 0},
{"ddns_url", "", 0},
{"ddns_username_6", "", 0},
{"ddns_passwd_6", "", 0},
{"ddns_hostname_6", "", 0},
{"ddns_dyndnstype_6", "", 0},
{"ddns_wildcard_6", "", 0},
{"ddns_username_7", "", 0},
{"ddns_passwd_7", "", 0},
{"ddns_hostname_7", "", 0},
{"ddns_wildcard_7", "", 0},
{"ddns_username_8", "", 0},
{"ddns_passwd_8", "", 0},
{"ddns_hostname_8", "", 0},
{"ddns_enable_buf", "", 0},
{"ddns_username_buf", "", 0},
{"ddns_passwd_buf", "", 0},
{"ddns_hostname_buf", "", 0},
{"ddns_force", "10", 0},
{"ddns_cache", "", 0},
{"ddns_time", "", 0},
{"skip_amd_check", "0", 0},
{"skip_intel_check", "0", 0},
{"l2tp_use_dhcp", "1", 0},
{"l2tp_server_ip", "", 0},
{"l2tp_server_name", "", 0},
{"l2tp_get_ip", "", 0},
{"l2tp_req_chap", "yes", 0},
{"l2tp_ref_pap", "yes", 0},
{"l2tp_req_auth", "yes", 0},
{"wan_gateway_buf", "0.0.0.0", 0},
{"hb_server_ip", "", 0},
{"hb_server_domain", "", 0},
{"samba_mount", "0", 0},
{"rflow_enable", "0", 0},
{"info_passwd", "0", 0},
{"macupd_enable", "0", 0},
{"wl_radauth", "0", 0},
{"rc_startup", "", 0},
{"rc_firewall", "", 0},
{"rc_custom", "", 0},
{"rc_shutdown", "", 0},
{"wl0_txpwr", "71", 0},
{"wl1_txpwr", "71", 0},
{"wl0_txant", "3", 0},
{"wl0_antdiv", "3", 0},
{"wl1_txant", "3", 0},
{"wl1_antdiv", "3", 0},
{"apwatchdog_enable", "0", 0},
{"apwatchdog_interval", "15", 0},
{"boot_wait", "on", 0},
{"cron_enable", "1", 0},
{"cron_jobs", "", 0},
{"dhcpd_options", "", 0},
{"dhcpd_usenvram", "0", 0},
{"local_dns", "0", 0},
{"dnsmasq_no_dns_rebind", "1", 0},
{"dnsmasq_enable", "1", 0},
{"dnsmasq_options", "", 0},
{"nas_enable", "1", 0},
{"ntp_enable", "1", 0},
{"pptpd_enable", "0", 0},
{"pptpd_forcemppe", "1", 0},
{"pptpd_bcrelay", "0", 0},
{"pptpd_lip", "", 0},
{"pptpd_rip", "", 0},
{"pptpd_auth", "", 0},
{"pptpd_radius", "0", 0},
{"pptpd_radserver", "0.0.0.0", 0},
{"pptpd_radport", "1812", 0},
{"pptpd_acctport", "1813", 0},
{"pptpd_radpass", "", 0},
{"pptpd_conn", "64", 0},
{"pptp_reorder", "0", 0},
{"pptp_iptv", "0", 0},
{"pptp_extraoptions", "", 0},
{"pptpd_mtu", "1436", 0},
{"pptpd_mru", "1436", 0},
{"pptp_encrypt", "0", 0},
{"resetbutton_enable", "1", 0},
{"telnetd_enable", "1", 0},
{"ipv6_enable", "0", 0},
{"radvd_enable", "0", 0},
{"radvd_conf", "", 0},
{"remote_mgt_telnet", "1", 0},
{"telnet_wanport", "23", 0},
{"syslogd_enable", "0", 0},
{"syslogd_rem_ip", "", 0},
{"wl0_wds1_enable", "0", 0},
{"wl0_wds2_enable", "0", 0},
{"wl0_wds3_enable", "0", 0},
{"wl0_wds4_enable", "0", 0},
{"wl0_wds5_enable", "0", 0},
{"wl0_wds6_enable", "0", 0},
{"wl0_wds7_enable", "0", 0},
{"wl0_wds8_enable", "0", 0},
{"wl0_wds9_enable", "0", 0},
{"wl0_wds10_enable", "0", 0},
{"wl0_wds1_hwaddr", "", 0},
{"wl0_wds2_hwaddr", "", 0},
{"wl0_wds3_hwaddr", "", 0},
{"wl0_wds4_hwaddr", "", 0},
{"wl0_wds5_hwaddr", "", 0},
{"wl0_wds6_hwaddr", "", 0},
{"wl0_wds7_hwaddr", "", 0},
{"wl0_wds8_hwaddr", "", 0},
{"wl0_wds9_hwaddr", "", 0},
{"wl0_wds10_hwaddr", "", 0},
{"wl0_wds1_ipaddr", "", 0},
{"wl0_wds2_ipaddr", "", 0},
{"wl0_wds3_ipaddr", "", 0},
{"wl0_wds4_ipaddr", "", 0},
{"wl0_wds5_ipaddr", "", 0},
{"wl0_wds6_ipaddr", "", 0},
{"wl0_wds7_ipaddr", "", 0},
{"wl0_wds8_ipaddr", "", 0},
{"wl0_wds9_ipaddr", "", 0},
{"wl0_wds10_ipaddr", "", 0},
{"wl0_wds1_netmask", "", 0},
{"wl0_wds2_netmask", "", 0},
{"wl0_wds3_netmask", "", 0},
{"wl0_wds4_netmask", "", 0},
{"wl0_wds5_netmask", "", 0},
{"wl0_wds6_netmask", "", 0},
{"wl0_wds7_netmask", "", 0},
{"wl0_wds8_netmask", "", 0},
{"wl0_wds9_netmask", "", 0},
{"wl0_wds10_netmask", "", 0},
{"wl0_wds1_desc", "", 0},
{"wl0_wds2_desc", "", 0},
{"wl0_wds3_desc", "", 0},
{"wl0_wds4_desc", "", 0},
{"wl0_wds5_desc", "", 0},
{"wl0_wds6_desc", "", 0},
{"wl0_wds7_desc", "", 0},
{"wl0_wds8_desc", "", 0},
{"wl0_wds9_desc", "", 0},
{"wl0_wds10_desc", "", 0},
{"wl0_wds1_ospf", "", 0},
{"wl0_wds2_ospf", "", 0},
{"wl0_wds3_ospf", "", 0},
{"wl0_wds4_ospf", "", 0},
{"wl0_wds5_ospf", "", 0},
{"wl0_wds6_ospf", "", 0},
{"wl0_wds7_ospf", "", 0},
{"wl0_wds8_ospf", "", 0},
{"wl0_wds9_ospf", "", 0},
{"wl0_wds10_ospf", "", 0},
{"wl1_wds1_enable", "0", 0},
{"wl1_wds2_enable", "0", 0},
{"wl1_wds3_enable", "0", 0},
{"wl1_wds4_enable", "0", 0},
{"wl1_wds5_enable", "0", 0},
{"wl1_wds6_enable", "0", 0},
{"wl1_wds7_enable", "0", 0},
{"wl1_wds8_enable", "0", 0},
{"wl1_wds9_enable", "0", 0},
{"wl1_wds10_enable", "0", 0},
{"wl1_wds1_hwaddr", "", 0},
{"wl1_wds2_hwaddr", "", 0},
{"wl1_wds3_hwaddr", "", 0},
{"wl1_wds4_hwaddr", "", 0},
{"wl1_wds5_hwaddr", "", 0},
{"wl1_wds6_hwaddr", "", 0},
{"wl1_wds7_hwaddr", "", 0},
{"wl1_wds8_hwaddr", "", 0},
{"wl1_wds9_hwaddr", "", 0},
{"wl1_wds10_hwaddr", "", 0},
{"wl1_wds1_ipaddr", "", 0},
{"wl1_wds2_ipaddr", "", 0},
{"wl1_wds3_ipaddr", "", 0},
{"wl1_wds4_ipaddr", "", 0},
{"wl1_wds5_ipaddr", "", 0},
{"wl1_wds6_ipaddr", "", 0},
{"wl1_wds7_ipaddr", "", 0},
{"wl1_wds8_ipaddr", "", 0},
{"wl1_wds9_ipaddr", "", 0},
{"wl1_wds10_ipaddr", "", 0},
{"wl1_wds1_netmask", "", 0},
{"wl1_wds2_netmask", "", 0},
{"wl1_wds3_netmask", "", 0},
{"wl1_wds4_netmask", "", 0},
{"wl1_wds5_netmask", "", 0},
{"wl1_wds6_netmask", "", 0},
{"wl1_wds7_netmask", "", 0},
{"wl1_wds8_netmask", "", 0},
{"wl1_wds9_netmask", "", 0},
{"wl1_wds10_netmask", "", 0},
{"wl1_wds1_desc", "", 0},
{"wl1_wds2_desc", "", 0},
{"wl1_wds3_desc", "", 0},
{"wl1_wds4_desc", "", 0},
{"wl1_wds5_desc", "", 0},
{"wl1_wds6_desc", "", 0},
{"wl1_wds7_desc", "", 0},
{"wl1_wds8_desc", "", 0},
{"wl1_wds9_desc", "", 0},
{"wl1_wds10_desc", "", 0},
{"wl1_wds1_ospf", "", 0},
{"wl1_wds2_ospf", "", 0},
{"wl1_wds3_ospf", "", 0},
{"wl1_wds4_ospf", "", 0},
{"wl1_wds5_ospf", "", 0},
{"wl1_wds6_ospf", "", 0},
{"wl1_wds7_ospf", "", 0},
{"wl1_wds8_ospf", "", 0},
{"wl1_wds9_ospf", "", 0},
{"wl1_wds10_ospf", "", 0},
{"wl0_br1_enable", "0", 0},
{"wl0_br1_nat", "0", 0},
{"wl1_br1_enable", "0", 0},
{"wl1_br1_nat", "0", 0},
{"wl0_wds", "", 0},
{"wl0_wds0", "", 0},
{"wl0_wds1", "", 0},
{"wl0_wds2", "", 0},
{"wl0_wds3", "", 0},
{"wl0_wds4", "", 0},
{"wl0_wds5", "", 0},
{"wl0_wds6", "", 0},
{"wl0_wds7", "", 0},
{"wl0_wds8", "", 0},
{"wl0_wds9", "", 0},
{"wl1_wds", "", 0},
{"wl1_wds0", "", 0},
{"wl1_wds1", "", 0},
{"wl1_wds2", "", 0},
{"wl1_wds3", "", 0},
{"wl1_wds4", "", 0},
{"wl1_wds5", "", 0},
{"wl1_wds6", "", 0},
{"wl1_wds7", "", 0},
{"wl1_wds8", "", 0},
{"wl1_wds9", "", 0},
{"wl0_wds0_if", "", 0},
{"wl0_wds1_if", "", 0},
{"wl0_wds2_if", "", 0},
{"wl0_wds3_if", "", 0},
{"wl0_wds4_if", "", 0},
{"wl0_wds5_if", "", 0},
{"wl0_wds6_if", "", 0},
{"wl0_wds7_if", "", 0},
{"wl0_wds8_if", "", 0},
{"wl0_wds9_if", "", 0},
{"wl0_wds10_if", "", 0},
{"wl1_wds0_if", "", 0},
{"wl1_wds1_if", "", 0},
{"wl1_wds2_if", "", 0},
{"wl1_wds3_if", "", 0},
{"wl1_wds4_if", "", 0},
{"wl1_wds5_if", "", 0},
{"wl1_wds6_if", "", 0},
{"wl1_wds7_if", "", 0},
{"wl1_wds8_if", "", 0},
{"wl1_wds9_if", "", 0},
{"wl1_wds10_if", "", 0},
{"wds0.1", "", 0},
{"wds0.2", "", 0},
{"wds0.3", "", 0},
{"wds0.4", "", 0},
{"wds0.5", "", 0},
{"wds0.6", "", 0},
{"wds0.7", "", 0},
{"wds0.8", "", 0},
{"wds0.9", "", 0},
{"wds0.10", "", 0},
{"wds0.11", "", 0},
{"wds0.12", "", 0},
{"wds0.13", "", 0},
{"wds0.14", "", 0},
{"wds0.15", "", 0},
{"wds0.16", "", 0},
{"wds1.1", "", 0},
{"wds1.2", "", 0},
{"wds1.3", "", 0},
{"wds1.4", "", 0},
{"wds1.5", "", 0},
{"wds1.6", "", 0},
{"wds1.7", "", 0},
{"wds1.8", "", 0},
{"wds1.9", "", 0},
{"wds1.10", "", 0},
{"wds1.11", "", 0},
{"wds1.12", "", 0},
{"wds1.13", "", 0},
{"wds1.14", "", 0},
{"wds1.15", "", 0},
{"wds1.16", "", 0},
{"wshaper_enable", "0", 0},
{"wshaper_dev", "WAN", 0},
{"wshaper_downlink", "0", 0},
{"wshaper_uplink", "0", 0},
{"wshaper_nopriohostsrc", "", 0},
{"wshaper_nopriohostdst", "", 0},
{"wshaper_noprioportsrc", "", 0},
{"wshaper_noprioportdst", "", 0},
{"zebra_enable", "1", 0},
{"qos_type", "0", 0},
{"svqos_svcs", "", 0},
{"svqos_ips", "", 0},
{"svqos_macs", "", 0},
{"svqos_port1bw", "FULL", 0},
{"svqos_port2bw", "FULL", 0},
{"svqos_port3bw", "FULL", 0},
{"svqos_port4bw", "FULL", 0},
{"svqos_port1prio", "10", 0},
{"svqos_port2prio", "10", 0},
{"svqos_port3prio", "10", 0},
{"svqos_port4prio", "10", 0},
{"wol_enable", "0", 0},
{"wol_interval", "86400", 0},
{"wol_hostname", "", 0},
{"wol_macs", "", 0},
{"wol_passwd", "", 0},
{"hs_enable", "", 0},
{"hs_exempt", "", 0},
{"hs_urls", "", 0},
{"hs_redirect", "", 0},
{"hs_html", "", 0},
{"hs_image", "", 0},
{"def_whwaddr", "00:00:00:00:00:00", 0},
{"sv_restore_defaults", "0", 0},
{"ospfd_conf", "", 0},
{"zebra_conf", "", 0},
{"ospfd_copt", "0", 0},
{"zebra_copt", "0", 0},
{"zebra_log", "0", 0},
{"dyn_default", "0", 0},
{"altdns1", "", 0},
{"altdns2", "", 0},
{"altdns3", "", 0},
{"log_accepted", "0", 0},
{"log_dropped", "0", 0},
{"log_rejected", "0", 0},
{"port0vlans", "1", 0},
{"port1vlans", "0", 0},
{"port2vlans", "0", 0},
{"port3vlans", "0", 0},
{"port4vlans", "0", 0},
{"port5vlans", "0 1 16", 0},
{"vlans", "0", 0},
{"trunking", "0", 0},
{"manual_boot_nv", "0", 0},
{"status_auth", "1", 0},
{"ipv6_enable", "0", 0},
{"enable_jffs2", "0", 0},
{"clean_jffs2", "0", 0},
{"sys_enable_jffs2", "0", 0},
{"language", "russian", 0},
{"macupd_ip", "0.0.0.0", 0},
{"macupd_port", "2056", 0},
{"macupd_interval", "10", 0},
{"mmc_enable", "0", 0},
{"mmc_enable0", "0", 0},
{"ip_conntrack_max", "4096", 0},
{"ip_conntrack_tcp_timeouts", "3600", 0},
{"ip_conntrack_udp_timeouts", "120", 0},
{"rflow_ip", "0.0.0.0", 0},
{"rflow_port", "2055", 0},
{"rflow_if", "br0", 0},
{"schedule_enable", "0", 0},
{"schedule_time", "3600", 0},
{"schedule_hour_time", "1", 0},
{"schedule_minutes", "0", 0},
{"schedule_hours", "0", 0},
{"schedule_weekdays", "00", 0},
{"smtp_redirect_enable", "0", 0},
{"smtp_redirect_destination", "0.0.0.0", 0},
{"smtp_source_network", "0.0.0.0", 0},
{"wds_watchdog_enable", "0", 0},
{"wds_watchdog_interval_sec", "1000", 0},
{"wds_watchdog_ips", "", 0},
{"dhcpfwd_enable", "0", 0},
{"dhcpfwd_ip", "0.0.0.0", 0},
{"NC_enable", "0", 0},
{"NC_GatewayName", "DD-WRT", 0},
{"NC_HomePage", " http://www.dd-wrt.com ", 0},
{"NC_ExcludePorts", "25", 0},
{"NC_IncludePorts", "", 0},
{"NC_Verbosity", "2", 0},
{"NC_LoginTimeout", "86400", 0},
{"NC_AllowedWebHosts", "", 0},
{"NC_RouteOnly", "0", 0},
{"NC_DocumentRoot", "/www", 0},
{"NC_SplashURL", "", 0},
{"NC_SplashURLTimeout", "21600", 0},
{"NC_MACWhiteList", "", 0},
{"NC_GatewayPort", "5280", 0},
{"NC_GatewayMode", "Open", 0},
{"NC_extifname", "auto", 0},
{"NC_ForcedRedirect", "0", 0},
{"NC_IdleTimeout", "0", 0},
{"NC_MaxMissedARP", "5", 0},
{"NC_RenewTimeout", "0", 0},
{"wl_wme", "on", 0},
{"wl1_wme", "on", 0},
{"wl_wme_sta_bk", "15 1023 7 0 0 off", 0},
{"wl_wme_sta_be", "15 1023 3 0 0 off", 0},
{"wl_wme_sta_vi", "7 15 2 6016 3008 off", 0},
{"wl_wme_sta_vo", "3 7 2 3264 1504 off", 0},
{"wl_wme_ap_bk", "15 1023 7 0 0 off", 0},
{"wl_wme_ap_be", "15 63 3 0 0 off", 0},
{"wl_wme_ap_vi", "7 15 1 6016 3008 off", 0},
{"wl_wme_ap_vo", "3 7 1 3264 1504 off", 0},
{"wl_wme_no_ack", "off", 0},
{"wl_wme_apsd", "on", 0},
{"wl1_wme_sta_bk", "15 1023 7 0 0 off", 0},
{"wl1_wme_sta_be", "15 1023 3 0 0 off", 0},
{"wl1_wme_sta_vi", "7 15 2 6016 3008 off", 0},
{"wl1_wme_sta_vo", "3 7 2 3264 1504 off", 0},
{"wl1_wme_ap_bk", "15 1023 7 0 0 off", 0},
{"wl1_wme_ap_be", "15 63 3 0 0 off", 0},
{"wl1_wme_ap_vi", "7 15 1 6016 3008 off", 0},
{"wl1_wme_ap_vo", "3 7 1 3264 1504 off", 0},
{"wl1_wme_no_ack", "off", 0},
{"wl1_wme_apsd", "on", 0},
{"wl_maxassoc", "128", 0},
{"wl1_maxassoc", "128", 0},
{"wl_wme_txp_be", "7 3 4 2 0", 0},
{"wl_wme_txp_bk", "7 3 4 2 0", 0},
{"wl_wme_txp_vi", "7 3 4 2 0", 0},
{"wl_wme_txp_vo", "7 3 4 2 0", 0},
{"wl1_wme_txp_be", "7 3 4 2 0", 0},
{"wl1_wme_txp_bk", "7 3 4 2 0", 0},
{"wl1_wme_txp_vi", "7 3 4 2 0", 0},
{"wl1_wme_txp_vo", "7 3 4 2 0", 0},
{"dhcp_dnsmasq", "1", 0},
{"dns_dnsmasq", "1", 0},
{"auth_dnsmasq", "1", 0},
{"pptp_use_dhcp", "0", 0},
{"pptp_server_name", "10.10.10.22", 0},
{"forward_entries", "0", 0},
{"forwardspec_entries", "0", 0},
{"trigger_entries", "0", 0},
{"sip_port", "5060", 0},
{"sip_domain", "192.168.1.1", 0},
{"static_leases", "", 0},
{"static_leasenum", "0", 0},
{"dhcpc_vendorclass", "", 0},
{"dhcpc_requestip", "", 0},
{"maskmac", "1", 0},
{"fullswitch", "0", 0},
{"upgrade_delay", "300", 0},
{"fon_enable", "0", 0},
{"pptpd_client_enable", "", 0},
{"pptpd_client_srvip", "", 0},
{"pptpd_client_srvsub", "", 0},
{"pptpd_client_srvsubmsk", "", 0},
{"pptpd_client_srvuser", "", 0},
{"pptpd_client_srvpass", "", 0},
{"pptpd_client_ipparam", "", 0},
{"pptpd_client_mtu", "1436", 0},
{"pptpd_client_mru", "1436", 0},
{"radio0_on_time", "111111111111111111111111", 0},
{"radio0_timer_enable", "0", 0},
{"radio1_on_time", "111111111111111111111111", 0},
{"radio1_timer_enable", "0", 0},
{"wifi_bonding", "0", 0},
{"wifi_display", "wl0", 0},
{"ttraff_enable", "1", 0},
{"ttraff_iface", "", 0},
{"reconnect_enable", "0", 0},
{"reconnect_hours", "0", 0},
{"reconnect_minutes", "0", 0},
{"warn_enabled", "0", 0},
{"warn_connlimit", "500", 0},
{"ptoken", "0", 0}
};
Структура достаточно понятна, недостающие элементы продуманы интуитивно, но что-то особо непонятное можно найти обходным путем.
Практически все названия элементов страниц веб-интерфейса совпадают с названиями параметров нашей структуры, для примера посмотрим код элемента в хроме
Думаю, комментарии излишни.
Сам формирователь bin_defaults.c #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include ".
/defaults.c"
static void
usage(void)
{
Теги: #настройка Linux #dd-wrt tp-link
-
Paint.net V3.5 Бета 1
19 Oct, 24 -
Отладка Приложений С Помощью Dtrace
19 Oct, 24 -
Ответы На Хабр Из Сколково
19 Oct, 24