04.03.08 @ 09:23 Marcelo Araujo wrote:
Hi all,
I started a work to create a new function called of modip, but I've some
doubts around this implementation.
I created inside of ipfw2.c a case statement called of TOK_SETMODIP, I
check if user passed one of the options(DF,TOS,DSCP,TTL), after set an
int with the respective value.
Now, I need to call O_SETMODIP within ip_fw2.c going with parameter
opmodip, and inside O_SETMODIP I can do a goto to O_SETIPTOSPRE as
example.
Only as example - no O_SETIPTOSPRE should be in actual patch...
ipfw2.c:
4913 /* New Implementation MODIP. */
4914 /* [DF|TOS|DSCP|TTL] */
4915 case TOK_SETMODIP: {
4916 int opmodip = 0;
4917 NEED1("need modip [DF|TOS|DSCP|TTL] arg\n");
You're checking only one argument, but there are two - e.g. "tos" and
actual arg.
4918 if (_substrcmp(*av, "DF") == 0 ||
4919 _substrcmp(*av, "df") == 0) {
4920 opmodip = 1;
Operation constants for O_MODIP should be #defines in ip_fw.h rather than
plain 1, 2, 3, etc.
4938 fill_cmd(cmd, O_SETMODIP, 0, modip);
Why "modip" var, not "opmodip" you've used before?
4939 ac--; av++;
4940 printf("Value %d\n", opmodip);
4941 break;
4942 }
When I execute the ipfw with the option I've this output:
island# ipfw add modip
ipfw: need modip [DF|TOS|DSCP|TTL] arg
and
island# ipfw add modip tos
TOS....
ipfw: invalid flag tos
I'd like to pass as follows:
island# ipfw add modip tos flashover ip from any to any
My problem I believe are in fill_cmd().
Somebody can help me with this problem?
I think problem is in "ac--; av++" count times, not in fill_cmd() which is
only instruction setter, not parser.
--
WBR, Vadim Goncharov
_______________________________________________
freebsd-ipfw@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ipfw
To unsubscribe, send any mail to "[EMAIL PROTECTED]"