aboutsummaryrefslogtreecommitdiffstats
path: root/src/frontends/osx
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-12-16 16:58:17 +0100
committerMartin Willi <martin@revosec.ch>2014-12-16 17:22:27 +0100
commit1c6188a0c2cd25604fdcc9b1843298286fb34dfc (patch)
treebf66047c75fc923a9f74836fa7e5abfb054ef6ed /src/frontends/osx
parentf9da7ef868cef64c3dd63ce4eec91c87a6a2978e (diff)
downloadstrongswan-1c6188a0c2cd25604fdcc9b1843298286fb34dfc.tar.bz2
strongswan-1c6188a0c2cd25604fdcc9b1843298286fb34dfc.tar.xz
charon-xpc: Add a work-around to trigger IP address add events after boot
Diffstat (limited to 'src/frontends/osx')
-rw-r--r--src/frontends/osx/charon-xpc/charon-xpc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/frontends/osx/charon-xpc/charon-xpc.c b/src/frontends/osx/charon-xpc/charon-xpc.c
index 2235be12d..057bfbd88 100644
--- a/src/frontends/osx/charon-xpc/charon-xpc.c
+++ b/src/frontends/osx/charon-xpc/charon-xpc.c
@@ -123,6 +123,29 @@ static void segv_handler(int signal)
}
/**
+ * PF_ROUTE for some reason does not send an event for the first address
+ * installed after a fresh boot. Fix this by installing a fake tun address
+ * just to remove it afterwards.
+ */
+static void fixup_pf_route()
+{
+ tun_device_t *tun;
+ host_t *host;
+
+ tun = tun_device_create(NULL);
+ if (tun)
+ {
+ if (tun->up(tun))
+ {
+ host = host_create_from_string("127.0.0.99", 0);
+ tun->set_address(tun, host, 32);
+ host->destroy(host);
+ }
+ tun->destroy(tun);
+ }
+}
+
+/**
* Main function, starts the daemon.
*/
int main(int argc, char *argv[])
@@ -204,5 +227,6 @@ int main(int argc, char *argv[])
atexit(dispatcher_cleanup);
charon->start(charon);
+ fixup_pf_route();
return run();
}