zehome / MLVPN

Multi-link VPN (ADSL/SDSL/xDSL/Network aggregation / bonding)
http://www.mlvpn.fr/
BSD 2-Clause "Simplified" License
519 stars 126 forks source link

FreeBSD and SO_SETFIB feature #63

Closed ocochard closed 8 years ago

ocochard commented 8 years ago

For using source-routing on FreeBSD, I didn't found how to source-route packets generated by the system it-self.

This mean, if my FreeBSD-mlvpn-client is configured like that:

#Interface toward ISP-1
ifconfig_vtnet0="10.0.12.1/24 fib 1"
#Interface toward ISP-2
ifconfig_vtnet1="10.0.13.1/24 fib 2"
#Interface to internal LAN (default fib 0)
ifconfig_vtnet2="192.168.1.254/24"
static_routes="ISP1 ISP2"
route_ISP1="-fib 1 default 10.0.12.2"
route_ISP2="-fib 2 default 10.0.13.3"

Now I can't configure my firewall (ipfw) to says:

Then how to configure mlvpn to use different routing table ?

FreeBSD allow to setsockopt(2) with option SO_SETFIB:

  SO_SETFIB       set the associated FIB (routing table) for the
                  socket (set only)

Is possible (or easy for a newbie C dev) to add this feature to mlvpn ? The idea is to configure mlvpn like that:

[dsl2]
bindhost = "10.0.12.1"
bindport = 5082
bindfib = 1
remotehost = "10.0.56.6"
remoteport = 5082

[dsl3]
bindhost = "10.0.13.1"
bindport = 5083
bindfib = 2
remotehost = "10.0.56.6"
remoteport = 5083

I believe this will simplify the source-route setup.

zehome commented 8 years ago

Would not be hard to implement I guess.

Basically you would have to implement the new configuration option in the documentation, then the example file, then implement in configfile.c the read/reread, and finally implement it in mlvpn.c:mlvpn_rtun_start

ocochard commented 8 years ago

Thanks for the advice, pull request send: https://github.com/zehome/MLVPN/pull/65