* luci-0.8: merge ppp config support (r3562-r3568)

This commit is contained in:
Jo-Philipp Wich 2008-10-12 22:38:30 +00:00
parent 6576ff9a05
commit 2da8f3324e
7 changed files with 207 additions and 34 deletions

View file

@ -197,6 +197,19 @@ network_interface_demand = 'Automatic Disconnect'
network_interface_demand_desc = 'Time (in seconds) after which an unused connection will be closed'
network_interface_keepalive = 'Keep-Alive'
network_interface_keepalive_desc = 'Number of failed connection tests to initiate automatic reconnect'
network_interface_device = 'Modem device'
network_interface_device_desc = 'The device node of your modem, e.g. /dev/ttyUSB0'
network_interface_defaultroute = 'Replace default route'
network_interface_defaultroute_desc = 'Let pppd replace the current default route to use the PPP interface after successful connect'
network_interface_peerdns = 'Use peer DNS'
network_interface_peerdns_desc = 'Configure the local DNS server to use the name servers adverticed by the PPP peer'
network_interface_ipv6 = 'Enable IPv6 on PPP link'
network_interface_connect = 'Connect script'
network_interface_connect_desc = 'Let pppd run this script after establishing the PPP link'
network_interface_disconnect = 'Disconnect script'
network_interface_disconnect_desc = 'Let pppd run this script before tearing down the PPP link'
network_interface_pppd_options = 'Additional pppd options'
network_interface_pppd_options_desc = 'Specify additional command line arguments for pppd here'
a_n_r_routes1 = 'Routes specify over which interface and gateway a certain host or network can be reached.'
a_n_routes_static = 'Static Routes'
a_n_routes_kernel4 = 'Active <abbr title="Internet Protocol Version 4">IPv4</abbr>-Routes'

View file

@ -201,6 +201,19 @@
<i18n:msg xml:id="network_interface_demand_desc">Time (in seconds) after which an unused connection will be closed</i18n:msg>
<i18n:msg xml:id="network_interface_keepalive">Keep-Alive</i18n:msg>
<i18n:msg xml:id="network_interface_keepalive_desc">Number of failed connection tests to initiate automatic reconnect</i18n:msg>
<i18n:msg xml:id="network_interface_device">Modem device</i18n:msg>
<i18n:msg xml:id="network_interface_device_desc">The device node of your modem, e.g. /dev/ttyUSB0</i18n:msg>
<i18n:msg xml:id="network_interface_defaultroute">Replace default route</i18n:msg>
<i18n:msg xml:id="network_interface_defaultroute_desc">Let pppd replace the current default route to use the PPP interface after successful connect</i18n:msg>
<i18n:msg xml:id="network_interface_peerdns">Use peer DNS</i18n:msg>
<i18n:msg xml:id="network_interface_peerdns_desc">Configure the local DNS server to use the name servers adverticed by the PPP peer</i18n:msg>
<i18n:msg xml:id="network_interface_ipv6">Enable IPv6 on PPP link</i18n:msg>
<i18n:msg xml:id="network_interface_connect">Connect script</i18n:msg>
<i18n:msg xml:id="network_interface_connect_desc">Let pppd run this script after establishing the PPP link</i18n:msg>
<i18n:msg xml:id="network_interface_disconnect">Disconnect script</i18n:msg>
<i18n:msg xml:id="network_interface_disconnect_desc">Let pppd run this script before tearing down the PPP link</i18n:msg>
<i18n:msg xml:id="network_interface_pppd_options">Additional pppd options</i18n:msg>
<i18n:msg xml:id="network_interface_pppd_options_desc">Specify additional command line arguments for pppd here</i18n:msg>
<i18n:msg xml:id="a_n_r_routes1">Routes specify over which interface and gateway a certain host or network can be reached.</i18n:msg>
<i18n:msg xml:id="a_n_routes_static">Static Routes</i18n:msg>
<i18n:msg xml:id="a_n_routes_kernel4">Active <abbr title="Internet Protocol Version 4">IPv4</abbr>-Routes</i18n:msg>

View file

