lnxrouter for openSUSE users (tested on openSUSE tumbleweed)

This commit is contained in:
Gabriel Evan 2021-07-01 19:09:49 +07:00
parent e5fc9efe48
commit 55ff550cd5
1 changed files with 14 additions and 14 deletions

View File

@ -1685,55 +1685,55 @@ dealwith_mac() {
} }
write_hostapd_conf() { write_hostapd_conf() {
cat <<- EOF > "$CONFDIR/hostapd.conf" cat <<- EOF > "/etc/hostapd.conf"
beacon_int=100 beacon_int=100
ssid=${SSID} ssid=${SSID}
interface=${AP_IFACE} interface=${AP_IFACE}
driver=${DRIVER} driver=${DRIVER}
channel=${CHANNEL} channel=${CHANNEL}
ctrl_interface=$CONFDIR/hostapd_ctrl #ctrl_interface=$CONFDIR/hostapd_ctrl
ctrl_interface_group=0 #ctrl_interface_group=0
ignore_broadcast_ssid=$HIDDEN ignore_broadcast_ssid=$HIDDEN
ap_isolate=$ISOLATE_CLIENTS ap_isolate=$ISOLATE_CLIENTS
EOF EOF
if [[ -n "$COUNTRY" ]]; then if [[ -n "$COUNTRY" ]]; then
cat <<- EOF >> "$CONFDIR/hostapd.conf" cat <<- EOF >> "/etc/hostapd.conf"
country_code=${COUNTRY} country_code=${COUNTRY}
ieee80211d=1 ieee80211d=1
EOF EOF
fi fi
if [[ $FREQ_BAND == 2.4 ]]; then if [[ $FREQ_BAND == 2.4 ]]; then
echo "hw_mode=g" >> "$CONFDIR/hostapd.conf" echo "hw_mode=g" >> "/etc/hostapd.conf"
else else
echo "hw_mode=a" >> "$CONFDIR/hostapd.conf" echo "hw_mode=a" >> "/etc/hostapd.conf"
fi fi
if [[ $MAC_FILTER -eq 1 ]]; then if [[ $MAC_FILTER -eq 1 ]]; then
cat <<- EOF >> "$CONFDIR/hostapd.conf" cat <<- EOF >> "/etc/hostapd.conf"
macaddr_acl=${MAC_FILTER} macaddr_acl=${MAC_FILTER}
accept_mac_file=${MAC_FILTER_ACCEPT} accept_mac_file=${MAC_FILTER_ACCEPT}
EOF EOF
fi fi
if [[ $IEEE80211N -eq 1 ]]; then if [[ $IEEE80211N -eq 1 ]]; then
cat <<- EOF >> "$CONFDIR/hostapd.conf" cat <<- EOF >> "/etc/hostapd.conf"
ieee80211n=1 ieee80211n=1
ht_capab=${HT_CAPAB} ht_capab=${HT_CAPAB}
EOF EOF
fi fi
if [[ $IEEE80211AC -eq 1 ]]; then if [[ $IEEE80211AC -eq 1 ]]; then
echo "ieee80211ac=1" >> "$CONFDIR/hostapd.conf" echo "ieee80211ac=1" >> "/etc/hostapd.conf"
fi fi
if [[ -n "$VHT_CAPAB" ]]; then if [[ -n "$VHT_CAPAB" ]]; then
echo "vht_capab=${VHT_CAPAB}" >> "$CONFDIR/hostapd.conf" echo "vht_capab=${VHT_CAPAB}" >> "/etc/hostapd.conf"
fi fi
if [[ $IEEE80211N -eq 1 ]] || [[ $IEEE80211AC -eq 1 ]]; then if [[ $IEEE80211N -eq 1 ]] || [[ $IEEE80211AC -eq 1 ]]; then
echo "wmm_enabled=1" >> "$CONFDIR/hostapd.conf" echo "wmm_enabled=1" >> "/etc/hostapd.conf"
fi fi
if [[ -n "$PASSPHRASE" ]]; then if [[ -n "$PASSPHRASE" ]]; then
@ -1743,7 +1743,7 @@ write_hostapd_conf() {
else else
WPA_KEY_TYPE=psk WPA_KEY_TYPE=psk
fi fi
cat <<- EOF >> "$CONFDIR/hostapd.conf" cat <<- EOF >> "/etc/hostapd.conf"
wpa=${WPA_VERSION} wpa=${WPA_VERSION}
wpa_${WPA_KEY_TYPE}=${PASSPHRASE} wpa_${WPA_KEY_TYPE}=${PASSPHRASE}
wpa_key_mgmt=WPA-PSK wpa_key_mgmt=WPA-PSK
@ -1753,7 +1753,7 @@ write_hostapd_conf() {
else else
echo "WARN: Wifi is not protected by password" >&2 echo "WARN: Wifi is not protected by password" >&2
fi fi
chmod 600 "$CONFDIR/hostapd.conf" chmod 600 "/etc/hostapd.conf"
} }
write_dnsmasq_conf() { write_dnsmasq_conf() {
@ -1861,7 +1861,7 @@ run_wifi_ap_processes() {
echo echo
echo "Starting hostapd" echo "Starting hostapd"
# hostapd '-P' works only when use '-B' (run in background) # hostapd '-P' works only when use '-B' (run in background)
$STDBUF_PATH hostapd $HOSTAPD_DEBUG_ARGS -P "$CONFDIR/hostapd.pid" "$CONFDIR/hostapd.conf" & $STDBUF_PATH hostapd $HOSTAPD_DEBUG_ARGS -P "$CONFDIR/hostapd.pid" "/etc/hostapd.conf" &
HOSTAPD_PID=$! HOSTAPD_PID=$!
echo "$HOSTAPD_PID" > "$CONFDIR/hostapd.pid" echo "$HOSTAPD_PID" > "$CONFDIR/hostapd.pid"
echo "hostapd PID: $HOSTAPD_PID" echo "hostapd PID: $HOSTAPD_PID"