[Swan-dev] the EVENT_PENDING_DDNS event

Paul Wouters paul at nohats.ca
Tue Jan 27 23:58:16 EET 2015


While converting to libevent, we noticed this event EVENT_PENDING_DDNS

It is associated with connection_check_ddns()

This function first loops over oriented connections and calls
connection_check_ddns1(c)

then it loops over all unoriented connections and calls
connection_check_ddns1(c)


The function connection_check_ddns1() checks if the connection loaded
used DNS names instead of IP addresses (via c>dnshostname)
If so, it tries to resolve the remote hostname. It is resolves, it
updates c->spd.that.host_addr (and c->spd.this.host_nexthop) and
calls update_host_pairs(c) and then calls initiate_connection()
and then loops through all connections on the same hostpair and
if initiates those as well.

I think this translates to "If loading a connection where the remote
endpoint is a hostname which did not resolve, try again in a minute".

It does cause a connection with auto=add to actually initiate as if it
had auto=route|start just be using a DNS name that does not initially
resolve. I think that's a bug.

I also do not think this addresses the use case of dynamic dns, where
the remote changes IP, our DPD kicks in, and now the remote DNS changes
and we hope to pick this up somehow.

Right now this function has been converted to libevent. But I think in
the future we should revisit this using a new libevent type that depends
on DNS for resolving and then does better checks on whether it should
do something to the connection.

Paul


More information about the Swan-dev mailing list