mirror of
https://github.com/srlabs/blue-merle.git
synced 2025-01-03 03:20:52 -05:00
functions: Do not automatically restart the wifi on RESET_BSSIDS
Instead of restarting the service we have the service started *after* our modification to its configuration. This makes it slightly more inconvenient to reset the WiFi BSSIDs while the device is booted but that capability can be restored and made better through an executable, say, /usr/bin/reset-wifi-bssids or something. We also split the volatile client MACs into its own service to have a bit of a clearer separation of duties. This will allow us to eventually split the package more easily into sub-packages with finer-grained control.
This commit is contained in:
parent
1c3c5f79e1
commit
8b4d371c9f
@ -2,15 +2,21 @@
|
|||||||
|
|
||||||
. /lib/blue-merle/functions.sh
|
. /lib/blue-merle/functions.sh
|
||||||
|
|
||||||
START=81
|
# We intend to be started before the first network-related service is started.
|
||||||
|
# According to https://openwrt.org/docs/techref/initscripts, /etc/rc.d/ determines
|
||||||
|
# the order of the services to be started (or stopped). The lower the number,
|
||||||
|
# the earlier the service is started.
|
||||||
|
# We observe "repeater" having the value 15. "network" 20. We certainly want to ahead of those.
|
||||||
|
START=14
|
||||||
STOP=99
|
STOP=99
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
/lib/blue-merle/mac-wipe.sh
|
/lib/blue-merle/mac-wipe.sh
|
||||||
RESET_BSSIDS
|
RESET_BSSIDS
|
||||||
}
|
RANDOMIZE_MACADDR
|
||||||
|
}
|
||||||
stop() {
|
|
||||||
|
stop() {
|
||||||
/lib/blue-merle/mac-wipe.sh
|
/lib/blue-merle/mac-wipe.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
files/etc/init.d/volatile-client-macs
Normal file
19
files/etc/init.d/volatile-client-macs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
# MAC addresses of connected clients are stored in a sqlite database.
|
||||||
|
# Having the database seems to be necessary for the device to be working properly.
|
||||||
|
# We intent to have the device store the database in RAM rather than on flash.
|
||||||
|
# We replace the directory with a memory-backed tmpfs which is as volatile as we can make it.
|
||||||
|
|
||||||
|
# We want to run ahead of "gl-tertf" which, currently, has a prioprity of 20.
|
||||||
|
START=19
|
||||||
|
STOP=99
|
||||||
|
|
||||||
|
start() {
|
||||||
|
/lib/blue-merle/mac-wipe.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
shred /etc/oui-tertf/client.db || rm -f /etc/oui-tertf/client.db
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,16 @@ RESET_BSSIDS () {
|
|||||||
uci set wireless.@wifi-iface[1].macaddr=`UNICAST_MAC_GEN`
|
uci set wireless.@wifi-iface[1].macaddr=`UNICAST_MAC_GEN`
|
||||||
uci set wireless.@wifi-iface[0].macaddr=`UNICAST_MAC_GEN`
|
uci set wireless.@wifi-iface[0].macaddr=`UNICAST_MAC_GEN`
|
||||||
uci commit wireless
|
uci commit wireless
|
||||||
wifi # need to reset wifi for changes to apply
|
# you need to reset wifi for changes to apply, i.e. executing "wifi"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# This chaneges the MAC address clients see when connecting to the WiFi spawned by the device.
|
||||||
|
# You can check with "arp -a" that your endpoint, e.g. your laptop, sees a different MAC after a reboot of the Mudi.
|
||||||
|
RANDOMIZE_MACADDR () {
|
||||||
|
uci set network.@device[1].macaddr=`UNICAST_MAC_GEN`
|
||||||
|
uci commit network
|
||||||
|
# You need to restart the network, i.e. /etc/init.d/network restart
|
||||||
}
|
}
|
||||||
|
|
||||||
READ_IMEI () {
|
READ_IMEI () {
|
||||||
|
@ -15,6 +15,11 @@ mount -t tmpfs / /etc/oui-tertf
|
|||||||
cp -a "$tmpdir/client.db" /etc/oui-tertf/client.db
|
cp -a "$tmpdir/client.db" /etc/oui-tertf/client.db
|
||||||
umount -t tmpfs -l "$tmpdir"
|
umount -t tmpfs -l "$tmpdir"
|
||||||
|
|
||||||
logger -p notice -t blue-merle-mac-wipe "Restarting tertf..."
|
|
||||||
/etc/init.d/gl-tertf start
|
if [ $1 == "restart" ]; then
|
||||||
logger -p notice -t blue-merle-mac-wipe "... Finished"
|
logger -p notice -t blue-merle-mac-wipe "Restarting tertf..."
|
||||||
|
/etc/init.d/gl-tertf start
|
||||||
|
logger -p notice -t blue-merle-mac-wipe "... Finished"
|
||||||
|
else
|
||||||
|
echo You will need to restart the gl-tertf service, i.e. /etc/init.d/gl-tertf restart
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user