summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/ifieee80211.c
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2009-02-27 00:31:34 +0000
committerrpaulo <rpaulo@FreeBSD.org>2009-02-27 00:31:34 +0000
commit2af9e81296d11b332adae2fe9855f658a4660ae8 (patch)
tree7275c4eafc8684e62de1c0c3a9947ef80862818d /sbin/ifconfig/ifieee80211.c
parent9e19feba057306f5e98a28151c121d0eefe749f2 (diff)
downloadFreeBSD-src-2af9e81296d11b332adae2fe9855f658a4660ae8.zip
FreeBSD-src-2af9e81296d11b332adae2fe9855f658a4660ae8.tar.gz
Replace clone_setcallback() with a new function clone_setdefcallback()
that selects a callback from an interface prefix name. This allows us to report a meaningful error when the user types 'ifconfig wlan0 create', for example, and also kills some redundant code. Reviewed by: sam (earlier version)
Diffstat (limited to 'sbin/ifconfig/ifieee80211.c')
-rw-r--r--sbin/ifconfig/ifieee80211.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index e5b9d8b..16615a3 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -4667,7 +4667,8 @@ wlan_create(int s, struct ifreq *ifr)
static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
if (params.icp_parent[0] == '\0')
- errx(1, "must specify a parent when creating a wlan device");
+ errx(1, "must specify a parent device (wlandev) when creating "
+ "a wlan device");
if (params.icp_opmode == IEEE80211_M_WDS &&
memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0)
errx(1, "no bssid specified for WDS (use wlanbssid)");
@@ -4680,7 +4681,6 @@ static
DECL_CMD_FUNC(set80211clone_wlandev, arg, d)
{
strlcpy(params.icp_parent, arg, IFNAMSIZ);
- clone_setcallback(wlan_create);
}
static
@@ -4692,7 +4692,6 @@ DECL_CMD_FUNC(set80211clone_wlanbssid, arg, d)
if (ea == NULL)
errx(1, "%s: cannot parse bssid", arg);
memcpy(params.icp_bssid, ea->octet, IEEE80211_ADDR_LEN);
- clone_setcallback(wlan_create);
}
static
@@ -4705,7 +4704,6 @@ DECL_CMD_FUNC(set80211clone_wlanaddr, arg, d)
errx(1, "%s: cannot parse addres", arg);
memcpy(params.icp_macaddr, ea->octet, IEEE80211_ADDR_LEN);
params.icp_flags |= IEEE80211_CLONE_MACADDR;
- clone_setcallback(wlan_create);
}
static
@@ -4729,7 +4727,6 @@ DECL_CMD_FUNC(set80211clone_wlanmode, arg, d)
params.icp_flags |= IEEE80211_CLONE_TDMA;
} else
errx(1, "Don't know to create %s for %s", arg, name);
- clone_setcallback(wlan_create);
#undef iseq
}
@@ -4741,7 +4738,6 @@ set80211clone_beacons(const char *val, int d, int s, const struct afswtch *rafp)
params.icp_flags &= ~IEEE80211_CLONE_NOBEACONS;
else
params.icp_flags |= IEEE80211_CLONE_NOBEACONS;
- clone_setcallback(wlan_create);
}
static void
@@ -4751,7 +4747,6 @@ set80211clone_bssid(const char *val, int d, int s, const struct afswtch *rafp)
params.icp_flags |= IEEE80211_CLONE_BSSID;
else
params.icp_flags &= ~IEEE80211_CLONE_BSSID;
- clone_setcallback(wlan_create);
}
static void
@@ -4761,7 +4756,6 @@ set80211clone_wdslegacy(const char *val, int d, int s, const struct afswtch *raf
params.icp_flags |= IEEE80211_CLONE_WDSLEGACY;
else
params.icp_flags &= ~IEEE80211_CLONE_WDSLEGACY;
- clone_setcallback(wlan_create);
}
static struct cmd ieee80211_cmds[] = {
@@ -4935,5 +4929,6 @@ ieee80211_ctor(void)
for (i = 0; i < N(ieee80211_cmds); i++)
cmd_register(&ieee80211_cmds[i]);
af_register(&af_ieee80211);
+ clone_setdefcallback("wlan", wlan_create);
#undef N
}
OpenPOWER on IntegriCloud