From b55848941adad2e712f0b3487c10cd363671e3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Thu, 20 Oct 2011 18:21:36 -0400 Subject: [PATCH] --- yaml --- r: 266898 b: refs/heads/master c: 6cc7a765c2987f03ba278dac03c7cc759ee198e7 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/capability.h | 3 ++- trunk/net/ipv4/ip_sockglue.c | 2 +- trunk/net/ipv6/ipv6_sockglue.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index ab6fdd57a033..669d7f0bcd3e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 05bdd2f14351176d368e8ddc67993690a2d1bfb6 +refs/heads/master: 6cc7a765c2987f03ba278dac03c7cc759ee198e7 diff --git a/trunk/include/linux/capability.h b/trunk/include/linux/capability.h index c42112350003..a63d13d84ad8 100644 --- a/trunk/include/linux/capability.h +++ b/trunk/include/linux/capability.h @@ -198,7 +198,7 @@ struct cpu_vfs_cap_data { /* Allow modification of routing tables */ /* Allow setting arbitrary process / process group ownership on sockets */ -/* Allow binding to any address for transparent proxying */ +/* Allow binding to any address for transparent proxying (also via NET_RAW) */ /* Allow setting TOS (type of service) */ /* Allow setting promiscuous mode */ /* Allow clearing driver statistics */ @@ -210,6 +210,7 @@ struct cpu_vfs_cap_data { /* Allow use of RAW sockets */ /* Allow use of PACKET sockets */ +/* Allow binding to any address for transparent proxying (also via NET_ADMIN) */ #define CAP_NET_RAW 13 diff --git a/trunk/net/ipv4/ip_sockglue.c b/trunk/net/ipv4/ip_sockglue.c index 8905e92f896a..f0dc3ad662ae 100644 --- a/trunk/net/ipv4/ip_sockglue.c +++ b/trunk/net/ipv4/ip_sockglue.c @@ -961,7 +961,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, break; case IP_TRANSPARENT: - if (!capable(CAP_NET_ADMIN)) { + if (!!val && !capable(CAP_NET_RAW) && !capable(CAP_NET_ADMIN)) { err = -EPERM; break; } diff --git a/trunk/net/ipv6/ipv6_sockglue.c b/trunk/net/ipv6/ipv6_sockglue.c index 2fbda5fc4cc4..c99e3ee9781f 100644 --- a/trunk/net/ipv6/ipv6_sockglue.c +++ b/trunk/net/ipv6/ipv6_sockglue.c @@ -343,7 +343,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, break; case IPV6_TRANSPARENT: - if (!capable(CAP_NET_ADMIN)) { + if (valbool && !capable(CAP_NET_ADMIN) && !capable(CAP_NET_RAW)) { retv = -EPERM; break; }