Skip to content

Commit

Permalink
fix mesh issue
Browse files Browse the repository at this point in the history
add sftp support
  • Loading branch information
dragino committed Apr 11, 2015
1 parent 36d96ee commit 6eab0a1
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .config.IoT
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# OpenWrt version: Attitude Adjustment (r42647)
# Tue Feb 24 16:02:57 2015
# Sat Apr 11 19:47:47 2015
#
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_ppc40x is not set
Expand Down Expand Up @@ -2176,7 +2176,7 @@ CONFIG_PACKAGE_kmod-pppox=y
# CONFIG_PACKAGE_kmod-slip is not set
# CONFIG_PACKAGE_kmod-stp is not set
# CONFIG_PACKAGE_kmod-trelay is not set
# CONFIG_PACKAGE_kmod-tun is not set
CONFIG_PACKAGE_kmod-tun=y
# CONFIG_PACKAGE_kmod-wprobe is not set

#
Expand Down Expand Up @@ -3232,7 +3232,7 @@ CONFIG_PACKAGE_avahi-daemon=y
# CONFIG_PACKAGE_openssh-moduli is not set
# CONFIG_PACKAGE_openssh-server is not set
# CONFIG_PACKAGE_openssh-sftp-client is not set
# CONFIG_PACKAGE_openssh-sftp-server is not set
CONFIG_PACKAGE_openssh-sftp-server=y
# CONFIG_PACKAGE_rssh is not set
# CONFIG_PACKAGE_sshtunnel is not set

Expand Down
2 changes: 1 addition & 1 deletion build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SFLAG=
AFLAG=

APP=IoT
VERSION=1.3.5
VERSION=1.3.6
OPENWRT_PATH="ms14"

while getopts 'a:p:v:sh' OPTION
Expand Down
5 changes: 2 additions & 3 deletions files-IoT/etc/config/secn
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config secn 'accesspoint'

config secn 'mesh'
option mesh_enable 'unchecked'
option mpgw 'OFF'

config secn 'dhcp'
option domain 'dragino2'
Expand All @@ -34,16 +35,14 @@ config secn 'dhcp'
option dns2 '8.8.4.4'
option enable 'checked'
option subnet '255.255.255.0'
option gateway '255.255.255.255'
option leaseterm '7200'
option dhcp_auth 'unchecked'
option startip '10.130.1.200'
option endip '10.130.1.240'
option router '10.130.1.1'
option FallbackIP 'enable'

config secn 'mpgw'
option mode 'OFF'

config secn 'http'
option limitip '0'
option enssl '0'
Expand Down
28 changes: 24 additions & 4 deletions files-IoT/etc/init.d/set-mesh-gw-mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
# This script configures batman-adv correctly on startup
# It sets up bridge loop avoidance mode and mesh gateway mode on startup

/usr/sbin/batman-adv restart
# Add the adhoc interface
/usr/sbin/batctl if add wlan0-1

# Enable Bridge Loop Avoidance mode
/usr/sbin/batctl bl 1
sleep 5

# Get the MPGW setting from /etc/config/secn
MPGW=`uci get secn.mpgw.mode`
MPGW=`uci get secn.mesh.mpgw`

# Set up mesh gateway mode
if [ $MPGW = "OFF" ]; then
Expand Down Expand Up @@ -52,6 +53,25 @@ if [ $MPGW = "CLIENT" ]; then
uci commit batman-adv

# Add bat0 to bridge now that it is configured and bl is enabled
brctl addif br-lan bat0
# Check to see if mesh is to be used on WAN side.
WANPORT=`uci get secn.wan.wanport`
ETHWANMODE=`uci get secn.wan.ethwanmode`
if [ $WANPORT = "Mesh" ]; then
brctl addif br-wan bat0
# Force udhcpc lease renewal
if [ $ETHWANMODE = "DHCP" ]; then
kill -SIGUSR1 `cat /var/run/udhcpc-br-wan.pid`
fi
else
brctl addif br-lan bat0
fi

###
# Setup AP Isolation on mesh if reqd, unless it is used for WAN
AP_ISOL=`uci get secn.accesspoint.ap_isol`
if [ $AP_ISOL = "1" ] && [ $WANPORT != "Mesh" ]; then
batctl ap 1
else
batctl ap 0
fi

