Skip to content
twpedersen edited this page Dec 9, 2013 · 4 revisions

Process

After generating a list of all nodes in a mesh by doing an ipv6 link local mcast ping then comparing the responders agains the mpath table, we can request the peer list of any node with a custom action frame.

This would look something like:

iw <meshif> plink_get <peer>
<..... blocks on response or -ETIMEOUT ... >
<peer mac> peers: <peer1 mac>, <peer2 mac>, <peer3 mac>
  1. request list of node's peers in nl80211 (CMD_NL80211_GET_MESH_PEERS, defined in include/uapi/linux/nl80211.h, implemented in net/wireless/nl80211.c). This takes 1 argument: the node's mac address. Function in nl80211.c (nl80211_get_mesh_node_peers() calls wrapper around cfg80211_ops (probably cfg80211.h or such) in net/wireless/mesh.c. This cfg80211_ops is implemented by mac80211 in net/mac80211/cfg.c.

  2. The mac80211 implementation of the get_mesh_node_peers() cfg80211_ops lives in net/mac80211/mesh.c. The mac80211 mpath table is checked for mpath to node, if it exists we're ok. Just generate an action frame for direct neighbor for now. mac80211 generates a PLREQ frame and sends it over the mpath table.

(find example of how to generate an action frame in mac80211 in 'net/mac80211/mesh_plink.c (mesh_plink_frame_tx()` or so). This will be a vendor-specific (cozybit) action frame. See IEEE802.11-2012 s. 8.5.6

PLREQ frame format

<action frame header>
<category: vendor specific>
<vendor specific action frame action field specifying cozybit OUI and PLREQ #>
<PLREQ IE w/ own + target peer's MAC>
  1. mac80211 receives a PLREQ frame and handles it in ieee80211_rx_h_action() in net/mac80211/rx.c follow the mesh code there and eventually process it in net/mac80211/mesh_plink.c. The handling code will generate a list of mesh peers, put it in a PLRES IE, and send it over an mpath toward the originating node (specified in the received PLREQ IE).

PLRES frame format

<cozybit vendor specific action frame>
<PLRES IE w/ own + list of peer MACs>
  1. mac80211 receives a PLRES frame, parses it into a list of peers and sends it to cfg80211 (as an asynchronous notification, or to a waiting peer list request). CMD_NL80211_GET_MESH_PEERS responds with the key value pair (peer MAC: peer's peer MACs).