Commit 4d4bb0b1 authored by chenhaowen's avatar chenhaowen

add luci macaddr option

parent b7b15a79
config gdut_drcom
option remote_ip '0.0.0.0'
option remote_ip '10.0.3.2'
option keep_alive1_flag '2a'
option enable '1'
......@@ -6,6 +6,14 @@ start() {
remote_ip=$(uci get gdut_drcom.@gdut_drcom[0].remote_ip 2>/dev/null)
keep_alive1_flag=$(uci get gdut_drcom.@gdut_drcom[0].keep_alive1_flag 2>/dev/null)
enable=$(uci get gdut_drcom.@gdut_drcom[0].enable 2>/dev/null)
enable_dial=$(uci get gdut_drcom.@gdut_drcom[0].enable_dial 2>/dev/null)
ifname=$(uci get gdut_drcom.@gdut_drcom[0].ifname 2>/dev/null)
username=$(uci get gdut_drcom.@gdut_drcom[0].username 2>/dev/null)
password=$(uci get gdut_drcom.@gdut_drcom[0].password 2>/dev/null)
macaddr=$(uci get gdut_drcom.@gdut_drcom[0].macaddr 2>/dev/null)
if [ "$enable"x = "1"x ]; then
/etc/init.d/gdut-drcom enable
else
......@@ -13,12 +21,29 @@ start() {
return
fi
# if [ "$enable_dial"x = "1"x ]; then
# uci set network.wan.ifname="$ifname"
# uci set network.wan.proto="pppoe"
# uci set network.wan.username="$username"
# uci set network.wan.password="$password"
# uci set network.wan._orig_ifname='eth0.2'
# uci set network.wan._orig_bridge='false'
# uci commit
# /etc/init.d/network restart
# fi
if [ -n "$macaddr" ]; then
uci set network.wan.macaddr="$macaddr"
uci commit
# /etc/init.d/network restart
fi
cmd="service_start /usr/bin/gdut-drcom -c /etc/gdut-drcom.conf "
if [ -n "$remote_ip" ]; then
cmd=$cmd"--remote-ip=$remote_ip "
cmd=$cmd"--remote_ip=$remote_ip "
fi
if [ -n "$keep_alive1_flag" ]; then
cmd=$cmd"--keep-alive1-flag=$keep_alive1_flag "
cmd=$cmd"--keep_alive1_flag=$keep_alive1_flag "
fi
cmd=$cmd"1> /tmp/gdut-drcom.log 2>/tmp/gdut-drcom_error.log &"
......
......@@ -19,7 +19,28 @@ s.addremove = false
s.anonymous = true
enable = s:option(Flag, "enable", translate("Enable"))
--[[enabledial = s:option(Flag, "enabledial", translate("Enable PPPoE Dial"))
enabledial.default = enabledial.enabled
ifname = s:option(ListValue, "ifname", translate("Interface name"))
ifname:depends("enabledial", "1")
for k, v in ipairs(luci.sys.net.devices()) do
if string.sub(v,0,3) == "eth" then
ifname:value(v)
end
end
username = s:option(Value, "username", translate("Username"))
username:depends("enabledial", "1")
password = s:option(Value, "password", translate("Password"))
password:depends("enabledial", "1")
password.password = true
]]--
macaddr = s:option(Value, "macaddr", translate("Mac address"))
macaddr.datatype="macaddr"
remote_ip = s:option(Value, "remote_ip", translate("Remote ip"))
remote_ip.datatype="ipaddr"
keep_alive_flag = s:option(Value, "keep_alive1_flag", translate("Keep alive1 flag"))
local apply = luci.http.formvalue("cbi.apply")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment