Open mweinelt opened 2 years ago
The on-establish hook is not run when renewing an existing connection; this is expected. Unfortunately is it sometimes necessary to tear down and recreate L2TP offload interfaces even for a renewal, as some settings can't be changed for existing L2TP interfaces.
For interface setup, use on-up, which is called each time an interface is created (and for each peer in TUN and Multi-TAP mode).
Note that on-up is currently not passed all environment variables that on-establish gets (in particular, no IP address and port information). This is unlikely to be an issue in practice, as this information is fairly useless with on-establish as well for anything but logging purposes, as addresses and ports may change without on-establish being called again...
What would be the appropriate hook to clean up after disconnect/timeout? Thinking of setting link down, nomaster and removing the link, or is that entirely pointless?
The documentation on when these hooks are called is slightly unintuitive.
Hmm yes, I think some of the documentation predates the multi-interface modes of fastd and could use some updates and clarification...
The rules are:
null@l2tp
and another method.persist interface no
, a peer interface is removed as soon as its connection times out (or is disestablished for another reason)on-down is usually the right place for cleanup, if there is anything that isn't cleaned up simply by the interface disappearing.
Maybe it would be a good idea to deprecate on-establish/on-disestablish in TUN and Multi-TAP modes to reduce confusion, and possibly extend peer-specific on-up/on-down to include the same environment as on-establish/on-disestablish currently do.
Edit: This only makes sense when persist interface no
is also set
Every day the offloader in our hackspace reconnects to a gateway and the link ends up down, because the establish hook is not called. This connection always uses
null@l2tp
and we are using a multitap setup.The configuration roughly looks like this:
and a successful connect looks like so: