summaryrefslogtreecommitdiff
path: root/ovn/lib/expr.c
diff options
context:
space:
mode:
authorNuman Siddique <nusiddiq@redhat.com>2016-06-15 14:47:35 +0530
committerBen Pfaff <blp@ovn.org>2016-06-23 15:57:22 -0700
commit42814145d70c77462ce28b38841cd160f0486776 (patch)
tree82517d62565949a1081338ac6bda930bc5aaf7e4 /ovn/lib/expr.c
parent8fb72d297dab0015cd07236dd6f08f7bf9ecc713 (diff)
downloadopenvswitch-42814145d70c77462ce28b38841cd160f0486776.tar.gz
ovn-controller: Add 'put_dhcp_opts' action in ovn-controller
This patch adds a new OVN action 'put_dhcp_opts' to support native DHCP in OVN. ovn-controller parses this action and adds a NXT_PACKET_IN2 OF flow with 'pause' flag set and the DHCP options stored in 'userdata' field. When the valid DHCP packet is received by ovn-controller, it frames a new DHCP reply packet with the DHCP options present in the 'userdata' field and resumes the packet and stores 1 in the 1-bit subfield. If the packet is invalid, it resumes the packet without any modifying and stores 0 in the 1-bit subfield. Eg. reg0[0] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.255.0, lease_time = 3600,....) A new 'DHCP_Options' table is added in SB DB which stores the supported DHCP options with DHCP code and type. ovn-northd is expected to popule this table. The next patch will add logical flows with this action. Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Co-authored-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn/lib/expr.c')
-rw-r--r--ovn/lib/expr.c45
1 files changed, 10 insertions, 35 deletions
diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c
index 31b94d81c..91bff075d 100644
--- a/ovn/lib/expr.c
+++ b/ovn/lib/expr.c
@@ -405,39 +405,6 @@ expr_print(const struct expr *e)
/* Parsing. */
-/* Type of a "union expr_constant" or "struct expr_constant_set". */
-enum expr_constant_type {
- EXPR_C_INTEGER,
- EXPR_C_STRING
-};
-
-/* A string or integer constant (one must know which from context). */
-union expr_constant {
- /* Integer constant.
- *
- * The width of a constant isn't always clear, e.g. if you write "1",
- * there's no way to tell whether you mean for that to be a 1-bit constant
- * or a 128-bit constant or somewhere in between. */
- struct {
- union mf_subvalue value;
- union mf_subvalue mask; /* Only initialized if 'masked'. */
- bool masked;
-
- enum lex_format format; /* From the constant's lex_token. */
- };
-
- /* Null-terminated string constant. */
- char *string;
-};
-
-/* A collection of "union expr_constant"s of the same type. */
-struct expr_constant_set {
- union expr_constant *values; /* Constants. */
- size_t n_values; /* Number of constants. */
- enum expr_constant_type type; /* Type of the constants. */
- bool in_curlies; /* Whether the constants were in {}. */
-};
-
/* Context maintained during expr_parse(). */
struct expr_context {
struct lexer *lexer; /* Lexer for pulling more tokens. */
@@ -448,7 +415,6 @@ struct expr_context {
struct expr *expr_parse__(struct expr_context *);
static void expr_not(struct expr *);
-static void expr_constant_set_destroy(struct expr_constant_set *);
static bool parse_field(struct expr_context *, struct expr_field *);
static bool
@@ -829,7 +795,7 @@ parse_constant_set(struct expr_context *ctx, struct expr_constant_set *cs)
return ok;
}
-static void
+void
expr_constant_set_destroy(struct expr_constant_set *cs)
{
if (cs) {
@@ -2931,3 +2897,12 @@ exit:
}
return ctx.error;
}
+
+char * OVS_WARN_UNUSED_RESULT
+expr_parse_constant_set(struct lexer *lexer, const struct shash *symtab,
+ struct expr_constant_set *cs)
+{
+ struct expr_context ctx = { .lexer = lexer, .symtab = symtab };
+ parse_constant_set(&ctx, cs);
+ return ctx.error;
+}