This fails due to -Wvoid-pointer-to-enum-cast because RadiusType is an
enum which has smaller width than the void *sock_ctx. Upstream doesn't
seem to have fixed this and FreeBSD's suppressing the warning seems more
complicated than adding an intermediate cast to intptr_t.

https://github.com/freebsd/freebsd-ports/blob/5ec99c62e498b8c2a3e585c93b1d4de28b69b3b3/security/wpa_supplicant/files/patch-src_radius_radius__client.c

I don't have a setup to actually test this.

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/wpa_supplicant/Makefile,v
retrieving revision 1.49
diff -u -p -r1.49 Makefile
--- Makefile    5 Feb 2021 19:57:54 -0000       1.49
+++ Makefile    10 Mar 2021 19:41:17 -0000
@@ -3,7 +3,7 @@
 COMMENT=       IEEE 802.1X supplicant
 
 DISTNAME=      wpa_supplicant-2.9
-REVISION=      0
+REVISION=      1
 CATEGORIES=    security net
 
 HOMEPAGE=      https://w1.fi/wpa_supplicant/
Index: patches/patch-src_radius_radius_client_c
===================================================================
RCS file: patches/patch-src_radius_radius_client_c
diff -N patches/patch-src_radius_radius_client_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_radius_radius_client_c    10 Mar 2021 19:57:41 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Fix build failure due to -Wvoid-pointer-to-enum-cast
+
+Index: src/radius/radius_client.c
+--- src/radius/radius_client.c.orig
++++ src/radius/radius_client.c
+@@ -814,7 +814,7 @@ static void radius_client_receive(int sock, void *eloo
+ {
+       struct radius_client_data *radius = eloop_ctx;
+       struct hostapd_radius_servers *conf = radius->conf;
+-      RadiusType msg_type = (RadiusType) sock_ctx;
++      RadiusType msg_type = (RadiusType)(intptr_t) sock_ctx;
+       int len, roundtrip;
+       unsigned char buf[3000];
+       struct radius_msg *msg;

Reply via email to