aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-11-14 00:40:13 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:53:45 -0500
commit29bb43b4ec4e625b0659186fc8a7c8f8b7c81982 (patch)
tree8c04e70edb9ef5d0a76793add6b70cf530f41913
parenta2deb6d26f16ed7bf787dbd6a58c5d7be47d8db3 (diff)
[INET]: Give outer DSCP directly to ip*_copy_dscp
This patch changes the prototype of ipv4_copy_dscp and ipv6_copy_dscp so that they directly take the outer DSCP rather than the outer IP header. This will help us to unify the code for inter-family tunnels. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/inet_ecn.h8
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c2
-rw-r--r--net/ipv6/ip6_tunnel.c2
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c3
4 files changed, 8 insertions, 7 deletions
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index de8399a79774..ba33db053854 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -83,9 +83,9 @@ static inline void IP_ECN_clear(struct iphdr *iph)
83 iph->tos &= ~INET_ECN_MASK; 83 iph->tos &= ~INET_ECN_MASK;
84} 84}
85 85
86static inline void ipv4_copy_dscp(struct iphdr *outer, struct iphdr *inner) 86static inline void ipv4_copy_dscp(unsigned int dscp, struct iphdr *inner)
87{ 87{
88 u32 dscp = ipv4_get_dsfield(outer) & ~INET_ECN_MASK; 88 dscp &= ~INET_ECN_MASK;
89 ipv4_change_dsfield(inner, INET_ECN_MASK, dscp); 89 ipv4_change_dsfield(inner, INET_ECN_MASK, dscp);
90} 90}
91 91
@@ -104,9 +104,9 @@ static inline void IP6_ECN_clear(struct ipv6hdr *iph)
104 *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); 104 *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20);
105} 105}
106 106
107static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) 107static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
108{ 108{
109 u32 dscp = ipv6_get_dsfield(outer) & ~INET_ECN_MASK; 109 dscp &= ~INET_ECN_MASK;
110 ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); 110 ipv6_change_dsfield(inner, INET_ECN_MASK, dscp);
111} 111}
112 112
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index e4deecba6dd2..68a9f56ff09f 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -113,7 +113,7 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
113 iph = ip_hdr(skb); 113 iph = ip_hdr(skb);
114 if (iph->protocol == IPPROTO_IPIP) { 114 if (iph->protocol == IPPROTO_IPIP) {
115 if (x->props.flags & XFRM_STATE_DECAP_DSCP) 115 if (x->props.flags & XFRM_STATE_DECAP_DSCP)
116 ipv4_copy_dscp(iph, ipip_hdr(skb)); 116 ipv4_copy_dscp(ipv4_get_dsfield(iph), ipip_hdr(skb));
117 if (!(x->props.flags & XFRM_STATE_NOECN)) 117 if (!(x->props.flags & XFRM_STATE_NOECN))
118 ipip_ecn_decapsulate(skb); 118 ipip_ecn_decapsulate(skb);
119 } 119 }
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 5383b33db8ca..a4051afaf776 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -635,7 +635,7 @@ static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t,
635 struct sk_buff *skb) 635 struct sk_buff *skb)
636{ 636{
637 if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) 637 if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
638 ipv6_copy_dscp(ipv6h, ipv6_hdr(skb)); 638 ipv6_copy_dscp(ipv6_get_dsfield(ipv6h), ipv6_hdr(skb));
639 639
640 if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h))) 640 if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h)))
641 IP6_ECN_set_ce(ipv6_hdr(skb)); 641 IP6_ECN_set_ce(ipv6_hdr(skb));
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index fd84e2217274..9a43ea722481 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -95,7 +95,8 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
95 nh = skb_network_header(skb); 95 nh = skb_network_header(skb);
96 if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) { 96 if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) {
97 if (x->props.flags & XFRM_STATE_DECAP_DSCP) 97 if (x->props.flags & XFRM_STATE_DECAP_DSCP)
98 ipv6_copy_dscp(ipv6_hdr(skb), ipipv6_hdr(skb)); 98 ipv6_copy_dscp(ipv6_get_dsfield(ipv6_hdr(skb)),
99 ipipv6_hdr(skb));
99 if (!(x->props.flags & XFRM_STATE_NOECN)) 100 if (!(x->props.flags & XFRM_STATE_NOECN))
100 ipip6_ecn_decapsulate(skb); 101 ipip6_ecn_decapsulate(skb);
101 } else { 102 } else {