hostapd: fix radius problem due to invalid attributes
authorJohn Crispin <john@phrozen.org>
Thu, 3 Jun 2021 13:57:07 +0000 (15:57 +0200)
committerPetr Štetiar <ynezz@true.cz>
Sat, 26 Feb 2022 08:27:15 +0000 (09:27 +0100)
The offending commit caused the configuration file to contain:
  radius_auth_req_attr=
  radius_acct_req_attr=
which cause hostapd to add an ATTR of type 0 into the messages.

hostapd: RADIUS message: code=4 (Accounting-Request) identifier=0 length=93
hostapd:    Attribute 40 (Acct-Status-Type) length=6
hostapd:       Value: 7
hostapd:    Attribute 30 (Called-Station-Id) length=28
hostapd:       Value: 'C4-41-1E-F5-2D-55:OpenWifi'
hostapd:    Attribute 61 (NAS-Port-Type) length=6
hostapd:       Value: 19
hostapd:    Attribute 0 (?Unknown?) length=3    <----------------
hostapd:    Attribute 55 (Event-Timestamp) length=6
hostapd:       Value: 1622726457
hostapd:    Attribute 41 (Acct-Delay-Time) length=6
hostapd:       Value: 0
hostapd:    Attribute 44 (Acct-Session-Id) length=18
hostapd:       Value: '9B5961E7235AAEC6'

Closes: #9315
Fixes: ce7a17041486 ("hostapd: add additional radius options")
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [pkg version bump]
(cherry picked from commit 96e9c81aabe9e14d6ec75c3f238c4ca7389b92a8)

package/network/services/hostapd/Makefile
package/network/services/hostapd/files/hostapd.sh

index d1ca7ba8b69b5b58576b972c72258f5a2bbd861b..e529a2efd34e68fd1c4be57a30ef3de164fd9fdc 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=39
+PKG_RELEASE:=40
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
index b52667d09ae01bd00a672e0b174e747a998daa8c..e47ae46f980eaf436bf9187890125489da1deca9 100644 (file)
@@ -488,11 +488,11 @@ append_hs20_conn_capab() {
 }
 
 append_radius_acct_req_attr() {
-       append bss_conf "radius_acct_req_attr=$1" "$N"
+       [ -n "$1" ] && append bss_conf "radius_acct_req_attr=$1" "$N"
 }
 
 append_radius_auth_req_attr() {
-       append bss_conf "radius_auth_req_attr=$1" "$N"
+       [ -n "$1" ] && append bss_conf "radius_auth_req_attr=$1" "$N"
 }
 
 append_airtime_sta_weight() {