summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/eventscripts
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-01-16 14:48:39 +1100
committerAmitay Isaacs <amitay@samba.org>2014-05-05 03:55:08 +0200
commit151b02cd9e05b120cc88086cfa0be6eaad04f736 (patch)
tree8c4720dcac53d60363f17b0bf06b3cd77f2009e2 /ctdb/tests/eventscripts
parente09147b6a31371d46b269563b707313619616564 (diff)
downloadsamba-151b02cd9e05b120cc88086cfa0be6eaad04f736.tar.gz
samba-151b02cd9e05b120cc88086cfa0be6eaad04f736.tar.xz
samba-151b02cd9e05b120cc88086cfa0be6eaad04f736.zip
ctdb-eventscripts: Add check for invalid policy routing configuration
The range CTDB_PER_IP_ROUTING_TABLE_ID_LOW..CTDB_PER_IP_ROUTING_TABLE_ID_HIGH should not include 253-255. Otherwise policy routing may overwrite the default system routing tables. Add some corresponding tests. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests/eventscripts')
-rwxr-xr-xctdb/tests/eventscripts/13.per_ip_routing.021.sh14
-rwxr-xr-xctdb/tests/eventscripts/13.per_ip_routing.022.sh14
2 files changed, 28 insertions, 0 deletions
diff --git a/ctdb/tests/eventscripts/13.per_ip_routing.021.sh b/ctdb/tests/eventscripts/13.per_ip_routing.021.sh
new file mode 100755
index 0000000000..609ecadb06
--- /dev/null
+++ b/ctdb/tests/eventscripts/13.per_ip_routing.021.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "Invalid table ID range - includes system tables"
+
+setup_ctdb
+setup_ctdb_policy_routing
+
+CTDB_PER_IP_ROUTING_TABLE_ID_LOW=100
+CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=500
+
+required_result 1 "error: range CTDB_PER_IP_ROUTING_TABLE_ID_LOW[${CTDB_PER_IP_ROUTING_TABLE_ID_LOW}]..CTDB_PER_IP_ROUTING_TABLE_ID_HIGH[${CTDB_PER_IP_ROUTING_TABLE_ID_HIGH}] must not include 253-255"
+simple_test_event "ipreallocated"
diff --git a/ctdb/tests/eventscripts/13.per_ip_routing.022.sh b/ctdb/tests/eventscripts/13.per_ip_routing.022.sh
new file mode 100755
index 0000000000..28997e3e6c
--- /dev/null
+++ b/ctdb/tests/eventscripts/13.per_ip_routing.022.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "Invalid table ID range - reversed"
+
+setup_ctdb
+setup_ctdb_policy_routing
+
+CTDB_PER_IP_ROUTING_TABLE_ID_LOW=9000
+CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=1000
+
+required_result 1 "error: CTDB_PER_IP_ROUTING_TABLE_ID_LOW[${CTDB_PER_IP_ROUTING_TABLE_ID_LOW}] and/or CTDB_PER_IP_ROUTING_TABLE_ID_HIGH[${CTDB_PER_IP_ROUTING_TABLE_ID_HIGH}] improperly configured"
+simple_test_event "ipreallocated"