linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Javier Cardona <javier@cozybit.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
	Steve Derosier <steve@cozybit.com>,
	devel@lists.open80211s.org
Subject: Re: [RFC 5/5] cfg80211/mac80211: add mesh join/leave commands
Date: Wed, 1 Dec 2010 16:23:41 -0800	[thread overview]
Message-ID: <AANLkTin==aJjY4Sctu1+g7bitDsd6S14SKRymrNW_WLy@mail.gmail.com> (raw)
In-Reply-To: <20101201210226.159495600@sipsolutions.net>

Wow, Johannes!

On Wed, Dec 1, 2010 at 12:59 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Instead of tying mesh activity to interface up,
> add join and leave commands for mesh. Since we
> must be backward compatible, let cfg80211 handle
> joining a mesh if a mesh ID was pre-configured
> when the device goes up.
>
> Note that this therefore must modify mac80211 as
> well since mac80211 needs to lose the logic to
> start the mesh on interface up.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Pretty impressive.  Comments below

+static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
+{
+       struct cfg80211_registered_device *rdev = info->user_ptr[0];
+       struct net_device *dev = info->user_ptr[1];
+       struct mesh_config cfg;
+       int err;
+
+       /* start with default */
+       memcpy(&cfg, &default_mesh_config, sizeof(cfg));
+
+       /* and parse other given info */
+       err = nl80211_parse_mesh_params(info, &cfg, NULL);
+       if (err)
+               return err;

Only the mesh id should be mandatory for starting the mesh, and none
of the other mesh parameters.  Therefore I would change the above to:

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 75c501f..300835d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4527,9 +4527,11 @@ static int nl80211_join_mesh(struct sk_buff
*skb, struct genl_info *info)
        memcpy(&cfg, &default_mesh_config, sizeof(cfg));

        /* and parse other given info */
-       err = nl80211_parse_mesh_params(info, &cfg, NULL);
-       if (err)
-               return err;
+       if (info->attrs[NL80211_ATTR_MESH_PARAMS]) {
+               err = nl80211_parse_mesh_params(info, &cfg, NULL);
+               if (err)
+                       return err;
+       }

        if (!info->attrs[NL80211_ATTR_MESH_ID] ||
            !nla_len(info->attrs[NL80211_ATTR_MESH_ID]))

@@ -775,20 +779,26 @@ static int cfg80211_netdev_notifier_call
               }
               cfg80211_lock_rdev(rdev);
               mutex_lock(&rdev->devlist_mtx);
-#ifdef CONFIG_CFG80211_WEXT
               wdev_lock(wdev);
               switch (wdev->iftype) {
+#ifdef CONFIG_CFG80211_WEXT
               case NL80211_IFTYPE_ADHOC:
                       cfg80211_ibss_wext_join(rdev, wdev);
                       break;
               case NL80211_IFTYPE_STATION:
                       cfg80211_mgd_wext_connect(rdev, wdev);
                       break;
+#endif
+               case NL80211_IFTYPE_MESH_POINT:
+                       /* backward compat code ... */
+                       if (wdev->ssid_len)
+                               __cfg80211_join_mesh(rdev, dev, wdev->ssid,
+                                                    wdev->ssid_len, NULL);
+

This doesn't quite work:  when mesh interfaces are created with a mesh
id you set wdev->ssid_len.
Later, when the interface is brought up, the mesh won't start because
of the last check below:

+int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
+                        struct net_device *dev,
+                        const u8 *mesh_id, size_t mesh_id_len,
+                        const struct mesh_config *conf)
+{
+       struct wireless_dev *wdev = dev->ieee80211_ptr;
+       int err;
+
+       BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != IEEE80211_MAX_MESH_ID_LEN);
+
+       ASSERT_WDEV_LOCK(wdev);
+
+       if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
+               return -EOPNOTSUPP;
+
+       if (wdev->ssid_len)       <<<<<<
+               return -EALREADY;

If you want to keep working on this we'll be happy to test it again,
or if you want we can take it from here and finish this.
Let me know.

Regarding...

> I just noticed that this will lose mesh parameters when you leave the
> mesh, unlike previously where they would be kept.

...I don't think there's an issue.  I'll ask around.

Cheers,

Javier

-- 
Javier Cardona
cozybit Inc.
http://www.cozybit.com

  parent reply	other threads:[~2010-12-02  0:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01 20:59 [RFC 0/5] mesh join/leave API Johannes Berg
2010-12-01 20:59 ` [RFC 1/5] mac80211: use configured mesh TTL Johannes Berg
2010-12-01 20:59 ` [RFC 2/5] mac80211: move mesh filter adjusting Johannes Berg
2010-12-01 20:59 ` [RFC 3/5] cfg80211: require add_virtual_intf to return new dev Johannes Berg
2010-12-01 20:59 ` [RFC 4/5] nl80211: refactor mesh parameter parsing Johannes Berg
2010-12-02  8:34   ` [RFC 4/5 v2] " Johannes Berg
2010-12-01 20:59 ` [RFC 5/5] cfg80211/mac80211: add mesh join/leave commands Johannes Berg
2010-12-01 21:15   ` Johannes Berg
2010-12-02  0:23   ` Javier Cardona [this message]
2010-12-02  6:57     ` Johannes Berg
2010-12-02  8:45   ` [RFC 5/5 v2] " Johannes Berg
2010-12-02 20:09     ` Javier Cardona
2010-12-02 20:14       ` Johannes Berg
2010-12-02 21:24         ` Javier Cardona
2010-12-02 21:38           ` Johannes Berg
2010-12-02 23:08             ` Javier Cardona
2010-12-03  8:13               ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTin==aJjY4Sctu1+g7bitDsd6S14SKRymrNW_WLy@mail.gmail.com' \
    --to=javier@cozybit.com \
    --cc=devel@lists.open80211s.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=steve@cozybit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).