aboutsummaryrefslogtreecommitdiff
path: root/net/colo.c
diff options
context:
space:
mode:
authorZhang Chen <zhangchen.fnst@cn.fujitsu.com>2016-09-27 10:22:33 +0800
committerJason Wang <jasowang@redhat.com>2016-09-27 17:54:22 +0800
commitafe461240940077e7ea8313e9c547a4898263cd2 (patch)
tree39934b9a6a266b4434bd12c232f4fabadc6bedce /net/colo.c
parente6eee8ab5148aee369416e5126d6d149319579be (diff)
filter-rewriter: track connection and parse packet
We use net/colo.h to track connection and parse packet Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net/colo.c')
-rw-r--r--net/colo.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/colo.c b/net/colo.c
index 94f5992545..124994c99f 100644
--- a/net/colo.c
+++ b/net/colo.c
@@ -114,6 +114,20 @@ void fill_connection_key(Packet *pkt, ConnectionKey *key)
}
}
+void reverse_connection_key(ConnectionKey *key)
+{
+ struct in_addr tmp_ip;
+ uint16_t tmp_port;
+
+ tmp_ip = key->src;
+ key->src = key->dst;
+ key->dst = tmp_ip;
+
+ tmp_port = key->src_port;
+ key->src_port = key->dst_port;
+ key->dst_port = tmp_port;
+}
+
Connection *connection_new(ConnectionKey *key)
{
Connection *conn = g_slice_new(Connection);