From owner-svn-src-projects@FreeBSD.ORG Thu May 14 22:13:17 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1270106566C; Thu, 14 May 2009 22:13:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B02728FC16; Thu, 14 May 2009 22:13:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EMDHFJ004113; Thu, 14 May 2009 22:13:17 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EMDH7o004111; Thu, 14 May 2009 22:13:17 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200905142213.n4EMDH7o004111@svn.freebsd.org> From: Rui Paulo Date: Thu, 14 May 2009 22:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192126 - projects/mesh11s/sys/net80211 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 22:13:18 -0000 Author: rpaulo Date: Thu May 14 22:13:17 2009 New Revision: 192126 URL: http://svn.freebsd.org/changeset/base/192126 Log: * Really send the mesh path reply, don't just pretend. * Fix a bug in calculating the location of the IEs on mesh_recv_action(). Sponsored by: The FreeBSD Foundation Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c projects/mesh11s/sys/net80211/ieee80211_output.c Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_mesh.c Thu May 14 22:01:32 2009 (r192125) +++ projects/mesh11s/sys/net80211/ieee80211_mesh.c Thu May 14 22:13:17 2009 (r192126) @@ -3,7 +3,7 @@ * Copyright (c) 2009 The FreeBSD Foundation * All rights reserved. * - * This software was developed by Rui Paulo under sponsorship from the + * This software was developed by Rui Paulo under sponsorship from the * FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without @@ -635,8 +635,7 @@ mesh_recv_action(struct ieee80211_node * wh = mtod(m0, struct ieee80211_frame *); ia = (struct ieee80211_action *) &wh[1]; - frm = (uint8_t *)&wh[1]; - frm += sizeof(ia); + frm = (uint8_t *)&wh[1] + sizeof(struct ieee80211_action); efrm = mtod(m0, uint8_t *) + m0->m_len; /* @@ -646,8 +645,6 @@ mesh_recv_action(struct ieee80211_node * if (ni == vap->iv_bss) { return; } - - meshid = NULL; meshpeer = NULL; meshconf = NULL; @@ -684,10 +681,10 @@ mesh_recv_action(struct ieee80211_node * frm += frm[1] + 2; } + switch (ia->ia_category) { /* * Mesh Peer Link Management Finite State Machine handling. */ - switch (ia->ia_category) { case IEEE80211_ACTION_CAT_MESHPEERING: /* * Check if we agree on the required fields. Modified: projects/mesh11s/sys/net80211/ieee80211_output.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_output.c Thu May 14 22:01:32 2009 (r192125) +++ projects/mesh11s/sys/net80211/ieee80211_output.c Thu May 14 22:13:17 2009 (r192126) @@ -546,6 +546,13 @@ ieee80211_send_action(struct ieee80211_n frm[1] = (v) >> 8; \ frm += 2; \ } while (0) +#define ADDWORD(frm, v) do { \ + frm[0] = (v) & 0xff; \ + frm[1] = ((v) >> 8) & 0xff; \ + frm[2] = ((v) >> 16) & 0xff; \ + frm[3] = ((v) >> 24) & 0xff; \ + frm += 4; \ +} while (0) #define MS(_v, _f) (((_v) & _f) >> _f##_S) #define SM(_v, _f) (((_v) << _f##_S) & _f) struct ieee80211vap *vap = ni->ni_vap; @@ -765,25 +772,44 @@ ieee80211_send_action(struct ieee80211_n * mesh path request action frame format: * [1] action * [1] category - * [tlv] mesh preq + * [tlv] mesh path request */ case IEEE80211_ACTION_MESHPATH_REQ: break; /* - * mesh path request action frame format: + * mesh path reply action frame format: * [1] action * [1] category - * [tlv] mesh preq + * [tlv] mesh path reply */ case IEEE80211_ACTION_MESHPATH_REP: + { + struct ieee80211_meshprep_ie *prep; + + prep = vargs.ptrarg; IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni, "send PATH REPLY action: flags 0x%x, " - "hopcount 0x%x", vargs.fixedarg[0], - vargs.fixedarg[1]); - + "hopcount 0x%x, ttl 0x%x, " + "seq 0x%x, lifetime 0x%x", prep->prep_flags, + prep->prep_hopcount, prep->prep_ttl, + prep->prep_targetseq, prep->prep_lifetime); + *frm++ = IEEE80211_ELEMID_MESHPREP; + *frm++ = sizeof(struct ieee80211_meshprep_ie) - 2; + *frm++ = prep->prep_flags; + *frm++ = prep->prep_hopcount; + *frm++ = prep->prep_ttl; + IEEE80211_ADDR_COPY(frm, prep->prep_targetaddr); + frm += 6; + ADDWORD(frm, prep->prep_targetseq); + ADDWORD(frm, prep->prep_lifetime); + ADDWORD(frm, prep->prep_metric); + IEEE80211_ADDR_COPY(frm, prep->prep_origaddr); + frm += 6; + ADDWORD(frm, prep->prep_origseq); break; } + } break; default: badaction: