Date: Tue, 04 Mar 2008 00:23:22 -0300 From: Marcelo Araujo <araujobsdport@gmail.com> 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>, Vadim Goncharov <vadimnuclight@tpu.ru> Subject: ipfw modip [DF|TOS|DSCP|TTL] Message-ID: <47CCC0AA.5030106@FreeBSD.org> In-Reply-To: <47C68CD1.10409@FreeBSD.org> References: <200802261908.m1QJ8n5N023371@freefall.freebsd.org> <47C4F2D1.5080703@yandex.ru> <47C5516F.9080200@FreeBSD.org> <47C64BB7.60309@yandex.ru> <47C68CD1.10409@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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 (__)
araujo@FreeBSD.org \\\'',)
http://www.FreeBSD.org \/ \ ^
Power To Server. .\. /_)
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)
iD8DBQFHzMCvovxJd1Pkz6gRAusaAJ9rgDi20ZYyEoDkHhUvIIs3SkzyhACgh9e+
I0+me0mLj52SA6fECXXTMbI=
=lYCt
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47CCC0AA.5030106>
