From patchwork Sat Feb 15 02:59:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 320607 X-Patchwork-Delegate: davem@davemloft.net 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 CBD902C0079 for ; Sat, 15 Feb 2014 14:01:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478AbaBODAu (ORCPT ); Fri, 14 Feb 2014 22:00:50 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:65379 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752026AbaBOC76 (ORCPT ); Fri, 14 Feb 2014 21:59:58 -0500 Received: by mail-pd0-f174.google.com with SMTP id z10so12632296pdj.19 for ; Fri, 14 Feb 2014 18:59:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=RPZzAH9NBmo76+2Gqb0J3Z476Uznh3/zDgCxK4lFFlk=; b=D3G5Y2HmwiabMM98v9F8TTP7uopjd2l334G6vwTOzNpG98GWfuNIcFl0oXV28UuR/w kNWw2gXQH83DcJGZFi5IyE7CzZu+AfYEMyETxVy+HDzgzZOB38dJ8zldMzbZ/u8e1s8x 08e/9j0nXwsgh0Z0Y9i3yXm257oWcO5io2yPRezYWrPKjyrX6zw2IH795YMThqKpOaYo ttWYZAgQtfEza3EezXkCA+h7qgSNlD79YMRWN+EZaXvvUQj/Cq6FOzNgAoTh9uMKk4Wf 7xXxqNHuEf8KfL/Gs0anWp5Sb0L0Cm8iTcxukfAyf6fD+HIxSrhO77JcYd9qwpiJgMVA NEvw== X-Received: by 10.66.156.4 with SMTP id wa4mr13022842pab.49.1392433197890; Fri, 14 Feb 2014 18:59:57 -0800 (PST) Received: from mcgrof@gmail.com (c-24-7-61-223.hsd1.ca.comcast.net. [24.7.61.223]) by mx.google.com with ESMTPSA id iq10sm22184658pbc.14.2014.02.14.18.59.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 14 Feb 2014 18:59:56 -0800 (PST) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Fri, 14 Feb 2014 18:59:52 -0800 From: "Luis R. Rodriguez" To: netdev@vger.kernel.org Cc: xen-devel@lists.xenproject.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy Subject: [RFC v2 2/4] net: enables interface option to skip IP Date: Fri, 14 Feb 2014 18:59:38 -0800 Message-Id: <1392433180-16052-3-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1392433180-16052-1-git-send-email-mcgrof@do-not-panic.com> References: <1392433180-16052-1-git-send-email-mcgrof@do-not-panic.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: "Luis R. Rodriguez" Some interfaces do not need to have any IPv4 or IPv6 addresses, so enable an option to specify this. One example where this is observed are virtualization backend interfaces which just use the net_device constructs to help with their respective frontends. This should optimize boot time and complexity on virtualization environments for each backend interface while also avoiding triggering SLAAC and DAD, which is simply pointless for these type of interfaces. Cc: "David S. Miller" cC: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Luis R. Rodriguez --- include/uapi/linux/if.h | 1 + net/ipv4/devinet.c | 3 +++ net/ipv6/addrconf.c | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h index 8d10382..566d856 100644 --- a/include/uapi/linux/if.h +++ b/include/uapi/linux/if.h @@ -85,6 +85,7 @@ * change when it's running */ #define IFF_MACVLAN 0x200000 /* Macvlan device */ #define IFF_BRIDGE_NON_ROOT 0x400000 /* Don't consider for root bridge */ +#define IFF_SKIP_IP 0x800000 /* Skip IPv4, IPv6 */ #define IF_GET_IFACE 0x0001 /* for querying only */ diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index a1b5bcb..8e9ef07 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1342,6 +1342,9 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, ASSERT_RTNL(); + if (dev->priv_flags & IFF_SKIP_IP) + goto out; + if (!in_dev) { if (event == NETDEV_REGISTER) { in_dev = inetdev_init(dev); diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 4b6b720..57f58e3 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -314,6 +314,9 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) ASSERT_RTNL(); + if (dev->priv_flags & IFF_SKIP_IP) + return NULL; + if (dev->mtu < IPV6_MIN_MTU) return NULL; @@ -2749,6 +2752,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, int run_pending = 0; int err; + if (dev->priv_flags & IFF_SKIP_IP) + return NOTIFY_OK; + switch (event) { case NETDEV_REGISTER: if (!idev && dev->mtu >= IPV6_MIN_MTU) {