From patchwork Tue Jan 23 19:19:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhey Popovych X-Patchwork-Id: 864961 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b3f26ddL"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zQymD6f4lz9s4s for ; Wed, 24 Jan 2018 06:19:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751996AbeAWTTi (ORCPT ); Tue, 23 Jan 2018 14:19:38 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=vttvftuUx+sHQVZWdfmrsniSh/H4xcn+WBmm1p03R0o=; b=b3f26ddLsmeKj4RnxILIsfAX4sIrKyTP+EZW0kcbPrevZsYLsykgtqS0zo94bKKZ8e DlzfcC+R/cVDWprxiQVkvVQ+lg3CqLpLD3zgl47u4fmMkpBkrvEnig2EWi+NwG3vtqsY 4Oxr4T3Ys6BkXtiDFwiSMkmquzOsO045wMRarB00JQpDu4S41qYDu7CXxAxceieAQFI0 6jlZWo/Y1i8PNxvTfgwMqM4YFd9TtG16PJz+pDUF4edp03K2SVKjMiZWTTwWqp/fFSDR zIipkPG+Kno8GcTr1nXRvWHL/NbxhL5DrXRt4MO4T64KSQQ4QEip9Xcb/a2YCFsmK7ar bTHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=vttvftuUx+sHQVZWdfmrsniSh/H4xcn+WBmm1p03R0o=; b=nFdVcwSjUWuw8pvv7xwTAm44Z8AqI7QyuMm1BANC7WIz/20wtkUP0ZgNZKzlcZiXUF fIAay/8pjVblXka3y3qp/szzr9ESUSIZLohLN+gRgMQZ2Fhhh67+HIelc6GK88tyOJZX rD3sdKxO47OpjFNK2hnRIwUFxSKLYqOxurRpbQG0CdcdTm6lSoOIkW2YOBxiDjiY2YCc 2UObn/xWNMtDINpIR+ZlYLv8UZ8uOgMWRgf2KpeTHTN2SDvgX40EAB1b/7mMWiN5fLow Lzd9afyYSrnPPNI9vbZjfanoJCepBVrRbH325FWVfYUwYPBj2Cz1X+dLN9GBFZAnILtM cqYA== X-Gm-Message-State: AKwxyterQlbH7IAPJGAVpGIcGbWMho4N2qWM1adpbB3jxKMOVVardCpa C3aGf/jSrOlOojVGSfCLpk/yaQ== X-Google-Smtp-Source: AH8x227j6UxYZfjeD4oq1Z+v72cSGFwcnQb0dmhORwd6VXcTGx2Gct7XdDi6fberfkuLTlkJBt2sMg== X-Received: by 10.46.9.70 with SMTP id 67mr1898971ljj.124.1516735175588; Tue, 23 Jan 2018 11:19:35 -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) From: Serhey Popovych To: netdev@vger.kernel.org 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> X-Mailer: git-send-email 1.7.10.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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(-)