コード例 #1
0
ファイル: wfa_igd_handle.php プロジェクト: jhbsz/DIR-850L_A1
function exe_ouside_cmd($cmd)
{
    $ext_node = "/runtime/webaccess/ext_node";
    setattr($ext_node, "get", $cmd);
    get("x", $ext_node);
    del($ext_node);
}
コード例 #2
0
ファイル: ddnsserver.php プロジェクト: jhbsz/DIR-850L_A1
function ddns4generate($inf, $phyinf, $ddnsp)
{
    /* the interface status */
    $stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $inf, 0);
    /* Get the network info. */
    $addrtype = query($stsp . "/inet/addrtype");
    if ($addrtype == "ipv4") {
        $ipaddr = query($stsp . "/inet/ipv4/ipaddr");
    } else {
        $ipaddr = query($stsp . "/inet/ppp4/local");
    }
    /* Get the DDNS service index*/
    anchor($ddnsp);
    $provider = query("provider");
    $username = get("s", "username");
    $password = get("s", "password");
    $hostname = get("s", "hostname");
    $interval = get("s", "interval");
    if ($provider == "IOBB") {
        $model = query("/runtime/device/modelname");
        $hostname = $hostname . ".iobb.net";
        if ($interval == "") {
            $interval = 14400;
        }
        /* 10 days */
        $useragent = iobb_user_agent($model);
    } else {
        $vendor = query("/runtime/device/vendor");
        $model = query("/runtime/device/modelname");
        if ($interval == "") {
            $interval = 21600;
        }
        /* 15 days */
        $useragent = '"' . $vendor . ' ' . $model . '"';
    }
    set($stsp . "/ddns4/valid", "1");
    set($stsp . "/ddns4/provider", $provider);
    if ($provider != "ORAY") {
        $cmd = "susockc /var/run/ddnsd.susock DUMP " . $provider;
        setattr($stsp . "/ddns4/uptime", "get", $cmd . " | scut -p uptime:");
        setattr($stsp . "/ddns4/ipaddr", "get", $cmd . " | scut -p ipaddr:");
        setattr($stsp . "/ddns4/status", "get", $cmd . " | scut -p state:");
        setattr($stsp . "/ddns4/result", "get", $cmd . " | scut -p result:");
        $set = 'SET ' . $provider . ' "' . $ipaddr . '" "' . $username . '" "' . $password . '" "' . $hostname . '" ' . $interval;
        /* start the application */
        fwrite("a", $_GLOBALS["START"], 'event DDNS4.' . $inf . '.UPDATE add "susockc /var/run/ddnsd.susock UPDATE ' . $provider . '"\\n' . 'susockc /var/run/ddnsd.susock USERAGENT ' . $useragent . '\\n' . 'susockc /var/run/ddnsd.susock ' . $set . '\\n' . 'xmldbc -s ' . $stsp . '/ddns4/valid 1\\n' . 'xmldbc -s ' . $stsp . '/ddns4/provider ' . $provider . '\\n' . 'exit 0\\n');
        fwrite("a", $_GLOBALS["STOP"], 'event DDNS4.' . $inf . '.UPDATE add true\\n' . 'xmldbc -s ' . $stsp . '/ddns4/valid 0\\n' . 'xmldbc -s ' . $stsp . '/ddns4/provider ""\\n' . 'susockc /var/run/ddnsd.susock DEL ' . $provider . '\\n' . 'exit 0\\n');
    } else {
        setattr($stsp . "/ddns4/uptime", "get", "scut -p uptime: /var/run/peanut.info");
        setattr($stsp . "/ddns4/ipaddr", "get", "scut -p ip:     /var/run/peanut.info");
        setattr($stsp . "/ddns4/status", "get", "scut -p status: /var/run/peanut.info");
        setattr($stsp . "/ddns4/usertype", "get", "cat /var/run/peanut_user_type");
        fwrite("a", $_GLOBALS["START"], 'echo Start peanut...\\n' . 'peanut -S "5" -u "' . $username . '" -p "' . $password . '" -i ' . $ipaddr . ' -q "/var/run/peanut.info" > /dev/console &\\n' . 'xmldbc -s ' . $stsp . '/ddns4/valid 1\\n' . 'xmldbc -s ' . $stsp . '/ddns4/provider ' . $provider . '\\n' . 'exit 0\\n');
        fwrite("a", $_GLOBALS["STOP"], 'echo Stop peanut...\\n' . 'killall -16 peanut\\n' . 'xmldbc -s ' . $stsp . '/ddns4/valid 0\\n' . 'xmldbc -s ' . $stsp . '/ddns4/provider ""\\n' . 'rm -rf /var/run/peanut.info\\n' . 'rm -rf /var/run/peanut_user_type' . 'rm -rf /var/run/all_ddns_domain_name' . 'exit 0\\n');
    }
}
コード例 #3
0
function arping($ip, $devname)
{
    setattr("/runtime/test/arping", "get", "arpping -i " . $devname . " -t " . $ip . " -u 200000");
    $ret = query("/runtime/test/arping");
    if ($ret == "no") {
        return 0;
    }
    /*yes have mac or not arpping program.*/
    return 1;
}
コード例 #4
0
ファイル: SetTriggerADIC.php プロジェクト: jhbsz/DIR-850L_A1
function wandetect($inf)
{
    $infp = XNODE_getpathbytarget("", "inf", "uid", $inf, 0);
    $phyinf = query($infp . "/phyinf");
    $phyinfp = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0);
    $ifname = PHYINF_getifname($phyinf);
    $linkstatus = query($phyinfp . "/linkstatus");
    if ($linkstatus == "") {
        return "UNKNOWN";
    }
    setattr("/runtime/detectpppoe", "get", "pppd pty_pppoe pppoe_discovery pppoe_device " . $ifname);
    $ret = query("/runtime/detectpppoe");
    del("/runtime/detectpppoe");
    if ($ret == "yes") {
        return "PPPOE";
    }
    setattr("/runtime/detectdhcp", "get", "udhcpc -i " . $ifname . " -d -D 1 -R 2");
    $ret = query("/runtime/detectdhcp");
    del("/runtime/detectdhcp");
    if ($ret == "yes") {
        return "DHCP";
    }
    return "UNKNOWN";
}
コード例 #5
0
ファイル: PHYINF.ETH-1.php プロジェクト: jhbsz/DIR-850L_A1
<?php

include "/etc/services/PHYINF/phyinf.php";
fwrite("w", $START, "#!/bin/sh\n");
fwrite("w", $STOP, "#!/bin/sh\n");
phyinf_setup("ETH-1");
$path = XNODE_getpathbytarget("/runtime", "phyinf", "uid", "ETH-1", 0);
setattr($path . "/linkstatus:1", "get", "psts lan1");
setattr($path . "/linkstatus:2", "get", "psts lan2");
setattr($path . "/linkstatus:3", "get", "psts lan3");
setattr($path . "/linkstatus:4", "get", "psts lan4");
fwrite("a", $START, "exit 0\n");
fwrite("a", $STOP, "exit 0\n");
コード例 #6
0
ファイル: usbmount_helper.php プロジェクト: jhbsz/DIR-850L_A1
 if ($action == "unmount") {
     if ($base != "") {
         setattr($base . "/space/used", "get", "");
         setattr($base . "/space/available", "get", "");
         set($base . "/fs", "UNKNOWN");
         set($base . "/state", "NOT MOUNTED");
         set($base . "/space/size", "");
         set($base . "/space/used", "");
         set($base . "/space/available", "");
     }
 } else {
     if ($action == "update") {
         if ($base != "" && query($base . "/space/size") == "CALCULATING") {
             set($base . "/space/size", $size);
             setattr($base . "/space/used", "get", "df|scut -p" . $dev . " -f2");
             setattr($base . "/space/available", "get", "df|scut -p" . $dev . " -f3");
         }
     } else {
         if ($action == "detach") {
             echo "#!/bin/sh\n";
             echo "mount|grep " . $dev . " > /dev/null\n";
             echo "while ([ \"\$?\" = \"0\" ])\n";
             echo "do\n";
             echo "\tumount /dev/" . $dev . " 2> /dev/null\n";
             echo "\tmount|grep " . $dev . " > /dev/null\n";
             echo "done\n";
             if ($mntp != "") {
                 echo "rm -rf " . $mntp . "\n";
             }
             echo "exit 0\n";
         }
コード例 #7
0
ファイル: RA-WAIT.php プロジェクト: jhbsz/DIR-850L_A1
function main_entry($inf, $phyinf, $devnam, $dhcpopt, $dns, $me)
{
    /* generate callback script */
    $pid = "/var/servd/" . $inf . "-rdisc6.pid";
    $hlp = "/var/servd/" . $inf . "-rdisc6.sh";
    fwrite(w, $hlp, "#!/bin/sh\n" . "echo [\$0]: [{$IFNAME}] [{$MFLAG}] [{$OFLAG}] > /dev/console\n" . "phpsh /etc/services/INET/inet6_rdisc6_helper.php" . ' "IFNAME=$IFNAME"' . ' "MFLAG=$MFLAG"' . ' "OFLAG=$OFLAG"' . ' "PREFIX=$PREFIX"' . ' "PFXLEN=$PFXLEN"' . ' "LLADDR=$LLADDR"' . ' "RDNSS=$RDNSS"' . ' "DNSSL=$DNSSL"' . "\n");
    cmd("chmod +x " . $hlp);
    /* run rdisc */
    //cmd("killall rdisc6");
    //cmd("sleep 1");
    /* INF status path. */
    $stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $inf, 0);
    if ($stsp == "") {
        return error($inf . " has not runtime nodes !");
    }
    /* need infprev */
    $infprev = query($stsp . "/infprevious");
    if ($infprev != "") {
        $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
        $prevdevnam = query($prevstsp . "/devnam");
        $prevphyinf = query($prevstsp . "/phyinf");
    }
    /* check if interface if ppp */
    if (strstr($prevdevnam, "ppp") == "") {
        if (strstr($prevdevnam, "sit") == "") {
            cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q " . $devnam . " &");
        } else {
            msg("SIT-Autoconf mode");
            /* auto in sit mode */
            $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $prevphyinf, 0);
            if ($p != "") {
                $ipaddr = query($p . "/ipv6/link/ipaddr");
            } else {
                return error("SIT tunnel need exist!! ");
            }
            msg("ipaddr: " . $ipaddr . " and devnam: " . $prevdevnam);
            cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q -e " . $ipaddr . " " . $prevdevnam . " &");
        }
    } else {
        msg("PPP-Autoconf mode");
        /* need infprev */
        $infprev = query($stsp . "/infprevious");
        $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
        /* need infprev */
        $atype = query($prevstsp . "/inet/addrtype");
        if ($atype == "ipv6") {
            $ipaddr = query($prevstsp . "/inet/ipv6/ipaddr");
        } else {
            if ($atype == "ppp6") {
                $ipaddr = query($prevstsp . "/inet/ppp6/local");
            } else {
                return error($inf . " has wrong addrtype of infprevious");
            }
        }
        cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q -e " . $ipaddr . " " . $prevdevnam . " &");
    }
    cmd("sleep 5");
    /* Clear any old records. */
    del($stsp . "/stateless");
    /* Preparing & Get M flag */
    $child = query($stsp . "/child/uid");
    if (strstr($prevdevnam, "ppp") == "") {
        $conf = "/var/run/" . $devnam;
    } else {
        $conf = "/var/run/" . $prevdevnam;
    }
    $mflag = fread("e", $conf . ".ra_mflag");
    $oflag = fread("e", $conf . ".ra_oflag");
    $rdnss = fread("e", $conf . ".ra_rdnss");
    $dnssl = fread("e", $conf . ".ra_dnssl");
    /* need infnext */
    $infnext = query($stsp . "/infnext");
    if ($infnext != "") {
        XNODE_set_var($inf . "_NEXTINF", $infnext);
    }
    /* need dnssl info */
    if ($dnssl != "") {
        msg("DNSSL :" . $dnssl);
        XNODE_set_var($child . "_DOMAIN", $dnssl);
    }
    if (strstr($prevdevnam, "ppp") == "") {
        msg($inf . "/" . $devnam . ", M=[" . $mflag . "], O=[" . $oflag . "]");
    } else {
        msg($inf . "/" . $prevdevnam . ", M=[" . $mflag . "], O=[" . $oflag . "]");
    }
    /* according to TR-124 issue 2 */
    /* Ignore m and o flags, always start dhcp client */
    /* generate wait script */
    $ipwait = "/var/servd/INET." . $inf . "-ipwait.sh";
    fwrite(w, $ipwait, "#!/bin/sh\n" . "phpsh /etc/scripts/IP-WAIT.php" . " INF=" . $inf . " PHYINF=" . $phyinf . " DEVNAM=" . $devnam . ' "DNS=' . $dns . '"' . " ME=" . $ipwait . "\n");
    /* start script */
    cmd("chmod +x " . $ipwait);
    cmd('xmldbc -t "ra.iptest.' . $inf . ':10:' . $ipwait . '"');
    if ($child != "") {
        /* always need dhcp client */
        $dhcpopt = "IA-NA+IA-PD";
        if (strstr($prevdevnam, "ppp") == "") {
            dhcp_client("STATEFUL", $inf, $devnam, $dhcpopt, $router, $dns);
        } else {
            XNODE_set_var($inf . "_PREVINF", $infprev);
            dhcp_client("PPPDHCP", $inf, $devnam, $dhcpopt, $router, $dns);
        }
        return 0;
    } else {
        $dhcpopt = "IA-NA";
        if (strstr($prevdevnam, "ppp") == "") {
            dhcp_client("STATEFUL", $inf, $devnam, $dhcpopt, $router, $dns);
        } else {
            XNODE_set_var($inf . "_PREVINF", $infprev);
            dhcp_client("PPPDHCP", $inf, $devnam, $dhcpopt, $router, $dns);
        }
        return 0;
    }
    //not reach here
    if ($mflag == "1") {
        /* Stateful ... */
        if ($dhcpopt == "") {
            if ($child == "") {
                $dhcpopt = "IA-NA";
            } else {
                $dhcpopt = "IA-NA+IA-PD";
            }
        }
        //dhcp_client("STATEFUL", $inf, $devnam, $dhcpopt, $router, $dns);
        if (strstr($prevdevnam, "ppp") == "") {
            dhcp_client("STATEFUL", $inf, $devnam, $dhcpopt, $router, $dns);
        } else {
            XNODE_set_var($inf . "_PREVINF", $infprev);
            dhcp_client("PPPDHCP", $inf, $devnam, $dhcpopt, $router, $dns);
        }
        return 0;
    } else {
        if ($mflag == "0") {
            /* Stateless */
            $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0);
            if ($p == "") {
                return error($phyinf . " has not runtime nodes!");
            }
            /* Get self-configured IP address. */
            /*$ipaddr = query($p."/ipv6/global/ipaddr");*/
            /*$prefix = query($p."/ipv6/global/prefix");*/
            $mac = PHYINF_getphymac($inf);
            $hostid = ipv6eui64($mac);
            $ra_prefix = fread("e", $conf . ".ra_prefix");
            $prefix = fread("e", $conf . ".ra_prefix_len");
            $ipaddr = ipv6ip($ra_prefix, $prefix, $hostid, 0, 0);
            $router = fread("e", $conf . ".ra_saddr");
            if (strstr($prevdevnam, "ppp") != "") {
                $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $prevphyinf, 0);
                $llipaddr = query($p . "/ipv6/link/ipaddr");
                $hostid = ipv6hostid($llipaddr, 64);
                $ipaddr = ipv6ip($ra_prefix, $prefix, $hostid, 0, 0);
            }
            if ($ipaddr != "") {
                if ($oflag == "0" && $dns == "" && $rdnss != "") {
                    $dns = $rdnss;
                }
                msg("Stateless Self-Config IP: " . $ipaddr . "/" . $prefix);
                //$router	= fread("e", $conf."/ra_saddr");
                if ($child != "") {
                    set($stsp . "/stateless/ipaddr", $ipaddr);
                    set($stsp . "/stateless/prefix", $prefix);
                    //set($stsp."/stateless/gateway",	$router);
                    setattr($stsp . "/stateless/gateway", "get", "ip -6 route show default | scut -p via");
                    set($stsp . "/stateless/dns", $dns);
                    if ($dnssl != "") {
                        set($stsp . "/stateless/domain", $dnssl);
                    }
                    /* run dhcpc6 for the child interface, and attach at the callback of dhcpc. */
                    //dhcp_client("STATELESS", $inf, $devnam, "IA-PD", $router, $dns);
                    if (strstr($prevdevnam, "ppp") == "") {
                        dhcp_client("STATELESS", $inf, $devnam, "IA-PD", $router, $dns);
                    } else {
                        XNODE_set_var($inf . "_PREVINF", $infprev);
                        dhcp_client("PPPDHCP", $inf, $devnam, "IA-PD", $router, $dns);
                    }
                } else {
                    cmd("phpsh /etc/scripts/IPV6.INET.php ACTION=ATTACH" . " MODE=STATELESS" . " INF=" . $inf . " DEVNAM=" . $devnam . " IPADDR=" . $ipaddr . " PREFIX=" . $prefix . " GATEWAY=" . $router . ' "DNS=' . $dns . '"');
                    if ($oflag == "1" && $dns == "") {
                        msg("STATELESS DHCP: information only.");
                        dhcp_client("INFOONLY", $inf, $devnam, "", "", "");
                    }
                }
                return 0;
            }
        }
    }
    //cmd("killall rdisc6");
    cmd("/etc/scripts/killpid.sh " . $pid);
    cmd("sleep 1");
    /* Not configured, try later. */
    cmd('xmldbc -t "ra.iptest.' . $inf . ':5:' . $me . '"');
    /* force to send RS */
    //$conf = "/proc/sys/net/ipv6/conf/".$_GLOBALS["DEVNAM"];
    //fwrite(w, $conf."/disable_ipv6",  "1");
    //fwrite(w, $conf."/disable_ipv6",  "0");
    return 0;
}
コード例 #8
0
ファイル: S40links.php プロジェクト: jhbsz/DIR-850L_A1
<?php

