Patchwork net: use INET_ECN_MASK instead of hardcoded 3

login
register
mail settings
Submitter Maciej Żenczykowski
Date Oct. 21, 2011, 11:11 p.m.
Message ID <1319238710-11272-1-git-send-email-zenczykowski@gmail.com>
Download mbox | patch
Permalink /patch/121091/
State Accepted
Delegated to: David Miller
Headers show

Comments

Maciej Żenczykowski - Oct. 21, 2011, 11:11 p.m.
From: Maciej Żenczykowski <maze@google.com>

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv4/ip_sockglue.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
David Miller - Oct. 22, 2011, 4:08 a.m.
From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Fri, 21 Oct 2011 16:11:50 -0700

> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index f0dc3ad..09ff51b 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -33,6 +33,7 @@ 
 #include <linux/netfilter.h>
 #include <linux/route.h>
 #include <linux/mroute.h>
+#include <net/inet_ecn.h>
 #include <net/route.h>
 #include <net/xfrm.h>
 #include <net/compat.h>
@@ -578,8 +579,8 @@  static int do_ip_setsockopt(struct sock *sk, int level,
 		break;
 	case IP_TOS:	/* This sets both TOS and Precedence */
 		if (sk->sk_type == SOCK_STREAM) {
-			val &= ~3;
-			val |= inet->tos & 3;
+			val &= ~INET_ECN_MASK;
+			val |= inet->tos & INET_ECN_MASK;
 		}
 		if (inet->tos != val) {
 			inet->tos = val;