Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3944638rdb; Thu, 14 Sep 2023 07:27:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnycwG/evQvrEoiPkESi0U42btk7okNQQvICvhFI0F4pYYAQ/gjq2GzOauPY9Y8w6XoDJA X-Received: by 2002:a05:6a20:3d0f:b0:133:6e3d:68cd with SMTP id y15-20020a056a203d0f00b001336e3d68cdmr6090129pzi.3.1694701653651; Thu, 14 Sep 2023 07:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694701653; cv=none; d=google.com; s=arc-20160816; b=Zt6aobjY2u3sj1M2w+oWKbltcHmM2ZGvYI31Zu64p/BwhtrFKvCEHmtG/Xiypm0WsB gOWkrYGJcVGIkPeBY0AwZ/QBoGlHvYeDOx7i3voUGV4wO3GePcAuk4VTTVBSIjLVo1Ww dUtWJTs/G9GVW20G8ns+k9lxASwhqAa453JM6JAe7Ql7fdWzThROPDxPL9Uz7pup7+8c RH17WWcZzo2XaD81C3a9Iqu2yrzKs2RKAGg4dHLv2TyWMtXnmokqbreD2t9haTRhk2xi jv98pUSXVHVwUEaO3iRcDrh4hP9WfsFrnN3n+yKgEJxNcdb/eBpyD7sPF3lEUcP30tVz yTcw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=E43S9VBhjuwYwLYR+zQD8HsSCmgwf9f6i9kez2c5CxY=; fh=cuZf9MNS4fasoz2DSbitSqfEgaqGDELWIntsMQRXu/s=; b=MfnxN3ml1mOH5AYMHrKFvcnn4CN+NcD1Dk5z6m0yMNda9u8xp+k4XP5P2FFGVxhE/9 h6zfMaQxiECZQzjgsC6/I130gxVUYM8P0Ax+QPlPY2P38AUhNjfwbuzNA2/TcjEwKWGX TJypInVFi3ZeZ1IB//PnTeYz4xTASFF+9lCcbXwjdFB6dppln/DsAF2k/G60/8t0rtR4 y9sUdLbBPeRJOJxkfbBEd8Xdr9uUCHZt/ne/XnL+hY8/Cfm9aVvLHK8vOoMu+Ow9YCCu wlahR9qdp7lsKfi0aSA86ycmFG0Btwj8cN16XyoMlL0MktkoD9RUsYRepzrT7E7vLOJp bxxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=ZY0QW8Ha; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ck7-20020a056a00328700b0067ff1a1ccbcsi1709222pfb.63.2023.09.14.07.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 07:27:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=ZY0QW8Ha; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 6B8228224DA0; Thu, 14 Sep 2023 05:48:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236954AbjINMrx (ORCPT + 99 others); Thu, 14 Sep 2023 08:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjINMrw (ORCPT ); Thu, 14 Sep 2023 08:47:52 -0400 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CF4B1FCC; Thu, 14 Sep 2023 05:47:48 -0700 (PDT) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 717C386940; Thu, 14 Sep 2023 14:47:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1694695667; bh=E43S9VBhjuwYwLYR+zQD8HsSCmgwf9f6i9kez2c5CxY=; h=From:To:Cc:Subject:Date:From; b=ZY0QW8HaGSTPGuNgJzhWV4HYojM0LbS50NUK1MHm1asJfFKYyokbmPS0jeqSrtp99 +17rxQPdxDLj6cQbbTF3IrX2ziNPg/+6BTWA2jIYKHQ5yt74aWnpnp+o0Sybx3L0ti 9JtyA/LeGAwG9bOxPkMBS5jy3SJLpes0cUsOKGlfbko3GbzYXyagC6jBvlm2fN4O7n qF6iOJdVOrRIiFi9HQ9Oy6WPd/scWn3E82GarIsTnPD2gmfiX6lKk6isuelWiMH0PN Hqqqy5tKsnJPqMzju2LYK1vmhwaFeIH0NOJm5JQjcLyE4vFHftU5eP1im7iFoFeaot dQuJE0seO+dQw== From: Lukasz Majewski To: Tristram.Ha@microchip.com, Eric Dumazet , davem@davemloft.net Cc: Andrew Lunn , Florian Fainelli , Jakub Kicinski , Sebastian Andrzej Siewior , Paolo Abeni , Kristian Overskeid , Matthieu Baerts , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH v2 net-next] net: hsr: Provide fix for HSRv1 supervisor frames decoding Date: Thu, 14 Sep 2023 14:47:30 +0200 Message-Id: <20230914124731.1654059-1-lukma@denx.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 14 Sep 2023 05:48:07 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Provide fix to decode correctly supervisory frames when HSRv1 version of the HSR protocol is used. Without this patch console is polluted with: ksz-switch spi1.0 lan1: hsr_addr_subst_dest: Unknown node as a result of destination node's A MAC address equals to: 00:00:00:00:00:00. cat /sys/kernel/debug/hsr/hsr0/node_table Node Table entries for (HSR) device MAC-Address-A, MAC-Address-B, time_in[A], time_in[B], Address-B 00:00:00:00:00:00 00:10:a1:94:77:30 400bf, 399c, 0 It was caused by wrong frames decoding in the hsr_handle_sup_frame(). As the supervisor frame is encapsulated in HSRv1 frame: SKB_I100000000: 01 15 4e 00 01 2d 00 10 a1 94 77 30 89 2f 00 34 SKB_I100000010: 02 59 88 fb 00 01 84 15 17 06 00 10 a1 94 77 30 SKB_I100000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 SKB_I100000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 SKB_I100000040: 00 00 The code had to be adjusted accordingly and the MAC-Address-A now has the proper address (the MAC-Address-B now has all 0's). Fixes: eafaa88b3eb7 ("net: hsr: Add support for redbox supervision frames")' Signed-off-by: Lukasz Majewski --- Changes for v2: - Use the proper parsing code altered with eafaa88b3eb7f --- net/hsr/hsr_framereg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index b77f1189d19d..6d14d935ee82 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -288,13 +288,13 @@ void hsr_handle_sup_frame(struct hsr_frame_info *frame) /* And leave the HSR tag. */ if (ethhdr->h_proto == htons(ETH_P_HSR)) { - pull_size = sizeof(struct ethhdr); + pull_size = sizeof(struct hsr_tag); skb_pull(skb, pull_size); total_pull_size += pull_size; } /* And leave the HSR sup tag. */ - pull_size = sizeof(struct hsr_tag); + pull_size = sizeof(struct hsr_sup_tag); skb_pull(skb, pull_size); total_pull_size += pull_size; -- 2.20.1