Date: Tue, 12 Jan 2010 02:29:59 +0200 From: Maxim Ignatenko <gelraen.ua@gmail.com> To: Julian Elischer <julian@elischer.org> Cc: freebsd-net@freebsd.org Subject: Re: ng_patch node Message-ID: <ac42db051001111629p118cf6e4p4adce3dc4fb90065@mail.gmail.com> In-Reply-To: <4B4BBE59.9010908@elischer.org> References: <ac42db051001111440p7b460641g855e4264d9433f58@mail.gmail.com> <4B4BBE59.9010908@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
2010/1/12 Julian Elischer <julian@elischer.org>: > Maxim Ignatenko wrote: >> >> Hi, >> I've written netgraph node able to modify arbitrary (8|16|32)-bit >> unsigned integer in passing packets. Node applies one of =3D,+,-,&,| and >> ^ operations to number at given offset. >> Modification applied to each packet received on "in" hook. If "out" >> hook is connected - resulting packets passed on it, otherwise - >> returned back on "in" (for more easy use with ng_ipfw). Packets >> received on "out" hook passed on "in" unmodified. >> Node supports two control messages: "getconfig" and "setconfig". >> Configuration represented in next structure: >> struct ng_patch_config { >> =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2=A0 =C2=A0 =C2=A0value; /* argum= ent passed to requested operation */ >> =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2=A0 =C2=A0 =C2=A0offset; /* offs= et in bytes */ >> =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2=A0 =C2=A0 =C2=A0length; /* 1,2 = or 4 bytes */ >> =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2=A0 =C2=A0 =C2=A0mode; /* operat= ion code: 1 - "=3D", 2 - "+", 3 - >> "-", 4 - "&", 5 - "|", 6 - "^" */ >> }; >> Same names used in ASCII representation. >> >> I wanted to make ipfw able to modify TTL and ToS fields in IP packets, >> but after some generalization idea looked like described above. > > > I like it :-) > if you can provide a short man page, I can commit it for you. > I'll try to do this in few days, thanks :)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ac42db051001111629p118cf6e4p4adce3dc4fb90065>