summaryrefslogtreecommitdiff
path: root/ovsdb/mutation.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-09-05 10:35:20 -0700
committerBen Pfaff <blp@nicira.com>2012-09-05 10:35:20 -0700
commit341c4e59f50a842a2974d06e448a57af372a7edd (patch)
tree35f92730f035ab655e76334bdb19f771c042d10a /ovsdb/mutation.c
parentc22c56bd746352f5c70a0d99bb3f548d03cfd105 (diff)
downloadopenvswitch-341c4e59f50a842a2974d06e448a57af372a7edd.tar.gz
ovsdb: Enforce immutability of immutable columns.
OVSDB has always had the ability to mark a column as "immutable", so that its value cannot be changed in a given row after that row is initially inserted. However, we discovered recently that ovsdb-server has never enforced this constraint. This commit implements enforcement. Reported-by: Paul Ingram <paul@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com>
Diffstat (limited to 'ovsdb/mutation.c')
-rw-r--r--ovsdb/mutation.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ovsdb/mutation.c b/ovsdb/mutation.c
index 0dcd16fec..5fd983a4b 100644
--- a/ovsdb/mutation.c
+++ b/ovsdb/mutation.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010, 2011 Nicira, Inc.
+/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,6 +95,12 @@ ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts,
"No column %s in table %s.",
column_name, ts->name);
}
+ if (!m->column->mutable) {
+ return ovsdb_syntax_error(json, "constraint violation",
+ "Cannot mutate immutable column %s in "
+ "table %s.", column_name, ts->name);
+ }
+
ovsdb_type_clone(&m->type, &m->column->type);
mutator_name = json_string(array->elems[1]);