• Martin Willi's avatar
    mac80211_hwsim: Allow managing radios from non-initial namespaces · 100cb9ff
    Martin Willi authored
    While wiphys can be moved into network namespaces over nl80211, the
    creation and removal of hwsim radios is currently limited to the initial
    namespace. This patch allows management of namespaced radios from the
    owning namespace by setting genetlink netnsok.
    
    To prevent two arbitrary namespaces to communicate over the simulated
    shared medium, radios are separated by netgroups. Each radio created in
    the same namespace lives in the same netgroup and hence can communicate
    with other radios in that group. When moving radios to other namespaces,
    the netgroup is preserved, so two radios having the same netgroup can
    communicate even if not in the same namespace; This allows a controlling
    namespace to create radios and move them to other namespaces for
    communication.
    
    When a net namespace owning a radio exits, the radio is destroyed unless
    it was created in the initial network namespace. This keeps the previous
    behavior by returning them to the init namespace, but prevents unprivileged
    users from creating radios in the initial namespace.
    Signed-off-by: default avatarMartin Willi <martin@strongswan.org>
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    100cb9ff
mac80211_hwsim.c 91.2 KB