extract-ofp-errors: Check that error codes are in the expected ranges.
authorBen Pfaff <blp@nicira.com>
Wed, 5 Sep 2012 17:18:56 +0000 (10:18 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 5 Sep 2012 17:19:02 +0000 (10:19 -0700)
All real OpenFlow error codes are small numbers, and for Nicira extensions
we've intentionally chosen large numbers.  This commit adds a check that
standard and extension codes are properly designated in the ofp-errors.h
header.

Signed-off-by: Ben Pfaff <blp@nicira.com>
build-aux/extract-ofp-errors

index bd4ab9e..db28af8 100755 (executable)
@@ -238,6 +238,11 @@ def extract_ofp_errors(filenames):
                               "NX1.2":  ("OF1.2",)}
                 if targets not in target_map:
                     fatal("%s: unknown error domain" % targets)
+                if targets.startswith('NX') and code < 0x100:
+                    fatal("%s: NX domain code cannot be less than 0x100" % dst)
+                if targets.startswith('OF') and code >= 0x100:
+                    fatal("%s: OF domain code cannot be greater than 0x100"
+                          % dst)
                 for target in target_map[targets]:
                     domain[target].setdefault(type_, {})
                     if code in domain[target][type_]: