core: recognize some helper script options libreswan renamed
core: simplify prefix/netmask code

The netmask is hardcoded for now, no sense converting from string to number.
core: make some log messages and debug variables generic

Instead of only referencing openswan
core: use G_SPAWN_DO_NOT_REAP_CHILD when starting initial pluto process

The child is already reaped with waitpid() in pluto_watch_cb().
trivial: whitespace cleanups

No code changes.
core: use g_set_error_literal() where appropriate
core: consolidate ipsec helper search
core: simplify writing the PSK

Move writing the PSK to the only function that cares about it.
core: remove commented code
core: trivial: simplify some code
core: remove write_one_property()

It was only used for writing the PSK, which is now done elsewhere,
so it can be removed.
core: use different name for each connection

Instead of everything being named 'nm-conn1' use a different name
for each connection based on the UUID.
core: consolidate helper program launching
core: "ipsec setup start" doesn't stick around

The command just starts the ipsec service and then exits, so if we
kill the VPN connection when it stops, we kill it every single time
and long before anything has happened.  Just don't do that.

Instead only fail if a child process exits with a non-zero exit
code, which probably does indicate an error.
Revert "Fixed an issue where writing configuration on stdin should not end with \n as it gives error. It used to work previously, but not with latest versions."

This reverts commit e2aa41b86012963328d59550d7b82a19f1f79d2f.

The initial problem was likely not the lack of \n but a combination
of not waiting long enough for the child process to be ready, and
closing the stdin pipe too early.
core: rework connect process and subprocess handling

Instead of sprinkling sleep() calls around, waiting for processes to
be ready, actually wait until they are ready.  Since the ipsec
processes are only helpers that spawn the actual 'pluto' process,
we can simply wait until they exit to proceed.

Second, the user password handling was quite racy, often writing
the password long before the subprocess was ready.  Second, it didn't
work when running nm-openswan with --debug on a terminal, because
whack (the helper that asks for the password) uses getpass() which
opens /dev/tty instead of reading from stdin.  To handle that, we
must spawn the process that eventually asks for the password in
a pseudo-TTY with pipes so we can write the password to it when
it asks for one.
core: implement interactive secrets requests

Request secrets from NetworkManager when existing secrets are
insufficient and openswan asks us for new ones.
auth-dialog: handle and parse hints
core: autodetect NEVER_DEFAULT by searching kernel IPSec routes

The IPSec daemon doesn't indicate to us whether upstream sent
routes (eg, CISCO_SPLIT_INC) so we have no way to easily determine
whether or not the VPN should get the default route automatically.

Instead, what we can do is ask the kernel for the IPSec security
association database, and look through the routes it returns for
an assocation between a subnet route and the VPN gateway we just
connected to.  This indicates that the gateway sent some subnets
that should be secured with IPSec, which in turn indicates that
the VPN should not receive the default route (because if it should,
why was the VPN sending specific subnets to secure?).
build: remove usage of INCLUDES