From patchwork Wed Jan 18 22:19:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Baechle X-Patchwork-Id: 12400655 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 DAD92C4338F for ; Mon, 26 Jul 2021 19:04:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC16560F11 for ; Mon, 26 Jul 2021 19:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232958AbhGZSYL (ORCPT ); Mon, 26 Jul 2021 14:24:11 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:55113 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232518AbhGZSYG (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 65D06200006; 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 16QJ4Wrm836361 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 26 Jul 2021 21:04:32 +0200 Received: (from ralf@localhost) by h7.dl5rb.org.uk (8.16.1/8.16.1/Submit) id 16QJ4WBE836360; Mon, 26 Jul 2021 21:04:32 +0200 Message-Id: <48e5a534453d2da234946bd1da7d609b3c0b8c60.1627295848.git.ralf@linux-mips.org> In-Reply-To: References: From: Ralf Baechle Date: Wed, 18 Jan 2017 23:19:22 +0100 Subject: [PATCH 4/6] NETROM: 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 an OSI layer 3 protocol sitting on top of AX.25. It also uses AX.25 addresses. Without this commit ip will print NETROM address like link/generic 98:92:9c:aa:b0:40:02 brd 00:00:00:00:00:00:00 while with this commit the decoded result link/generic LINUX-1 brd * is much more eye friendly. 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 910e6daf..46e30c79 100644 --- a/lib/ll_addr.c +++ b/lib/ll_addr.c @@ -41,6 +41,8 @@ const char *ll_addr_n2a(const unsigned char *addr, int alen, int type, return inet_ntop(AF_INET6, addr, buf, blen); if (alen == 7 && type == ARPHRD_AX25) return ax25_ntop(AF_AX25, addr, buf, blen); + if (alen == 7 && type == ARPHRD_NETROM) + return netrom_ntop(AF_NETROM, addr, buf, blen); snprintf(buf, blen, "%02x", addr[0]); for (i = 1, l = 2; i < alen && l < blen; i++, l += 3)