netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: John Heffner <jheffner@psc.edu>, "David S. Miller" <davem@davemloft.net>
Cc: Hagen Paul Pfeifer <hagen@jauu.net>, netdev@vger.kernel.org
Subject: [PATCH] tcp: allow restricting congestion control choices
Date: Fri, 27 Oct 2006 10:59:00 -0700	[thread overview]
Message-ID: <20061027105900.758e78b9@freekitty> (raw)
In-Reply-To: <4542452C.6050209@psc.edu>

Here is an alternative that allows runtime based restriction on some
TCP congestion control choices. 

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

---
 include/net/tcp.h   |    1 +
 net/ipv4/tcp_cong.c |    4 ++++
 2 files changed, 5 insertions(+)

--- sky2.orig/include/net/tcp.h	2006-10-27 10:46:19.000000000 -0700
+++ sky2/include/net/tcp.h	2006-10-27 10:46:55.000000000 -0700
@@ -651,6 +651,7 @@
 
 	char 		name[TCP_CA_NAME_MAX];
 	struct module 	*owner;
+	int		restricted;	/* NET_ADMIN only */
 };
 
 extern int tcp_register_congestion_control(struct tcp_congestion_ops *type);
--- sky2.orig/net/ipv4/tcp_cong.c	2006-10-27 10:51:47.000000000 -0700
+++ sky2/net/ipv4/tcp_cong.c	2006-10-27 10:56:36.000000000 -0700
@@ -10,6 +10,7 @@
 #include <linux/mm.h>
 #include <linux/types.h>
 #include <linux/list.h>
+#include <linux/capability.h>
 #include <net/tcp.h>
 
 static DEFINE_SPINLOCK(tcp_cong_list_lock);
@@ -159,6 +160,9 @@
 	if (!ca)
 		err = -ENOENT;
 
+	else if (ca->restricted && !capable(CAP_NET_ADMIN))
+		err = -EPERM;
+
 	else if (!try_module_get(ca->owner))
 		err = -EBUSY;
 

  reply	other threads:[~2006-10-27 17:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-25 18:08 [RFC] tcp: setsockopt congestion control autoload Stephen Hemminger
2006-10-25 23:21 ` Patrick McHardy
2006-10-26  5:22 ` Evgeniy Polyakov
2006-10-26 14:34   ` Stephen Hemminger
2006-10-26 14:57     ` Evgeniy Polyakov
2006-10-26 15:23       ` Stephen Hemminger
2006-10-26 17:05         ` Patrick McHardy
2006-10-26 20:55       ` David Miller
2006-10-26 17:29 ` John Heffner
2006-10-26 20:57   ` David Miller
2006-10-26 22:44   ` Hagen Paul Pfeifer
2006-10-26 22:53     ` John Heffner
2006-10-26 23:52     ` [PATCH] Check if user has CAP_NET_ADMIN to change congestion control algorithm Hagen Paul Pfeifer
2006-10-26 23:59       ` Ian McDonald
2006-10-27  0:07         ` David Miller
2006-10-27  0:20           ` Ian McDonald
2006-10-27  0:02       ` David Miller
2006-10-27 10:43         ` Hagen Paul Pfeifer
2006-10-27 14:41           ` Stephen Hemminger
2006-10-27 15:21             ` Hagen Paul Pfeifer
2006-10-27 15:48               ` Stephen Hemminger
2006-10-27 17:30                 ` [PATCH] tcp: don't allow unfair congestion control to be built without warning Stephen Hemminger
2006-10-27 17:43                   ` John Heffner
2006-10-27 17:59                     ` Stephen Hemminger [this message]
2006-10-27 21:17                   ` David Miller
2006-10-27 21:24                     ` Stephen Hemminger
2006-10-27 21:37                       ` David Miller
2006-10-27 21:59                         ` Stephen Hemminger
2006-10-27 22:12                           ` David Miller
2006-10-27 22:21                             ` Stephen Hemminger
2006-10-27 22:24                               ` David Miller
2006-10-28  0:48                                 ` Stephen Hemminger
2006-10-28  3:10                                   ` [RFC] tcp: available congetsion control Stephen Hemminger
2006-10-27 21:22             ` [PATCH] Check if user has CAP_NET_ADMIN to change congestion control algorithm David Miller
2006-10-27  1:03       ` Stephen Hemminger
2006-10-27 18:14 ` [PATCH] tcp: setsockopt congestion control autoload Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061027105900.758e78b9@freekitty \
    --to=shemminger@osdl.org \
    --cc=davem@davemloft.net \
    --cc=hagen@jauu.net \
    --cc=jheffner@psc.edu \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).