Commit 280a827a authored by Harald Welte's avatar Harald Welte Committed by Stephen Hemminger

[NETFILTER]: Fix SO_ORIGINAL_DST, broken by earlier endianness fixes.

parent 49448a2f
......@@ -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,
......
......@@ -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")) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment