Bug 208505 - ifconfig name changes behavior of wireless interface
Summary: ifconfig name changes behavior of wireless interface
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-04 11:49 UTC by matthias+freebsd+bugzilla
Modified: 2016-04-06 04:55 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matthias+freebsd+bugzilla 2016-04-04 11:49:33 UTC
I want to create an Wireless Interface with a Spezial MAC ans same bssid ind hostapmode:

If I do 

/sbin/ifconfig wlan0 create wlandev urtwn0 wlanaddr 00:24:b2:0e:15:cd -bssid wlanmode hostap ssid "NZ@McD1" authmode open country DE descr nintendo
/sbin/ifconfig wlan0 up

I get the following:

/sbin/ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: nintendo
        ether 00:24:b2:0e:15:cd
        groups: wlan
        ssid NZ@McD1 channel 9 (2452 MHz 11g) bssid 00:24:b2:0e:15:cd
        regdomain ETSI country DE authmode OPEN privacy OFF txpower 30
        scanvalid 60 protmode CTS wme dtimperiod 1 -dfs
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Works as expected.

But if i rename the Interface after cretaion:

/sbin/ifconfig wlan0 create wlandev urtwn0 wlanaddr 00:24:b2:0e:15:cd -bssid wlanmode hostap ssid "NZ@McD1" authmode open country DE descr nintendo
/sbin/ifconfig wlan0 nintendo
/sbin/ifconfig nintendo up

I get the following:

/sbin/ifconfig nintendo
nintendo: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: nintendo
        ether 00:24:b2:0e:15:cd
        groups: wlan
        ssid NZ@McD1 channel 9 (2452 MHz 11g) bssid 6e:64:6f:00:24:b2
        regdomain ETSI country DE authmode OPEN privacy OFF txpower 30
        scanvalid 60 protmode CTS wme dtimperiod 1 -dfs
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

as you can see bssid ist not the expected one.

tested wither urtwn0 and run0
Comment 1 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-04-04 14:35:39 UTC
> /sbin/ifconfig wlan0 nintendo

ifconfig: nintendo: bad value

(probably, you mean '/sbin/ifconfig wlan0 name nintendo)

> 6e:64:6f:00:24:b2

6e:64:6f is 'ndo' (part of the name), 00:24:b2 is an address part (memory corruption?)
Comment 2 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-04-04 14:37:12 UTC
... and this name is longer for only three (ndo) chars than the previous one.
Comment 3 matthias+freebsd+bugzilla 2016-04-04 15:07:30 UTC
(In reply to Andriy Voskoboinyk from comment #1)

Yes of cource.
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-04-05 21:29:26 UTC
A commit references this bug:

Author: avos
Date: Tue Apr  5 21:29:11 UTC 2016
New revision: 297592
URL: https://svnweb.freebsd.org/changeset/base/297592

Log:
  net80211: copy MAC address into iv_myaddr[] instead of aliasing it.

  Since IF_LLADDR() returns a non-constant pointer to the MAC address
  preserve a copy of it in iv_myaddr.

  PR:		208505

Changes:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_var.h
Comment 5 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-04-06 04:55:30 UTC
Should be fixed now.