4 Commits

Author SHA1 Message Date
garywill
200b6d4451 show distro and kernel 2022-01-05 20:07:15 +08:00
garywill
2ea1dfd5b7 Merge branch 'master' 2022-01-05 20:02:39 +08:00
garywill
204756cffb more logs 2022-01-03 20:30:11 +08:00
garywill
e1ccfac40c add some delay and logging 2021-12-09 11:07:50 +08:00

View File

@@ -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