summaryrefslogtreecommitdiff
path: root/main/openvpn
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-03-13 13:37:57 +0100
committerArne Schwabe <arne@rfc2549.org>2014-03-13 13:37:57 +0100
commitd2692a74e86d44cc70e276184f1c67a84bfe17ae (patch)
treea446a705d60a7097f93b3a3e3e06e11ca53d4796 /main/openvpn
parent9c3b8cae419af4888580fe89b4c5d3789d4369ad (diff)
Allow interface roaming. Currently only tested with static/udp configuration
Diffstat (limited to 'main/openvpn')
-rw-r--r--main/openvpn/config-version.h4
-rw-r--r--main/openvpn/src/openvpn/init.c17
-rw-r--r--main/openvpn/src/openvpn/manage.c17
-rw-r--r--main/openvpn/src/openvpn/manage.h3
4 files changed, 39 insertions, 2 deletions
diff --git a/main/openvpn/config-version.h b/main/openvpn/config-version.h
index 3b3c7918..4dcbb0ae 100644
--- a/main/openvpn/config-version.h
+++ b/main/openvpn/config-version.h
@@ -1,2 +1,2 @@
-#define CONFIGURE_GIT_REVISION "icsopenvpn_70-078981e61dfdf105"
-#define CONFIGURE_GIT_FLAGS ""
+#define CONFIGURE_GIT_REVISION "icsopenvpn_610-eab94f1a54e461a1"
+#define CONFIGURE_GIT_FLAGS "+"
diff --git a/main/openvpn/src/openvpn/init.c b/main/openvpn/src/openvpn/init.c
index c39646de..a866b7d6 100644
--- a/main/openvpn/src/openvpn/init.c
+++ b/main/openvpn/src/openvpn/init.c
@@ -3209,6 +3209,20 @@ management_show_net_callback (void *arg, const int msglevel)
#endif
}
+#ifdef TARGET_ANDROID
+int
+managmenet_callback_network_change (void *arg)
+{
+ struct context *c = (struct context *) arg;
+ if (!c->c2.link_socket)
+ return -1;
+ if (c->c2.link_socket->sd == SOCKET_UNDEFINED)
+ return -1;
+
+ return c->c2.link_socket->sd;
+}
+#endif
+
#endif
void
@@ -3224,6 +3238,9 @@ init_management_callback_p2p (struct context *c)
cb.show_net = management_show_net_callback;
cb.proxy_cmd = management_callback_proxy_cmd;
cb.remote_cmd = management_callback_remote_cmd;
+#ifdef TARGET_ANDROID
+ cb.network_change = managmenet_callback_network_change;
+#endif
management_set_callback (management, &cb);
}
#endif
diff --git a/main/openvpn/src/openvpn/manage.c b/main/openvpn/src/openvpn/manage.c
index 561c252b..855ed042 100644
--- a/main/openvpn/src/openvpn/manage.c
+++ b/main/openvpn/src/openvpn/manage.c
@@ -1105,6 +1105,19 @@ man_remote (struct management *man, const char **p)
}
}
+#ifdef TARGET_ANDROID
+static void
+man_network_change (struct management *man)
+{
+ if (man->persist.callback.network_change)
+ {
+ int fd = (*man->persist.callback.network_change)(man->persist.callback.arg);
+ man->connection.fdtosend = fd;
+ msg (M_CLIENT, "PROTECTFD: fd '%d' sent to be protected", fd);
+ }
+}
+#endif
+
static void
man_dispatch_command (struct management *man, struct status_output *so, const char **p, const int nparms)
{
@@ -1148,6 +1161,10 @@ man_dispatch_command (struct management *man, struct status_output *so, const ch
if (man_need (man, p, 1, 0))
man_signal (man, p[1]);
}
+ else if (streq (p[0], "network-change"))
+ {
+ man_network_change(man);
+ }
else if (streq (p[0], "load-stats"))
{
man_load_stats (man);
diff --git a/main/openvpn/src/openvpn/manage.h b/main/openvpn/src/openvpn/manage.h
index 1c8dda69..c48875c7 100644
--- a/main/openvpn/src/openvpn/manage.h
+++ b/main/openvpn/src/openvpn/manage.h
@@ -173,6 +173,9 @@ struct management_callback
#endif
bool (*proxy_cmd) (void *arg, const char **p);
bool (*remote_cmd) (void *arg, const char **p);
+#ifdef TARGET_ANDROID
+ int (*network_change) (void *arg);
+#endif
};
/*