@@ -2613,14 +2613,6 @@ static int nl80211_get_mesh_params(struct sk_buff *skb,
2613
2613
return - ENOBUFS ;
2614
2614
}
2615
2615
2616
- #define FILL_IN_MESH_PARAM_IF_SET (table , cfg , param , mask , attr_num , nla_fn ) \
2617
- do {\
2618
- if (table[attr_num]) {\
2619
- cfg.param = nla_fn(table[attr_num]); \
2620
- mask |= (1 << (attr_num - 1)); \
2621
- } \
2622
- } while (0);\
2623
-
2624
2616
static const struct nla_policy nl80211_meshconf_params_policy [NL80211_MESHCONF_ATTR_MAX + 1 ] = {
2625
2617
[NL80211_MESHCONF_RETRY_TIMEOUT ] = { .type = NLA_U16 },
2626
2618
[NL80211_MESHCONF_CONFIRM_TIMEOUT ] = { .type = NLA_U16 },
@@ -2639,31 +2631,34 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A
2639
2631
[NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME ] = { .type = NLA_U16 },
2640
2632
};
2641
2633
2642
- static int nl80211_set_mesh_params (struct sk_buff * skb , struct genl_info * info )
2634
+ static int nl80211_parse_mesh_params (struct genl_info * info ,
2635
+ struct mesh_config * cfg ,
2636
+ u32 * mask_out )
2643
2637
{
2644
- u32 mask ;
2645
- struct cfg80211_registered_device * rdev = info -> user_ptr [0 ];
2646
- struct net_device * dev = info -> user_ptr [1 ];
2647
- struct mesh_config cfg ;
2648
2638
struct nlattr * tb [NL80211_MESHCONF_ATTR_MAX + 1 ];
2649
- struct nlattr * parent_attr ;
2639
+ u32 mask = 0 ;
2650
2640
2651
- parent_attr = info -> attrs [NL80211_ATTR_MESH_PARAMS ];
2652
- if (!parent_attr )
2641
+ #define FILL_IN_MESH_PARAM_IF_SET (table , cfg , param , mask , attr_num , nla_fn ) \
2642
+ do {\
2643
+ if (table[attr_num]) {\
2644
+ cfg->param = nla_fn(table[attr_num]); \
2645
+ mask |= (1 << (attr_num - 1)); \
2646
+ } \
2647
+ } while (0);\
2648
+
2649
+
2650
+ if (!info -> attrs [NL80211_ATTR_MESH_PARAMS ])
2653
2651
return - EINVAL ;
2654
2652
if (nla_parse_nested (tb , NL80211_MESHCONF_ATTR_MAX ,
2655
- parent_attr , nl80211_meshconf_params_policy ))
2653
+ info -> attrs [NL80211_ATTR_MESH_PARAMS ],
2654
+ nl80211_meshconf_params_policy ))
2656
2655
return - EINVAL ;
2657
2656
2658
- if (!rdev -> ops -> set_mesh_params )
2659
- return - EOPNOTSUPP ;
2660
-
2661
2657
/* This makes sure that there aren't more than 32 mesh config
2662
2658
* parameters (otherwise our bitfield scheme would not work.) */
2663
2659
BUILD_BUG_ON (NL80211_MESHCONF_ATTR_MAX > 32 );
2664
2660
2665
2661
/* Fill in the params struct */
2666
- mask = 0 ;
2667
2662
FILL_IN_MESH_PARAM_IF_SET (tb , cfg , dot11MeshRetryTimeout ,
2668
2663
mask , NL80211_MESHCONF_RETRY_TIMEOUT , nla_get_u16 );
2669
2664
FILL_IN_MESH_PARAM_IF_SET (tb , cfg , dot11MeshConfirmTimeout ,
@@ -2703,12 +2698,32 @@ static int nl80211_set_mesh_params(struct sk_buff *skb, struct genl_info *info)
2703
2698
NL80211_MESHCONF_HWMP_ROOTMODE ,
2704
2699
nla_get_u8 );
2705
2700
2701
+ if (mask_out )
2702
+ * mask_out = mask ;
2703
+ return 0 ;
2704
+
2705
+ #undef FILL_IN_MESH_PARAM_IF_SET
2706
+ }
2707
+
2708
+ static int nl80211_set_mesh_params (struct sk_buff * skb , struct genl_info * info )
2709
+ {
2710
+ struct cfg80211_registered_device * rdev = info -> user_ptr [0 ];
2711
+ struct net_device * dev = info -> user_ptr [1 ];
2712
+ struct mesh_config cfg ;
2713
+ u32 mask ;
2714
+ int err ;
2715
+
2716
+ if (!rdev -> ops -> set_mesh_params )
2717
+ return - EOPNOTSUPP ;
2718
+
2719
+ err = nl80211_parse_mesh_params (info , & cfg , & mask );
2720
+ if (err )
2721
+ return err ;
2722
+
2706
2723
/* Apply changes */
2707
2724
return rdev -> ops -> set_mesh_params (& rdev -> wiphy , dev , & cfg , mask );
2708
2725
}
2709
2726
2710
- #undef FILL_IN_MESH_PARAM_IF_SET
2711
-
2712
2727
static int nl80211_get_reg (struct sk_buff * skb , struct genl_info * info )
2713
2728
{
2714
2729
struct sk_buff * msg ;
0 commit comments