From 199bf7c9b0ac1af1e28540ea0d31fa84c6bbde82 Mon Sep 17 00:00:00 2001 From: bol-van Date: Fri, 12 Mar 2021 15:44:25 +0300 Subject: [PATCH] nfqws: do not allow increasing scale factor --- nfq/darkmagic.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nfq/darkmagic.c b/nfq/darkmagic.c index 054de60..3f8fd99 100644 --- a/nfq/darkmagic.c +++ b/nfq/darkmagic.c @@ -669,9 +669,15 @@ void tcp_rewrite_wscale(struct tcphdr *tcp, uint8_t scale_factor) if (scale && scale[1]==3) // length should be 3 { scale_factor_old=scale[2]; - scale[2]=scale_factor; - if (scale_factor_old!=scale_factor) - DLOG("Scale factor change %u => %u\n", scale_factor_old, scale_factor) + // do not allow increasing scale factor + if (scale_factor>=scale_factor_old) + DLOG("Scale factor %u unchanged\n", scale_factor_old) + else + { + scale[2]=scale_factor; + if (scale_factor_old!=scale_factor) + DLOG("Scale factor change %u => %u\n", scale_factor_old, scale_factor) + } } } }