Skip to contentSkip to conversation

sch_cake: allow setting TCA_CAKE_NAT with value 0 if conntrack is disabled

PATCH In review Felix Fietkau 4 participants 5 messages Mar 7, 2022

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

PATCH 1/2 sch_cake: allow setting TCA_CAKE_NAT with value 0 if conntrack is disabled

Allows the 'nonat' option to be specified

---
 net/sched/sch_cake.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
net/sched/sch_cake.c +5 -3
index a43a58a73d09..57c0095a831b 100644
@@ -2583,9 +2583,11 @@ static int cake_change(struct Qdisc *sch, struct nlattr *opt,
 		q->flow_mode |= CAKE_FLOW_NAT_FLAG *
 			!!nla_get_u32(tb[TCA_CAKE_NAT]);
 #else
-		NL_SET_ERR_MSG_ATTR(extack, tb[TCA_CAKE_NAT],
-				    "No conntrack support in kernel");
-		return -EOPNOTSUPP;
+		if (nla_get_u32(tb[TCA_CAKE_NAT])) {
+			NL_SET_ERR_MSG_ATTR(extack, tb[TCA_CAKE_NAT],
+					    "No conntrack support in kernel");
+			return -EOPNOTSUPP;
+		}
 #endif
 	}
 
Signature · 1 line
2.32.0 (Apple Git-132)
#1 lore raw

PATCH 2/2 sch_fq_codel: fix running with classifiers that don't set a classid

If no valid classid is provided, fall back to calculating the hash directly, in order to avoid dropping packets

---
 net/sched/sch_fq_codel.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
net/sched/sch_fq_codel.c +6 -3
index 839e1235db05..b2a13185bb63 100644
@@ -88,7 +88,7 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
 
 	filter = rcu_dereference_bh(q->filter_list);
 	if (!filter)
-		return fq_codel_hash(q, skb) + 1;
+		goto out;
 
 	*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 	result = tcf_classify(skb, NULL, filter, &res, false);
@@ -104,10 +104,13 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
 			return 0;
 		}
 #endif
-		if (TC_H_MIN(res.classid) <= q->flows_cnt)
+		if (TC_H_MIN(res.classid) > 0 &&
+		    TC_H_MIN(res.classid) <= q->flows_cnt)
 			return TC_H_MIN(res.classid);
 	}
-	return 0;
+
+out:
+	return fq_codel_hash(q, skb) + 1;
 }
 
 /* helper functions : might be changed when/if skb use a standard list_head */
Signature · 1 line
2.32.0 (Apple Git-132)
#2 lore raw

Re: [PATCH 2/2] sch_fq_codel: fix running with classifiers that don't set a classid

Quoted 4 lines · Felix Fietkau

If no valid classid is provided, fall back to calculating the hash directly, in order to avoid dropping packets

While I agree that this behaviour makes more sense, it's also a user-facing API change; I suppose there may be filters out there relying on the fact that invalid (or unset) class ID values lead to dropped packets?

-Toke

#3 lore raw

Re: [PATCH 2/2] sch_fq_codel: fix running with classifiers that don't set a classid

Quoted 10 lines · Toke Høiland-Jørgensen
Quoted 4 lines · Felix Fietkau

If no valid classid is provided, fall back to calculating the hash directly, in order to avoid dropping packets

While I agree that this behaviour makes more sense, it's also a user-facing API change; I suppose there may be filters out there relying on the fact that invalid (or unset) class ID values lead to dropped packets?

Indeed.

This part was copied from SFQ, so if we want to (optionally ?) change the behavior,

same change should be applied to SFQ.