* [PATCH 2.4] fix SO_ORIGINAL_DST gestsockopt()
@ 2003-10-02 16:36 Harald Welte
2003-10-03 6:37 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Harald Welte @ 2003-10-02 16:36 UTC (permalink / raw)
To: David Miller; +Cc: Netfilter Development Mailinglist
[-- Attachment #1.1: Type: text/plain, Size: 650 bytes --]
Hi Davem!
Please apply the following patch to your 2.4 tree, thanks.
Author: Harald Welte <laforge@netfilter.org>
Status: Submitted at 2.4.23-preX time
This patch fixes the SO_ORIGINAL_DST sockopt() call, which was broken by
endianness fixes that went in 2.4.22.
--
- Harald Welte <laforge@netfilter.org> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #1.2: 63_getorigdst-tuple-zero.patch --]
[-- Type: text/plain, Size: 2084 bytes --]
diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linux-2.4.22-plain/include/linux/netfilter_ipv4/ip_conntrack_tuple.h linux-2.4.22-getorig/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
--- linux-2.4.22-plain/include/linux/netfilter_ipv4/ip_conntrack_tuple.h 2002-02-25 20:38:13.000000000 +0100
+++ linux-2.4.22-getorig/include/linux/netfilter_ipv4/ip_conntrack_tuple.h 2003-09-05 17:04:20.000000000 +0200
@@ -62,6 +62,14 @@
} dst;
};
+/* This is optimized opposed to a memset of the whole structure. Everything we
+ * really care about is the source/destination unions */
+#define IP_CT_TUPLE_U_BLANK(tuple) \
+ do { \
+ (tuple)->src.u.all = 0; \
+ (tuple)->dst.u.all = 0; \
+ } while (0)
+
enum ip_conntrack_dir
{
IP_CT_DIR_ORIGINAL,
diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linux-2.4.22-plain/net/ipv4/netfilter/ip_conntrack_core.c linux-2.4.22-getorig/net/ipv4/netfilter/ip_conntrack_core.c
--- linux-2.4.22-plain/net/ipv4/netfilter/ip_conntrack_core.c 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.22-getorig/net/ipv4/netfilter/ip_conntrack_core.c 2003-09-05 17:04:20.000000000 +0200
@@ -1303,9 +1303,14 @@
getorigdst(struct sock *sk, int optval, void *user, int *len)
{
struct ip_conntrack_tuple_hash *h;
- struct ip_conntrack_tuple tuple = { { sk->rcv_saddr, { .tcp = { sk->sport } } },
- { sk->daddr, { .tcp = { sk->dport } },
- IPPROTO_TCP } };
+ struct ip_conntrack_tuple tuple;
+
+ IP_CT_TUPLE_U_BLANK(&tuple);
+ tuple.src.ip = sk->rcv_saddr;
+ tuple.src.u.tcp.port = sk->sport;
+ tuple.dst.ip = sk->daddr;
+ tuple.dst.u.tcp.port = sk->dport;
+ tuple.dst.protonum = IPPROTO_TCP;
/* We only do TCP at the moment: is there a better way? */
if (strcmp(sk->prot->name, "TCP") != 0) {
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2.4] fix SO_ORIGINAL_DST gestsockopt()
2003-10-02 16:36 [PATCH 2.4] fix SO_ORIGINAL_DST gestsockopt() Harald Welte
@ 2003-10-03 6:37 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-10-03 6:37 UTC (permalink / raw)
To: Harald Welte; +Cc: netfilter-devel
On Thu, 2 Oct 2003 18:36:17 +0200
Harald Welte <laforge@netfilter.org> wrote:
> Please apply the following patch to your 2.4 tree, thanks.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-03 6:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-02 16:36 [PATCH 2.4] fix SO_ORIGINAL_DST gestsockopt() Harald Welte
2003-10-03 6:37 ` David S. Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.