[no ci] Overlay: update init.d script files (#1528)

pull/1529/head
viktorxda 2024-08-20 16:46:46 +02:00 committed by GitHub
parent ca1e3e3b6c
commit 28a8aba338
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 194 additions and 898 deletions

View File

@ -8,6 +8,3 @@
# | | | | |
# * * * * * command to be executed
#
#*/30 * * * * /usr/sbin/openwall
#*/30 * * * * /usr/sbin/telegram
#

View File

@ -2,12 +2,12 @@
DAEMON="syslogd"
PIDFILE="/var/run/$DAEMON.pid"
SYSLOGD_ARGS="-C64 -t"
DAEMON_ARGS="-n -C64 -t"
start() {
printf "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" -- -n $SYSLOGD_ARGS
if [ $? = 0 ]; then
echo -n "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
@ -15,9 +15,9 @@ start() {
}
stop() {
printf "Stopping $DAEMON: "
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? = 0 ]; then
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
@ -27,7 +27,7 @@ stop() {
case "$1" in
start|stop)
"$1"
$1
;;
restart|reload)

View File

@ -1,42 +0,0 @@
#!/bin/sh
DAEMON="rngd"
PIDFILE="/var/run/$DAEMON.pid"
RNGD_ARGS="-r /dev/urandom"
start() {
printf "Starting $DAEMON: "
start-stop-daemon -S -q -x "/usr/sbin/$DAEMON" -- $RNGD_ARGS
if [ $? = 0 ]; then
echo "OK"
else
echo "FAIL"
fi
}
stop() {
printf "Stopping $DAEMON: "
start-stop-daemon -K -q -n "$DAEMON"
if [ $? = 0 ]; then
echo "OK"
else
echo "FAIL"
fi
}
case "$1" in
start|stop)
"$1"
;;
restart|reload)
stop
sleep 1
start
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac

View File

@ -16,4 +16,12 @@ case "$1" in
check_mac
;;
stop)
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac

View File

@ -2,9 +2,7 @@
case "$1" in
start)
echo "Loading modules..."
# load modules from /etc/modules
echo "Loading kernel modules..."
[ -r /etc/modules ] || exit 0
while read module args; do
case "$module" in
@ -12,9 +10,15 @@ case "$1" in
continue
;;
esac
# attempt to load modules
modprobe ${module} ${args} > /dev/null
modprobe "$module" "$args" > /dev/null
done < /etc/modules
;;
stop)
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac

View File

@ -4,6 +4,14 @@ case "$1" in
start)
echo "Starting mdev..."
echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -s
mdev -s
;;
stop)
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac

View File

@ -15,33 +15,37 @@ set_wireless() {
[ -e /sys/class/net/eth0 ] && ifconfig eth0 "${net:-192.168.2.10}"
}
start() {
echo "Starting network..."
ifup lo
if [ -n "$dev" ]; then
set_wireless
else
ifup eth0
fi
}
stop() {
echo "Stopping network..."
ifdown lo
ifdown -f wlan0
ifdown -f usb0
ifdown -f eth1
ifdown -f eth0
}
case "$1" in
start)
echo "Starting network..."
ifup lo
if [ -n "$dev" ]; then
set_wireless
else
ifup eth0
fi
start|stop)
$1
;;
stop)
echo "Stopping network..."
ifdown lo
ifdown -f wlan0
ifdown -f usb0
ifdown -f eth1
ifdown -f eth0
;;
restart)
"$0" stop
"$0" start
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac

View File

@ -2,12 +2,12 @@
DAEMON="ntpd"
PIDFILE="/var/run/$DAEMON.pid"
NTPD_ARGS="-n"
DAEMON_ARGS="-n"
start() {
printf "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $NTPD_ARGS
if [ $? = 0 ]; then
echo -n "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
@ -15,9 +15,9 @@ start() {
}
stop() {
printf "Stopping $DAEMON: "
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? = 0 ]; then
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
@ -27,7 +27,7 @@ stop() {
case "$1" in
start|stop)
"$1"
$1
;;
restart|reload)

View File

@ -2,29 +2,13 @@
DAEMON="dropbear"
PIDFILE="/var/run/$DAEMON.pid"
DROPBEAR_ARGS="-R -B -k -p 22 -K 300"
DAEMON_ARGS="-R -B -k -p 22 -K 300"
start() {
# If /etc/dropbear is a symlink to /var/run/dropbear, and
# - the filesystem is RO (i.e. we can not rm the symlink),
# create the directory pointed to by the symlink.
# - the filesystem is RW (i.e. we can rm the symlink),
# replace the symlink with an actual directory
if [ -L /etc/dropbear -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]; then
if rm -f /etc/dropbear >/dev/null 2>&1; then
mkdir -p /etc/dropbear
else
echo "No persistent location to store SSH host keys. New keys will be"
echo "generated at each boot. Are you sure this is what you want to do?"
mkdir -p "$(readlink /etc/dropbear)"
fi
fi
printf "Starting $DAEMON: "
echo -n "Starting $DAEMON: "
umask 077
start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $DROPBEAR_ARGS
if [ $? = 0 ]; then
start-stop-daemon -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
@ -32,9 +16,10 @@ start() {
}
stop() {
printf "Stopping $DAEMON: "
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? = 0 ]; then
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
@ -43,7 +28,7 @@ stop() {
case "$1" in
start|stop)
"$1"
$1
;;
restart|reload)

