Re: ifconfig reporting SIOCSIFMEDIA Device not configured error
- In reply to: Farhan Khan : "ifconfig reporting SIOCSIFMEDIA Device not configured error"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Jul 2022 03:09:00 UTC
On Thursday, July 21, 2022 5:05:19 PM EDT you wrote: > Hi all, > > I am setting up a device driver in monitor mode, but appear to be getting an > `ifconfig` error that I do not understand. > > Specifically, when I set my device to be in monitor mode, I receive this > error: > > ``` > $ ifconfig wlan create wlandev athn0 mode monitor > ifconfig: SIOCSIFMEDIA (media): Device not configured > ``` > > This creates a `wlan0` interface, but `ifconfig` reports this error. What > might be causing this? I am certain I am missing a step in the ic_vap_create > or ic_ioctl handlers or something related, but what might that be? > > I searched for SIOCSIFMEDIA in the kernel source of drivers I know, but do > not see anything that looks relevant. I could back out from the ifconfig > source to figure out the exact cause, but that might take a while and was > hoping someone here could/would shortcut that research. > > For context my WIP code is located here (https://github.com/khanzf/freebsd/ > tree/ar9271/sys/dev/athn). This is an attempt to port OpenBSD's athn, > currently focusing on the USB driver. > > Thank you. > > - Farhan I was wrong, I have not been able to solve this problem after a few days. I gather that the error condition begins after I create the VAP, which I do via: # ifconfig wlan create wlandev athn0 mode monitor ifconfig: SIOCSIFMEDIA (media): Device not configured The error condition seems to begin in ifmedia_ioctl() in: /usr/src/sys/net/if_media.c, specifically the ifmedia_match function fails. This is here: https://github.com/freebsd/freebsd-src/blob/main/sys/net/if_media.c#L227 I enabled the printf debugging message here: ``` printf("ifmedia_ioctl: no media found for %#010x mask %#010x\n", newmedia, ifm->ifm_mask); ``` And then I receive this kernel message: ifmedia_ioctl: no media found for 0xffffffff mask 0000000000 I do not understand what this means. Why is newmedia set to 0xffffffff and ifm->ifm_mask set to 0000000000? What am I am missing such that this error is happening? I searched through /usr/src/sys/dev/usb/wlan and only see one usage of `struct ifreq`. Please help, stuck :/ - Farhan