mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-22 20:43:40 +00:00
rtl8188eu: Fix build for kernel 5.18
Also update control_ap Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
bf23ec4903
commit
13531f3844
2 changed files with 113 additions and 82 deletions
185
control_ap
185
control_ap
|
@ -1,17 +1,23 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Script to start/stop a hostapd-based access point
|
# Script to start/stop a hostapd-based access point
|
||||||
#
|
#
|
||||||
# Sample start call "control_ap start wlan0 eth0"
|
# Sample start call "control_ap start wlan0 eth0 encrypt"
|
||||||
# Stop with "control_ap stop"
|
# Stop with "control_ap stop"
|
||||||
#
|
#
|
||||||
|
|
||||||
|
ENCRYPT=$4
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if [ $# -ne 3 ]
|
if [ $# -le 2 ]
|
||||||
then
|
then
|
||||||
echo "Usage: $0 start AP_iface NET_iface"
|
echo "Usage: $0 start AP_iface NET_iface <encrypt>"
|
||||||
|
echo " Optional encrypt is wpa, wpa2, wep, or none. If not given, wpa2 is assumed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ $# -eq 3 ]
|
||||||
|
then
|
||||||
|
ENCRYPT="wpa2"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
if [ $# -ne 1 ]
|
if [ $# -ne 1 ]
|
||||||
|
@ -22,7 +28,7 @@ stop)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo "$0 start AP-iface net_iface"
|
echo "$0 start AP-iface net_iface <encrypt>"
|
||||||
echo "or"
|
echo "or"
|
||||||
echo "$0 stop"
|
echo "$0 stop"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -31,12 +37,15 @@ esac
|
||||||
|
|
||||||
# Symbols for needed programs
|
# Symbols for needed programs
|
||||||
|
|
||||||
IPTABLES=/sbin/iptables
|
IPTABLES=/usr/sbin/iptables
|
||||||
IFCONFIG=/sbin/ifconfig
|
IFCONFIG=/usr/bin/ifconfig
|
||||||
DHCPD=/usr/sbin/dhcpd
|
DHCPD=/sbin/dhcpd
|
||||||
HOSTAPD=/home/finger/rtl8188eu/hostapd-0.8/hostapd/hostapd
|
HOSTAPD=/home/finger/hostapd-2.9/hostapd/hostapd
|
||||||
|
#HOSTAPD=/sbin/hostapd
|
||||||
|
#HOSTAPD=/home/finger/hostapd-0.8/hostapd/hostapd
|
||||||
|
OPT=-ddK
|
||||||
|
|
||||||
|
|
||||||
# Symbols for AP and external interfaces
|
|
||||||
|
|
||||||
NET_AP=$2
|
NET_AP=$2
|
||||||
NET_EXT=$3
|
NET_EXT=$3
|
||||||
|
@ -49,34 +58,34 @@ AP_ADDR=192.168.0
|
||||||
|
|
||||||
NAME_SERVER=8.8.8.8
|
NAME_SERVER=8.8.8.8
|
||||||
|
|
||||||
# AP Channel, SSID, Encryption method, driver, and Encryption secret
|
# AP Channel, SSID, Encryption method, and Encryption secret
|
||||||
|
|
||||||
AP_CHANNEL=11
|
AP_CHANNEL=6
|
||||||
AP_SSID=rtwap
|
AP_SSID=TEST-LARRY
|
||||||
WPA_SECRET="87654321"
|
WPA_SECRET=TheSecret
|
||||||
ENCRYPT_MODE=2
|
WEP_SECRET=123456789a
|
||||||
DRIVER=rtl871xdrv
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo "Starting AP mode for $NET_AP at address $AP_ADDR.1"
|
echo "Starting AP mode for $NET_AP at address $AP_ADDR"
|
||||||
# Disable packet forwarding
|
# Disable packet forwarding
|
||||||
echo 0 > /proc/sys/net/ipv4/ip_forward
|
echo 0 > /proc/sys/net/ipv4/ip_forward
|
||||||
# Stop any existing hostapd and dhcpd daemons
|
# Stop any existing hostapd and dhcpd daemons
|
||||||
killall -q hostapd
|
killproc hostapd
|
||||||
killall -q dhcpd
|
killproc dhcpd
|
||||||
#Set up forwarding
|
#Set up forwarding
|
||||||
$IPTABLES -t nat -A POSTROUTING -o $NET_EXT -j MASQUERADE
|
$IPTABLES -t nat -A POSTROUTING -o $NET_EXT -j MASQUERADE
|
||||||
$IPTABLES -A FORWARD -i $NET_EXT -o $NET_AP -m state \
|
$IPTABLES -A FORWARD -i $NET_EXT -o $NET_AP -m state \
|
||||||
--state RELATED,ESTABLISHED -j ACCEPT
|
--state RELATED,ESTABLISHED -j ACCEPT
|
||||||
$IPTABLES -A FORWARD -i $NET_AP -o $NET_EXT -j ACCEPT
|
$IPTABLES -A FORWARD -i $NET_AP -o $NET_EXT -j ACCEPT
|
||||||
|
# Enable packet forwarding
|
||||||
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
# Get the AP interface in the right state
|
# Get the AP interface in the right state
|
||||||
$IFCONFIG $NET_AP down
|
$IFCONFIG $NET_AP down
|
||||||
$IFCONFIG $NET_AP up
|
$IFCONFIG $NET_AP up
|
||||||
$IFCONFIG $NET_AP $AP_ADDR.1
|
$IFCONFIG $NET_AP $AP_ADDR.1
|
||||||
# dhcpd needs to have a leases file available - create it if needed
|
# dhcpd needs to have a leases file available - create it if needed
|
||||||
if [ ! -f /var/lib/dhcp/db/dhcpd.leases ]; then
|
if [ ! -f /var/lib/dhcp/db/dhcpd.leases ]; then
|
||||||
mkdir -p /var/lib/dhcp/db
|
|
||||||
touch /var/lib/dhcp/db/dhcpd.leases
|
touch /var/lib/dhcp/db/dhcpd.leases
|
||||||
fi
|
fi
|
||||||
# Write the DHCP server configuration file
|
# Write the DHCP server configuration file
|
||||||
|
@ -90,73 +99,95 @@ start)
|
||||||
echo " option broadcast-address $AP_ADDR.255;" >> ~/dhcpd.conf
|
echo " option broadcast-address $AP_ADDR.255;" >> ~/dhcpd.conf
|
||||||
echo " option routers $AP_ADDR.1;" >> ~/dhcpd.conf
|
echo " option routers $AP_ADDR.1;" >> ~/dhcpd.conf
|
||||||
echo "}" >> ~/dhcpd.conf
|
echo "}" >> ~/dhcpd.conf
|
||||||
# Bring up the DHCP server
|
|
||||||
$DHCPD -cf ~/dhcpd.conf $NET_AP
|
$DHCPD -cf ~/dhcpd.conf $NET_AP
|
||||||
# Write the hostapd configuration file
|
# Write the hostapd configuration file
|
||||||
cat > ~/hostapd.conf << EOF
|
echo "interface=$NET_AP" > ~/hostapd.conf
|
||||||
auth_algs=1
|
echo "driver=nl80211" >> ~/hostapd.conf
|
||||||
beacon_int=100
|
# echo "driver=rtl871x" >> ~/hostapd.conf
|
||||||
country_code=US
|
|
||||||
ctrl_interface_group=0
|
|
||||||
ctrl_interface=/var/run/hostapd
|
|
||||||
dtim_period=2
|
|
||||||
dump_file=/tmp/hostapd.dump
|
|
||||||
fragm_threshold=2346
|
|
||||||
#ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40][MAX-AMSDU-7935][DSSS_CCK-40]
|
|
||||||
#ieee80211d=1
|
|
||||||
ieee80211n=1
|
|
||||||
ignore_broadcast_ssid=0
|
|
||||||
logger_stdout=-1
|
|
||||||
logger_stdout_level=2
|
|
||||||
logger_syslog=-1
|
|
||||||
logger_syslog_level=2
|
|
||||||
macaddr_acl=0
|
|
||||||
max_num_sta=255
|
|
||||||
rts_threshold=2347
|
|
||||||
wmm_ac_be_acm=0
|
|
||||||
wmm_ac_be_aifs=3
|
|
||||||
wmm_ac_be_cwmax=10
|
|
||||||
wmm_ac_be_cwmin=4
|
|
||||||
wmm_ac_be_txop_limit=0
|
|
||||||
wmm_ac_bk_acm=0
|
|
||||||
wmm_ac_bk_aifs=7
|
|
||||||
wmm_ac_bk_cwmax=10
|
|
||||||
wmm_ac_bk_cwmin=4
|
|
||||||
wmm_ac_bk_txop_limit=0
|
|
||||||
wmm_ac_vi_acm=0
|
|
||||||
wmm_ac_vi_aifs=2
|
|
||||||
wmm_ac_vi_cwmax=4
|
|
||||||
wmm_ac_vi_cwmin=3
|
|
||||||
wmm_ac_vi_txop_limit=94
|
|
||||||
wmm_ac_vo_acm=0
|
|
||||||
wmm_ac_vo_aifs=2
|
|
||||||
wmm_ac_vo_cwmax=3
|
|
||||||
wmm_ac_vo_cwmin=2
|
|
||||||
wmm_ac_vo_txop_limit=47
|
|
||||||
wmm_enabled=1
|
|
||||||
EOF
|
|
||||||
echo "interface=$NET_AP" >> ~/hostapd.conf
|
|
||||||
echo "ssid=$AP_SSID" >> ~/hostapd.conf
|
|
||||||
echo "driver=$DRIVER" >> ~/hostapd.conf
|
|
||||||
echo "hw_mode=g" >> ~/hostapd.conf
|
echo "hw_mode=g" >> ~/hostapd.conf
|
||||||
echo "channel=$AP_CHANNEL" >> ~/hostapd.conf
|
echo "channel=$AP_CHANNEL" >> ~/hostapd.conf
|
||||||
echo "wpa=$ENCRYPT_MODE" >> ~/hostapd.conf
|
case "$ENCRYPT" in
|
||||||
echo "wpa_key_mgmt=WPA-PSK" >> ~/hostapd.conf
|
"wpa")
|
||||||
echo "wpa_pairwise=TKIP CCMP" >> ~/hostapd.conf
|
echo "Setting up wpa"
|
||||||
echo "rsn_pairwise=CCMP" >> ~/hostapd.conf
|
echo "wpa=1" >> ~/hostapd.conf
|
||||||
echo "wpa_passphrase=$WPA_SECRET" >> ~/hostapd.conf
|
echo "wpa_key_mgmt=WPA-PSK" >> ~/hostapd.conf
|
||||||
# Enable packet forwarding
|
echo "wpa_pairwise=TKIP" >> ~/hostapd.conf
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
echo "wpa_passphrase=$WPA_SECRET" >> ~/hostapd.conf
|
||||||
|
echo "ssid=$AP_SSID-wpa" >> ~/hostapd.conf
|
||||||
|
;;
|
||||||
|
"wpa2")
|
||||||
|
echo "Setting up wpa2"
|
||||||
|
echo "wpa=2" >> ~/hostapd.conf
|
||||||
|
# echo "wpa_key_mgmt=WPA-PSK" >> ~/hostapd.conf
|
||||||
|
echo "wpa_pairwise=CCMP" >> ~/hostapd.conf
|
||||||
|
echo "rsn_pairwise=CCMP" >> ~/hostapd.conf
|
||||||
|
echo "wpa_passphrase=$WPA_SECRET" >> ~/hostapd.conf
|
||||||
|
echo "ssid=$AP_SSID-wpa2" >> ~/hostapd.conf
|
||||||
|
;;
|
||||||
|
"wep")
|
||||||
|
echo "Setting up wep"
|
||||||
|
echo "wep_default_key=0" >> ~/hostapd.conf
|
||||||
|
echo "wep_key0=$WEP_SECRET" >> ~/hostapd.conf
|
||||||
|
echo "ssid=$AP_SSID-wep" >> ~/hostapd.conf
|
||||||
|
;;
|
||||||
|
"none")
|
||||||
|
echo "No encryption"
|
||||||
|
echo "ssid=$AP_SSID" >> ~/hostapd.conf
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Improper value for encryption"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# echo "ssid=$AP_SSID" >> ~/hostapd.conf
|
||||||
|
echo "beacon_int=100" >> ~/hostapd.conf
|
||||||
|
echo "dtim_period=2" >> ~/hostapd.conf
|
||||||
|
echo "max_num_sta=20" >> ~/hostapd.conf
|
||||||
|
echo "rts_threshold=2347" >> ~/hostapd.conf
|
||||||
|
echo "fragm_threshold=2346" >> ~/hostapd.conf
|
||||||
|
echo "preamble=1" >> ~/hostapd.conf
|
||||||
|
echo "macaddr_acl=0" >> ~/hostapd.conf
|
||||||
|
echo "auth_algs=1" >> ~/hostapd.conf
|
||||||
|
echo "ignore_broadcast_ssid=0" >> ~/hostapd.conf
|
||||||
|
echo "wmm_enabled=1" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_bk_cwmin=4" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_bk_cwmax=10" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_bk_aifs=7" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_bk_txop_limit=0" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_bk_acm=0" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_be_aifs=3" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_be_cwmin=4" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_be_cwmax=10" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_be_txop_limit=0" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_be_acm=0" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vi_aifs=2" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vi_cwmin=3" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vi_cwmax=4" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vi_txop_limit=94" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vi_acm=0" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vo_aifs=2" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vo_cwmin=2" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vo_cwmax=3" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vo_txop_limit=47" >> ~/hostapd.conf
|
||||||
|
echo "wmm_ac_vo_acm=0" >> ~/hostapd.conf
|
||||||
|
#echo "ieee80211n=1" >> ~/hostapd.conf
|
||||||
|
#echo "ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40]" >> ~/hostapd.conf
|
||||||
|
echo "logger_syslog=-1" >> ~/hostapd.conf
|
||||||
|
echo "logger_syslog_level=0" >> ~/hostapd.conf
|
||||||
|
echo "logger_stdout=-1" >> ~/hostapd.conf
|
||||||
|
echo "logger_stdout_level=0" >> ~/hostapd.conf
|
||||||
|
echo "ctrl_interface=/var/run/hostapd" >> ~/hostapd.conf
|
||||||
|
echo "ctrl_interface_group=0" >> ~/hostapd.conf
|
||||||
|
|
||||||
# Bring up hostapd
|
# Bring up hostapd
|
||||||
$HOSTAPD -dd -B ~/hostapd.conf
|
$HOSTAPD $OPT -B -dd ~/hostapd.conf
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo "Stopping AP mode"
|
echo "Stopping AP mode"
|
||||||
# Stop hostapd and dhcpd daemons
|
# Stop hostapd and dhcpd daemons
|
||||||
killall hostapd
|
killproc hostapd
|
||||||
killall dhcpd
|
killproc dhcpd
|
||||||
rm -f ~/hostapd.conf
|
# rm -f ~/hostapd.conf
|
||||||
rm -f ~/dhcpd.conf
|
rm -f ~/dhcpd.conf
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -1235,18 +1235,18 @@ enum ieee80211_state {
|
||||||
#define PORT_FMT "%u"
|
#define PORT_FMT "%u"
|
||||||
#define PORT_ARG(x) ntohs(*((__be16 *)(x)))
|
#define PORT_ARG(x) ntohs(*((__be16 *)(x)))
|
||||||
|
|
||||||
extern __inline int is_multicast_mac_addr(const u8 *addr)
|
static inline int is_multicast_mac_addr(const u8 *addr)
|
||||||
{
|
{
|
||||||
return (addr[0] != 0xff) && (0x01 & addr[0]);
|
return (addr[0] != 0xff) && (0x01 & addr[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern __inline int is_broadcast_mac_addr(const u8 *addr)
|
static inline int is_broadcast_mac_addr(const u8 *addr)
|
||||||
{
|
{
|
||||||
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
|
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
|
||||||
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
|
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern __inline int is_zero_mac_addr(const u8 *addr)
|
static inline int is_zero_mac_addr(const u8 *addr)
|
||||||
{
|
{
|
||||||
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
||||||
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
||||||
|
|
Loading…
Reference in a new issue