View File

@ -2,12 +2,12 @@
DAEMON="crond"
PIDFILE="/var/run/$DAEMON.pid"
CROND_ARGS="-f -c /etc/crontabs"
DAEMON_ARGS="-f -c /etc/crontabs"
start() {
printf "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $CROND_ARGS
if [ $? = 0 ]; then
echo -n "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
@ -15,9 +15,9 @@ start() {
}
stop() {
printf "Stopping $DAEMON: "
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? = 0 ]; then
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
@ -27,7 +27,7 @@ stop() {
case "$1" in
start|stop)
"$1"
$1
;;
restart|reload)

View File

@ -3,6 +3,15 @@
case "$1" in
start)
echo "Loading vendor modules..."
load_"$(ipcinfo -v)" -i
vendor=$(ipcinfo -v)
load_"$vendor" -i
;;
stop)
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac

View File

@ -1,10 +1,18 @@
#!/bin/sh
vtun=$(fw_printenv -n vtun)
case "$1" in
start)
vtun=$(fw_printenv -n vtun)
if [ -n "$vtun" ]; then
tunnel "$vtun"
fi
;;
stop)
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac

View File

@ -10,7 +10,7 @@ stop() {
case "$1" in
start|stop)
"$1"
$1
;;
*)

View File

@ -1,22 +1,9 @@
#!/bin/sh
# Stop all init scripts in /etc/init.d executing them in reversed numerical order.
for i in $(ls -r /etc/init.d/S??*); do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set stop
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i stop
;;
esac

View File

@ -3,26 +3,10 @@ export SENSOR=$(fw_printenv -n sensor)
export UPGRADE=$(fw_printenv -n upgrade)
export TZ=$(cat /etc/TZ)
# Set the firmware creation time as the base system time
/bin/date -s @$(stat -t /etc/os-release | cut -d" " -f12)
# Start all init scripts in /etc/init.d executing them in numerical order.
for i in /etc/init.d/S??*; do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac

View File

@ -29,7 +29,7 @@ null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
::sysinit:/etc/init.d/rcS
# Put a getty on the serial port
console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL
console::respawn:/sbin/getty -L console 0 vt100
# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK

View File

@ -12,11 +12,9 @@
# !: do not create device node
# @|$|*: run@cmd if $ACTION=add, $cmd if $ACTION=remove, *cmd in all cases
#
#
#
mmcblk[0-9] root:disk 660
mmcblk[0-9]p[0-9] root:disk 660 *(/lib/mdev/automount.sh)
#
sd[a-z] root:disk 660
sd[a-z][0-9] root:disk 660 *(/lib/mdev/automount.sh)
#

View File

@ -1,5 +1,3 @@
#
# Level of messages on console
kernel.printk = 3 3 1 3
#
net.core.bpf_jit_enable=1

View File

@ -1,12 +1,10 @@
#
[Interface]
PrivateKey = *
ListenPort = *
#
[Peer]
AllowedIPs = 10.8.0.0/24
Endpoint = *:51820
PersistentKeepalive = 25
PresharedKey = *
PublicKey = *
#

View File

@ -2,13 +2,13 @@
on_exit() {
mountpoint -q /proc && umount /proc
exec /sbin/init $*
exec /sbin/init "$*"
}
trap on_exit 0
trap on_exit EXIT
mount -t proc proc /proc || exit
grep -q overlay /proc/filesystems || exit
mount -t proc proc /proc || exit 1
grep -q overlay /proc/filesystems || exit 1
if ! grep -q 'root=.*nfs\|mmcblk\|ram' /proc/cmdline; then
if grep -q ubifs /proc/cmdline; then
@ -16,34 +16,30 @@ if ! grep -q 'root=.*nfs\|mmcblk\|ram' /proc/cmdline; then
else
mtdblkdev=$(awk -F ':' '/rootfs_data/ {print $1}' /proc/mtd | sed 's/mtd/mtdblock/')
mtdchrdev=$(grep 'rootfs_data' /proc/mtd | cut -d: -f1)
mount -t jffs2 /dev/${mtdblkdev} /overlay
if [ $? -ne 0 ] || { dmesg | grep "jffs2.*: Magic bitmask.*not found" >/dev/null 2>&1; }; then
echo "jffs2 health check error, format required!"
flash_eraseall -j /dev/${mtdchrdev}
echo "Done! Remounting..."
mount -t jffs2 /dev/${mtdblkdev} /overlay || mount -t tmpfs tmpfs /overlay || exit
if ! cat /proc/mounts | grep ${mtdblkdev}; then
echo "--------------------------------"
echo "Crash - your flash in the trash!"
echo "--------------------------------"
if ! mount -t jffs2 /dev/$mtdblkdev /overlay || dmesg | grep -q "jffs2.*: Magic bitmask.*not found"; then
echo "Formatting flash..."
grep -q 'nand' /proc/cmdline || jffs2="-j"
flash_eraseall $jffs2 /dev/$mtdchrdev
if ! mount -t jffs2 /dev/$mtdblkdev /overlay && ! mount -t tmpfs tmpfs /overlay; then
echo "Cannot mount overlay."
exit 1
fi
fi
fi
if grep -q overlayfs /proc/filesystems; then
mount -t overlayfs overlayfs -o lowerdir=/,upperdir=/overlay,ro /mnt || {
if ! mount -t overlayfs overlayfs -o lowerdir=/,upperdir=/overlay,ro /mnt; then
umount /overlay
exit
}
exit 1
fi
else
overlay_rootdir=/overlay/root
overlay_workdir=/overlay/work
mkdir -p ${overlay_rootdir} ${overlay_workdir}
mount -t overlay overlay -o lowerdir=/,upperdir=${overlay_rootdir},workdir=${overlay_workdir} /mnt || {
mkdir -p $overlay_rootdir $overlay_workdir
if ! mount -t overlay overlay -o lowerdir=/,upperdir=$overlay_rootdir,workdir=$overlay_workdir /mnt; then
umount /overlay
exit
}
exit 1
fi
fi
pivot_root /mnt /mnt/rom

View File

@ -3,7 +3,7 @@
# OpenIPC.org | 2024
#
scr_version=1.0.40
scr_version=1.0.41
args=" $@"
@ -106,7 +106,6 @@ free_resources() {
sleep 1
/etc/init.d/S60crond stop
/etc/init.d/S49ntpd stop
/etc/init.d/S21rngd stop
/etc/init.d/S02klogd stop
/etc/init.d/S01syslogd stop
sleep 1

View File

@ -1,25 +0,0 @@
diff --git a/miscutils/seedrng.c b/miscutils/seedrng.c
index 967741dc7..7cc855141 100644
--- a/miscutils/seedrng.c
+++ b/miscutils/seedrng.c
@@ -45,6 +45,20 @@
#include <sys/random.h>
#include <sys/file.h>
+/* Fix up glibc <= 2.24 not having getrandom() */
+#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 24
+#include <sys/syscall.h>
+# define getrandom(...) bb_getrandom(__VA_ARGS__)
+static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
+{
+# if defined(__NR_getrandom)
+ return syscall(__NR_getrandom, buffer, length, flags);
+# else
+ return ENOSYS;
+# endif
+}
+#endif
+
#ifndef GRND_INSECURE
#define GRND_INSECURE 0x0004 /* Apparently some headers don't ship with this yet. */
#endif

View File

@ -1,353 +0,0 @@
diff -urn -- a/miscutils/rng_fips.h b/miscutils/rng_fips.h
--- a/miscutils/rng_fips.h 1970-01-01 00:00:00.000000000 +0000
+++ b/miscutils/rng_fips.h 2008-08-17 13:28:27.000000000 +0000
@@ -0,0 +1,152 @@
+/* vi: set sw=4 ts=4: */
+/* rng_fips.h
+ *
+ * Ported to busybox by Malek Degachi
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#ifndef _RNG_FIPS_H
+#define _RNG_FIPS_H
+
+#include "libbb.h"
+
+/**********************************************
+ * FIPS part
+ *********************************************/
+
+/* Size of a FIPS test buffer, do not change this */
+#define FIPS_RNG_BUFFER_SIZE 2500
+
+/* Context for running FIPS tests */
+typedef struct {
+ int poker[16];
+ int runs[12];
+ int ones;
+ int rlength;
+ int current_bit;
+ int last_bit;
+ int longrun;
+ unsigned int last32;
+} fips_ctx_t;
+
+/*
+ * Return values for fips_run_rng_test. These values are OR'ed together
+ * for all tests that failed.
+ */
+#define FIPS_RNG_MONOBIT 0x0001 /* FIPS 140-2 2001-10-10 monobit */
+#define FIPS_RNG_POKER 0x0002 /* FIPS 140-2 2001-10-10 poker */
+#define FIPS_RNG_RUNS 0x0004 /* FIPS 140-2 2001-10-10 runs */
+#define FIPS_RNG_LONGRUN 0x0008 /* FIPS 140-2 2001-10-10 long run */
+#define FIPS_RNG_CONTINUOUS_RUN 0x0010 /* FIPS 140-2 continuous run */
+
+/*
+ * fips_test_store - store 8 bits of entropy in FIPS
+ * internal test data pool
+ */
+static void fips_test_store(fips_ctx_t *ctx, unsigned int rng_data)
+{
+ int j;
+
+ ctx->poker[rng_data >> 4]++;
+ ctx->poker[rng_data & 15]++;
+
+ /* Note in the loop below rlength is always one less than the actual
+ run length. This makes things easier. */
+ for (j = 7; j >= 0; j--) {
+ ctx->ones += ctx->current_bit = ((rng_data >> j) & 1);
+ if (ctx->current_bit != ctx->last_bit) {
+ /* If runlength is 1-6 count it in correct bucket. 0's go in
+ runs[0-5] 1's go in runs[6-11] hence the 6*current_bit below */
+ if (ctx->rlength < 5) {
+ ctx->runs[ctx->rlength +
+ (6 * ctx->current_bit)]++;
+ } else {
+ ctx->runs[5 + (6 * ctx->current_bit)]++;
+ }
+
+ /* Check if we just failed longrun test */
+ if (ctx->rlength >= 25)
+ ctx->longrun = 1;
+ ctx->rlength = 0;
+ /* flip the current run type */
+ ctx->last_bit = ctx->current_bit;
+ } else {
+ ctx->rlength++;
+ }
+ }
+}
+
+static int fips_run_rng_test(fips_ctx_t *ctx, const void *buf)
+{
+ int i, j;
+ int rng_test = 0;
+ unsigned char *rngdatabuf;
+
+ if (!ctx) return -1;
+ if (!buf) return -1;
+ rngdatabuf = (unsigned char *)buf;
+
+ for (i=0; i<FIPS_RNG_BUFFER_SIZE; i += 4) {
+ int new32 = rngdatabuf[i] |
+ ( rngdatabuf[i+1] << 8 ) |
+ ( rngdatabuf[i+2] << 16 ) |
+ ( rngdatabuf[i+3] << 24 );
+ if (new32 == ctx->last32) rng_test |= FIPS_RNG_CONTINUOUS_RUN;
+ ctx->last32 = new32;
+ fips_test_store(ctx, rngdatabuf[i]);
+ fips_test_store(ctx, rngdatabuf[i+1]);
+ fips_test_store(ctx, rngdatabuf[i+2]);
+ fips_test_store(ctx, rngdatabuf[i+3]);
+ }
+
+ /* add in the last (possibly incomplete) run */
+ if (ctx->rlength < 5)
+ ctx->runs[ctx->rlength + (6 * ctx->current_bit)]++;
+ else {
+ ctx->runs[5 + (6 * ctx->current_bit)]++;
+ if (ctx->rlength >= 25)
+ rng_test |= FIPS_RNG_LONGRUN;
+ }
+
+ if (ctx->longrun) {
+ rng_test |= FIPS_RNG_LONGRUN;
+ ctx->longrun = 0;
+ }
+
+ /* Ones test */
+ if ((ctx->ones >= 10275) || (ctx->ones <= 9725))
+ rng_test |= FIPS_RNG_MONOBIT;
+ /* Poker calcs */
+ for (i = 0, j = 0; i < 16; i++)
+ j += ctx->poker[i] * ctx->poker[i];
+ /* 16/5000*1563176-5000 = 2.1632 */
+ /* 16/5000*1576928-5000 = 46.1696 */
+ if ((j > 1576928) || (j < 1563176))
+ rng_test |= FIPS_RNG_POKER;
+
+ if ((ctx->runs[0] < 2315) || (ctx->runs[0] > 2685) ||
+ (ctx->runs[1] < 1114) || (ctx->runs[1] > 1386) ||
+ (ctx->runs[2] < 527) || (ctx->runs[2] > 723) ||
+ (ctx->runs[3] < 240) || (ctx->runs[3] > 384) ||
+ (ctx->runs[4] < 103) || (ctx->runs[4] > 209) ||
+ (ctx->runs[5] < 103) || (ctx->runs[5] > 209) ||
+ (ctx->runs[6] < 2315) || (ctx->runs[6] > 2685) ||
+ (ctx->runs[7] < 1114) || (ctx->runs[7] > 1386) ||
+ (ctx->runs[8] < 527) || (ctx->runs[8] > 723) ||
+ (ctx->runs[9] < 240) || (ctx->runs[9] > 384) ||
+ (ctx->runs[10] < 103) || (ctx->runs[10] > 209) ||
+ (ctx->runs[11] < 103) || (ctx->runs[11] > 209)) {
+ rng_test |= FIPS_RNG_RUNS;
+ }
+
+ /* finally, clear out FIPS variables for start of next run */
+ memset(ctx->poker, 0, sizeof (ctx->poker));
+ memset(ctx->runs, 0, sizeof (ctx->runs));
+ ctx->ones = 0;
+ ctx->rlength = -1;
+ ctx->current_bit = 0;
+
+ return rng_test;
+}
+#endif /* _RNG_FIPS_H */
diff -urn -- a/miscutils/rngd.c b/miscutils/rngd.c
--- a/miscutils/rngd.c 2021-04-14 10:06:59.131381906 +0300
+++ b/miscutils/rngd.c 2021-04-14 10:04:59.785401231 +0300
@@ -0,0 +1,193 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * rngd implementation for busybox
+ *
+ * Ported to busybox by Malek Degachi
+ *
+ * Licensed under GPLv2 or later, see file License in this tarball for details.
+ *
+ */
+
+//config:config RNGD
+//config: bool "rngd"
+//config: default n
+//config: help
+//config: Hardware random number generation daemon.
+//config:config FEATURE_RNGD_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default n
+//config: depends on RNGD && GETOPT_LONG
+//config: help
+//config: Support long options for the rngd applet.
+
+//applet:IF_RNGD(APPLET(rngd, BB_DIR_USR_SBIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_RNGD) += rngd.o
+
+//usage:#define rngd_trivial_usage
+//usage: "[-bf] [-o random file] [-r rng file] [-s step] [-t nnn] [-W n]"
+//usage:#define rngd_full_usage "\n\n"
+//usage: "Check and feed random data from hardware device to kernel entropy pool.\n"
+//usage: "\nOptions:"
+//usage: "\n -b,--background Become a daemon (default)"
+//usage: "\n -f,--foreground Do not fork and become a daemon"
+//usage: "\n -o,--rng-device=file Kernel device used for random number output"
+//usage: "\n (default: /dev/random)"
+//usage: "\n -r,--random-step=nnn Kernel device used for random number input"
+//usage: "\n (default: /dev/hw_random)"
+//usage: "\n -s,--random-step=nnn Number of bytes written to random-device at a time"
+//usage: "\n (default: 64)"
+//usage: "\n -t,--timeout=nnn Interval written to random-device when the entropy"
+//usage: "\n pool is full, in seconds (default: 60)"
+//usage: "\n -W,--fill-watermark=n Do not stop feeding entropy to random-device until"
+//usage: "\n at least n bits of entropy are available in the"
+//usage: "\n pool (default: 2048), 0 <= n <= 4096"
+
+
+#include "libbb.h"
+#include "rng_fips.h"
+#include <syslog.h>
+
+#ifndef __u32
+typedef unsigned int __u32;
+#endif
+#include <linux/random.h> /* struct rand_pool_info, RNDADDENTROPY and RNDGETENTCNT */
+
+enum {
+ RNG_b = (1 << 0),
+ RNG_f = (1 << 1),
+ RNG_o = (1 << 2),
+ RNG_r = (1 << 3),
+ RNG_s = (1 << 4),
+ RNG_t = (1 << 5),
+ RNG_W = (1 << 6),
+};
+
+static void random_add_entropy(int random_fd, void *buf, size_t size)
+{
+ struct rand_pool_info *entropy;
+
+ entropy = xmalloc(sizeof(struct rand_pool_info) + size);
+
+ entropy->entropy_count = size * 8;
+ entropy->buf_size = size;
+ memcpy(entropy->buf, buf, size);
+
+ ioctl_or_perror_and_die(random_fd, RNDADDENTROPY, entropy, "RNDADDENTROPY failed: %s\n",
+ strerror(errno));
+}
+
+static void random_sleep(int random_fd, double timeout, unsigned fill_watermark)
+{
+ int ent_count;
+ struct pollfd pfd[1];
+
+ pfd[0].fd = random_fd;
+ pfd[0].events = POLLOUT;
+
+ ioctl_or_perror_and_die(random_fd, RNDGETENTCNT, &ent_count, "RNDGETENTCNT failed: %s\n",
+ strerror(errno));
+ if (ent_count < fill_watermark) return;
+
+ safe_poll(pfd, 1, 1000.0 * timeout);
+}
+
+/* Initialize entropy source */
+static int discard_initial_data(int rng_fd)
+{
+ /* Trash 32 bits of what is probably stale (non-random)
+ * initial state from the RNG. For Intel's, 8 bits would
+ * be enough, but since AMD's generates 32 bits at a time...
+ *
+ * The kernel drivers should be doing this at device powerup,
+ * but at least up to 2.4.24, it doesn't. */
+ unsigned char tempbuf[4];
+
+ xread(rng_fd, tempbuf, sizeof tempbuf);
+
+ /* Return 32 bits of bootstrap data */
+ xread(rng_fd, tempbuf, sizeof tempbuf);
+
+ return tempbuf[0] | (tempbuf[1] << 8) |
+ (tempbuf[2] << 16) | (tempbuf[3] << 24);
+}
+
+
+#if ENABLE_FEATURE_RNGD_LONG_OPTIONS
+static const char rngd_longopts[] ALIGN1 =
+ "background\0" No_argument "b"
+ "foreground\0" No_argument "f"
+ "random-device\0" Required_argument "o"
+ "rng-device\0" Required_argument "r"
+ "random-step\0" Required_argument "s"
+ "timeout\0" Required_argument "t"
+ "fill-watermark\0" Required_argument "W"
+ ;
+#endif
+
+int rngd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int rngd_main(int argc UNUSED_PARAM, char **argv)
+{
+ const char *random_name = "/dev/random";
+ const char *rng_name = "/dev/hw_random";
+ int random_step = 64;
+ unsigned fill_watermark;
+ double poll_timeout = 60;
+
+ const char *watermark = "2048";
+ static int rng_fd;
+ static int random_fd;
+
+ unsigned char buf[FIPS_RNG_BUFFER_SIZE];
+ unsigned char *p;
+ int fips;
+ fips_ctx_t *fipsctx;
+
+#if ENABLE_FEATURE_RNGD_LONG_OPTIONS
+ applet_long_options = rngd_longopts;
+#endif
+
+
+ getopt32(argv, "bfo:r:s:t:W:", &random_name, &rng_name, &random_step, &poll_timeout, &watermark);
+ argv += optind;
+
+ fill_watermark = xatou_range(watermark, 0, 4096);
+
+ /* Init entropy source, and open hardware RNG device */
+ rng_fd = xopen(rng_name, O_RDONLY);
+
+ /* Bootstrap FIPS tests */
+ fipsctx = (fips_ctx_t *) xzalloc(sizeof(fips_ctx_t));
+ fipsctx->rlength = -1;
+ fipsctx->last32 = discard_initial_data(rng_fd);
+
+ /* Init entropy sink and open random device */
+ random_fd = xopen(random_name, O_RDWR);
+
+ if (!(option_mask32 & RNG_f)) { /* no -f */
+ bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
+ openlog(applet_name, LOG_PID, LOG_DAEMON);
+ logmode = LOGMODE_SYSLOG;
+ }
+
+ write_pidfile("/var/run/rngd.pid");
+ for (;;) {
+ xread(rng_fd, buf, sizeof buf);
+
+ fips = fips_run_rng_test(fipsctx, buf);
+
+ if (fips) {
+ bb_info_msg("failed fips test");
+ sleep(1);
+ continue;
+ }
+
+ for (p = buf; p + random_step <= &buf[sizeof buf]; p += random_step) {
+ random_add_entropy(random_fd, p, random_step);
+ random_sleep(random_fd, poll_timeout ? : -1.0, fill_watermark);
+ }
+ }
+
+ return EXIT_SUCCESS;
+}
+

View File

@ -2,45 +2,40 @@
DAEMON="baresip"
PIDFILE="/var/run/$DAEMON.pid"
DAEMON_ARGS="-f /etc/baresip"
start() {
printf 'Starting %s: ' "$DAEMON"
echo -n "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS
status=$?
if [ "$status" -eq 0 ]; then
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
case "$1" in
start|stop|restart)
"$1";;
reload)
restart;;
start|stop)
$1
;;
restart|reload)
stop
sleep 1
start
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1

View File

@ -3,6 +3,7 @@
# datalink
#
################################################################################
DATALINK_VERSION =
DATALINK_SITE =
DATALINK_LICENSE = GPL-2.0
@ -14,19 +15,15 @@ endif
define DATALINK_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc
cp $(DATALINK_PKGDIR)/files/datalink.conf $(TARGET_DIR)/etc
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc
cp $(DATALINK_PKGDIR)/files/telemetry_$(DATALINK_UNIT).conf $(TARGET_DIR)/etc/telemetry.conf
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc $(DATALINK_PKGDIR)/files/datalink.conf
$(INSTALL) -m 644 $(DATALINK_PKGDIR)/files/telemetry_$(DATALINK_UNIT).conf $(TARGET_DIR)/etc/telemetry.conf
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
cp $(DATALINK_PKGDIR)/files/S98datalink $(TARGET_DIR)/etc/init.d
$(INSTALL) -m 755 -t $(TARGET_DIR)/etc/init.d $(DATALINK_PKGDIR)/files/S98datalink
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
cp $(DATALINK_PKGDIR)/files/telemetry $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
cp $(DATALINK_PKGDIR)/files/tweaksys $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(DATALINK_PKGDIR)/files/telemetry
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(DATALINK_PKGDIR)/files/tweaksys
endef
$(eval $(generic-package))

View File

@ -12,7 +12,7 @@ basic() {
fw_setenv bootdelay 0
# free uart for telemetry
sed -i "s!console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL!#console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL!g" /etc/inittab
sed -i "s!console::respawn:/sbin/getty -L console 0 vt100!#console::respawn:/sbin/getty -L console 0 vt100!g" /etc/inittab
# tune socket buffer
echo "net.core.rmem_default=512000" >> /etc/sysctl.conf
@ -43,9 +43,6 @@ hisi_goke() {
streamer() {
if [ -f /usr/bin/majestic ]; then
# digital image stabilization
#cli -s .isp.dis true
cli -s .isp.slowShutter disabled
cli -s .image.contrast 50
cli -s .image.luminance 50
@ -70,7 +67,6 @@ streamer() {
cli -s .hls.enabled false
cli -s .netip.enabled false
cli -s .jpeg.enabled false
cli -s .outgoing.enabled true
cli -s .outgoing.server udp://127.0.0.1:5600
fi
@ -97,7 +93,7 @@ sigmastar() {
cli -s .isp.sensorConfig /etc/sensors/imx415_fpv.bin
cli -s .isp.exposure 5
cli -s .video0.codec h265
cli -s .video0.size 1920x1080
cli -s .video0.size 1920x1080
cli -s .video0.fps 60
cli -s .video0.rcMode cbr
cli -s .jpeg.enabled false

View File

@ -20,15 +20,8 @@ define LINUX_PATCHER_CONFIG_ATHEROS
endef
endif
# ifeq ($(OPENIPC_VARIANT),rubyfpv)
# define LINUX_PATCHER_CONFIG_TIMERS
# $(call KCONFIG_ENABLE_OPT,CONFIG_HZ_1000)
# endef
# endif
define LINUX_PATCHER_LINUX_CONFIG_FIXUPS
$(LINUX_PATCHER_CONFIG_ATHEROS)
# $(LINUX_PATCHER_CONFIG_TIMERS)
endef
$(eval $(generic-package))

View File

@ -1,17 +1,16 @@
#!/bin/sh
export SENSOR=$(fw_printenv -n sensor)
DAEMON="majestic"
PIDFILE="/var/run/$DAEMON.pid"
MAJESTIC_ARGS="-s"
DAEMON_ARGS="-s"
start() {
ulimit -c unlimited
echo "/tmp/majestic.core" > /proc/sys/kernel/core_pattern
echo "/tmp/core.majestic" > /proc/sys/kernel/core_pattern
printf "Starting $DAEMON: "
start-stop-daemon -b -S -m -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" -- $MAJESTIC_ARGS
if [ $? = 0 ]; then
echo -n "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
@ -19,9 +18,9 @@ start() {
}
stop() {
printf "Stopping $DAEMON: "
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? = 0 ]; then
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
@ -31,17 +30,17 @@ stop() {
case "$1" in
start|stop)
"$1"
$1
;;
restart)
restart|reload)
stop
sleep 3
start
;;
*)
echo "Usage: $0 {start|stop|debug|restart}"
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac

View File

@ -1,22 +1,22 @@
#!/bin/sh
#
# Start MAVlink Router
#
case "$1" in
start)
if grep -q telemetry=true /etc/datalink.conf; then
echo "Starting mavlink router daemon..."
/usr/bin/mavlink-routerd &
else
echo "Telemetry service disabled in datalink.conf..."
fi
;;
stop)
echo "Stopping mavlink router daemon..."
kill -9 $(pidof mavlink-routerd)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
start)
if grep -q telemetry=true /etc/datalink.conf; then
echo "Starting mavlink router daemon..."
mavlink-routerd &
else
echo "Telemetry service disabled in datalink.conf..."
fi
;;
stop)
echo "Stopping mavlink router daemon..."
killall -q mavlink-routerd
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@ -2,12 +2,12 @@
DAEMON="mini_snmpd"
PIDFILE="/var/run/$DAEMON.pid"
SNMPD_ARGS="-n -4 -c openipc -D OpenIPC -C https://openipc.org -L Internet"
DAEMON_ARGS="-n -4 -c openipc -D OpenIPC -C https://openipc.org -L Internet"
start() {
printf "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" -- $SNMPD_ARGS
if [ $? = 0 ]; then
echo -n "Starting $DAEMON: "
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS
if [ $? -eq 0 ]; then
echo "OK"
else
echo "FAIL"
@ -15,9 +15,10 @@ start() {
}
stop() {
printf "Stopping $DAEMON: "
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? = 0 ]; then
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
@ -26,7 +27,7 @@ stop() {
case "$1" in
start|stop)
"$1"
$1
;;
restart|reload)

View File

@ -1,187 +0,0 @@
#!/bin/sh
chip=$(ipcinfo -c)
family=$(ipcinfo -f)
vendor=$(ipcinfo -v)
if [ ! "$chip" = "hi3536dv100" ]; then
sensor=$(ipcinfo -s)
fi
basic() {
# set boot delay
fw_setenv bootdelay 0
# free uart for telemetry
sed -i "s!console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL!#console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL!g" /etc/inittab
# tune socket buffer
echo "net.core.rmem_default=512000" >> /etc/sysctl.conf
}
prefix=${family}
hisi_goke() {
if [ "$vendor" = "hisilicon" ]; then
prefix="open"
fi
# remove unneeded modules
sed -i "s!insmod ${prefix}_rgn.ko!#insmod ${prefix}_rgn.ko!g" "/usr/bin/load_${vendor}"
sed -i "s!insmod ${prefix}_jpege.ko!#insmod ${prefix}_jpege.ko!g" "/usr/bin/load_${vendor}"
sed -i "s!insmod ${prefix}_ive.ko save_power=0!#insmod ${prefix}_ive.ko save_power=0!g" "/usr/bin/load_${vendor}"
sed -i "s!insmod ${prefix}_aio.ko!#insmod ${prefix}_aio.ko!g" "/usr/bin/load_${vendor}"
sed -i "s!insmod ${prefix}_ai.ko!#insmod ${prefix}_ai.ko!g" "/usr/bin/load_${vendor}"
sed -i "s!insmod ${prefix}_ao.ko!#insmod ${prefix}_ao.ko!g" "/usr/bin/load_${vendor}"
sed -i "s!insmod ${prefix}_aenc.ko!#insmod ${prefix}_aenc.ko!g" "/usr/bin/load_${vendor}"
sed -i "s!insmod ${prefix}_adec.ko!#insmod ${prefix}_adec.ko!g" "/usr/bin/load_${vendor}"
sed -i "s!insmod ${prefix}_acodec.ko!#insmod ${prefix}_acodec.ko!g" "/usr/bin/load_${vendor}"
# change fps 25 -> 30
sed -i "s!Isp_FrameRate=25!Isp_FrameRate=30!g" /etc/sensors/imx307_i2c_2l_1080p.ini
sed -i "s!Isp_FrameRate=25!Isp_FrameRate=30!g" /etc/sensors/smtsec_imx307_i2c_4l_1080p.ini
sed -i "s!Isp_FrameRate=25!Isp_FrameRate=30!g" /etc/sensors/imx335_i2c_4M.ini
}
sigmastar() {
sed -i "s!serial=/dev/ttyAMA0!serial=/dev/ttyS0!g" /etc/telemetry.conf
sed -i "s!Device = /dev/ttyAMA0!Device = /dev/ttyS0!g" /etc/mavlink.conf
}
majestic_generic() {
# digital image stabilization
#cli -s .isp.dis true
cli -s .isp.slowShutter disabled
cli -s .image.contrast 50
cli -s .image.luminance 50
cli -s .video0.size 1920x1080
cli -s .video0.fps 30
cli -s .video0.bitrate 5120
cli -s .video0.codec h264
cli -s .video0.rcMode cbr
cli -s .video0.gopSize 1.5
# lowdelay support only imx307 sensor
if [ "$sensor" = "imx307" ]; then
cli -s .isp.lowDelay true
#cli -s .video0.sliceUnits 4
fi
if [ "$sensor" = "imx335" ]; then
cli -s .isp.drc 350
cli -s .isp.sensorConfig /etc/sensors/imx335_i2c_4M.ini
fi
cli -s .hls.enabled false
cli -s .netip.enabled false
cli -s .jpeg.enabled false
}
majestic_sigmastar() {
cli -s .isp.sensorConfig /etc/sensors/imx415_fpv.bin
cli -s .isp.exposure 10
cli -s .video0.codec h265
cli -s .video0.size 1920x1080
cli -s .video0.fps 60
cli -s .video0.rcMode cbr
cli -s .jpeg.enabled false
}
streamer() {
if [ -f /usr/bin/majestic ]; then
if [ "$vendor" = "sigmastar" ]; then
majestic_sigmastar
else
majestic_generic
fi
# outgoing rtp stream
cli -s .outgoing.enabled true
cli -s .outgoing.server udp://127.0.0.1:5600
fi
if [ -f /usr/bin/venc ]; then
if [ "$sensor" = "imx335" ]; then
sed -i "s!version=200_imx307B!version=300_imx335B!g" /etc/venc.conf
sed -i "s!size=720p!size=1292x972!g" /etc/venc.conf
fi
fi
}
finish() {
# complete tweaks and add flag
fw_setenv wlandev
touch /etc/system.ok
echo "Restart system to apply fpv changes..."
reboot
}
case "$1" in
gk7205v200 | gk7205v210 | hi3516ev200)
echo "Preparing system tweaks for ${chip}..."
# set custom config
if [ "$chip" = "gk7205v200" ] && [ "$sensor" = "imx307" ]; then
echo "switch to custom sensor config"
#cli -s .isp.sensorConfig /etc/sensors/60fps/720p_imx307_i2c_2l.ini
fi
# fix osmem in bootargs
bootargs=$(fw_printenv -n bootargs)
if echo "$bootargs" | grep -q "32M"; then
newbootargs="mem=\${osmem} "$(echo "$bootargs" | cut -d " " -f2-)
fw_setenv bootargs "$newbootargs"
fw_setenv osmem 40M
fi
# remove unneeded scripts
rm -f /etc/init.d/S60crond /etc/init.d/S49ntpd /etc/init.d/S02klogd
basic
hisi_goke
streamer
finish
;;
gk7205v300 | hi3516ev300)
echo "Preparing system tweaks for $chip..."
# increase osmem
mem=$(fw_printenv -n osmem) && [ "$mem" = "32M" ] && fw_setenv osmem 64M && set_allocator cma || echo "Memory allocated for the system:" "$mem"
# set sensor config for smtsec board
if [ "$chip" = "gk7205v300" ] && [ "$sensor" = "imx307" ]; then
cli -s .isp.sensorConfig /etc/sensors/smtsec_imx307_i2c_4l_1080p.ini
fi
basic
hisi_goke
streamer
finish
;;
t31l | t31n | t31x | t31zx)
echo "Preparing system tweaks for $chip..."
basic
streamer
finish
;;
hi3536dv100)
echo "Preparing system tweaks for $chip..."
finish
;;
ssc33x)
echo "Preparing system tweaks for $chip..."
basic
sigmastar
streamer
finish
;;
*)
echo "Usage: $0 {gk7205v200|gk7205v210|gk7205v300|hi3516ev200|hi3516ev300|t31l|t31n|t31x|t31zx|hi3536dv100|ssc33x}"
exit 1
;;
esac

