diff options
author | Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 2016-09-27 10:22:33 +0800 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2016-09-27 17:54:22 +0800 |
commit | afe461240940077e7ea8313e9c547a4898263cd2 (patch) | |
tree | 39934b9a6a266b4434bd12c232f4fabadc6bedce /net/colo.c | |
parent | e6eee8ab5148aee369416e5126d6d149319579be (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.c | 14 |
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); |