#!/usr/bin/webif-page >|max=10|$FORM_submit EOF save_repeater_dhcpconf() { if [ "x$FORM_eth0_dhcp" = "x1" ];then cat </etc/dnsmasq.repeater dhcp-leasefile=/var/dhcp.leases dhcp-range=$FORM_eth0_dhcp_from,$FORM_eth0_dhcp_to,12h dhcp-option=1,$FORM_eth0_mask dhcp-option=3,$FORM_eth0_dhcp_gw dhcp-option=6,$FORM_eth0_dhcp_ns read-ethers EOF fi } save_lan_ip_settings() { save_setting fon lan ipaddr "$FORM_ipaddr" save_setting fon lan netmask "$FORM_netmask" save_setting fon lan dhcp "$FORM_dhcp" } save_access_rules() { save_setting fon access lan_wan "$FORM_lan_wan" save_setting fon access hotspot_lan "$FORM_hs_lan" save_setting fon access hotspot_wan "$FORM_hs_wan" save_setting remote method ssh "$FORM_ssh" save_setting remote method ssh_port "$FORM_ssh_port" save_setting remote method rssh "$FORM_rssh" save_setting remote method webif "$FORM_webif" } if [ "$?" != "0" ] then FORM_submit="" fi load_settings fon get_default mode wan mode if empty "$FORM_submit"; then config_load fon get_default ipaddr lan ipaddr get_default netmask lan netmask get_default dhcp lan dhcp get_default bridge wan bridge get_default lan_wan access lan_wan get_default hs_lan access hotspot_lan get_default hs_wan access hotspot_wan config_load router get_default eth0_on eth0 eth0_on get_default eth0_nat eth0 eth0_nat get_default eth0_ip eth0 eth0_ip get_default eth0_mask eth0 eth0_mask get_default eth0_dhcp_from eth0 eth0_dhcp_from get_default eth0_dhcp_to eth0 eth0_dhcp_to get_default eth0_dhcp eth0 eth0_dhcp get_default eth0_dhcp_gw eth0 eth0_dhcp_gw get_default eth0_dhcp_ns eth0 eth0_dhcp_ns config_load remote get_default ssh method ssh get_default ssh_port method ssh_port get_default rssh method rssh get_default webif method webif else config_load fon config_get mode wan mode case $mode in wlan) case $FORM_eth0_on in 3) bridge_switch=required lan_ip_settings=required ;; 1) eth0_ip_settings=required if [ "$FORM_eth0_dhcp" = "1" ]; then eth0_dhcp_settings=required bridge_switch=required fi if [ "$FORM_bridge" = "0" ]; then lan_ip_settings=required fi ;; 0) lan_ip_settings=required ;; esac ;; *) bridge_switch=required lan_ip_settings=required ;; esac case $mode in wlan) validate <>|$bridge_switch|$FORM_bridge ip|FORM_ipaddr|@TR<>|$lan_ip_settings|$FORM_ipaddr ip|FORM_netmask|@TR<>|$lan_ip_settings|$FORM_netmask bool|FORM_dhcp|LAN @TR<>|$lan_ip_settings|$FORM_dhcp ip|FORM_eth0_ip|@TR<>|$eth0_ip_settings|$FORM_eth0_ip ip|FORM_eth0_mask|@TR<>|$eth0_ip_settings|$FORM_eth0_mask bool|FORM_eth0_dhcp|eth0 @TR<>|$eth0_ip_settings|$FORM_eth0_dhcp ip|FORM_eth0_dhcp_from|@TR<>|$eth0_dhcp_settings|$FORM_eth0_dhcp_from ip|FORM_eth0_dhcp_to|@TR<>|$eth0_dhcp_settings|$FORM_eth0_dhcp_to ip|FORM_eth0_dhcp_ns|@TR<>|$eth0_dhcp_settings|$FORM_eth0_dhcp_ns ip|FORM_eth0_dhcp_gw|@TR<>|$eth0_dhcp_settings|$FORM_eth0_dhcp_gw bool|FORM_eth0_nat|@TR<>|$eth0_ip_settings|$FORM_eth0_nat bool|FORM_lan_wan|@TR<WAN>>|required|$FORM_lan_wan bool|FORM_hs_lan|@TR<Private>>|required|$FORM_hs_lan bool|FORM_hs_wan|@TR<WAN>>|required|$FORM_hs_wan bool|FORM_ssh|@TR<>|required|$FORM_ssh int|FORM_ssh_port|@TR<<2nd SSH Port>>||$FORM_ssh_port bool|FORM_rssh|@TR<>|required|$FORM_rssh bool|FORM_webif|@TR<>|required|$FORM_webif EOF equal "$?" 0 && { save_setting router eth0 eth0_on "$FORM_eth0_on" case $FORM_eth0_on in 3) save_setting fon wan bridge "0" save_lan_ip_settings; ;; 1) save_setting router eth0 eth0_ip "$FORM_eth0_ip" save_setting router eth0 eth0_mask "$FORM_eth0_mask" save_setting router eth0 eth0_dhcp "$FORM_eth0_dhcp" save_setting router eth0 eth0_nat "$FORM_eth0_nat" if [ "$FORM_eth0_dhcp" = "1" ]; then save_setting router eth0 eth0_dhcp_from "$FORM_eth0_dhcp_from" save_setting router eth0 eth0_dhcp_to "$FORM_eth0_dhcp_to" save_setting router eth0 eth0_dhcp_ns "$FORM_eth0_dhcp_ns" save_setting router eth0 eth0_dhcp_gw "$FORM_eth0_dhcp_gw" save_repeater_dhcpconf save_setting fon wan bridge "$FORM_bridge" else save_setting fon wan bridge "0" fi if [ "$FORM_bridge" = "0" ]; then save_lan_ip_settings; fi ;; 0) save_lan_ip_settings; ;; esac save_access_rules; commit_settings SAVED=1 } ;; *) validate <>|$bridge_switch|$FORM_bridge ip|FORM_ipaddr|@TR<>|$lan_ip_settings|$FORM_ipaddr ip|FORM_netmask|@TR<>|$lan_ip_settings|$FORM_netmask bool|FORM_dhcp|LAN @TR<>|$lan_ip_settings|$FORM_dhcp bool|FORM_lan_wan|@TR<WAN>>|required|$FORM_lan_wan bool|FORM_hs_lan|@TR<Private>>|required|$FORM_hs_lan bool|FORM_hs_wan|@TR<WAN>>|required|$FORM_hs_wan bool|FORM_ssh|@TR<>|required|$FORM_ssh int|FORM_ssh_port|@TR<<2nd SSH Port>>||$FORM_ssh_port bool|FORM_rssh|@TR<>|required|$FORM_rssh bool|FORM_webif|@TR<>|required|$FORM_webif EOF equal "$?" 0 && { save_setting fon wan bridge "$FORM_bridge" save_lan_ip_settings; save_access_rules; commit_settings SAVED=1 } ;; esac fi sel_net=1 . /usr/lib/webif/advanced.sh header "Advanced Network Settings" if [ "$SAVED" = "1" ]; then echo "

