From owner-freebsd-net@FreeBSD.ORG Tue Jan 12 00:30:27 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51BD4106568D for ; Tue, 12 Jan 2010 00:30:27 +0000 (UTC) (envelope-from gelraen.ua@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id D7E358FC0C for ; Tue, 12 Jan 2010 00:30:26 +0000 (UTC) Received: by bwz5 with SMTP id 5so14214680bwz.3 for ; Mon, 11 Jan 2010 16:30:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=hq7ewOlk81HVXT/PqU6iOs2uxWGNdCcDej8zgD6Re98=; b=t3+YF724HxPFl7fP5hCeQcRcJ5ib/Rad8yzcYdJ8zTUhe1i5pIz/j3TlGc0At+yylj Ih8kcUq28+0oynbfy7xaCk1UU4jd9AlWVYeNxv+V54pkNRn1llDOlQdz9c5G7oOrNgqZ K9gySjZLaKpvds+rrLujVZuy8q+599BXUH4Z0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=wvvllMv3qUpxfopfFjlY08HQPxjVlGLVqxi3wfcL/Q0v/y34Nvije0cvQsmoSYgJUm yFQHWbNKFfDoIPTLT78T0NTB4GpJ5Cm3sS6Yvf2dIclmxjSYZ5v7/xK6ce8j0awTVf/C Dol7Q2A7pG/+lTepjTqzRhfZn3i58gYUTnCwc= MIME-Version: 1.0 Received: by 10.204.135.217 with SMTP id o25mr1903114bkt.105.1263256219093; Mon, 11 Jan 2010 16:30:19 -0800 (PST) In-Reply-To: <4B4BBE59.9010908@elischer.org> References: <4B4BBE59.9010908@elischer.org> From: Maxim Ignatenko Date: Tue, 12 Jan 2010 02:29:59 +0200 Message-ID: To: Julian Elischer Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-net@freebsd.org Subject: Re: ng_patch node X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2010 00:30:27 -0000 2010/1/12 Julian Elischer : > 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 :)