Changeset 61
- Timestamp:
- 09/06/07 22:41:08 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/imagebuilder/files/etc/hotplug.d/iface/05-3g
r47 r61 14 14 15 15 # startup keepalive if enabled 16 [ "$(nvram get wwan_ redial)" != "demand" ] && keepalive &16 [ "$(nvram get wwan_keepalive)" = "1" ] && keepalive & 17 17 ;; 18 18 ifdown) trunk/imagebuilder/files/www/cgi-bin/webif/network-wan-lan.sh
r41 r61 81 81 FORM_pptp_server_ip=${pptp_server_ip:-$(nvram get pptp_server_ip)} 82 82 83 84 # get opendns setting (uci_load webif above)85 FORM_opendns=${CONFIG_misc_opendns:-"0"}86 87 # get local lan88 FORM_lan_ipaddr=${lan_ipaddr:-$(nvram get lan_ipaddr)}89 FORM_lan_netmask=${lan_netmask:-$(nvram get lan_netmask)}90 FORM_lan_gateway=${lan_gateway:-$(nvram get lan_gateway)}91 92 83 # wwan common 93 84 FORM_wwan_network=${wwan_network:-$(nvram get wwan_network)} … … 98 89 FORM_wwan_type=${wwan_type:-$(nvram get wwan_type)} 99 90 FORM_wwan_redial=${wwan_redial:-$(nvram get wwan_redial)} 100 FORM_wwan_keepalive _ip=${wwan_keepalive_ip:-$(nvram get wwan_keepalive_ip)}91 FORM_wwan_keepalive=${wwan_keepalive:-$(nvram get wwan_keepalive)} 101 92 FORM_wwan_idletime=${wwan_idletime:-$(nvram get wwan_idletime)} 102 FORM_wwan_mtu=${wwan_mtu:-$(nvram get wwan_mtu)} 103 104 #creates wwan network list from 3g-networks.csv 105 WWAN_NETWORK_LIST=$( 106 awk ' BEGIN{FS=":"} 107 $1 ~ /[ \t]*#/ {next} 108 {print "option|" $1 "|@TR<<" $2 ">>"}' < /usr/lib/webif/3g-networks.csv 109 ) 110 111 #creates javascript array of wwan network settings from 3g-networks.csv 112 WWAN_NETWORK_SETTINGS=$( 113 awk ' BEGIN{FS=":"} 114 $1 ~ /[ \t]*#/ {next} 115 {print " network." $1 " = new Object;" 116 print " network." $1 ".user = \"" $3 "\";" 117 print " network." $1 ".pass = \"" $4 "\";" 118 print " network." $1 ".apn = \"" $5 "\";" 119 print " network." $1 ".num = \"" $6 "\";" 120 print " network." $1 ".type = \"" $7 "\";\n"}' < /usr/lib/webif/3g-networks.csv 121 ) 93 94 # get opendns setting (uci_load webif above) 95 FORM_opendns=${CONFIG_misc_opendns:-"0"} 96 97 # get local lan 98 FORM_lan_ipaddr=${lan_ipaddr:-$(nvram get lan_ipaddr)} 99 FORM_lan_netmask=${lan_netmask:-$(nvram get lan_netmask)} 100 FORM_lan_gateway=${lan_gateway:-$(nvram get lan_gateway)} 101 122 102 else 123 103 SAVED=1 … … 201 181 202 182 3g) 203 # if these forms are empty, don't bother saving them to nvram183 # dont save these settings if they are blank 204 184 empty "$FORM_wwan_num" || save_setting network wwan_num "$FORM_wwan_num" 205 185 empty "$FORM_wwan_type" || save_setting network wwan_type "$FORM_wwan_type" … … 210 190 empty "$FORM_wwan_idletime" && save_setting network wwan_idletime "10" 211 191 192 # if demand mode is set, disable keepalive 193 if [ "$FORM_wwan_redial" = "demand" ]; then 194 save_setting network wwan_keepalive "0" 195 else 196 save_setting network wwan_keepalive "$FORM_wwan_keepalive" 197 fi 198 212 199 # These can be blank 213 save_setting network wwan_keepalive_ip "$FORM_wwan_keepalive_ip"214 save_setting network wwan_mtu "$FORM_wwan_mtu"215 200 save_setting network wwan_network "$FORM_wwan_network" 216 201 save_setting network wwan_passwd "$FORM_wwan_passwd" … … 244 229 } 245 230 231 # detect 3g package and compile option 232 [ -x "/sbin/ifup.3g" ] && { 233 WWAN_CONFIG_FORM=" 234 start_form|@TR<<WWAN Configuration>>|wwan_configuration 235 field|@TR<<Connection Type>> 236 select|wwan_proto|$FORM_wwan_proto 237 option|none|@TR<<No WWAN#None>> 238 option|3g|@TR<<3G Data Card>> 239 end_form" 240 241 #creates wwan network list from 3g-networks.csv 242 WWAN_NETWORK_LIST=$( 243 awk ' BEGIN{FS=":"} 244 $1 ~ /[ \t]*#/ {next} 245 {print "option|" $1 "|@TR<<" $2 ">>"}' < /usr/lib/webif/3g-networks.csv 246 ) 247 248 #creates javascript array of wwan network settings from 3g-networks.csv 249 WWAN_NETWORK_SETTINGS=$( 250 awk ' BEGIN{FS=":"} 251 $1 ~ /[ \t]*#/ {next} 252 {print " network." $1 " = new Object;" 253 print " network." $1 ".user = \"" $3 "\";" 254 print " network." $1 ".pass = \"" $4 "\";" 255 print " network." $1 ".apn = \"" $5 "\";" 256 print " network." $1 ".num = \"" $6 "\";" 257 print " network." $1 ".type = \"" $7 "\";\n"}' < /usr/lib/webif/3g-networks.csv 258 ) 259 } 246 260 header "Network" "WAN-LAN" "@TR<<WAN-LAN Configuration>>" ' onload="modechange()" ' "$SCRIPT_NAME" 247 261 … … 294 308 set_visible('opendns_form', v); 295 309 set_visible('wwan_network_settings', v); 296 set_visible('wwan_keepalive_settings', v && !isset('wwan_redial', 'demand')); 297 set_visible('field_wwan_redial', v); 298 set_visible('field_wwan_mtu', v); 310 set_visible('field_wwan_keepalive', v && !isset('wwan_redial', 'demand')); 299 311 set_visible('field_wwan_idletime', v && isset('wwan_redial', 'demand')); 300 312 … … 319 331 end_form 320 332 321 start_form|@TR<<WWAN Configuration>> 322 field|@TR<<Connection Type>> 323 select|wwan_proto|$FORM_wwan_proto 324 option|none|@TR<<No WWAN#None>> 325 option|3g|@TR<<3G Data Card>> 326 field|@TR<<Connection Mode>>|field_wwan_redial|hidden 333 $WWAN_CONFIG_FORM 334 335 start_form|@TR<<Mobile Network Configuration>>|wwan_network_settings|hidden 336 field|@TR<<Connection Mode>>|field_wwan_redial 327 337 select|wwan_redial|$FORM_wwan_redial 328 338 option|demand|@TR<<Connect On Demand>> 329 339 option|persist|@TR<<Always Connected>> 330 340 option|manual|@TR<<Connect Manually>> 331 field|@TR<< Auto Disconnect (Min.)>>|field_wwan_idletime|hidden341 field|@TR<<Maximum Idle Time>>|field_wwan_idletime|hidden 332 342 text|wwan_idletime|$FORM_wwan_idletime 333 field|@TR<<MTU>>|field_wwan_mtu|hidden 334 text|wwan_mtu|$FORM_wwan_mtu 335 end_form 336 337 start_form|@TR<<Keepalive Settings>>|wwan_keepalive_settings|hidden 338 field|@TR<<Keepalive IP>>|field_wwan_keepalive_ip 339 text|wwan_keepalive_ip|$FORM_wwan_keepalive_ip 340 helpitem|Keepalive IP 341 helptext|Helptext Keepalive IP#You may specify a custom IP for the Keepalive daemon to use. 342 end_form 343 344 start_form|@TR<<Mobile Network Configuration>>|wwan_network_settings 343 helpitem|Maximum Idle Time 344 helptext|Helptext Idle Time#The number of minutes without internet traffic that the router should wait before disconnecting from the Internet (Connect on Demand only) 345 field|@TR<<Utilize Keepalive>>|field_wwan_keepalive|hidden 346 radio|keepalive|$FORM_wwan_keepalive|1|@TR<<Yes>> 347 radio|keepalive|$FORM_wwan_keepalive|0|@TR<<No>> 348 helpitem|Keepalive 349 helptext|Helptext Keepalive#The keepalive daemon insures that the internet is always connected and responding. Keepalive cannot be used with Connect on Demand mode. 350 field| 351 string|<br> 345 352 onchange|wwanchange 346 field|@TR<< SelectNetwork>>|field_wwan_network353 field|@TR<<Network>>|field_wwan_network 347 354 select|wwan_network|$FORM_wwan_network 348 355 $WWAN_NETWORK_LIST 349 helpitem| MobileNetwork350 helptext|Helptext Mobile Network#Select your mobile networkfrom the list. Some fields may be blank depending on the provider. If your network is not listed, you may be able enter in the mobile network settings manually.356 helpitem|Network 357 helptext|Helptext Network#Select a mobile network preset from the list. Some fields may be blank depending on the provider. If your network is not listed, you may be able enter in the mobile network settings manually. 351 358 field|@TR<<Username>>|field_wwan_username 352 359 text|wwan_username|$FORM_wwan_username