Compare commits
9 Commits
448a9b5dc3
...
fb49d2e22a
Author | SHA1 | Date |
---|---|---|
|
fb49d2e22a | |
|
c6a1557ba3 | |
|
94949ba40b | |
|
e34c91ba18 | |
|
60ce7d7e2e | |
|
9df05cd81a | |
|
01c99f8e4c | |
|
3900871977 | |
|
cfeadeb3bd |
|
@ -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)
|
- iptables (or nftables with `iptables-nft` translation linked)
|
||||||
- WiFi hotspot dependencies
|
- WiFi hotspot dependencies
|
||||||
- hostapd
|
- hostapd
|
||||||
- iw
|
- iw (or iwconfig, when iw can not recognize adapter)
|
||||||
- iwconfig (you only need this if 'iw' can not recognize your adapter)
|
|
||||||
- haveged (optional)
|
- haveged (optional)
|
||||||
|
- crda and wireless-regdb (optional)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
26
lnxrouter
26
lnxrouter
|
@ -140,6 +140,8 @@ Options:
|
||||||
|
|
||||||
Instance managing:
|
Instance managing:
|
||||||
--daemon Run in background
|
--daemon Run in background
|
||||||
|
--keep-confdir Don't delete the temporary config dir after exit
|
||||||
|
|
||||||
-l, --list-running Show running instances
|
-l, --list-running Show running instances
|
||||||
--lc, --list-clients <id|interface>
|
--lc, --list-clients <id|interface>
|
||||||
List clients of an instance. Or list neighbors of
|
List clients of an instance. Or list neighbors of
|
||||||
|
@ -251,6 +253,7 @@ define_global_variables(){
|
||||||
NM_PID=
|
NM_PID=
|
||||||
FIREWALLD_PID=
|
FIREWALLD_PID=
|
||||||
TMP_FIREWALLD_ZONE=
|
TMP_FIREWALLD_ZONE=
|
||||||
|
KEEP_CONFDIR=
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_user_options(){
|
parse_user_options(){
|
||||||
|
@ -550,6 +553,10 @@ parse_user_options(){
|
||||||
LIST_CLIENTS_ID="$1"
|
LIST_CLIENTS_ID="$1"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--keep-confdir)
|
||||||
|
shift
|
||||||
|
KEEP_CONFDIR=1
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Invalid parameter: $1" 1>&2
|
echo "Invalid parameter: $1" 1>&2
|
||||||
|
@ -670,13 +677,13 @@ can_transmit_to_channel() {
|
||||||
if [[ $FREQ_BAND == "2.4" ]]; then
|
if [[ $FREQ_BAND == "2.4" ]]; then
|
||||||
CHANNEL_FREQ_FILTER="(24)"
|
CHANNEL_FREQ_FILTER="(24)"
|
||||||
elif [[ $FREQ_BAND -eq 5 ]]; then
|
elif [[ $FREQ_BAND -eq 5 ]]; then
|
||||||
CHANNEL_FREQ_FILTER="(5[0-8])"
|
CHANNEL_FREQ_FILTER="(5[1-8])"
|
||||||
elif [[ $FREQ_BAND -eq 6 ]]; then
|
elif [[ $FREQ_BAND -eq 6 ]]; then
|
||||||
CHANNEL_FREQ_FILTER="((59)|(6[0-9])|(70))"
|
CHANNEL_FREQ_FILTER="((59)|(6[0-9])|(7[0-1]))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $USE_IWCONFIG -eq 0 ]]; then
|
if [[ $USE_IWCONFIG -eq 0 ]]; then
|
||||||
CHANNEL_INFO=$(get_adapter_info "${IFACE}" | grep -E " ${CHANNEL_FREQ_FILTER}[0-9]+(\.[0-9]+){0,1} MHz \[${CHANNEL_NUM}\]")
|
CHANNEL_INFO=$(get_adapter_info "${IFACE}" | grep -E " ${CHANNEL_FREQ_FILTER}[0-9]{2}(\.[0-9]+){0,1} MHz \[${CHANNEL_NUM}\]")
|
||||||
[[ -z "${CHANNEL_INFO}" ]] && return 1
|
[[ -z "${CHANNEL_INFO}" ]] && return 1
|
||||||
[[ "${CHANNEL_INFO}" == *no\ IR* ]] && return 2
|
[[ "${CHANNEL_INFO}" == *no\ IR* ]] && return 2
|
||||||
[[ "${CHANNEL_INFO}" == *disabled* ]] && return 3
|
[[ "${CHANNEL_INFO}" == *disabled* ]] && return 3
|
||||||
|
@ -1379,7 +1386,7 @@ _cleanup() {
|
||||||
|
|
||||||
ip addr flush "${SUBNET_IFACE}"
|
ip addr flush "${SUBNET_IFACE}"
|
||||||
|
|
||||||
rm -rf "$CONFDIR"
|
[[ ! "$KEEP_CONFDIR" -eq 1 ]] && rm -rf "$CONFDIR"
|
||||||
|
|
||||||
ip link set down dev "${SUBNET_IFACE}"
|
ip link set down dev "${SUBNET_IFACE}"
|
||||||
|
|
||||||
|
@ -1415,6 +1422,7 @@ clean_iptables() {
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
trap "" SIGINT SIGUSR1 SIGUSR2 EXIT SIGTERM
|
trap "" SIGINT SIGUSR1 SIGUSR2 EXIT SIGTERM
|
||||||
|
touch "$CONFDIR/exit_$(date +"%Y-%m-%d_%H:%M:%S.%6N")"
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
echo "Doing cleanup.. "
|
echo "Doing cleanup.. "
|
||||||
|
@ -1457,12 +1465,14 @@ init_conf_dirs() {
|
||||||
cd "$TMPDIR" || die "Couldn't change directory to linux-router's temporary path"
|
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
|
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"
|
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
|
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
|
#== functions to deal with running instances
|
||||||
|
@ -1906,6 +1916,8 @@ prepare_wifi_interface() {
|
||||||
CHANNEL=36
|
CHANNEL=36
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Freq band: $FREQ_BAND GHz Channel: $CHANNEL"
|
||||||
}
|
}
|
||||||
|
|
||||||
decide_subnet_interface() {
|
decide_subnet_interface() {
|
||||||
|
|
Loading…
Reference in New Issue