On Wed, 2019-05-08 at 14:55 +0530, Manikanta Pubbisetty wrote:
> 
> +++ b/net/mac80211/util.c
> @@ -3795,7 +3795,9 @@ int ieee80211_check_combinations(struct 
> ieee80211_sub_if_data *sdata,
>       }
>  
>       /* Always allow software iftypes */
> -     if (local->hw.wiphy->software_iftypes & BIT(iftype)) {
> +     if (local->hw.wiphy->software_iftypes & BIT(iftype) ||
> +         (iftype == NL80211_IFTYPE_AP_VLAN &&
> +          local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) {
>               if (radar_detect)
>                       return -EINVAL;

Shouldn't this check if 4addr is actually enabled too, like here:

>       case NETDEV_PRE_UP:
> -             if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
> +             if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)) &&
> +                 !(wdev->iftype == NL80211_IFTYPE_AP_VLAN &&
> +                   rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP &&
> +                   wdev->use_4addr))
>                       return notifier_from_errno(-EOPNOTSUPP);

?
Or is there some reason it doesn't matter?

> @@ -3439,6 +3438,11 @@ static int nl80211_new_interface(struct sk_buff *skb, 
> struct genl_info *info)
>                       return err;
>       }
>  
> +     if (!(rdev->wiphy.interface_modes & (1 << type)) &&
> +         !(type == NL80211_IFTYPE_AP_VLAN && params.use_4addr &&
> +           rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP))
> +             return -EOPNOTSUPP;
> +

I also wonder if we shouldn't go "all in" and actually make the check
something like

  check_interface_allowed(iftype, 4addr):
    if (iftype == AP_VLAN && 4addr)
      return wiphy.flags & WIPHY_FLAG_4ADDR_AP;

    else return wiphy.interface_modes & BIT(iftype);

i.e. make it "you must have WIPHY_FLAG_4ADDR_AP to use 4-addr AP_VLAN
interfaces", rather than "also allow it in this case".

That would seem like the clearer semantics to me?

johannes

Reply via email to