@ -201,6 +201,19 @@ network_interface_demand_desc = 'Zeit (in s) nach der die Verbindung bei Inaktiv
network_interface_keepalive = 'Keep-Alive'
network_interface_keepalive_desc = 'Anzahl fehlgeschlagener Verbindungstests nach der automatisch neu verbunden wird'
network_interface_server = 'PPTP-Server'
network_interface_device = 'Modemgerät'
network_interface_device_desc = 'Geräteknoten des Modems, z.B. /dev/ttyUSB0'
network_interface_defaultroute = 'Standardroute ersetzen'
network_interface_defaultroute_desc = 'Lässt pppd die aktuelle Standardroute ersetzen und über die PPP Schnittstelle leiten'
network_interface_peerdns = 'DNS der Gegenstelle nutzen'
network_interface_peerdns_desc = 'Konfiguriert den lokalen DNS-Server so, dass er die von der Gegenstelle angekündigten Nameserver-Adressen nutzt'
network_interface_ipv6 = 'IPv6 für die PPP-Verbindung aktivieren'
network_interface_connect = 'Verbindungs-Script'
network_interface_connect_desc = 'Lässt pppd das angegebene Script nach dem Aufbau der PPP Verbindung abarbeiten'
network_interface_disconnect = 'Trennuns-Script'
network_interface_disconnect_desc = 'Lässt pppd das angegebene Script vor dem Trennen der PPP Verbindung abarbeiten'
network_interface_pppd_options = 'Weitere pppd Optionen'
network_interface_pppd_options_desc = 'Hier können zusätzliche Kommandozeilenargumente für pppd angegeben werden'
network_switch_desc = 'Die zu einem VLAN gehörenden Schnittstellen werden durch Leerzeichen getrennt. Die Schnittstelle mit der höchsten Nummer (meistens 5) bildet in der Regel die Verbindung zur internen Netzschnittstelle des Routers. Bei Geräten mit 5 Schnittstellen ist in der Regel die Schnittstelle mit der niedrigsten Nummer (0) die standardmäßige Uplinkschnittstelle des Routers.'
noise = 'Rausch'
power = 'Leistung'

View file

@ -208,6 +208,19 @@
<i18n:msg xml:id="network_interface_keepalive">Keep-Alive</i18n:msg>
<i18n:msg xml:id="network_interface_keepalive_desc">Anzahl fehlgeschlagener Verbindungstests nach der automatisch neu verbunden wird</i18n:msg>
<i18n:msg xml:id="network_interface_server">PPTP-Server</i18n:msg>
<i18n:msg xml:id="network_interface_device">Modemgerät</i18n:msg>
<i18n:msg xml:id="network_interface_device_desc">Geräteknoten des Modems, z.B. /dev/ttyUSB0</i18n:msg>
<i18n:msg xml:id="network_interface_defaultroute">Standardroute ersetzen</i18n:msg>
<i18n:msg xml:id="network_interface_defaultroute_desc">Lässt pppd die aktuelle Standardroute ersetzen und über die PPP Schnittstelle leiten</i18n:msg>
<i18n:msg xml:id="network_interface_peerdns">DNS der Gegenstelle nutzen</i18n:msg>
<i18n:msg xml:id="network_interface_peerdns_desc">Konfiguriert den lokalen DNS-Server so, dass er die von der Gegenstelle angekündigten Nameserver-Adressen nutzt</i18n:msg>
<i18n:msg xml:id="network_interface_ipv6">IPv6 für die PPP-Verbindung aktivieren</i18n:msg>
<i18n:msg xml:id="network_interface_connect">Verbindungs-Script</i18n:msg>
<i18n:msg xml:id="network_interface_connect_desc">Lässt pppd das angegebene Script nach dem Aufbau der PPP Verbindung abarbeiten</i18n:msg>
<i18n:msg xml:id="network_interface_disconnect">Trennuns-Script</i18n:msg>
<i18n:msg xml:id="network_interface_disconnect_desc">Lässt pppd das angegebene Script vor dem Trennen der PPP Verbindung abarbeiten</i18n:msg>
<i18n:msg xml:id="network_interface_pppd_options">Weitere pppd Optionen</i18n:msg>
<i18n:msg xml:id="network_interface_pppd_options_desc">Hier können zusätzliche Kommandozeilenargumente für pppd angegeben werden</i18n:msg>
<i18n:msg xml:id="network_switch_desc">Die zu einem VLAN gehörenden Schnittstellen werden durch Leerzeichen getrennt. Die Schnittstelle mit der höchsten Nummer (meistens 5) bildet in der Regel die Verbindung zur internen Netzschnittstelle des Routers. Bei Geräten mit 5 Schnittstellen ist in der Regel die Schnittstelle mit der niedrigsten Nummer (0) die standardmäßige Uplinkschnittstelle des Routers.</i18n:msg>
<i18n:msg xml:id="noise">Rausch</i18n:msg>

View file