EXECUTING CONFIGURATION" fi cat < EOF display_form < to LAN/WAN-Port>> start_select_cell|bridge|$FORM_bridge|tableTextSelect|bridgechange option|0|@TR<> option|1|@TR<> end_select_cell end_row end_table end_div start_div|lan_ip_settings start_table|0|10|5 add_row add_label_cell|@TR<> add_input_cell|ipaddr|$FORM_ipaddr|tableTextButton end_row add_row add_label_cell|@TR<> add_input_cell|netmask|$FORM_netmask|tableTextButton end_row add_row add_label_cell|@TR<> start_select_cell|dhcp|$FORM_dhcp|tableTextSelect option|0|@TR<> option|1|@TR<> end_select_cell end_row end_table end_div start_table|0|10|5 add_row add_button_cell|submit|@TR<>|tableTextButton end_row end_table call_js|bridgechange EOF equal "$FORM_mode" wlan && { display_form <> start_select_cell|eth0_on|$FORM_eth0_on|tableTextSelect|eth0switchchange option|0|@TR<> option|1|@TR<> option|3|FON end_select_cell end_row end_table start_div|mode_eth0 start_table|0|10|5 add_row add_label_cell|@TR<> add_input_cell|eth0_ip|$FORM_eth0_ip|tableTextButton end_row add_row add_label_cell|@TR<> add_input_cell|eth0_mask|$FORM_eth0_mask|tableTextButton end_row add_row add_label_cell|@TR<> start_select_cell|eth0_dhcp|$FORM_eth0_dhcp|tableTextSelect|eth0dhcpchange option|0|@TR<> option|1|@TR<> end_select_cell end_row end_table start_div|eth0dhcp start_table|0|10|5 add_row add_label_cell|@TR<> add_input_cell|eth0_dhcp_from|$FORM_eth0_dhcp_from|tableTextButton end_row add_row add_label_cell|@TR<> add_input_cell|eth0_dhcp_to|$FORM_eth0_dhcp_to|tableTextButton end_row add_row add_label_cell|@TR<> add_input_cell|eth0_dhcp_ns|$FORM_eth0_dhcp_ns|tableTextButton end_row add_row add_label_cell|@TR<> add_input_cell|eth0_dhcp_gw|$FORM_eth0_dhcp_gw|tableTextButton end_row end_table end_div start_table|0|10|5 add_row add_label_cell|@TR<> start_select_cell|eth0_nat|$FORM_eth0_nat|tableTextSelect option|1|@TR<> option|0|@TR<> end_select_cell end_row end_table end_div start_table|0|10|5 add_row add_button_cell|submit|@TR<>|tableTextButton end_row end_table call_js|eth0switchchange EOF } display_form < Private>> start_select_cell|hs_lan|$FORM_hs_lan|tableTextSelect option|1|@TR<> option|0|@TR<> end_select_cell add_label_cell|@TR<> start_select_cell|ssh|$FORM_ssh|tableTextSelect option|1|@TR<> option|0|@TR<> end_select_cell end_row add_row add_label_cell|@TR< WAN>> start_select_cell|hs_wan|$FORM_hs_wan|tableTextSelect option|1|@TR<> option|0|@TR<> end_select_cell add_label_cell|@TR<> start_select_cell|rssh|$FORM_rssh|tableTextSelect option|1|@TR<> option|0|@TR<> end_select_cell end_row add_row add_label_cell|@TR< WAN>> start_select_cell|lan_wan|$FORM_lan_wan|tableTextSelect option|1|@TR<> option|0|@TR<> end_select_cell add_label_cell|@TR<> start_select_cell|webif|$FORM_webif|tableTextSelect option|1|@TR<> option|0|@TR<> end_select_cell end_row add_row add_label_cell add_label_cell add_label_cell|@TR<<2nd SSH Port>> add_input_cell|ssh_port|$FORM_ssh_port|tableTextButton end_row end_table start_table|0|10|5 add_row add_button_cell|submit|@TR<>|tableTextButton end_row end_table EOF footer if [ "$SAVED" = "1" ]; then SAVED=0 display_form <