Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp767579lko; Tue, 13 Jul 2021 09:47:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxctmQ6AVglObJHRXOYxt0qkH1OuIT1qabx9PoB+oPAG5ZUccgbwxz+gvEiZH621x96r7QA X-Received: by 2002:a50:fa94:: with SMTP id w20mr1603863edr.275.1626194844000; Tue, 13 Jul 2021 09:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626194843; cv=none; d=google.com; s=arc-20160816; b=gT5LZIHN2A+m768Dvk03FBYpk/iB8uWrKZ6riK/1xplKb/fGxBLyX6vGb0WR5B+YFv xbX6EYkWoc4PYd7/zhOKXNJ9HcpRuEiFHGhdsWcmqC2KwlmZ8wiCl8RxUldyVLq+nQHJ gERD15QMttPBFclqUONyiHWzZ4+5f9jMcR4yxEXvFObQvE4BkKo+u9J5giNWQr46PjrQ ++Qz2aXX/XXAdhy9bfsCzot/JKal+G4PFLIl86f21O8zErZViav2gKxk0mR2bs9j3Uor aHclloSqHs3mImcEsu2ctiqTyOJa85G1gzvdD5fkDQbXxSQ5T8UgrCH/CWPPmSWExxWC wdiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=TTJ8LwE2YLzzQbluXnCR1S6PvuqP3zGFAOpQWY9Sbpw=; b=Agdg5ReZ4Jx27koBhjOX7+M1/ZDAhB2FNm31sMoXsKzq5oWvP1nppOVuWd9mOilqX2 FjnkXrIeCMLzWy4uQfmaB0ry6MZf+sAvwiLtI1vlhhFJrF/aBX8GxxcGe1gPA2nrvfzk kBQOlZzb2nC08DGYeKMB5S0bPxpvsnc/HGNsaobC5uiWpgUDTXlrKyOlQkpbvwA/TZoD WX0S1yXZ8EhmY4bOZmI9slf6lA7TyrRqwSHtdilv+pLaoqO29muuGQvQmRY9G19YenfO aJOp+xRA+X+iGXMMq4HBxOUHyJe6oTiwDGHocqjQGIQbV8jAP/8Jb/fJAV86+wvw9rm2 s/HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=fZN9m2J6; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si712153edx.468.2021.07.13.09.46.57; Tue, 13 Jul 2021 09:47:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=fZN9m2J6; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbhGMQtP (ORCPT + 99 others); Tue, 13 Jul 2021 12:49:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbhGMQtO (ORCPT ); Tue, 13 Jul 2021 12:49:14 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C06C0613DD; Tue, 13 Jul 2021 09:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=TTJ8LwE2YLzzQbluXnCR1S6PvuqP3zGFAOpQWY9Sbpw=; t=1626194784; x=1627404384; b=fZN9m2J6Al1zbS6LSebaDMukWsmtgZC49sSVeRBP2yl+x2o U+j9D6zvlWBIeQDfr5dVSXibkmgf9DLFc/hyliQLcF1fkSnh4eQ+axdhGJJCqLxsejW8oSU/SK7+6 XTuu03cqjbE2J15HCMiihj9YYHUaetjszfIDzWNlI19a5kENSOCOGvT//PUS48KtDuFtAS1QHQqo3 qftp8ncqDBwA6oPuHmy5PU2nkV5BZyL0TkYpcrLnqMcQf+zcXwH3lavBMMYeA3QFrx7TKNl3JbewI VfYbADIN7lz+IwlltON8m7I+4ZZAGXvU2TXrmctXatLW4IBHa0LIZFWxpYVhYulA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1m3LY5-001pwk-5W; Tue, 13 Jul 2021 18:46:21 +0200 Message-ID: <6d8e441da60ce29d0007c5a6cf173e0a7a1353f6.camel@sipsolutions.net> Subject: Re: [RFC 1/7] mac80211: add support for .ndo_fill_forward_path From: Johannes Berg To: Felix Fietkau , linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, pablo@netfilter.org, ryder.lee@mediatek.com Date: Tue, 13 Jul 2021 18:46:20 +0200 In-Reply-To: <20210713160745.59707-2-nbd@nbd.name> References: <20210713160745.59707-1-nbd@nbd.name> <20210713160745.59707-2-nbd@nbd.name> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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