@ -169,3 +169,19 @@ function file( val, seen )
return false
end
function device( val, seen )
local s = fs.stat( val )
seen = seen or { }
if s and not seen[s.ino] then
seen[s.ino] = true
if s.type == "character device" or s.type == "block device" then
return true
elseif s.type == "link" then
return device( fs.readlink(val), seen )
end
end
return false
end

View file

@ -10,11 +10,12 @@ config section
list depends 'proto=static, ipaddr, netmask'
list depends 'proto=static, ip6addr'
list depends 'proto=pppoe, username, password'
list depends 'proto=ppp, device'
list depends 'proto=pptp, username, password, server'
list depends 'proto=dhcp'
list depends 'proto=none'
option named true
option required true
option named 'true'
option required 'true'
config variable
option name 'ifname'
@ -74,16 +75,17 @@ config variable
option title 'DNS server (IPv4 or IPv6)'
option section 'network.interface'
option datatype 'ipaddr'
option multival true
option multival 'true'
config variable
option name 'keepalive'
option title 'keep-alive'
option descriptions 'Number of connection failures before reconnect'
option description 'Number of connection failures before reconnect'
option section 'network.interface'
option datatype 'uint'
list depends proto=pppoe
list depends proto=pptp
list depends 'proto=pppoe'
list depends 'proto=pptp'
list depends 'proto=ppp'
config variable
option name 'demand'
@ -91,38 +93,90 @@ config variable
option description 'Number of seconds to wait before closing the connection due to inactivity'
option section 'network.interface'
option datatype 'uint'
list depends proto=pppoe
list depends proto=pptp
list depends 'proto=pppoe'
list depends 'proto=pptp'
list depends 'proto=ppp'
config variable
option name 'username'
option title 'Username'
option section 'network.interface'
option datatype 'string'
list depends proto=pppoe
list depends proto=pptp
list depends 'proto=pppoe'
list depends 'proto=pptp'
list depends 'proto=ppp'
config variable
option name 'password'
option title 'Password'
option section 'network.interface'
option datatype 'string'
list depends proto=pppoe
list depends proto=pptp
list depends 'proto=pppoe'
list depends 'proto=pptp'
list depends 'proto=ppp'
config variable
option name 'server'
option title 'PPTP server'
option section 'network.interface'
option datatype 'ipaddr'
list depends proto=pptp
option datatype 'host'
list depends 'proto=pptp'
config variable
option name 'device'
option title 'Modem device'
option section 'network.interface'
option datatype 'device'
list depends 'proto=ppp'
config variable
option name 'defaultroute'
option title 'Replace default route'
option section 'network.interface'
option datatype 'boolean'
list depends 'proto=ppp'
config variable
option name 'peerdns'
option title 'Use peer DNS'
option section 'network.interface'
option datatype 'boolean'
list depends 'proto=ppp'
config variable
option name 'ipv6'
option title 'Enable IPv6 on PPP link'
option section 'network.interface'
option datatype 'boolean'
list depends 'proto=ppp'
config variable
option name 'connect'
option title 'PPP connect script'
option section 'network.interface'
option datatype 'file'
list depends 'proto=ppp'
config variable
option name 'disconnect'
option title 'PPP disconnect script'
option section 'network.interface'
option datatype 'file'
list depends 'proto=ppp'
config variable
option name 'pppd_options'
option title 'Additional PPP daemon options'
option section 'network.interface'
option datatype 'string'
list depends 'proto=ppp'
config variable
option name 'proto'
option title 'Protocol'
option section 'network.interface'
option type 'enum'
option required true
option required 'true'
config enum
option variable 'network.interface.proto'
@ -133,7 +187,7 @@ config enum
option variable 'network.interface.proto'
option value 'dhcp'
option title 'Retrieve IP address via DHCP'
option default true
option default 'true'
config enum
option variable 'network.interface.proto'
@ -148,7 +202,12 @@ config enum
config enum
option variable 'network.interface.proto'
option value 'pppoe'
option title 'Retrieve IP address via PPPoE'
option title 'Interface is a PPPoE connection'
config enum
option variable 'network.interface.proto'
option value 'ppp'
option title 'Interface is a PPP connection'
config variable
option name 'type'
@ -169,14 +228,14 @@ config section
option package 'network'
list depends 'proto=static, ipaddr, netmask'
list depends 'proto=static, ip6addr'
option named true
option named 'true'
config variable
option name 'interface'
option title 'Parent interface'
option section 'network.alias'
option valueof 'network.interface'
option required true
option required 'true'
config variable
option name 'ipaddr'
@ -225,7 +284,7 @@ config variable
option title 'Protocol'
option section 'network.alias'
option type 'enum'
option required true
option required 'true'
config enum
option variable 'network.alias.proto'
@ -244,14 +303,14 @@ config variable
option title 'Interface'
option section 'network.route'
option valueof 'network.interface'
option required true
option required 'true'
config variable
option name 'target'
option title 'Target IPv4 host or network'
option section 'network.route'
option datatype 'ip4addr'
option required true
option required 'true'
config variable
option name 'netmask'
@ -264,7 +323,7 @@ config variable
option title 'IPv4 gateway'
option section 'network.route'
option datatype 'ip4addr'
option required true
option required 'true'
@ -272,6 +331,6 @@ config section
option name 'switch'
option title 'Section switch'
option package 'network'
option named true
option dynamic true
option required true
option named 'true'
option dynamic 'true'
option required 'true'

