diff options
author | Li RongQing <roy.qing.li@gmail.com> | 2014-01-15 04:03:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-15 18:53:18 -0500 |
commit | d76ed22b225c02228c643ae336f76e086fdc32f0 (patch) | |
tree | e420a54624555e185458c2d8a443820ef9a276e5 /net | |
parent | e96a41ebde3b66dbb59d3ffa0a38dff6e5ca25a9 (diff) |
ipv6: move IPV6_TCLASS_SHIFT into ipv6.h and define a helper
Two places defined IPV6_TCLASS_SHIFT, so we should move it into ipv6.h,
and use this macro as possible. And define ip6_tclass helper to return
tclass
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/fib6_rules.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_gre.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 2 | ||||
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 3 |
4 files changed, 3 insertions, 6 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 3fd0a578329e..b4d5e1d97c1b 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -169,7 +169,7 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | |||
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |
171 | 171 | ||
172 | if (r->tclass && r->tclass != ((ntohl(fl6->flowlabel) >> 20) & 0xff)) | 172 | if (r->tclass && r->tclass != ip6_tclass(fl6->flowlabel)) |
173 | return 0; | 173 | return 0; |
174 | 174 | ||
175 | return 1; | 175 | return 1; |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index e7a440dd5c0d..f3ffb43f59c0 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -61,8 +61,6 @@ static bool log_ecn_error = true; | |||
61 | module_param(log_ecn_error, bool, 0644); | 61 | module_param(log_ecn_error, bool, 0644); |
62 | MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); | 62 | MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); |
63 | 63 | ||
64 | #define IPV6_TCLASS_SHIFT 20 | ||
65 | |||
66 | #define HASH_SIZE_SHIFT 5 | 64 | #define HASH_SIZE_SHIFT 5 |
67 | #define HASH_SIZE (1 << HASH_SIZE_SHIFT) | 65 | #define HASH_SIZE (1 << HASH_SIZE_SHIFT) |
68 | 66 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 1e5e2404f1af..5db8d310f9c0 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -69,8 +69,6 @@ MODULE_ALIAS_NETDEV("ip6tnl0"); | |||
69 | #define IP6_TNL_TRACE(x...) do {;} while(0) | 69 | #define IP6_TNL_TRACE(x...) do {;} while(0) |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #define IPV6_TCLASS_SHIFT 20 | ||
73 | |||
74 | #define HASH_SIZE_SHIFT 5 | 72 | #define HASH_SIZE_SHIFT 5 |
75 | #define HASH_SIZE (1 << HASH_SIZE_SHIFT) | 73 | #define HASH_SIZE (1 << HASH_SIZE_SHIFT) |
76 | 74 | ||
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index af0ecb94b3b4..2855b00ed49d 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -1019,7 +1019,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
1019 | put_cmsg(&msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim); | 1019 | put_cmsg(&msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim); |
1020 | } | 1020 | } |
1021 | if (np->rxopt.bits.rxtclass) { | 1021 | if (np->rxopt.bits.rxtclass) { |
1022 | int tclass = ntohl(np->rcv_flowinfo & IPV6_TCLASS_MASK) >> 20; | 1022 | int tclass = (int)ip6_tclass(np->rcv_flowinfo); |
1023 | |||
1023 | put_cmsg(&msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass); | 1024 | put_cmsg(&msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass); |
1024 | } | 1025 | } |
1025 | if (np->rxopt.bits.rxoinfo) { | 1026 | if (np->rxopt.bits.rxoinfo) { |