Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
e635453d
Commit
e635453d
authored
8 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Bridging the mesh to a wifi hotspot
parent
689c236d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/freedombone-mesh-batman
+87
-25
87 additions, 25 deletions
src/freedombone-mesh-batman
src/freedombone-utils-wifi
+0
-12
0 additions, 12 deletions
src/freedombone-utils-wifi
src/freedombone-wifi
+1
-1
1 addition, 1 deletion
src/freedombone-wifi
with
88 additions
and
38 deletions
src/freedombone-mesh-batman
+
87
−
25
View file @
e635453d
...
...
@@ -30,6 +30,35 @@
PROJECT_NAME
=
'freedombone'
COMPLETION_FILE
=
/root/
${
PROJECT_NAME
}
-completed
.txt
HOTSPOT_PASSPHRASE
=
'mesh'
function
count_wlan
{
# counts the number of wlan devices
ctr
=
0
for
i
in
$(
seq
0
-1
10
)
;
do
if
grep
-q
"wlan
${
i
}
"
/proc/net/dev
;
then
ctr
=
$((
ctr
+
1
))
fi
done
echo
$ctr
}
function
update_wifi_adaptors
{
IFACE
=
IFACE_SECONDARY
=
for
i
in
$(
seq
10
-1
0
)
;
do
if
grep
-q
"wlan
${
i
}
"
/proc/net/dev
;
then
if
[
!
$IFACE
]
;
then
IFACE
=
"wlan
${
i
}
"
else
IFACE_SECONDARY
=
"wlan
${
i
}
"
return
fi
fi
done
}
if
[[
$1
==
"start"
]]
;
then
# install avahi
...
...
@@ -68,33 +97,22 @@ TAHOELAFS_PORT=50213
# Ethernet bridge definition (bridged to bat0)
BRIDGE
=
br-mesh
IFACE
=
'wlan0'
BRIDGE_HOTSPOT
=
br-hotspot
IFACE
=
IFACE_SECONDARY
=
EIFACE
=
eth0
WLAN_ADAPTORS
=
$(
count_wlan
)
if
[[
$IFACE
==
"wlan0"
]]
;
then
if
grep
-q
"wlan5"
/proc/net/dev
;
then
IFACE
=
wlan5
fi
fi
if
[[
$IFACE
==
"wlan0"
]]
;
then
if
grep
-q
"wlan4"
/proc/net/dev
;
then
IFACE
=
wlan4
fi
if
[
$WLAN_ADAPTORS
-eq
0
]
;
then
echo
$'No wlan adaptors found'
exit
0
fi
if
[[
$IFACE
==
"wlan0"
]]
;
then
if
grep
-q
"wlan3"
/proc/net/dev
;
then
IFACE
=
wlan3
fi
fi
if
[[
$IFACE
==
"wlan0"
]]
;
then
if
grep
-q
"wlan2"
/proc/net/dev
;
then
IFACE
=
wlan2
fi
fi
if
[[
$IFACE
==
"wlan0"
]]
;
then
if
grep
-q
"wlan1"
/proc/net/dev
;
then
IFACE
=
wlan1
fi
update_wifi_adaptors
if
[
!
$IFACE
]
;
then
echo
$'No wlan adaptor'
exit
0
fi
if
[
-e
/etc/default/batctl
]
;
then
...
...
@@ -126,6 +144,11 @@ function stop {
brctl delbr
$BRIDGE
ifconfig
$EIFACE
down
-promisc
fi
if
[
$IFACE_SECONDARY
]
;
then
brctl delif
$BRIDGE_HOTSPOT
bat0
ifconfig
$BRIDGE_HOTSPOT
down
||
true
brctl delbr
$BRIDGE_HOTSPOT
fi
avahi-autoipd
-k
$BRIDGE
avahi-autoipd
-k
$IFACE
...
...
@@ -220,7 +243,6 @@ function start {
modprobe batman-adv
batctl
if
add
$IFACE
ifconfig
$IFACE
up
avahi-autoipd
--force-bind
--daemonize
--wait
$BRIDGE
avahi-autoipd
--force-bind
--daemonize
--wait
$IFACE
ifconfig bat0 up promisc
...
...
@@ -242,6 +264,46 @@ function start {
ifconfig
$EIFACE
0.0.0.0
ifconfig
$EIFACE
up promisc
ifconfig
$BRIDGE
up
avahi-autoipd
--force-bind
--daemonize
--wait
$BRIDGE
fi
if
[
$IFACE_SECONDARY
]
;
then
if
[[
$IFACE
!=
$IFACE_SECONDARY
]]
;
then
if
[
-d
/etc/hostapd
]
;
then
# bridge between mesh and wifi hotspot for mobile
HOTSPOT_NAME
=
$"
${
WIFI_SSID
}
-hotspot"
ifconfig
$IFACE_SECONDARY
down
iwconfig
$IFACE_SECONDARY
mode managed essid
$HOTSPOT_NAME
channel
${
CHANNEL
}
iwconfig
$IFACE_SECONDARY
ap
$CELLID
brctl addbr
$BRIDGE_HOTSPOT
brctl addif
$BRIDGE_HOTSPOT
bat0
brctl addif
$BRIDGE_HOTSPOT
$IFACE_SECONDARY
ifconfig bat0 0.0.0.0
ifconfig
$IFACE_SECONDARY
0.0.0.0
sed
-i
's|#DAEMON_CONF=.*|DAEMON_CONF="/etc/hostapd/hostapd.conf"|g'
/etc/default/hostapd
echo
"interface=
$IFACE_SECONDARY
"
>
/etc/hostapd/hostapd.conf
echo
"bridge=
${
BRIDGE_HOTSPOT
}
"
>>
/etc/hostapd/hostapd.conf
echo
'driver=nl80211'
>>
/etc/hostapd/hostapd.conf
echo
"country_code=UK"
>>
/etc/hostapd/hostapd.conf
echo
"ssid=
$HOTSPOT_NAME
"
>>
/etc/hostapd/hostapd.conf
echo
'hw_mode=g'
>>
/etc/hostapd/hostapd.conf
echo
"channel=
${
CHANNEL
}
"
>>
/etc/hostapd/hostapd.conf
echo
'wpa=2'
>>
/etc/hostapd/hostapd.conf
echo
"wpa_passphrase=
$HOTSPOT_PASSPHRASE
"
>>
/etc/hostapd/hostapd.conf
echo
'wpa_key_mgmt=WPA-PSK'
>>
/etc/hostapd/hostapd.conf
echo
'wpa_pairwise=TKIP'
>>
/etc/hostapd/hostapd.conf
echo
'rsn_pairwise=CCMP'
>>
/etc/hostapd/hostapd.conf
echo
'auth_algs=1'
>>
/etc/hostapd/hostapd.conf
echo
'macaddr_acl=0'
>>
/etc/hostapd/hostapd.conf
ifconfig
$IFACE_SECONDARY
up promisc
ifconfig
$BRIDGE_HOTSPOT
up
avahi-autoipd
--force-bind
--daemonize
--wait
$BRIDGE_HOTSPOT
fi
fi
fi
iptables
-A
INPUT
-p
icmp
--icmp-type
echo-request
-j
ACCEPT
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-utils-wifi
+
0
−
12
View file @
e635453d
...
...
@@ -39,18 +39,6 @@ WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
# repo for atheros AR9271 wifi driver
ATHEROS_WIFI_REPO
=
"https://github.com/qca/open-ath9k-htc-firmware.git"
function
count_wlan
{
# counts the number of wlan devices
ctr
=
0
for
i
in
$(
seq
0 10
)
;
do
if
grep
-q
"wlan
${
i
}
"
/proc/net/dev
;
then
ctr
=
$((
ctr
+
1
))
fi
done
echo
$ctr
}
function
setup_wifi
{
if
[[
$SYSTEM_TYPE
==
"
$VARIANT_MESH
"
]]
;
then
return
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-wifi
+
1
−
1
View file @
e635453d
...
...
@@ -110,7 +110,7 @@ function hotspot_on {
echo
'rsn_pairwise=CCMP'
>>
/etc/hostapd/hostapd.conf
echo
''
>>
/etc/hostapd/hostapd.conf
echo
'## Shared Key Authentication ##'
echo
'auth_algs=1'
echo
'auth_algs=1'
>>
/etc/hostapd/hostapd.conf
echo
''
>>
/etc/hostapd/hostapd.conf
echo
'## Accept all MAC address ###'
>>
/etc/hostapd/hostapd.conf
echo
'macaddr_acl=0'
>>
/etc/hostapd/hostapd.conf
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment