From cfeadeb3bd9e098a95f4e960e5c6fac5f52a800a Mon Sep 17 00:00:00 2001 From: garywill Date: Sun, 27 Jul 2025 12:52:59 +0800 Subject: [PATCH 1/5] start/exit time in temp config dir --- lnxrouter | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lnxrouter b/lnxrouter index fecd7eb..f5c48b0 100755 --- a/lnxrouter +++ b/lnxrouter @@ -1366,6 +1366,7 @@ clean_iptables() { cleanup() { trap "" SIGINT SIGUSR1 SIGUSR2 EXIT SIGTERM + touch "$CONFDIR/exit_$(date +"%Y-%m-%d_%H:%M:%S.%6N")" echo echo echo "Doing cleanup.. " @@ -1412,6 +1413,8 @@ init_conf_dirs() { #echo "Config dir: $CONFDIR" echo $$ > "$CONFDIR/pid" + touch "$CONFDIR/begin_$(date +"%Y-%m-%d_%H:%M:%S.%6N")" + COMMON_CONFDIR="$TMPDIR/lnxrouter_common.conf" # config dir for all instances mkdir -p "$COMMON_CONFDIR" } From 3900871977124abc888dc9950d4acef4ec8cc547 Mon Sep 17 00:00:00 2001 From: garywill Date: Sun, 27 Jul 2025 12:55:28 +0800 Subject: [PATCH 2/5] add --keep-confdir --- lnxrouter | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lnxrouter b/lnxrouter index f5c48b0..2dcbcaa 100755 --- a/lnxrouter +++ b/lnxrouter @@ -126,6 +126,8 @@ Options: Instance managing: --daemon Run in background + --keep-confdir Don't delete the temporary config dir after exit + -l, --list-running Show running instances --lc, --list-clients List clients of an instance. Or list neighbors of @@ -232,6 +234,7 @@ define_global_variables(){ NM_PID= FIREWALLD_PID= TMP_FIREWALLD_ZONE= + KEEP_CONFDIR= } parse_user_options(){ @@ -508,6 +511,10 @@ parse_user_options(){ LIST_CLIENTS_ID="$1" shift ;; + --keep-confdir) + shift + KEEP_CONFDIR=1 + ;; *) echo "Invalid parameter: $1" 1>&2 @@ -1330,7 +1337,7 @@ _cleanup() { ip addr flush "${SUBNET_IFACE}" - rm -rf "$CONFDIR" + [[ ! "$KEEP_CONFDIR" -eq 1 ]] && rm -rf "$CONFDIR" ip link set down dev "${SUBNET_IFACE}" From 01c99f8e4c22b7c386114c9847ea7b45a398ba7c Mon Sep 17 00:00:00 2001 From: garywill Date: Sun, 27 Jul 2025 13:03:47 +0800 Subject: [PATCH 3/5] show config dir at start --- lnxrouter | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lnxrouter b/lnxrouter index 2dcbcaa..f63272d 100755 --- a/lnxrouter +++ b/lnxrouter @@ -1416,14 +1416,14 @@ init_conf_dirs() { cd "$TMPDIR" || die "Couldn't change directory to linux-router's temporary path" CONFDIR="$(mktemp -d $TMPDIR/lnxrouter.${TARGET_IFACE}.conf.XXXXXX)" || die "Instance couldn't make config dir" # config dir for one instance - chmod 755 "$CONFDIR" - #echo "Config dir: $CONFDIR" + echo "Config dir: $CONFDIR" + chmod 755 "$CONFDIR" || die "chmod config dir failed" echo $$ > "$CONFDIR/pid" touch "$CONFDIR/begin_$(date +"%Y-%m-%d_%H:%M:%S.%6N")" COMMON_CONFDIR="$TMPDIR/lnxrouter_common.conf" # config dir for all instances - mkdir -p "$COMMON_CONFDIR" + mkdir -p "$COMMON_CONFDIR" || die "Failed creating common config dir" } #== functions to deal with running instances From 9df05cd81a7b9c7658769d6fdce61836cf2e7207 Mon Sep 17 00:00:00 2001 From: garywill Date: Sun, 27 Jul 2025 13:42:50 +0800 Subject: [PATCH 4/5] dependency: crda ,regdb --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 17d0335..1b2135b 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,9 @@ I'm currently not packaging for any distro. If you do, open a PR and add the lin - iptables (or nftables with `iptables-nft` translation linked) - WiFi hotspot dependencies - hostapd - - iw - - iwconfig (you only need this if 'iw' can not recognize your adapter) + - iw (or iwconfig, when iw can not recognize adapter) - haveged (optional) + - crda and wireless-regdb (optional) From 94949ba40bc3425dac48d26812d79ef0be1cdd16 Mon Sep 17 00:00:00 2001 From: garywill Date: Sun, 27 Jul 2025 14:12:21 +0800 Subject: [PATCH 5/5] show freq band and channel --- lnxrouter | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lnxrouter b/lnxrouter index f63272d..7aa8e77 100755 --- a/lnxrouter +++ b/lnxrouter @@ -1867,6 +1867,8 @@ prepare_wifi_interface() { CHANNEL=36 fi fi + + echo "Freq band: $FREQ_BAND GHz Channel: $CHANNEL" } decide_subnet_interface() {