View File

@ -25,7 +25,7 @@ define RUBYFPV_INSTALL_TARGET_CMDS
$(INSTALL) -m 644 -t $(TARGET_DIR)/usr/sbin $(RUBYFPV_PKGDIR)/files/version_ruby_base.txt
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(RUBYFPV_PKGDIR)/files/tweaksys
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(DATALINK_PKGDIR)/files/tweaksys
$(INSTALL) -m 755 -d $(TARGET_DIR)/root/ruby/licenses
$(INSTALL) -m 644 -t $(TARGET_DIR)/root/ruby/licenses $(@D)/licenses/*

View File

@ -1,61 +0,0 @@
#! /bin/sh
#
# submitted by Morgon Kanter
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/vtund
CONFFILE=/etc/vtund-start.conf
PIDPREFIX=/var/run/vtund
test -f $DAEMON || exit 0
case "$1" in
start)
# find all the defined tunnels
egrep -v '^[:space:]*(#.*)?$' $CONFFILE | while true;
do
read i
# no more lines available? done, then.
if [ $? != 0 ] ; then break; fi
SARGS=`echo $i|sed -ne 's/--server--\s*/-s -P /p'`;
if [ -n "$SARGS" ];
then
echo "Starting vtund server."
start-stop-daemon --start --exec $DAEMON --pidfile $PIDPREFIX.pid -- $SARGS;
else
# split args into host and rest
HOST=`echo $i|cut -f 1 -d " "`;
TARGET=`echo $i|cut -f 2 -d " "`;
echo "Starting vtund client $HOST to $TARGET.";
start-stop-daemon --start --exec $DAEMON --pidfile $PIDPREFIX.$HOST.pid -- $i;
fi
done
;;
stop)
echo "Stopping vtund.";
for i in $PIDPREFIX*;
do
start-stop-daemon --stop --pidfile $i;
rm -f $i;
done
;;
reload|force-reload)
echo "Reloading vtund.";
for i in $PIDPREFIX*;
do
start-stop-daemon --stop --signal 1 --pidfile $i;
done
;;
restart)
$0 stop
sleep 1;
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@ -1,28 +1,28 @@
#!/bin/sh
#
# Start zerotier-one
#
config_file=/etc/webui/zerotier.conf
[ ! -f "$config_file" ] && echo "Config file not found." && exit 2
source $config_file
if [ -e "$config_file" ]; then
. $config_file
fi
case "$1" in
start)
if [ "true" = "$zerotier_enabled" ]; then
if [ "$zerotier_enabled" = "true" ]; then
echo "Starting zerotier-one daemon..."
/sbin/modprobe tun
/usr/sbin/zerotier-one -d
modprobe tun
zerotier-one -d
else
echo "Zerotier-One service is disabled in ${config_file}."
exit 3
exit 1
fi
;;
stop)
echo "Stopping zerotier-one daemon..."
kill -9 $(pidof zerotier-one)
/sbin/rmmod -w tun
killall -q zerotier-one
rmmod -w tun
;;
*)
echo "Usage: $0 {start|stop}"
exit 1