mirror of https://github.com/aredn/aredn.git
Merge branch 'release-3.15.1.0' into develop
Early merge of 3.15.1.0 into develop due to a large number of code changes in the release branch. Will merge again in the future when the branch is closed but want to pull in changes now from release.
This commit is contained in:
commit
f96dd0d49d
|
@ -1,3 +1,4 @@
|
|||
David Rivenburg <ad5oo@arrl.net>
|
||||
Conrad Lara - KG6JEI <KG6JEI@amsat.org>
|
||||
Darryl Quinn - K5DLQ <k5dlq@arrl.net>
|
||||
Joe Ayers - AE6XE <AE6XE@arrl.net>
|
||||
|
|
|
@ -10,6 +10,7 @@ cat feeds.conf.default >> feeds.conf
|
|||
./scripts/feeds install perl
|
||||
./scripts/feeds install -p arednpackages vtun
|
||||
./scripts/feeds install snmpd
|
||||
./scripts/feeds install ntpclient
|
||||
|
||||
SHORT_COMMIT=$(echo "$GIT_COMMIT" | awk '{ string=substr($0, 1, 8); print string; }' )
|
||||
SHORT_BRANCH=$(echo "$GIT_BRANCH" | awk 'match($0,"/"){print substr($0,RSTART+1)}')
|
||||
|
|
|
@ -31,5 +31,5 @@ if ( -z "$BUILD_SET_VERSION" ); then
|
|||
else
|
||||
MYBUILDNAME="${SHORT_BRANCH}-${BUILD_NUMBER}-${SHORT_COMMIT}"
|
||||
fi
|
||||
rename "s/openwrt/AREDN-$MYBUILDNAME/g" bin/ar71xx/*
|
||||
rename "s/openwrt-ar71xx-generic/AREDN-$MYBUILDNAME/g" bin/ar71xx/*
|
||||
|
||||
|
|
|
@ -79,4 +79,5 @@ CONFIG_PACKAGE_iptables-mod-ipopt=y
|
|||
CONFIG_PACKAGE_iwinfo=y
|
||||
CONFIG_PACKAGE_libiwinfo=y
|
||||
CONFIG_PACKAGE_socat=y
|
||||
CONFIG_PACKAGE_ntpclient=y
|
||||
EOF
|
||||
|
|
|
@ -6,7 +6,7 @@ wifi_mode = adhoc
|
|||
wifi_txpower = 19
|
||||
wifi_channel = 1
|
||||
wifi_chanbw = 20
|
||||
wifi_distance = 0
|
||||
wifi_distance = 100000
|
||||
wifi_country = 00
|
||||
|
||||
dmz_mode = 3
|
||||
|
|
|
@ -6,7 +6,7 @@ wifi_mode = adhoc
|
|||
wifi_txpower = 19
|
||||
wifi_channel = 1
|
||||
wifi_chanbw = 20
|
||||
wifi_distance = 0
|
||||
wifi_distance = 100000
|
||||
wifi_country = 00
|
||||
|
||||
dmz_mode = 3
|
||||
|
|
|
@ -83,7 +83,6 @@ config rule
|
|||
config include
|
||||
option path /etc/firewall.user
|
||||
|
||||
|
||||
config rule
|
||||
option src wan
|
||||
option dest_port 2222
|
||||
|
|
|
@ -14,7 +14,7 @@ config interface lan
|
|||
option netmask <lan_mask>
|
||||
option dns "<wan_dns1> <wan_dns2>"
|
||||
option gateway <lan_gw>
|
||||
|
||||
include /etc/aredn_include/ethmacfixup
|
||||
|
||||
#### WAN configuration
|
||||
config interface wan
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# Handles setting up rules for tunnel interfaces
|
||||
if [[ -x "/usr/bin/vtund" ]]
|
||||
if [ -x "/usr/sbin/vtund" ]
|
||||
then
|
||||
ISVPN=false
|
||||
case "$INTERFACE" in
|
||||
|
@ -19,4 +19,4 @@ then
|
|||
# echo "$INTF down" >> /tmp/vtundscript.log
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -4,116 +4,54 @@
|
|||
START=99
|
||||
boot() {
|
||||
|
||||
# Deal with lan and wifi having same mac address (common on TP-Link)
|
||||
if [ ! -f /etc/aredn_include/ethmacfixup ]
|
||||
then
|
||||
mkdir -p /etc/aredn_include
|
||||
touch /etc/aredn_include/ethmacfixup
|
||||
local lanintf=`uci -q get 'network.lan.ifname'`
|
||||
local wifiintf="wlan0"
|
||||
local lanmac=`ifconfig $lanintf | grep -o -E '([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}'`
|
||||
local wifimac=`ifconfig $wifiintf | grep -o -E '([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}'`
|
||||
|
||||
if [ "$lanmac" = "$wifimac" ]
|
||||
then
|
||||
local wifimacdigit=`echo $wifimac | awk 'BEGIN { FS = ":" } ;{print $4}'`
|
||||
local newmac="00:00:00:00:00:00"
|
||||
if [ "$wifimacdigit" = "FF" ]
|
||||
then
|
||||
newmac=`echo "$wifimac" | awk 'BEGIN { FS = ":" } ;{print $1":"$2":"$3":00:"$5":"$6}'`
|
||||
else
|
||||
local wifimacdigitplusone
|
||||
wifimacdigitplusone=`printf "%02X\n" $((0x$wifimacdigit + 1))`
|
||||
newmac=`echo "$wifimac:$wifimacdigitplusone" | awk 'BEGIN { FS = ":" } ;{print $1":"$2":"$3":"$7":"$5":"$6}'`
|
||||
fi
|
||||
case $lanintf in
|
||||
*.*)
|
||||
echo "" > /etc/aredn_include/ethmacfixup
|
||||
echo "config interface 'setethmac'" >> /etc/aredn_include/ethmacfixup
|
||||
echo -e "\toption\tifname\t'eth0'" >> /etc/aredn_include/ethmacfixup
|
||||
echo -e "\toption\tproto\t'none'" >> /etc/aredn_include/ethmacfixup
|
||||
echo -e "\toption\tmacaddr\t$newmac" >> /etc/aredn_include/ethmacfixup
|
||||
uci set "network.setethmac=interface"
|
||||
uci set "network.setethmac.ifname=eth0"
|
||||
uci set "network.setethmac.proto=none"
|
||||
uci set "network.setethmac.macaddr=$newmac"
|
||||
;;
|
||||
*)
|
||||
uci -q set "network.lan.macaddr=$newmac"
|
||||
echo -e "\toption\tmacaddr\t$newmac" > /etc/aredn_include/ethmacfixup
|
||||
;;
|
||||
esac
|
||||
uci commit
|
||||
/etc/init.d/network reload
|
||||
/etc/init.d/network restart
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
[ -x /usr/local/bin/bbhn-postupgrade ] && /usr/local/bin/bbhn-postupgrade
|
||||
|
||||
# extract auto-generated first boot switch config settings
|
||||
# and store them for future use
|
||||
if [ ! -f /etc/aredn_include/swconfig ]
|
||||
then
|
||||
mkdir -p /etc/aredn_include
|
||||
touch /etc/aredn_include/swconfig
|
||||
i=0
|
||||
while true; do
|
||||
uci -q get network.\@switch\[$i\] > /dev/null
|
||||
local status=$?
|
||||
if [ $status == 1 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "config switch" >> /etc/aredn_include/swconfig
|
||||
echo " option name '`uci -q get network.\@switch\[$i\].name`'" >> /etc/aredn_include/swconfig
|
||||
echo " option reset '`uci -q get network.\@switch\[$i\].reset`'" >> /etc/aredn_include/swconfig
|
||||
echo " option enable_vlan '`uci -q get network.\@switch\[$i\].enable_vlan`'" >> /etc/aredn_include/swconfig
|
||||
echo "" >> /etc/aredn_include/swconfig
|
||||
let i++
|
||||
done
|
||||
|
||||
i=0
|
||||
while true; do
|
||||
uci -q get network.\@switch_vlan\[$i\] > /dev/null
|
||||
local status=$?
|
||||
if [ $status == 1 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "config switch_vlan" >> /etc/aredn_include/swconfig
|
||||
echo " option device '`uci -q get network.\@switch_vlan\[$i\].device`'" >> /etc/aredn_include/swconfig
|
||||
echo " option vlan '`uci -q get network.\@switch_vlan\[$i\].vlan`'" >> /etc/aredn_include/swconfig
|
||||
echo " option ports '`uci -q get network.\@switch_vlan\[$i\].ports`'" >> /etc/aredn_include/swconfig
|
||||
echo "" >> /etc/aredn_include/swconfig
|
||||
let i++
|
||||
done
|
||||
|
||||
i=0
|
||||
while true; do
|
||||
uci -q get network.\@switch_port\[$i\] > /dev/null
|
||||
local status=$?
|
||||
if [ $status == 1 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "config switch_port" >> /etc/aredn_include/swconfig
|
||||
echo " option device '`uci -q get network.\@switch_port\[$i\].device`'" >> /etc/aredn_include/swconfig
|
||||
echo " option port '`uci -q get network.\@switch_port\[$i\].port`'" >> /etc/aredn_include/swconfig
|
||||
echo " option pvid '`uci -q get network.\@switch_port\[$i\].pvid`'" >> /etc/aredn_include/swconfig
|
||||
echo "" >> /etc/aredn_include/swconfig
|
||||
let i++
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Store the unique information about the card, such as its path, mac, and phy
|
||||
# so it can be used later.
|
||||
if [ ! -f /etc/aredn_include/radio0path ]
|
||||
then
|
||||
mkdir -p /etc/aredn_include
|
||||
touch /etc/aredn_include/radio0path
|
||||
local radio0path=`uci -q get wireless.radio0.path`
|
||||
local radio0phy=`uci -q get wireless.radio0.phy`
|
||||
local radio0mac=`uci -q get wireless.radio0.macaddr`
|
||||
if [ "$radio0path" != "" ]
|
||||
then
|
||||
echo " option path '$radio0path'" >> /etc/aredn_include/radio0path
|
||||
fi
|
||||
if [ "$radio0phy" != "" ]
|
||||
then
|
||||
echo " option phy '$radio0phy'" >> /etc/aredn_include/radio0path
|
||||
fi
|
||||
if [ "$radio0mac" != "" ]
|
||||
then
|
||||
echo " option macaddr '$radio0mac'" >> /etc/aredn_include/radio0path
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Save system NET LED settings
|
||||
if [ ! -f /etc/aredn_include/system_netled ]
|
||||
then
|
||||
mkdir -p /etc/aredn_include
|
||||
touch /etc/aredn_include/system_netled
|
||||
i=0
|
||||
while true; do
|
||||
uci -q get system.led_lan$i > /dev/null
|
||||
local status=$?
|
||||
if [ $status == 1 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "config led 'led_lan$i'" >> /etc/aredn_include/system_netled
|
||||
echo " option name '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled
|
||||
echo " option sysfs '`uci -q get system.led_lan$i.sysfs`'" >> /etc/aredn_include/system_netled
|
||||
echo " option trigger '`uci -q get system.led_lan$i.trigger`'" >> /etc/aredn_include/system_netled
|
||||
echo " option port_mask '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled
|
||||
echo "" >> /etc/aredn_include/system_netled
|
||||
let i++
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# setup nvram variables
|
||||
[ -x /usr/local/bin/nvram-setup ] && /usr/local/bin/nvram-setup
|
||||
|
||||
|
|
|
@ -106,14 +106,14 @@ apply_uci_config() {
|
|||
}
|
||||
|
||||
start() {
|
||||
# only if vtun is installed
|
||||
if [[ -x "/usr/sbin/vtund" ]]
|
||||
# only if vtun is installed and ind mesh mode
|
||||
configmode=$(uci -q -c /etc/local/uci/ get hsmmmesh.settings.config)
|
||||
if [ -x "/usr/sbin/vtund" -a "$configmode" = "mesh" ]
|
||||
then
|
||||
apply_uci_config
|
||||
config_load vtun
|
||||
|
||||
#if options section doesn't exist, add it
|
||||
echo "testing for options..."
|
||||
j=`uci get vtun.@options[0]`
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
|
|
|
@ -15,7 +15,6 @@ network_config() {
|
|||
# generate the default net
|
||||
def_net='172.31.1.1'
|
||||
config_get start "$cfg" start $def_net
|
||||
echo "NETWORK: $start" >> /tmp/vtuntest.log
|
||||
}
|
||||
|
||||
options_config() {
|
||||
|
@ -97,36 +96,47 @@ apply_uci_config() {
|
|||
}
|
||||
|
||||
start() {
|
||||
apply_uci_config
|
||||
config_load vtun
|
||||
|
||||
#if options section doesn't exist, add it
|
||||
echo "testing for options..."
|
||||
j=`uci get vtun.@options[0]`
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
j=`uci add vtun options`
|
||||
j='uci commit vtun'
|
||||
configmode=$(uci -q -c /etc/local/uci/ get hsmmmesh.settings.config)
|
||||
if [ -x "/usr/sbin/vtund" -a "$configmode" = "mesh" ]
|
||||
then
|
||||
|
||||
apply_uci_config
|
||||
config_load vtun
|
||||
|
||||
#if options section doesn't exist, add it
|
||||
j=`uci get vtun.@options[0]`
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
j=`uci add vtun options`
|
||||
j='uci commit vtun'
|
||||
config_load vtun
|
||||
fi
|
||||
|
||||
# Remove the current config files
|
||||
mkdir -p /tmp/vtun
|
||||
rm -f $SERVER_CONF
|
||||
|
||||
config_foreach network_config network
|
||||
config_foreach options_config options "$SERVER_CONF"
|
||||
config_foreach allowed_client_config client "$SERVER_CONF"
|
||||
|
||||
# START SERVER LISTENER
|
||||
/usr/sbin/vtund -s -f $SERVER_CONF
|
||||
fi
|
||||
|
||||
# Remove the current config files
|
||||
mkdir -p /tmp/vtun
|
||||
rm -f $SERVER_CONF
|
||||
|
||||
config_foreach network_config network
|
||||
config_foreach options_config options "$SERVER_CONF"
|
||||
config_foreach allowed_client_config client "$SERVER_CONF"
|
||||
|
||||
# START SERVER LISTENER
|
||||
/usr/sbin/vtund -s -f $SERVER_CONF
|
||||
}
|
||||
|
||||
stop() {
|
||||
# find the vtund SERVER process... --- FIX THIS
|
||||
for x in `ps -w|grep -F 'vtund[s]:'|grep -v grep|awk '{print $1}'`
|
||||
do
|
||||
s=`echo $s $x`
|
||||
done
|
||||
kill $s
|
||||
|
||||
# only if vtun is installed
|
||||
if [ -x "/usr/sbin/vtund" ]
|
||||
then
|
||||
|
||||
# find the vtund SERVER process... --- FIX THIS
|
||||
for x in `ps -w|grep -F 'vtund[s]:'|grep -v grep|awk '{print $1}'`
|
||||
do
|
||||
s=`echo $s $x`
|
||||
done
|
||||
kill $s
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh
|
||||
# extract auto-generated first boot switch config settings
|
||||
# and store them for future use
|
||||
if [ ! -f /etc/aredn_include/swconfig ]
|
||||
then
|
||||
mkdir -p /etc/aredn_include
|
||||
touch /etc/aredn_include/swconfig
|
||||
i=0
|
||||
while true; do
|
||||
uci -q get network.\@switch\[$i\] > /dev/null
|
||||
local status=$?
|
||||
if [ $status == 1 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "config switch" >> /etc/aredn_include/swconfig
|
||||
echo " option name '`uci -q get network.\@switch\[$i\].name`'" >> /etc/aredn_include/swconfig
|
||||
echo " option reset '`uci -q get network.\@switch\[$i\].reset`'" >> /etc/aredn_include/swconfig
|
||||
echo " option enable_vlan '`uci -q get network.\@switch\[$i\].enable_vlan`'" >> /etc/aredn_include/swconfig
|
||||
echo "" >> /etc/aredn_include/swconfig
|
||||
let i++
|
||||
done
|
||||
|
||||
i=0
|
||||
while true; do
|
||||
uci -q get network.\@switch_vlan\[$i\] > /dev/null
|
||||
local status=$?
|
||||
if [ $status == 1 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "config switch_vlan" >> /etc/aredn_include/swconfig
|
||||
echo " option device '`uci -q get network.\@switch_vlan\[$i\].device`'" >> /etc/aredn_include/swconfig
|
||||
echo " option vlan '`uci -q get network.\@switch_vlan\[$i\].vlan`'" >> /etc/aredn_include/swconfig
|
||||
echo " option ports '`uci -q get network.\@switch_vlan\[$i\].ports`'" >> /etc/aredn_include/swconfig
|
||||
echo "" >> /etc/aredn_include/swconfig
|
||||
let i++
|
||||
done
|
||||
|
||||
i=0
|
||||
while true; do
|
||||
uci -q get network.\@switch_port\[$i\] > /dev/null
|
||||
local status=$?
|
||||
if [ $status == 1 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "config switch_port" >> /etc/aredn_include/swconfig
|
||||
echo " option device '`uci -q get network.\@switch_port\[$i\].device`'" >> /etc/aredn_include/swconfig
|
||||
echo " option port '`uci -q get network.\@switch_port\[$i\].port`'" >> /etc/aredn_include/swconfig
|
||||
echo " option pvid '`uci -q get network.\@switch_port\[$i\].pvid`'" >> /etc/aredn_include/swconfig
|
||||
echo "" >> /etc/aredn_include/swconfig
|
||||
let i++
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Obtain and store the path to the wireless card so it can be used latter
|
||||
if [ -z "$(uci -q get wireless.radio0.path)" ]
|
||||
then
|
||||
mkdir -p /etc/aredn_include
|
||||
rm -f /etc/config/wireless
|
||||
wifi detect|grep "option path"|head -n 1 > /etc/aredn_include/radio0path
|
||||
wifi detect > /etc/config/wireless
|
||||
else
|
||||
echo " option path '$(uci -q get wireless.radio0.path)'" > /etc/aredn_include/radio0path
|
||||
fi
|
||||
|
||||
# Save system NET LED settings
|
||||
if [ ! -f /etc/aredn_include/system_netled ]
|
||||
then
|
||||
mkdir -p /etc/aredn_include
|
||||
touch /etc/aredn_include/system_netled
|
||||
i=0
|
||||
while true; do
|
||||
uci -q get system.led_lan$i > /dev/null
|
||||
local status=$?
|
||||
if [ $status == 1 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "config led 'led_lan$i'" >> /etc/aredn_include/system_netled
|
||||
echo " option name '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled
|
||||
echo " option sysfs '`uci -q get system.led_lan$i.sysfs`'" >> /etc/aredn_include/system_netled
|
||||
echo " option trigger '`uci -q get system.led_lan$i.trigger`'" >> /etc/aredn_include/system_netled
|
||||
echo " option port_mask '`uci -q get system.led_lan$i.port_mask`'" >> /etc/aredn_include/system_netled
|
||||
echo "" >> /etc/aredn_include/system_netled
|
||||
let i++
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -316,7 +316,6 @@ if($cfg{dmz_mode}) {
|
|||
print FILE " option dest lan\n";
|
||||
|
||||
system "uci set firewall.\@zone\[2\].masq=0";
|
||||
system "uci commit";
|
||||
} else {
|
||||
print FILE "\n";
|
||||
print FILE "config 'include'\n";
|
||||
|
@ -423,9 +422,6 @@ unless($cfg{wifi_proto} eq "disabled")
|
|||
{
|
||||
$cfg{wifi_txpower} = wifi_maxpower() if not defined $cfg{wifi_txpower} or $cfg{wifi_txpower} > wifi_maxpower();
|
||||
$cfg{wifi_txpower} = 1 if $cfg{wifi_txpower} < 1;
|
||||
if(wifi_useschains()){
|
||||
print FILE "/usr/local/bin/wifi-onbootchains\n";
|
||||
}
|
||||
print FILE "/usr/sbin/iw dev wlan0 set txpower fixed $cfg{wifi_txpower}00\n";
|
||||
if(defined $cfg{aprs_lat} and defined $cfg{aprs_lon})
|
||||
{
|
||||
|
@ -494,16 +490,6 @@ if(-f "/etc/config.$config/olsrd")
|
|||
# indicate whether lan is running in dmz mode
|
||||
system "echo $cfg{dmz_mode} > /etc/config/dmz-mode" if $cfg{dmz_mode};
|
||||
|
||||
# Set chains/antenna config elements as they are no longer in the template files
|
||||
|
||||
if(wifi_useschains()){
|
||||
$cmd .= "uci set wireless.\@wifi-device[0].rxchain=$cfg{wifi_rxant} >/dev/null 2>&1;";
|
||||
$cmd .= "uci set wireless.\@wifi-device[0].txchain=$cfg{wifi_txant} >/dev/null 2>&1;";
|
||||
} else {
|
||||
$cmd .= "uci set wireless.\@wifi-device[0].rxantenna=$cfg{wifi_rxant} >/dev/null 2>&1;";
|
||||
$cmd .= "uci set wireless.\@wifi-device[0].txantenna=$cfg{wifi_txant} >/dev/null 2>&1;";
|
||||
}
|
||||
|
||||
# Setup node lan dhcp
|
||||
if ( $cfg{lan_dhcp_noroute} ) {
|
||||
$cmd .= "uci add_list dhcp.\@dhcp[0].dhcp_option=3 >/dev/null 2>&1;"
|
||||
|
|
|
@ -101,7 +101,9 @@ foreach (@tunnelnames)
|
|||
$section=&uci_get_named_section("vtun",$_);
|
||||
if ($section->{enabled} eq 1)
|
||||
{
|
||||
my $sip=$section->{serverip};
|
||||
push(@tunnels,"tun${tunnum}");
|
||||
push @hosts, qq("$sip" "tun${tunnum}.$name.local.mesh");
|
||||
$tunnum++;
|
||||
}
|
||||
}
|
||||
|
@ -113,15 +115,13 @@ foreach (@tunnelnames)
|
|||
$section=&uci_get_named_section("vtun",$_);
|
||||
if ($section->{enabled} eq 1)
|
||||
{
|
||||
my $cip=$section->{clientip};
|
||||
push(@tunnels,"tun${tunnum}");
|
||||
push @hosts, qq("$cip" "tun${tunnum}.$name.local.mesh");
|
||||
$tunnum++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# add the nameservice plugin
|
||||
push @file, qq(\nLoadPlugin "olsrd_nameservice.so.0.3"\n);
|
||||
push @file, qq({\n);
|
||||
|
@ -145,6 +145,5 @@ push @file, qq(\n{\n);
|
|||
push @file, qq( Ip4Broadcast 255.255.255.255\n);
|
||||
push @file, qq(}\n);
|
||||
|
||||
|
||||
# write the file
|
||||
print @file;
|
||||
|
|
|
@ -31,9 +31,9 @@ if [ $rules_exist -eq 0 -a "$action" = "up" ] ; then
|
|||
iptables -N zone_vpn_DROP
|
||||
iptables -N zone_vpn_REJECT
|
||||
iptables -N zone_vpn_forward
|
||||
iptables -A forward -i tun+ -j zone_vpn_forward
|
||||
iptables -A input -i tun+ -j zone_vpn
|
||||
iptables -A output -j zone_vpn_ACCEPT
|
||||
iptables -I delegate_forward 3 -i tun+ -j zone_vpn_forward
|
||||
iptables -I delegate_input 3 -i tun+ -j zone_vpn
|
||||
iptables -I delegate_output 3 -j zone_vpn_ACCEPT
|
||||
iptables -A zone_vpn -p icmp -m icmp --icmp-type 8 -j ACCEPT
|
||||
iptables -A zone_vpn -p tcp -m tcp --dport 2222 -j ACCEPT
|
||||
iptables -A zone_vpn -p tcp -m tcp --dport 8080 -j ACCEPT
|
||||
|
@ -41,16 +41,14 @@ if [ $rules_exist -eq 0 -a "$action" = "up" ] ; then
|
|||
iptables -A zone_vpn -p tcp -m tcp --dport 1978 -j ACCEPT
|
||||
iptables -A zone_vpn -p tcp -m tcp --dport 23 -j ACCEPT
|
||||
iptables -I zone_dtdlink_forward 1 -j zone_vpn_ACCEPT
|
||||
if [ ! $is_olsrgw -eq 1 ] ; then
|
||||
iptables -I zone_dtdlink_forward 1 -j zone_wan_REJECT
|
||||
fi
|
||||
iptables -I zone_lan_forward 1 -j zone_vpn_ACCEPT
|
||||
iptables -I zone_wifi_forward 1 -j zone_vpn_ACCEPT
|
||||
if [ ! $is_olsrgw -eq 1 ] ; then
|
||||
iptables -I zone_wifi_forward 1 -j zone_wan_REJECT
|
||||
fi
|
||||
iptables -I zone_vpn_forward 1 -j zone_vpn_ACCEPT
|
||||
iptables -I zone_vpn_forward -j zone_wan_REJECT
|
||||
if [ $is_olsrgw -eq 1 ] ; then
|
||||
iptables -I zone_vpn_forward -j zone_wan_ACCEPT
|
||||
else
|
||||
iptables -I zone_vpn_forward -j zone_wan_REJECT
|
||||
fi
|
||||
iptables -A zone_vpn -j input_vpn
|
||||
iptables -A zone_vpn -j zone_vpn_ACCEPT
|
||||
iptables -A zone_vpn_ACCEPT -o tun+ -j ACCEPT
|
||||
|
@ -79,22 +77,24 @@ if [ $inf_count -eq 0 -a "$action" = "down" ] ; then
|
|||
iptables -D zone_vpn_ACCEPT -o tun+ -j ACCEPT
|
||||
iptables -D zone_vpn -j zone_vpn_ACCEPT
|
||||
iptables -D zone_vpn -j input_vpn
|
||||
iptables -D zone_vpn_forward -j zone_wan_REJECT
|
||||
iptables -D zone_vpn_forward -j zone_vpn_ACCEPT
|
||||
if [ ! $is_olsrgw -eq 1 ] ; then
|
||||
iptables -D zone_vpn_forward -j zone_wan_ACCEPT
|
||||
else
|
||||
iptables -D zone_vpn_forward -j zone_wan_REJECT
|
||||
fi
|
||||
iptables -D zone_wifi_forward -j zone_vpn_ACCEPT
|
||||
iptables -D zone_wifi_forward -j zone_wan_REJECT
|
||||
iptables -D zone_lan_forward -j zone_vpn_ACCEPT
|
||||
iptables -D zone_dtdlink_forward -j zone_vpn_ACCEPT
|
||||
iptables -D zone_dtdlink_forward -j zone_wan_REJECT
|
||||
iptables -D zone_vpn -p tcp -m tcp --dport 23 -j ACCEPT
|
||||
iptables -D zone_vpn -p tcp -m tcp --dport 1978 -j ACCEPT
|
||||
iptables -D zone_vpn -p udp -m udp --dport 698 -j ACCEPT
|
||||
iptables -D zone_vpn -p tcp -m tcp --dport 8080 -j ACCEPT
|
||||
iptables -D zone_vpn -p tcp -m tcp --dport 2222 -j ACCEPT
|
||||
iptables -D zone_vpn -p icmp -m icmp --icmp-type 8 -j ACCEPT
|
||||
iptables -D output -j zone_vpn_ACCEPT
|
||||
iptables -D input -i tun+ -j zone_vpn
|
||||
iptables -D forward -i tun+ -j zone_vpn_forward
|
||||
iptables -D delegate_output -j zone_vpn_ACCEPT
|
||||
iptables -D delegate_input -i tun+ -j zone_vpn
|
||||
iptables -D delegate_forward -i tun+ -j zone_vpn_forward
|
||||
iptables -X zone_vpn_REJECT
|
||||
iptables -X zone_vpn_DROP
|
||||
iptables -X zone_vpn_ACCEPT
|
||||
|
@ -106,22 +106,22 @@ fi
|
|||
|
||||
if [ "$action" = "up" ] ; then
|
||||
# Adding route policies for tunnel interface
|
||||
# identical to hotplug for dtdlink
|
||||
if ( ! `ip rule list | egrep "^20020:.*$interface.*30" > /dev/null`) then
|
||||
if [ -e /etc/config/dmz-mode ] ; then
|
||||
ip rule add pref 20010 iif $interface lookup 29 # local interfaces
|
||||
fi
|
||||
ip rule add pref 20020 iif $interface lookup 30 # mesh
|
||||
# ensure routing to internet is the local interface on this
|
||||
# node and not forwarded to another gateway on the local mesh
|
||||
# firewall rules above will always REJECT wan access comming across the tunnel
|
||||
ip rule add pref 20090 iif $interface lookup main # local routes including wan
|
||||
ip rule add pref 20080 iif $interface lookup 31 # gateway
|
||||
ip rule add pref 20090 iif $interface lookup main
|
||||
ip rule add pref 20099 iif $interface unreachable
|
||||
fi
|
||||
else
|
||||
# Remove route policies for tunnel interface
|
||||
ip rule del pref 20010 iif $interface lookup 29
|
||||
ip rule del pref 20020 iif $interface lookup 30
|
||||
ip rule del pref 20090 iif $interface lookup main
|
||||
ip rule del pref 20080 iff $interface lookup 31
|
||||
ip rule del pref 20090 iff $interface lookup main
|
||||
ip rule del pref 20099 iif $interface unreachable
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
#!/usr/bin/perl -w -I/www/cgi-bin
|
||||
=for commnet
|
||||
|
||||
Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks
|
||||
Copyright (C) 2015 Conrad Lara
|
||||
See Contributors file for additional contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation version 3 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
=cut
|
||||
|
||||
use perlfunc;
|
||||
|
||||
if (wifi_useschains()){
|
||||
|
||||
$wifi_rxant = `uci -q get wireless.\@wifi-device[0].rxchain`;
|
||||
$wifi_txant = `uci -q get wireless.\@wifi-device[0].txchain`;
|
||||
chomp($wifi_rxant);
|
||||
chomp($wifi_txant);
|
||||
|
||||
if ( $wifi_rxant ne "" ) {
|
||||
`echo $wifi_rxant > /sys/kernel/debug/ieee80211/phy0/ath9k/rx_chainmask`;
|
||||
}
|
||||
|
||||
if ( $wifi_txant ne "" ) {
|
||||
`echo $wifi_txant > /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask`;
|
||||
}
|
||||
}
|
|
@ -239,7 +239,7 @@ while(1)
|
|||
}
|
||||
elsif($web)
|
||||
{
|
||||
foreach $line (sort @list)
|
||||
foreach $line (sort { $b <=> $a } @list)
|
||||
{
|
||||
if ( $line =~ /AREDN/) { print "<tr class=\"wscan-row-node\">"}
|
||||
else { print "<tr>"}
|
||||
|
|
|
@ -528,7 +528,7 @@ foreach(@fw_images)
|
|||
print "</select>\n";
|
||||
print "<input type=submit name=button_refresh_fw value=Refresh title='download the list of available firmware versions'>\n";
|
||||
print "<td align=center><input type=submit name=button_dl_fw value=Download title='install the firmware'></td>\n";
|
||||
print "<td align=right><input type=checkbox name=checkbox_keep_settings>Keep Settings</td>\n";
|
||||
print "<td align=right><input type=checkbox name=checkbox_keep_settings checked>Keep Settings</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table></td></tr>\n";
|
||||
|
|
|
@ -51,7 +51,6 @@ sub rf_channel_map
|
|||
'2400' => {
|
||||
-2 => "-2 (2397)",
|
||||
-1 => "-1 (2402)",
|
||||
0 => "0 (2407)",
|
||||
1 => "1 (2412)",
|
||||
2 => "2 (2417)",
|
||||
3 => "3 (2422)",
|
||||
|
|
|
@ -42,7 +42,8 @@ BEGIN {push @INC, '/www/cgi-bin'};
|
|||
use perlfunc;
|
||||
|
||||
# collect some variables
|
||||
$node = nvram_get("node");
|
||||
$
|
||||
node = nvram_get("node");
|
||||
$node = "NOCALL" if $node eq "";
|
||||
$tactical = nvram_get("tactical");
|
||||
$config = nvram_get("config");
|
||||
|
@ -84,9 +85,14 @@ foreach(`echo /all | nc 127.0.0.1 2006 2>$tmperr`)
|
|||
}
|
||||
elsif($table eq "HNA")
|
||||
{
|
||||
($iproute, $ip) = split /\s+/, $_;
|
||||
($net, $cidr) = split /\//, $iproute;
|
||||
if ( $net eq "0.0.0.0" ) { $wangateway{$ip} = 1; }
|
||||
}
|
||||
elsif($table eq "MID")
|
||||
{
|
||||
($ip, $junk) = split /\s+/, $_;
|
||||
foreach $aip ( split /;/, $junk ) { $ipalias{$aip} = $ip }
|
||||
}
|
||||
elsif($table eq "Routes")
|
||||
{
|
||||
|
@ -111,20 +117,14 @@ foreach(`cat /etc/hosts`)
|
|||
chomp;
|
||||
($ip, $name, $tactical) = split /\s+/, $_;
|
||||
next if $name =~ /^(localhost|localnode|localap|dtdlink\..*)$/;
|
||||
if ( $name !~ /\./ ) { $name="${name}.local.mesh"; }
|
||||
if($ip eq $my_ip)
|
||||
{
|
||||
$tactical = "" unless $tactical;
|
||||
$localhosts{$ip}{tactical} = $tactical;
|
||||
$localhosts{$ip}{name} = $name;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $name !~ /\./ )
|
||||
{
|
||||
$name="${name}.local.mesh";
|
||||
}
|
||||
push @{$localhosts{$my_ip}{hosts}}, $name;
|
||||
}
|
||||
else { push @{$localhosts{$my_ip}{hosts}}, $name; }
|
||||
}
|
||||
|
||||
# load the olsr hosts file
|
||||
|
@ -135,35 +135,37 @@ foreach(`cat /var/run/hosts_olsr 2>/dev/null`)
|
|||
($ip, $name, $junk, $originator, $mid, $midnum) = split /\s+/, $_;
|
||||
next unless $originator;
|
||||
next if $originator eq "myself";
|
||||
if ( $name =~ /^dtdlink\..*$/ )
|
||||
|
||||
if (( $name !~ /\./ ) || ( $name =~ /^mid\.[^\.]*$/ )) { $name="${name}.local.mesh"; }
|
||||
|
||||
if ( $ip eq $originator )
|
||||
{
|
||||
$hosts{$ip}{name} = $name;
|
||||
$hosts{$ip}{hide} = 1;
|
||||
next;
|
||||
if($hosts{$ip}{name}) { $hosts{$ip}{tactical} = $name }
|
||||
else
|
||||
{
|
||||
$hosts{$ip}{name} = $name;
|
||||
if ( $routes{$ip} ) { $hosts{$ip}{etx} = $routes{$ip}{etx} ; }
|
||||
else { $hosts{$ip}{etx} = "99.000"; }
|
||||
}
|
||||
}
|
||||
|
||||
if(defined $mid and $midnum =~ /^\#(\d+)/)
|
||||
{
|
||||
if ( !exists $hosts{$ip}{name} )
|
||||
{
|
||||
elsif ( $name =~ /^dtdlink\..*$/ )
|
||||
{
|
||||
$hosts{$ip}{name} = $name;
|
||||
if ( $routes{$ip} ) { $hosts{$ip}{etx} = $routes{$ip}{etx} ; }
|
||||
else { $hosts{$ip}{etx} = "99.000"; }
|
||||
$dtd{$originator} = 1 ;
|
||||
}
|
||||
$hosts{$ip}{hide} = 1;
|
||||
$hosts{$originator}{mid} = $1;
|
||||
}
|
||||
elsif($ip eq $originator)
|
||||
{
|
||||
if($hosts{$ip}{name}) { $hosts{$ip}{tactical} = $name }
|
||||
else { $hosts{$ip}{name} = $name }
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $name !~ /\./ )
|
||||
{
|
||||
$name="${name}.local.mesh";
|
||||
}
|
||||
push @{$hosts{$originator}{hosts}}, $name;
|
||||
}
|
||||
elsif ( $name =~ /^mid\d+\..*$/ )
|
||||
{
|
||||
$midcount{$originator} = $midcount{$originator} ? $midcount{$originator}+1: 1 ;
|
||||
if (! $hosts{$ip}{name} )
|
||||
{
|
||||
if ( $routes{$ip} ) { $hosts{$ip}{etx} = $routes{$ip}{etx} ; }
|
||||
else { $hosts{$ip}{etx} = "99.000"; }
|
||||
$hosts{$ip}{name} = $name;
|
||||
}
|
||||
}
|
||||
else { push @{$hosts{$originator}{hosts}}, $name; }
|
||||
}
|
||||
|
||||
# load the olsr services file
|
||||
|
@ -178,12 +180,7 @@ foreach(`cat /var/run/services_olsr 2>/dev/null`)
|
|||
($name, $originator) = split /\#/, $name;
|
||||
$name =~ s/\s+$//;
|
||||
|
||||
if ( $host !~ /\./ )
|
||||
{
|
||||
$host="${host}.local.mesh";
|
||||
}
|
||||
|
||||
#$host = $originator eq " my own service" ? $node : $hosts{$originator}{name};
|
||||
if ( $host !~ /\./ ) { $host="${host}.local.mesh"; }
|
||||
|
||||
# attempt to work around olsr never forgetting defunct services
|
||||
# assume that the first entry in the file by this name is the most recent, ignore the rest
|
||||
|
@ -279,9 +276,15 @@ if(keys %localhosts)
|
|||
|
||||
foreach $ip (keys %localhosts)
|
||||
{
|
||||
$host = $localhosts{$ip}{name} . ".local.mesh";
|
||||
$host = $localhosts{$ip}{name};
|
||||
$tactical = $localhosts{$ip}{tactical} ? " / " . $localhosts{$ip}{tactical} : "";
|
||||
$rows{$host} = sprintf "<tr><td valign=top><nobr>%s</nobr></td><td colspan=3> </td><td>\n", $host . $tactical;
|
||||
$rows{$host} = sprintf "<tr><td valign=top><nobr>%s</nobr>", $host . $tactical;
|
||||
|
||||
if ( $wangateway{$ip} ) { $nodeiface = "wan" ; }
|
||||
if ( $nodeiface ) { $rows{$host} .= " <small>($nodeiface)</small>"; }
|
||||
|
||||
$rows{$host} .= "</td><td colspan=3> </td><td>\n" ;
|
||||
|
||||
foreach(sort keys %{$services{$host}})
|
||||
{
|
||||
$rows{$host} .= "<nobr>" . $services{$host}{$_} . "</nobr><br>\n";
|
||||
|
@ -316,40 +319,38 @@ print "<tr><th align=left><nobr>Remote Nodes</nobr></th><th> </th><th
|
|||
print "<tr><td colspan=5><hr></td></tr>\n";
|
||||
|
||||
%rows = ();
|
||||
%sortrows = ();
|
||||
foreach $ip (keys %hosts)
|
||||
{
|
||||
next if $links{$ip};
|
||||
next if exists $hosts{$ip}{hide};
|
||||
next if $ipalias{$ip};
|
||||
|
||||
$isNeig=0;
|
||||
foreach $aip (keys %ipalias)
|
||||
{
|
||||
if ($ipalias{$aip} eq $ip ) { if ($links{$aip} ) { $isNeig=1; last;} }
|
||||
}
|
||||
next if $isNeig;
|
||||
|
||||
$host = $hosts{$ip}{name};
|
||||
$tactical = $hosts{$ip}{tactical} ? " / " . $hosts{$ip}{tactical} : "";
|
||||
$etx = "unknown";
|
||||
$etx = sprintf "%.2f", $hosts{$ip}{etx};
|
||||
next if ($etx > 50 );
|
||||
|
||||
if ( $host !~ /\./ )
|
||||
{
|
||||
$host="${host}.local.mesh";
|
||||
}
|
||||
|
||||
if($routes{$ip}) # get the etx directly
|
||||
{
|
||||
$etx = sprintf "%.2f", $routes{$ip}{etx};
|
||||
}
|
||||
else # find the subnet it belongs to
|
||||
{
|
||||
foreach $net (keys %routes)
|
||||
{
|
||||
next unless (ip2decimal($ip) & $routes{$net}{mask}) == $routes{$net}{value};
|
||||
$etx = sprintf "%.2f", $routes{$net}{etx};
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
next if $etx eq "unknown";
|
||||
$rows{$host} = sprintf "<tr><td valign=top><nobr><a href='http://%s:8080/'>%s</a>", $host, $host . $tactical;
|
||||
if($midnum = $hosts{$ip}{mid}) # show mid interfaces
|
||||
{
|
||||
$midnum = ($midnum > 1) ? "*$midnum" : "";
|
||||
$rows{$host} .= " <small>(mid$midnum)</small>";
|
||||
}
|
||||
|
||||
undef $nodeiface;
|
||||
#if ( $dtd{$ip} )
|
||||
#{
|
||||
#$nodeiface = "dtd";
|
||||
#if ( $midcount{$ip} ) { $midcount{$ip} -= 1; } # extra mid entry matching and with dtdlink in hosts_olsrd
|
||||
#}
|
||||
#if ( $hosts{$ip}{tactical} ) { $midcount{$ip} -= 1; } # extra mid entry if tactical name defined
|
||||
#if ( $midcount{$ip} ) { $nodeiface = $nodeiface ? "dtd," . "tun*$midcount{$ip}" : "tun*$midcount{$ip}" ; }
|
||||
if ( $wangateway{$ip} ) { $nodeiface = $nodeiface ? $nodeiface . ",wan" : "wan" ; }
|
||||
|
||||
if ( $nodeiface ) { $rows{$host} .= " <small>($nodeiface)</small>"; }
|
||||
|
||||
$rows{$host} .= sprintf "</nobr></td><td></td><td align=right valign=top>%s</td><td></td><td>\n", $etx;
|
||||
foreach(sort keys %{$services{$host}})
|
||||
{
|
||||
|
@ -368,11 +369,12 @@ foreach $ip (keys %hosts)
|
|||
}
|
||||
$rows{$host} .= "</td></tr>\n";
|
||||
}
|
||||
$sortrows{$ip}=$host;
|
||||
}
|
||||
|
||||
if(keys %rows)
|
||||
{
|
||||
foreach(sort keys %rows) { print $rows{$_} }
|
||||
foreach(sort { $hosts{$a}{etx} <=> $hosts{$b}{etx} } keys %sortrows) { print $rows{$sortrows{$_}} }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -382,7 +384,6 @@ else
|
|||
|
||||
print "</table></td><td width=20> </td><td valign=top><table>\n";
|
||||
|
||||
|
||||
# show current neighbors
|
||||
|
||||
print "<tr><th align=left><nobr>Current Neighbors</nobr></th><th> </th><th>LQ</th><th>NLQ</th><th> </th><th align=left>Services</th></tr>\n";
|
||||
|
@ -394,32 +395,42 @@ if(keys %links)
|
|||
|
||||
foreach $ip (keys %links)
|
||||
{
|
||||
$host = $hosts{$ip}{name} ? $hosts{$ip}{name} : $ip;
|
||||
$tactical = $hosts{$ip}{tactical} ? " / " . $hosts{$ip}{tactical} : "";
|
||||
$ipmain = exists $ipalias{$ip} ? $ipalias{$ip} : $ip ;
|
||||
$host = $hosts{$ipmain}{name} ? $hosts{$ipmain}{name} : $ipmain;
|
||||
$tactical = $hosts{$ipmain}{tactical} ? " / " . $hosts{$ipmain}{tactical} : "";
|
||||
if ( $rows{$host} ) { $host .= " " ; } # avoid collision 2 links to same host {rf, dtd}
|
||||
|
||||
if ( $host !~ /\./ )
|
||||
{
|
||||
$host="${host}.local.mesh";
|
||||
}
|
||||
$no_space_host=$host;
|
||||
$no_space_host =~ s/\s+$//;
|
||||
$rows{$host} = sprintf "<tr><td valign=top><nobr><a href='http://%s:8080/'>%s</a>", $no_space_host, $no_space_host . $tactical;
|
||||
|
||||
$rows{$host} = sprintf "<tr><td valign=top><nobr><a href='http://%s:8080/'>%s</a>", $host, $host . $tactical;
|
||||
|
||||
if($midnum = $hosts{$ip}{mid}) # show mid interfaces
|
||||
undef $nodeiface;
|
||||
if ( $ipmain ne $ip ) # indicate if dtd or tunnel interface to neighbor
|
||||
{
|
||||
$midnum = ($midnum > 1) ? "*$midnum" : "";
|
||||
$rows{$host} .= " <small>(mid$midnum)</small>";
|
||||
if ( $hosts{$ip}{name} =~ /^dtdlink\..*$/ ){ $nodeiface="dtd" ; }
|
||||
#elsif ( $hosts{$ip}{name} =~ /^mid\d+\..*$/ ) { $nodeiface="tun" ; }
|
||||
#else { $nodeiface="?" ; }
|
||||
}
|
||||
|
||||
$rows{$host} .= sprintf ("</nobr></td><td></td><td align=right valign=top>%.0f%%</td><td align=right valign=top>%.0f%%</td><td></td><td>\n", 100*$links{$ip}{lq}, 100*$links{$ip}{nlq});
|
||||
foreach(sort keys %{$services{$host}}) { $rows{$host} .= "<nobr>" . $services{$host}{$_} . "</nobr><br>\n" }
|
||||
$rows{$host} .= "</td></tr>\n";
|
||||
if ( $wangateway{$ip} or $wangateway{$ipmain} ) { $nodeiface = $nodeiface ? $nodeiface . ",wan" : "wan" ; }
|
||||
if ( $nodeiface ) { $rows{$host} .= " <small>($nodeiface)</small>"; }
|
||||
|
||||
# add advertised dmz hosts
|
||||
foreach $dmzhost (@{$hosts{$ip}{hosts}})
|
||||
{
|
||||
$rows{$host} .= "<tr><td valign=top><nobr> <img src='/dot.png'>$dmzhost</nobr></td><td colspan=3></td><td>\n";
|
||||
foreach(sort keys %{$services{$dmzhost}}) { $rows{$host} .= $services{$dmzhost}{$_} . "<br>\n" }
|
||||
$rows{$host} .= sprintf ("</nobr></td><td></td><td align=right valign=top>%.0f%%</td><td align=right valign=top>%.0f%%</td><td></td><td>\n", 100*$links{$ip}{lq}, 100*$links{$ip}{nlq});
|
||||
|
||||
if ( ! exists $neighservices{$host} )
|
||||
{
|
||||
foreach(sort keys %{$services{$host}}) { $rows{$host} .= "<nobr>" . $services{$host}{$_} . "</nobr><br>\n" }
|
||||
|
||||
$rows{$host} .= "</td></tr>\n";
|
||||
|
||||
# add advertised dmz hosts
|
||||
foreach $dmzhost (@{$hosts{$ipmain}{hosts}})
|
||||
{
|
||||
$rows{$host} .= "<tr><td valign=top><nobr> <img src='/dot.png'>$dmzhost</nobr></td><td colspan=3></td><td>\n";
|
||||
foreach(sort keys %{$services{$dmzhost}}) { $rows{$host} .= $services{$dmzhost}{$_} . "<br>\n" }
|
||||
$rows{$host} .= "</td></tr>\n";
|
||||
}
|
||||
$neighservices{$host}=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,8 +453,11 @@ print "<tr><td colspan=6><hr></td></tr>\n";
|
|||
foreach $ip (keys %history)
|
||||
{
|
||||
next if $links{$ip};
|
||||
next if $links{$ipalias{$ip}};
|
||||
$age = sprintf "%010d", $uptime - $history{$ip}{age};
|
||||
$host = $history{$ip}{host} ? $history{$ip}{host} : $ip;
|
||||
$host =~ s/^mid\d+\.// ;
|
||||
$host =~ s/^dtdlink\.// ;
|
||||
$rows{$age} .= sprintf "<tr><td colspan=4><nobr>%s</nobr>", $host;
|
||||
foreach(@{$hosts{$ip}{hosts}}) { $rows{$age} .= "<br><nobr><img src='/dot.png'>$_</nobr>" }
|
||||
$rows{$age} .= "</td><td valign=top><nobr>";
|
||||
|
@ -497,7 +511,6 @@ if($debug)
|
|||
printf "/%s", $hosts{$ip}{tactical} if $hosts{$ip}{tactical};
|
||||
foreach(@{$hosts{$ip}{hosts}}) { print ":$_" }
|
||||
printf(" %d", $hosts{$ip}{mid}) if $hosts{$ip}{mid};
|
||||
print "\n";
|
||||
}
|
||||
|
||||
print "\nlinks\n";
|
||||
|
|
|
@ -61,6 +61,11 @@ sub html_header
|
|||
print "<meta http-equiv='expires' content='0'>\n";
|
||||
print "<meta http-equiv='cache-control' content='no-cache'>\n";
|
||||
print "<meta http-equiv='pragma' content='no-cache'>\n";
|
||||
|
||||
# set up the style sheet
|
||||
mkdir "/tmp/web" unless -d "/tmp/web"; # make sure /tmp/web exists
|
||||
symlink "/www/aredn.css","/tmp/web/style.css" unless -l "/tmp/web/style.css"; # default to aredn.css
|
||||
|
||||
# Prevent browser caching of the css file
|
||||
my $rnum=`date +%s`;
|
||||
chomp($rnum);
|
||||
|
@ -318,8 +323,8 @@ sub reboot_page
|
|||
print "<h1>$node is rebooting</h1><br>\n";
|
||||
print "<h3>The LAN subnet has changed. You will need to acquire a new DHCP lease<br>";
|
||||
print "and reset any name service caches you may be using.</h3><br>\n";
|
||||
print "<h3>Wait for the Power LED to start blinking, then stop blinking.<br>\n";
|
||||
print "When the DMZ LED turns off you can get your new DHCP lease and reconnect with<br>\n";
|
||||
print "<h3>Wait for the Status 4 LED to start blinking, then stop blinking.<br>\n";
|
||||
print "When the Status 4 LED remains solid on you can get your new DHCP lease and reconnect with<br>\n";
|
||||
print "<a href='http://localnode.local.mesh:8080/'>http://localnode.local.mesh:8080/</a><br>or<br>\n";
|
||||
print "<a href='http://$node.local.mesh:8080/'>http://$node.local.mesh:8080/</a></h3>\n";
|
||||
}
|
||||
|
@ -595,11 +600,29 @@ sub get_wifi_signal
|
|||
chomp $wifiintf;
|
||||
my ($SignalLevel) = "N/A";
|
||||
my ($NoiseFloor) = "N/A";
|
||||
foreach(`iwinfo $wifiintf info`)
|
||||
{
|
||||
next unless /.*Signal: ([\d\-]+) dBm.*Noise: ([\d\-]+) dBm/;
|
||||
$SignalLevel=$1;
|
||||
$NoiseFloor=$2;
|
||||
foreach(`iw dev $wifiintf station dump`)
|
||||
{
|
||||
next unless /.+signal:\s+([-]?[\d]+)/;
|
||||
if ( $SignalLevel <= "$1" || $SignalLevel == "N/A" )
|
||||
{
|
||||
$SignalLevel=$1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach(`iw dev $wifiintf survey dump|grep -A 1 \"\\[in use\\]\"`)
|
||||
{
|
||||
next unless /([\d\-]+) dBm/;
|
||||
$NoiseFloor=$1;
|
||||
}
|
||||
|
||||
if ( $NoiseFloor == "N/A" )
|
||||
{
|
||||
open( my $NoiseFH , "<" , "/sys/kernel/debug/ieee80211/phy0/ath9k/dump_nfcal") or return ("N/A","N/A");
|
||||
while (<$NoiseFH>) {
|
||||
next unless /Channel Noise Floor : ([-]?[0-9]+)/;
|
||||
$NoiseFloor=$1;
|
||||
}
|
||||
close($NoiseFH);
|
||||
}
|
||||
|
||||
if ( $SignalLevel == "N/A" || $NoiseFloor == "N/A" )
|
||||
|
@ -933,8 +956,6 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '27',
|
||||
'pwroffset' => '0',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -944,8 +965,6 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '27',
|
||||
'pwroffset' => '0',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -960,8 +979,6 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '16',
|
||||
'pwroffset' => '4',
|
||||
'antennas' => { 1 => 'Antenna' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -971,19 +988,24 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '10',
|
||||
'antennas' => { 1 => 'Antenna' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
'0xe005' => {
|
||||
'name' => 'NanoStation M5',
|
||||
'comment' => 'NanoStation M5',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '5',
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
'0xe009' => {
|
||||
'name' => 'NanoStation Loco M9',
|
||||
'comment' => 'NanoStation Loco M9',
|
||||
'supported' => '1',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '6',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '900',
|
||||
},
|
||||
|
@ -993,19 +1015,24 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '18',
|
||||
'pwroffset' => '10',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
'0xe035' => {
|
||||
'name' => 'NanoStation M3',
|
||||
'comment' => 'NanoStation M3 in testing',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '3',
|
||||
'usechains' => 1,
|
||||
'rfband' => '3400',
|
||||
},
|
||||
'0xe0a2' => {
|
||||
'name' => 'NanoStation Loco M2',
|
||||
'comment' => '',
|
||||
'supported' => '1',
|
||||
'maxpower' => '18',
|
||||
'pwroffset' => '5',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1015,8 +1042,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '18',
|
||||
'pwroffset' => '10',
|
||||
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1026,8 +1051,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '5',
|
||||
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1037,8 +1060,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '6',
|
||||
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '900',
|
||||
},
|
||||
|
@ -1048,8 +1069,6 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '3',
|
||||
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '3400',
|
||||
},
|
||||
|
@ -1059,8 +1078,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '16',
|
||||
'pwroffset' => '12',
|
||||
'antennas' => { 1 => 'N Connector' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1070,8 +1087,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '6',
|
||||
'antennas' => { 1 => 'N Connector' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1081,8 +1096,6 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '28',
|
||||
'pwroffset' => '0',
|
||||
'antennas' => { 1 => 'airGrid' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1092,8 +1105,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '1',
|
||||
'antennas' => { 1 => 'airGrid' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1103,8 +1114,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '21',
|
||||
'pwroffset' => '2',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1114,8 +1123,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '6',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '900',
|
||||
},
|
||||
|
@ -1125,8 +1132,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '9',
|
||||
'antennas' => { 1 => 'airGrid' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1136,8 +1141,6 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '3',
|
||||
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '3400',
|
||||
},
|
||||
|
@ -1147,8 +1150,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '9',
|
||||
'antennas' => { 1 => 'airGrid' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1158,8 +1159,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '6',
|
||||
'antennas' => { 1 => 'airGrid' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1169,8 +1168,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '1',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1180,8 +1177,6 @@ sub hardware_info
|
|||
'supported' => '-1',
|
||||
'maxpower' => '18',
|
||||
'pwroffset' => '10',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1191,8 +1186,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '16',
|
||||
'pwroffset' => '12',
|
||||
'antennas' => { 1 => 'N Connector' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1202,8 +1195,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '6',
|
||||
'antennas' => { 1 => 'N Connector' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1213,8 +1204,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '16',
|
||||
'pwroffset' => '12',
|
||||
'antennas' => { 1 => 'Antenna' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '2400',
|
||||
},
|
||||
|
@ -1224,8 +1213,6 @@ sub hardware_info
|
|||
'supported' => '-1',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '1',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5500',
|
||||
},
|
||||
|
@ -1235,8 +1222,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '5',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1246,8 +1231,6 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '4',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1257,8 +1240,6 @@ sub hardware_info
|
|||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '5',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1268,8 +1249,6 @@ sub hardware_info
|
|||
'supported' => '1',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '1',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
|
@ -1299,43 +1278,6 @@ sub wifi_maxpower
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
sub wifi_validant
|
||||
{
|
||||
$boardinfo = hardware_info();
|
||||
if ( exists $boardinfo->{'antennas'} ) {
|
||||
return $boardinfo->{'antennas'};
|
||||
} else
|
||||
{
|
||||
return { 0 => "Left", 1 => "Right", 2 => "Diversity" };
|
||||
}
|
||||
}
|
||||
|
||||
sub wifi_defaultant
|
||||
{
|
||||
|
||||
$boardinfo = hardware_info();
|
||||
if ( exists $boardinfo->{'defaultant'} ) {
|
||||
return $boardinfo->{'defaultant'};
|
||||
} else
|
||||
{
|
||||
#Most likely to catch all models. Some have 3 and start at 1, some start at 0, others have 1 at 1, etc
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub wifi_useschains
|
||||
{
|
||||
|
||||
$boardinfo = hardware_info();
|
||||
if ( exists $boardinfo->{'usechains'} ) {
|
||||
return $boardinfo->{'usechains'};
|
||||
} else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#Some systems have power offsets in them because of a secondary amplifier
|
||||
#Because of this the chipset may report one power level but the amplifier
|
||||
#has increased it to a higher level.
|
||||
|
@ -1452,7 +1394,7 @@ sub reboot_required()
|
|||
}
|
||||
sub css_options
|
||||
{
|
||||
print "<option value=\"style.css\">Select a theme</option>";
|
||||
print "<option>Select a theme</option>";
|
||||
my @cssfiles = `ls /www/*.css`;
|
||||
foreach $css (@cssfiles)
|
||||
{
|
||||
|
|
|
@ -136,28 +136,12 @@ unless($parms{reload})
|
|||
if ( $doesiwoffset ) {
|
||||
$wifi_txpower -= $1;
|
||||
}
|
||||
if (wifi_useschains()){
|
||||
$wifi_txant = `cat /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask`;
|
||||
$wifi_rxant = `cat /sys/kernel/debug/ieee80211/phy0/ath9k/rx_chainmask`;
|
||||
$wifi_txant = hex($wifi_txant);
|
||||
$wifi_rxant = hex($wifi_rxant);
|
||||
}
|
||||
else {
|
||||
foreach ( `iw phy phy0 info` ) {
|
||||
next unless /Configured Antennas: TX 0x([\d]+) RX 0x([\d]+)/;
|
||||
$wifi_txant = $1;
|
||||
$wifi_rxant = $2;
|
||||
}
|
||||
}
|
||||
$slottime = "";
|
||||
}
|
||||
|
||||
# sanitize the active settings
|
||||
$valid_ant = wifi_validant();
|
||||
$wifi_txpower = wifi_maxpower() if not defined $wifi_txpower or $wifi_txpower > wifi_maxpower();
|
||||
$wifi_txpower = 1 if $wifi_txpower < 1;
|
||||
$wifi_rxant = wifi_defaultant() if not defined $wifi_rxant or not exists $valid_ant->{$wifi_rxant};
|
||||
$wifi_txant = wifi_defaultant() if not defined $wifi_txant or not exists $valid_ant->{$wifi_txant};
|
||||
$wifi_distance = 0 unless defined $wifi_distance;
|
||||
$wifi_distance = 0 if $wifi_distance =~ /\D/;
|
||||
|
||||
|
@ -165,8 +149,6 @@ $wifi_distance = 0 if $wifi_distance =~ /\D/;
|
|||
# so they get saved correctly
|
||||
$parms{wifi_distance} = $wifi_distance;
|
||||
$parms{wifi_txpower} = $wifi_txpower;
|
||||
$parms{wifi_txant} = $wifi_txant;
|
||||
$parms{wifi_rxant} = $wifi_rxant;
|
||||
|
||||
#
|
||||
# apply the wifi settings
|
||||
|
@ -176,16 +158,6 @@ if($parms{button_apply} or $parms{button_save})
|
|||
{
|
||||
my $wifiintf = get_interface("wifi");
|
||||
$cmd = "";
|
||||
if(wifi_useschains()){
|
||||
$cmd .= "echo $wifi_rxant > /sys/kernel/debug/ieee80211/phy0/ath9k/rx_chainmask;";
|
||||
$cmd .= "echo $wifi_txant > /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask;";
|
||||
} else {
|
||||
$cmd .= "ifdown wifi >/dev/null 2>&1;";
|
||||
$cmd .= "ifdown wifi_mon >/dev/null 2>&1;";
|
||||
$cmd .= "iw phy phy0 set antenna $wifi_txantenna $wifi_rxantenna >/dev/null 2>&1;";
|
||||
$cmd .= "ifup wifi >/dev/null 2>&1;";
|
||||
$cmd .= "ifup wifi_mon >/dev/null 2>&1;";
|
||||
}
|
||||
$cmd .= "iw phy phy0 set distance $wifi_distance >/dev/null 2>&1;";
|
||||
$cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;";
|
||||
system $cmd;
|
||||
|
@ -483,7 +455,18 @@ print "
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
</td></tr><tr><td>
|
||||
</td></tr>";
|
||||
|
||||
if($config ne "mesh")
|
||||
{
|
||||
print "<tr><td align=center>";
|
||||
print "<b>This node type will be removed in a future release -- See release notes</b>";
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
print "
|
||||
<tr><td>
|
||||
<br>
|
||||
|
||||
<table cellpadding=5 border=1 width=100%>
|
||||
|
@ -612,20 +595,7 @@ if($wifi_proto ne "disabled")
|
|||
|
||||
print "<tr><td colspan=2 align=center><hr><small>Active Settings</small></td></tr>\n";
|
||||
|
||||
print "<tr><td><nobr>Rx Antenna</nobr></td>\n";
|
||||
print "<td><select name=wifi_rxant>\n";
|
||||
$validants = wifi_validant();
|
||||
while (($value, $name) = each (%{$validants})){
|
||||
selopt($name, $value, $wifi_rxant);
|
||||
}
|
||||
print "</select></td></tr>\n";
|
||||
|
||||
print "<tr><td><nobr>Tx Antenna</nobr></td>\n";
|
||||
print "<td><select name=wifi_txant>\n";
|
||||
while (($value, $name) = each (%{$validants})){
|
||||
selopt($name, $value, $wifi_txant);
|
||||
}
|
||||
print "</select></td></tr>\n";
|
||||
print "<tr><td colspan=2><br>Antenna selection is now automatic<br><br></td></tr>";
|
||||
|
||||
print "<tr><td><nobr>Tx Power</nobr></td>\n";
|
||||
print "<td><select name=wifi_txpower>\n";
|
||||
|
@ -634,7 +604,7 @@ if($wifi_proto ne "disabled")
|
|||
print "</select></td></tr>\n";
|
||||
|
||||
print "<tr><td>Distance</td>\n";
|
||||
print "<td><input type=text size=8 name=wifi_distance value='$wifi_distance' title='Distance in meters to the farthest neighbor; 0=automatic'></td></tr>\n";
|
||||
print "<td><input type=text size=8 name=wifi_distance value='$wifi_distance' title='Distance in meters to the farthest neighbor'> meters</td></tr>\n";
|
||||
|
||||
print "<tr><td></td><td><input type=submit name=button_apply value=Apply title='Immediately use these active settings'></td></tr>\n";
|
||||
}
|
||||
|
@ -643,6 +613,8 @@ else
|
|||
push @hidden, "<input type=hidden name=wifi_ssid value='$wifi_ssid'>";
|
||||
push @hidden, "<input type=hidden name=wifi_mode value='$wifi_mode'>";
|
||||
push @hidden, "<input type=hidden name=wifi_channel value='$wifi_channel'>";
|
||||
push @hidden, "<input type=hidden name=wifi_chanbw value='20'>";
|
||||
push @hidden, "<input type=hidden name=wifi_country value='US'>";
|
||||
}
|
||||
print "</table></td>\n";
|
||||
|
||||
|
@ -818,6 +790,7 @@ print "<td><input type=text size=15 name=wan_dns2 value='$wan_dns2'></td></tr>\n
|
|||
if($config eq "mesh")
|
||||
{
|
||||
print "<tr><td colspan=2><hr></td></tr>\n";
|
||||
print "<tr><th colspan=2>Advanced</th></tr>";
|
||||
print "<tr><td><nobr>Mesh Gateway</nobr></td>\n";
|
||||
print "<td><input type=checkbox name=olsrd_gw value=1 title='Allow this node to provide internet access to all other nodes'";
|
||||
print " checked" if $olsrd_gw;
|
||||
|
|
|
@ -48,10 +48,6 @@ $config = "not set" if $config eq "" or not -d "/etc/config.$config";
|
|||
|
||||
read_postdata();
|
||||
|
||||
# set up the style sheet
|
||||
mkdir "/tmp/web" unless -d "/tmp/web"; # make sure /tmp/web exists
|
||||
symlink "/www/aredn.css","/tmp/web/style.css" unless -l "/tmp/web/style.css"; # default to aredn.css
|
||||
|
||||
if($parms{css} and -f "/www/$parms{css}" and $parms{css} =~ /\.css$/i) {
|
||||
unlink "/tmp/web/style.css";
|
||||
symlink "/www/$parms{css}","/tmp/web/style.css";
|
||||
|
|
|
@ -50,8 +50,16 @@ use perlfunc;
|
|||
"/var/run/hosts_olsr",
|
||||
);
|
||||
|
||||
@sensitive = ( "/etc/config/vtun",
|
||||
"/etc/config.mesh/vtun",
|
||||
"/etc/httpd.conf",
|
||||
);
|
||||
|
||||
|
||||
|
||||
@cmds = ( "cat /proc/cpuinfo",
|
||||
"df -k",
|
||||
"dmesg",
|
||||
"ifconfig",
|
||||
"iptables -t filter -S",
|
||||
"iptables -t nat -S",
|
||||
|
@ -68,9 +76,9 @@ use perlfunc;
|
|||
"iw phy phy0 info",
|
||||
"logread",
|
||||
"md5sum /www/cgi-bin/*",
|
||||
"echo /all | nc 127.0.0.1 2006",
|
||||
"opkg list-installed",
|
||||
"ps -w",
|
||||
"telnet localhost 2006",
|
||||
"/usr/local/bin/get_hardwaretype",
|
||||
"/usr/local/bin/get_boardid",
|
||||
"/usr/local/bin/get_model",
|
||||
|
@ -99,6 +107,15 @@ foreach $path (@files) {
|
|||
|
||||
}
|
||||
|
||||
#Remove sensitive files
|
||||
foreach $path (@sensitive) {
|
||||
if ( $path =~ /^\/(.*)/ ) {
|
||||
my $sourcepath = $1;
|
||||
system("rm", "-r", "-f", "/tmp/sd/$sourcepath");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
system("touch","/tmp/sd/data.txt");
|
||||
open (my $CMDS_OUT, '>', '/tmp/sd/data.txt') or die "Could not open dump file";
|
||||
|
@ -114,11 +131,16 @@ close ($CMDS_OUT);
|
|||
|
||||
system("tar", "-zcf", "/tmp/supportdata.tgz", "-C", "/tmp/sd", "./");
|
||||
|
||||
$nodename=`uname -n`;
|
||||
chomp($nodename);
|
||||
$tstamp=`date +%Y%m%d%H%M`;
|
||||
chomp($tstamp);
|
||||
|
||||
open(my $SDFH, '<', "/tmp/supportdata.tgz") or exit(1);
|
||||
binmode $SDFH;
|
||||
|
||||
print "Content-type: application/x-gzip\r\n";
|
||||
print "Content-Disposition: attachment; filename=supportdata.tgz\r\n";
|
||||
print "Content-Disposition: attachment; filename=supportdata-$nodename-$tstamp.tgz\r\n";
|
||||
print "\r\n";
|
||||
|
||||
print while <$SDFH>;
|
||||
|
|
|
@ -131,11 +131,15 @@ sub add_network_interfaces() {
|
|||
|
||||
for (my $tunnum=50; $tunnum<=69; $tunnum++)
|
||||
{
|
||||
&uci_add_named_section("network","tun${tunnum}","interface");
|
||||
&uci_set_named_option("network","tun${tunnum}","ifname","tun${tunnum}");
|
||||
&uci_set_named_option("network","tun${tunnum}","proto","none");
|
||||
&uci_add_named_section("network_tun","tun${tunnum}","interface");
|
||||
&uci_set_named_option("network_tun","tun${tunnum}","ifname","tun${tunnum}");
|
||||
&uci_set_named_option("network_tun","tun${tunnum}","proto","none");
|
||||
}
|
||||
&uci_commit("network");
|
||||
&uci_commit("network_tun");
|
||||
&uci_clone("network_tun");
|
||||
# required to support node_setup script
|
||||
system "cat /etc/config.mesh/network_tun >> /etc/config.mesh/network";
|
||||
system "cat /etc/config.mesh/network_tun >> /etc/config/network";
|
||||
}
|
||||
|
||||
#################################
|
||||
|
@ -149,15 +153,29 @@ sub check_freespace()
|
|||
}
|
||||
|
||||
##########################
|
||||
# Config firewall to allow port 5525 on WAN interface - USE UCIFUNC LIB CALLS***********
|
||||
# Config firewall to allow port 5525 on WAN interface
|
||||
##########################
|
||||
sub open_5525_on_wan() {
|
||||
system "uci add firewall rule >/dev/null 2>&1";
|
||||
system "uci set firewall.\@rule[-1].src='wan' >/dev/null 2>&1";
|
||||
system "uci set firewall.\@rule[-1].dest_port='5525' >/dev/null 2>&1";
|
||||
system "uci set firewall.\@rule[-1].proto='tcp' >/dev/null 2>&1";
|
||||
system "uci set firewall.\@rule[-1].target='ACCEPT' >/dev/null 2>&1";
|
||||
system "uci commit firewall >/dev/null 2>&1";
|
||||
#my $rc;
|
||||
#$rc=&uci_add_sectiontype("firewall_tun","rule");
|
||||
#$rc=&uci_set_indexed_option("firewall_tun","rule","0","src","wan");
|
||||
#$rc=&uci_set_indexed_option("firewall_tun","rule","0","dest_port","5525");
|
||||
#$rc=&uci_set_indexed_option("firewall_tun","rule","0","proto","tcp");
|
||||
#$rc=&uci_set_indexed_option("firewall_tun","rule","0","target","ACCEPT");
|
||||
#$rc=&uci_commit("firewall_tun");
|
||||
#$rc=&uci_clone("firewall_tun");
|
||||
|
||||
my $filename = '/etc/config/firewall_tun';
|
||||
open(my $fh, '>', $filename) or die "Could not open file '$filename' $!";
|
||||
print $fh "\nconfig rule\n";
|
||||
print $fh " option src 'wan'\n";
|
||||
print $fh " option dest_port '5525'\n";
|
||||
print $fh " option proto 'tcp'\n";
|
||||
print $fh " option target 'ACCEPT'\n";
|
||||
close $fh;
|
||||
system "cp /etc/config/firewall_tun /etc/config.mesh";
|
||||
system "cat /etc/config.mesh/firewall_tun >> /etc/config.mesh/firewall";
|
||||
system "cat /etc/config.mesh/firewall_tun >> /etc/config/firewall";
|
||||
}
|
||||
|
||||
sub vpn_setup_required()
|
||||
|
@ -215,10 +233,6 @@ sub install_vtun
|
|||
# allow port 5525 for server connections
|
||||
open_5525_on_wan();
|
||||
|
||||
# enable init.d scripts
|
||||
system("chmod +x /etc/init.d/vtundsrv");
|
||||
system("chmod +x /etc/init.d/vtund");
|
||||
|
||||
# create UCI config file
|
||||
system("touch /etc/config/vtun");
|
||||
# create options section
|
||||
|
@ -275,4 +289,4 @@ sub addrtoint { return( unpack( "N", pack( "C4", split( /[.]/,$_[0]))))};
|
|||
sub inttoaddr { return( join( ".", unpack( "C4", pack( "N", $_[0]))))};
|
||||
|
||||
#weird uhttpd/busybox error requires a 1 at the end of this file
|
||||
1
|
||||
1
|
||||
|
|
|
@ -170,6 +170,7 @@ sub uci_add_list_named_option()
|
|||
sub uci_add_named_section()
|
||||
{
|
||||
my ($config,$sname,$stype)=@_;
|
||||
system `touch /etc/config/$config` if (! -f "/etc/config/$config");
|
||||
my $cmd=sprintf('uci set %s.%s=%s',$config,$sname,$stype);
|
||||
#uci set olsrd.tunnelserver=Interface
|
||||
my $res=`$cmd`;
|
||||
|
@ -221,6 +222,7 @@ sub uci_set_named_option()
|
|||
return $rc;
|
||||
}
|
||||
|
||||
## issue with multiple sections added!
|
||||
sub uci_set_indexed_option()
|
||||
{
|
||||
my ($config,$stype,$index,$option,$val)=@_;
|
||||
|
@ -259,6 +261,16 @@ sub uci_revert()
|
|||
return ($rc,$res);
|
||||
}
|
||||
|
||||
sub uci_clone()
|
||||
{
|
||||
my ($config)=@_;
|
||||
# TODO: add protection of overwriting specific templated files in /etc/config.mesh
|
||||
my $cmd=sprintf('cp /etc/config/%s /etc/config.mesh',$config);
|
||||
my $res=`$cmd`;
|
||||
my $rc=$?;
|
||||
return $rc;
|
||||
}
|
||||
|
||||
### UCI Helpers END ###
|
||||
|
||||
#weird uhttpd/busybox error requires a 1 at the end of this file
|
||||
|
|
|
@ -62,8 +62,6 @@ if($parms{button_install})
|
|||
reboot_required() if($config eq "" or -e "/tmp/reboot-required");
|
||||
&vpn_setup_required("vpn") unless(-e "/usr/sbin/vtund" );
|
||||
|
||||
@active_tun=&get_active_tun();
|
||||
|
||||
#################
|
||||
# If RESET, revert the UCI file
|
||||
#################
|
||||
|
@ -197,16 +195,19 @@ if($parms{button_save} and not @cli_err)
|
|||
if (&uci_commit("vtun"))
|
||||
{
|
||||
push(@errors,"Problem committing UCI vtun");
|
||||
system("cp -f /etc/config/vtun /etc/config.mesh");
|
||||
}
|
||||
&uci_clone("vtun");
|
||||
unless($debug == 3)
|
||||
{
|
||||
# Regenerate olsrd files and restart olsrd
|
||||
push(@errors,"Problem restarting olsrd") if system "/etc/init.d/olsrd restart > /dev/null 2>&1";
|
||||
push(@errors,"Problem restaring vtundsrv") if system "/etc/init.d/vtundsrv restart > /dev/null 2>&1";
|
||||
# delay to allow clients to connect and have an accurate "cloud" status
|
||||
sleep 5;
|
||||
}
|
||||
}
|
||||
|
||||
@active_tun=&get_active_tun();
|
||||
|
||||
######################################################################################
|
||||
# generate the page
|
||||
|
@ -214,6 +215,9 @@ if($parms{button_save} and not @cli_err)
|
|||
http_header() unless $debug == 2;
|
||||
html_header("$node setup", 1);
|
||||
print "<body><center>\n";
|
||||
|
||||
alert_banner();
|
||||
|
||||
print "<form id=vpn method=post action=/cgi-bin/vpn enctype='multipart/form-data'>\n" unless $debug == 2;
|
||||
print "<form method=post action=test>\n" if $debug == 2;
|
||||
print "<table width=790>\n";
|
||||
|
@ -378,12 +382,15 @@ sub print_vpn_clients()
|
|||
print "<td> $fullnet";
|
||||
print "<input type=hidden name=client${val}_netip value='$fullnet'/></td>";
|
||||
print "<td align=center> ";
|
||||
print "<img class='tun_client_active_img' src='/connected.png'/>" if (&is_tunnel_active($name,@active_tun) && ($val ne "_add"));
|
||||
print "<img class='tun_client_inactive_img' src='/disconnected.png'/>" if ($val ne "_add");
|
||||
if (&is_tunnel_active($fullnet,@active_tun) && ($val ne "_add")) {
|
||||
print "<img class='tun_client_active_img' src='/connected.png' title='Connected' />";
|
||||
} else {
|
||||
print "<img class='tun_client_inactive_img' src='/disconnected.png' title='Not connected' />";
|
||||
}
|
||||
print "</td>";
|
||||
print "<td><input type=submit name=client_add value=Add title='Add this client'>" if($val eq "_add");
|
||||
print "</td>";
|
||||
print "<td class='tun_client_mailto'><a href='mailto:?subject=AREDN%20Tunnel%20Connection&body=Your%20connection%20details:%0D%0AName:%20$name%0D%0APassword:%20$passwd%0D%0ANetwork:%20$fullnet%0D%0AServer%20address:%20$dns'><img class='tun_client_mailto_img' src='/email.png'/></a></td>" unless($val eq "_add");
|
||||
print "<td class='tun_client_mailto'><a href='mailto:?subject=AREDN%20Tunnel%20Connection&body=Your%20connection%20details:%0D%0AName:%20$name%0D%0APassword:%20$passwd%0D%0ANetwork:%20$fullnet%0D%0AServer%20address:%20$dns'><img class='tun_client_mailto_img' src='/email.png' title='Email details' /></a></td>" unless($val eq "_add");
|
||||
print "</tr>\n";
|
||||
|
||||
# display any errors
|
||||
|
|
|
@ -62,8 +62,6 @@ if($parms{button_install})
|
|||
reboot_required() if($config eq "" or -e "/tmp/reboot-required");
|
||||
&vpn_setup_required("vpnc") unless(-e "/usr/sbin/vtund" );
|
||||
|
||||
@active_tun=&get_active_tun();
|
||||
|
||||
#################
|
||||
# If RESET, revert the UCI file
|
||||
#################
|
||||
|
@ -175,16 +173,18 @@ if($parms{button_save} and not @conn_err)
|
|||
if (&uci_commit("vtun"))
|
||||
{
|
||||
push(@errors,"Problem committing UCI vtun");
|
||||
system("cp -f /etc/config/vtun /etc/config.mesh");
|
||||
}
|
||||
&uci_clone("vtun");
|
||||
unless($debug == 3)
|
||||
{
|
||||
# Regenerate olsrd files and restart olsrd
|
||||
push(@errors,"Problem restarting olsrd") if system "/etc/init.d/olsrd restart > /dev/null 2>&1";
|
||||
push(@errors,"Problem restaring vtund") if system "/etc/init.d/vtund restart > /dev/null 2>&1";
|
||||
sleep 5;
|
||||
}
|
||||
}
|
||||
|
||||
@active_tun=&get_active_tun();
|
||||
|
||||
######################################################################################
|
||||
# generate the page
|
||||
|
@ -193,6 +193,9 @@ http_header() unless $debug == 2;
|
|||
html_header("$node setup", 1);
|
||||
|
||||
print "<body><center>\n";
|
||||
|
||||
alert_banner();
|
||||
|
||||
print "<form method=post action=/cgi-bin/vpnc enctype='multipart/form-data'>\n" unless $debug == 2;
|
||||
print "<form method=post action=test>\n" if $debug == 2;
|
||||
print "<table width=790>\n";
|
||||
|
@ -338,9 +341,9 @@ sub print_vpn_connections()
|
|||
print "</td>";
|
||||
print "<td> ";
|
||||
if (&is_tunnel_active($netip,@active_tun) && ($val ne "_add")) {
|
||||
print "<img class='tun_client_active_img' src='/connected.png'/>";
|
||||
print "<img class='tun_client_active_img' src='/connected.png' title='Connected' />";
|
||||
} else {
|
||||
print "<img class='tun_client_inactive_img' src='/disconnected.png'/>" if ($val ne "_add");
|
||||
print "<img class='tun_client_inactive_img' src='/disconnected.png' title='Not connected' />" if ($val ne "_add");
|
||||
}
|
||||
print "</td>";
|
||||
print "<td> ";
|
||||
|
@ -406,7 +409,7 @@ sub save_connections()
|
|||
|
||||
# generate the VTUN NODE name based on the node name and netip
|
||||
$net=~ s/\./\-/g;
|
||||
my $vtun_node_name="$node-$net";
|
||||
my $vtun_node_name=uc "$node-$net";
|
||||
|
||||
$rc=&uci_set_named_option("vtun","server_$i","clientip",$clientip);
|
||||
push(@cli_err,"Problem saving UCI vtun connection client IP (#$i)") if $rc;
|
||||
|
|
|
@ -277,10 +277,12 @@ In the <strong>WiFi</strong> box there are settings shown as being
|
|||
Active Settings. These settings can be changed without rebooting the node by
|
||||
clicking the <strong>Apply</strong> button, but unless they are saved they
|
||||
will revert to the previously saved values after a reboot.<br> <br>
|
||||
The <strong>Rx Antenna</strong> and <strong>Tx Antenna</strong> settings are
|
||||
named to match either the printed name on the antenna connector or in the
|
||||
case of units that have a built in antenna the names are for units mounted
|
||||
in its normal orientation.
|
||||
The <strong>Rx Antenna</strong> and <strong>Tx Antenna</strong> settings have
|
||||
been removed from current builds. The hardware handles antenna selection
|
||||
automatically in the backend without need for configuration.
|
||||
<br>
|
||||
As always a dummy load on unused RF ports is recommended to keep out physical
|
||||
contaminants and to avoid EMI/RFI interference.
|
||||
</p>
|
||||
<p>
|
||||
The <strong>Distance</strong> setting adjusts the packet retry timer
|
||||
|
@ -342,14 +344,16 @@ covered here.
|
|||
</p>
|
||||
<p>
|
||||
The other option in the WAN box is the <strong>Mesh Gateway</strong>.
|
||||
This is an advanced configuration option.<br>
|
||||
When a node has internet access from either the WAN or LAN, that access is
|
||||
available to the node itself and to any computer connected to the LAN port.
|
||||
When the Mesh Gateway is enabled, this node will advertise to the mesh that it
|
||||
has internet access and will act as a gateway and provide internet access to
|
||||
the rest of the mesh. By default it is disabled, so consider carefully your
|
||||
When the Mesh Gateway is enabled this node will gate(route) traffic from the
|
||||
mesh onto this network and the internet.
|
||||
|
||||
By default it is disabled, so consider carefully your
|
||||
intentions for enabling it. AREDN™ is an FCC Part 97 amateur radio
|
||||
computer network, so be sure that any internet traffic that will be sent over
|
||||
radio will comply with Part 97 rules. If you just want local wireless
|
||||
radio needs to comply with Part 97 rules. If you just want local wireless
|
||||
internet access, consider using a standard Part 15 compliant access point
|
||||
instead of the Mesh Gateway function.
|
||||
</p>
|
||||
|
@ -695,7 +699,7 @@ How to use failsafe mode:
|
|||
<li>use a static IP address of 192.168.1.2 and netmask 255.255.255.0<br>
|
||||
(default gateway and DNS are not necessary)</li>
|
||||
<li>apply power to the node</li>
|
||||
<li>just after the DMZ LED illuminates, hold the reset button until DMZ starts blinking</li>
|
||||
<li>just after the Status 4 LED illuminates, hold the reset button until DMZ starts blinking</li>
|
||||
<li>at a command prompt run "<b>telnet 192.168.1.1</b>"</li>
|
||||
<li>you should now have a prompt that looks like "root@(none)$"</li>
|
||||
<ul><li>if not, you are not in safe mode and something went wrong along the way, so stop here and start over</li></ul>
|
||||
|
|
Loading…
Reference in New Issue