Re: [RFC 1/7] mac80211: add support for .ndo_fill_forward_path

Johannes Berg
2021-07-13T16:46:26Z

On Tue, 2021-07-13 at 18:07 +0200, Felix Fietkau wrote:
> +
> +static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx,
> + struct net_device_path *path)
> +{
> + struct ieee80211_sub_if_data *sdata;
> + struct ieee80211_local *local;
> + struct sta_info *sta;
> + int ret = -ENOENT;
> +
> + sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev);
> + local = sdata->local;
> +
> + if (!local->ops->net_fill_forward_path)
> + return -EOPNOTSUPP;
> +
> + rcu_read_lock();
> + switch (sdata->vif.type) {
> + case NL80211_IFTYPE_AP_VLAN:
> + sta = rcu_dereference(sdata->u.vlan.sta);
> + if (sta)
> + break;
> + if (!sdata->wdev.use_4addr)
> + goto out;

Am I confusing things, or is this condition inverted? If it's not 4-addr
then you won't have a u.vlan.sta, but you might still want to look up
the station more generally, no?

> + fallthrough;
> + case NL80211_IFTYPE_AP:
> + if (is_multicast_ether_addr(ctx->daddr))
> + goto out;
> + sta = sta_info_get_bss(sdata, ctx->daddr);

Or maybe this shouldn't use _bss() here, but then you'd need to write a
sta_info_get() also in the VLAN case, no?

Which might actually be better or even correct, because if the station
is on the VLAN you probably *don't* want to find it here if the
interface that's being passed is the AP, no?

johannes