Hello list,

I am developing a userspace TCP/IP stack. Most of the time on my
servers I use special NICs and API to bypass the kernel. When on the go
I'd like to do the same on my OpenBSD dev laptop.

I chose to use tap + bridge and some PF-fu to try to make it work, but
after several fruitless hours i am stumped. Here is my setup:

userspace <-> tap0 <-> bridge0 <-> iwm0 

TAP0 is left unconfigured (except for link0). No route is present for
my userspace stack. I added the following in pf.conf to get out to the
Internet:

> pass out on $lan_if proto tcp from 10.1.0.1 to any nat-to ($lan_if:0)

10.1.0.1 being my userspace stack's IP.

I've gone as far as having one of my packet sent to its destination
address and come back to iwm0. Then, OpenBSD does the reverse
translation and schlepts the packet back on the bridge.

However, because of the lack of route to my userspace stack, openbsd
uses the defaut route's MAC, which is not the one for my tap0 device
and therefore the packet never reaches its destination through bridge0.

I tried to add a static route for the userspace stack's IP but I don't
seem to be able to do that (route fails between "address unreachable"
and "invalid argument" when specifying either the device of the link
address).

Is my approach correct? If so, how get I get openbsd to use the proper
MAC address on the return path?

Thanks!
xavier

Reply via email to