* [PATCH net] ipv4: fib: Fix metrics match when deleting a route
@ 2017-12-19 14:17 Phil Sutter
2017-12-19 19:22 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2017-12-19 14:17 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Xin Long
The recently added fib_metrics_match() causes a regression for routes
with both RTAX_FEATURES and RTAX_CC_ALGO if the latter has
TCP_CONG_NEEDS_ECN flag set:
| # ip link add d0 type dummy
| # ip link set d0 up
| # ip route add 172.29.29.0/24 dev d0 features ecn congctl dctcp
| # ip route del 172.29.29.0/24 dev d0 features ecn congctl dctcp
| RTNETLINK answers: No such process
During route insertion, fib_convert_metrics() detects that the given CC
algo requires ECN and hence sets DST_FEATURE_ECN_CA bit in
RTAX_FEATURES.
During route deletion though, fib_metrics_match() compares stored
RTAX_FEATURES value with that from userspace (which obviously has no
knowledge about DST_FEATURE_ECN_CA) and fails.
Fixes: 5f9ae3d9e7e4a ("ipv4: do metrics match when looking up and deleting a route")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
net/ipv4/fib_semantics.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index f04d944f8abe0..c586597da20db 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -698,7 +698,7 @@ bool fib_metrics_match(struct fib_config *cfg, struct fib_info *fi)
nla_for_each_attr(nla, cfg->fc_mx, cfg->fc_mx_len, remaining) {
int type = nla_type(nla);
- u32 val;
+ u32 fi_val, val;
if (!type)
continue;
@@ -715,7 +715,11 @@ bool fib_metrics_match(struct fib_config *cfg, struct fib_info *fi)
val = nla_get_u32(nla);
}
- if (fi->fib_metrics->metrics[type - 1] != val)
+ fi_val = fi->fib_metrics->metrics[type - 1];
+ if (type == RTAX_FEATURES)
+ fi_val &= ~DST_FEATURE_ECN_CA;
+
+ if (fi_val != val)
return false;
}
--
2.13.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] ipv4: fib: Fix metrics match when deleting a route
2017-12-19 14:17 [PATCH net] ipv4: fib: Fix metrics match when deleting a route Phil Sutter
@ 2017-12-19 19:22 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-12-19 19:22 UTC (permalink / raw)
To: phil; +Cc: netdev, lucien.xin
From: Phil Sutter <phil@nwl.cc>
Date: Tue, 19 Dec 2017 15:17:13 +0100
> The recently added fib_metrics_match() causes a regression for routes
> with both RTAX_FEATURES and RTAX_CC_ALGO if the latter has
> TCP_CONG_NEEDS_ECN flag set:
>
> | # ip link add d0 type dummy
> | # ip link set d0 up
> | # ip route add 172.29.29.0/24 dev d0 features ecn congctl dctcp
> | # ip route del 172.29.29.0/24 dev d0 features ecn congctl dctcp
> | RTNETLINK answers: No such process
>
> During route insertion, fib_convert_metrics() detects that the given CC
> algo requires ECN and hence sets DST_FEATURE_ECN_CA bit in
> RTAX_FEATURES.
>
> During route deletion though, fib_metrics_match() compares stored
> RTAX_FEATURES value with that from userspace (which obviously has no
> knowledge about DST_FEATURE_ECN_CA) and fails.
>
> Fixes: 5f9ae3d9e7e4a ("ipv4: do metrics match when looking up and deleting a route")
> Signed-off-by: Phil Sutter <phil@nwl.cc>
Good catch, applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-19 19:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-19 14:17 [PATCH net] ipv4: fib: Fix metrics match when deleting a route Phil Sutter
2017-12-19 19:22 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox