In message <Pine.LNX.4.00.10002080057370.22280-100000@xxxxxxxxxxxxxxxx> you wri
te:
> Ideally.. if I could do something like..
> ipchains -A input -p udp -s x.x.0.0/255.255.252.0 -d 0/0 -j MASQ
How equisitely disgusting!
My advice: use LD_PRELOAD and tell it what it wants to know when it
calls getsockname().
OR: use the ethertap device, grab a free address in the C class you
want, and aim a host route out to tap0.
Then write something in userspace, which loops like so:
1) read packet from /dev/tap0
2) recalculate IP checksum
3) recalc protocol checksum if TCP or UDP
4) rewrite destination IP (source IP for `reply' packets).
Similar code can be found in libfw.
Enjoy,
Rusty.
--
Hacking time.
|