###
12 changes: 7 additions & 5 deletions files-IoT/usr/bin/config_secn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ OPTION_DNS=`uci get secn.dhcp.dns`
OPTION_DNS2=`uci get secn.dhcp.dns2`
OPTION_SUBNET=`uci get secn.dhcp.subnet`
OPTION_ROUTER=`uci get secn.dhcp.router`
LANGATEWAY=`uci get secn.dhcp.gateway`

uci set dhcp.setup.dhcpleasemax=$MAXLEASES
uci set dhcp.setup.domain=$DOMAIN
Expand Down Expand Up @@ -121,7 +122,8 @@ uci set network.wan.type=''
# Set up for WAN disabled
if [ $WANPORT = "Disable" ]; then
uci set network.lan.ifname='eth0'

uci set network.lan.gateway=$LANGATEWAY

uci set network.wan.ifname=''
uci set network.wan.proto=''
uci set network.wan.ipaddr=''
Expand All @@ -145,7 +147,7 @@ fi
if [ $WANPORT = "Ethernet" ]; then
# Set up for Eth WAN port
uci set network.lan.ifname='eth0' # This is just a dummy
uci set network.lan.gateway='255.255.255.255'
uci set network.lan.gateway=$LANGATEWAY
uci set network.wan.ifname='eth1' # Single Eth port devices
uci set wireless.sta_0.disabled='1'
fi
Expand All @@ -158,7 +160,7 @@ if [ $WANPORT = "Mesh" ]; then
uci set network.wan.type='bridge' # Reqd. See /etc/init.d/set-mesh-gw-mode
MESH_ENABLE='1'
uci set secn.mesh.mesh_enable='1'
uci set network.lan.gateway='255.255.255.255'
uci set network.lan.gateway=$LANGATEWAY

# Disable WiFi Client mode
uci set wireless.sta_0.disabled='1'
Expand All @@ -167,7 +169,7 @@ fi
#### Use WiFi Client mode for Internet Access
if [ $WANPORT = "WiFi" ]; then
uci set network.lan.ifname='eth0'
uci set network.lan.gateway='255.255.255.255'
uci set network.lan.gateway=$LANGATEWAY


# Set up for wlan0 WAN port
Expand Down Expand Up @@ -226,7 +228,7 @@ fi
# Set up for 3G Modem
if [ $WANPORT = "USB-Modem" ]; then
uci set network.lan.ifname='eth0 eth1'
uci set network.lan.gateway='255.255.255.255'
uci set network.lan.gateway=$LANGATEWAY
uci set network.wan.ifname='ppp0'
uci set network.wan.proto='3g'
uci set network.wan.service=$SERVICE
Expand Down
2 changes: 1 addition & 1 deletion package/dragino2/files/usr/lib/lua/dragino/utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ end
--Get USB Modem
--@return USB Manufacture, Vendor ID and Product ID
function getUSBInfo()
local USB_INFO=util.exec('cat /proc/bus/usb/devices | grep -A 1 "P: Vendor"')
local USB_INFO=util.exec('cat /sys/kernel/debug/usb/devices | grep -A 1 "P: Vendor"')
local start = string.find(USB_INFO,"%-%-")
if start == nil then return nil end
u_man=string.match(USB_INFO,"Manufacturer=([%w%s%.%_]+[%w])",start)
Expand Down
4 changes: 4 additions & 0 deletions package/luci-0.11/modules/secn/luasrc/model/cbi/secn/lan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ au.enabled = "checked"
au.disabled = "unchecked"
au.default = au.disable

local gw = s:option(Value, "gateway", "LAN Gateway")
gw.datatype = "ipaddr"
gw.default = "255.255.255.255"

local nm = s:option(Value, "subnet", "Subnet Mask")
nm:depends("enable","checked")
nm:value("255.255.255.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ function mbssid.write(self,section,value)
m.uci:set("wireless","ah_0","bssid",value)
end

s = m:section(NamedSection, "mpgw", "secn", translate("Mesh Gateway"))
local gwmode= s:option(ListValue, "mode", "Gateway Mode")
local gwmode= s:option(ListValue, "mpgw", "Gateway Mode")
gwmode:value("OFF","OFF")
gwmode:value("CLIENT","CLIENT")
gwmode:value("SERVER","SERVER")
Expand Down

0 comments on commit 6eab0a1

Please sign in to comment.