Thread (17 messages) 17 messages, 3 authors, 2021-08-29

Re: [PATCH 2/3] net: netfilter: Add RFC-7597 Section 5.1 PSID support

flat view

From: Florian Westphal <fw@strlen.de>
Date: 2021-07-22 07:18:05
Also in: linux-kselftest, lkml, netfilter-devel

Cole Dishington [off-list ref] wrote:
Adds support for masquerading into a smaller subset of ports -
defined by the PSID values from RFC-7597 Section 5.1. This is part of
the support for MAP-E and Lightweight 4over6, which allows multiple
devices to share an IPv4 address by splitting the L4 port / id into
ranges.

Co-developed-by: Anthony Lineham <redacted>
Signed-off-by: Anthony Lineham <redacted>
Co-developed-by: Scott Parlane <redacted>
Signed-off-by: Scott Parlane <redacted>
Signed-off-by: Blair Steven <redacted>
Signed-off-by: Cole Dishington <redacted>
---
+
+	/* In this case we are in PSID mode, avoid checking all ranges by computing bitmasks */
+	if (is_psid) {
+		u16 power_j = ntohs(max->all) - ntohs(min->all) + 1;
I think this needs to be 'u32 power_j' to prevent overflow of
65535 + 1 -> 0.
+		if (base)
+			off = prandom_u32() % (((1 << 16) / base) - 1);
I think this can use prandom_u32_max(((1 << 16) / base) - 1).

I have no other comments.  Other kernel patches LGTM.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help