# creating wlan0



## grodzix (Apr 19, 2010)

I wanted to do

```
ifconfig ath0 scan
```
but it returns

```
ifconfig: unable to get scan results
```
so I started readin and I read that in FreeBSD 8 you need to create wlan interface. That's what I've found that I'm supposed to do to get it

```
ifconfig wlan0 create wlandev ath0
```
but it throws following error

```
ifconfig: SIOCIFCREATE2: Bad address
```
and I have no idea what does it mean. I cannot find anything on the web.

I also tried adding

```
wlans_ath0="wlan0"
```
to /etc/rc.conf but it doesn't seem to be doing anything. I cannot find anything in /var/log/messages and in dmesg.


```
uname -a
FreeBSD grodzix.net 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Jan  5 16:02:27 UTC 2010     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
```

Any pointers would be appreciated.


----------



## psycho (Apr 19, 2010)

maybe this could be useful. ifconfig.c !
And I found this part relevant (?) :

```
void
clone_create(void)
{
	int s;
	
	s = socket(AF_INET, SOCK_DGRAM, 0);
	if (s == -1)
		err(1, "socket");
	
	memset(&ifr, 0, sizeof(ifr));
	(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
	if (ioctl(s, SIOCIFCREATE, &ifr) < 0)
		err(1, "SIOCIFCREATE");
	
	if (strcmp(name, ifr.ifr_name) != 0) {
		printf("%s\n", ifr.ifr_name);
		strlcpy(name, ifr.ifr_name, sizeof(name));
	}
	
	close(s);
}
```

It is at bottom of link.


----------

