Bug#1057447: broadcom-sta-dkms: module build fails for Linux 6.6: wl_linux.c:486:12: error: 'struct net_device' has no member named 'wireless_handlers'

2024-03-02 Thread Andreas Beckmann

Control: retitle -1 broadcom-sta-dkms: module build fails for Linux 6.X-rcY 
(only two version components)

On 02/03/2024 22.06, Eduard Bloch wrote:

Thanks, and sorry, I overlooked the last message. I guess we should take
it as is.


I should have updated the misleading bug title after finding the real
cause ...  this time it was not a change in the kernel causing the
failure but a the logic flaw leading to usage of the wrong code path.

Attached are updated versions of two more patches that restore
compatibility with older Linux releases. Let's just use the old or new
names depending on the kernel version ...

(With these three applied, broadcom-sta successfully survives my dkms
torture chroot which contains some header packages for most kernels we
had in sid/stable/security/backports since 2.6.32 ;-)

AndreasFrom: Diego Escalante Urrelo 
Date: Sun, 2 Aug 2020 19:54:56 -0500
Subject: wl: Use the right enums for cfg80211_get_bss

---
 amd64/src/wl/sys/wl_cfg80211_hybrid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/amd64/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/amd64/src/wl/sys/wl_cfg80211_hybrid.c
@@ -2309,7 +2309,13 @@ static s32 wl_update_bss_info(struct wl_
 
 	ssid = >profile->ssid;
 	bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)>bssid,
-	  ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
+			   ssid->SSID, ssid->SSID_len,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
+			   WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS
+#else
+			   IEEE80211_BSS_TYPE_ESS, IEEE80211_PRIVACY_ANY
+#endif
+			   );
 
 	rtnl_lock();
 	if (!bss) {
From: Felix Yan 
Date: Mon, 20 Jun 2016 11:18:00 +0800
Subject: linux47

Origin: https://github.com/archlinuxcn/repo/tree/f4d6cff1cacf8dad13006fade5f96bc2cf020a9b/broadcom-wl-dkms

Since Linux 4.7, the enum ieee80211_band is no longer used

This shall cause no problem's since both enums ieee80211_band
and nl80211_band were added in the same commit:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c

This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*

Reference:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3

This patch is based on
https://github.com/archlinuxcn/repo/tree/f4d6cff1cacf8dad13006fade5f96bc2cf020a9b/broadcom-wl-dkms .
---
 amd64/src/wl/sys/wl_cfg80211_hybrid.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

--- a/amd64/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/amd64/src/wl/sys/wl_cfg80211_hybrid.c
@@ -235,8 +235,13 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX]
 };
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+#define NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
+#define NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
+#endif
+
 #define CHAN2G(_channel, _freq, _flags) {			\
-	.band			= IEEE80211_BAND_2GHZ,		\
+	.band			= NL80211_BAND_2GHZ,		\
 	.center_freq		= (_freq),			\
 	.hw_value		= (_channel),			\
 	.flags			= (_flags),			\
@@ -245,7 +250,7 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX]
 }
 
 #define CHAN5G(_channel, _flags) {\
-	.band			= IEEE80211_BAND_5GHZ,		\
+	.band			= NL80211_BAND_5GHZ,		\
 	.center_freq		= 5000 + (5 * (_channel)),	\
 	.hw_value		= (_channel),			\
 	.flags			= (_flags),			\
