2 * mac80211 configuration hooks for cfg80211
4 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
6 * This file is GPLv2 as found in COPYING.
9 #include <linux/nl80211.h>
10 #include <linux/rtnetlink.h>
11 #include <net/cfg80211.h>
12 #include "ieee80211_i.h"
13 #include "ieee80211_cfg.h"
15 static int ieee80211_add_iface(struct wiphy
*wiphy
, char *name
,
18 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
21 if (unlikely(local
->reg_state
!= IEEE80211_DEV_REGISTERED
))
25 case NL80211_IFTYPE_UNSPECIFIED
:
26 itype
= IEEE80211_IF_TYPE_STA
;
28 case NL80211_IFTYPE_ADHOC
:
29 itype
= IEEE80211_IF_TYPE_IBSS
;
31 case NL80211_IFTYPE_STATION
:
32 itype
= IEEE80211_IF_TYPE_STA
;
34 case NL80211_IFTYPE_MONITOR
:
35 itype
= IEEE80211_IF_TYPE_MNTR
;
41 return ieee80211_if_add(local
->mdev
, name
, NULL
, itype
);
44 static int ieee80211_del_iface(struct wiphy
*wiphy
, int ifindex
)
46 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
47 struct net_device
*dev
;
50 if (unlikely(local
->reg_state
!= IEEE80211_DEV_REGISTERED
))
53 dev
= dev_get_by_index(ifindex
);
60 return ieee80211_if_remove(local
->mdev
, name
, -1);
63 struct cfg80211_ops mac80211_config_ops
= {
64 .add_virtual_intf
= ieee80211_add_iface
,
65 .del_virtual_intf
= ieee80211_del_iface
,