View file

@ -27,6 +27,7 @@ p = s:option(ListValue, "proto", translate("protocol"))
p:value("static", translate("static"))
p:value("dhcp", "DHCP")
p:value("pppoe", "PPPoE")
p:value("ppp", "PPP")
p:value("pptp", "PPTP")
p.default = "static"
@ -43,11 +44,11 @@ for i,d in ipairs(luci.sys.net.devices()) do
end
local zones = luci.tools.webadmin.network_get_zones(arg[1])
if zones then
if zones then
if #zones == 0 then
m:chain("firewall")
fwzone = s:option(Value, "_fwzone",
fwzone = s:option(Value, "_fwzone",
translate("network_interface_fwzone"),
translate("network_interface_fwzone_desc"))
fwzone.rmempty = true
@ -59,11 +60,11 @@ if zones then
fwzone:value(section.name)
end
)
function fwzone.write(self, section, value)
function fwzone.write(self, section, value)
local zone = luci.tools.webadmin.firewall_find_zone(value)
local stat
if not zone then
stat = m.uci:section("firewall", "zone", nil, {
name = value,
@ -74,7 +75,7 @@ if zones then
net = (net or value) .. " " .. section
stat = m.uci:set("firewall", zone, "network", net)
end
if stat then
self.render = function() end
end
@ -134,11 +135,13 @@ user = s:option(Value, "username", translate("username"))
user.rmempty = true
user:depends("proto", "pptp")
user:depends("proto", "pppoe")
user:depends("proto", "ppp")
pass = s:option(Value, "password", translate("password"))
pass.rmempty = true
pass:depends("proto", "pptp")
pass:depends("proto", "pppoe")
pass:depends("proto", "ppp")
ka = s:option(Value, "keepalive",
translate("network_interface_keepalive"),
@ -147,16 +150,59 @@ ka = s:option(Value, "keepalive",
ka.rmempty = true
ka:depends("proto", "pptp")
ka:depends("proto", "pppoe")
ka:depends("proto", "ppp")
demand = s:option(Value, "demand",
demand = s:option(Value, "demand",
translate("network_interface_demand"),
translate("network_interface_demand_desc")
)
demand.rmempty = true
demand:depends("proto", "pptp")
demand:depends("proto", "pppoe")
demand:depends("proto", "ppp")
device = s:option(Value, "device",
translate("network_interface_device"),
translate("network_interface_device_desc")
)
device.rmempty = true
device:depends("proto", "ppp")
defaultroute = s:option(Flag, "defaultroute",
translate("network_interface_defaultroute"),
translate("network_interface_defaultroute_desc")
)
defaultroute:depends("proto", "ppp")
peerdns = s:option(Flag, "peerdns",
translate("network_interface_peerdns"),
translate("network_interface_peerdns_desc")
)
peerdns:depends("proto", "ppp")
ipv6 = s:option(Flag, "ipv6", translate("network_interface_ipv6") )
ipv6:depends("proto", "ppp")
connect = s:option(Value, "connect",
translate("network_interface_connect"),
translate("network_interface_connect_desc")
)
connect.optional = true
connect:depends("proto", "ppp")
disconnect = s:option(Value, "disconnect",
translate("network_interface_disconnect"),
translate("network_interface_disconnect_desc")
)
disconnect.optional = true
disconnect:depends("proto", "ppp")
pppd_options = s:option(Value, "pppd_options",
translate("network_interface_pppd_options"),
translate("network_interface_pppd_options_desc")
)
pppd_options.optional = true
pppd_options:depends("proto", "ppp")
s2 = m:section(TypedSection, "alias", translate("aliases"))