summaryrefslogtreecommitdiff
path: root/lib/ovsdb-types.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-01-26 10:32:33 -0800
committerBen Pfaff <blp@nicira.com>2010-01-26 10:32:33 -0800
commit31a763d7d7892bad5c4f839d920bbdbff3167caf (patch)
treea32b0b00038d65fe15e2783c30d763d7ea32915b /lib/ovsdb-types.c
parentad83bfa65881712c3d9bc22e7430ddbc6c7bcaba (diff)
downloadopenvswitch-31a763d7d7892bad5c4f839d920bbdbff3167caf.tar.gz
ovsdb: Require column type "min" value be 0 or 1.
A "min" value greater than 1 is problematic for the database. There is no reasonable way to synthesize a default value for such a column: keys in a set or map must unique, so the database cannot, say, simply set a set of 3 or more integers to [0, 0, 0]. This should have no effect on the vswitch in practice because it does not have any columns that require more than one element.
Diffstat (limited to 'lib/ovsdb-types.c')
-rw-r--r--lib/ovsdb-types.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ovsdb-types.c b/lib/ovsdb-types.c
index 07982e343..659b50db3 100644
--- a/lib/ovsdb-types.c
+++ b/lib/ovsdb-types.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009, 2010 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,6 +75,7 @@ ovsdb_type_is_valid(const struct ovsdb_type *type)
return (type->key_type != OVSDB_TYPE_VOID
&& ovsdb_atomic_type_is_valid(type->key_type)
&& ovsdb_atomic_type_is_valid(type->value_type)
+ && type->n_min <= 1
&& type->n_min <= type->n_max
&& (type->value_type == OVSDB_TYPE_VOID
|| ovsdb_atomic_type_is_valid_key(type->key_type)));