mirror of
https://github.com/garywill/linux-router.git
synced 2025-12-29 10:18:28 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
200b6d4451 | ||
|
|
2ea1dfd5b7 | ||
|
|
204756cffb | ||
|
|
e1ccfac40c |
65
lnxrouter
65
lnxrouter
@@ -1614,6 +1614,10 @@ decide_ip_addresses() {
|
||||
}
|
||||
|
||||
prepare_wifi_interface() {
|
||||
|
||||
sleep 1
|
||||
echo; echo; echo;
|
||||
echo "Trying to set power_save off ..."
|
||||
if [[ $USE_IWCONFIG -eq 0 ]]; then
|
||||
iw dev ${WIFI_IFACE} set power_save off
|
||||
fi
|
||||
@@ -1636,7 +1640,9 @@ prepare_wifi_interface() {
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
sleep 6
|
||||
echo; echo; echo;
|
||||
echo "Creating a virtual WiFi interface... "
|
||||
VWIFI_IFACE=$(alloc_new_vface_name)
|
||||
if iw dev ${WIFI_IFACE} interface add ${VWIFI_IFACE} type __ap; then
|
||||
@@ -1951,6 +1957,8 @@ phead
|
||||
phead2
|
||||
echo
|
||||
|
||||
echo " ============ In dev branch for issue #12 ==========="
|
||||
|
||||
echo "PID: $$"
|
||||
|
||||
TARGET_IFACE="$(decide_target_interface)" || exit 1 # judge wired (-i CONN_IFACE) or wireless hotspot (--ap $WIFI_IFACE)
|
||||
@@ -1974,10 +1982,33 @@ init_trap
|
||||
|
||||
init_conf_dirs # CONFDIR , COMMON_CONFDIR . make dir
|
||||
|
||||
echo -e "\nDistro:"
|
||||
cat /etc/os-release
|
||||
|
||||
echo -e "\nKernel:"
|
||||
uname -a
|
||||
echo
|
||||
|
||||
echo "setting NM log level: nmcli general logging level TRACE domains ALL"
|
||||
nmcli general logging level TRACE domains ALL
|
||||
|
||||
echo "Logging journalctl -f"
|
||||
journalctl -f &
|
||||
echo $! > $CONFDIR/journalctl.pid
|
||||
|
||||
echo "Logging dmesg -W"
|
||||
dmesg -W &
|
||||
echo $! > $CONFDIR/dmesg.pid
|
||||
|
||||
echo "Logging wpa_supplicant.log"
|
||||
tail -f /var/log/wpa_supplicant.log &
|
||||
echo $! > $CONFDIR/wpa_supplicant_log.pid
|
||||
|
||||
[[ $WIFI_IFACE ]] && prepare_wifi_interface # this will create virtual ap interface (if needed) and set VWIFI_IFACE and AP_IFACE (if success)
|
||||
|
||||
SUBNET_IFACE="$(decide_subnet_interface)" # SUBNET_IFACE can be TARGET_IFACE (wired) or AP_IFACE (ap) .this is after prepare_wifi_interface()
|
||||
echo "$SUBNET_IFACE" > "$CONFDIR/subn_iface"
|
||||
ip addr show dev ${SUBNET_IFACE}
|
||||
|
||||
# if virtual wifi interface, will be destroyed, so only need to save status when not
|
||||
[[ -z $VWIFI_IFACE ]] && backup_interface_status
|
||||
@@ -1997,6 +2028,10 @@ fi
|
||||
#===================================================
|
||||
#===================================================
|
||||
|
||||
sleep 1
|
||||
echo; echo; echo;
|
||||
ip addr show dev ${SUBNET_IFACE}
|
||||
echo "Trying to set NM unmanage ..."
|
||||
# set interface unmanaged by networkManager
|
||||
if [[ $NM_RUNNING -eq 1 ]] && nm_knows $TARGET_IFACE; then # if nm knows target iface, should know subnet iface too. but need to wait until nm finds subnet iface (waiting code is in nm_set_unmanaged()
|
||||
nm_set_unmanaged ${SUBNET_IFACE} # will write NM_UNM_LIST
|
||||
@@ -2005,19 +2040,47 @@ fi
|
||||
[[ $NO_DNSMASQ -eq 0 ]] && write_dnsmasq_conf
|
||||
#===========================
|
||||
|
||||
|
||||
sleep 1
|
||||
echo; echo; echo;
|
||||
ip addr show dev ${SUBNET_IFACE}
|
||||
echo "Trying to set ${SUBNET_IFACE} down ..."
|
||||
# initialize subnet interface
|
||||
# take subnet interface down first
|
||||
ip link set down dev ${SUBNET_IFACE} || die "Failed setting ${SUBNET_IFACE} down"
|
||||
|
||||
sleep 1
|
||||
echo; echo; echo;
|
||||
ip addr show dev ${SUBNET_IFACE}
|
||||
echo "Trying to flush ${SUBNET_IFACE} ..."
|
||||
# flush old IPs of subnet interface
|
||||
ip addr flush ${SUBNET_IFACE} || die "Failed flush ${SUBNET_IFACE} IP"
|
||||
|
||||
sleep 1
|
||||
echo; echo; echo;
|
||||
ip addr show dev ${SUBNET_IFACE}
|
||||
dealwith_mac # setting MAC should be after setting NM unmanaged
|
||||
|
||||
sleep 1
|
||||
echo; echo; echo;
|
||||
ip addr show dev ${SUBNET_IFACE}
|
||||
echo "Trying to check and do rfkill unblock ..."
|
||||
[[ $WIFI_IFACE ]] && check_rfkill_unblock_wifi
|
||||
|
||||
sleep 1
|
||||
echo; echo; echo;
|
||||
ip addr show dev ${SUBNET_IFACE}
|
||||
echo "Trying to bring interface ${SUBNET_IFACE} up ..."
|
||||
# bring subnet interface up
|
||||
ip link set up dev ${SUBNET_IFACE} || die "Failed bringing ${SUBNET_IFACE} up"
|
||||
|
||||
sleep 1
|
||||
echo; echo; echo;
|
||||
echo "Finished test. Exiting ..."
|
||||
clean_exit
|
||||
exit
|
||||
|
||||
|
||||
# hostapd , haveged
|
||||
[[ $WIFI_IFACE ]] && run_wifi_ap_processes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user