changeset 458:7e979416094e

Commit removal.
author Aleksandr Rybalko <ray@ddteam.net>
date Thu, 20 Sep 2012 16:23:02 +0300
parents 12a79832118b
children 23bc9425f041
files profiles/dlink.ua.web/files/etc/dhclient-script profiles/dlink.ua.web/files/etc/mpd-linkdown profiles/dlink.ua.web/files/etc/mpd-linkup profiles/dlink.ua.web/files/etc/racoon/phase1-down.sh profiles/dlink.ua.web/files/etc/racoon/phase1-up.sh profiles/dlink.ua.web/files/etc/www/collector.lua profiles/dlink.ua.web/files/etc/www/collector.sh profiles/dlink.ua.web/files/etc/www/config.xml profiles/dlink.ua.web/files/etc/www/devd.lua profiles/dlink.ua.web/files/etc/www/devd.sh profiles/dlink.ua.web/files/etc/www/htdocs/Administration.info.html profiles/dlink.ua.web/files/etc/www/htdocs/Basic.wlan.html profiles/dlink.ua.web/files/etc/www/htdocs/cmd.xml profiles/dlink.ua.web/files/etc/www/htdocs/css/router.css profiles/dlink.ua.web/files/etc/www/htdocs/event.xml profiles/dlink.ua.web/files/etc/www/htdocs/header.html profiles/dlink.ua.web/files/etc/www/htdocs/home_sys.html profiles/dlink.ua.web/files/etc/www/htdocs/img/banner.jpg profiles/dlink.ua.web/files/etc/www/htdocs/img/tool_bar.jpg profiles/dlink.ua.web/files/etc/www/htdocs/index.html profiles/dlink.ua.web/files/etc/www/htdocs/js/ajax.js profiles/dlink.ua.web/files/etc/www/htdocs/js/defineMyTree.js profiles/dlink.ua.web/files/etc/www/htdocs/js/view.js profiles/dlink.ua.web/files/etc/www/httpd.lua profiles/dlink.ua.web/files/etc/www/httpd.sh profiles/dlink.ua.web/files/etc/www/lib/mpd.lua profiles/dlink.ua.web/files/etc/www/lib/racoon.lua profiles/dlink.ua.web/files/etc/www/lib/utils.lua profiles/dlink.ua.web/profile.mk
diffstat 29 files changed, 0 insertions(+), 4330 deletions(-) [+]
line wrap: on
line diff
--- a/profiles/dlink.ua.web/files/etc/dhclient-script	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#!/bin/sh
-
-#LOG=/tmp/DHCLIENT-SCRIPT.log
-LOG=/dev/null
-
-touch ${LOG}
-echo "DHCLIENT-SCRIPT: $*" >> ${LOG}
-#set >> ${LOG}
-echo >>  ${LOG}
-
-case ${reason} in
-ARPSEND)
-	# TODO
-	;;
-
-ARPCHECK)
-	# TODO
-	;;
-
-EXPIRE)
-	# TODO
-	;;
-
-PREINIT)
-	# TODO
-	;;
-
-REBOOT|BOUND|RENEW)
-        #interface=wan0
-        #new_broadcast_address=192.168.1.255
-        #new_dhcp_lease_time=3600
-        #new_dhcp_message_type=5
-        #new_dhcp_server_identifier=192.168.1.3
-        #new_domain_name_servers='192.168.1.3 192.168.1.3'
-        #new_expiry=4137
-        #new_ip_address=192.168.1.5
-        #new_network_number=192.168.1.0
-        #new_routers=192.168.1.3
-        #new_subnet_mask=255.255.255.0
-        #reason=REBOOT
-        ifconfig ${interface} ${new_ip_address} netmask ${new_subnet_mask}
-        echo "DHCP: iface=${interface} ip=${new_ip_address} netmask=${new_subnet_mask} route=${new_routers} dns=${new_domain_name_servers}" >> ${LOG}
-        query="cmd=event"
-        query="${query}&state=up"
-        query="${query}&iface=${interface}"
-        query="${query}&gw=${new_routers}"
-        query="${query}&ip=${new_ip_address}"
-        query="${query}&netmask=${new_subnet_mask}"
-        query="${query}&dhclient_reason=${reason}"
-        query="${query}&dhclient_lease_time=${new_dhcp_lease_time}"
-        query="${query}&dhclient_message_type=${new_dhcp_message_type}"
-        query="${query}&dhclient_server_identifier=${new_dhcp_server_identifier}"
-        query="${query}&dhclient_expiry=${new_expiry}"
-        i=1
-        for dns in ${new_domain_name_servers} ; do
-    		query="${query}&dns${i}=${dns}"
-		i=$(( ${i} + 1 ))
-        done
-
-        # Notify configuration handler
-        fetch -qo - "http://127.0.0.1:8/event.xml?${query}"
-	;;
-*)
-	;;
-esac
-
--- a/profiles/dlink.ua.web/files/etc/mpd-linkdown	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-#!/bin/sh
-
-LOG=/tmp/mpd-linkdown.log
-
-touch ${LOG}
-echo "mpd-linkdown $*" >> ${LOG}
-#set >> ${LOG}
-echo >>  ${LOG}
-
-interface=$1
-proto=$2
-localip=$3
-remoteip=$4
-authname=$5
-
-echo $#
-case $# in
-	6)
-	dns1="8.8.8.8"
-	dns2="8.8.4.4"
-	peeraddress=$6
-	;;
-	7)
-	dns1=$6
-	dns2="8.8.8.8"
-	peeraddress=$7
-	;;
-	8)
-	dns1=$6
-	dns2=$7
-	peeraddress=$8
-	;;
-esac
-
-echo "MPD: iface=${interface} proto = ${proto} localip=${localip} remoteip=${remoteip} dns1=${dns1} dns2=${dns2} peeraddress=${peeraddress}" >> ${LOG}
-
-query="cmd=event"
-query="${query}&state=down"
-query="${query}&iface=${interface}"
-query="${query}&proto=${proto}"
-query="${query}&gw=${remoteip}"
-query="${query}&ip=${localip}"
-#query="${query}&dns1=${dns1}"
-#query="${query}&dns2=${dns2}"
-
-# Notify configuration handler
-fetch -qo - "http://127.0.0.1:8/event.xml?${query}"
-
-exit 0
-
--- a/profiles/dlink.ua.web/files/etc/mpd-linkup	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#!/bin/sh
-
-#
-# mpd-linkup ng0 inet 95.81.35.177/32 195.128.182.55 - dns1 195.128.182.40 dns2 195.128.182.41 [12]
-#
-
-LOG=/tmp/mpd-linkup.log
-
-touch ${LOG}
-echo "mpd-linkup $*" >> ${LOG}
-#set >> ${LOG}
-echo >>  ${LOG}
-
-interface=$1
-proto=$2
-localip=$3
-remoteip=$4
-authname=$5
-
-case $# in
-6)
-	dns1="8.8.8.8"
-	dns2="8.8.4.4"
-	peeraddress=$6
-	;;
-7)
-	dns1=$6
-	dns2="8.8.8.8"
-	peeraddress=$7
-	;;
-8)
-	dns1=$6
-	dns2=$7
-	peeraddress=$8
-	;;
-esac
-
-dns1=${dns1#dns1 }
-dns2=${dns2#dns2 }
-
-echo "MPD: iface=${interface} proto = ${proto} localip=${localip} remoteip=${remoteip} dns1=${dns1} dns2=${dns2} peeraddress=${peeraddress}" >> ${LOG}
-query="cmd=event"
-query="${query}&state=up"
-query="${query}&iface=${interface}"
-query="${query}&proto=${proto}"
-query="${query}&gw=${remoteip}"
-query="${query}&ip=${localip}"
-query="${query}&dns1=${dns1}"
-query="${query}&dns2=${dns2}"
-
-# Notify configuration handler
-fetch -qo - "http://127.0.0.1:8/event.xml?${query}"
-
-exit 0
-
--- a/profiles/dlink.ua.web/files/etc/racoon/phase1-down.sh	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
-LOG=/tmp/racoon-phase1-down.log
-
-touch ${LOG}
-echo "phase1-down.sh $*" >> ${LOG}
-
-
-echo [email protected]  >>  ${LOG}
-echo "LOCAL_ADDR = ${LOCAL_ADDR} LOCAL_PORT = ${LOCAL_PORT} REMOTE_ADDR = ${REMOTE_ADDR} REMOTE_PORT = ${REMOTE_PORT}" >>  ${LOG}
-
-echo >>  ${LOG}
-
-query="cmd=event"
-query="${query}&state=down"
-query="${query}&iface=IPSec0"	# XXX: should use names for IPSec peers
-query="${query}&gw=${REMOTE_ADDR}:${REMOTE_PORT}"
-query="${query}&ip=${LOCAL_ADDR}:${LOCAL_PORT}"
-
-# Notify configuration handler
-fetch -qo - "http://127.0.0.1:8/event.xml?${query}"
-
-# XXX: should be handled by httpd/collector
-sh "/var/run/racoon.${REMOTE_ADDR}_down.sh"
-
-exit 0
-
--- a/profiles/dlink.ua.web/files/etc/racoon/phase1-up.sh	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
-LOG=/tmp/racoon-phase1-up.log
-
-touch ${LOG}
-echo "phase1-up.sh $*" >> ${LOG}
-
-
-echo [email protected]  >>  ${LOG}
-echo "LOCAL_ADDR = ${LOCAL_ADDR} LOCAL_PORT = ${LOCAL_PORT} REMOTE_ADDR = ${REMOTE_ADDR} REMOTE_PORT = ${REMOTE_PORT}" >>  ${LOG}
-
-echo >>  ${LOG}
-
-query="cmd=event"
-query="${query}&state=up"
-query="${query}&iface=IPSec0"	# XXX: should use names for IPSec peers
-query="${query}&gw=${REMOTE_ADDR}:${REMOTE_PORT}"
-query="${query}&ip=${LOCAL_ADDR}:${LOCAL_PORT}"
-
-# Notify configuration handler
-fetch -qo - "http://127.0.0.1:8/event.xml?${query}"
-
-# XXX: should be handled by httpd/collector
-sh "/var/run/racoon.${REMOTE_ADDR}_up.sh"
-
-exit 0
-
--- a/profiles/dlink.ua.web/files/etc/www/collector.lua	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-#!/usr/bin/lua
-
-package.path = "./?.lua;/etc/www/lib/?.lua;./lib/?.lua";
-package.cpath =
-	"/lib/?.so;/usr/lib/?.so;/usr/lib/lua/?.so;" ..
-	"/lib/lua?.so;/usr/lib/lua?.so;/usr/lib/lua/lua?.so;" ..
-	"/lib/?-core.so;/usr/lib/?-core.so;/usr/lib/lua/?-core.so;" ..
-	"/lib/?/core.so;/usr/lib/?/core.so;/usr/lib/lua/?/core.so;";
-
-host = host or "127.0.0.1";
-port = port or "8";
-
-serverhost = serverhost or "127.0.0.1";
-serverport = serverport or "80";
-
--- Globals
-r = {};		-- Runtime varibles structure
-rquery = {};
-queue = {};
-local internet_led = nil;
-
---
--- Utility function:  URL encoding function
---
-function urlEncode(str)
-    if (str) then
-        str = string.gsub (str, "\n", "\r\n")
-        str = string.gsub (str, "([^%w ])",
-            function (c) return string.format ("%%%02X", string.byte(c)) end)
-        str = string.gsub (str, " ", "+")
-    end
-    return str
-end
-
-
---
--- Utility function:  URL decode function
---
-function urlDecode(str)
-    str = string.gsub (str, "+", " ")
-    str = string.gsub (str, "%%(%x%x)", function(h) return string.char(tonumber(h,16)) end)
-    str = string.gsub (str, "\r\n", "\n")
-    return str
-end
-
--- convert name1=value1&name2=val+ue%2F2
--- to table {"name1"="value1", "name2"="val ue/2"}
-function parse_query(query)
-    local parsed = {};
-    local pos = 0;
-
-    query = string.gsub(query, "&amp;", "&");
-    query = string.gsub(query, "&lt;", "<");
-    query = string.gsub(query, "&gt;", ">");
-
-    local function ginsert(qstr)
-        local first, last = string.find(qstr, "=");
-        if first then
-            local key = urlDecode(string.sub(qstr, 0, first-1));
-            local value = urlDecode(string.sub(qstr, first+1));
-            parsed[key] = value;
-        end
-    end
-
-    while true do
-        local first, last = string.find(query, "&", pos);
-        if first then
-            ginsert(string.sub(query, pos, first-1));
-            pos = last+1;
-        else
-            ginsert(string.sub(query, pos));
-            break;
-        end
-    end
-    return parsed;
-end
-
-function process(q, queryline)
-
-    if q["cmd"] == "event" then
-	    q["timestamp"] = os.date("%Y-%m-%d %H:%M:%S");
-
-	    local iface = q["iface"];
-
-	    if not iface then
-		return ("collector.lua: ERROR: Interface not defined");
-	    end
-
-	    if type(r[iface]) ~= "table" then r[iface] = {}; end
---	    rquery[iface] = queryline;
-	    -- First element processed last (implement FIFO)
-	    table.insert(queue, 1, {handled=false, query=queryline, qt=q});
-
-	    for k,v in pairs(q) do
-		if (k ~= "iface") and (k ~= "cmd") then
-		    r[iface][k] = v;
-		end
-	    end
-	    if q["state"] == "up" then
-		-- XXX: should not be here
-		-- XXX: must check exit code
-		if r[iface]["gw"] then
-		    exitcode = os.execute(
-			"route change default  " .. r[iface]["gw"] .." > /dev/null 2>&1 || " ..
-			"route add default  " .. r[iface]["gw"] .." > /dev/null 2>&1"
-		    );
-		    if internet_led then
-			internet_led:set(1);
-		    end
-		end
-		local dns = {};
-		if q["dns1"] and q["dns1"]:len() >= 7 then
-		    table.insert(dns, q["dns1"]);
-		end
-		if q["dns2"] and q["dns2"]:len() >= 7 then
-		    table.insert(dns, q["dns2"]);
-		end
-		if table.getn(dns) > 0 then
-		    resolv_conf = io.open("/etc/resolv.conf", "w");
-		    for i,v in ipairs(dns) do
-			-- print("nameserver	" .. v);
-			resolv_conf:write("nameserver	" .. v .. "\n");
-		    end
-		    resolv_conf:close();
-		end
-	    end
-	    if q["state"] == "down" then
-		if r[iface]["gw"] then
-		    if internet_led then
-			internet_led:set(0);
-		    end
-		end
-	    end
-
-	return "OK";
-
-    elseif q["cmd"] == "revent" then
-
-	iface = q["iface"];
-
-	if r[iface] then
-	    local ret = nil;
-
-	    for k,v in pairs(r[iface]) do
-		if ret then
-		    ret = ret .. "&" .. urlEncode(k) .. "=" .. urlEncode(v);
-		else
-		    ret = urlEncode(k) .. "=" .. urlEncode(v);
-		end
-	    end
-
-	    return (ret);
-	else
-	    return ("ERROR: no data for interface " .. iface);
-	end
-    else
-	return ("ERROR: unknown command");
-    end
-end
-
-function call_server(http, q)
-    local query = "http://127.0.0.1:80/event.xml?" .. q;
-
-    local body, code, headers = http.request(query);
-
-    if code == 200 then
-	return (true);
-    else
-	return (nil);
-    end
-
-end
-
-function getopt(args, opts)
-    i=1;
-    while i < table.getn(arg) do
-	if arg[i]:match("^-") then
-	    opts[arg[i]] = arg[i+1];
-	    i = i + 1;
-	end
-	i = i + 1;
-    end
-    return (opts);
-end
-
-
-
-opts = {};
-opts["-P"] = "/var/run/collector.pid";
-
-if arg then
-    opts = getopt(arg, opts);
-end
-
-
--- Check pidfile
-dofile("lib/pidfile.lua");
-pidfile(opts["-P"]);
-
-dofile("lib/led.lua");
-
-internet_led = Led:new_from_env("INTERNET_LED");
-
-socket = require("socket");
-http = require("socket.http");
-server = assert(socket.bind(host, port));
-server:settimeout(5);
-
-
-while 1 do
-    local method, path, query, major, minor;
-
-    local control = server:accept();
-
-    if control then
-	while 1 do
-    	    local data, err = control:receive();
-    	    if not err then
-    		local q;
-	        _, _, method, path, q, major, minor  = string.find(data, "([A-Z]+) (.-)%?(.-) HTTP/(%d).(%d)");
-		if not query and q then
-		    query = q;
-		    break;
-		end
-    	    else
-    		break;
-    	    end
-	end
-
-	if query then
-	    local q = parse_query(query);
-	    if q and q.cmd then
-		assert(control:send(
-		    "HTTP/1.0 200 OK\r\n" ..
-		    "Server: simple-lua\r\n" ..
-		    "Content-type: text/xml\r\n" ..
-		    "Connection: close\r\n" ..
-		    "\r\n" ..
-		    process(q, query)
-		));
-    	    end
-        end
-
-	assert(control:close());
-    end
-
-    local n = table.getn(queue);
-    if n > 0 then
-	for i = n,1,-1 do
-	    if queue[i].handled ~= true then
-		-- print("queue[" .. i .. "] Will send " .. queue[i].query .. " to main server");
-		if (call_server(http, queue[i].query) == true) then
-		    -- print("queue[" .. i .. "] Will delete " .. queue[i].query .. " from queue");
-		    queue[i].handled = true;
-		    table.remove(queue, i);
-		end
-	    end
-	end
-    end
-
-end
-
-os.exit(0);
-
-
-
-
-
--- a/profiles/dlink.ua.web/files/etc/www/collector.sh	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-
-cd /etc/www
-
-echo $$ > /var/run/collector.sh.pid
-
-INTERNET_LED=$(kenv -q INTERNET_LED)
-INTERNET_LED_INVERT=$(kenv -q INTERNET_LED_INVERT)
-
-export INTERNET_LED INTERNET_LED_INVERT
-
-./collector.lua > /var/log/collector.sh.log 2>&1
-exit 1
-
-while true; do
-    ./collector.lua > /var/log/collector.sh.log 2>&1
-done
-
--- a/profiles/dlink.ua.web/files/etc/www/config.xml	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,274 +0,0 @@
-<interfaces>
-    <wan0>
-        <PPPoE enable="false" type="pppoe" onchange="iface_changed('interfaces.wan0.PPPoE')">
-            <action>
-                <create target="socket:127.0.0.1:5005" type="socket">
-                    <message></message>
-                </create>
-            </action>
-            <nat enable="true"></nat>
-            <name>PPPoE</name>
-            <username>pppoe1</username>
-            <password>test</password>
-            <service_name></service_name>
-            <device>wan0</device>
-            <default_route>true</default_route>
-            <!-- flags -> FORCE='overwrite received', DEFAULT='used if no received' -->
-            <ipaddr flags="DEFAULT,FORCE">10.0.0.1/32</ipaddr>
-            <gateway flags="DEFAULT">10.0.0.2</gateway>
-            <!-- <ip6addr></ip6addr> -->
-            <!-- Values holders -->
-            <dns1></dns1>
-            <dns2></dns2>
-            <name>wan0pppoe</name>
-            <group>WAN</group>
-            <cost>10</cost>
-        </PPPoE>
-        <PPP enable="false" type="modem" onchange="iface_changed('interfaces.wan0.PPP')">
-            <action>
-                <up target="socket:127.0.0.1:5005" type="socket"></up>
-                <destroy target="socket:127.0.0.1:5005" type="socket"></destroy>
-                <down target="socket:127.0.0.1:5005" type="socket"></down>
-                <create target="socket:127.0.0.1:5005" type="socket"></create>
-                <destroy target="socket:127.0.0.1:5005" type="socket"></destroy>
-            </action>
-            <name>3G</name>
-            <nat enable="true"></nat>
-            <username>IT</username>
-            <password>IT</password>
-            <phone>#777</phone>
-            <init_string></init_string>
-            <device>/dev/cuaU0.0</device>
-            <default_route>true</default_route>
-            <!-- flags -> FORCE='overwrite received', DEFAULT='used if no received' -->
-            <ipaddr flags="DEFAULT,FORCE">10.0.0.1/32</ipaddr>
-            <gateway flags="DEFAULT">10.0.0.2</gateway>
-            <!-- <ip6addr></ip6addr> -->
-            <!-- Values holders -->
-            <dns1></dns1>
-            <dns2></dns2>
-            <name>PPP</name>
-            <group>WAN</group>
-            <cost>1000</cost>
-        </PPP>
-        <Static enable="true" type="hw">
-            <nat enable="true"></nat>
-            <dhcp enable="true"></dhcp>
-            <device>wan0</device>
-            <default_route>true</default_route>
-            <!-- flags -> FORCE='overwrite received', DEFAULT='used if no received' -->
-            <ipaddr flags="DEFAULT,FORCE">10.0.0.10/24</ipaddr>
-            <!-- Values holders -->
-            <gateway>10.0.0.1</gateway>
-            <dns1>10.0.0.1</dns1>
-            <dns2>10.0.0.2</dns2>
-            <name>wan0</name>
-            <group>WAN</group>
-            <cost>100</cost>
-        </Static>
-    </wan0>
-    <wlan0 enable="true" type="wlan">
-        <create>
-            <exec>ifconfig wlan0 create wlandev wifi0 wlanmode hostap</exec>
-        </create>
-        <init>
-            <exec>ifconfig wlan0</exec>
-        </init>
-        <wlan_interface>wifi0</wlan_interface>
-        <channel>6</channel>
-        <mode>11ng</mode>
-        <ht40>true</ht40>
-    </wlan0>
-    <wifi0>
-        <init>
-            <exec>ifconfig wifi0 up</exec>
-        </init>
-    </wifi0>
-    <lan0>
-        <init>
-            <!-- exec>ifconfig lan0 up</exec -->
-        </init>
-    </lan0>
-    <bridge0 type="bridge">
-        <create>
-            <exec>ifconfig wlan0 down</exec>
-            <exec>ifconfig lan0 down</exec>
-            <exec>ifconfig bridge0 create addm lan0 addm wlan0 up</exec>
-            <exec>ifconfig bridge0 down</exec>
-            <exec>ifconfig bridge0 ether `kenv LAN_MAC_ADDR`</exec>
-            <exec>ifconfig lan0 up</exec>
-            <exec>ifconfig wlan0 up</exec>
-            <exec>ifconfig bridge0 up</exec>
-        </create>
-        <init>
-        </init>
-        <ipaddr>192.168.0.1/24</ipaddr>
-        <lagg_interfaces>lan0,wlan0</lagg_interfaces>
-    </bridge0>
-</interfaces>
-<switch>
-    <ports>
-        <port id="0" pvid="1" tagged="false"></port>
-        <port id="1" pvid="1" tagged="false"></port>
-        <port id="2" pvid="1" tagged="false"></port>
-        <port id="3" pvid="1" tagged="false"></port>
-        <port id="4" pvid="2" tagged="false"></port>
-        <port id="5" pvid="1" tagged="true"></port>
-        <port id="6" pvid="1" tagged="false"></port>
-    </ports>
-    <vlans>
-        <vlan id="0" vid="1">0,1,2,3,5</vlan>
-        <vlan id="1" vid="2">4,5</vlan>
-    </vlans>
-</switch>
-<dnsrelay enable="false"></dnsrelay>
-<dhcpd>
-    <instances>
-        <instance id="0" enable="true">
-            <interface>bridge0</interface>
-            <domain>dlink.ua</domain>
-            <!-- <domainservers>192.168.0.1</domainservers> -->
-            <default-lease-time>600</default-lease-time>
-            <max-lease-time>7200</max-lease-time>
-            <range>
-                <start>192.168.0.100</start>
-                <end>192.168.0.200</end>
-            </range>
-        </instance>
-    </instances>
-</dhcpd>
-<routes>
-    <default>
-        <source priority="10">interfaces.wan0.DHCP.gateway</source>
-        <source priority="11">interfaces.wan0.PPPoE.gateway</source>
-        <source priority="12">interfaces.wan0.PPP.gateway</source>
-        <source priority="13">interfaces.wan0.Static.gateway</source>
-        <source priority="14">interfaces.wan0.PPTP.gateway</source>
-        <source priority="15">interfaces.wan0.L2TP.gateway</source>
-    </default>
-    <route id="1" enable="false">
-        <net>172.16.0.0/12</net>
-        <gw>192.168.0.2</gw>
-    </route>
-</routes>
-<resolve>
-    <search>dlink.ua</search>
-    <domain>dlink.ua dlink.ru</domain>
-    <options>attempts:5 timeout:10</options>
-    <nameserver order="100">8.8.8.8</nameserver>
-    <nameserver order="101">8.8.4.4</nameserver>
-</resolve>
-<igmp>
-    <instance id="0" enable="false">
-	<up>wan0</up>
-	<down>wlan0</down>
-    </instance>
-    <instance id="0" enable="false">
-	<up>wan0</up>
-	<down>lan0</down>
-    </instance>
-</igmp>
-<info>
-    <hostname>zrouter</hostname>
-    <location>home</location>
-    <firmware>
-	<!-- XXX: version and build date should be here -->
-        <version>???</version>
-        <date>????</date>
-        <update_url>http://www.dlink.ua/files/products/ftp/pub/Router/DIR-620/Firmware/FreeBSD/D-Link_DIR-620-last.txt</update_url>
-    </firmware>
-</info>
-<hostapd>
-    <instance id="0" enable="true">
-        <ieee80211d>1</ieee80211d>
-        <country_code>UA</country_code>
-        <interface>wlan0</interface>
-        <macaddr_acl>0</macaddr_acl>
-        <auth_algs>1</auth_algs>
-        <debug>0</debug>
-        <hw_mode>g</hw_mode>
-        <ctrl_interface>/var/run/hostapd</ctrl_interface>
-        <ctrl_interface_group>wheel</ctrl_interface_group>
-        <ssid>zrouter</ssid>
-        <channel>6</channel>
-        <!-- Open -->
-        <wpa>3</wpa>
-        <!-- WPA -->
-        <!-- <wpa>1</wpa> -->
-        <!-- RSN/WPA2 -->
-        <!-- <wpa>2</wpa> -->
-        <wpa_passphrase>freebsdmall</wpa_passphrase>
-        <wpa_key_mgmt>WPA-PSK</wpa_key_mgmt>
-        <wpa_pairwise>CCMP TKIP</wpa_pairwise>
-    </instance>
-    <instance id="1" enable="false">
-        <ieee80211d>1</ieee80211d>
-        <country_code>UA</country_code>
-        <interface>wlan0</interface>
-        <macaddr_acl>0</macaddr_acl>
-        <auth_algs>1</auth_algs>
-        <debug>0</debug>
-        <hw_mode>g</hw_mode>
-        <ctrl_interface>/var/run/hostapd</ctrl_interface>
-        <ctrl_interface_group>wheel</ctrl_interface_group>
-        <ssid>zrouter</ssid>
-        <!-- WPA -->
-        <!-- <wpa>1</wpa> -->
-        <!-- RSN/WPA2 -->
-        <wpa>2</wpa>
-        <wpa_passphrase>freebsdmall</wpa_passphrase>
-        <wpa_key_mgmt>WPA-PSK</wpa_key_mgmt>
-        <wpa_pairwise>CCMP TKIP</wpa_pairwise>
-    </instance>
-</hostapd>
-<http>
-    <users>
-        <user username="admin" password="admin" group="admin"></user>
-        <user username="user" password="123" group="stat"></user>
-    </users>
-    <!-- host>192.168.0.1</host
-	bind to all, because we need local access also.
-	XXX: we should take care about ipfw deny for that. -->
-    <host>192.168.0.1</host>
-    <port>80</port>
-</http>
-<ipsec>
-    <remote id="0" enable="false">
-	<gateway>10.0.0.2:500</gateway>
-        <exchange_mode>main,aggressive</exchange_mode>
-        <my_identifier>address 10.0.0.1</my_identifier>
-        <peers_identifier>address 10.0.0.2</peers_identifier>
-        <lifetime>time 28800 sec</lifetime>
-	<initial_contact>on</initial_contact>
-        <passive>off</passive>
-        <proposal_check>obey</proposal_check>
-	<nat_traversal>off</nat_traversal>
-        <generate_policy>off</generate_policy>
-        <proposal>
-            <encryption_algorithm>3des</encryption_algorithm>
-            <hash_algorithm>md5</hash_algorithm>
-            <authentication_method>pre_shared_key</authentication_method>
-            <dh_group>5</dh_group>
-            <psk>pskpskpsk</psk>
-	</proposal>
-    </remote>
-    <sainfo id="0" enable="true">
-	<src>address 192.168.0.0/24 any</src>
-	<dst>address 192.168.2.0/24 any</dst>
-	<pfs_group>5</pfs_group>
-	<lifetime>time 3600 sec</lifetime>
-	<encryption_algorithm>3des</encryption_algorithm>
-	<authentication_algorithm>hmac_md5</authentication_algorithm>
-	<compression_algorithm>deflate</compression_algorithm>
-    </sainfo>
-    <setkey>
-	<line>spdadd 192.168.0.0/24 192.168.2.0/24 any -P out ipsec esp/tunnel/10.0.0.1-10.0.0.2/use</line>
-	<line>spdadd 192.168.2.0/24 192.168.0.0/24 any -P in ipsec esp/tunnel/10.0.0.2-10.0.0.1/use</line>
-	<line></line>
-	<line></line>
-    </setkey>
-</ipsec>
-<ntp enable="true">
-    <server id="1">ntp.dlink.com.tw</server>
-    <server id="2">ntp1.dlink.com</server>
-</ntp>
--- a/profiles/dlink.ua.web/files/etc/www/devd.lua	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-#!/usr/bin/lua
-
-package.path = "./?.lua;/etc/www/lib/?.lua;./lib/?.lua";
-package.cpath =
-	"/lib/?.so;/usr/lib/?.so;/usr/lib/lua/?.so;" ..
-	"/lib/lua?.so;/usr/lib/lua?.so;/usr/lib/lua/lua?.so;" ..
-	"/lib/?-core.so;/usr/lib/?-core.so;/usr/lib/lua/?-core.so;" ..
-	"/lib/?/core.so;/usr/lib/?/core.so;/usr/lib/lua/?/core.so;";
-
-serverhost = serverhost or "127.0.0.1";
-serverport = serverport or "80";
-
--- redirect print to /dev/console
--- dofile("lib/print_to_console.lua");
-
--- redirect print to syslog
-dofile("lib/lsyslog.lua");
-syslog_init("devd.lua");
-
--- urlEncode/urlDecode
-dofile("lib/urlXxcode.lua");
-
-function tab_to_query(t)
-    local ret = "event=devd";
-
-    for k,v in pairs(t) do
-	ret = ret .. "&" .. urlEncode(k) .. "=" .. urlEncode(v);
-    end
-
-    return (ret);
-end
-
-function call_server(config, q)
-    local query = "http://127.0.0.1:80/event.xml?" .. q;
-
-    local body, code, headers = config.http.request(query);
-
-    if code == 200 then
-	return (true);
-    else
-	return (nil);
-    end
-
-end
-
-function exec_output(cmd)
-	fp = io.popen(cmd, "r");
-	data = fp:read("*a");
-	fp:close();
-	return data;
-end
-
-function system_event(config, msg)
-    -- !system=IFNET subsystem=rt0 type=ATTACH
-    -- !system=DEVFS subsystem=CDEV type=CREATE cdev=usb/0.1.1
-    -- !system=USB subsystem=DEVICE type=ATTACH ugen=ugen0.1 cdev=ugen0.1 \
-    --		vendor=0x0000 product=0x0000 devclass=0x09 devsubclass=0x00 \
-    --		sernum= release=0x0100 mode=host port=1 parent=dotg0
-    -- !system=GPIO subsystem=pin14 type=PIN_LOW bus=gpiobus0 period=0
-    -- !system=GPIO subsystem=pin14 type=PIN_HIGH bus=gpiobus0 period=0
-
-    function generic_event(m, msg)
-	-- Relay to main control logic
-	local query = "cmd=event" ..
-	    "&system=" .. m.system ..
-	    "&subsystem=" .. m.subsystem ..
-	    "&type=" .. m.type ..
-	    "&data=" .. urlEncode(msg);
-	-- cmd=event&iface=wan0&state=linkup;
-	print("devd.lua: query master with \"" .. query .. "\"");
-	if call_server(config, query) == false then
-	    -- XXX error handling
-	end
-    end
-
-    local m = {};
-
-    if not msg then
-	return (nil);
-    end
-
-    for k, v in msg:gmatch("(%w+)=(%S+)") do
-        m[k] = v;
-        -- print(k,v);
-    end
-
-    if m.system and m.subsystem and m.type then
-	if     m.system == "IFNET" then
-	    -- Interfaces
-	    -- system=IFNET subsystem=lan0 type=LINK_UP
-	    local linkstate;
-	    if m.type == "LINK_UP" then
-		if m.subsystem == "lan0" then
-		    -- XXX: bug workaround, we have to check why UP does not unplumb iface
-		    os.execute("ifconfig lan0 down");
-		    os.execute("ifconfig lan0 up");
-		end
-		linkstate = "linkup";
-	    elseif m.type == "LINK_DOWN" then
-		linkstate = "linkdown";
-	    else
-		generic_event(m, msg);
-		return (nil);
-	    end
-	    local query = "cmd=event" ..
-		"&iface=" .. urlEncode(m.subsystem) ..
-		"&state=" .. linkstate;
-	    -- cmd=event&iface=wan0&state=linkup;
-	    if call_server(config, query) == false then
-		-- XXX error handling
-	    end
-	elseif m.system == "DEVFS" then
-	    -- Device nodes
-	    generic_event(m, msg);
-
-	elseif m.system == "USB" then
-	    -- USB messages
-	    generic_event(m, msg);
-	    -- !system=USB subsystem=INTERFACE type=ATTACH ugen=ugen0.2 cdev=ugen0.2 vendor=0x1f28 product=0x0021
-	    -- devclass=0x00 devsubclass=0x00 sernum="216219360300" release=0x0000
-	    -- mode=host interface=0 endpoints=2 intclass=0x08 intsubclass=0x06 intprotocol=0x50
-
-	    -- system=USB subsystem=DEVICE type=ATTACH ugen=ugen0.2 cdev=ugen0.2 vendor=0x1f28 product=0x0021
-	    -- devclass=0x00 devsubclass=0x00 sernum=%22216219360300%22 release=0x0000 mode=host port=1 parent=ugen0.1
-
-	    -- Our usb_modeswitch :)
-	    if m.subsystem == "DEVICE" and m.type == "ATTACH" then
-		-- XXX: get that from config
-		m.vendor = m.vendor - 0;
-		m.product = m.product - 0;
-		-- ugen0.2 -> 0.2
-		devid = m.ugen:gsub("ugen", "");
-		if m.vendor == 0x1f28 and m.product == 0x0021 then
-	    	    os.execute("hex2bin " ..
-	    		"55534243b82e238c24000000800108df200000000000000000000000000000" ..
-	    		" > /dev/usb/" .. devid .. ".8"); -- EndPoint 8
-		end
-	    end
-
-	elseif m.system == "GPIO" then
-	    -- GPIO messages
-	    generic_event(m, msg);
-
-	    -- XXX: should not be hardcoded
-	    if m.subsystem == reset_pin and m.bus == "gpiobus0" then
-		if     m.type == "PIN_LOW" then
-		    -- Pin return to normal state
-		    time = tonumber(m.period);
-		    -- if hold time between 10 and 15 sec, call httpd to reset to default
-		    -- XXX better to send event to httpd, then httpd will decide what to do
-		    -- XXX2 but if httpd have wrong config, then he can't start
-		    if 10 < time and time < 15 then
-			-- XXX: always do restore config here, because wrong config break httpd yet
-			-- if call_server(config, "restore=config") == false then
-			    -- If we can't get success from httpd, then we restore default manualy
-			    os.execute("mv /tmp/etc/www/config.xml /tmp/etc/www/config.xml.bak");
-			    os.execute("/etc/rc.save_config");
-			    os.execute("reboot");
-			-- end
-			os.execute("echo \"devd.lua: User request Reset to Default\" > /dev/console");
-		    end
-		elseif m.type == "PIN_HIGH" then
-		    -- User push the reset button
-		    -- Nothing to do yet
-		else
-		    -- Unknown type
-		end
-	    end
-	else
-	    -- Unknown system
-	end
-    end
-end
-
-function unknown_device(config, msg)
--- "? at pins=?  on gpiobus0"
-end
-
-function device_attached(config, msg)
--- "+nvram2env0 at   on nexus0"
-end
-
-function device_detached(config, msg)
--- "-nvram2env0 at   on nexus0"
-end
-
-
-
-local run = true;
-local config = {};
-config.http = require("socket.http");
-
-reset_pin = exec_output("kenv -q RESET_PIN");
-if not reset_pin then
-    reset_pin = 10;
-end
-reset_pin = string.format("pin%03d", reset_pin);
-
-while run do
-    if not config.d then
-	config.d = io.open("/dev/devctl", "r");
-    end
-    local line = config.d:read("*l");
-    if line then
-	print("devd.lua:DEBUG: got \"" .. line .. "\"");
-	local m, _, t, msg = line:find("^(.)(.*)");
-	if m and t and msg then
-		if     t == "!" then
-		    system_event(config, msg);
-		elseif t == "?" then
-		    unknown_device(config, msg);
-		elseif t == "+" then
-		    device_attached(config, msg);
-		elseif t == "-" then
-		    device_detached(config, msg);
-		else
-			os.execute("echo \" Message with unknown type received " .. line .. "\" > /dev/console");
-		end
-	end
-    end
-end
-
-
---[[
-!system=IFNET subsystem=rt0 type=ATTACH
-!system=IFNET subsystem=usbus0 type=ATTACH
-!system=IFNET subsystem=rt28600 type=ATTACH
-!system=IFNET subsystem=lo0 type=ATTACH
-
-+nvram2env0 at   on nexus0
-+clock0 at   on nexus0
-+rt0 at   on nexus0
-+rt305x_sysctl0 at   on obio0
-+rt305x_ic0 at   on obio0
-+gpioc0 at pins=?  on gpiobus0
-+gpioreset0 at pins=?  on gpiobus0
-? at pins=?  on gpiobus0
-+gpioled1 at pins=?  on gpiobus0
-+gpiobus0 at   on gpio0
-+gpio0 at   on obio0
-+uart1 at   on obio0
-+cfid0 at   on cfi0
-+cfi0 at   on obio0
-+usbus0 at   on dotg0
-+dotg0 at   on obio0
-+rt28600 at   on nexus0
-+nexus0 at   on root0
-
--- New device node
-!system=DEVFS subsystem=CDEV type=CREATE cdev=usbctl
-!system=DEVFS subsystem=CDEV type=CREATE cdev=usb/0.1.0
-!system=DEVFS subsystem=CDEV type=CREATE cdev=ugen0.1
-!system=DEVFS subsystem=CDEV type=CREATE cdev=usb/0.1.1
-
-!system=USB subsystem=DEVICE type=ATTACH ugen=ugen0.1 cdev=ugen0.1 vendor=0x0000 product=0x0000 devclass=0x09 devsubclass=0x00 sernum= release=0x0100 mode=host port=1 parent=dotg0
-!system=USB subsystem=INTERFACE type=ATTACH ugen=ugen0.1 cdev=ugen0.1 vendor=0x0000 product=0x0000 devclass=0x09 devsubclass=0x00 sernum= release=0x0100 mode=host interface=0 endpoints=1 intclass=0x09 intsubclass=0x00 intprotocol=0x00
-!system=DEVFS subsystem=CDEV type=CREATE cdev=cfid0
-!system=DEVFS subsystem=CDEV type=CREATE cdev=map/bootloader
-
--- Reported GPIO pins
-!system=GPIO subsystem=pin14 type=PIN_LOW bus=gpiobus0 period=0
-!system=GPIO subsystem=pin14 type=PIN_HIGH bus=gpiobus0 period=0
-]]
--- a/profiles/dlink.ua.web/files/etc/www/devd.sh	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-
-cd /etc/www
-
-echo $$ > /var/run/devd.sh.pid
-
-./devd.lua > /var/log/devd.sh.log 2>&1
-exit 1
-
-while true; do
-    ./devd.lua
-done
-
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/Administration.info.html	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-$$$code:inc("htdocs/header.html")$$$
-    <h1>Device Information</h1>
-Vendor:<strong>$$$info.device.vendor$$$</strong><br/>
-Model:<strong>$$$info.device.model$$$</strong><br/>
-Hardware Revision:<strong>$$$info.device.revision$$$</strong><br/>
-
-$$$code:conf_table("DevInfo", "Device Information", "info",
-{
-    { label = "Hostname", 	type = "node", htmltype = "text", 	node = "hostname" 	},
-    { label = "Location", 	type = "node", htmltype = "text", 	node = "location" 	},
-})$$$
-
-
-$$$code:inc("htdocs/footer.html")$$$
-
-
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/Basic.wlan.html	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-$$$code:inc("htdocs/header.html")$$$
-    <h1>Wireless configuration</h1>
-
-$$$code:conf_table("WLAN", "Wireless Access Point configuration", "hostapd.instance[1]",
-{
-    { label = "Enabled", 			type = "attr", htmltype = "checkbox", 	node = ":enable" 	},
-    { label = "Country code (UA)", 		type = "node", htmltype = "text", 	node = "country_code" 	},
-    { label = "wireless iface (wlan0)", 	type = "node", htmltype = "text", 	node = "interface" 	},
-    { label = "Channel (6)", 			type = "node", htmltype = "text", 	node = "channel" 	},
-    { label = "SSID", 				type = "node", htmltype = "text", 	node = "ssid"		},
-    { label = "WPA mode, 1-WPA, 2-RSN, 3-WPA+RSN", 	type = "node", htmltype = "text", 	node = "wpa"	},
-    { label = "WPA key", 			type = "node", htmltype = "text", 	node = "wpa_passphrase" },
-})$$$
-
-$$$code:inc("htdocs/footer.html")$$$
-
-
-
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/cmd.xml	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-function process()
-
-    if rq.POST["cmd"] == "get" then
-
-	return (c:getNode(rq.POST["key"]):value());
-
-    elseif rq.POST["cmd"] == "set" then
-
-	c:getNode(rq.POST["key"]):value(rq.POST["value"]);
-	return (c:getNode(rq.POST["key"]):value());
-
-    elseif rq.POST["cmd"] == "upload_config" then
-
-	print(tdump(rq.POST));
-	return ("OK");
-
-    elseif rq.POST["cmd"] == "upgrade" then
-
-	os.execute("LAST=`fetch -o - " .. c:getNode("info.firmware.update_url"):value() .."` ; /etc/upgrade ${LAST} > /dev/console 2>&1");
-	return ("OK");
-
-    elseif rq.POST["cmd"] == "setmany" then
-
-	path = rq.POST["path"];
-	if not path then
-	    return ("path missing");
-	end
-	-- print(rq.RequestBody);
-
-	-- if name like "sm:key" do c:getNode(path .. "key"):value(rq.POST["value"]);
-	-- if name like "smattr:key:attr" do c:getNode(path .. "key"):attr("attr", rq.POST["value"]);
-	for k,v in pairs(rq.POST) do
-	    attr, _, subpath, attrname = string.find(k, "^smattr:(.-):(.*)");
-	    if not v then v = ""; end
-	    if (attr) then
-		if string.len(subpath) > 0 then
-		    subpath = path .. "." .. subpath;
-		else
-		    subpath = path;
-		end
-
-		local n = c:getOrCreateNode(subpath);
-		if not n then
-		    print ("ERROR: can't find/create node \"" .. subpath .. "\"");
-		    return ("ERROR: can't find/create node \"" .. subpath .. "\"");
-		end
-		n:attr(attrname, v);
-		print(subpath .." ".. attrname .. " newval=" .. c:getNode(subpath):attr(attrname));
-    	    elseif string.find(k, "^sm:") then
-    		_, _, subpath = string.find(k, "^sm:(.*)");
-		if string.len(subpath) > 0 then
-		    subpath = path .. "." .. subpath;
-		else
-		    subpath = path;
-		end
-		local n = c:getOrCreateNode(subpath);
-		if not n then
-		    print ("ERROR: can't find/create node \"" .. subpath .. "\"");
-		    return ("ERROR: can't find/create node \"" .. subpath .. "\"");
-		end
-		n:value(v or "");
-		print(subpath .. " newval=" .. n:value());
-    	    end
-	end
-	return ("OK");
-
-    elseif rq.POST["save"] == "config" then
-
-	print("Saving configuration to config.xml");
-	if not save_file("config.xml", xmldump(c:gettree())) then
-	    return ("Error saving configuration");
-	end
-	if os.execute("/etc/rc.save_config") ~= 0 then
-	    return ("Error saving configuration block to flash");
-	end
-	return ("Configuration saved successful");
-
-    elseif rq.POST["restore"] == "config" then
-
-	print("Restoring factory default setting");
-	os.execute("echo '(sleep 5 ; rm /tmp/etc/www/config.xml ; /etc/rc.save_config ; /sbin/reboot ) & ' >> /tmp/restore_scrip.sh");
-	if os.execute("sh /tmp/restore_scrip.sh &") ~= 0 then
-	    return ("Run restore script fail");
-	end
-	return ("Configuration restore procedure started");
-
-    elseif rq.POST["system"] == "reboot" then
-
-	print("Reboot device");
-	os.execute("echo '(sleep 5 ; /sbin/reboot) &' > /tmp/reboot_scrip.sh");
-	os.execute("echo 'Run /tmp/reboot_scrip.sh' > /dev/console");
-	if os.execute("sh /tmp/reboot_scrip.sh &") ~= 0 then
-	    return ("Can't execute reboot script");
-	end
-	os.execute("echo 'Return \"Reboot in progress\" to parent' > /dev/console");
-	return ("Reboot in progress");
-
-    elseif rq.POST["telnet"] == "enable" then
-
-	print("Enabling telnet service");
-	os.execute("echo 'Enabling telnet service' > /dev/console");
-	os.execute("/usr/libexec/telnetd -4 -debug 23 &");
-	return ("telnet service started");
-
-    else
-
---	print(tdump(rq));
---	print(tdump(rq.POST));
-	return ("Unknow command");
-
-    end
-end
-
-
-
-    return ([[
-<?xml version="1.0" encoding="utf-8" ?>
-<data>
-]] ..
-process() ..
-[[
-</data>
-]]);
-
-
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/css/router.css	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +0,0 @@
-html, div, h1, h2, h3, h4, p, ul, ol, li, dl, dt, dd, td, input, select, textarea
-{
-	font-family: Tahoma, Helvetica, Geneva, Arial, sans-serif;
-	font-size: 12px;
-}
-
-body
-{
-	background: #CCDCE2;
-	font-size: 12px; font-family:
-	Arial; margin: 0px;
-}
-
-body.body_fw{
-	background: #ffffff;
-}
-
-input, select, textarea
-{
-	font-family: Tahoma, Helvetica, Geneva, Arial, sans-serif;
-	font-size: 11px;
-}
-
-input.text
-{
-	text-align: left;
-	border: solid;
-	border-width: 1px;
-	border-color: steelblue;
-}
-
-.style6
-{
-	font-size: 14px;
-	font-weight: bold;
-}
-.r_tb
-{
-	font-family: Tahoma, Helvetica, Geneva, Arial, sans-serif;
-	font-size: 12px;
-	text-align:right;
-}
-.c_tb
-{
-	font-family: Tahoma, Helvetica, Geneva, Arial, sans-serif;
-	font-size: 12px;
-	text-align:center;
-}
-.l_tb
-{
-	font-family: Tahoma, Helvetica, Geneva, Arial, sans-serif;
-	font-size: 12px;
-	text-align:left;
-}
-.br_tb
-{
-	font-family: Tahoma, Helvetica, Geneva, Arial, sans-serif;
-	font-size: 12px;
-	text-align:right;
-	font-weight: bold;
-}
-.bc_tb
-{
-	font-family: Tahoma, Helvetica, Geneva, Arial, sans-serif;
-	font-size: 12px;
-	text-align:center;
-	font-weight: bold;
-}
-.bl_tb
-{
-	font-family: Tahoma, Helvetica, Geneva, Arial, sans-serif;
-	font-size: 12px;
-	text-align:left;
-	font-weight: bold;
-}
-
-h1
-{
-	color: #000000;
-	font-size: 12px;
-	font-weight: bold;
-	letter-spacing: 1px;
-	text-transform: uppercase;
-	margin: 0 -10px 5px -10px;
-	padding: 5px 5px 5px 10px;
-	background: url(img/light_blue1.jpg);
-}
-
-#table_tree{
-	font-family: Arial;
-	font-size: 22px;
-	height: 514px;
-	width: 200px;
-	margin: 5px 4px 3px 1px;
-	border-top-color:#808080;
-	border-left-color:#808080;
-	background:#FFFFFF;
-}
-
-#table_page{
-	width:555px;
-	height: 514px;
-	margin: 5px 5px 5px 3px;
-	border-width: 2px;
-	border-top:solid 2 #ffffff;
-	border-bottom:solid 2 #808080;
-	border-left:solid 2 #ffffff;
-	border-right:solid 2 #808080;
-	background:#CCDCE2;
-}
-
-#table_frame{
-	width:547px;
-	height: 504px;
-	margin: 2px 2px 2px 3px;
-	border: 1px solid #136393;
-	background:#E4EAEB;
-}
-
-#alink_tree a:link, #alink_tree a:visited, #alink_tree a:active{
-	text-decoration: none;
-	font-size: 11px;
-	color: #000000;
-}
-
-#td_header
-{
-	font-family: Arial;
-	height: 30px;
-	color: #000000;
-	font-size: 18px;
-	background: url(img/light_blue1.jpg);
-	padding-left: 15px;
-}
-
-#table_header{
-	height: 30px;
-	width: 100%;
-	background:#CCDCE2;
-}
-
-#table_set_main{
-	width: 100%;
-	margin-top: 1px;
-	border-top: solid 1px  #136393;
-	background: #E4EAEB;
-	padding-left: 5px;
-	padding-top: 5px;
-}
-
-#td_left{
-	font-family: Arial;
-	text-align:left;
-	margin: 2px;
-	height:25px;
-}
-
-#td_right{
-	font-family: Arial;
-	text-align:left;
-}
-
-span.word{
-	vertical-align: 3px;
-	padding: 0px 3px 0px 3px;
-}
-
-span.img{
-	vertical-align: 5px;
-}
-
-a.logout{
-	font-family: Arial;
-	font-size: 11px;
-	margin: 0px 0px 0px 0px;
-	padding: 6px 8px 6px 8px;
-	width:200px;
-}
-
-a.logout:link, a.logout:visited, a.logout:active{
-	color: #000000;
-	background: #FFFFCC;
-}
-
-a.logout:hover {
-	color: #0000FF;
-	background: #FFFFCC;
-	text-decoration: underline;
-}
-
-.list_head{
-	background: #4D4D4D;
-	color: #FFFFFF;
-}
-
-.div_tab {
-	background: #ffffff;
-	border-color: #c0c0c0 #ffffff #ffffff #c0c0c0;
-	border-style: inset;
-	border-width: 2px;
-	overflow: auto;
-	height: 125px;
-}
-
-.div_tab td{
-	height: 20px;
-}
-
-.div_tab tr{
-	height: auto;
-}
-
-.div_client_tab{
-	background: #E4EAEB;
-	border-color: #c0c0c0 #ffffff #ffffff #c0c0c0;
-	border-style: inset;
-	border-width: 1px;
-	overflow: auto;
-}
-
-.div_client_tab td{
-	height: 20px;
-}
-
-.div_client_tab tr{
-	height: auto;
-}
-
-.table_tool{
-	width: 99%;
-	background: #E4EAEB;
-	border: 1px solid #136393;
-
-}
-
-.table_tool_td{
-	font-family: Arial;
-	height: 25px;
-	color: #ffffff;
-	font-size: 15px;
-	background: #6595b9;
-	padding-left: 5px;
-}
-
-.table_tool td{
-	padding: 3px;
-}
-
-.sec_n {
-  	background-color: #EEEEEE;
-  	color: #000000;
-  	border-left: 1px solid #FFFFFF;
-  	border-top: 1px solid #FFFFFF;
-  	border-right: 1px solid gray;
-  	border-bottom: 1px solid #FFFFFF
-}
-
-.sec_s {
-  	background-color: #D4D0C8;
-  	color: #000000;
-  	border-left: 1px solid #FFFFFF;
-  	border-top: 1px solid #FFFFFF;
- 	 border-right: 1px solid gray;
- 	font-weight: bold;
-}
-
-.TabPane_body {
-  	background-color: #D4D0C8;
-  	color: #000000;
-  	border-left:1px solid #FFFFFF;
-  	border-right: 1px solid gray;
-  	border-bottom: 1px solid gray;
-  	width:99%;
-  	height:350px;
-}
-
-.edit_vlan_table{
-
-	background-color: #E4EAEB;
-	margin:20px 10px 0px 10px;
-	border: 1px solid #136393;
-}
-
-.help_title_td
-{
-	font-size: 14px;
-	text-decoration: underline;
-	font-weight:bold;
-
-}
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/event.xml	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
--- rq = {};
--- rq.GET = {};
-
--- rq.GET["cmd"	] = "event";
--- rq.GET["gw"	] = "192.168.1.3";
--- rq.GET["dns2"	] = "192.168.1.3";
--- rq.GET["dns1"	] = "192.168.1.3";
--- rq.GET["iface"	] = "PPP";
--- rq.GET["state"] = "up";
-
--- r = {};
-
--- function doit()
-
-function process()
-    if not c then
-	print("Configuration structure 'c' is missing");
-    end
-    if not rq then
-	print("Request structure 'rq' is missing");
-    end
-
-    if     rq.GET["cmd"] == "get" then
-
-	return (c:getNode(rq.GET["key"]):value());
-
-    elseif rq.GET["cmd"] == "set" then
-
-	c:getNode(rq.GET["key"]):value(rq.GET["value"]);
-	return (c:getNode(rq.GET["key"]):value());
-
-    elseif rq.GET["restore"] == "config" then
-
-	os.execute("echo \"event.xml: " .. rq.QueryString .."\" > /dev/console");
-	if os.execute("rm /tmp/etc/www/config.xml") ~= 0 then
-	    return ("Can't remove current config");
-	end
-	if os.execute("/etc/rc.save_config") ~= 0 then
-	    return ("Error saving configuration block to flash");
-	end
-	if os.execute("reboot &") ~= 0 then
-	    return ("Error when trying reboot");
-	end
-	return ("Configuration restored successful");
-
-    elseif rq.GET["cmd"] == "event" then
-	    -- print(rq.RequestHeader);
-	    -- cmd=event&iface=wan0&state=linkup
-	    local iface = rq.GET["iface"];
-	    local newstate = rq.GET["state"];
-
-	    if not iface then
-		return ("event.lua: ERROR: Interface not defined");
-	    end
-
-	    if type(r[iface]) ~= "table" then r[iface] = {}; end
-
-	    print("echo \"event.xml: " .. rq.QueryString .."\" > /dev/console");
-	    if newstate == "up" then
-		-- Update NAT alias address for Static/DHCP
-		if iface == "wan0" then
-		    local ip = rq.GET["ip"];
-		    ip = ip:gsub("/%d+", "");
-		    os.execute("ngctl msg wan0nat: setaliasaddr " .. ip);
-		end
-	    elseif newstate == "linkup" then
-		--
-		run_dhclient(c, iface); -- if DHCP enabled.
-	    elseif newstate == "down" then
-		--
-	    elseif newstate == "linkdown" then
-		--
-	    end
-
-	    for k,v in pairs(rq.GET) do
-		if (k ~= "iface") and (k ~= "cmd") then
-		    r[iface][k] = v;
-		end
-	    end
-
-	return "OK";
-
-    elseif rq.GET["cmd"] == "revent" then
-
-	iface = rq.GET["iface"];
-
-	if r[iface] then
-	    return (tdump(r[iface]));
-	else
-	    return ("ERROR: no data for interface " .. iface);
-	end
-    else
-	return ("ERROR: unknown command");
-    end
-end
-
-return ([[
-<?xml version="1.0" encoding="utf-8" ?>
-<data>]] ..
-process() ..
-[[
-</data>
-]]);
-
--- end
-
--- print(doit());
-
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/header.html	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-    <head>
-	<meta http-equiv="content-type" content="text/html; charset=utf-8">
-	<title></title>
-	<style type="text/css"> body {	margin:0; padding:0; } 	</style>
-	<link href="css/anim.css" rel="stylesheet" type="text/css">
-    </head>
-    <body class="yui3-skin-sam  yui-skin-sam">
-<script type="text/javascript" src="js/ajax.js"></script>
-<script>
-function send_update(form, proc)
-{
-    var query = getValuesAsArray(form);
-    if (!proc) {
-	proc = function (x) { };
-    }
-    ajax("POST", "/cmd.xml", query, true, proc);
-
-    return false;
-}
-</script>
-
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/home_sys.html	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-
-<HTML XMLNS="http://www.w3.org/1999/xhtml">
-  <HEAD>
-    <LINK REL="stylesheet" HREF="index_files/router.css" TYPE="text/css">
-    <META http-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
-    <TITLE>$$$info.device.vendor$$$&nbsp;&nbsp;&nbsp;$$$info.device.model$$$&nbsp;&nbsp;&nbsp;$$$info.device.revision$$$</TITLE>
-    <script type="text/javascript" src="js/utils.js"></script>
-    <script type="text/javascript" src="js/ajax.js"></script>
-  </HEAD>
-  <BODY LEFTMARGIN="0" TOPMARGIN="0" STYLE="overflow:auto;" BGCOLOR="#ccdce2" MARGINHEIGHT="0" MARGINWIDTH="0">
-    <TABLE ID="table_frame" BORDER="0" CELLPADDING="0" CELLSPACING="0">
-      <TBODY>
-        <TR>
-          <TD VALIGN="top">
-            <TABLE ID="table_header" CELLPADDING="0" CELLSPACING="0">
-              <TBODY>
-                <TR><TD ID="td_header" VALIGN="middle">System Information</TD></TR>
-              </TBODY>
-            </TABLE>
-            <TABLE ID="table_set_main" BORDER="0" CELLPADDING="0" CELLSPACING="0">
-              <!-- ________________________________ Main Content Start ______________________________ -->
-              <TBODY>
-                <TR><TD ID="td_left" HEIGHT="25" WIDTH="150">Device</TD>
-            	    <TD ID="td_right">$$$info.device.vendor$$$&nbsp;&nbsp;&nbsp;$$$info.device.model$$$&nbsp;&nbsp;&nbsp;$$$info.device.revision$$$</TD>
-            	</TR>
-                <TR><TD ID="td_left" HEIGHT="25" WIDTH="150">SoC</TD>
-            	    <TD ID="td_right">$$$info.soc.vendor$$$&nbsp;&nbsp;&nbsp;$$$info.soc.model$$$&nbsp;&nbsp;&nbsp;$$$info.soc.revision$$$</TD>
-            	</TR>
-                <TR><TD ID="td_left" HEIGHT="25">Firmware Version</TD><TD ID="td_right">$$$info.firmware.version$$$</TD></TR>
-                <TR><TD ID="td_left" HEIGHT="25">Code revision</TD><TD ID="td_right">$$$code: r.zrouter_version.revision $$$</TD></TR>
-                <TR><TD ID="td_left" HEIGHT="25">Firmware build date</TD><TD ID="td_right">$$$code: r.zrouter_version.build $$$</TD></TR>
-                <TR><TD ID="td_left" HEIGHT="25">System Name</TD><TD ID="td_right">$$$info.hostname$$$</TD></TR>
-                <TR><TD ID="td_left" HEIGHT="25">Location</TD><TD ID="td_right">$$$info.location$$$</TD></TR>
-                <TR><TD ID="td_left" HEIGHT="25">System Time</TD><TD ID="td_right">$$$code:os.date("%Y-%m-%d %H:%M:%S")$$$</TD></TR>
-                <!--TR><TD ID="td_left" HEIGHT="25">Up Time</TD><TD ID="td_right"></TD></TR-->
-                <!-- TR><TD ID="td_left" HEIGHT="25">Operation Mode</TD><TD ID="td_right">Access Point</TD></TR -->
-                <!-- TR><TD ID="td_left" HEIGHT="25">MAC Address</TD><TD ID="td_right">00:21:91:5a:86:f2</TD></TR-->
-                <!-- TR><TD ID="td_left" HEIGHT="25">SSID 1~3</TD><TD ID="td_right">02:21:91:5a:86:f2 ~ 06:21:91:5a:86:f2</TD></TR-->
-                <TR><TD ID="td_left" HEIGHT="25">IP Address</TD><TD ID="td_right">$$$interfaces.bridge0.ipaddr$$$</TD></TR>
-
-              </TBODY>
-    	      <!-- ________________________________  Main Content End _______________________________ -->
-            </TABLE>
-          </TD>
-        </TR>
-      </TBODY>
-    </TABLE>
-  </BODY>
-</HTML>
Binary file profiles/dlink.ua.web/files/etc/www/htdocs/img/banner.jpg has changed
Binary file profiles/dlink.ua.web/files/etc/www/htdocs/img/tool_bar.jpg has changed
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/index.html	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <link rel="stylesheet" href="css/router.css" type="text/css" />
-  <link rel="stylesheet" href="css/toolbar.css" type="text/css" />
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-
-  <title>$$$info.device.vendor$$$&nbsp;&nbsp;&nbsp;$$$info.device.model$$$&nbsp;&nbsp;&nbsp;$$$info.device.revision$$$</title>
-  <script type="text/javascript" src="js/utils.js"></script>
-  <script type="text/javascript" src="js/wizard.js"></script>
-  <!-- script type="text/javascript" src="js/tree.js"></script -->
-  <script type="text/javascript" src="js/view.js"></script>
-  <script type="text/javascript" src="js/ajax.js"></script>
-</head>
-<body leftmargin="0" topmargin="0" style="overflow: auto;" bgcolor="#ccdce2" marginheight="0" marginwidth="0">
-    <center>
-      <table id="MainTable" border="1" bordercolor="#1e4c7d" cellpadding="0" cellspacing="0">
-        <tbody>
-          <tr>
-            <td colspan="2">
-              <table background="img/banner.jpg" border="0" cellpadding="0" cellspacing="0" height="71" width="1000">
-                <tbody>
-                  <tr>
-                    <td align="right" valign="middle">
-                      <font style="color: white; font-family: Arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
-                        <b>$$$info.device.vendor$$$&nbsp;&nbsp;&nbsp;$$$info.device.model$$$&nbsp;&nbsp;&nbsp;$$$info.device.revision$$$</b>
-                      </font>
-                    </td>
-                  </tr>
-                </tbody>
-              </table>
-            </td>
-          </tr>
-          <tr>
-            <td colspan="2">
-              <div class='toolbar'>
-                <ul>
-                  <li><a href='home_sys.html' target='ifrMain'><span>Home<img src='img/home.gif' width='16' border='0' hspace='10'></span></a></li>
-                  <li class='separator'>&nbsp;</li>
-                  <li><a href='#'><span>Maintenance<img src='img/tool.gif' width='16' border='0' hspace='10'></span></a>
-                    <ul>
-                      <li><a href='#' onClick="tryget('system=reboot'); return false;"><span>Reboot</span></a></li>
-                    </ul>
-                  </li>
-                  <li class='separator'>&nbsp;</li>
-                  <li><a href='#'><span>Configuration</span></a>
-                    <ul>
-                       <li><a href='#' onClick="tryget('save=config'); return false;"><span>Save Configuration</span></a></li>
-                       <li><a href='#' onClick="tryget('restore=config'); return false;"><span>Restore to Default</span></a></li>
-                       <li><a href='#' onClick="tryget('telnet=enable'); return false;"><span>Run telnet service</span></a></li>
-                    </ul>
-                  </li>
-                  <li class='separator'>&nbsp;</li>
-                  <li><a href='http://www.dlink.ua/files/products/ftp/pub/Router/DIR-632/Help/'><span>Help</span></a></li>
-                </ul>
-              </div>
-              <div style="clear:both; height: 0px; margin: 0px 0px 0px 0px;">&nbsp;</div>
-            </td>
-          </tr>
-
-
-          <tr>
-            <td bordercolor="ccdce2" valign="top">
-              <table id="table_tree" style="margin: 3px; width: 256px;" border="1" cellpadding="0" cellspacing="0" frame="box" width="261">
-                <tbody>
-                  <tr>
-                    <td id="link_tree" valign="top">
-                      <iframe id="ifrMenu" class="ifrMenu" src="tv.html" frameborder="0" height="100%" scrolling="no" width="100%"></iframe>
-                    </td>
-                  </tr>
-                </tbody>
-              </table>
-            </td>
-            <td bordercolor="ccdce2" valign="top" style="padding: 5px;">
-              <table id="table_page" style="margin: 3px; width: 720px; padding: 5px;" border="0" cellpadding="0" cellspacing="0" frame="box" width="750">
-                <tbody>
-                  <tr>
-                    <td>
-                      <iframe id="ifrMain" name="ifrMain" src="home_sys.html" onload="" frameborder="0" height="100%" scrolling="auto" width="100%"></iframe>
-                    </td>
-                  </tr>
-                </tbody>
-              </table>
-            </td>
-          </tr>
-          <tr>
-            <td colspan="2">
-              <table background="img/FreeBSD_logo.png" border="0" cellpadding="0" cellspacing="0" height="75" width="1000">
-                <tbody>
-                  <tr>
-                    <td align="right" valign="middle">
-                      &nbsp;
-                    </td>
-                  </tr>
-                </tbody>
-              </table>
-            </td>
-          </tr>
-        </tbody>
-      </table>
-    </center>
-</body>
-</html>
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/js/ajax.js	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-
-function getXmlHttp()
-{
-	var xmlhttp;
-	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
-	catch (e) {
-		try {  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP.6.0"); }
-		catch (E) { }
-		try {  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP.3.0"); }
-		catch (E) { }
-		try {  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
-		catch (E) { xmlhttp = false; }
-	}
-	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
-		xmlhttp = new XMLHttpRequest();
-	}
-	return xmlhttp;
-}
-
-var xmlhttp = getXmlHttp()
-var xmlhttptimeout = 0;
-
-function ajax(method, target, msg, async, handler)
-{
-
-	if (handler != "ignore") {
-		xmlhttptimeout = setTimeout( function(){ xmlhttp.abort(); alert("Timeout") }, 10000);
-	}
-
-	xmlhttp.onreadystatechange = function()
-	{
-		if (xmlhttp.readyState != 4) return;
-
-		clearTimeout(xmlhttptimeout);
-
-		if (xmlhttp.status == 200) {
-	    		handler(xmlhttp);
-		} else {
-	    		alert("Error: " + xmlhttp.statusText);
-		}
-	}
-
-	xmlhttp.open(method, target, async);
-	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
-	xmlhttp.send(msg);
-}
-
-function getValuesAsArray(formRef)
-{
-	var ret = "r=" + encodeURIComponent(Math.random());
-	var els = formRef.elements;
-	for(var no=0; no < els.length; no++)
-	{
-		if(els[no].disabled)
-		    continue;
-		var tag = els[no].tagName.toLowerCase();
-
-		switch(tag){
-			case "input":
-				var type = els[no].type.toLowerCase();
-
-				if(!type)
-				    type='text';
-
-				switch(type){
-					case "text":
-					case "image":
-					case "hidden":
-					case "password":
-						ret += '&' + encodeURIComponent(els[no].name) + '=' + encodeURIComponent(els[no].value);
-						break;
-					case "checkbox":
-						if(els[no].checked)
-						    ret += '&' + encodeURIComponent(els[no].name) + '=true';
-						else
-						    ret += '&' + encodeURIComponent(els[no].name) + '=false';
-						break;
-					case "radio":
-						if(els[no].checked)
-						    ret += '&' + encodeURIComponent(els[no].name) + '=' + encodeURIComponent(els[no].value);
-						break;
-				}
-				break;
-			case "select":
-				var string = '';
-				var mult = els[no].getAttribute('multiple');
-				if(mult || mult===''){
-					ops = els[no].options;
-
-					for(var no2=0;no2<ops.length;no2++)
-					{
-						var index = retArray[els[no].name].length;
-						if(ops[no2].selected)
-						    ret += '&' + encodeURIComponent(els[no].name + index) + '=' + encodeURIComponent(ops[no2].value);
-					}
-				}else{
-					ret += '&' + encodeURIComponent(els[no].name) + '=' + encodeURIComponent(ops[els[no].selectedIndex].value);
-				}
-				break;
-			case "textarea":
-				ret += '&' + encodeURIComponent(els[no].name) + '=' + encodeURIComponent(els[no].value);
-				break;
-		}
-	}
-	return ret;
-}
-
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/js/defineMyTree.js	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/* You can find instructions for this file here:
-/ http://www.geocities.com/marcelino_martins/ftv2instructions.html
-*/
-
-// Decide if the names are links or just the icons
-var USETEXTLINKS = 1;  //replace 0 with 1 for hyperlinks
-
-// Decide if the tree is to start all open or just showing the root folders
-var STARTALLOPEN = 0; //replace 0 with 1 to show the whole tree
-
-var ICONPATH = 'img/';
-
-var deviceType="Router";
-
-var  band=0;
-
-
-if(band==0)
-{
-	var x="CfgWLanParam.html?0";
-}
-else
-{
-	var x="CfgWLanParam.html?1";
-}
-
-
-var foldersTree = gHeader(deviceType, "/home_sys.html");
-var aux1, aux2;
-
-aux1 = insFld(foldersTree, gFld("<font face=Tahoma size=2> Basic Settings </font>", ""));
-insDoc(aux1, gLnk("R","&nbsp;Internet", "/Basic.wan.html"));
-insDoc(aux1, gLnk("R","&nbsp;Wireless", "/Basic.wlan.html"));
-insDoc(aux1, gLnk("R","&nbsp;LAN", "/Basic.lan.html"));
-insDoc(aux1, gLnk("R","&nbsp;IPTV", "/Basic.iptv.html"));
-
-aux1 = insFld(foldersTree, gFld("<font face=Tahoma size=2> Security Links </font>", ""));
-insDoc(aux1, gLnk("R","&nbsp;IPSec", "/Security.IPSec.html"));
-insDoc(aux1, gLnk("R","&nbsp;OpenVPN", "/Security.OpenVPN.html"));
-insDoc(aux1, gLnk("R","&nbsp;SSH Tunnels", "/Security.SSH.html"));
-
-aux1 = insFld(foldersTree, gFld("<font face=Tahoma size=2> Administration </font>", ""));
-insDoc(aux1, gLnk("R","&nbsp;Device Info", "/Administration.info.html"));
-insDoc(aux1, gLnk("R","&nbsp;Users", "/Administration.users.html"));
-insDoc(aux1, gLnk("R","&nbsp;Firmware", "/Administration.firmware.html"));
-
-//aux1 = insFld(foldersTree, gFld("<font face=Tahoma size=2> Advanced Settings </font>", ""));
-//insDoc(aux1, gLnk("R","&nbsp;Performance", "/home_sys.html?page=adv_perf.html"));
-//insDoc(aux1, gLnk("R","&nbsp;Multi-SSID", "/home_sys.html?page=adv_mssid.html"));
-//insDoc(aux1, gLnk("R","&nbsp;VLAN ", "/home_sys.html?page=adv_8021q.html"));
-//insDoc(aux1, gLnk("R","&nbsp;Instrusion", "/home_sys.html?page=adv_rogue.html"));
-//insDoc(aux1, gLnk("R","&nbsp;Schedule", "/home_sys.html?page=adv_schedule.html"));
-//insDoc(aux1, gLnk("R","&nbsp;QOS", "/home_sys.html?page=adv_qos.html"));
-
-//aux2 = insFld(aux1, gFld("<font face=Tahoma size=2>&nbsp;DHCP Server</font>", ""));
-//insDoc(aux2, gLnk("R","&nbsp;Dynamic Pool Setting", "/home_sys.html?page=adv_dhcpd.html"));
-//insDoc(aux2, gLnk("R","&nbsp;Static Pool Setting", "/home_sys.html?page=adv_dhcps.html"));
-//insDoc(aux2, gLnk("R","&nbsp;Current IP Mapping List", "/home_sys.html?page=adv_dhcpl.html"));
-
-//aux2 = insFld(aux1, gFld("<font face=Tahoma size=2>&nbsp;Filters</font>", ""));
-//insDoc(aux2, gLnk("R","&nbsp;Wireless MAC ACL", "/home_sys.html?page=adv_acl.html"));
-//insDoc(aux2, gLnk("R","&nbsp;WLAN Partition", "/home_sys.html?page=adv_partition.html"));
-
-aux1 = insFld(foldersTree, gFld("<font face=Tahoma size=2> Status</font>", ""));
-insDoc(aux1, gLnk("R","&nbsp;Device Information", "/status.lua"));
-insDoc(aux1, gLnk("R","&nbsp;System Log", "/log.lua"));
-//insDoc(aux1, gLnk("R","&nbsp;Client Information", "/home_sys.html?page=st_info.html"));
-//insDoc(aux1, gLnk("R","&nbsp;WDS Information", "/home_sys.html?page=st_wds_info.html"));
-
-//aux2 = insFld(aux1, gFld("<font face=Tahoma size=2> Stats</font>", ""));
-//insDoc(aux2, gLnk("R","&nbsp;Ethernet", "/home_sys.html?page=st_stats_lan.html"));
-//insDoc(aux2, gLnk("R","&nbsp;WLAN", "/home_sys.html?page=st_stats_wl.html"));
-
-//aux2 = insFld(aux1, gFld("<font face=Tahoma size=2>Log</font>", ""));
-//insDoc(aux2, gLnk("R","&nbsp;View Log", "/home_sys.html?page=st_log.html"));
-//insDoc(aux2, gLnk("R","&nbsp;Log Settings", "/home_sys.html?page=st_logs.html"));
-
--- a/profiles/dlink.ua.web/files/etc/www/htdocs/js/view.js	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-function tryget(msg)
-{
-	if (msg == 'system=reboot') {
-
-		ajax("POST", "/cmd.xml", "system=reboot&r=" + encodeURIComponent(Math.random()), true, "ignore");
-		reboottimeout = setTimeout( function(){ clearTimeout(reboottimeout); window.location = "/";}, 80000);
-		return false;
-	}
-
-	ajax("POST", "/cmd.xml", msg + "&r=" + encodeURIComponent(Math.random()), true,
-	    function (x) {
-		window.alert(x.responseXML.getElementsByTagName("data")[0].firstChild.nodeValue);
-	    }
-	);
-	return false;
-}
-
-
--- a/profiles/dlink.ua.web/files/etc/www/httpd.lua	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1290 +0,0 @@
-#!/usr/bin/lua
---  -*-mode: C++; style: K&R; c-basic-offset: 4 ; -*- */
-
---
---  A simple HTTP server written in Lua, using the socket primitives
--- in 'libhttpd.so'.
---
---
--- Steve Kemp
--- --
--- http://www.steve.org.uk/
---
--- $Id: httpd.lua,v 1.31 2005/10/31 17:08:22 steve Exp $
-
-
---
--- load the socket library
---
-package.path = "./?.lua;/etc/www/lib/?.lua;./lib/?.lua";
-package.cpath =
-	"/lib/?.so;/usr/lib/?.so;/usr/lib/lua/?.so;" ..
-	"/lib/lua?.so;/usr/lib/lua?.so;/usr/lib/lua/lua?.so;" ..
-	"/lib/?-core.so;/usr/lib/?-core.so;/usr/lib/lua/?-core.so;" ..
-	"/lib/?/core.so;/usr/lib/?/core.so;/usr/lib/lua/?/core.so;";
-
---io.stdout = assert(io.open("/dev/console", "w"));
---io.stderr = io.stdout;
-
-socket = require("socket");
-require('sysctl.core');
-
--- Expat binding
-dofile('lib/xml.lua');
--- XML entity handlers
-dofile('lib/handler.lua');
-
--- read_file, tdump, xmldump
-dofile('lib/utils.lua');
--- Conf object
-dofile('lib/conf.lua');
--- Node object
-dofile('lib/node.lua');
--- base64 decode/encode
-dofile('lib/base64.lua');
--- Socket helper
---dofile("lib/sock.lua");
--- Route select logic
-dofile("lib/route.lua");
--- MPD helper
-dofile("lib/mpd.lua");
--- RACOON helper
-dofile("lib/racoon.lua");
--- DHCPD helper
--- dofile("lib/dhcpd.lua");
--- HOSTAPD helper
---dofile("lib/hostapd.lua");
-
--- redirect print to /dev/console
--- dofile("lib/print_to_console.lua");
-
--- redirect print to syslog
-dofile("lib/lsyslog.lua");
-syslog_init("httpd.lua");
-
--- urlEncode/urlDecode
-dofile("lib/urlXxcode.lua");
-
-httpd_debug = true;
-
---
---  A table of MIME types.
---  These values will be loaded from /etc/mime.types if available, otherwise
--- a minimum set of defaults will be used.
---
-mime = {};
-
--- # lua -e 'package.cpath ="/usr/lib/lua/lua?.so"; require("sysctl.core"); s,e,v,t = pcall(function () return sysctl.get("hw.device.model") end); print(s,e,v,t);'
--- true    DIR-825 A       nil
--- # lua -e 'package.cpath ="/usr/lib/lua/lua?.so"; require("sysctl.core"); s,e,v,t = pcall(function () return sysctl.get("hw.device.mode") end); print(s,e,v,t);'
--- false   (command line):1: unknown iod 'hw.device.mode'  nil     nil
-
--- save sysctl obj
-sysctl_obj = sysctl;
-function sysctl(oid, value)
-	if type(oid) == "table" then
-		print("sysctl(table) not implemented\n");
-	else
-		if value then
-			print("sysctl(%s, %s)\n", oid, tostring(value));
-			local s,v,t = pcall(function () return sysctl_obj.set(oid, value) end);
-			if s then return (v); end
-			return (nil);
-		else
-			print("sysctl(%s)\n", oid);
-			local s,v,t = pcall(function () return sysctl_obj.get(oid) end);
-			if s then return (v); end
-			return (nil);
-		end
-	end
-end
-
---
---  Start a server upon the given port, using the given
--- root directory path.
---
---  The root path is designed to contain sub-directories for
--- each given virtual host.
---
-function start_server( c, config )
-	running = 1;
-
-	--
-	--  Bind a socket to the given port
-	-- c:getNode("http.host"):value();
-	s = socket.tcp();
-	assert(s:setoption("reuseaddr", true));
-	assert(s:bind("*", c:getNode("http.port"):value()));
-	assert(s:listen(8));
-	assert(s:settimeout(5));
-	config.listener = s;
-
-	--
-	--   Print some status messages.
-	--
-	print( "\nListening upon:" );
-	print( "  http://" .. c:getNode("http.host"):value() .. ":" ..
-			c:getNode("http.port"):value() .. "/" );
-	print( "\n\n");
-	--[[
-	table.insert(r.tasks.countdown, { count=25, task=
-			function()
-			print("task 0 ok");
-			return (true);
-			end
-			});
-	table.insert(r.tasks.countdown, { count=10, task=
-			function()
-			print("task 1 ok");
-			return (true);
-			end
-			});
-	table.insert(r.tasks.countdown, { count=15, task=
-			function()
-			print("task 2 ok");
-			return (true);
-			end
-			});
-	table.insert(r.tasks.countdown, { count=5, task=
-			function()
-			print("task 3 ok");
-			return (true);
-			end
-			});
-	]]
-	--
-	--  Loop accepting requests.
-	--
-	while ( running == 1 ) do
-	processConnection( c, config );
-	periodic_tasks(c);
-	end
-
-	--
-	-- Finished.
-	--
-	config.listener:close();
-end
-
-function periodic_tasks(c)
-	-- fetch collector info
-	local i;
-	local n = #r.tasks.countdown;
-
-	for i = n,1,-1 do
-		r.tasks.countdown[i].count = r.tasks.countdown[i].count -
-		    r.tasks.step;
-
-		if (r.tasks.countdown[i].count <= 0) then
-			-- Task must return true, else run forever
-			if r.tasks.countdown[i].task() then
-				table.remove(r.tasks.countdown, i);
-			end
-		end
-	end
-end
-
-
-
---
---  Process a single incoming connection.
---
-function processConnection( c, config )
-	--
-	--  Accept a new connection
-	--
-	config.listener:settimeout(r.tasks.step);
-	local client = config.listener:accept();
-	if (not client) then return (nil) end;
-	local ip, port = client:getpeername();
-
-	if not client then
-		return (nil);
-	end
-
-	found   = 0;  -- Found the end of the HTTP headers?
-	chunk   = 0;  -- Count of data read from client socket
-	size    = 0;  -- Total size of incoming request.
-	code    = 0;  -- Status code we send to the client
-	request = ""; -- Request body read from client.
-	rq = {};
-	rq.ip = ip;
-	rq.port = port;
-
-
-	--
-	--  Read in a response from the client, terminating at the first
-	-- '\r\n\r\n' line - this is the end of the HTTP header request.
-	--
-	--  Also break out of this loop if we read ten packets of data
-	-- from the client but didn't manage to find a HTTP header end.
-	-- This should help protect us from DOSes.
-	--
-	-- client:settimeout(1);
-	--    while ( true ) do
-	--    	local data, err = client:receive("*l");
-	--
-	--	if not data then break end
-	--
-	--        request = request .. data .. "\r\n";
-	--
-	--	if data:len() <= 0 then break end
-	--    end
-
-	--    local request, err = client:receive("*a");
-
-	--    size = request:len();
-	--
-	--    print("Rq: \"" .. request .. "\"");
-	--
-	--    position,len = request:find("\r\n\r\n");
-	--    if ( position ~= nil )  then
-	--        rq.RequestHeader = request:sub(0, position);
-	--        rq.RequestBody   = request:sub(position+4);
-	--        rq.RequestBodyLength = len-4;
-	--    else
-	--	-- Maybe we need say ERROR!!!!
-	--	return (nil);
-	--    end
-
-	rq.ContentLength = -1;
-	rq.RequestHeader = "";
-	i = 1;
-	while ( true ) do
-		local data, err = client:receive("*l");
-		--print(i, data or "(no data)", err or " . ");
-		i = i + 1;
-
-		if not data then break end
-
-		local match, _, len = data:find("Content%-Length: ([^:\r\n]+)");
-		if match then
-			rq.ContentLength = tonumber(len);
-		end
-
-		rq.RequestHeader = rq.RequestHeader .. data .. "\r\n";
-
-		if data:len() <= 0 then break end
-	end
-
-	if rq.ContentLength >= 0 then
-		rq.RequestBodyLength = rq.ContentLength;
-		rq.RequestBody, err = client:receive(rq.RequestBodyLength);
-	end
-
-	if err then
-		rq.RequestBodyLength = nil;
-		rq.RequestBody = nil;
-	end
-
-	--
-	--  OK We now have a complete HTTP request of 'size' bytes long
-	-- stored in 'rq.RequestHeader'.
-	--
-
-	--
-	-- Find the requested path.
-	--
-	_, _, method, path, major, minor  =
-	    string.find(rq.RequestHeader, "([A-Z]+) (.+) HTTP/(%d).(%d)");
-
-	--
-	-- We only handle GET requests.
-	--
-	if ( method ~= "GET" ) and ( method ~= "POST" ) then
-		error = "Method not implemented";
-
-		if ( method == nil ) then
-			error = error .. ".";
-		else
-			error = error .. ": " .. urlEncode( method );
-		end
-
-		err = sendError(501, error);
-		client:send(err);
-		client:close();
-		return err:len(), "501";
-	end
-
-
-	--
-	-- Decode the requested path.
-	--
-	path = urlDecode( path );
-
-	--
-	-- find the Virtual Host which we need for serving, and find the
-	-- user agent and referer for logging purposes.
-	--
-	_, _, rq.Host           = rq.RequestHeader:find( "Host: (.-)\r?\n");
-	_, _, rq.Agent          = rq.RequestHeader:find( "Agent: (.-)\r?\n");
-	_, _, rq.Referer        = rq.RequestHeader:find( "Referer: (.-)\r?\n");
-
-	_, _, rq.Accept         = rq.RequestHeader:find( "Accept: (.-)\r?\n");
-	_, _, rq.AcceptLanguage = rq.RequestHeader:find( "Accept%-Language: ([^:\r\n]+)");
-	_, _, rq.AcceptEncoding = rq.RequestHeader:find( "Accept%-Encoding: ([^:\r\n]+)");
-	_, _, rq.AcceptCharset  = rq.RequestHeader:find( "Accept%-Charset: ([^:\r\n]+)");
-	_, _, rq.ContentType    = rq.RequestHeader:find( "Content%-Type: ([^:\r\n]+)");
-	_, _, rq.ContentLength  = rq.RequestHeader:find( "Content%-Length: ([^:\r\n]+)");
-	_, _, rq.Authorization  = rq.RequestHeader:find( "Authorization: ([^:\r\n]+)");
-
-	rq.UserName = nil;
-	rq.Password = nil;
-	rq.Group    = nil;
-	if rq.Authorization then
-		local BasicAuth = "";
-		_, _, BasicAuth = string.find(rq.RequestHeader,
-		    "Basic ([^:\r\n]+)");
-		if BasicAuth then
-			local pair = b64dec(BasicAuth);
-			_, _, _u, _p = string.find(pair, "(.-)%:(.*)");
-
-			for usr = 1, 8, 1 do
-				local u = c:getNode(string.format(
-				    "http.users.user[%d]",
-				    usr));
-				if u and (u:attr("username") == _u) and
-				    (u:attr("password") == _p) then
-					rq.UserName = _u;
-					rq.Password = _p;
-					rq.Group    = u:attr("group");
-				end
-			end
-		end
-	end
-
-	if not rq.Group and rq.ip ~= "127.0.0.1" then
-		local message = "HTTP/1.1 401 Authorization Required\r\n" ;
-			message = message .. "Server: httpd\r\n";
-			message = message .. "WWW-Authenticate: Basic " ..
-			    "realm=\"Secure Area\"\n";
-			message = message .. "Content-type: text/html\r\n";
-			message = message .. "Connection: close\r\n\r\n" ;
-			message = message ..
-			    "<html>" ..
-				"<head><title>Error</title></head>" ..
-				"<body><H1>401 Unauthorized.</H1></body>" ..
-			    "</html>" ;
-		--Content-Length: 311
-
-		size = string.len(message);
-		client:send(message);
-		client:close();
-		code = "401";
-	else
-		size, code = handleRequest(c, config, path, client, method, rq);
-	end
-
-	if ( rq.Agent   == nil ) then rq.Agent   = "-" end;
-	if ( rq.Referer == nil ) then rq.Referer = "-" end;
-	if ( code       == nil ) then code       = 0 ; end;
-
-	if ( running == 0 ) then
-		print( "Terminating as per request from " .. ip );
-	end
-
-	--
-	--  Close the client connection.
-	--
-	client:close();
-end
-
---
---  Attempt to serve the given path to the given client
---
-function handleRequest( c, config, path, client, method, rq )
-	--
-	-- Local file
-	--
-	local file = string.gsub(path, "%?.*", "");
-	local query_string = "";
-	if file ~= path then
-		query_string = string.gsub(path, ".*%?", "");
-	end
-
-	rq.ScriptName = file;
-	rq.QueryString = query_string;
-	rq.GET = parse_query(query_string);
-	-- TODO check request content type
-	if rq.RequestBody then
-		rq.POST = parse_query(rq.RequestBody);
-	end
-
-	--
-	--  File must be beneath the vhost root.
-	--
-	file = "htdocs/" .. file ;
-
-	--
-	--  Attempt to sanitize the input Virtual Host + requested path.
-	--
-	--    file = string.strip( file );
-	file = string.gsub (file, "//", "/")
-
-	--
-	-- Add a trailing "index.html" to paths ending in / if such
-	-- a file exists.
-	--
-	-- Otherwise if it is a directory then serve it.
-	--
-	if ( string.endsWith( file, "/" ) ) then
-		tmp = file .. "index.html";
-		if ( fileExists( tmp ) ) then
-			file = tmp;
-		end
-	end
-
-	--
-	-- Open the file and return an error if it fails.
-	--
-
-	if ( fileExists(file) == false ) then
-		err = sendError(404, "File not found " .. urlEncode(path));
-		size = string.len(err);
-		client:send(err)
-		client:close();
-		return size, "404";
-	end;
-
-	--
-	-- Find the suffix to get the mime.type.
-	--
-	_, _, ext  = string.find( file, "\.([^\.]+)$" );
-	if ( ext == nil ) then
-		ext = "html";   -- HACK
-	end
-
-	mimetype = mime[ext];
-	if ( mimetype == nil ) then mimetype = 'text/plain' ; end;
-
-	--
-	-- Send out the header.
-	--
-	client:send(
-			"HTTP/1.0 200 OK\r\n" ..
-			"Server: httpd\r\n" ..
-			"Content-type: " .. mimetype  .. "\r\n" ..
-			"Connection: close\r\n\r\n" );
-
-
-	--
-	-- Read the file, and then serve it.
-	--
-	f       = io.open( file, "rb" );
-	size    = fileSize( f );
-	local t = f:read("*all")
-	f:close();
-
-	local retcode = "200";
-
-	-- Replace $$$ name $$$ variables
-	if (ext == "html") or (ext == "js") then
-		t = string.gsub(t, "%$%$%$(.-)%$%$%$",
-		    function (s)
-			if not s then return; end
-			return evalembeded(s)
-			end);
-
-	-- Eval Lua code
-	elseif (ext == "lua") or (ext == "xml") or (ext == "dat") then
-		code, err = assert(loadstring(t));
-		if not code then
-			t = sendError(500, "Error \""..err.."\" when parse"..
-			    " " .. urlEncode(path));
-			retcode = "500";
-		else
-			t = code();
-		end
-	end
-	client:send(t);
-	client:close();
-
-	return string.len(t), retcode;
-end
-
-function evalembeded(s)
-	if not s then
-		return "";
-	end
-
-	match, _, code = string.find(s, "^code%:(.*)$");
-	if match then
-		local func, err = loadstring("return " .. code);
-		if not func then
-			return err;
-		end
-		return func();
-	else
-		node = c:getNode(s);
-		if node then
-			return field(node:value() or "");
-		end
-		return field("");
-	end
-end
-
-function exec_output(cmd)
-	fp = io.popen(cmd, "r");
-	data = fp:read("*a");
-	fp:close();
-	return data;
-end
-
-function queryData(rq)
-	if rq.POST["cmd"] then
-		cmd = rq.POST["cmd"];
-		if cmd == "get" then
-			key = rq.POST["key"];
-			if key == "datetime" then
-				return os.date("%Y-%m-%d %H:%M:%S");
-			end
-			if key == "uptime" then
-				return sysctl("kern.ident");
-			end
-		else
-			return ("Unknown command \"" .. cmd .. "\"");
-		end
-	end
-	return ("");
-end
-
-
--- convert name1=value1&name2=val+ue%2F2
--- to table {"name1"="value1", "name2"="val ue/2"}
-function parse_query(query)
-    local parsed = {};
-    local pos = 0;
-
-    query = string.gsub(query, "&amp;", "&");
-    query = string.gsub(query, "&lt;", "<");
-    query = string.gsub(query, "&gt;", ">");
-
-    local function ginsert(qstr)
-        local first, last = string.find(qstr, "=");
-        if first then
-            local key = urlDecode(string.sub(qstr, 0, first-1));
-            local value = urlDecode(string.sub(qstr, first+1));
-            parsed[key] = value;
-        end
-    end
-
-    while true do
-        local first, last = string.find(query, "&", pos);
-        if first then
-            ginsert(string.sub(query, pos, first-1));
-            pos = last+1;
-        else
-            ginsert(string.sub(query, pos));
-            break;
-        end
-    end
-    return parsed;
-end
-
---
---  Send the given error message to the client.
---  Return the length of data sent to the client so we know what to log.
---
-function sendError( status, str )
-    message = "HTTP/1.0 " .. status .. " OK\r\n" ;
-    message = message .. "Server: httpd\r\n";
-    message = message .. "Content-type: text/html\r\n";
-    message = message .. "Connection: close\r\n\r\n" ;
-    message = message .. "<html><head><title>Error</title></head>" ;
-    message = message .. "<body><h1>Error</h1>" ;
-    message = message .. "<p>" .. str .. "</p></body></html>" ;
-
-    return (message);
-end
-
-
-
---
---  Utility function:  Determine the size of an open file.
---
-function fileSize (file)
-    local current = file:seek()      -- get current position
-    local size = file:seek("end")    -- get file size
-    file:seek("set", current)        -- restore position
-    return size
-end
-
-
---
---  Utility function:  Determine whether the given file exists.
---
-function fileExists (file)
-    local f = io.open(file, "rb");
-    if f == nil then
-        return false;
-    else
-        f:close();
-        return true;
-    end
-end
-
-function read_zrouter_version (ar)
-	ar.zrouter_version = {};
-	return parse_kv_file(ar.zrouter_version, "/etc/zrouter_version");
-end
-
-function read_rc_conf (ar)
-	ar.rc_conf = {};
-	return parse_kv_file(ar.rc_conf, "/etc/rc.conf");
-end
-
---
---  Read the mime file and setup mime types
---
-function loadMimeFile(file, table)
-     local f = io.open( file, "r" );
-     while true do
-         local line = f:read()
-         if line == nil then break end
-         _, _, mimetype, name = string.find( line, "^(.*)\t+([^\t]+)$" );
-         if ( mimetype ~= nil ) then
-             for w in string.gfind(name, "([^%s]+)") do
-                  table[w] = mimetype;
-             end
-         end
-     end
-end
-
---
---  Utility function:   Does the string end with the given suffix?
---
-function string.endsWith(String,End)
-    return End=='' or string.sub(String,-string.len(End))==End
-end
-
---
---  Strip path traversal requests.
---
-function string.strip( str )
-    return( string.gsub( str, "/../", "" ) );
-end
-
---
--- Log an access request.
---
-function logAccess( user, method, host, ip, request, status, size, agent, referer, major, minor )
-    date = os.date("%m/%b/%Y:%H:%M:%S +0000");
-
-    --
-    -- Format the logging line.
-    --
-    log  = string.format( '%s %s - - [%s] "%s %s HTTP/%s.%s" %s %s "%s" "%s"',
-        user, method, ip, date, request, major, minor, status, size, referer, agent );
-
-    logfile = "logs/access.log"
-
-    --
-    -- Open logfile for appending.
-    --
-    file = io.open( logfile , "a" );
-    if ( file ~= nil ) then
-        file:write( log .. "\n" );
-        file:close();
-    else
-        print( "WARNING : Unable to open logfile for writing : " .. logfile );
-    end
-
-    print( log );
-end
-
---
------
----
---
---  This is the start of the real code.  Now that our functions have been
--- defined we actually execute from this point onwards.
---
----
-----
---
-
---
---  Setup the MIME types our server will use for serving files.
---
-if ( fileExists( "/etc/mime.types" ) ) then
-    loadMimeFile( "/etc/mime.types",  mime );
-else
-    --
-    --  The global MIME types file does not exist.
-    --  Setup minimal defaults.
-    --
---    print( "WARNING: /etc/mime.types could not be read." );
---    print( "         Running with minimal MIME types." );
-
-    -- TODO: lua scripts can be able to set content type
-    mime[ "lua" ]  = "text/html";
-    mime[ "xml" ]  = "application/xml";
-    mime[ "html"]  = "text/html";
-    mime[ "txt" ]  = "text/plain";
-    mime[ "js"  ]  = "text/plain";
-    mime[ "css" ]  = "text/css";
-    mime[ "jpg" ]  = "image/jpeg";
-    mime[ "jpeg"]  = "image/jpeg";
-    mime[ "gif" ]  = "image/gif";
-    mime[ "png" ]  = "image/png";
-    mime[ "dat" ]  = "application/octet-stream";
-end
-
-function checkIface(name)
-	local ret = os.execute("ifconfig " .. name .. " > /dev/null");
-	if ret ~= 0 then
-	    return (nil);
-	end
-	return (true);
-end
---[[
-        <create>
-            <exec order="1">ifconfig wlan0 ether `kenv WAN_MAC_ADDR`</exec>
-            <exec order="2">ifconfig lan0 ether `kenv WAN_MAC_ADDR`</exec>
-            <exec order="3">ifconfig bridge0 create addm lan0 addm wlan0 up</exec>
-        </create>
-        <init>
-            <exec order="1">ifconfig bridge0</exec>
-        </init>
-]]
-
-function doexec(c, path)
-    if ((not c) or (not path)) then
-	return (nil);
-    end
-
-    local block = c:getNode(path);
-
-    if not block then
-	return (nil);
-    end
-
-    local function execone(c, path)
-	local exec = c:getNode(path);
-	if exec then
-	    exec = exec:value();
-	    if exec then
-		print("Run:" .. exec)
-		print(exec_output(exec));
-	    end
-	end
-    end
-
-    for i = 1,16,1 do
-	execone(c, path .. ".exec[" .. i .. "]");
-    end
-
-    return (true);
-
-end
-
-
-function configure_lan(c)
-
-    local function config_iface(c, name)
-        if not checkIface(name) then
-	    doexec(c, "interfaces." .. name ..".create");
-	end
-	doexec(c, "interfaces." .. name ..".init");
-
-	ipnode = c:getNode("interfaces." .. name .. ".ipaddr");
-	if (ipnode) then
-	    local ip = ipnode:value();
-	    if ip then
-		local cmd = "ifconfig " .. name .. " " .. " inet " .. ip;
-		print("Run:" .. cmd)
-		print(exec_output(cmd));
-	    end
-	end
-    end
-
-    config_iface(c, "lan0");
-    config_iface(c, "wlan0");
-    config_iface(c, "bridge0");
-
-end
-
-mpd = 0;
-
-function configure_mpd_link(c, path, bundle, link)
-    if mpd == 0 then
-	mpd = MPD:new(c, "127.0.0.1", 5005);
-    end
-
---    local bundle = "PPP";
---    local path = "interfaces.wan0.PPP";
-
-    mpd:config_bundle(path, bundle);
-    mpd:config_link(path, link, bundle);
-end
-
-function run_dhclient(c, iface)
-    local path = "interfaces." .. iface .. ".Static";
-
-    -- return if no iface.Static node.
-    if not c:getNode(path) then
-	return (nil);
-    end
-
-    -- return if Static mode not enabled.
-    if c:getNode(path):attr("enable") ~= "true" then
-	return (nil);
-    end
-
-    -- return if no DHCP enabled.
-    local dhcp = c:getNode(path .. ".dhcp");
-    if not dhcp or dhcp:attr("enable") ~= "true" then
-	return (nil);
-    end
-
-    -- Run dhclient
-    print("Run dhclient on " .. iface);
-    os.execute(string.format("kill `cat /var/run/dhclient.%s.pid`", iface));
-
-    -- Do not execute dhclient if interface is down
-    if exec_output("ifconfig -v " .. iface .." | grep 'status: active'") ~= "" then
-	os.execute(string.format("/sbin/dhclient -b %s", iface));
-	-- XXX, hack to "unplumb" iface if it was not up on boot
-	os.execute(string.format("ifconfig %s `ifconfig %s | grep 'ether '`", iface, iface));
-    end
-end
-
-
-function configure_wan(c)
-    -- TODO: auto enumerate wan links
-    --[[
-kldload ng_nat
-kldload ng_ipfw
-
-ngctl mkpeer ipfw: nat 60 out
-ngctl name ipfw:60 nat
-ngctl connect ipfw: nat: 61 in
-ngctl msg nat: setaliasaddr 192.168.101.204
-
-ipfw add 98 netgraph 61 all from any to any in via wan0
-ipfw add 99 netgraph 60 all from any to any out via wan0
-
-sysctl net.inet.ip.fw.one_pass=0
-    ]]
-
-    kldload({"ng_nat", "ng_ipfw"});
-    sysctl("net.inet.ip.fw.one_pass", 0);
-
-    local sub = "";
-    for _, sub in ipairs({"Static", "PPPoE", "PPP", "PTPP", "L2TP"}) do
-	print("sub=" .. sub);
-	local path = "interfaces.wan0." .. sub;
-	local ifnode = c:getNode(path);
-
-	if ifnode and ifnode:attr("enable") == "true" then
-	    local subtype = c:getNode(path):attr("type");
-	    print("subtype=" .. subtype);
-	    if (subtype == "l2tp") then
-		-- TODO: multilink have different link names
-	    elseif (subtype == "pppoe") then
-		kldload({"ng_pppoe"});
-		os.execute("sleep 1");
-		configure_mpd_link(c, path, sub, sub);
-		-- Add interface to route select logic
-		r.route:f(sub,
-		    safeValue(c, path .. ".group", "WAN"),
-		    safeValue(c, path .. ".cost", "1000") - 0,
-		    "down",
-		    "LINKDOWN")
-	    elseif (subtype == "pptp") then
-		-- TODO: multilink have different link names
-	    elseif (subtype == "modem") then
-		kldload({"umodem", "u3g"});
-		os.execute("sleep 1");
-		configure_mpd_link(c, path, sub, sub);
-		r.route:f(sub,
-		    safeValue(c, path .. ".group", "WAN"),
-		    safeValue(c, path .. ".cost", "1000") - 0,
-		    "down",
-		    "LINKDOWN")
-	    elseif (subtype == "hw") then
-		local dev = c:getNode(path .. ".device"):value();
-		local dhcp = c:getNode(path .. ".dhcp");
-		local dhcpenabled = 0;
-		if dhcp and dhcp:attr("enable") == "true" then
-			dhcpenabled = true;
-		end
-
-		os.execute(string.format("ifconfig %s up", dev));
-		r.route:f(sub,
-		    safeValue(c, path .. ".group", "WAN"),
-		    safeValue(c, path .. ".cost", "1000") - 0,
-		    "up",
-		    "LINKDOWN")
-
-    		local query = "cmd=event";
-        	query = query .. "&state=up";
-        	query = query .. "&iface=" .. 	urlEncode(dev);
-        	query = query .. "&gw=" .. 	urlEncode(c:getNode(path .. ".gateway"):value());
-        	query = query .. "&ip=" .. 	urlEncode(c:getNode(path .. ".ipaddr"):value());
-        	query = query .. "&netmask=" .. urlEncode(c:getNode(path .. ".ipaddr"):value());
-    		query = query .. "&dns1=" .. 	urlEncode(c:getNode(path .. ".dns1"):value());
-    		query = query .. "&dns2=" .. 	urlEncode(c:getNode(path .. ".dns2"):value());
-
-		-- Call collector, to let him know about static config, and assign route+dns's
-		cmdline = "fetch -qo - \"http://127.0.0.1:8/event.xml?" .. query .. "\"";
-    		print("Exec: " .. cmdline);
-    		os.execute(cmdline);
-
-		-- Config static first
-		local ip = c:getNode(path .. ".ipaddr"):value();
-		local dhcp = c:getNode(path .. ".dhcp");
-		print("Run: \"ifconfig " .. dev .. " " .. ip .. "\"");
-		if os.execute(string.format("ifconfig %s %s", dev, ip)) ~= 0 then
-		    print("\"ifconfig " .. dev .. " " .. ip .. "\" - failed");
-		end
-
-		run_dhclient(c, dev); -- if DHCP enabled.
-
-		-- XXX temporary FIX for wan0 with static address
-		-- if not dhcpenabled and dev == "wan0" then
-		    os.execute(string.format("route add default %s",
-			c:getNode(path .. ".gateway"):value()));
-		-- end
-
-
-		local nat = c:getNode(path .. ".nat");
-		if nat and nat:attr("enable") == "true" then
-		    local ip = c:getNode(path .. ".ipaddr"):value();
-		    ip = ip:gsub("/%d+", "");
-		    os.execute("ngctl mkpeer ipfw: nat 60 out");
-		    os.execute("ngctl name ipfw:60 wan0nat");
-		    os.execute("ngctl connect ipfw: wan0nat: 61 in");
-		    os.execute("ngctl msg wan0nat: setaliasaddr " .. ip);
-
-		    if dhcpenabled then
-			-- pass DHCP via iface
-			os.execute("ipfw add 96 allow all from any 67 to any 68 out via " .. dev);
-			os.execute("ipfw add 97 allow all from any 68 to any 67 out via " .. dev);
-		    end
-		    os.execute("ipfw add 98 netgraph 61 all from any to any in via " .. dev);
-		    os.execute("ipfw add 99 netgraph 60 all from any to any out via " .. dev);
-		else
-		    if dhcpenabled then
-			os.execute("ipfw delete 96");
-			os.execute("ipfw delete 97");
-		    end
-		    os.execute("ipfw delete 98");
-		    os.execute("ipfw delete 99");
-		end
-	    else
-		print("Unsupported interface type " .. subtype);
-	    end
-	else
-	    print("Skiping disabled iface " .. path);
-	end
-    end
-end
-
-dhcpd = 0;
-function start_dhcpd(c)
-    if c:getNode("dhcpd.instances.instance[1]"):attr("enable") == "true" then
-	if dhcpd == 0 then
-	    dhcpd = DHCPD:new(c, "dhcpd.instances.instance[1]");
-	end
-	dhcpd:make_conf();
-	dhcpd:write();
-	print("Start DHCPD");
-	dhcpd:run();
-    end
-end
-
-function getopt(args, opts)
-    i=1;
-    while i < table.getn(arg) do
-	if arg[i]:match("^-") then
-	    opts[arg[i]] = arg[i+1];
-	    i = i + 1;
-	end
-	i = i + 1;
-    end
-    return (opts);
-end
-
-function update_board_info(c)
-    for _, oid in pairs({"device.vendor", "device.model", "device.revision", "soc.vendor", "soc.model"}) do
-	n = c:getOrCreateNode("info." .. oid);
-	n:value(sysctl("hw." .. oid));
-	if not n:value() then
-	    n:value("__NO_DATA__");
-	end
-	print(tostring(oid) .. "=" .. n:value());
-    end
-end
-
-function safeValue(c, name, default)
-	node = c:getNode(name);
-	if not node then
-		if default then
-			return default;
-		else
-			return "";
-		end
-	end
-	return node:value();
-end
-
-function start_dnsmasq(c)
-	-- TODO: if DNS-Relay enabled
-	-- XXX: dnsmasq able to do DHCPD also
-	-- dhcp-range=[interface:<inter-face>,][tag:<tag>[,tag:<tag>],][set:<tag],]<start-addr>,<end-addr>[,<netmask>[,<broadcast>]][,<lease time>]
-	-- # --domain=zrouter,192.168.0.100,192.168.0.200
-	-- # --dhcp-range=192.168.0.100,192.168.0.200,1h
-	-- # --dhcp-authoritative - don't wait for other DHCPDs
-	-- # --bogus-priv - NXDOMAIN for private nets
-	local_domain = "";
-	local_dhcp_range = "";
-	if c:getNode("dhcpd.instances.instance[1]"):attr("enable") == "true" then
-
-		dhcproot = "dhcpd.instances.instance[1].";
-		domain = safeValue(c, dhcproot .. "domain", "zrouter");
-		dltime = safeValue(c, dhcproot .. "default-lease-time", 3600);
-		mltime = safeValue(c, dhcproot .. "max-lease-time");
-		ranges = safeValue(c, dhcproot .. "range.start");
-		rangee = safeValue(c, dhcproot .. "range.end");
-
-		local_domain = " --domain=" .. domain .."," .. ranges .. "," .. rangee;
-		local_dhcp_range = " --dhcp-range=" .. ranges .. "," .. rangee .. "," .. dltime;
-
-	end
-	dnsmasq_cmd =
-	    "/sbin/dnsmasq" ..
-	    " -i bridge0" ..
-	    local_domain ..
-	    local_dhcp_range ..
-	    " --dhcp-authoritative" ..
-	    " --bogus-priv";
-
-	print("Start " .. dnsmasq_cmd);
-	os.execute(dnsmasq_cmd);
-end
-
-function start_hostapd(c)
-	if c:getNode("hostapd.instance[1]"):attr("enable") == "true" then
-		kldload({"wlan_xauth", "wlan_tkip", "wlan_ccmp"});
-		aproot = "hostapd.instance[1].";
-		driver = "bsd";
-		--        <ieee80211d>1</ieee80211d>
-		--        <country_code>UA</country_code>
-		channel = safeValue(c, aproot .. "channel", 6);
-		country_code = safeValue(c, aproot .. "country_code", "UA");
-		--        <interface>wlan0</interface>
-		interface = safeValue(c, aproot .. "interface", "wlan0");
-
-		commandline = string.format("ifconfig %s down",interface);
-		if os.execute(commandline) ~= 0 then
-		    print("Exec: " .. commandline .. " - FAILED");
-		end
-		commandline = string.format(
-		    "ifconfig %s country %s channel %s up",
-		    interface, country_code, channel);
-		if os.execute(commandline) ~= 0 then
-		    print("Exec: " .. commandline .. " - FAILED");
-		end
-		--        <macaddr_acl>0</macaddr_acl>
-		--        <auth_algs>1</auth_algs>
-		--        <debug>0</debug>
-		--        <hw_mode>g</hw_mode>
-		--        <ctrl_interface>/var/run/hostapd</ctrl_interface>
-		--        <ctrl_interface_group>wheel</ctrl_interface_group>
-		--        <ssid>zrouter</ssid>
-		ssid = safeValue(c, aproot .. "ssid", "zrouter");
-		--        <!-- Open -->
-		--        <wpa>0</wpa>
-		wpa = safeValue(c, aproot .. "wpa", 3);
-		--        <!-- WPA -->
-		--        <!-- <wpa>1</wpa> -->
-		--        <!-- RSN/WPA2 -->
-		-- <!-- <wpa>2</wpa> -->
-    		-- <wpa_pairwise>CCMP TKIP</wpa_pairwise>
-		wpa_key_mgmt = safeValue(c, aproot .. "wpa_key_mgmt", "WPA-PSK");
-		wpa_passphrase = safeValue(c, aproot .. "wpa_passphrase", "freebsdmall");
-		wpa_pairwise = safeValue(c, aproot .. "wpa_pairwise", "CCMP");
-		ctrl_interface = "/var/run/hostapd";
-
-		-- # TARGET
-		-- interface=wlan0
-		-- driver=bsd
-		-- ssid=CACHEBOY_11N_1
-		-- wpa=3
-		-- wpa_key_mgmt=WPA-PSK
-		-- wpa_passphrase=Sysinit891234
-		-- wpa_pairwise=CCMP
-		-- ctrl_interface=/var/run/hostapd
-		hostapd_conf = "/tmp/hostapd." .. interface ..".conf";
-
-		hostapd_conf_data = 
-		    "interface=" ..		interface .. "\n" ..
-		    "driver=" ..		driver .. "\n" ..
-		    "country_code=" .. 		country_code .. "\n" ..
-		    "channel=" ..		channel .. "\n" ..
-		    "ssid=" ..			ssid .. "\n" ..
-		    "wpa=" ..			wpa .. "\n" ..
-		    "wpa_key_mgmt=" ..		wpa_key_mgmt .. "\n" ..
-		    "wpa_passphrase=" ..	wpa_passphrase .. "\n" ..
-		    "wpa_pairwise=" ..		wpa_pairwise .. "\n" ..
-		    "ctrl_interface=" ..	ctrl_interface .. "\n";
-
-		local f = assert(io.open(hostapd_conf, "w"));
-		f:write(hostapd_conf_data);
-		f:close();
-
-		hostapd_cmd = "/usr/sbin/hostapd -B " .. hostapd_conf;
-
-		print("Start " .. hostapd_cmd);
-		os.execute(hostapd_cmd);
-
-	end
-end
-
-function start_igmp_fwd(c)
-	if not c:getNode("igmp.instance[1]") then
-		return;
-	end
-	if c:getNode("igmp.instance[1]"):attr("enable") == "true" then
-		upif   = safeValue(c, aproot .. "up", "wan0");
-		downif = safeValue(c, aproot .. "down", "lan0");
-
-		cmd = "/etc/rc.d/ng_igmpproxy start " .. upif .. " " .. downif;
-
-		print("Start " .. cmd);
-		os.execute(cmd);
-	end
-end
-
--- Globals
-config = {};	-- Unused now
-c = {}; 	-- XML tree from config.xml
-r = {};		-- Runtime varibles structure
-
-r.routes = {};
-r.routes["default"] = "127.0.0.1";
-r.routes["224.0.0.0/4"] = "-iface bridge0"
-r.tasks = {};
-r.tasks.step = 5; -- Seconds
-r.tasks.periodic = {};
-r.tasks.onetime  = {}; -- At some time
-r.tasks.countdown= {}; -- when counter expired
-r.ver = {};
-
-opts = {};
-opts["-P"] = "/var/run/httpd.pid";
-
-if arg then
-    opts = getopt(arg, opts);
-end
-
--- Check pidfile
-dofile("lib/pidfile.lua");
-pidfile(opts["-P"]);
-
-
-print("Parse config ...");
-c = Conf:new(load_file("config.xml"));
-
-update_board_info(c);
-read_zrouter_version(r);
-read_rc_conf(r);
-
-print("Initialize board ...");
-
-print("Initialize route select logic ...");
-r.route = ROUTE:new(c, 0);
-
-print("Enable LAN ports ...");
-os.execute("/etc/rc.d/switchctl enablelan");
-print("Init LAN ...");
-configure_lan(c);
-
-print("Start DHCP/DNS Relay ...");
-start_dnsmasq(c);
--- start_dhcpd(c);
-
--- print("Init AP");
--- ap = HOSTAPD:new(c, 1);
--- ap:run();
-
-print("Init AP ...");
-start_hostapd(c);
-
-print("Init IGMP/Multicast forwarding ...");
-start_igmp_fwd(c);
-
-os.execute("ipfw add 100 allow ip from any to any via lo0");
--- os.execute("ipfw add 200 deny ip from any to 127.0.0.0/8");
--- os.execute("ipfw add 300 deny ip from 127.0.0.0/8 to any");
-
--- Hide Web-UI from WAN links
-os.execute("ipfw add 400 allow tcp from any to me 80 via lan0");
-os.execute("ipfw add 500 allow tcp from any to me 80 via bridge0");
--- TODO: If not enabled WAN administration
-os.execute("ipfw add 600 deny tcp from any to me 80");
--- check w/ ipfw NAT-ed packets
-sysctl("net.inet.ip.forwarding", 1);
-sysctl("net.inet.ip.fastforwarding", 1);
-sysctl("net.inet.tcp.blackhole", 2);
-sysctl("net.inet.udp.blackhole", 0);
-sysctl("net.inet.icmp.drop_redirect", 1);
-sysctl("net.inet.icmp.log_redirect", 0);
-sysctl("net.inet.ip.redirect", 0);
-sysctl("net.inet.ip.sourceroute", 0);
-sysctl("net.inet.ip.accept_sourceroute", 0);
-sysctl("net.inet.icmp.bmcastecho", 0);
-sysctl("net.inet.icmp.maskrepl", 0);
-sysctl("net.link.ether.inet.max_age", 30);
-sysctl("net.inet.ip.ttl", 226);
-sysctl("net.inet.tcp.drop_synfin", 1);
-sysctl("net.inet.tcp.syncookies", 1);
--- sysctl("kern.ipc.somaxconn", 32768);
--- sysctl("kern.maxfiles", 204800);
--- sysctl("kern.maxfilesperproc", 200000);
--- ??? -- sysctl("kern.ipc.nmbclusters", 524288);
--- sysctl("kern.ipc.maxsockbuf", 2097152);
-sysctl("kern.random.sys.harvest.ethernet", 0);
-sysctl("kern.random.sys.harvest.interrupt", 0);
--- sysctl("net.inet.ip.dummynet.io_fast", 1);
--- sysctl("net.inet.ip.dummynet.max_chain_len", 2048);
--- sysctl("net.inet.ip.dummynet.hash_size", 65535);
--- sysctl("net.inet.ip.dummynet.pipe_slot_limit", 2048);
--- ?? -- sysctl("net.inet.carp.preempt", 1);
--- ?? -- sysctl("net.inet.carp.log", 2);
--- ?? -- sysctl("kern.ipc.shmmax", 67108864);
-sysctl("net.inet.ip.intr_queue_maxlen", 8192);
-sysctl("net.inet.ip.fw.one_pass", 0);
-sysctl("net.inet.ip.portrange.randomized", 0);
-sysctl("net.inet.tcp.nolocaltimewait", 1);
-
-racoon = 0;
-if racoon == 0 then
-	racoon = RACOON:new(c);
-end
-
--- WAN links tasks
-table.insert(r.tasks.countdown, { count=2, task=
-	function()
-	    print("Init WAN links ...");
-	    configure_wan(c);
-	    return (true);
-	end
-    });
--- IPSec links tasks
-table.insert(r.tasks.countdown, { count=10, task=
-	function()
-	    print("Run racoon ...");
-	    racoon:run();
-	    return (true);
-	end
-    });
-
-print("Run server ...");
-start_server( c, config );
-
-
-
-
-
--- a/profiles/dlink.ua.web/files/etc/www/httpd.sh	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-
-cd /etc/www
-
-echo $$ > /var/run/httpd.sh.pid
-
-./httpd.lua > /var/log/httpd.sh.log 2>&1
-echo -n "./httpd.lua exit with status code $? at " >> /var/log/httpd.sh.log 2>&1
-date >> /var/log/httpd.sh.log 2>&1
-echo "./httpd.lua exit " > /dev/console
-exit 1
-
-while true; do
-    ./httpd.lua
-done
-
--- a/profiles/dlink.ua.web/files/etc/www/lib/mpd.lua	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,315 +0,0 @@
------------------------------------
------------ MPD Class ------------
------------------------------------
---[[
-
-create bundle static B1
-bundle B1
-
-set bundle links L1
-
-set iface addrs 1.1.1.1 2.2.2.2
-set iface route default
-set iface enable on-demand
-set iface idle 900
-set iface enable nat
-set iface up-script /etc/mpd5-up.sh
-set iface down-script /etc/mpd5-down.sh
-
-set ipcp ranges 0.0.0.0/0 0.0.0.0/0
-set ipcp enable req-pri-dns
-set ipcp enable req-sec-dns
-
-open iface
-
-
-
-create link static L1 modem
-create link static L1 pppoe
-create link static L1 pptp
-create link static L1 ltp
-
-set auth authname adbrd****@dsl.ukrtel.net
-set auth password *******
-
-set modem device /dev/cuaU0.0
-set modem var $DialPrefix "DT"
-set modem var $Telephone "#777"
-set modem var $TryPPPEarly "yes"
-set modem var $InitString "+CGDCONT=1,\"IP\",\"internet\""
-set modem script DialPeer
-set modem idle-script Ringback
-set modem watch -cd
-
-set pppoe iface nfe0
-set pppoe service ""
-
-set pptp self 10.1.3.3
-set pptp peer 10.1.0.1
-set pptp disable windowing
-
-set l2tp peer 10.10.10.10
-
-set link disable chap pap
-set link accept chap pap
-set link action bundle B1
-set link enable incoming
-set link max-redial 0
-set link mtu 1460
-set link keep-alive 10 60
-set link bandwidth 14194304
-
-open
-
-
-
-
-
-
-]]
-
---require("sleep");
-
-MPD = {};
-mt = {};
-
-function MPD:new(tree, host, port, debug)
-	local t = {};
-	if not host or not port then
-		print("No host or port");
-		return (nil);
-	end
-
---	t.socket = socket.connect(host, port);
---	if not t.socket then
---		print("Can't connect to " .. host .. ":" .. port);
---		return (nil);
---	end
-	t.host = host;
-	t.port = port;
-	t.c = tree;
-	t.debug = 1;
-	return setmetatable(t, mt);
-end
-
-function MPD:msg(s, wait)
-
-    if self.debug then print("DEBUG MPD:msg: " .. s); end
-    self.socket:settimeout(0.1);
-    self.socket:send(s .. "\n");
-
-    local err = nil;
-    local ret = "";
---    while not err do
-	local data, err = self.socket:receive("*a");
-	ret = ret .. (data or "");
---    end
-    if self.debug then print("DEBUG MPD:msg:return = [[" .. ret .. "]]"); end
-
-    return (ret);
-end
-
-function MPD:config_bundle(path, bundle)
-    local pathl = path .. ".";
-    local node;
-
-    self.socket = socket.connect(self.host, self.port);
-	if not self.socket then
-		print("Can't connect to " .. self.host .. ":" .. self.port);
-		return (nil);
-	end
-    -- Create or select bundle
-    self:msg("create bundle static " .. bundle);
-    self:msg("bundle " .. bundle);
-
-    -- Multilink only
---    self:msg("set bundle links L1");
-
-    -- TODO
---    local ip = c:getNode(pathl .. "ipaddr")
---    if ip then
---	string.match(ip:value(), "%d+%.%d+%.%d+%.%d+%/(%d+)")
---    end
-
-    local def_local_addr = "0.0.0.0";
-    local def_perr_addr = "10.254.254.2";
-    if self.c:getNode(pathl .. "gateway"):value() then
-	def_perr_addr = self.c:getNode(pathl .. "gateway"):value();
-    end
-
-    self:msg("set iface addrs " .. def_local_addr .. " " .. def_perr_addr);
-    self:msg("set iface up-script /etc/mpd-linkup");
-    self:msg("set iface down-script /etc/mpd-linkdown");
-    self:msg("set ipcp ranges " .. def_local_addr .. "/0 " .. def_perr_addr .."/0");
-
-    -- We should apply default on a up-script run
---     self:msg("set iface route default");
-
-    local dod = self.c:getNode(pathl .. "on-demand")
-    if dod and dod:attr("enable") == "true" then
-	self:msg("set iface enable on-demand");
-        self:msg("set iface idle " .. self.c:getNode(pathl .. "idle-time"):value());
-    end
-
-    self:msg("set iface name " .. bundle);
-
-    node = self.c:getNode(pathl .. "nat")
-    if node and node:attr("enable") == "true" then
-	self:msg("set iface enable nat");
-    end
-
-    self:msg("set ipcp enable req-pri-dns");
-    self:msg("set ipcp enable req-sec-dns");
-
-    self:msg("open iface");
-
-    self:msg("exit");
-    self.socket:close();
-
-    return (true);
-end
-
-function MPD:config_link(path, link, bundle)
-    local pathl = path .. ".";
-    self.socket = socket.connect(self.host, self.port);
-	if not self.socket then
-		print("Can't connect to " .. self.host .. ":" .. self.port);
-		return (nil);
-	end
-
-    local mpdtype = self.c:getNode(path);
-    if mpdtype and mpdtype:attr("type") then
-	mpdtype = mpdtype:attr("type");
-    else
-	return (nil);
-    end
-
-    self:msg("create link static " .. link .. " " .. mpdtype);
-    self:msg("link " .. link);
-
-    local user = self.c:getNode(pathl .. "username");
-    if user and user:value() and string.len(user:value()) > 0 then
-	self:msg("set auth authname " .. user:value());
-	local passwd = self.c:getNode(pathl .. "password");
-	if passwd and passwd:value() then
-	    self:msg("set auth password \"" .. passwd:value() .. "\"");
-	else
-	    self:msg("set auth password \"\"");
-	end
-    end
-
-    if mpdtype == "modem" then
-	self:msg("set modem device " ..
-	    self.c:getNode(pathl .. "device"):value() .. "");
-	self:msg("set modem var $DialPrefix \"DT\"");
-	-- Try to send PPP request, for cases when modem stick at data mode
-	-- Leased Line.
-	self:msg("set modem var $TryPPPEarly \"yes\"");
-	self:msg("set modem var $Telephone \"" ..
-	    self.c:getNode(pathl .. "phone"):value() .. "\"");
-	local initstring = self.c:getNode(pathl .. "init_string");
-	if initstring then -- If node
-	    initstring = initstring:value();
-	    if initstring and initstring ~= "" then -- If value not empty
-		-- Escape double quotes
-		initstring = initstring:gsub("\"", "\\\"");
-		print("set modem var $InitString \"" .. initstring .. "\"");
-		self:msg("set modem var $InitString \"" .. initstring .. "\"");
-	    end
-	end
-	self:msg("set modem script DialPeer");
-	self:msg("set modem idle-script Ringback");
-	self:msg("set modem watch -cd");
-    elseif mpdtype == "pppoe" then
-	self:msg("set pppoe iface " .. self.c:getNode(pathl .. "device"):value() .. "");
-	local service_node = self.c:getNode(pathl .. "service_name");
-	if service_node and service_node:value() then
-	    self:msg("set pppoe service \"" .. service_node:value() .. "\"");
-	end
-    elseif mpdtype == "pptp" then
-	-- TODO:
-	self:msg("set pptp self 10.1.3.3");
-	self:msg("set pptp peer 10.1.0.1");
-	self:msg("set pptp disable windowing");
-    end
-
-
-    -- TODO
-    self:msg("set link disable chap pap");
-    self:msg("set link accept chap pap");
-    self:msg("set link action bundle " .. bundle);
-    self:msg("set link enable incoming");
-    self:msg("set link max-redial 0");
-    self:msg("set link mtu 1460");
-    self:msg("set link keep-alive 10 60");
---    self:msg("set link bandwidth 14194304");
-
-    -- Open link
-    self:msg("open");
-    self:msg("exit");
-    self.socket:close();
-
-
-
-    return (true);
-end
-
-function MPD:show_bundle(path, bundle)
---    self.socket:refresh();
-    self.socket = socket.connect(self.host, self.port);
-
-    self:msg("bundle " .. bundle);
-    local info = self:msg("show bundle " .. bundle, 500);
-    self:msg("exit");
-    self.socket:close();
-
-    return (true);
-end
-
-function MPD:close()
---    self.socket:close();
-end
-
-mt.__index = MPD;
------------------------------------
--------- End of MPD Class --------
------------------------------------
-
---[[
-Bundle 'PPP' (static):
-	Links          : PPP[Opened/UP]
-	Status         : OPEN
-	Session time   : 1119 seconds
-	MultiSession Id: 249-PPP
-	Total bandwidth: 28800 bits/sec
-	Avail bandwidth: 28800 bits/sec
-	Peer authname  : ""
-Configuration:
-	Retry timeout  : 2 seconds
-	BW-manage:
-	  Period       : 60 seconds
-	  Low mark     : 20%
-	  High mark    : 80%
-	  Min conn     : 30 seconds
-	  Min disc     : 90 seconds
-	  Links        :
-Bundle level options:
-	ipcp      	enable
-	ipv6cp    	disable
-	compression	disable
-	encryption	disable
-	crypt-reqd	disable
-	bw-manage 	disable
-	round-robin	disable
-Multilink PPP:
-	Status         : Inactive
-Traffic stats:
-	Input octets   : 1322
-	Input frames   : 19
-	Output octets  : 1270
-	Output frames  : 18
-	Bad protocols  : 0
-	Runts          : 0
-	Dup fragments  : 0
-	Drop fragments : 0
-]]
--- a/profiles/dlink.ua.web/files/etc/www/lib/racoon.lua	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
---[[
-
-file /etc/racoon/racoon.conf:
->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-path    pidfile  "/var/run/racoon.pid";
-path    pre_shared_key  "/var/db/racoon/racoon_psk.txt"; #location of pre-shared key file
-log     notify;  #log verbosity setting: set to 'notify' when testing and debugging is complete
-
-padding # options are not to be changed
-{
-        maximum_length  20;
-        randomize       off;
-        strict_check    off;
-        exclusive_tail  off;
-}
-
-timer   # timing options. change as needed
-{
-        counter         5;
-        interval        20 sec;
-        persend         1;
-#       natt_keepalive  15 sec;
-        phase1          30 sec;
-        phase2          15 sec;
-}
-
-listen  # address [port] that racoon will listening on
-{
-        isakmp          192.168.90.1 [500];
-        isakmp_natt     192.168.90.1 [4500];
-}
-
-include /var/run/racoon.links.conf
-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-Generated /var/run/racoon.links.conf:
->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-include /var/run/racoon.10.0.0.2:500.conf
-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-Generated /var/run/racoon.10.0.0.2:500.conf:
->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-remote  10.0.0.2 [500]
-{
-        exchange_mode   	main,aggressive;
-        doi             	ipsec_doi;
-        situation       	identity_only;
-        my_identifier   	address 10.0.0.1;
-        peers_identifier        address 10.0.0.2;
-        lifetime        	time 28800 sec;
-	initial_contact 	on;
-        passive         	off;
-        proposal_check  	obey;
-        generate_policy 	off;
-
-                        proposal {
-                                encryption_algorithm    3des;
-                                hash_algorithm          md5;
-                                authentication_method   pre_shared_key;
-                                dh_group                5;
-			}
-}
-sainfo  (address 192.168.0.0/24 any address 192.168.2.0/24 any)
-{
-	pfs_group			5;
-	lifetime			time 3600 sec;
-	encryption_algorithm		3des;
-	authentication_algorithm	hmac_md5;
-	compression_algorithm		deflate;
-}
-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-usage: racoon [-BdFv] [-a (port)] [-f (file)] [-l (file)] [-p (port)]
-   -B: install SA to the kernel from the file specified by the configuration file.
-   -d: debug level, more -d will generate more debug message.
-   -C: dump parsed config file.
-   -L: include location in debug messages
-   -F: run in foreground, do not become daemon.
-   -v: be more verbose
-   -a: port number for admin port.
-   -f: pathname for configuration file.
-   -l: pathname for log file.
-   -p: port number for isakmp (default: 500).
-   -P: port number for NAT-T (default: 4500).
-
-<ipsec>
-    <remote id="0" enable="true">
-	<gateway>10.0.0.2:500</gateway>
-        <exchange_mode>main,aggressive</exchange_mode>
-        <my_identifier>address 10.0.0.1</my_identifier>
-        <peers_identifier>address 10.0.0.2</peers_identifier>
-        <lifetime>time 28800 sec</lifetime>
-	<initial_contact>on</initial_contact>
-        <passive>off</passive>
-        <proposal_check>obey</proposal_check>
-	<nat_traversal>off</nat_traversal>
-        <generate_policy>off</generate_policy>
-        <proposal>
-            <encryption_algorithm>3des</encryption_algorithm>
-            <hash_algorithm>md5</hash_algorithm>
-            <authentication_method>pre_shared_key</authentication_method>
-            <dh_group>5</dh_group>
-            <psk>pskpskpsk</psk>
-	</proposal>
-    </remote>
-    <sainfo id="0" enable="true">
-	<src>address 192.168.0.0/24 any</src>
-	<dst>address 192.168.2.0/24 any</dst>
-	<pfs_group>5</pfs_group>
-	<lifetime>time 3600 sec</lifetime>
-	<encryption_algorithm>3des</encryption_algorithm>
-	<authentication_algorithm>hmac_md5</authentication_algorithm>
-	<compression_algorithm>deflate</compression_algorithm>
-    </sainfo>
-    <setkey>
-	<line>spdadd 192.168.0.0/24 192.168.2.0/24 any -P out ipsec esp/tunnel/10.0.0.1-10.0.0.2/use</line>
-	<line>spdadd 192.168.2.0/24 192.168.0.0/24 any -P in ipsec esp/tunnel/10.0.0.2-10.0.0.1/use</line>
-	<line></line>
-	<line></line>
-    </setkey>
-</ipsec>
-
-
-]]
-
--- require("ipcalc");
-
-RACOON = {};
-local mt = {};
-
-
-function RACOON:new(c, debug)
-    t = {};
-    t.c = c;
-    t.remote_count = 0;
-    t.pidfile = "/var/run/racoon.pid";
-    t.logfile = "/var/log/racoon.log";
-    t.configfile = "/etc/racoon/racoon.conf";
-    t.linksfile = "/var/run/racoon.links.conf";
-    t.psk = "/var/db/racoon/racoon_psk.txt";
-
-    t.debug = debug;
-    return setmetatable(t, mt);
-end
-
-function RACOON:make_conf()
-
-    -- Generate linksfile
-    local f = assert(io.open(self.linksfile, "w"));
-    for i = 1,16,1 do
-	local ppath = "ipsec.remote[" ..i.. "]";
-	local node = self.c:getNode(ppath);
-	if node and node:attr("enable") == "true" then
-	    local gw = self.c:getNode(ppath .. ".gateway"):value();
-	    if gw then
-		f:write("include \"/var/run/racoon." .. gw .. ".conf\";\n");
-		t.remote_count = t.remote_count + 1;
-	    else
-		print("Can't get " .. ppath .. ".gateway value");
-		return (nil);
-	    end
-	end
-    end
-    if self.remote_count == 0 then
-	-- No remote targets, so nothing todo
-	print("No remote targets, so nothing todo");
-	return (nil);
-    end
-
-    for i = 1,16,1 do
-	local ppath = "ipsec.sainfo[" ..i.. "]";
-	local node = self.c:getNode(ppath);
-	if node and node:attr("enable") == "true" then
-	    f:write("include \"/var/run/racoon.sainfo" .. i .. ".conf\";\n");
-	end
-    end
-    f:close();
-
-
-
-    local function addline(ppath, item, prep, confitem)
-	local ret = "";
-	    local val = self.c:getNode(ppath .. "." .. (confitem or item)):value();
-	    if val then
-		ret = (prep or "") .. item .. "\t" .. val .. ";\n";
-	    else
-		print("Can't get " .. ppath .. "." .. (confitem or item) .." value");
-	    end
-	return (ret);
-    end
-
-    -- XXX: We need setup routes per IPSec tunnel
-    local last_gw = nil;
-
-    for i = 1,16,1 do
-	local ppath = "ipsec.remote[" ..i.. "]";
-	local node = self.c:getNode(ppath);
-	if node and node:attr("enable") == "true" then
-	    local gw = self.c:getNode(ppath .. ".gateway"):value();
-	    local file = "/var/run/racoon." .. gw .. ".conf";
-	    local remote = gw:gsub(":", " [") .. "]";
-	    last_gw = gw:gsub(":.*", "");
-
-	    local conf = "remote\t" .. remote .. "\n";
-
-	    conf = conf .. "{\n";
-	    conf = conf .. addline(ppath, "exchange_mode"	, "\t");
-	    conf = conf .. "\tdoi	ipsec_doi;\n";
-	    conf = conf .. "\tsituation	identity_only;\n";
-	    conf = conf .. "\tscript \"/etc/racoon/phase1-up.sh\" phase1_up;\n";
-	    conf = conf .. "\tscript \"/etc/racoon/phase1-down.sh\" phase1_down;\n";
-
-	    conf = conf .. addline(ppath, "my_identifier"	, "\t");
-	    conf = conf .. addline(ppath, "peers_identifier"	, "\t");
-	    conf = conf .. addline(ppath, "lifetime"		, "\t");
-	    conf = conf .. addline(ppath, "initial_contact"	, "\t");
-	    conf = conf .. addline(ppath, "passive"		, "\t");
-	    conf = conf .. addline(ppath, "proposal_check"	, "\t");
-	    conf = conf .. addline(ppath, "generate_policy"	, "\t");
-	    conf = conf .. "\tproposal {\n";
-            conf = conf .. addline(ppath, "encryption_algorithm", "\t\t", "proposal.encryption_algorithm");
-            conf = conf .. addline(ppath, "hash_algorithm"	, "\t\t", "proposal.hash_algorithm");
-            conf = conf .. addline(ppath, "authentication_method","\t\t", "proposal.authentication_method");
-            conf = conf .. addline(ppath, "dh_group"		, "\t\t", "proposal.dh_group");
-	    conf = conf .. "\t}\n";
-	    conf = conf .. "}\n";
-
-	    print("IPsec Remote config file " .. file .. ":\n" ..
-		conf ..
-		"=======================================\n");
-
-	    local f = assert(io.open(file, "w"));
-	    f:write(conf);
-	    f:close();
-
-	end
-    end
-
-    local route_up = nil;
-    local route_down = nil;
-
-    if last_gw then
-	local route_up_file = "/var/run/racoon." .. last_gw .. "_up.sh";
-	local route_down_file = "/var/run/racoon." .. last_gw .. "_down.sh";
-
-	route_up = assert(io.open(route_up_file, "w"));
-	route_down = assert(io.open(route_down_file, "w"));
-
-	route_up:write("#!/bin/sh\n");
-	route_down:write("#!/bin/sh\n");
-    end
-
-    for i = 1,16,1 do
-	local ppath = "ipsec.sainfo[" ..i.. "]";
-	local node = self.c:getNode(ppath);
-	if node and node:attr("enable") == "true" then
-	    local file = "/var/run/racoon.sainfo" .. i .. ".conf";
-	    local src = self.c:getNode(ppath .. ".src"):value();
-	    local dst = self.c:getNode(ppath .. ".dst"):value();
-
-	    dst_cidr = dst:gsub("^%S+%s+(%S+)%s+%S+", "%1");
-	    if dst_cidr:match("%d+%.%d+%.%d+%.%d+%/%d+") then
-		-- Preinstall routes of secured remote nets
-		-- "already in table" ignored
-		local cmd = string.format(
-		    "/sbin/route add %s -iface lo0 -reject", dst_cidr);
-		print(cmd);
-		os.execute(cmd);
-		if last_gw then
-		    route_up:write(string.format("/sbin/route change %s %s\n", dst_cidr, last_gw));
-		    route_down:write(string.format("/sbin/route change %s -iface lo0 -reject\n", dst_cidr));
-		end
-	    end
-
-	    local conf = "sainfo (" .. src .. " " .. dst .. ")\n";
-	    conf = conf .. "{\n";
-	    conf = conf .. addline(ppath, "pfs_group"			, "\t");
-	    conf = conf .. addline(ppath, "lifetime"			, "\t");
-	    conf = conf .. addline(ppath, "encryption_algorithm"	, "\t");
-	    conf = conf .. addline(ppath, "authentication_algorithm"	, "\t");
-	    conf = conf .. addline(ppath, "compression_algorithm"	, "\t");
-	    conf = conf .. "}\n";
-
-	    print("IPsec SA info config file " .. file .. ":\n" ..
-		conf ..
-		"=======================================\n");
-
-	    local f = assert(io.open(file, "w"));
-	    f:write(conf);
-	    f:close();
-	end
-    end
-    if last_gw then
-	route_up:close();
-	route_down:close();
-    end
-
-end
-
-function RACOON:make_psk()
-
-    -- Generate linksfile
-    local f = assert(io.open(self.psk, "w"));
-    for i = 1,16,1 do
-	local ppath = "ipsec.remote[" ..i.. "]";
-	local node = self.c:getNode(ppath);
-	if node and node:attr("enable") == "true" then
-	    local gw = self.c:getNode(ppath .. ".gateway"):value();
-	    if gw then
-		gw = gw:gsub(":.*", "");
-		local psk = self.c:getNode(ppath .. ".proposal.psk");
-		if psk then
-		    f:write(gw .. "\t" .. psk:value() .. "\n");
-		end;
-	    else
-		print("Can't get " .. ppath .. ".gateway value");
-		return (nil);
-	    end
-	end
-    end
-    f:close();
-    os.execute("/bin/chmod 700 " .. self.psk);
-end
-
-function RACOON:setkey()
-    local setkey = "";
-
-    for i = 1,16,1 do
-	local ppath = "ipsec.setkey.line[" ..i.. "]";
-	local node = self.c:getNode(ppath);
-	if node then
-	    local val  = node:value();
-	    if val and string.len(val) > 0 then
-		setkey = setkey .. val .. ";\n";
-	    end
-	end
-    end
-
-    if string.len(setkey) > 0 then
-	local sk = io.popen("/sbin/setkey -c ", "w");
-        sk:write(setkey);
-	sk:close();
-    end
-end
-
-function RACOON:run()
-    -- FIXME install routes to remote nets via his IPSec gates
-    --os.execute("route add 192.168.2.0/24 10.0.0.1");
-    os.execute("mkdir -p /var/run/");
-    os.execute("mkdir -p /var/db/racoon");
-    self:setkey();
-    self:make_psk();
-    self:make_conf();
-    if self.remote_count > 0 then
---	os.execute("echo 'WARNING: RACOON run in DEBUG mode' > /dev/console");
---	os.execute("/sbin/racoon -ddddf " .. self.configfile .. " -l " .. self.logfile);
-	os.execute("/sbin/racoon -f " .. self.configfile .. " -l " .. self.logfile);
-    end
-end
-
-function RACOON:stop()
-
-    os.execute("kill `cat /var/run/racoon.pid`");
-end
-
-mt.__index = RACOON;
-
--- a/profiles/dlink.ua.web/files/etc/www/lib/utils.lua	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,328 +0,0 @@
---[[
-    tdump(table_to_dump)
-    return text dump of table
-]]
-
-function tdump(t)
-    local function dmp(t, l, k)
-	local ret = "";
-	if type(t) == "table" then
-    	    ret = ret .. string.format("%s%s:", string.rep(" ", l*2), tostring(k)) .. "\n";
-    	    for k, v in pairs(t) do
-    		if k ~= "_parent" then
-    		    ret = ret .. dmp(v, l+1, k);
-    		end
-    	    end
-	else
-    	    ret = ret .. string.format("%s%s:%s", string.rep(" ", l*2), tostring(k), tostring(t)) .. "\n";
-	end
-	return (ret);
-    end
-    return dmp(t, 1, "root");
-end
-
---[[
-    xmldump(table_to_dump)
-    return XML subtree of table
-]]
-
-function xmldump(t)
-
-    local function xatrdmp(t)
-	local ret = '';
-
-        for k, v in pairs(t) do
-    	    ret = ret .. string.format(" %s=\"%s\"", tostring(k), tostring(v));
-        end
-
-        return ret;
-    end
-
-    local function xdmp(t, l)
-	local ret = '';
-	local enum = 0;
-	local name = t._name or '';
-	local attrs = '';
-	local childs = '';
-	local brk = nil;
-
-    	if t._attr then
-	    attrs = attrs .. xatrdmp(t._attr);
-	end
-
-
-	if t._children then
-    	    for k, v in ipairs(t._children) do
-    		childs = childs .. xdmp(v, l+1);
-    	    end
-
-    	    if table.maxn (t._children) > 1 then
-		brk = 1;
-	    elseif table.maxn (t._children) == 1 and
-	      t._children[1]._type ~= "TEXT" then
-		brk = 1;
-	    end
-    	end
-
-	if t._type == "ELEMENT" then
-	    if brk then
-    		ret =   ret ..
-    		    string.format("%s<%s%s>\n", string.rep(" ", l*4), name, attrs) ..
-    		    childs ..
-    		    string.format("%s</%s>\n", string.rep(" ", l*4), name);
-    	    else
-    		ret =   ret ..
-    		    string.format("%s<%s%s>", string.rep(" ", l*4), name, attrs) ..
-    		    childs ..
-    		    string.format("</%s>\n", name);
-    	    end
-    	elseif t._type == "TEXT" then
-    	    ret = ret .. t._text;
-    	elseif t._type == "ROOT" then
-    	    ret = childs;
-    	elseif t._type == "COMMENT" then
-    	    ret = ret ..
-    		string.format("%s<!-- %s -->\n", string.rep(" ", l*4), t._text);
---    	else
---    	    print("Parse Error Unknow type \"" .. (t._type or "(nil)") .. "\"");
-    	end
-
-	-- print(ret);
-	return ret;
-    end
-
-    return xdmp(t, -1);
-end
-
-
-
---[[
-    read_file(_file)
-    return data from file
-]]
-function read_file(_file)
-    local xml;
-
-    if (_debug) then
-        io.write ( "File: ".._file.."\n" )
-    end
-
-    local f, e = io.open(_file, "r")
-    if f then
-      xml = f:read("*a")
-    else
-      return ("Can't open file " .. _file);
-    end
-
-    return xml;
-end
-
-function inc(_file)
-    return read_file(_file);
-end
-
-function load_file(_file)
-    h = domHandler();
-    x = xmlParser(h);
-    index = 1
-
-    x.options.expandEntities = 1; -- nil;
-    x:parse(read_file(_file));
-
-    return (h.root);
-end
-
-function save_file(_file, _data)
-    local out, e = io.open(_file, "w");
-    if out then
-        out:write(_data);
-	assert(out:close());
-    else
-        print(e);
-        return (nil);
-    end
-
-    return (true);
-end
-
-function checked(v)
-    if (v and v ~= "" and v ~= "false") then
-	return "checked";
-    end
-    return "";
-end
-
-function field(v)
-    if (v and v ~= "") then
-        return v;
-    end
-    return "";
-end
-
-function conf_table(id, header, rootpath, fields)
-
-	local ret =
-		"<div id=\"" .. id .. "\" class=\"yui3-module boxitem\">\n" ..
-		"    <div class=\"yui3-hd\">\n" ..
-		"        <h4>" .. header .."</h4>\n" ..
-		"    </div>\n" ..
-		"    <div class=\"yui3-bd\">\n" ..
-		"	<form method=\"POST\" target=\"/cmd.xml\" onchange=\"document.getElementById('" .. id .. "_update_button').disabled = false; return true;\">\n" ..
-		"	    <input type=\"hidden\" name=\"path\" value=\"" .. rootpath .."\" />\n" ..
-		"	    <input type=\"hidden\" name=\"cmd\" value=\"setmany\" />\n" ..
-		"	<table>\n";
-
-
-	for i,v in ipairs(fields) do
-	    if v.type == "attr" then
-		local _, _, nodestr, attrstr = string.find(v.node, "(.-)%:(.*)");
-
-		print(string.format("node='%s' attr='%s'", nodestr or "(no node)", attrstr or "(no attr)"));
-
-		if not nodestr then
-		    nodestr = rootpath;
-		else
-		    nodestr = rootpath .. "." .. nodestr;
-		end
-
-		if not attrstr then
-		    ret = ret .. "Error parsing attr fileld at path " .. v.node;
-		else
-
-		attrvalue = c:getNode(nodestr):attr(attrstr) or
-		    "Error getting attribute value of " .. nodestr .. ":attr(" .. attrstr .. ")";
-		local inserted = "";
-		if v.htmltype == "checkbox" then
-		    inserted = checked(attrvalue);
-		elseif v.htmltype == "text" then
-		    inserted = " value=\"" .. attrvalue .. "\"";
-		else
-		    inserted = "Unknown htmltype " .. v.htmltype;
-		end
-		ret = ret ..
-		"            <tr>\n" ..
-		"        	<td>" .. v.label .. ":</td>\n" ..
-		"        	<td><input name=\"smattr:" .. v.node .. "\" " ..
-				    "type=\"" .. v.htmltype .. "\" " ..
-				    inserted ..
-				    " onchange=\"" ..
-					"document.getElementById(" .. 
-					    "'" .. id .. "_update_button'" ..
-					").disabled = false; return true;\"/></td>\n" ..
-		"    	     </tr>\n";
-		end
-	    elseif v.type == "node" then
-		local nodestr = v.node;
-		if not nodestr then
-		    nodestr = rootpath;
-		else
-		    nodestr = rootpath .. "." .. nodestr;
-		end
-
-		local n = c:getNode(nodestr);
-		if n then
-		    nodevalue = n:value() or "";
-		else
-		    nodevalue = "Error: node " .. nodestr .. " not found";
-		end
-
-		nodevalue = nodevalue:gsub("\"","&quot;");
-
-		ret = ret ..
-		"            <tr>\n" ..
-		"        	<td>" .. v.label .. ":</td>\n" ..
-		"    		<td><input type=\"" .. v.htmltype .. "\" name=\"sm:" .. v.node .. "\" value=\"" ..
-				    nodevalue ..
-				    "\" onchange=\"document.getElementById(" ..
-					"'" .. id .. "_update_button'" ..
-				    ").disabled = false; return true;\"/></td>\n" ..
-		"            </tr>\n";
-	    end
-	end
-
-	ret = ret ..
-		"            <tr>\n" ..
-		"        	<td>&nbsp;</td>\n" ..
-		"        	<td><input id=\"" .. id .. "_update_button\" type=\"button\" name=\"Update\" value=\"Update\" disabled onclick=\"" ..
-					"send_update(this.form, function(x) { document.getElementById('" .. id .. "_update_button').disabled = true; })" ..
-				    "\"/></td>\n" ..
-		"            </tr>\n" ..
-		"	</table>\n" ..
-		"	</form>\n" ..
-		"    </div>\n" ..
-		"</div>\n";
-
-	return (ret);
-end
-
-function peritem(item, sub)
-	if type(item) == "table" then
-
-    		for k, v in pairs(item) do
-    			sub(v);
-    		end
-	else
-    		sub(item);
-	end
-end
-
-function kldload(module)
-	function kldload_one(module)
-		if debug then
-			print("kldstat -q -m " .. module .. " || kldload " .. module);
-		end
-		os.execute("kldstat -q -m " .. module .. " || kldload " .. module);
-	end
-	peritem(module, kldload_one);
-end
-
-function strip_quote (str)
-	str = str:gsub("^\"(.*)\"$", "%1");
-	str = str:gsub("^\'(.*)\'$", "%1");
-	return str;
-end
-
-function parse_kv_file (ar, file)
-	local err = nil;
-	if not file then
-		return "Filename required";
-	end
-
-	if type(ar) ~= "table" then
-		return "First argument must be table";
-	end
-
-	local f = io.open(file);
-	if not f then
-		return "Can't open \"" .. file .. "\"\n";
-	end
-
-	local count = 0;
-	while true do
-		local line = f:read('*line');
-		if line == nil then break end -- EOF
-		if count > 100 then
-			-- to much lines
-			err = "Lines count more than 100 \"" .. file .. "\n";
-			break;
-		end
-
-		line = line:gsub("#.*$", ""); -- Strip comments
-		line = line:gsub("%s*$", ""); -- Strip whitespaces
-
-		if line ~= "" then -- Do only if line not empty
-			match, _, name, value = line:find("^(.+)=(.+)%s*$");
-			if not match then
-				err = "Wrong format in \"" .. file .. "\n";
-				break;
-			end
-			ar[strip_quote(name)] = strip_quote(value);
-		end
-
-		count = count + 1;
-	end
-
-	f:close();
-	return err;
-end
-
--- a/profiles/dlink.ua.web/profile.mk	Thu Sep 20 15:57:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-
-
-
-# Requirement of other profiles
-# XXX not yet supported, TARGET_PROFILES used as simple list
-#TARGET_PROFILES+=shttpd
-
-WORLD_SUBDIRS_ZROUTER+= \
-	target/usr.bin/lua/
-
-WORLD_SUBDIRS_USR_SBIN+=	\
-	tcpdump
-