From patchwork Sun Sep 19 13:30:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Baechle X-Patchwork-Id: 12505555 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.4 required=3.0 tests=BAYES_00,DATE_IN_PAST_24_48, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24B44C433F5 for ; Mon, 20 Sep 2021 14:36:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0344C610CE for ; Mon, 20 Sep 2021 14:36:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240533AbhITOh4 (ORCPT ); Mon, 20 Sep 2021 10:37:56 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:56953 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237382AbhITOhm (ORCPT ); Mon, 20 Sep 2021 10:37:42 -0400 Received: from h7.dl5rb.org.uk (p5790756f.dip0.t-ipconnect.de [87.144.117.111]) (Authenticated sender: ralf@linux-mips.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id BCA6624000B; Mon, 20 Sep 2021 14:36:14 +0000 (UTC) Received: from h7.dl5rb.org.uk (localhost [127.0.0.1]) by h7.dl5rb.org.uk (8.16.1/8.16.1) with ESMTPS id 18KEaDJc1202547 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 20 Sep 2021 16:36:13 +0200 Received: (from ralf@localhost) by h7.dl5rb.org.uk (8.16.1/8.16.1/Submit) id 18KEaDQh1202546; Mon, 20 Sep 2021 16:36:13 +0200 Message-Id: <66f18d42c5b54b47110d323b62b2bca09f960282.1632059758.git.ralf@linux-mips.org> In-Reply-To: References: From: Ralf Baechle Date: Sun, 19 Sep 2021 15:30:26 +0200 Subject: [PATCH v2 6/6] ROSE: Print decoded addresses rather than hex numbers. To: Stephen Hemminger Cc: netdev@vger.kernel.org, linux-hams@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org NETROM is a OSI layer 3 protocol sitting on top of AX.25. It uses BCD- encoded 10 digit telephone numbers as addresses. Without this ip will print a ROSE addresses like link/rose 12:34:56:78:90 brd 00:00:00:00:00 which is readable but ugly. With this applied it ROSE addresses will be printed as link/rose 1234567890 brd 0000000000 Signed-off-by: Ralf Baechle --- lib/ll_addr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ll_addr.c b/lib/ll_addr.c index 46e30c79..d6fd736b 100644 --- a/lib/ll_addr.c +++ b/lib/ll_addr.c @@ -43,6 +43,8 @@ const char *ll_addr_n2a(const unsigned char *addr, int alen, int type, return ax25_ntop(AF_AX25, addr, buf, blen); if (alen == 7 && type == ARPHRD_NETROM) return netrom_ntop(AF_NETROM, addr, buf, blen); + if (alen == 5 && type == ARPHRD_ROSE) + return rose_ntop(AF_ROSE, addr, buf, blen); snprintf(buf, blen, "%02x", addr[0]); for (i = 1, l = 2; i < alen && l < blen; i++, l += 3)