conntrack: fix incomplete copying IPv6 addresses
PATCH 1/2 conntrack: fix incomplete copying IPv6 addresses
[CONNTRACK] fix incomplete copying IPv6 addresses
If only addresses of orig(reply) tuple is specified, conntrack automatically copy them to reply(orig) tuple. This fix makes conntrack possible to copy IPv6 addresses correctly and set address family to invert tuple.
Signed-off-by Yasuyuki Kozakai <[email protected]>
---
commit dcc6b2fb1e018f7ceda135c731417ce92755bc77
tree 2c153fed854cee7253f8484bcf7a67b9f82c62bc
parent 7789192e0f5cfb4e8903be500880984c29c10b2c
author Yasuyuki Kozakai <[email protected]> Sat, 24 Dec 2005 13:53:21 +0900 committer Yasuyuki Kozakai <[email protected]> Sat, 24 Dec 2005 13:53:21 +0900
src/conntrack.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
src/conntrack.c +12 -8
@@ -912,12 +912,14 @@ int main(int argc, char *argv[])case CT_CREATE :if ((options &CT_OPT_ORIG ) && !(options &CT_OPT_REPL )) { - reply.src.v4 = orig.dst.v4; - reply.dst.v4 = orig.src.v4; + reply.l3protonum = orig.l3protonum; +memcpy (&reply.src, &orig.dst,sizeof (reply.src)); +memcpy (&reply.dst, &orig.src,sizeof (reply.dst)); }else if (!(options &CT_OPT_ORIG ) && (options &CT_OPT_REPL )) { - orig.src.v4 = reply.dst.v4; - orig.dst.v4 = reply.src.v4; + orig.l3protonum = reply.l3protonum; +memcpy (&orig.src, &reply.dst,sizeof (orig.src)); +memcpy (&orig.dst, &reply.src,sizeof (orig.dst)); }if (options &CT_OPT_NATRANGE ) ct = nfct_conntrack_alloc(&orig, &reply, timeout,
@@ -963,12 +965,14 @@ int main(int argc, char *argv[])case CT_UPDATE :if ((options &CT_OPT_ORIG ) && !(options &CT_OPT_REPL )) { - reply.src.v4 = orig.dst.v4; - reply.dst.v4 = orig.src.v4; + reply.l3protonum = orig.l3protonum; +memcpy (&reply.src, &orig.dst,sizeof (reply.src)); +memcpy (&reply.dst, &orig.src,sizeof (reply.dst)); }else if (!(options &CT_OPT_ORIG ) && (options &CT_OPT_REPL )) { - orig.src.v4 = reply.dst.v4; - orig.dst.v4 = reply.src.v4; + orig.l3protonum = reply.l3protonum; +memcpy (&orig.src, &reply.dst,sizeof (orig.src)); +memcpy (&orig.dst, &reply.src,sizeof (orig.dst)); } ct = nfct_conntrack_alloc(&orig, &reply, timeout, &proto, status, mark, id,