Exemple #1
0
															   uport:"5425,15425,28900"}},                                                                    
			{name: "Warcraft II",                       value:{tport:"6112-6119,4000",                                    
															   uport:"6112-6119"}},                                        
			{name: "Warcraft III",                      value:{tport:"6112-6119,4000",                                                      
															   uport:"6112-6119"}},
			{name: "WinMX",                      		value:{tport:"6699",                                                                
															   uport:"6257"}},                                                                
			{name: "Wolfenstein: Enemy Territory",      value:{tport:"",                                                                    
															   uport:"27950,27960,27965,27952"}},                                                                    
			{name: "WON Servers",      					value:{tport:"27000-27999",                                                        
															   uport:"15001,15101,15200,15400"}},                                                        
			{name: "World of Warcraft",                 value:{tport:"3724,6112,6881-6999", uport:""}},                                                 
			{name: "Xbox Live",                 		value:{tport:"3074", uport:"88,3074"}}
		  ],
	lanip: "<?php 
echo INF_getcurripaddr("LAN-1");
?>
",
	mask: "<?php 
echo INF_getcurrmask("LAN-1");
?>
",
	CursorFocus: function(node)
	{
		var i = node.lastIndexOf("entry:");
		if(node.charAt(i+7)==="/") var idx = parseInt(node.charAt(i+6), 10);
		else var idx = parseInt(node.charAt(i+6), 10)*10 + parseInt(node.charAt(i+7), 10);
		var indx = 1;
		var valid_dsc_cnt = 0;		
		for(indx=1; indx <= <?php 
echo $PFWD_MAX_COUNT;
Exemple #2
0
function inet_ipv4_dslite($inf, $ifname, $inet, $inetp, $infprev)
{
    startcmd("# inet_start_ipv4_dslite(" . $inf . "," . $ifname . "," . $inet . "," . $inetp . "," . $infprev . ")");
    startcmd("echo \$\$ > /var/run/dslite_start.pid");
    /* Get INET setting */
    $b4addr = query($inetp . "/ipv4/ipaddr");
    anchor($inetp . "/ipv4/ipv4in6");
    $remote = query("remote");
    $stsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $inf, 0);
    if ($b4addr != "") {
        set($stsp . "/inet/ipv4/ipaddr", $b4addr);
    } else {
        set($stsp . "/inet/ipv4/ipaddr", "");
    }
    $devnam = "ip4ip6." . $inf;
    //if($local!="")  $lcmd = " local ".$local;
    $mtu = query($inetp . "/ipv4/mtu");
    if ($mtu == "") {
        $mtu = 1452;
    }
    set($stsp . "/inet/ipv4/mtu", $mtu);
    if ($remote != "") {
        if ($infprev != "") {
            $local = INF_getcurripaddr($infprev);
            if ($local != "") {
                $lcmd = " local " . $local;
            }
        }
        $rcmd = " remote " . $remote;
        startcmd("ip -6 tunnel add " . $devnam . " mode ip4ip6" . $rcmd . $lcmd);
        set($stsp . "/inet/ipv4/ipv4in6/remote", $remote);
        startcmd("ip link set dev " . $devnam . " up");
        if ($b4addr != "") {
            startcmd("ip -4 addr add " . $b4addr . " dev " . $devnam);
        }
        startcmd("ip route add default dev " . $devnam);
        $uptime = query("/runtime/device/uptime");
        set($stsp . "/inet/uptime", query("/runtime/device/uptime"));
        set($stsp . "/inet/ipv4/valid", "1");
        startcmd("event " . $inf . ".UP");
        startcmd("echo 1 > /var/run/" . $inf . ".UP");
        stopcmd("ip -6 tunnel del " . $devnam);
        stopcmd("ip route del default dev " . $devnam);
        stopcmd("xmldbc -s " . $stsp . "/inet/ipv4/valid 0");
        stopcmd("event " . $inf . ".DOWN");
        stopcmd("rm -f /var/run/" . $inf . ".UP");
    } else {
        /* Get the IPv6 address of the previous interface */
        if ($infprev != "") {
            $local = INF_getcurripaddr($infprev);
            if ($local != "") {
                $lcmd = " local " . $local;
            }
            $prevstsp = XNODE_getpathbytarget("/runtime", "inf", "uid", $infprev, 0);
            $remote = query($prevstsp . "/inet/ipv4/ipv4in6/remote");
            startcmd("sip=`gethostip -6 " . $remote . "`");
            /* check if remote is acquired */
            startcmd("if [ \"{$remote}\" == \"\" ]; then");
            startcmd("\tsleep 1");
            startcmd("\tremote=`xmldbc -w " . $prevstsp . "/inet/ipv4/ipv4in6/remote`");
            startcmd("\twhile [ \"{$remote}\" == \"\" ]; do");
            startcmd("\t\tsleep 1");
            startcmd("\t\tremote=`xmldbc -w " . $prevstsp . "/inet/ipv4/ipv4in6/remote`");
            startcmd("\tdone");
            startcmd("\tsip=`gethostip -6 {$remote}`");
            startcmd("fi");
            //startcmd("sip=`gethostip -6 ".$remote."`");
        }
        startcmd("b4addr=`xmldbc -w " . $inetp . "/ipv4/ipaddr`");
        startcmd("if [ \"{$sip}\" != \"\" ]; then");
        startcmd("\tip -6 tunnel add " . $devnam . " mode ip4ip6 remote {$sip}" . $lcmd);
        startcmd("\txmldbc -s " . $stsp . "/inet/ipv4/ipv4in6/remote {$sip}");
        startcmd("\tip link set dev " . $devnam . " up");
        startcmd("\tif [ \"{$b4addr}\" != \"\" ]; then");
        startcmd("\t\tip -4 addr add {$b4addr} dev " . $devnam);
        startcmd("\tfi");
        startcmd("\tip route add default dev " . $devnam);
        $uptime = query("/runtime/device/uptime");
        startcmd("\txmldbc -s " . $stsp . "/inet/uptime " . $uptime);
        startcmd("\txmldbc -s " . $stsp . "/inet/ipv4/valid 1");
        startcmd("\tevent " . $inf . ".UP");
        startcmd("\techo 1 > /var/run/" . $inf . ".UP");
        startcmd("else");
        startcmd("\techo Cannot resolve aftr server name > /dev/console");
        startcmd("\txmldbc -s " . $stsp . "/inet/ipv4/valid 0");
        startcmd("fi");
        /* Start script */
        /*
        startcmd("phpsh /etc/scripts/IPV4.INET.php ACTION=ATTACH".
        	" STATIC=1".
        	" INF=".$inf.
        	" DEVNAM=".$ifname.
        	" IPADDR=".$ipaddr.
        	" MASK=".$mask.
        	" GATEWAY=".$gw.
        	" MTU=".$mtu.
        	' "DNS='.$dns.'"'
        );
        */
        //startcmd("event ".$inf.".UP");
        //startcmd("echo 1 > /var/run/".$inf.".UP");
        //startcmd("fi");
        /* Stop script */
        stopcmd("if [ -e /var/run/" . $inf . ".UP ]; then");
        stopcmd("\tip -6 tunnel del " . $devnam);
        stopcmd("\tip route del default dev " . $devnam);
        stopcmd("\txmldbc -s " . $stsp . "/inet/ipv4/valid 0");
        stopcmd("\tevent " . $inf . ".DOWN");
        stopcmd("\trm -f /var/run/" . $inf . ".UP");
        stopcmd("fi");
        //stopcmd("phpsh /etc/scripts/IPV4.INET.php ACTION=DETACH INF=".$inf);
    }
    stopcmd("if [ -f /var/run/dslite_start.pid ]; then");
    stopcmd("\tpid=`pfile -f /var/run/dslite_start.pid`");
    stopcmd("\t[ \"{$pid}\" != \"0\" ] && kill {$pid} > /dev/console 2>&1");
    stopcmd("\trm -rf /var/run/dslite_start.pid");
    stopcmd("fi");
}
Exemple #3
0
<?php

/* vi: set sw=4 ts=4: */
include "/htdocs/phplib/inf.php";
include "/htdocs/phplib/xnode.php";
$dtype = "urn:schemas-wifialliance-org:device:WFADevice:1";
$dpath = XNODE_getpathbytarget("/runtime/upnp", "dev", "deviceType", $dtype, 0);
if ($dpath == "") {
    exit;
}
anchor($dpath);
$ipaddr = INF_getcurripaddr($INF);
$port = query("port");
set("devdesc/URLBase", "http://" . $ipaddr . ":" . $port);
set("devdesc/device/presentationURL", "http://" . $ipaddr);
echo "<\\?xml version=\"1.0\" encoding=\"utf-8\"?\\>\n";
echo "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">\n";
echo dump(1, "devdesc");
echo "</root>\n";
Exemple #4
0
<?php

/* vi: set sw=4 ts=4: */
include "/htdocs/phplib/trace.php";
include "/htdocs/phplib/xnode.php";
include "/htdocs/phplib/inf.php";
fwrite("w", $START, "#!/bin/sh\n");
fwrite("w", $STOP, "#!/bin/sh\n");
$path = XNODE_getpathbytarget("", "inf", "uid", "LAN-1", 0);
$lan_ip_addr = INF_getcurripaddr("LAN-1");
$wan_ip_addr = INF_getcurripaddr("WAN-1");
$path_wan = XNODE_getpathbytarget("", "inf", "uid", "WAN-1", 0);
$wan_https_rport = query($path_wan . "/https_rport");
$stunnel = query($path . "/stunnel");
if (query("webaccess/enable") == "1") {
    $wfa_stunnel = 1;
} else {
    $wfa_stunnel = 0;
}
$mydlink = query("/mydlink/register_st");
$stunnel_conf = "/var/stunnel.conf";
/* prepare data for http to create httpd.conf (service STUNNEL) */
if ($stunnel == 1 || $wfa_stunnel == 1 || $mydlink == 1) {
    //prepare stunnel needed file
    fwrite("w", $stunnel_conf, "cert = /etc/stunnel_cert.pem\n");
    fwrite("a", $stunnel_conf, "key =/etc/stunnel.key\n");
    fwrite("a", $stunnel_conf, "pid = /var/run/stunnel.pid\n");
    fwrite("a", $stunnel_conf, "setuid = 0\n");
    fwrite("a", $stunnel_conf, "setgid = 0\n");
    fwrite("a", $stunnel_conf, "debug = 7\n");
    fwrite("a", $stunnel_conf, "output = /var/log/stunnel.log\n");