A question on modifying packet.

Sami Halabi sodynet1 at gmail.com
Wed Jul 9 17:47:55 UTC 2014


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=2 csum_flags=1
ops=[         \
                         { mode=1 value=0xc0a8e609 length=4 offset=12 }  \
                         { mode=1 value=0xc0a8e680 length=4 offset=16 } ] }
         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 address
> and change the both src and dst addresses and forward to other destination
> via the same NIC. It is possible? Is there any library to help me do this?
>
there is no library, but look at how natd does this using divert sockets.


>
> Regards,
> Niu Zhixiong
> ---------------
>   kaiaixi at gmail.com
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
>
>
>
_______________________________________________
freebsd-net at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"


More information about the freebsd-net mailing list