]> git.hungrycats.org Git - linux/commitdiff
[NETFILTER]: Fix SO_ORIGINAL_DST, broken by earlier endianness fixes.
authorHarald Welte <laforge@netfilter.org>
Thu, 2 Oct 2003 16:39:47 +0000 (09:39 -0700)
committerStephen Hemminger <shemminger@osdl.org>
Thu, 2 Oct 2003 16:39:47 +0000 (09:39 -0700)
include/linux/netfilter_ipv4/ip_conntrack_tuple.h
net/ipv4/netfilter/ip_conntrack_core.c

index 9f6ec0a6bccc11a3cd1e051aa63f65bfe38aab2f..1e7691189c67c6c7f8d562a0b9d315c90390df0a 100644 (file)
@@ -62,6 +62,14 @@ struct ip_conntrack_tuple
        } 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,
index 02630aedef4e71625fd0ef25b8c748f5ec914b87..1b187101db4d7f27690455eccf8b49e5e7fb28a8 100644 (file)
@@ -1279,11 +1279,14 @@ getorigdst(struct sock *sk, int optval, void *user, int *len)
 {
        struct inet_opt *inet = inet_sk(sk);
        struct ip_conntrack_tuple_hash *h;
-       struct ip_conntrack_tuple tuple = { { inet->rcv_saddr,
-                                               { .tcp = { inet->sport } } },
-                                           { inet->daddr,
-                                               { .tcp = { inet->dport } },
-                                             IPPROTO_TCP } };
+       struct ip_conntrack_tuple tuple;
+       
+       IP_CT_TUPLE_U_BLANK(&tuple);
+       tuple.src.ip = inet->rcv_saddr;
+       tuple.src.u.tcp.port = inet->sport;
+       tuple.dst.ip = inet->daddr;
+       tuple.dst.u.tcp.port = inet->dport;
+       tuple.dst.protonum = IPPROTO_TCP;
 
        /* We only do TCP at the moment: is there a better way? */
        if (strcmp(sk->sk_prot->name, "TCP")) {