Subject: IP over IP route calculation
To: None <tech-net@netbsd.org>
From: Rick Byers <rickb@iaw.on.ca>
List: tech-net
Date: 05/23/1999 17:06:28
Hi,
I have a need for an IP over IP tunnel which has no intermediate machines.
Here is what my network looks like:

192.168.149.16   - My PC - NetBSD-current
     |
192.168.149.1    Gateway, NetBSD-1.4 using IPNAT
24.112.22.6       
     |
     |           Rogers@Home cable network
     |
24.112.22.29     Other Gateway - NetBSD-1.4
192.168.78.5
     |
192.168.78.1     Remote PC

I need to be able to do windows filesharing (tcp/udp ports 137-139) 
between the 192.168.149 and 192.168.78 networks.  I can route the packets
directly (with a minor hack to IP nat to prevent translation), but the
cable modems block traffic on those ports.  So, I want to use an IP over
IP tunnel. 

However, ipip_compute_route (ip_ipip.c) uses a hack to compute the route
to the destination end of the tunnel.  It's toggles the last bit of the IP
address.  This would normally work fine when there is a gateway machine
between the two tunnel end-points, but in my case is causes the traffic to
get sent to the MAC address of 24.112.22.29.  So I need a better way of
computing the route.  I've been digging around the source for an hour or
so now, and haven't really had any luck. 

I would guess that the "right" way to do this would be to modify the route
structure to contain information about permitted interfaces, or atleast
permitted interface "types" (direct, tunnel, etc..).  However, I don't
think I know the networking code well enough to make a change like this
without breaking everything.

So, I've been trying to come up with a different hack to make this work.
Perhaps disabling the routing table entry for the tunnel while the route
is calculated.  However, there are so many layers involved in route
calculation, that I'm left perplexed (I don't quite understand all the
'radix' stuff).

Anyway, I was hoping someone could atleast point me in the right
direction.  Maybe take a couple of minutes to give me a quick overview of
what the rtalloc stuff is actually doing (it's doesn't seem to be
commented very thouroughly).  Does anyone have any suggestions of a way of
implementing this (as a quick hack, or the "RIGHT" way)?

Thanks a-lot...
	Rick

=========================================================================
Rick Byers                       University of Waterloo, Computer Science
rickb@iaw.on.ca                               http://www.iaw.on.ca/rickb/