<?php /* extern parameters: $ACTION, $ENDCODE, $VALUE */ include "/htdocs/neap/NEAP_LIB.php"; include "/htdocs/webinc/config.php"; $set_value = $VALUE; $get_value = ""; $uid = $LAN1; $inet = INET_getpathbyinf($uid); $ipv4 = $inet . "/ipv4"; if ($ENDCODE == "1") { $path = $ipv4 . "/ipaddr"; $get_value = query($path); } else { if ($ENDCODE == "2") { $path = $ipv4 . "/mask"; $mask = query($path); $get_value = ipv4int2mask($mask); $set_value = ipv4mask2int($set_value); } } NEAP_action($ACTION, $path, $get_value, $set_value);
function pptp_l2tp_func($waninf, $wan2inf, $over, $ACTION, $ENDCODE, $VALUE) { $path = ""; $get_value = ""; $set_value = $VALUE; $uid = $wan2inf; $inetp = INET_getpathbyinf($uid); $addrtype_path = $inetp . "/ipv4"; $infp = XNODE_getpathbytarget("", "inf", "uid", $waninf, "0"); set($infp . "/lowerlayer", "WAN-2"); $infp = XNODE_getpathbytarget("", "inf", "uid", $wan2inf, "0"); set($infp . "/active", 1); set($infp . "/upperlayer", "WAN-1"); set($infp . "/defaultroute", ""); if ($over == "pptp") { set($infp . "/nat", ""); } if ($ENDCODE == "1") { $node = "/static"; $path = $addrtype_path . $node; $static = query($path); $get_value = pptp_static_get($static); $set_value = pptp_static_set($set_values); } else { if ($ENDCODE == "2") { $node = "/ipaddr"; $path = $addrtype_path . $node; $get_value = query($path); } else { if ($ENDCODE == "3") { $node = "/mask"; $path = $addrtype_path . $node; $mask = query($path); if ($mask != "") { $get_value = ipv4int2mask($mask); } $set_value = ipv4mask2int($set_value); } else { if ($ENDCODE == "4") { $node = "/gateway"; $path = $addrtype_path . $node; $get_value = query($path); } else { if ($ENDCODE == "5") { $uid = $waninf; $inetp = INET_getpathbyinf($uid); $path = $inetp . "/ppp4/" . $over . "/server"; $get_value = query($path); } } } } } NEAP_action($ACTION, $path, $get_value, $set_value); }
} set($path_wan2_inet . "/ipv4/dns/entry", $PriDns); set($path_wan2_inet . "/ipv4/dns/entry:2", $SecDns); } else { if ($Type == "StaticL2TP" || $Type == "DynamicL2TP") { set($path_inf_wan2 . "/active", "1"); set($path_inf_wan1 . "/lowerlayer", "WAN-2"); set($path_inf_wan2 . "/upperlayer", "WAN-1"); set($path_inf_wan2 . "/nat", ""); set($path_wan1_inet . "/addrtype", "ppp4"); set($path_wan1_inet . "/ppp4/over", "l2tp"); anchor($path_wan1_inet . "/ppp4"); if ($Type == "StaticL2TP") { set($path_wan2_inet . "/ipv4/static", 1); set($path_wan2_inet . "/ipv4/ipaddr", $IPAddress); set($path_wan2_inet . "/ipv4/mask", ipv4mask2int($SubnetMask)); } else { set($path_wan2_inet . "/ipv4/static", 0); } set($path_wan2_inet . "/ipv4/gateway", $Gateway); set("l2tp/server", $ServiceName); set("username", $Username); set("password", $Password); set("dialup/idletimeout", $MaxIdleTime); if ($MaxIdleTime > 0) { set("dialup/mode", "ondemand"); } else { set("dialup/mode", "auto"); } if ($AutoReconnect == "true") { set("dialup/mode", "auto");
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 <?php echo "\\<\\?xml version='1.0' encoding='utf-8'\\?\\>"; include "/htdocs/phplib/xnode.php"; include "/htdocs/webinc/config.php"; $path_inf_lan1 = XNODE_getpathbytarget("", "inf", "uid", $LAN1, 0); $lan1_inet = query($path_inf_lan1 . "/inet"); $path_lan1_inet = XNODE_getpathbytarget("inet", "entry", "uid", $lan1_inet, 0); $nodebase = "/runtime/hnap/SetRouterLanSettings/"; $DHCPServerEnabled = query($nodebase . "DHCPServerEnabled"); $result = "REBOOT"; $RSmask = query($nodebase . "RouterSubnetMask"); set($path_lan1_inet . "/ipv4/ipaddr", query($nodebase . "RouterIPAddress")); set($path_lan1_inet . "/ipv4/mask", ipv4mask2int($RSmask)); if ($DHCPServerEnabled == "true") { set($path_inf_lan1 . "/dhcps4", "DHCPS4-1"); } else { if ($DHCPServerEnabled == "false") { set($path_inf_lan1 . "/dhcps4", ""); } } fwrite("w", $ShellPath, "#!/bin/sh\n"); fwrite("a", $ShellPath, "echo \"[\$0]-->Lan Change\" > /dev/console\n"); fwrite("a", $ShellPath, "/etc/scripts/dbsave.sh > /dev/console\n"); fwrite("a", $ShellPath, "service DEVICE.HOSTNAME restart > /dev/console\n"); fwrite("a", $ShellPath, "service INET.LAN-1 restart > /dev/console\n"); fwrite("a", $ShellPath, "service DHCPS4.LAN-1 restart > /dev/console\n"); fwrite("a", $ShellPath, "service RUNTIME.INF.LAN-1 restart > /dev/console\n"); fwrite("a", $ShellPath, "xmldbc -s /runtime/hnap/dev_status '' > /dev/console\n");