svn commit: r195457 - projects/mesh11s/sys/net80211
Rui Paulo
rpaulo at FreeBSD.org
Wed Jul 8 15:02:57 UTC 2009
Author: rpaulo
Date: Wed Jul 8 15:02:56 2009
New Revision: 195457
URL: http://svn.freebsd.org/changeset/base/195457
Log:
Implement setter/getter for protocol ioctls.
Sponsored by: The FreeBSD Foundation
Modified:
projects/mesh11s/sys/net80211/ieee80211_mesh.c
projects/mesh11s/sys/net80211/ieee80211_mesh.h
Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_mesh.c Wed Jul 8 14:52:31 2009 (r195456)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.c Wed Jul 8 15:02:56 2009 (r195457)
@@ -98,6 +98,9 @@ static const int ieee80211_mesh_maxretri
#define IEEE80211_MESH_DEFAULT_TTL 31
+static const uint8_t broadcastaddr[IEEE80211_ADDR_LEN] =
+ { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+
static ieee80211_recv_action_func mesh_recv_action_meshpeering_open;
static ieee80211_recv_action_func mesh_recv_action_meshpeering_confirm;
static ieee80211_recv_action_func mesh_recv_action_meshpeering_close;
@@ -151,8 +154,6 @@ ieee80211_mesh_rt_add(struct ieee80211va
{
struct ieee80211_mesh_state *ms = vap->iv_mesh;
struct ieee80211_mesh_route *rt;
- static const uint8_t broadcastaddr[IEEE80211_ADDR_LEN] =
- { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
KASSERT(ieee80211_mesh_rt_find(vap, dest) == NULL,
("%s: duplicate entry in the routing table", __func__));
@@ -275,8 +276,6 @@ mesh_select_proto_metric(struct ieee8021
for (i = 0; i < N(mesh_proto_metrics); i++) {
if (strcmp(mesh_proto_metrics[i].mpm_descr, name) == 0) {
ms->ms_pmetric = &mesh_proto_metrics[i];
- if (vap->iv_state == IEEE80211_S_RUN)
- vap->iv_newstate(vap, IEEE80211_S_INIT, 0);
return 0;
}
}
@@ -2453,6 +2452,22 @@ mesh_ioctl_get80211(struct ieee80211vap
return ENOSYS;
}
break;
+ case IEEE80211_IOC_MESH_PR_METRIC:
+ len = strlen(ms->ms_pmetric->mpm_descr);
+ if (ireq->i_len < len)
+ return EINVAL;
+ ireq->i_len = len;
+ error = copyout(ms->ms_pmetric->mpm_descr,
+ (uint8_t *)ireq->i_data, len);
+ break;
+ case IEEE80211_IOC_MESH_PR_PATH:
+ len = strlen(ms->ms_ppath->mpp_descr);
+ if (ireq->i_len < len)
+ return EINVAL;
+ ireq->i_len = len;
+ error = copyout(ms->ms_ppath->mpp_descr,
+ (uint8_t *)ireq->i_data, len);
+ break;
default:
return ENOSYS;
}
@@ -2465,8 +2480,10 @@ static int
mesh_ioctl_set80211(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
struct ieee80211_mesh_state *ms = vap->iv_mesh;
- int error;
uint8_t tmpmeshid[IEEE80211_NWID_LEN];
+ uint8_t tmpaddr[IEEE80211_ADDR_LEN];
+ char tmpproto[IEEE80211_MESH_PROTO_DSZ];
+ int error;
if (vap->iv_opmode != IEEE80211_M_MBSS)
return ENOSYS;
@@ -2506,9 +2523,13 @@ mesh_ioctl_set80211(struct ieee80211vap
ieee80211_mesh_rt_flush(vap);
break;
case IEEE80211_MESH_RTCMD_ADD:
- if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ireq->i_data))
+ if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ireq->i_data) ||
+ IEEE80211_ADDR_EQ(broadcastaddr, ireq->i_data))
return EINVAL;
- ieee80211_mesh_rt_add(vap, ireq->i_data);
+ error = copyin(ireq->i_data, &tmpaddr,
+ IEEE80211_ADDR_LEN);
+ if (!error)
+ ieee80211_mesh_discover(vap, tmpaddr, NULL);
break;
case IEEE80211_MESH_RTCMD_DELETE:
ieee80211_mesh_rt_del(vap, ireq->i_data);
@@ -2517,6 +2538,16 @@ mesh_ioctl_set80211(struct ieee80211vap
return ENOSYS;
}
break;
+ case IEEE80211_IOC_MESH_PR_METRIC:
+ error = copyin(ireq->i_data, tmpproto, sizeof(tmpproto));
+ if (!error)
+ return mesh_select_proto_metric(vap, tmpproto);
+ break;
+ case IEEE80211_IOC_MESH_PR_PATH:
+ error = copyin(ireq->i_data, tmpproto, sizeof(tmpproto));
+ if (!error)
+ return mesh_select_proto_path(vap, tmpproto);
+ break;
default:
return ENOSYS;
}
Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.h
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_mesh.h Wed Jul 8 14:52:31 2009 (r195456)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.h Wed Jul 8 15:02:56 2009 (r195457)
@@ -393,12 +393,13 @@ struct ieee80211_mesh_route {
};
#define IEEE80211_MESH_ROUTE_PRIV(rt, cast) (cast *)rt->rt_priv
+#define IEEE80211_MESH_PROTO_DSZ 12 /* description size */
/*
* Mesh Path Selection Protocol.
*/
enum ieee80211_state;
struct ieee80211_mesh_proto_path {
- char mpp_descr[12];
+ char mpp_descr[IEEE80211_MESH_PROTO_DSZ];
uint8_t mpp_ie[4];
struct ieee80211_node *
(*mpp_discover)(struct ieee80211vap *,
@@ -416,7 +417,7 @@ struct ieee80211_mesh_proto_path {
* Mesh Link Metric Report Protocol.
*/
struct ieee80211_mesh_proto_metric {
- char mpm_descr[12];
+ char mpm_descr[IEEE80211_MESH_PROTO_DSZ];
uint8_t mpm_ie[4];
uint32_t (*mpm_metric)(struct ieee80211_node *);
};
More information about the svn-src-projects
mailing list