From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serhey Popovych Subject: [PATCH iproute2-next v2 0/8] ip: Introduce and use get_addr_rta()/inet_addr_match_rta() Date: Tue, 23 Jan 2018 21:19:22 +0200 Message-ID: <1516735170-20921-1-git-send-email-serhe.popovych@gmail.com> To: netdev@vger.kernel.org Return-path: Received: from mail-lf0-f53.google.com ([209.85.215.53]:37752 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751928AbeAWTTh (ORCPT ); Tue, 23 Jan 2018 14:19:37 -0500 Received: by mail-lf0-f53.google.com with SMTP id f3so2025451lfe.4 for ; Tue, 23 Jan 2018 11:19:36 -0800 (PST) Received: from tuxracer.localdomain ([2a01:6d80::195:20:96:53]) by smtp.gmail.com with ESMTPSA id u87sm162394lfk.8.2018.01.23.11.19.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 11:19:34 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: Now we enhance get_addr() to return additional information about address (e.g. if it unspecified or multicast) we want to have same functionality for attributes in netlink message. Introduce and use get_addr_rta() that parses given netlink attribute into @inet_prefix data structure in the same way similar get_addr() parses address from it's string representation. Use attribute length to guess address family: force it by giving non AF_UNSPEC @family to get_addr_rta() to ensure address is of expected family. Introduce and use inet_addr_match_rta() to further simplify and unify code where get_addr_rta() intended to be used together with inet_addr_match(). This is next step in ipv4 and ipv6 modules unification to prepare for merge in the future. Any comments, suggestions and criticism as always welcome. v2 Introduce and use inet_addr_match_rta() as suggested by David Ahern. Check for result from get_prefix() in places where inet_addr_match_rta() being used. Thanks, Serhii Serhey Popovych (8): utils: Introduce get_addr_rta() and inet_addr_match_rta() ipaddress: Use inet_addr_match_rta() iprule: Use inet_addr_match_rta() ipmroute: Use inet_addr_match_rta() ipneigh: Use inet_addr_match_rta() ipl2tp: Use get_addr_rta() tcp_metric: Use get_addr_rta() ip/tunnel: Unify local/remote endpoint address printing include/utils.h | 2 ++ ip/ipaddress.c | 29 ++++++----------- ip/ipl2tp.c | 37 +++++++++------------ ip/ipmroute.c | 26 ++++++--------- ip/ipneigh.c | 13 +++----- ip/iprule.c | 36 ++++++++++----------- ip/link_gre.c | 21 ++---------- ip/link_gre6.c | 26 ++------------- ip/link_ip6tnl.c | 15 ++------- ip/link_iptnl.c | 21 ++---------- ip/link_vti.c | 21 ++---------- ip/link_vti6.c | 21 ++---------- ip/tcp_metrics.c | 60 +++++++++++++++++----------------- ip/tunnel.c | 27 ++++++++++++++++ ip/tunnel.h | 2 ++ lib/utils.c | 95 +++++++++++++++++++++++++++++++++++++++++++----------- 16 files changed, 206 insertions(+), 246 deletions(-) -- 1.7.10.4