[Click] Help, how to route according to source IP address of an IP packet

Harald Schioeberg harald at net.t-labs.tu-berlin.de
Thu Mar 17 05:20:49 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 03/12/2011 03:55 PM, wubaochuan wrote:
> hi everyone,
>         The IPv4 Routing elements can route IP packets according to the 
> destination address of IP packets, 

looking at iproutetable.cc:153:
    int port = lookup_route(p->dst_ip_anno(), gw);

it looks like the route-tables actually use the destination annotation...


How to route IP packets according to
> source address of IP packets? 

and you can set the DstAnno using GetIPAddress, to grab the source IP
you would use offset 12,...

that means
	GetIPAddress(12)->SomeIPRoutetable(...)

should do the trick.

> I want to forward all IP packets from
> 10.2.2.0/24 to a machine.

well, this simple case can be done just using a classifier, like:

Classifier(12/0a020200%ffffff00, - )

I tried none of these, but maybe they set you on the right track.

	Harald


>        Thank you.
> Yours
> Chuan
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2B0m4ACgkQy8wrZ9OvkU1+dwCeMe9zNrZpWnilblFWcC0W2Q88
tzwAoIyBmJ9sBTSahgDdag2tejo0IJfM
=lQAE
-----END PGP SIGNATURE-----


More information about the click mailing list