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
a5d2b6a6
Commit
a5d2b6a6
authored
7 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Tidying the batman script
parent
0e314866
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-mesh-batman
+9
-14
9 additions, 14 deletions
src/freedombone-mesh-batman
with
9 additions
and
14 deletions
src/freedombone-mesh-batman
+
9
−
14
View file @
a5d2b6a6
...
...
@@ -205,7 +205,6 @@ function assign_peer_address {
fi
echo
-n
"
${
octet
}
"
done
echo
''
}
function
start
{
...
...
@@ -230,7 +229,9 @@ function start {
ifconfig
$IFACE
down
ifconfig
$IFACE
mtu 1532
ifconfig
$IFACE
hw ether
$(
assign_peer_address
)
peeraddr
=
$(
assign_peer_address
)
ifconfig
$IFACE
hw ether
$peeraddr
echo
$"
$IFACE
assigned MAC address
$peeraddr
"
iwconfig
$IFACE
enc off
iwconfig
$IFACE
mode ad-hoc essid
$WIFI_SSID
channel
$CHANNEL
sleep
1
...
...
@@ -242,17 +243,8 @@ function start {
avahi-autoipd
--force-bind
--daemonize
--wait
$IFACE
ifconfig bat0 up promisc
#Use persistent HWAddr
ether_new
=
$(
ifconfig eth0 |
grep
HWaddr |
sed
-e
"s/.*HWaddr //"
)
if
[
!
-f
/var/lib/mesh-node/bat0
]
;
then
mkdir
/var/lib/mesh-node
echo
"
${
ether_new
}
"
>
/var/lib/mesh-node/bat0
else
ether
=
$(
cat
/var/lib/mesh-node/bat0
)
ifconfig bat0 hw ether
${
ether
}
fi
if
[
"
$EIFACE
"
]
;
then
echo
$'Trying ethernet bridge to the internet'
brctl addbr
$BRIDGE
brctl addif
$BRIDGE
bat0
brctl addif
$BRIDGE
$EIFACE
...
...
@@ -261,6 +253,7 @@ function start {
ifconfig
$EIFACE
up promisc
ifconfig
$BRIDGE
up
dhclient
$BRIDGE
echo
$'End of ethernet bridge'
fi
hotspot_enabled
=
...
...
@@ -271,7 +264,9 @@ function start {
HOTSPOT_NAME
=
$"
${
WIFI_SSID
}
-hotspot"
ifconfig
$IFACE_SECONDARY
down
ifconfig
$IFACE_SECONDARY
mtu 1500
ifconfig
$IFACE_SECONDARY
hw ether
$(
assign_peer_address
)
peeraddr
=
$(
assign_peer_address
)
ifconfig
$IFACE_SECONDARY
hw ether
$peeraddr
echo
$"Secondary wifi adaptor
$IFACE_SECONDARY
assigned to MAC address
$peeraddr
"
iwconfig
$IFACE_SECONDARY
enc open
iwconfig
$IFACE_SECONDARY
mode managed essid
$HOTSPOT_NAME
channel
${
HOTSPOT_CHANNEL
}
iwconfig
$IFACE_SECONDARY
ap
$CELLID
...
...
@@ -338,7 +333,7 @@ function start {
iptables
-A
INPUT
-p
tcp
--dport
8942
-j
ACCEPT
iptables
-A
INPUT
-p
udp
--dport
8942
-j
ACCEPT
iptables
-t
nat
-A
POSTROUTING
-o
$EIFACE
-j
MASQUERADE
iptables
-t
nat
-A
POSTROUTING
-s
10.8.0.0/24
-o
$EIFACE
-j
MASQUERADE
iptables
-A
FORWARD
-i
$EIFACE
-o
$IFACE
-j
ACCEPT
-m
state
--state
RELATED,ESTABLISHED
iptables
-A
FORWARD
-i
$IFACE
-o
$EIFACE
-j
ACCEPT
...
...
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