Thread (3 messages) 3 messages, 2 authors, 2008-03-29

Re: [PATCH] [NETFILTER] xt_TCPMSS: combine nearly identical reverse_mtu4/6

From: Ilpo Järvinen <hidden>
Date: 2008-03-29 16:13:49
Also in: netfilter-devel

On Sat, 29 Mar 2008, Jan Engelhardt wrote:
How about this one instead?
A minor correction is necessary, see below.
quoted hunk ↗ jump to hunk
commit 1143bd2cbcddb9fcdbffea6a2edfde42dca5bb46
Author: Jan Engelhardt [off-list ref]
Date:   Sat Mar 29 16:20:13 2008 +0100

    [NETFILTER]: Collapse tcpmss_reverse_mtu{4,6} into one function

    Signed-off-by: Jan Engelhardt [off-list ref]
---
 net/netfilter/xt_TCPMSS.c |   44 ++++++++++++++------------------------------
 1 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index 217e2b6..2e3fe8e 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -147,15 +147,19 @@ tcpmss_mangle_packet(struct sk_buff *skb,
 	return TCPOLEN_MSS;
 }

-static u_int32_t tcpmss_reverse_mtu4(const struct iphdr *iph)
+static u_int32_t tcpmss_reverse_mtu(const struct sk_buff *skb,
+                                    unsigned int family)
 {
-	struct flowi fl = {
-		.fl4_dst = iph->saddr,
-	};
+	struct flowi fl = {};
 	const struct nf_afinfo *ai;
 	struct rtable *rt = NULL;
 	u_int32_t mtu     = ~0U;

+	if (family == AF_INET)
+		fl.fl4_dst = ip_hdr(skb)->saddr;
+	else
+		fl.fl6_dst = ipv6_hdr(skb)->saddr;
+
 	rcu_read_lock();
 	ai = nf_get_afinfo(AF_INET);
s/AF_INET/family/



-- 
 i.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help