Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jun 2009 17:17:46 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r194597 - projects/mesh11s/sbin/ifconfig
Message-ID:  <200906211717.n5LHHkst013408@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Sun Jun 21 17:17:46 2009
New Revision: 194597
URL: http://svn.freebsd.org/changeset/base/194597

Log:
  Implement hwmp:add, hwmp:del and hwmp:flush commands.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/mesh11s/sbin/ifconfig/ifieee80211.c

Modified: projects/mesh11s/sbin/ifconfig/ifieee80211.c
==============================================================================
--- projects/mesh11s/sbin/ifconfig/ifieee80211.c	Sun Jun 21 17:06:05 2009	(r194596)
+++ projects/mesh11s/sbin/ifconfig/ifieee80211.c	Sun Jun 21 17:17:46 2009	(r194597)
@@ -1280,6 +1280,44 @@ DECL_CMD_FUNC(set80211maccmd, val, d)
 }
 
 static void
+set80211hwmpmac(int s, int req, const char *val)
+{
+	char *temp;
+	struct sockaddr_dl sdl;
+
+	temp = malloc(strlen(val) + 2); /* ':' and '\0' */
+	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, IEEE80211_IOC_HWMP_CMD, req,
+	    IEEE80211_ADDR_LEN, LLADDR(&sdl));
+}
+
+static
+DECL_CMD_FUNC(set80211addhwmp, val, d)
+{
+	set80211hwmpmac(s, IEEE80211_HWMP_CMD_ADD, val);
+}
+
+static
+DECL_CMD_FUNC(set80211delhwmp, val, d)
+{
+	set80211hwmpmac(s, IEEE80211_HWMP_CMD_DELETE, val);
+}
+
+static
+DECL_CMD_FUNC(set80211hwmpcmd, val, d)
+{
+	set80211(s, IEEE80211_IOC_HWMP_CMD, d, 0, NULL);
+}
+
+static void
 set80211pureg(const char *val, int d, int s, const struct afswtch *rafp)
 {
 	set80211(s, IEEE80211_IOC_PUREG, d, 0, NULL);
@@ -3302,7 +3340,6 @@ list_mesh(int s)
 		struct ieee80211req_sta_req req;
 		uint8_t buf[24*1024];
 	} u;
-	enum ieee80211_opmode opmode = get80211opmode(s);
 	const uint8_t *cp;
 	int len;
 
@@ -3903,7 +3940,8 @@ list_hwmp(int s)
 
 	(void) memset(&ireq, 0, sizeof(ireq));
 	(void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
-	ireq.i_type = IEEE80211_IOC_HWMP_TABLE;
+	ireq.i_type = IEEE80211_IOC_HWMP_CMD;
+	ireq.i_val = IEEE80211_HWMP_CMD_LIST;
 	ireq.i_data = &routes;
 	ireq.i_len = sizeof(routes);
 	if (ioctl(s, SIOCG80211, &ireq) < 0)
@@ -5059,6 +5097,9 @@ static struct cmd ieee80211_cmds[] = {
 	DEF_CMD_ARG("mac:add",		set80211addmac),
 	DEF_CMD_ARG("mac:del",		set80211delmac),
 	DEF_CMD_ARG("mac:kick",		set80211kickmac),
+	DEF_CMD("hwmp:flush",	IEEE80211_HWMP_CMD_FLUSH,	set80211hwmpcmd),
+	DEF_CMD_ARG("hwmp:add",		set80211addhwmp),
+	DEF_CMD_ARG("hwmp:del",		set80211delhwmp),
 	DEF_CMD("pureg",	1,	set80211pureg),
 	DEF_CMD("-pureg",	0,	set80211pureg),
 	DEF_CMD("ff",		1,	set80211fastframes),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906211717.n5LHHkst013408>