sysprog21 / vwifi

A virtual wireless device driver for Linux
MIT License
203 stars 39 forks source link

Implement real AP and STA mode #27

Closed rickywu0421 closed 2 years ago

rickywu0421 commented 2 years ago

Before this commit, STAs can communicate to each other directly without AP, and that's not STA mode should be, it's more like Ad-hoc mode.

This commit, I rewrote many cfg80211_ops, and I also modify the owl_vif and owl_context for storing association between AP and STA.

And mainly, I implement the AP relay and forbidden STA from directly access to other STA, they must send packet to AP first, then after AP receive the packet, it should do the following stuff based on the packet type:

  1. unicast: if the skb is for another STA, then pass it to the STA and do not pass to protocol stack, otherwise (skb is for AP itself) pass it to protocol stack.
  2. broadcast: pass skb to another STA except the source STA, then pass it to protocol stack.
  3. multicast: do the same thing as broadcast.

I also change the testing enviroment to be one AP and two STAs, for further explanation, please read README.md, I have updated it.

rickywu0421 commented 2 years ago

Don't put file "plot.py". Always keep the necessary changes.

Oops, I put it in the directory in mistake.

rickywu0421 commented 2 years ago

Why not just register .add_virtual_intf for the virtual interface? What's your concern?

static struct cfg80211_ops ath6kl_cfg80211_ops = {
  .add_virtual_intf = ath6kl_cfg80211_add_iface,
  .del_virtual_intf = ath6kl_cfg80211_del_iface,

Yes, I don't use this two callback to add/delete interface due to the awkward reason:

They both have a parameter struct wiphy *wiphy, that's the problem: I cannot guess that what wiphy will kernel pass in, so I choose to create interfaces by the the module parameter "interfaces" instead.