summaryrefslogtreecommitdiff
path: root/files/common/www/service/cgi-bin/client_net.json
blob: 21c57676cc29a8e13ea579bf2983f5049f52ee1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh -e

[ -n "$REMOTE_HOST" ]
{
    grep ^$REMOTE_HOST </proc/net/arp \
	| awk 'BEGIN { FS = " " } ; { print $4, $6 }'
} | {
    read client_mac iface
    if [ "$iface" == br-lan ]; then wired=true; else wired=false; fi
    router_name="$(uci get 'system.@system[0].hostname')"
    echo -e "Status: 200 OK\r
Content-Type: application/json\r
\r
{\"client_mac\": \"$client_mac\",
 \"router_name\": \"$router_name\",
 \"iface\": \"$iface\",
 \"wired\": $wired
}"
}
contact: Jan Huwald // Impressum