Date: Tue, 04 Mar 2008 17:30:58 +0600 From: "Vadim Goncharov" <vadim_nuclight@mail.ru> To: araujo@freebsd.org Cc: stas@mbsd.msk.ru, Luigi Rizzo <rizzo@icir.org>, Oleg Bulyzhin <oleg@freebsd.org>, freebsd-ipfw@freebsd.org, "Andrey V. Elsukov" <bu7cher@yandex.ru>, Julian Elischer <julian@elischer.org>, Ion-Mihai Tetcu <itetcu@freebsd.org>, "Bruce M. Simpson" <bms@freebsd.org> Subject: Re: ipfw modip [DF|TOS|DSCP|TTL] Message-ID: <opt7hoxwnk17d6mn@nuclight.avtf.net> In-Reply-To: <47CCC0AA.5030106@FreeBSD.org> References: <200802261908.m1QJ8n5N023371@freefall.freebsd.org> <47C4F2D1.5080703@yandex.ru> <47C5516F.9080200@FreeBSD.org> <47C64BB7.60309@yandex.ru> <47C68CD1.10409@FreeBSD.org> <47CCC0AA.5030106@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?opt7hoxwnk17d6mn>