-if has_pppd or has_pppoe or has_pppoa or has_3g or has_pptp then
- ka = s:taboption("ppp", Value, "keepalive",
- translate("Keep-Alive"),
- translate("Number of failed connection tests to initiate automatic reconnect")
- )
- ka:depends("proto", "pptp")
- ka:depends("proto", "pppoe")
- ka:depends("proto", "pppoa")
- ka:depends("proto", "ppp")
- ka:depends("proto", "3g")
-
- demand = s:taboption("ppp", Value, "demand",
- translate("Automatic Disconnect"),
- translate("Time (in seconds) after which an unused connection will be closed")
- )
- demand.optional = true
- demand.datatype = "uinteger"
- demand:depends("proto", "pptp")
- demand:depends("proto", "pppoe")
- demand:depends("proto", "pppoa")
- demand:depends("proto", "ppp")
- demand:depends("proto", "3g")
-end
-
-if has_pppoa then
- encaps = s:taboption("atm", ListValue, "encaps", translate("PPPoA Encapsulation"))
- encaps:depends("proto", "pppoa")
- encaps:value("vc", "VC-Mux")
- encaps:value("llc", "LLC")
-
- atmdev = s:taboption("atm", Value, "atmdev", translate("ATM device number"))
- atmdev:depends("proto", "pppoa")
- atmdev.default = "0"
- atmdev.datatype = "uinteger"
-
- vci = s:taboption("atm", Value, "vci", translate("ATM Virtual Channel Identifier (VCI)"))
- vci:depends("proto", "pppoa")
- vci.default = "35"
- vci.datatype = "uinteger"
-
- vpi = s:taboption("atm", Value, "vpi", translate("ATM Virtual Path Identifier (VPI)"))
- vpi:depends("proto", "pppoa")
- vpi.default = "8"
- vpi.datatype = "uinteger"
-end
-
-if has_pptp or has_pppd or has_pppoe or has_pppoa or has_3g then
- device = s:taboption("general", Value, "device",
- translate("Modem device"),
- translate("The device node of your modem, e.g. /dev/ttyUSB0")
- )
- device:depends("proto", "ppp")
- device:depends("proto", "3g")
-
- defaultroute = s:taboption("ppp", Flag, "defaultroute",
- translate("Replace default route"),
- translate("Let pppd replace the current default route to use the PPP interface after successful connect")
- )
- defaultroute:depends("proto", "ppp")
- defaultroute:depends("proto", "pppoa")
- defaultroute:depends("proto", "pppoe")
- defaultroute:depends("proto", "pptp")
- defaultroute:depends("proto", "3g")
- defaultroute.default = defaultroute.enabled
-
- peerdns = s:taboption("ppp", Flag, "peerdns",
- translate("Use peer DNS"),
- translate("Configure the local DNS server to use the name servers adverticed by the PPP peer")
- )
- peerdns:depends("proto", "ppp")
- peerdns:depends("proto", "pppoa")
- peerdns:depends("proto", "pppoe")
- peerdns:depends("proto", "pptp")
- peerdns:depends("proto", "3g")
- peerdns.default = peerdns.enabled
-
- if has_ipv6 then
- ipv6 = s:taboption("ppp", Flag, "ipv6", translate("Enable IPv6 on PPP link") )
- ipv6:depends("proto", "ppp")
- ipv6:depends("proto", "pppoa")
- ipv6:depends("proto", "pppoe")
- ipv6:depends("proto", "pptp")
- ipv6:depends("proto", "3g")
- end
-
- connect = s:taboption("ppp", Value, "connect",
- translate("Connect script"),
- translate("Let pppd run this script after establishing the PPP link")
- )
- connect:depends("proto", "ppp")
- connect:depends("proto", "pppoe")
- connect:depends("proto", "pppoa")
- connect:depends("proto", "pptp")
- connect:depends("proto", "3g")
-
- disconnect = s:taboption("ppp", Value, "disconnect",
- translate("Disconnect script"),
- translate("Let pppd run this script before tearing down the PPP link")
- )
- disconnect:depends("proto", "ppp")
- disconnect:depends("proto", "pppoe")
- disconnect:depends("proto", "pppoa")
- disconnect:depends("proto", "pptp")
- disconnect:depends("proto", "3g")
-
- pppd_options = s:taboption("ppp", Value, "pppd_options",
- translate("Additional pppd options"),
- translate("Specify additional command line arguments for pppd here")
- )
- pppd_options:depends("proto", "ppp")
- pppd_options:depends("proto", "pppoa")
- pppd_options:depends("proto", "pppoe")
- pppd_options:depends("proto", "pptp")
- pppd_options:depends("proto", "3g")
-
- maxwait = s:taboption("ppp", Value, "maxwait",
- translate("Setup wait time"),
- translate("Seconds to wait for the modem to become ready before attempting to connect")
- )
- maxwait:depends("proto", "3g")
- maxwait.default = "0"
- maxwait.optional = true
- maxwait.datatype = "uinteger"
-end
-
-if has_relay then
- fb = s:taboption("relay", Flag, "forward_bcast", translate("Forward broadcasts"))
- fb.default = fb.enabled
- fb:depends("proto", "relay")
-
- fd = s:taboption("relay", Flag, "forward_dhcp", translate("Forward DHCP"))
- fd.default = fd.enabled
- fd:depends("proto", "relay")
-
- gw = s:taboption("relay", Value, "relay_gateway", translate("Override Gateway"))
- gw.optional = true
- gw.placeholder = "0.0.0.0"
- gw.datatype = "ip4addr"
- gw:depends("proto", "relay")
- function gw.cfgvalue(self, section)
- return m.uci:get("network", section, "gateway")
- end
- function gw.write(self, section, value)
- return m.uci:set("network", section, "gateway", value)
- end
- function gw.delete(self, section)
- return m.uci:delete("network", section, "gateway")
- end
-
- expiry = s:taboption("relay", Value, "expiry", translate("Host expiry timeout"))
- expiry.optional = true
- expiry.placeholder = 30
- expiry.datatype = "uinteger"
- expiry:depends("proto", "relay")
-
- retry = s:taboption("relay", Value, "retry", translate("ARP ping retries"))
- retry.optional = true
- retry.placeholder = 5
- retry.datatype = "uinteger"
- retry:depends("proto", "relay")
-
- table = s:taboption("relay", Value, "table", translate("Routing table ID"))
- table.optional = true
- table.placeholder = 16800
- table.datatype = "uinteger"
- table:depends("proto", "relay")
-end
-
-if has_ahcp then
- mca = s:taboption("ahcp", Value, "multicast_address", translate("Multicast address"))
- mca.optional = true
- mca.placeholder = "ff02::cca6:c0f9:e182:5359"
- mca.datatype = "ip6addr"
- mca:depends("proto", "ahcp")
-
- port = s:taboption("ahcp", Value, "port", translate("Port"))
- port.optional = true
- port.placeholder = 5359
- port.datatype = "port"
- port:depends("proto", "ahcp")
-
- fam = s:taboption("ahcp", ListValue, "_family", translate("Protocol family"))
- fam:value("", translate("IPv4 and IPv6"))
- fam:value("ipv4", translate("IPv4 only"))
- fam:value("ipv6", translate("IPv6 only"))
- fam:depends("proto", "ahcp")
-
- function fam.cfgvalue(self, section)
- local v4 = m.uci:get_bool("network", section, "ipv4_only")
- local v6 = m.uci:get_bool("network", section, "ipv6_only")
- if v4 then
- return "ipv4"
- elseif v6 then
- return "ipv6"
- end
- return ""
- end
-
- function fam.write(self, section, value)
- if value == "ipv4" then
- m.uci:set("network", section, "ipv4_only", "true")
- m.uci:delete("network", section, "ipv6_only")
- elseif value == "ipv6" then
- m.uci:set("network", section, "ipv6_only", "true")
- m.uci:delete("network", section, "ipv4_only")