netdev
[Top] [All Lists]

Re: routing tricks

To: Greg Simpson <gws@xxxxxxxxx>
Subject: Re: routing tricks
From: Rusty Russell <rusty@xxxxxxxxxxxxxxxx>
Date: Wed, 23 Feb 2000 15:39:51 +1100
Cc: netdev@xxxxxxxxxxx
In-reply-to: Your message of "Tue, 08 Feb 2000 01:22:46 CDT." <Pine.LNX.4.00.10002080057370.22280-100000@nofear.sweet.com>
Sender: owner-netdev@xxxxxxxxxxx
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.

<Prev in Thread] Current Thread [Next in Thread>