From 5e422c9ef2c4bf60a7856ae19a3686e9f63f3e62 Mon Sep 17 00:00:00 2001 From: Sairam Venugopal Date: Fri, 16 Dec 2016 14:28:10 -0800 Subject: datapath-windows: Cleanup Conntrack definitions and introduce related entries Consolidate the reusable structs and includes. Introduce the new OVS_CT_REL_ENTRY to track related connections. Signed-off-by: Sairam Venugopal Acked-by: Alin Gabriel Serdean Signed-off-by: Gurucharan Shetty --- datapath-windows/ovsext/Conntrack.c | 12 --------- datapath-windows/ovsext/Conntrack.h | 51 ++++++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/datapath-windows/ovsext/Conntrack.c b/datapath-windows/ovsext/Conntrack.c index 47dba9dc8..70c32a48f 100644 --- a/datapath-windows/ovsext/Conntrack.c +++ b/datapath-windows/ovsext/Conntrack.c @@ -14,27 +14,15 @@ * limitations under the License. */ -#ifdef OVS_DBG_MOD -#undef OVS_DBG_MOD -#endif -#define OVS_DBG_MOD OVS_DBG_CONTRK - #include "Conntrack.h" #include "Jhash.h" #include "PacketParser.h" -#include "Debug.h" #include "Event.h" #define WINDOWS_TICK 10000000 #define SEC_TO_UNIX_EPOCH 11644473600LL #define SEC_TO_NANOSEC 1000000000LL -typedef struct _OVS_CT_THREAD_CTX { - KEVENT event; - PVOID threadObject; - UINT32 exit; -} OVS_CT_THREAD_CTX, *POVS_CT_THREAD_CTX; - KSTART_ROUTINE ovsConntrackEntryCleaner; static PLIST_ENTRY ovsConntrackTable; static OVS_CT_THREAD_CTX ctThreadCtx; diff --git a/datapath-windows/ovsext/Conntrack.h b/datapath-windows/ovsext/Conntrack.h index 733596df8..7f1ec6f52 100644 --- a/datapath-windows/ovsext/Conntrack.h +++ b/datapath-windows/ovsext/Conntrack.h @@ -19,6 +19,13 @@ #include "precomp.h" #include "Flow.h" +#include "Debug.h" +#include + +#ifdef OVS_DBG_MOD +#undef OVS_DBG_MOD +#endif +#define OVS_DBG_MOD OVS_DBG_CONTRK struct ct_addr { union { @@ -80,6 +87,19 @@ typedef struct OVS_CT_ENTRY { struct ovs_key_ct_labels labels; } OVS_CT_ENTRY, *POVS_CT_ENTRY; +typedef struct OVS_CT_REL_ENTRY { + OVS_CT_KEY key; + POVS_CT_ENTRY parent; + UINT64 expiration; + LIST_ENTRY link; +} OVS_CT_REL_ENTRY, *POVS_CT_REL_ENTRY; + +typedef struct _OVS_CT_THREAD_CTX { + KEVENT event; + PVOID threadObject; + UINT32 exit; +} OVS_CT_THREAD_CTX, *POVS_CT_THREAD_CTX; + typedef struct OvsConntrackKeyLookupCtx { OVS_CT_KEY key; POVS_CT_ENTRY entry; @@ -158,13 +178,26 @@ enum CT_UPDATE_RES OvsConntrackUpdateOtherEntry(OVS_CT_ENTRY *conn_, enum CT_UPDATE_RES OvsConntrackUpdateIcmpEntry(OVS_CT_ENTRY* conn_, BOOLEAN reply, UINT64 now); -NTSTATUS -OvsCreateNlMsgFromCtEntry(POVS_CT_ENTRY entry, - PVOID outBuffer, - UINT32 outBufLen, - UINT8 eventType, - UINT32 nlmsgSeq, - UINT32 nlmsgPid, - UINT8 nfGenVersion, - UINT32 dpIfIndex); +NTSTATUS OvsCreateNlMsgFromCtEntry(POVS_CT_ENTRY entry, + PVOID outBuffer, + UINT32 outBufLen, + UINT8 eventType, + UINT32 nlmsgSeq, + UINT32 nlmsgPid, + UINT8 nfGenVersion, + UINT32 dpIfIndex); + +/* Tracking related connections */ +NTSTATUS OvsInitCtRelated(POVS_SWITCH_CONTEXT context); +VOID OvsCleanupCtRelated(VOID); +NDIS_STATUS OvsCtRelatedEntryCreate(UINT8 ipProto, + UINT16 dl_type, + UINT32 serverIp, + UINT32 clientIp, + UINT16 serverPort, + UINT16 clientPort, + UINT64 currentTime, + POVS_CT_ENTRY parent); +POVS_CT_ENTRY OvsCtRelatedLookup(OVS_CT_KEY key, UINT64 currentTime); + #endif /* __OVS_CONNTRACK_H_ */ -- cgit v1.2.1