From 813f5f0ace37876d9c13891514d0a2aa76e852c7 Mon Sep 17 00:00:00 2001 From: Sairam Venugopal Date: Fri, 2 Jun 2017 10:37:22 -0700 Subject: datapath-windows: Add original conntrack tuple to FlowKey Add the original tuple to Flow Key. In case of ICMP and UDP, default the parent entry to NULL until related connections is supported. Signed-off-by: Sairam Venugopal Acked-by: Alin Gabriel Serdean Signed-off-by: Gurucharan Shetty --- datapath-windows/ovsext/Conntrack.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'datapath-windows/ovsext/Conntrack.c') diff --git a/datapath-windows/ovsext/Conntrack.c b/datapath-windows/ovsext/Conntrack.c index dce0c1bcc..609ae5a95 100644 --- a/datapath-windows/ovsext/Conntrack.c +++ b/datapath-windows/ovsext/Conntrack.c @@ -198,7 +198,7 @@ OvsCtEntryCreate(PNET_BUFFER_LIST curNbl, } state |= OVS_CS_F_NEW; - POVS_CT_ENTRY parentEntry = NULL; + POVS_CT_ENTRY parentEntry; parentEntry = OvsCtRelatedLookup(ctx->key, currentTime); if (parentEntry != NULL) { state |= OVS_CS_F_RELATED; @@ -209,10 +209,10 @@ OvsCtEntryCreate(PNET_BUFFER_LIST curNbl, if (!entry) { return NULL; } - /* If this is related entry, then update parent */ - if (parentEntry != NULL) { - entry->parent = parentEntry; - } + + /* Set parent entry for related FTP connections */ + entry->parent = parentEntry; + OvsCtAddEntry(entry, ctx, currentTime); *entryCreated = TRUE; } @@ -235,6 +235,9 @@ OvsCtEntryCreate(PNET_BUFFER_LIST curNbl, if (!entry) { return NULL; } + + /* XXX Add support for ICMP-Related */ + entry->parent = NULL; OvsCtAddEntry(entry, ctx, currentTime); *entryCreated = TRUE; } @@ -250,6 +253,9 @@ OvsCtEntryCreate(PNET_BUFFER_LIST curNbl, if (!entry) { return NULL; } + + /* Default UDP related to NULL until TFTP is supported */ + entry->parent = NULL; OvsCtAddEntry(entry, ctx, currentTime); *entryCreated = TRUE; } @@ -586,8 +592,8 @@ OvsProcessConntrackEntry(PNET_BUFFER_LIST curNbl, } else { POVS_CT_ENTRY parentEntry; parentEntry = OvsCtRelatedLookup(ctx->key, currentTime); + entry->parent = parentEntry; if (parentEntry != NULL) { - entry->parent = parentEntry; state |= OVS_CS_F_RELATED; } } @@ -702,6 +708,23 @@ OvsCtExecute_(PNET_BUFFER_LIST curNbl, } } + /* Add original tuple information to flow Key */ + if (entry && entry->key.dl_type == ntohs(ETH_TYPE_IPV4)) { + OVS_CT_KEY *ctKey; + if (entry->parent != NULL) { + POVS_CT_ENTRY parent = entry->parent; + ctKey = &parent->key; + } else { + ctKey = &entry->key; + } + + key->ct.tuple_ipv4.ipv4_src = ctKey->src.addr.ipv4_aligned; + key->ct.tuple_ipv4.ipv4_dst = ctKey->dst.addr.ipv4_aligned; + key->ct.tuple_ipv4.src_port = ctKey->src.port; + key->ct.tuple_ipv4.dst_port = ctKey->dst.port; + key->ct.tuple_ipv4.ipv4_proto = ctKey->nw_proto; + } + if (entryCreated && entry) { OvsPostCtEventEntry(entry, OVS_EVENT_CT_NEW); } -- cgit v1.2.1