Beispiel #1
0
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;
}
Beispiel #2
0
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;
}