PERFORCE change 66521 for review

Sam Leffler sam at FreeBSD.org
Sun Dec 5 22:20:58 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=66521

Change 66521 by sam at sam_ebb on 2004/12/06 06:20:52

	checkpoint mac acl stuff

Affected files ...

.. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#29 edit

Differences ...

==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#29 (text+ko) ====

@@ -571,6 +571,43 @@
 	set80211(s, IEEE80211_IOC_BEACON_INTERVAL, atoi(val), 0, NULL);
 }
 
+static void
+set80211macmac(int s, int op, const char *val)
+{
+	char *temp;
+	struct sockaddr_dl sdl;
+
+	temp = malloc(strlen(val) + 1);
+	if (temp == NULL)
+		errx(1, "malloc failed");
+	temp[0] = ':';
+	strcpy(temp + 1, val);
+	sdl.sdl_len = sizeof(sdl);
+	link_addr(temp, &sdl);
+	free(temp);
+	if (sdl.sdl_alen != IEEE80211_ADDR_LEN)
+		errx(1, "malformed link-level address");
+	set80211(s, op, 0, IEEE80211_ADDR_LEN, LLADDR(&sdl));
+}
+
+static
+DECL_CMD_FUNC(set80211addmac, val, d)
+{
+	set80211macmac(s, IEEE80211_IOC_ADDMAC, val);
+}
+
+static
+DECL_CMD_FUNC(set80211delmac, val, d)
+{
+	set80211macmac(s, IEEE80211_IOC_DELMAC, val);
+}
+
+static
+DECL_CMD_FUNC(set80211maccmd, val, d)
+{
+	set80211(s, IEEE80211_IOC_MACCMD, d, 0, NULL);
+}
+
 static int
 getmaxrate(uint8_t rates[15], uint8_t nrates)
 {
@@ -1728,6 +1765,16 @@
 	DEF_CMD_ARG2("bss:txoplimit",	set80211bsstxoplimit),
 	DEF_CMD_ARG("dtimperiod",	set80211dtimperiod),
 	DEF_CMD_ARG("bintval",		set80211bintval),
+	DEF_CMD("mac:open",	IEEE80211_MACCMD_POLICY_OPEN,	set80211maccmd),
+	DEF_CMD("mac:allow",	IEEE80211_MACCMD_POLICY_ALLOW,	set80211maccmd),
+	DEF_CMD("mac:deny",	IEEE80211_MACCMD_POLICY_DENY,	set80211maccmd),
+	DEF_CMD("mac:flush",	IEEE80211_MACCMD_FLUSH,		set80211maccmd),
+	DEF_CMD("mac:detach",	IEEE80211_MACCMD_DETACH,	set80211maccmd),
+	DEF_CMD_ARG("mac:add",		set80211addmac),
+	DEF_CMD_ARG("mac:del",		set80211delmac),
+#if 0
+	DEF_CMD_ARG("mac:kick",		set80211kickmac),
+#endif
 };
 static struct afswtch af_ieee80211 = {
 	.af_name	= "af_ieee80211",


More information about the p4-projects mailing list