Skip to content

Commit 792d377

Browse files
Sairam Venugopalddiproietto
authored andcommitted
datapath-windows: Add Connection Tracking Support
Enable support for Stateful Firewall in Hyper-V by adding a Connection Tracking module. The module has been ported over from the userspace implementation patch of a similar name. The current version of the module supports ct - zone, mark and label for TCP packets. Support for other packet formats will be added in subsequent patches. The conntrack-tcp module is adapted from FreeBSD's pf subsystem and hence the BSD license. It has been ported over to match OVS Hyper-V coding style. Signed-off-by: Sairam Venugopal <[email protected]> Signed-off-by: Daniele Di Proietto <[email protected]> Co-Authored-by: Daniele Di Proietto <[email protected]> Acked-by: Nithin Raju <[email protected]> Signed-off-by: Ben Pfaff <[email protected]>
1 parent ce05810 commit 792d377

File tree

14 files changed

+1350
-4
lines changed

14 files changed

+1350
-4
lines changed

NOTICE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ Copyright (c) 2008, 2009, 2010 Sten Spans <[email protected]>
3838
Auto Attach implementation
3939
Copyright (c) 2014, 2015 WindRiver, Inc
4040
Copyright (c) 2014, 2015 Avaya, Inc
41+
42+
TCP connection tracker from FreeBSD pf, BSD licensed
43+
Copyright (c) 2001 Daniel Hartmeier
44+
Copyright (c) 2002 - 2008 Henning Brauer
45+
Copyright (c) 2012 Gleb Smirnoff <[email protected]>

datapath-windows/automake.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ EXTRA_DIST += \
1313
datapath-windows/ovsext/Atomic.h \
1414
datapath-windows/ovsext/BufferMgmt.c \
1515
datapath-windows/ovsext/BufferMgmt.h \
16+
datapath-windows/ovsext/Conntrack-tcp.c \
17+
datapath-windows/ovsext/Conntrack.c \
18+
datapath-windows/ovsext/Conntrack.h \
1619
datapath-windows/ovsext/Datapath.c \
1720
datapath-windows/ovsext/Datapath.h \
1821
datapath-windows/ovsext/Debug.c \

datapath-windows/ovsext/Actions.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "precomp.h"
1818

1919
#include "Actions.h"
20+
#include "Conntrack.h"
2021
#include "Debug.h"
2122
#include "Event.h"
2223
#include "Flow.h"
@@ -1786,6 +1787,28 @@ OvsDoExecuteActions(POVS_SWITCH_CONTEXT switchContext,
17861787
break;
17871788
}
17881789

1790+
case OVS_ACTION_ATTR_CT:
1791+
{
1792+
if (ovsFwdCtx.destPortsSizeOut > 0
1793+
|| ovsFwdCtx.tunnelTxNic != NULL
1794+
|| ovsFwdCtx.tunnelRxNic != NULL) {
1795+
status = OvsOutputBeforeSetAction(&ovsFwdCtx);
1796+
if (status != NDIS_STATUS_SUCCESS) {
1797+
dropReason = L"OVS-adding destination failed";
1798+
goto dropit;
1799+
}
1800+
}
1801+
1802+
status = OvsExecuteConntrackAction(ovsFwdCtx.curNbl, layers,
1803+
key, (const PNL_ATTR)a);
1804+
if (status != NDIS_STATUS_SUCCESS) {
1805+
OVS_LOG_ERROR("CT Action failed");
1806+
dropReason = L"OVS-conntrack action failed";
1807+
goto dropit;
1808+
}
1809+
break;
1810+
}
1811+
17891812
case OVS_ACTION_ATTR_RECIRC:
17901813
{
17911814
if (ovsFwdCtx.destPortsSizeOut > 0 || ovsFwdCtx.tunnelTxNic != NULL

0 commit comments

Comments
 (0)