tc: nat: ffs should operation on host byte ordered data

In print_nat the mask length is calculated as

	len = ffs(sel->mask);
	len = len ? 33 - len : 0;

The mask is stored in network byte order, it should be converted
to host byte order before calculating first bit set.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Torben Nielsen 2025-03-06 12:25:20 +01:00 committed by Stephen Hemminger
parent 667817b4c3
commit afbfd2f2b0

View File

@ -156,7 +156,7 @@ print_nat(const struct action_util *au, FILE * f, struct rtattr *arg)
}
sel = RTA_DATA(tb[TCA_NAT_PARMS]);
len = ffs(sel->mask);
len = ffs(ntohl(sel->mask));
len = len ? 33 - len : 0;
print_string(PRINT_ANY, "direction", "%s",