All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net-ipv6: IPV6_TRANSPARENT - check NET_RAW prior to NET_ADMIN
@ 2019-11-21 21:19 Maciej Żenczykowski
  2019-11-22  3:15 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej Żenczykowski @ 2019-11-21 21:19 UTC (permalink / raw
  To: Maciej Żenczykowski, David S . Miller; +Cc: netdev

From: Maciej Żenczykowski <maze@google.com>

NET_RAW is less dangerous, so more likely to be available to a process,
so check it first to prevent some spurious logging.

This matches IP_TRANSPARENT which checks NET_RAW first.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv6/ipv6_sockglue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 264c292e7dcc..79fc012dd2ca 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -363,8 +363,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 		break;
 
 	case IPV6_TRANSPARENT:
-		if (valbool && !ns_capable(net->user_ns, CAP_NET_ADMIN) &&
-		    !ns_capable(net->user_ns, CAP_NET_RAW)) {
+		if (valbool && !ns_capable(net->user_ns, CAP_NET_RAW) &&
+		    !ns_capable(net->user_ns, CAP_NET_ADMIN)) {
 			retv = -EPERM;
 			break;
 		}
-- 
2.24.0.432.g9d3f5f5b63-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net-ipv6: IPV6_TRANSPARENT - check NET_RAW prior to NET_ADMIN
  2019-11-21 21:19 [PATCH] net-ipv6: IPV6_TRANSPARENT - check NET_RAW prior to NET_ADMIN Maciej Żenczykowski
@ 2019-11-22  3:15 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-11-22  3:15 UTC (permalink / raw
  To: zenczykowski; +Cc: maze, netdev

From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Thu, 21 Nov 2019 13:19:08 -0800

> From: Maciej Żenczykowski <maze@google.com>
> 
> NET_RAW is less dangerous, so more likely to be available to a process,
> so check it first to prevent some spurious logging.
> 
> This matches IP_TRANSPARENT which checks NET_RAW first.
> 
> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-22  3:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-21 21:19 [PATCH] net-ipv6: IPV6_TRANSPARENT - check NET_RAW prior to NET_ADMIN Maciej Żenczykowski
2019-11-22  3:15 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.