Re: Bad definition of SIOCG80211JOIN

2020-10-05 Thread Theo de Raadt
OK deraadt


Gerhard Roth  wrote:

> The current definition of SIOCG80211JOIN uses 256 for the command,
> but the _IOC() macro only allows 8 bit for the command value.
> Using 256 would set the lowermost bit of the ioctl group.
> Fortunately, 'i' (0x69) already has the lowermost bit set. Otherwise
> SIOCG80211JOIN would never reach ifioctl().
> 
> The patch below is compatible with the current definition and
> results in no binary change, it just reflects reality better.
> 
> Gerhard
> 
> 
> --- sys/net80211/ieee80211_ioctl.h2020/04/29 13:13:30 1.40
> +++ sys/net80211/ieee80211_ioctl.h2020/10/05 11:24:06
> @@ -275,11 +275,11 @@ struct ieee80211_keyrun {
>  
>  #define SIOCS80211SCAN_IOW('i', 210, struct ifreq)
>  
>  #define  SIOCG80211JOINALL   _IOWR('i', 218, struct 
> ieee80211_joinreq_all)
>  #define  SIOCS80211JOIN  _IOWR('i', 255, struct ifreq)
> -#define  SIOCG80211JOIN  _IOWR('i', 256, struct ifreq)
> +#define  SIOCG80211JOIN  _IOWR('i', 0, struct ifreq)
>  
>  /* join is pointed at by ifr.ifr_data */
>  struct ieee80211_join {
>   u_int8_ti_len;  /* length of i_nwid */
>   u_int8_ti_nwid[IEEE80211_NWID_LEN];
> 



Bad definition of SIOCG80211JOIN

2020-10-05 Thread Gerhard Roth
The current definition of SIOCG80211JOIN uses 256 for the command,
but the _IOC() macro only allows 8 bit for the command value.
Using 256 would set the lowermost bit of the ioctl group.
Fortunately, 'i' (0x69) already has the lowermost bit set. Otherwise
SIOCG80211JOIN would never reach ifioctl().

The patch below is compatible with the current definition and
results in no binary change, it just reflects reality better.

Gerhard


--- sys/net80211/ieee80211_ioctl.h  2020/04/29 13:13:30 1.40
+++ sys/net80211/ieee80211_ioctl.h  2020/10/05 11:24:06
@@ -275,11 +275,11 @@ struct ieee80211_keyrun {
 
 #define SIOCS80211SCAN  _IOW('i', 210, struct ifreq)
 
 #defineSIOCG80211JOINALL   _IOWR('i', 218, struct 
ieee80211_joinreq_all)
 #defineSIOCS80211JOIN  _IOWR('i', 255, struct ifreq)
-#defineSIOCG80211JOIN  _IOWR('i', 256, struct ifreq)
+#defineSIOCG80211JOIN  _IOWR('i', 0, struct ifreq)
 
 /* join is pointed at by ifr.ifr_data */
 struct ieee80211_join {
u_int8_ti_len;  /* length of i_nwid */
u_int8_ti_nwid[IEEE80211_NWID_LEN];