]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtoptions: flag use of XTOPT_POINTER without XTOPT_PUT
authorJan Engelhardt <jengelh@medozas.de>
Sun, 21 Aug 2011 08:14:28 +0000 (10:14 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 21 Aug 2011 08:27:53 +0000 (10:27 +0200)
When XTOPT_POINTER is used (and yields a non-zero offsetof), we can
flag the absence of XTOPT_PUT.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
iptables/xtoptions.c

index 7095e3ea5d2379ee66ed4912a455d213e330dd8d..04344af430cde8dcf8d195c92836fb2cb473bdd1 100644 (file)
@@ -847,8 +847,14 @@ void xtables_option_metavalidate(const char *name,
                        xt_params->exit_err(OTHER_PROBLEM,
                                "Extension %s uses invalid ID %u\n",
                                name, entry->id);
-               if (!(entry->flags & XTOPT_PUT))
+               if (!(entry->flags & XTOPT_PUT)) {
+                       if (entry->ptroff != 0)
+                               xt_params->exit_err(OTHER_PROBLEM,
+                                       "%s: ptroff for \"--%s\" is non-"
+                                       "zero but no XTOPT_PUT is specified. "
+                                       "Oversight?", name, entry->name);
                        continue;
+               }
                if (entry->type >= ARRAY_SIZE(xtopt_psize) ||
                    xtopt_psize[entry->type] == 0)
                        xt_params->exit_err(OTHER_PROBLEM,