Skip to contentSkip to conversation

Fix IPv6 ECN marking in RED

PATCH Applied Patrick McHardy 2 participants 2 messages Mar 6, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix IPv6 ECN marking in RED

Hi Dave,

this patch fixes IPv6 ECN marking in RED and changes it to use the functions from net/inet_ecn.h. Currently a local variable is marked instead of the packet.

Best regards
Patrick

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/03/06 01:06:26+01:00 [email protected]
# Fix IPv6 ECN marking in RED
#

# net/sched/sch_red.c
#   2004/03/06 01:03:45+01:00 [email protected] +4 -19
#   Fix IPv6 ECN marking in RED
# 
diff -Nru a/net/sched/sch_red.c b/net/sched/sch_red.c
--- a/net/sched/sch_red.c	Sat Mar  6 01:07:33 2004
+++ b/net/sched/sch_red.c	Sat Mar  6 01:07:33 2004
@@ -41,9 +41,6 @@
 #include <net/pkt_sched.h>
 #include <net/inet_ecn.h>

-#define RED_ECN_ECT 0x02
-#define RED_ECN_CE 0x01
-

/* Random Early Detection (RED) algorithm.
=======================================
@@ -165,28 +162,16 @@

switch (skb->protocol) {
case __constant_htons(ETH_P_IP):
- {
- u8 tos = skb->nh.iph->tos;
-
- if (!(tos & RED_ECN_ECT))
+ if (!INET_ECN_is_capable(skb->nh.iph->tos))
return 0;
-
- if (!(tos & RED_ECN_CE))
+ if (INET_ECN_is_not_ce(skb->nh.iph->tos))
IP_ECN_set_ce(skb->nh.iph);
-
return 1;
- }
-
case __constant_htons(ETH_P_IPV6):
- {
- u32 label = *(u32*)skb->nh.raw;
-
- if (!(label & __constant_htonl(RED_ECN_ECT<<20)))
+ if (!INET_ECN_is_capable(ip6_get_dsfield(skb->nh.ipv6h)))
return 0;
- label |= __constant_htonl(RED_ECN_CE<<20);
+ IP6_ECN_set_ce(skb->nh.ipv6h);
return 1;
- }
-
default:
return 0;
}

#1 lore raw
Quoted 3 lines · On Sat, 06 Mar 2004 01:30:20 +0100 Patrick McHardy <[email protected]> wrote:

this patch fixes IPv6 ECN marking in RED and changes it to use the functions from net/inet_ecn.h. Currently a local variable is marked instead of the packet.

Applied to both 2.4.x and 2.6.x, thanks Patrick.