/* For BWC, BWC-2's flag and enable will use BWC-1's config */
setattr("/bwc/entry:2/flag", "link", "/bwc/entry:1/flag");
setattr("/bwc/entry:2/enable", "link", "/bwc/entry:1/enable");
setattr("/bwc/entry:2/rules", "link", "/bwc/entry:1/rules");
コード例 #9
0
ファイル: IP-WAIT.php プロジェクト: jhbsz/DIR-850L_A1
function main_entry($inf, $phyinf, $devnam, $dns, $me)
{
    /* INF status path. */
    $stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $inf, 0);
    if ($stsp == "") {
        return error($inf . " has not runtime nodes !");
    }
    $infprev = query($stsp . "/infprevious");
    if ($infprev != "") {
        $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
        $prevdevnam = query($prevstsp . "/devnam");
        $prevphyinf = query($prevstsp . "/phyinf");
    }
    /* Preparing & Get M flag */
    if (strstr($prevdevnam, "ppp") == "") {
        $conf = "/var/run/" . $devnam;
    } else {
        $conf = "/var/run/" . $prevdevnam;
    }
    $mflag = fread("e", $conf . ".ra_mflag");
    /* generate callback script */
    $hlp = "/var/servd/" . $inf . "-rdisc6.sh";
    $pid = "/var/servd/" . $inf . "-rdisc6.pid";
    $child = query($stsp . "/child/uid");
    if ($mflag == "") {
        //msg("mflag is null, kill rdisc6");
        /* kill daemon */
        cmd("/etc/scripts/killpid.sh " . $pid);
        /* check if interface if ppp */
        if (strstr($prevdevnam, "ppp") == "") {
            if (strstr($prevdevnam, "sit") == "") {
                cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q " . $devnam . " &");
            } else {
                //msg("SIT-Autoconf mode");
                /* auto in sit mode */
                $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $prevphyinf, 0);
                if ($p != "") {
                    $ipaddr = query($p . "/ipv6/link/ipaddr");
                } else {
                    return error("SIT tunnel need exist!! ");
                }
                msg("ipaddr: " . $ipaddr . " and devnam: " . $prevdevnam);
                cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q -e " . $ipaddr . " " . $prevdevnam . " &");
            }
        } else {
            //msg("PPP-Autoconf mode");
            /* need infprev */
            $infprev = query($stsp . "/infprevious");
            $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
            /* need infprev */
            $atype = query($prevstsp . "/inet/addrtype");
            if ($atype == "ipv6") {
                $ipaddr = query($prevstsp . "/inet/ipv6/ipaddr");
                /* share session with ipv4*/
            } else {
                if ($atype == "ppp6") {
                    $ipaddr = query($prevstsp . "/inet/ppp6/local");
                    /* only ipv6 session */
                } else {
                    return error($inf . " has wrong addrtype of infprevious");
                }
            }
            cmd("rdisc6 -c " . $hlp . " -p " . $pid . " -q -e " . $ipaddr . " " . $prevdevnam . " &");
        }
        //cmd("sleep 5");
        cmd('xmldbc -t "ra.iptest.' . $inf . ':10:' . $me . '"');
        return 0;
    }
    /* Preparing & Get M flag */
    $mflag = fread("e", $conf . ".ra_mflag");
    $oflag = fread("e", $conf . ".ra_oflag");
    $rdnss = fread("e", $conf . ".ra_rdnss");
    $dnssl = fread("e", $conf . ".ra_dnssl");
    /* need dnssl info */
    if ($dnssl != "") {
        msg("DNSSL :" . $dnssl);
        XNODE_set_var($child . "_DOMAIN", $dnssl);
    }
    if ($mflag != "") {
        if (strstr($prevdevnam, "ppp") == "") {
            msg($inf . "/" . $devnam . ", M=[" . $mflag . "], O=[" . $oflag . "]");
        } else {
            msg($inf . "/" . $prevdevnam . ", M=[" . $mflag . "], O=[" . $oflag . "]");
        }
    }
    $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $phyinf, 0);
    if ($p == "") {
        return error($phyinf . " has not runtime nodes!");
    }
    if ($mflag != "") {
        /* we got ra */
        $mac = PHYINF_getphymac($inf);
        $hostid = ipv6eui64($mac);
        $ra_prefix = fread("e", $conf . ".ra_prefix");
        $prefix = fread("e", $conf . ".ra_prefix_len");
        $ra_saddr = fread("e", $conf . ".ra_saddr");
        $ipaddr = ipv6ip($ra_prefix, $prefix, $hostid, 0, 0);
        $router = fread("e", $conf . ".ra_saddr");
        if (strstr($prevdevnam, "ppp") != "") {
            $p = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $prevphyinf, 0);
            $llipaddr = query($p . "/ipv6/link/ipaddr");
            $hostid = ipv6hostid($llipaddr, 64);
            $ipaddr = ipv6ip($ra_prefix, $prefix, $hostid, 0, 0);
        }
        //if ($ipaddr!="")
        if ($ra_saddr != "") {
            if ($oflag == "0" && $dns == "" && $rdnss != "") {
                $dns = $rdnss;
            }
            $defrt = query($stsp . "/defaultroute");
            if ($defrt != "" && $defrt > 0 && $router != "") {
                if (isfile("/var/run/wan_ralft_zero") != 1) {
                    /* add default route and runtime node*/
                    $gateway = query($stsp . "/inet/ipv6/gateway");
                    if ($gateway != "") {
                        cmd("ip -6 route del default via " . $gateway . " dev " . $devnam . " metric " . $defrt);
                        del($stsp . "/inet/ipv6/gateway");
                    }
                    cmd("ip -6 route add default via " . $router . " dev " . $devnam . " metric " . $defrt);
                }
                //set($stsp."/inet/ipv6/gateway",$router);
                setattr($stsp . "/inet/ipv6/gateway", "get", "ip -6 route show default | scut -p via");
                /* Replace runtime dynamic route */
                /*
                $base = "/runtime/dynamic/route6";
                $cnt = query($base."/entry#");
                $i=1;
                $found=0;
                while($i<=$cnt)
                {
                	$dest  = query($base."/entry:".$i."/ipaddr");
                	$pfx   = query($base."/entry:".$i."/prefix");
                	$dname = query($base."/entry:".$i."/inf");
                	if($dest=="::" && $pfx=="0" && $dname==$inf)
                	{
                		set($base."/entry:".$i."/gateway", $router);
                		$found=1;
                		break;
                	}
                	$i++;
                }
                
                if($found=="0")
                {
                	set($base."/entry:".$i."/ipaddr", "::");
                	set($base."/entry:".$i."/prefix", "0");
                	set($base."/entry:".$i."/gateway", $router);
                	set($base."/entry:".$i."/metric", $defrt);
                	set($base."/entry:".$i."/inf", $inf);
                }
                */
                if ($child != "") {
                    set($stsp . "/stateless/ipaddr", $ipaddr);
                    set($stsp . "/stateless/prefix", $prefix);
                    //set($stsp."/stateless/gateway", $router);
                    setattr($stsp . "/stateless/gateway", "get", "ip -6 route show default | scut -p via");
                    set($stsp . "/stateless/dns", $dns);
                }
                if ($child == "" && isfile("/var/run/" . $inf . ".UP") != 1) {
                    cmd("phpsh /etc/scripts/IPV6.INET.php ACTION=ATTACH" . " MODE=STATELESS" . " INF=" . $inf . " DEVNAM=" . $devnam . " IPADDR=" . $ipaddr . " PREFIX=" . $prefix . " GATEWAY=" . $router . ' "DNS=' . $dns . '"');
                }
            }
        }
        return 0;
    }
    /* Not configured, try later. */
    //cmd("killall rdisc6");
    //cmd("/etc/scripts/killpid.sh /var/servd/".$inf."-rdisc6.pid");
    //msg("mflag is null, kill rdisc6-part2");
    //cmd("/etc/scripts/killpid.sh ".$pid);
    //cmd("sleep 1");
    //cmd('xmldbc -t "ra.iptest.'.$inf.':5:'.$me.'"');
    //cmd('xmldbc -t "ra.iptest.'.$inf.':10:'.$me.'"');
    //return 0;
}
コード例 #10
0
function ckfw()
{
    setattr("/runtime/chfw", "get", "fwupdater -v /var/firmware.seama; echo \$?");
    return get("", "/runtime/chfw");
}
コード例 #11
0
ファイル: defaultvalue.php プロジェクト: jhbsz/DIR-850L_A1
include "/htdocs/phplib/trace.php";
include "/htdocs/webinc/config.php";
include "/htdocs/webinc/feature.php";
setattr("/runtime/devdata/wifiverify", "get", "devdata get -e wifiverify");
setattr("/runtime/devdata/ipv6logo", "get", "devdata get -e ipv6logo");
setattr("/runtime/tmpdevdata/wifipassword", "get", "devdata get -e psk");
setattr("/runtime/tmpdevdata/ssid_2G", "get", "devdata get -e wifissid_2g");
setattr("/runtime/tmpdevdata/ssid_5G", "get", "devdata get -e wifissid_5g");
setattr("/runtime/tmpdevdata/wlanmac", "get", "devdata get -e wlan24mac");
setattr("/runtime/tmpdevdata/wlanmac_sb", "get", "devdata get -e wlanmac");
setattr("/runtime/tmpdevdata/wlanmac2", "get", "devdata get -e wlan5mac");
setattr("/runtime/tmpdevdata/lanmac", "get", "devdata get -e lanmac");
setattr("/runtime/tmpdevdata/countrycode", "get", "devdata get -e countrycode");
setattr("/runtime/tmpdevdata/isfreset", "get", "mfc isfreset");
setattr("/runtime/tmpdevdata/hwver", "get", "devdata get -e hwver");
setattr("/runtime/tmpdevdata/image_sign", "get", "cat /etc/config/image_sign");
function changes_default_wifi($phyinfuid, $ssid, $password, $mac, $country)
{
    $authtype = "WPA+2PSK";
    $encrtype = "TKIP+AES";
    $p = XNODE_getpathbytarget("", "phyinf", "uid", $phyinfuid, 0);
    $wifi = XNODE_getpathbytarget("/wifi", "entry", "uid", query($p . "/wifi"), 0);
    if ($p == "" || $wifi == "") {
        return;
    }
    anchor($wifi);
    if ($ssid == "") {
        $n5 = cut($mac, 4, ":");
        $n6 = cut($mac, 5, ":");
        $ssidsuffix = $n5 . $n6;
        $ssid = query("ssid");
コード例 #12
0
ファイル: FORMAT.php プロジェクト: jhbsz/DIR-850L_A1
     $mntstatus = fread("", "/proc/mounts");
     if (scut_count($mntstatus, $dev) != "0") {
         if ($counter == "30") {
             echo "event UNMOUNT." . toupper($dev) . "\n";
         }
         $counter -= 2;
         if ($counter > 0) {
             echo "xmldbc -t \"TRYUNMOUNT:2:phpsh /etc/events/FORMAT.php dev=" . $dev . " action=try_unmount counter=" . $counter . "\"\n";
         } else {
             echo "phpsh " . $PHPFILE . " dev=" . $dev . " action=update state=FAILED\n";
         }
     } else {
         echo "phpsh " . $PHPFILE . " dev=" . $dev . " action=format\n";
     }
     setattr($path . "/space/used", "get", "");
     setattr($path . "/space/available", "get", "");
     set($path . "/state", "FORMATTING");
     set($path . "/fmt_result", "");
     set($path . "/space/size", "");
     set($path . "/space/used", "");
     set($path . "/space/available", "");
 } else {
     if ($action == "format") {
         echo "#!/bin/sh\n";
         echo "mkfs.ext3 /dev/" . $dev . " -F\n";
         echo "if [ \$? -eq 0 ]; then\n";
         echo "\tphpsh " . $PHPFILE . " dev=" . $dev . " action=update state=SUCCESS\n";
         echo "else\n";
         echo "\tphpsh " . $PHPFILE . " dev=" . $dev . " action=update state=FAILED\n";
         echo "fi\n";
     } else {
コード例 #13
0
ファイル: defaultvalue.php プロジェクト: jhbsz/DIR-850L_A1
/*rework wifi to
1.ssid dlink+mac
2.password and wpaauto psk.
*/
include "/htdocs/phplib/xnode.php";
include "/htdocs/phplib/trace.php";
include "/htdocs/webinc/config.php";
setattr("/runtime/devdata/wifiverify", "get", "devdata get -e wifiverify");
setattr("/runtime/devdata/ipv6logo", "get", "devdata get -e ipv6logo");
setattr("/runtime/tmpdevdata/wifipassword", "get", "devdata get -e psk");
setattr("/runtime/tmpdevdata/ssid_2G", "get", "devdata get -e wifissid_2g");
setattr("/runtime/tmpdevdata/ssid_5G", "get", "devdata get -e wifissid_5g");
setattr("/runtime/tmpdevdata/wlanmac", "get", "devdata get -e wlan24mac");
setattr("/runtime/tmpdevdata/wlanmac_sb", "get", "devdata get -e wlanmac");
setattr("/runtime/tmpdevdata/wlanmac2", "get", "devdata get -e wlan5mac");
setattr("/runtime/tmpdevdata/lanmac", "get", "devdata get -e lanmac");
function changes_default_wifi($phyinfuid, $ssid, $password, $mac)
{
    $p = XNODE_getpathbytarget("", "phyinf", "uid", $phyinfuid, 0);
    $wifi = XNODE_getpathbytarget("/wifi", "entry", "uid", query($p . "/wifi"), 0);
    if ($p == "" || $wifi == "") {
        return;
    }
    anchor($wifi);
    if ($ssid == "") {
        $n5 = cut($mac, 4, ":");
        $n6 = cut($mac, 5, ":");
        $ssidsuffix = $n5 . $n6;
        $ssid = query("ssid");
        if ($ssidsuffix != "") {
            //For dlink product, make the default SSID "dlink-mac" for 2.4GHz and "dlink-mac-media" for 5GHz.
コード例 #14
0
ファイル: PHYINF.ETH-2.php プロジェクト: jhbsz/DIR-850L_A1
<?php

include "/etc/services/PHYINF/phyinf.php";
fwrite("w", $START, "#!/bin/sh\n");
fwrite("w", $STOP, "#!/bin/sh\n");
phyinf_setup("ETH-2");
/* Create WAN interface. */
$path = XNODE_getpathbytarget("/runtime", "phyinf", "uid", "ETH-2", 0);
setattr($path . "/linkstatus", "get", "psts wan");
fwrite("a", $START, "exit 0\n");
fwrite("a", $STOP, "exit 0\n");
コード例 #15
0
ファイル: st_stats.php プロジェクト: jhbsz/DIR-850L_A1
        $cnt = query($p . $tx_error);
        $cnt = $cnt + query($p . "/stats/last_tx_error_cnt");
        set($p . "/stats/last_tx_error_cnt", $cnt);
        $cnt = query($p . $rx_error);
        $cnt = $cnt + query($p . "/stats/last_rx_error_cnt");
        set($p . "/stats/last_rx_error_cnt", $cnt);
        $cnt = query($p . $collision);
        $cnt = $cnt + query($p . "/stats/last_collision_cnt");
        set($p . "/stats/last_collision_cnt", $cnt);
        setattr($p . $tx_drop, "get", "scut -p " . query($p . "/name") . ": -f 12 /proc/net/dev -b " . query($p . "/stats/last_tx_drop_cnt") . " ");
        setattr($p . $rx_drop, "get", "scut -p " . query($p . "/name") . ": -f 4 /proc/net/dev -b " . query($p . "/stats/last_rx_drop_cnt") . " ");
        setattr($p . $tx_error, "get", "scut -p " . query($p . "/name") . ": -f 11 /proc/net/dev -b " . query($p . "/stats/last_tx_error_cnt") . " ");
        setattr($p . $rx_error, "get", "scut -p " . query($p . "/name") . ": -f 3 /proc/net/dev -b " . query($p . "/stats/last_rx_error_cnt") . " ");
        setattr($p . $collision, "get", "scut -p " . query($p . "/name") . ": -f 14 /proc/net/dev -b " . query($p . "/stats/last_collision_cnt") . " ");
        setattr($p . "/stats/rx/packets", "get", "scut -p " . query($p . "/name") . ": -f 2 /proc/net/dev -b " . query($p . "/stats/last_rx_pkt_cnt") . " ");
        setattr($p . "/stats/tx/packets", "get", "scut -p " . query($p . "/name") . ": -f 10 /proc/net/dev -b " . query($p . "/stats/last_tx_pkt_cnt") . " ");
        set($p . "/stats/reset", "dummy");
    }
}
$p = get_runtime_eth_path("WAN-1");
if ($p == "") {
    $wan1_tx = I18N("h", "N/A");
    $wan1_rx = I18N("h", "N/A");
    $wan1_txdrop = I18N("h", "N/A");
    $wan1_rxdrop = I18N("h", "N/A");
    $wan1_collision = I18N("h", "N/A");
    $wan1_error = I18N("h", "N/A");
} else {
    $wan1_tx = query($p . $tx);
    $wan1_rx = query($p . $rx);
    $wan1_txdrop = query($p . $tx_drop);
コード例 #16
0
<?php

include "/htdocs/phplib/xnode.php";
$path_run_inf_wan1 = XNODE_getpathbytarget("/runtime", "inf", "uid", "WAN-1", 0);
anchor($path_run_inf_wan1 . "/ddns4");
$provider = get("s", "provider");
$username = get("s", "username");
$password = get("s", "password");
$hostname = get("s", "hostname");
$interval = "21600";
$cmd = "susockc /var/run/ddnsd.susock DUMP " . $provider;
setattr("uptime", "get", $cmd . " | scut -p uptime:");
setattr("ipaddr", "get", $cmd . " | scut -p ipaddr:");
setattr("status", "get", $cmd . " | scut -p state:");
setattr("result", "get", $cmd . " | scut -p result:");
$addrtype = query($path_run_inf_wan1 . "/inet/addrtype");
if ($addrtype == "ipv4") {
    $ipaddr = query($path_run_inf_wan1 . "/inet/ipv4/ipaddr");
} else {
    $ipaddr = query($path_run_inf_wan1 . "/inet/ppp4/local");
}
$set = 'SET "' . $provider . '" "' . $ipaddr . '" "' . $username . '" "' . $password . '" "' . $hostname . '" ' . $interval;
$testtime = query($path_run_inf_wan1 . "/ddns4/testtime");
fwrite("w", $START, "#!/bin/sh\n");
fwrite("w", $STOP, "#!/bin/sh\n");
fwrite("a", $START, 'susockc /var/run/ddnsd.susock ' . $set . '\\n' . 'xmldbc -s ' . $path_run_inf_wan1 . '/ddns4/valid 1\\n' . 'xmldbc -s ' . $path_run_inf_wan1 . '/ddns4/provider ' . $provider . '\\n' . 'xmldbc -s ' . $path_run_inf_wan1 . '/ddns4/testtimeCheck ' . $testtime . '\\n' . 'exit 0\\n');
fwrite("a", $STOP, 'xmldbc -s ' . $path_run_inf_wan1 . '/ddns4/valid 0\\n' . 'susockc /var/run/ddnsd.susock DEL ' . $provider . '\\n' . 'exit 0\\n');
コード例 #17
0
ファイル: phyinf.php プロジェクト: jhbsz/DIR-850L_A1
function PHYINF_setup($uid, $type, $inf)
{
    $path = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $uid, 1);
    set($path . "/valid", "1");
    set($path . "/type", $type);
    set($path . "/name", $inf);
    setattr($path . "/mtu", "get", "ip -f link link show dev " . $inf . " | scut -p mtu");
    setattr($path . "/macaddr", "get", "ip -f link addr show dev " . $inf . " | scut -p link/ether");
    setattr($path . "/ipv6/link/ipaddr", "get", devipv6addr($inf, "link", 1));
    setattr($path . "/ipv6/link/prefix", "get", devipv6addr($inf, "link", 2));
    setattr($path . "/ipv6/global/ipaddr", "get", devipv6addr($inf, "global", 1));
    setattr($path . "/ipv6/global/prefix", "get", devipv6addr($inf, "global", 2));
    setattr($path . "/stats/rx/bytes", "get", "cat /sys/class/net/" . $inf . "/statistics/rx_bytes");
    setattr($path . "/stats/rx/packets", "get", "cat /sys/class/net/" . $inf . "/statistics/rx_packets");
    setattr($path . "/stats/rx/multicast", "get", "cat /sys/class/net/" . $inf . "/statistics/multicast");
    setattr($path . "/stats/rx/error", "get", "cat /sys/class/net/" . $inf . "/statistics/rx_errors");
    setattr($path . "/stats/rx/drop", "get", "cat /sys/class/net/" . $inf . "/statistics/rx_dropped");
    setattr($path . "/stats/tx/bytes", "get", "cat /sys/class/net/" . $inf . "/statistics/tx_bytes");
    setattr($path . "/stats/tx/packets", "get", "cat /sys/class/net/" . $inf . "/statistics/tx_packets");
    setattr($path . "/stats/tx/collision", "get", "cat /sys/class/net/" . $inf . "/statistics/collisions");
    setattr($path . "/stats/tx/error", "get", "cat /sys/class/net/" . $inf . "/statistics/tx_errors");
    setattr($path . "/stats/tx/drop", "get", "cat /sys/class/net/" . $inf . "/statistics/tx_dropped");
    setattr($path . "/stats/reset", "set", "/etc/scripts/resetstats.sh " . $inf);
    return $path;
}
コード例 #18
0
ファイル: register_send.php プロジェクト: jhbsz/DIR-850L_A1
function do_post($post_str, $post_url, $withcookie)
{
    $head_file = "/var/tmp/mydlink_head";
    $body_file = "/var/tmp/mydlink_body";
    $f_url = get_value_from_mydlink("portal_url");
    if ($f_url == "NULL") {
        return i18n("Unable to connect Mydlink.");
    }
    $http_ptr = strstr($f_url, "http://");
    $https_ptr = strstr($f_url, "https://");
    if (isempty($http_ptr) == 0) {
        $head = "http://";
    } else {
        if (isempty($https_ptr) == 0) {
            $head = "https://";
        } else {
            $head = "";
        }
    }
    $str_len = $http_ptr + strlen($head);
    $url = substr($f_url, $str_len, strlen($f_url) - $str_len);
    $slash_pt = strchr($url, "/");
    if (isempty($slash_pt) == 0) {
        $url = substr($url, 0, $slash_pt);
    }
    $f_url = $head . $url;
    $_GLOBALS["URL_MYDLINK"] = $f_url;
    //echo "url = ".$url."\n";
    //echo "f_url = ".$f_url."\n";
    $len = strlen($post_str) - 1;
    $req_head = "POST " . $post_url . " HTTP/1.1\r\n\\Accept: text/html, */*\r\n\\Accept-Language: en\r\n" . "x-requested-with: XMLHttpRequest\r\n\\Content-Type: application/x-www-form-urlencoded\r\n" . "User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\r\n" . "Host: " . $url . "\r\n\\Content-Length: " . $len . "\r\n\\Connection: Keep-Alive\r\n" . "Cache-Control: no-cache" . $withcookie . "\r\n\r\n";
    fwrite(w, $head_file, $req_head);
    fwrite(w, $body_file, $post_str);
    $url = "urlget post " . $f_url . $post_url . " " . $body_file . " " . $head_file;
    setattr("/runtime/register", "get", $url . " > /var/tmp/mydlink_result");
    get("x", "/runtime/register");
    del("/runtime/register");
    unlink($head_file);
    unlink($body_file);
    return 0;
}
コード例 #19
0
ファイル: S91upnpigd2.php プロジェクト: jhbsz/DIR-850L_A1
    $Genericname = $model;
}
/* find out the root device path. */
$pbase = "/runtime/upnp/dev";
$i = query($pbase . "#") + 1;
$dev_root = $pbase . ":" . $i;
$dtype = "urn:schemas-upnp-org:device:InternetGatewayDevice:2";
/********************************************************************/
/* root device: Internet Gateway Device */
/* create $dev_root */
set($dev_root, "");
anchor($dev_root);
/* set extension nodes. */
setattr("mac", "get", "devdata get -e wanmac");
$dtype2 = "urn:schemas-upnp-org:device:InternetGatewayDevice:1";
setattr("guid", "get", "genuuid -s \"" . $dtype2 . "\" -m \"" . query("mac") . "\"");
//setattr("guid", "get", "genuuid -s \"".$dtype."\" -r");
$udn = "uuid:" . query("guid");
/* set IGD nodes. */
set("UDN", $udn);
set("deviceType", $dtype);
set("port", "49152");
set("location", "InternetGatewayDevice.xml");
set("maxage", "1800");
set("server", "Linux, UPnP/1.0, " . $model . " Ver " . $ver);
/* set the description file names */
add("xmldoc", "InternetGatewayDevice.xml");
add("xmldoc", "Layer3Forwarding.xml");
add("xmldoc", "OSInfo.xml");
add("xmldoc", "WANCommonInterfaceConfig.xml");
add("xmldoc", "WANEthernetLinkConfig.xml");
コード例 #20
0
ファイル: dnsquery.php プロジェクト: jhbsz/DIR-850L_A1
HTTP/1.1 200 OK
Content-Type: text/xml

<?php 
if ($AUTHORIZED_GROUP < 0) {
    $result = "Authenication fail";
} else {
    if ($_POST["act"] == "dnsquery") {
        $param = "dnsquery -p -t 2 -d mydlink.com -d dlink.com -d dlink.com.cn -d dlink.com.tw -d google.com -d www.mydlink.com -d www.dlink.com -d www.dlink.com.cn -d www.dlink.com.tw -d www.google.com";
        setattr("/runtime/diagnostic/dnsquery", "get", $param);
        $result = get("s", "/runtime/diagnostic/dnsquery");
        del("/runtime/diagnostic/dnsquery");
    }
}
echo '<?xml version="1.0"?>\\n';
?>
<dnsquery>
	<report><?php 
echo $result;
?>
</report>
</dnsquery>
コード例 #21
0
ファイル: routing_stat.php プロジェクト: jhbsz/DIR-850L_A1
 function execute($cmd)
 {
     setattr("/runtime/command", "get", $cmd . " >> /var/cmd.result");
     get("x", "/runtime/command");
 }
コード例 #22
0
ファイル: bind.php プロジェクト: jhbsz/DIR-850L_A1
    if (query("/runtime/device/uptime") > $uptime_limit) {
        $Response = "BindTimeout";
    }
}
if ($Response == "BindSuccess") {
    set(INF_getinfpath($WAN1) . "/open_dns/type", "parent");
    set(INF_getinfpath($WAN1) . "/open_dns/deviceid", $_GET["deviceid"]);
    set(INF_getinfpath($WAN1) . "/open_dns/parent_dns_srv/dns1", $_GET["dnsip1"]);
    set(INF_getinfpath($WAN1) . "/open_dns/parent_dns_srv/dns2", $_GET["dnsip2"]);
    //+++sam_pan add
    $LAN1 = "LAN-1";
    $dns4 = INF_getinfpath($LAN1) . "/dns4";
    set($dns4, "DNS4-1");
    event("DBSAVE");
    //---sam_pan
    setattr(INF_getinfpath($WAN1) . "/open_dns/service", "set", "service OPENDNS4.MAP restart");
    set(INF_getinfpath($WAN1) . "/open_dns/service", "");
}
?>
<html>
	<head>
		<meta http-equiv="Pragma" content="no-cache"> <!--for HTTP 1.1-->
		<meta http-equiv="Cache-Control" content="no-cache"> <!--for HTTP 1.0--> 
		<meta http-equiv="Expires" content="0"> <!--prevents caching at the proxy server-->
		<meta name="Description" content="<?php 
echo $Response;
?>
"/>
		<script type="text/javascript">
			var Response = "<?php 
echo $Response;
コード例 #23
0
ファイル: phyinf.php プロジェクト: jhbsz/DIR-850L_A1
function PHYINF_setup($uid, $type, $inf)
{
    $path = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $uid, 1);
    set($path . "/valid", "1");
    set($path . "/type", $type);
    set($path . "/name", $inf);
    setattr($path . "/mtu", "get", "ip -f link link show dev " . $inf . " | scut -p mtu");
    setattr($path . "/macaddr", "get", "ip -f link addr show dev " . $inf . " | scut -p link/ether");
    setattr($path . "/ipv6/link/ipaddr", "get", devipv6addr($inf, "link", 1));
    setattr($path . "/ipv6/link/prefix", "get", devipv6addr($inf, "link", 2));
    setattr($path . "/ipv6/global/ipaddr", "get", devipv6addr($inf, "global", 1));
    setattr($path . "/ipv6/global/prefix", "get", devipv6addr($inf, "global", 2));
    setattr($path . "/stats/rx/bytes", "get", "scut -p " . $inf . ": -f 1 /proc/net/dev");
    setattr($path . "/stats/rx/packets", "get", "scut -p " . $inf . ": -f 2 /proc/net/dev");
    setattr($path . "/stats/rx/multicast", "get", "scut -p " . $inf . ": -f 8 /proc/net/dev");
    setattr($path . "/stats/rx/error", "get", "scut -p " . $inf . ": -f 3 /proc/net/dev");
    setattr($path . "/stats/rx/drop", "get", "scut -p " . $inf . ": -f 4 /proc/net/dev");
    setattr($path . "/stats/tx/bytes", "get", "scut -p " . $inf . ": -f 9 /proc/net/dev");
    setattr($path . "/stats/tx/packets", "get", "scut -p " . $inf . ": -f 10 /proc/net/dev");
    setattr($path . "/stats/tx/error", "get", "scut -p " . $inf . ": -f 11 /proc/net/dev");
    setattr($path . "/stats/reset", "set", "/etc/scripts/resetstats.sh " . $inf);
    setattr($path . "/stats/tx/drop", "get", "scut -p " . $inf . ": -f 12 /proc/net/dev");
    setattr($path . "/stats/tx/collision", "get", "scut -p " . $inf . ": -f 14 /proc/net/dev");
    setattr($path . "/stats/tx/collision", "get", "scut -p " . $inf . ": -f 14 /proc/net/dev");
    setattr($path . "/stats/connected_mac_2p4G", "get", "wl -i wifig0 bssid");
    setattr($path . "/stats/connected_mac_5G", "get", "wl -i wifia0 bssid");
    return $path;
}
コード例 #24
0
ファイル: wifi_stat.php プロジェクト: jhbsz/DIR-850L_A1
Content-Type: text/xml
<?php 
include "/htdocs/phplib/xnode.php";
if ($AUTHORIZED_GROUP < 0) {
    $RESULT = "FAIL";
    $REASON = i18n("Permission deny. The user is unauthorized.");
} else {
    /* should this be transfered as argument from web ? */
    $UID = "BAND24G-1.1";
    $infp = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $UID, 0);
    $ifname = query($infp . "/name");
    $phyp1 = XNODE_getpathbytarget("", "phyinf", "uid", $UID, 0);
    $wifi_path1 = XNODE_getpathbytarget("/wifi", "entry", "uid", query($phyp1 . "/wifi"), 0);
    $ssid1 = query($wifi_path1 . "/ssid");
    //set extension node
    setattr("/wifi_stat", "get", "wifi_stat " . $ifname);
    $DATA1 = query("/wifi_stat");
    $RESULT = "OK";
    $REASON = "";
}
/*
format should be like this 
<wifi_stat>
	<result>OK</result>
	<reason></reason>
	<Aband>
		<entry>
			<mac></mac>
			<rate></rate>
			<band></band>
		</entry>