Date: Thu, 10 Jul 2014 10:40:58 +0800 From: Niu Zhixiong <kaiaixi@gmail.com> To: Sami Halabi <sodynet1@gmail.com>, freebsd-net@freebsd.org Subject: Re: A question on modifying packet. Message-ID: <CAOENNMAkeZP7=rQsJDYEjTanUJUN%2BT7kc2kY95arP_T4NG8qtQ@mail.gmail.com> In-Reply-To: <CAEW%2BoganLM=as%2Bb2GOsKbqbsjw95uMnfVKVj09ZdFndvO8V21Q@mail.gmail.com> References: <CAOENNMA-%2B6P2tT3JTusH3Q8Qz4O7XnAc0ZEjVRqxU3W342sp%2Bg@mail.gmail.com> <53BD7317.9030008@freebsd.org> <CAEW%2BoganLM=as%2Bb2GOsKbqbsjw95uMnfVKVj09ZdFndvO8V21Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Sry, The problem is that I receive the packet from this NIC and send this packet via the same NIC? Does netmap can help me? Regards, Niu Zhixiong =EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF= =BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D kaiaixi@gmail.com On Thu, Jul 10, 2014 at 1:47 AM, Sami Halabi <sodynet1@gmail.com> wrote: > use netgraph. > In theory it should work.. in practice It worked for me once, but couldn'= t > repeat the success. > > See ng_patch. Here is the code i tried: > kldload ng_patch > kldload ng_ipfw > /usr/sbin/ngctl -f- << SEQ > mkpeer ipfw: patch 300 in > name ipfw:300 src_dst_chg > msg src_dst_chg: setconfig { count=3D2 csum_flags=3D1 > ops=3D[ \ > { mode=3D1 value=3D0xc0a8e609 length=3D4 offset= =3D12 } \ > { mode=3D1 value=3D0xc0a8e680 length=3D4 offset= =3D16 } ] } > SEQ > /sbin/ipfw add 600 netgraph 300 log ip from any to 239.0.0.19 dst-port > 1234 in via vlan999 > > Sami > On 7/9/14, 1:01 PM, Niu Zhixiong wrote: > >> Hi, all >> I have only one NIC. I want to capture packets from one certain ip addre= ss >> and change the both src and dst addresses and forward to other destinati= on >> via the same NIC. It is possible? Is there any library to help me do thi= s? >> > there is no library, but look at how natd does this using divert sockets. > > >> >> Regards, >> Niu Zhixiong >> =EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D= =EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D >> kaiaixi@gmail.com >> _______________________________________________ >> freebsd-net@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-net >> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >> >> >> > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOENNMAkeZP7=rQsJDYEjTanUJUN%2BT7kc2kY95arP_T4NG8qtQ>