Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ AC_C_INLINE
AC_FUNC_MALLOC

PKG_CHECK_MODULES([DBUS],[dbus-1 >= 1.6.18])
PKG_CHECK_MODULES([OPENVSWITCH],[libopenvswitch])

AC_CONFIG_FILES(
Makefile
Expand All @@ -85,6 +86,7 @@ AC_CONFIG_FILES(
source/OvsDbApi/Makefile
source/OvsAction/Makefile
source/OvsAgentApi/Makefile
source/guardian/Makefile
)

AC_SUBST(GTEST_ENABLE_FLAG)
Expand Down
2 changes: 1 addition & 1 deletion source/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# SPDX-License-Identifier: Apache-2.0
#

SUBDIRS = OvsAgentSsp OvsAction OvsDbApi OvsAgentApi OvsAgentCore
SUBDIRS = OvsAgentSsp OvsAction OvsDbApi OvsAgentApi OvsAgentCore guardian

if WITH_GTEST_SUPPORT
SUBDIRS += test
Expand Down
17 changes: 17 additions & 0 deletions source/guardian/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Guardian OpenFlow policy agent (native C port of guardian.sh).
# SPDX-License-Identifier: Apache-2.0
#

bin_PROGRAMS = guardian

guardian_SOURCES = \
guardian_main.c \
guardian_config.c \
guardian_flows.c \
guardian_ovs.c

guardian_CPPFLAGS = -Wall -Werror -I$(top_srcdir)/source/include $(OPENVSWITCH_CFLAGS)

# Links libopenvswitch for direct OpenFlow I/O (vconn/ofputil) -- no ovs-ofctl fork.
guardian_LDADD = $(OPENVSWITCH_LIBS)
30 changes: 30 additions & 0 deletions source/guardian/guardian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Guardian: native C port of guardian.sh.
* Shared constants and core data structures.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef GUARDIAN_H
#define GUARDIAN_H

#include <stdint.h>
#include <stdbool.h>

/* Match the live values used by guardian.sh so existing tooling keeps working. */
#define GUARDIAN_BRIDGE "brlan0"
#define GUARDIAN_COOKIE 0x9110ULL
#define GUARDIAN_CT_ZONE 9110

/* Commands accepted on the CLI. */
enum guardian_cmd {
GUARDIAN_CMD_UNKNOWN = 0,
GUARDIAN_CMD_APPLY,
GUARDIAN_CMD_DRY_RUN,
GUARDIAN_CMD_CLEAR,
GUARDIAN_CMD_SHOW,
GUARDIAN_CMD_STATS,
GUARDIAN_CMD_DIAGNOSTICS,
GUARDIAN_CMD_LOAD_TEST,
};

#endif /* GUARDIAN_H */
Loading
Loading