summaryrefslogtreecommitdiffstats
path: root/extensions/ebt_pkttype.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2005-02-08 20:02:28 +0000
committerBart De Schuymer <bdschuym@pandora.be>2005-02-08 20:02:28 +0000
commitff587205009a0d49e2d086765de87dc619b028bb (patch)
treed1d7fd0768212c24f2adcfd9c720975394f85694 /extensions/ebt_pkttype.c
parent96ce8685fe4011ef08b0f4fe2778b523c3740766 (diff)
general cleanup + add -C and -c
Diffstat (limited to 'extensions/ebt_pkttype.c')
-rw-r--r--extensions/ebt_pkttype.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/extensions/ebt_pkttype.c b/extensions/ebt_pkttype.c
index f7893bb..7894d0d 100644
--- a/extensions/ebt_pkttype.c
+++ b/extensions/ebt_pkttype.c
@@ -1,9 +1,9 @@
-/*
- * ebtables ebt_pkttype
+/* ebt_pkttype
*
- * Authors:
- * Bart De Schuymer <bdschuym@pandora.be>
+ * Authors:
+ * Bart De Schuymer <bdschuym@pandora.be>
*
+ * April, 2003
*/
#include <stdio.h>
@@ -38,7 +38,7 @@ static void print_help()
printf(
"pkttype options:\n"
"--pkttype-type [!] type: class the packet belongs to\n"
-"Possible values: broadcast, multicast, host, otherhost any byte value.\n");
+"Possible values: broadcast, multicast, host, otherhost, or any other byte value (which would be pretty useless).\n");
}
static void init(struct ebt_entry_match *match)
@@ -58,25 +58,21 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
switch (c) {
case '1':
ebt_check_option(flags, 1);
- if (ebt_check_inverse(optarg))
+ if (ebt_check_inverse2(optarg))
ptinfo->invert = 1;
- if (optind > argc)
- ebt_print_error("Missing pkttype class specification");
-
- i = strtol(argv[optind - 1], &end, 16);
+ i = strtol(optarg, &end, 16);
if (*end != '\0') {
int j = 0;
i = -1;
while (classes[j][0])
- if (!strcasecmp(argv[optind - 1], classes[j++])) {
+ if (!strcasecmp(optarg, classes[j++])) {
i = j - 1;
break;
}
}
if (i < 0 || i > 255)
- ebt_print_error("Problem with specified pkttype class");
+ ebt_print_error2("Problem with specified pkttype class");
ptinfo->pkt_type = (uint8_t)i;
-
break;
default:
return 0;