===== include/linux/ip6_tunnel.h 1.1 vs edited ===== --- 1.1/include/linux/ip6_tunnel.h 2003-06-10 00:56:43 +10:00 +++ edited/include/linux/ip6_tunnel.h 2004-09-13 16:30:44 +10:00 @@ -16,6 +16,8 @@ #define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 /* being used for Mobile IPv6 */ #define IP6_TNL_F_MIP6_DEV 0x8 +/* copy DSCP from the outer packet */ +#define IP6_TNL_F_RCV_DSCP_COPY 0x10 struct ip6_tnl_parm { char name[IFNAMSIZ]; /* name of tunnel device */ ===== include/net/inet_ecn.h 1.7 vs edited ===== --- 1.7/include/net/inet_ecn.h 2004-09-09 14:16:21 +10:00 +++ edited/include/net/inet_ecn.h 2004-09-13 15:55:17 +10:00 @@ -2,6 +2,7 @@ #define _INET_ECN_H_ #include +#include enum { INET_ECN_NOT_ECT = 0, @@ -91,6 +92,12 @@ static inline void IP6_ECN_clear(struct ipv6hdr *iph) { *(u32*)iph &= ~htonl(INET_ECN_MASK << 20); +} + +static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) +{ + u32 dscp = ipv6_get_dsfield(outer) & ~INET_ECN_MASK; + ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); } #endif ===== net/ipv6/ip6_tunnel.c 1.24 vs edited ===== --- 1.24/net/ipv6/ip6_tunnel.c 2004-09-09 14:21:46 +10:00 +++ edited/net/ipv6/ip6_tunnel.c 2004-09-13 16:30:11 +10:00 @@ -542,6 +542,8 @@ skb->dev = t->dev; dst_release(skb->dst); skb->dst = NULL; + if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) + ipv6_copy_dscp(ipv6h, skb->nh.ipv6h); ip6ip6_ecn_decapsulate(ipv6h, skb); t->stat.rx_packets++; t->stat.rx_bytes += skb->len;