From patchwork Wed Jan 18 21:34:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Baechle X-Patchwork-Id: 486169 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=-10.3 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED 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 AB985C432BE for ; Mon, 26 Jul 2021 19:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F57560F8F for ; Mon, 26 Jul 2021 19:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232854AbhGZSYJ (ORCPT ); Mon, 26 Jul 2021 14:24:09 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:44737 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbhGZSYG (ORCPT ); Mon, 26 Jul 2021 14:24:06 -0400 Received: from h7.dl5rb.org.uk (p57907709.dip0.t-ipconnect.de [87.144.119.9]) (Authenticated sender: ralf@linux-mips.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id D655D200007; Mon, 26 Jul 2021 19:04:33 +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 16QJ4XGC836369 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 26 Jul 2021 21:04:33 +0200 Received: (from ralf@localhost) by h7.dl5rb.org.uk (8.16.1/8.16.1/Submit) id 16QJ4XBp836368; Mon, 26 Jul 2021 21:04:33 +0200 Message-Id: <2ab3e7655dac7a5493a388793dce45afae5781e8.1627295848.git.ralf@linux-mips.org> In-Reply-To: References: From: Ralf Baechle Date: Wed, 18 Jan 2017 22:34:39 +0100 Subject: [PATCH 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)