@@ -379,7 +384,7 @@ static struct ieee80211_channel __wl_5gh
 };
 
 static struct ieee80211_supported_band __wl_band_2ghz = {
-	.band = IEEE80211_BAND_2GHZ,
+	.band = NL80211_BAND_2GHZ,
 	.channels = __wl_2ghz_channels,
 	.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
 	.bitrates = wl_g_rates,
@@ -387,7 +392,7 @@ static struct ieee80211_supported_band _
 };
 
 static struct ieee80211_supported_band __wl_band_5ghz_a = {
-	.band = IEEE80211_BAND_5GHZ,
+	.band = NL80211_BAND_5GHZ,
 	.channels = __wl_5ghz_a_channels,
 	.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
 	.bitrates = wl_a_rates,
@@ -395,7 +400,7 @@ static struct ieee80211_supported_band _
 };
 
 static struct ieee80211_supported_band __wl_band_5ghz_n = {
-	.band = IEEE80211_BAND_5GHZ,
+	.band = NL80211_BAND_5GHZ,
 	.channels = __wl_5ghz_n_channels,
 	.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
 	.bitrates = wl_a_rates,
@@ -1876,8 +1881,8 @@ static s32 wl_alloc_wdev(struct device *
 	wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
 #endif
 	wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
-	wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
-	wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a; 
+	wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
+	wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a; 
 	wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
 	wdev->wiphy->cipher_suites = __wl_cipher_suites;
 	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
@@ -2000,7 +2005,7 @@ static s32 wl_inform_single_bss(struct w
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
 	freq = 

Bug#1057447: broadcom-sta-dkms: module build fails for Linux 6.6: wl_linux.c:486:12: error: 'struct net_device' has no member named 'wireless_handlers'

2024-03-02 Thread Eduard Bloch
Hallo,
* Andreas Beckmann [Fri, Feb 23 2024, 06:27:26PM]:
> Followup-For: Bug #1057447
> Control: found -1 6.30.223.271-24~exp1
> Control: tag -1 + patch
>
> This issue is caused by
> a) version parsing that expects three numeric components (6.6.1-foo) and
>fails if there are only two (6.7-rc1)
> b) broken version comparison logic
> which turn on APICHOICE=FORCE_WEXT on kernels without
> CONFIG_WIRELESS_EXT
>
> Attached patch fixes that.

Thanks, and sorry, I overlooked the last message. I guess we should take
it as is. Any opinion from Roger or Cyril?

BR,
Eduard.

--
* weasel hatte letztens eine nette idee fuer ein namensschema
 hab's aber leider wieder vergessen :(



Bug#1057447: broadcom-sta-dkms: module build fails for Linux 6.6: wl_linux.c:486:12: error: 'struct net_device' has no member named 'wireless_handlers'

2024-03-02 Thread Eduard Bloch
tags 1057447 +moreinfo
thanks

Hi,

which exact kernel version is that? Which exact compiler version is
that?

At the first glance, that looks like some DKMS bug to me (see the
strange shell warning).

I just tested the module-assistant based build with a locally built
6.6.18 on Stable, works like a charm.

"/usr/share/modass/packages/default.sh" build KVERS=6.6.18 
KSRC=/lib/modules/6.6.18/build KDREV=6.6.18-5 kdist_image
Done with /usr/src/broadcom-sta-modules-6.6.18_6.30.223.271-23+6.6.18-5_all.deb 
.
dpkg -Ei /usr/src/broadcom-sta-modules-6.6.18_6.30.223.271-23+6.6.18-5_all.deb
(Reading database ... 464471 files and directories currently installed.)
Preparing to unpack 
.../broadcom-sta-modules-6.6.18_6.30.223.271-23+6.6.18-5_all.deb ...
Unpacking broadcom-sta-modules-6.6.18 (6.30.223.271-23+6.6.18-5) ...
Setting up broadcom-sta-modules-6.6.18 (6.30.223.271-23+6.6.18-5) ...
apt-mark auto broadcom-sta-modules-6.6.18
broadcom-sta-modules-6.6.18 set to automatically installed.

Please elaborate!

Eduard.

* Andreas Beckmann [Tue, Dec 05 2023, 10:33:27AM]:
> Package: broadcom-sta-dkms
> Version: 6.30.223.271-23
> Severity: important
> Tags: sid trixie
>
> Hi,
>
> broadcom-sta-dkms fails to build a module for Linux 6.6 that was just uploaded
> to experimental:
>
> DKMS make.log for broadcom-sta-6.30.223.271 for kernel 6.6-cloud-amd64 
> (x86_64)
> Tue Dec  5 08:33:20 UTC 2023
> /bin/sh: 1: [: Illegal number: 6.6-cloud-amd64
> /bin/sh: 1: [: Illegal number: 6.6-cloud-amd64
> Wireless Extension is the only possible API for this kernel version
> Using Wireless Extension API
> KBUILD_NOPEDANTIC=1 make -C /lib/modules/6.6-cloud-amd64/build M=`pwd`
> make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make 
> rule.
> make[1]: Entering directory '/usr/src/linux-headers-6.6-cloud-amd64'
> /bin/sh: 1: [: Illegal number: 6.6-cloud-amd64
> /bin/sh: 1: [: Illegal number: 6.6-cloud-amd64
> Wireless Extension is the only possible API for this kernel version
> Using Wireless Extension API
> Kernel architecture is X86_64
>   CC [M]  /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/shared/linux_osl.o
>   CC [M]  /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.o
> In file included from 
> /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.c:81:
> /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_iw.h:73: warning: 
> "isprint" redefined
>73 | #define isprint(c) bcm_isprint(c)
>   |
> In file included from 
> /usr/src/linux-headers-6.6-common/include/linux/string_helpers.h:6,
>  from 
> /usr/src/linux-headers-6.6-common/include/linux/seq_file.h:7,
>  from 
> /usr/src/linux-headers-6.6-common/include/linux/seq_file_net.h:5,
>  from 
> /usr/src/linux-headers-6.6-common/include/net/net_namespace.h:195,
>  from 
> /usr/src/linux-headers-6.6-common/include/linux/netdevice.h:38,
>  from 
> /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/include/linuxver.h:69,
>  from 
> /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.c:27:
> /usr/src/linux-headers-6.6-common/include/linux/ctype.h:30: note: this is the 
> location of the previous definition
>30 | #define isprint(c)  ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
>   |
> /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.c: In 
> function 'wl_if_setup':
> /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.c:486:12: 
> error: 'struct net_device' has no member named 'wireless_handlers'
>   486 | dev->wireless_handlers = (struct iw_handler_def *) 
> _iw_handler_def;
>   |^~
> make[3]: *** [/usr/src/linux-headers-6.6-common/scripts/Makefile.build:248: 
> /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.o] Error 1
> make[2]: *** [/usr/src/linux-headers-6.6-common/Makefile:1938: 
> /var/lib/dkms/broadcom-sta/6.30.223.271/build] Error 2
> make[1]: *** [/usr/src/linux-headers-6.6-common/Makefile:246: __sub-make] 
> Error 2
> make[1]: Leaving directory '/usr/src/linux-headers-6.6-cloud-amd64'
> make: *** [Makefile:181: all] Error 2
>
>
> Andreas

--
error compiling committee.c: too many arguments to function



Bug#1057447: broadcom-sta-dkms: module build fails for Linux 6.6: wl_linux.c:486:12: error: 'struct net_device' has no member named 'wireless_handlers'

2024-02-23 Thread Andreas Beckmann
Followup-For: Bug #1057447
Control: found -1 6.30.223.271-24~exp1
Control: tag -1 + patch

This issue is caused by
a) version parsing that expects three numeric components (6.6.1-foo) and
   fails if there are only two (6.7-rc1)
b) broken version comparison logic
which turn on APICHOICE=FORCE_WEXT on kernels without
CONFIG_WIRELESS_EXT

Attached patch fixes that.

Verified to be able to build a module for 6.7-cloud-amd64.


Andreas
Author: Andreas Beckmann 
Description: fix detection of LINUXVER_WEXT_ONLY
 - fix version parsing if there are only two numeric components (e.g. 6.7-rc1)
 - set SUBLEVEL to 0 if missing
 - fix version comparison logic
 - -a and -o don't have well defined precedence
Bug-Debian: https://bugs.debian.org/1057447

--- a/amd64/Makefile
+++ b/amd64/Makefile
@@ -20,20 +20,22 @@
 
 ifneq ($(KERNELRELEASE),)
 
-  VERSION := $(shell echo $(KERNELRELEASE) | sed -e 
's/\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\(.*\)/\1/')
-  PATCHLEVEL := $(shell echo $(KERNELRELEASE) | sed -e 
's/\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\(.*\)/\2/')
-  SUBLEVEL := $(shell echo $(KERNELRELEASE) | sed -e 
's/\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\(.*\)/\3/')
+  VERSION := $(shell echo $(KERNELRELEASE) | sed -e 
's/\([0-9]*\)[.]\([0-9]*\)\(.*\)/\1/')
+  PATCHLEVEL := $(shell echo $(KERNELRELEASE) | sed -e 
's/\([0-9]*\)[.]\([0-9]*\)\(.*\)/\2/')
+  SUBLEVEL := $(shell echo $(KERNELRELEASE) | sed -e 
's/\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\(.*\)/\3/; 
s/\([0-9]*\)[.]\([0-9]*\)\(.*\)/0/')
 
+  # >= 2.6.32
   LINUXVER_GOODFOR_CFG80211:=$(strip $(shell \
-if [ "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge 
"32" -o "$(VERSION)" -ge "3" ]; then \
+if [ "$(VERSION).$(PATCHLEVEL)" = "2.6" -a "$(SUBLEVEL)" -ge "32" ] || [ 
"$(VERSION)" -eq "2" -a "$(PATCHLEVEL)" -ge "7" ] || [ "$(VERSION)" -ge "3" ]; 
then \
   echo TRUE; \
 else \
   echo FALSE; \
 fi \
   ))
 
+  # < 2.6.17
 LINUXVER_WEXT_ONLY:=$(strip $(shell \
-if [ "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge 
"17" ]; then \
+if [ "$(VERSION).$(PATCHLEVEL)" = "2.6" -a "$(SUBLEVEL)" -ge "17" ] || [ 
"$(VERSION)" -eq "2" -a "$(PATCHLEVEL)" -ge "7" ] || [ "$(VERSION)" -ge "3" ]; 
then \
   echo FALSE; \
 else \
   echo TRUE; \


Bug#1057447: broadcom-sta-dkms: module build fails for Linux 6.6: wl_linux.c:486:12: error: 'struct net_device' has no member named 'wireless_handlers'

2024-01-25 Thread Steev Klimaszewski
Does the cloud kernel even have wireless enabled?  My understanding
was the cloud kernels do not enable wireless.



Bug#1057447: broadcom-sta-dkms: module build fails for Linux 6.6: wl_linux.c:486:12: error: 'struct net_device' has no member named 'wireless_handlers'

2023-12-05 Thread Andreas Beckmann
Package: broadcom-sta-dkms
Version: 6.30.223.271-23
Severity: important
Tags: sid trixie

Hi,

broadcom-sta-dkms fails to build a module for Linux 6.6 that was just uploaded
to experimental:

DKMS make.log for broadcom-sta-6.30.223.271 for kernel 6.6-cloud-amd64 (x86_64)
Tue Dec  5 08:33:20 UTC 2023
/bin/sh: 1: [: Illegal number: 6.6-cloud-amd64
/bin/sh: 1: [: Illegal number: 6.6-cloud-amd64
Wireless Extension is the only possible API for this kernel version
Using Wireless Extension API
KBUILD_NOPEDANTIC=1 make -C /lib/modules/6.6-cloud-amd64/build M=`pwd`
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make 
rule.
make[1]: Entering directory '/usr/src/linux-headers-6.6-cloud-amd64'
/bin/sh: 1: [: Illegal number: 6.6-cloud-amd64
/bin/sh: 1: [: Illegal number: 6.6-cloud-amd64
Wireless Extension is the only possible API for this kernel version
Using Wireless Extension API
Kernel architecture is X86_64
  CC [M]  /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/shared/linux_osl.o
  CC [M]  /var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.o
In file included from 
/var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.c:81:
/var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_iw.h:73: warning: 
"isprint" redefined
   73 | #define isprint(c) bcm_isprint(c)
  |
In file included from 
/usr/src/linux-headers-6.6-common/include/linux/string_helpers.h:6,
 from 
/usr/src/linux-headers-6.6-common/include/linux/seq_file.h:7,
 from 
/usr/src/linux-headers-6.6-common/include/linux/seq_file_net.h:5,
 from 
/usr/src/linux-headers-6.6-common/include/net/net_namespace.h:195,
 from 
/usr/src/linux-headers-6.6-common/include/linux/netdevice.h:38,
 from 
/var/lib/dkms/broadcom-sta/6.30.223.271/build/src/include/linuxver.h:69,
 from 
/var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.c:27:
/usr/src/linux-headers-6.6-common/include/linux/ctype.h:30: note: this is the 
location of the previous definition
   30 | #define isprint(c)  ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
  |
/var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.c: In 
function 'wl_if_setup':
/var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.c:486:12: 
error: 'struct net_device' has no member named 'wireless_handlers'
  486 | dev->wireless_handlers = (struct iw_handler_def *) 
_iw_handler_def;
  |^~
make[3]: *** [/usr/src/linux-headers-6.6-common/scripts/Makefile.build:248: 
/var/lib/dkms/broadcom-sta/6.30.223.271/build/src/wl/sys/wl_linux.o] Error 1
make[2]: *** [/usr/src/linux-headers-6.6-common/Makefile:1938: 
/var/lib/dkms/broadcom-sta/6.30.223.271/build] Error 2
make[1]: *** [/usr/src/linux-headers-6.6-common/Makefile:246: __sub-make] Error 
2
make[1]: Leaving directory '/usr/src/linux-headers-6.6-cloud-amd64'
make: *** [Makefile:181: all] Error 2


Andreas