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.

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");
4918         if (_substrcmp(*av, "DF") == 0 ||
4919               _substrcmp(*av, "df") == 0) {
4920             opmodip = 1;
4921             printf("DF.....\n");
4922         } else if (_substrcmp(*av, "TOS") == 0 ||
4923                      _substrcmp(*av, "tos") == 0) {
4924             opmodip = 2;
4925             printf("TOS....\n");
4926         } else if (_substrcmp(*av, "DSCP") == 0 ||
4927                      _substrcmp(*av, "dscp") == 0) {
4928             opmodip = 3;
4929             printf("DSCP....\n");
4930         } else if (_substrcmp(*av, "TTL") == 0 ||
4931                      _substrcmp(*av, "ttl") == 0) {
4932             opmodip = 4;
4933             printf("TTL....\n");
4934         } else {
4935             opmodip = 0;
4936             printf("0.....\n");
4937         }
4938         fill_cmd(cmd, O_SETMODIP, 0, modip);
4939         ac--; av++;
4940         printf("Value %d\n", opmodip);
4941         break;
4942     }

ip_fw2.c:
3244             /* New Implementation MODIP. */
3245             case O_SETMODIP:
3246                 printf("Entry ip_fw2.c\n");
3247                 switch (cmd->arg1) {
3248                     case 1:
3249                         printf("DF\n");
3250                         break;
3251                     case 2:
3252                         printf("TOS\n");
3253                         goto O_SETIPTOSPRE;
3254                         break;
3255                     case 3:
3256                         printf("DSCP\n");
3257                         break;
3258                     case 4:
3259                         printf("TTL\n");
3260                         break;
3261                     default:
3262                         printf("0000000\n");
3263                         break;
3264                 }

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? 


Best Regards,

-- 
Marcelo Araujo            (__)
[EMAIL PROTECTED]     \\\'',)
http://www.FreeBSD.org   \/  \ ^
Power To Server.         .\. /_)


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to