From patchwork Tue Jan 6 16:23:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 425739 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EC4DB1400A0 for ; Wed, 7 Jan 2015 03:23:56 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755383AbbAFQXw (ORCPT ); Tue, 6 Jan 2015 11:23:52 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:41140 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbbAFQXv (ORCPT ); Tue, 6 Jan 2015 11:23:51 -0500 Received: by mail-wi0-f175.google.com with SMTP id l15so5675177wiw.14 for ; Tue, 06 Jan 2015 08:23:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Mr/K4T24RR5bosQy0ufvjCTAM1G13BBR6OjQVf6QKpY=; b=ZrrpMgxoOcDwXp2L6TWNrL28v+WdZ9VnX/e7XibzzV+gNcd24ZV8UzRuB87uFEuM/c Vtegd5mVNgKQqvYS+Lv+6yvhY81IVy7yyR79SQ99dnZDIaszv+FHnohHWQbYB+Kdh9Fs VKiSD2C74zeAP4Ql+vrTiZtkTOdjOvkl/Leae/F7dZjssMAUpil/meugTc2FaL2+4OyZ 8ianhgf3nv/LDDSI1yz3nfjL50u96GKqpr4+BUDOt7WhdW0G61rUrOgW8xTTpv7rgsuN dBbfUWVdjhjrZJaq00SS3UQ6aLMmz+/znUtBH7YwKHTMCxv1+9qkjzS+GsNkdYaA3hdl potg== X-Gm-Message-State: ALoCoQl3CrpxBQo7WxYYj6iW2udiSg4N6MzPGE6Tzv70ah5ozCG7UK2yR5Z+yTR8YbbpcKVFSa5d X-Received: by 10.180.206.165 with SMTP id lp5mr38529461wic.83.1420561430232; Tue, 06 Jan 2015 08:23:50 -0800 (PST) Received: from localhost ([94.230.147.47]) by mx.google.com with ESMTPSA id h13sm14535303wiw.4.2015.01.06.08.23.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jan 2015 08:23:49 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, thaller@redhat.com Subject: [patch iproute2 2/2] iplink: print out addrgenmode attribute Date: Tue, 6 Jan 2015 17:23:46 +0100 Message-Id: <1420561426-3118-2-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1420561426-3118-1-git-send-email-jiri@resnulli.us> References: <1420561426-3118-1-git-send-email-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org addrgenmode is currently write only by ip. So display this information if provided by kernel as well. Signed-off-by: Jiri Pirko --- ip/ipaddress.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 4d99324..0a04d90 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -242,6 +242,29 @@ static void print_linktype(FILE *fp, struct rtattr *tb) } } +static void print_af_spec(FILE *fp, struct rtattr *af_spec_attr) +{ + struct rtattr *inet6_attr; + struct rtattr *tb[IFLA_INET6_MAX + 1]; + + inet6_attr = parse_rtattr_one_nested(AF_INET6, af_spec_attr); + if (!inet6_attr) + return; + + parse_rtattr_nested(tb, IFLA_INET6_MAX, inet6_attr); + + if (tb[IFLA_INET6_ADDR_GEN_MODE]) { + switch (rta_getattr_u8(tb[IFLA_INET6_ADDR_GEN_MODE])) { + case IN6_ADDR_GEN_MODE_EUI64: + fprintf(fp, "addrgenmode eui64 "); + break; + case IN6_ADDR_GEN_MODE_NONE: + fprintf(fp, "addrgenmode none "); + break; + } + } +} + static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) { struct ifla_vf_mac *vf_mac; @@ -634,6 +657,9 @@ int print_linkinfo(const struct sockaddr_nl *who, if (do_link && tb[IFLA_LINKINFO] && show_details) print_linktype(fp, tb[IFLA_LINKINFO]); + if (do_link && tb[IFLA_AF_SPEC] && show_details) + print_af_spec(fp, tb[IFLA_AF_SPEC]); + if (do_link && tb[IFLA_IFALIAS]) { fprintf(fp, "%s alias %s", _SL_, rta_getattr_str(tb[IFLA_IFALIAS]));