From patchwork Mon Dec 2 05:05:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 18713 X-Patchwork-Delegate: a@unstable.cc Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 8C78C8422C for ; Mon, 2 Dec 2024 06:38:24 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1733117904; b=SWpLLqK4qrSn74NCpZ7Mm4EoukJnW+mPHao3FsnxM+gjjbeQJf8rZH+3QYx2fEHYB+mw0 V5Uw7uTbSnKwXZ2IaCgMBDdCVf/Nmrvd689ItJeTZZ9szyxki/oo0X6RpDH4j5uxdz/y+6b wd4b/tbjua2M6qf58ucBOMiLvoaKafM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1733117904; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=+zbkL+0a+p5KxOrsos7HeAPMA6VAfsNwNEoVrIv5mhY=; b=ugAPNAxpf676rsn+AayWQsdG2Nxo7lKwutv+7nfe3/43UJXPE9o+V/YCD7U4bgVAKQlhz upUkVgh+wRzj/+y0GLn44hDH2IHL6oxsAT1xzmxvheQkqJumuL7XyaWBiF5E0zNz1M+jxtB D6aJFaGiHpQCsVeeS88k8P4FkcLDuaA= ARC-Authentication-Results: i=2; open-mesh.org; dkim=fail; arc=pass; dmarc=none Authentication-Results: open-mesh.org; dkim=fail; arc=pass; dmarc=none Received: from mail.aperture-lab.de (mail.aperture-lab.de [IPv6:2a01:4f8:c2c:665b::1]) by diktynna.open-mesh.org (Postfix) with ESMTPS id EE61C83C01 for ; Mon, 2 Dec 2024 06:35:23 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1733117724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+zbkL+0a+p5KxOrsos7HeAPMA6VAfsNwNEoVrIv5mhY=; b=sMfrjaJKK7XpgksSr/B6N+dgp1SPw4XJ0bItWCwtVpaKWAmImS1ELvNKdEch0DomHgeM6z b54VBJoU8tSDhYDS86wuwOHlsycWwM2tJp2EQYt3lMpygLhe11jk2eEjH4ynsS+BFrZ2wl l/FBHJSaZDECxISGFKo7v5uvpHDNNDk= ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1733117724; a=rsa-sha256; cv=none; b=FH17utuVNOoloRAVh+Aksf8yOFGmovEv5NRHFHbJrk0ANEocux/QWjMocgravHA8B5aAqV deI7P7LeDS4Rvh5W7fKWkU1m9l5VVyR5kwOdp8/UwNlwTIrEd9KS1lnUQqdSRWF8RNeikY dSppmTh6uVsQqV895ZtdMeuiN4i9TXY= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=none; spf=pass (diktynna.open-mesh.org: domain of linus.luessing@c0d3.blue designates 2a01:4f8:c2c:665b::1 as permitted sender) smtp.mailfrom=linus.luessing@c0d3.blue; dmarc=none Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 96038541073; Mon, 2 Dec 2024 06:35:23 +0100 (CET) From: =?utf-8?q?Linus_L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Cc: =?utf-8?q?Linus_L=C3=BCssing?= Subject: [PATCH v3 3/3] batman-adv: avoid adding VLAN IDs 0 + 1 through kernel events Date: Mon, 2 Dec 2024 06:05:22 +0100 Message-ID: <20241202053511.326-4-linus.luessing@c0d3.blue> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241202053511.326-1-linus.luessing@c0d3.blue> References: <20241202053511.326-1-linus.luessing@c0d3.blue> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 Message-ID-Hash: ORZPIX2BQQNHZEIY6R3AFRK3RVICONTC X-Message-ID-Hash: ORZPIX2BQQNHZEIY6R3AFRK3RVICONTC X-MailFrom: linus.luessing@c0d3.blue X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Currently the 8021q module always registers VLAN ID 0 and the Linux bridge always registers VLAN ID 1 if bat0 is added to a bridge (probably as a quirk for hardware network/switch device drivers). Even though we might not actually use them over the mesh. The issue is that any extra VLAN currently increases our own OGM protocol overhead quite a bit, so we want to avoid that by only adding VLANs that we are sure someone will be using. So only add VLAN IDs 0 and 1 through snooping of actual, VLAN tagged traffic, not through kernel internal network events. Signed-off-by: Linus Lüssing --- net/batman-adv/soft-interface.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index d08f5e99f39f..7a6287575505 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -699,6 +699,20 @@ static int batadv_interface_add_vid(struct net_device *dev, __be16 proto, if (proto != htons(ETH_P_8021Q)) return -EINVAL; + /* + * Currently the 8021q module always registers VLAN ID 0 and the Linux + * bridge always registers VLAN ID 1 if bat0 is added to a bridge + * (probably as a quirk for hardware network/switch device drivers). + * Even though we might not actually use them over the mesh. + * The issue is that any extra VLAN currently increases our own + * OGM protocol overhead quite a bit, so we want to avoid that + * by only adding VLANs that we are sure someone will be using. + * So only add VLAN IDs 0 and 1 through snooping of actual, VLAN tagged + * traffic, not through kernel internal network events. + */ + if (vid == 0 || vid == 1) + return 0; + vid |= BATADV_VLAN_HAS_TAG; return batadv_softif_create_vlan_own(bat_priv, vid); @@ -727,6 +741,9 @@ static int batadv_interface_kill_vid(struct net_device *dev, __be16 proto, if (proto != htons(ETH_P_8021Q)) return -EINVAL; + if (vid == 0 || vid == 1) + return 0; + batadv_softif_destroy_vlan_own(bat_priv, vid | BATADV_VLAN_HAS_TAG); return 0; }