From patchwork Tue Apr 24 02:56:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Novakovic X-Patchwork-Id: 903257 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=none (p=none dis=none) header.from=chrisn.me.uk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chrisn.me.uk header.i=@chrisn.me.uk header.b="eN7jF9a9"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40VSgH07QXz9rx7 for ; Tue, 24 Apr 2018 12:57:46 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932901AbeDXC5n (ORCPT ); Mon, 23 Apr 2018 22:57:43 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:39998 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932861AbeDXC5F (ORCPT ); Mon, 23 Apr 2018 22:57:05 -0400 Received: by mail-wr0-f193.google.com with SMTP id v60-v6so46377141wrc.7 for ; Mon, 23 Apr 2018 19:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisn.me.uk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q/V76x6GK89/SuPYv+3BTd0bX4LQa0w7M3vFMxrC2+w=; b=eN7jF9a9neQmQLSdo4Wzj0Bb1tNsSS2yRWa1IOeyfWSllmUtU/M3UlJRjUz4aazO4G A8MeWtWhFZonJV5QGXlvASAGImWWAx/XWga0ghHlTrDeQ1u4f11xhAmBzZHgnXiSjEKy Jq2aJCPwZaU0seJvNpP7quB0yHYfzFBHA5cwI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q/V76x6GK89/SuPYv+3BTd0bX4LQa0w7M3vFMxrC2+w=; b=BFZTiY6m6nhJYfIT3CSeB6GnjbqPD0VaOUVwj5v7jKTnEr8+QbiNRij/em/lKrA+gh 3eI/JokEBgB+Gza23ptG5u/8bXY5+LVodczL+uvffBLOPWwLu0st2xjom4Iklcqmz4o9 j83VJw1ikf/jHVipqj0s/xUqCiIIuyMqLgWjRYBTXxv5MauaDG/CL/vm3m4u9DnkJK4T xYTdI4z4LNjcB90LL2I0kLrZbz1pbMLRb2mDJFXz9UaaiPGMb5gc3E+BV7rvQUpWqMZN U1ThXQxiQGMhxhvxkz3ENX6lewUrYIyKhwq/3U6UcAvtpsmvlTfQ2Gk+CplutYBG0Yi3 sS8g== X-Gm-Message-State: ALQs6tDZ52zWvzjYjLDEOIt8FQoHSabNWU6KyqpJuYd8t7Ei8FJ6OqNX Dd/zUL7sthstIgAGvfqflxAoWA== X-Google-Smtp-Source: AIpwx4/n6A+7UK7dYA26sqa4hfhmeACvFUDqoPXC1fD8Hep2W3wOofGYM3t2CQ2ICFBax/ksQx9EHA== X-Received: by 2002:adf:e28c:: with SMTP id v12-v6mr17517518wri.188.1524538624210; Mon, 23 Apr 2018 19:57:04 -0700 (PDT) Received: from stronghold.base.iphq.net (cpc83449-wolv18-2-0-cust181.16-1.cable.virginm.net. [82.32.71.182]) by smtp.gmail.com with ESMTPSA id b18-v6sm17407241wrb.55.2018.04.23.19.57.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Apr 2018 19:57:03 -0700 (PDT) From: Chris Novakovic To: "David S. Miller" , netdev@vger.kernel.org Cc: Chris Novakovic Subject: [PATCH v2 7/8] ipconfig: Create /proc/net/ipconfig directory Date: Tue, 24 Apr 2018 03:56:38 +0100 Message-Id: <20180424025639.2228-8-chris@chrisn.me.uk> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180424025639.2228-1-chris@chrisn.me.uk> References: <20180424025639.2228-1-chris@chrisn.me.uk> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org To allow ipconfig to report IP configuration details to user space processes without cluttering /proc/net, create a new subdirectory /proc/net/ipconfig. All files containing IP configuration details should be written to this directory. Signed-off-by: Chris Novakovic --- net/ipv4/ipconfig.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index e11dfd29a929..9abf833f3a99 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -158,6 +158,9 @@ static u8 ic_domain[64]; /* DNS (not NIS) domain name */ * Private state. */ +/* proc_dir_entry for /proc/net/ipconfig */ +static struct proc_dir_entry *ipconfig_dir; + /* Name of user-selected boot device */ static char user_dev_name[IFNAMSIZ] __initdata = { 0, }; @@ -1301,6 +1304,16 @@ static const struct file_operations pnp_seq_fops = { .llseek = seq_lseek, .release = single_release, }; + +/* Create the /proc/net/ipconfig directory */ +static int ipconfig_proc_net_init(void) +{ + ipconfig_dir = proc_net_mkdir(&init_net, "ipconfig", init_net.proc_net); + if (!ipconfig_dir) + return -ENOMEM; + + return 0; +} #endif /* CONFIG_PROC_FS */ /* @@ -1384,6 +1397,8 @@ static int __init ip_auto_config(void) #ifdef CONFIG_PROC_FS proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops); + + ipconfig_proc_net_init(); #endif /* CONFIG_PROC_FS */ if (!ic_enable)