aboutsummaryrefslogtreecommitdiffstats
path: root/testing/wpa_actiond/no_trampoline.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/wpa_actiond/no_trampoline.patch')
-rw-r--r--testing/wpa_actiond/no_trampoline.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/testing/wpa_actiond/no_trampoline.patch b/testing/wpa_actiond/no_trampoline.patch
new file mode 100644
index 0000000000..560f05aafb
--- /dev/null
+++ b/testing/wpa_actiond/no_trampoline.patch
@@ -0,0 +1,95 @@
+--- wpa_actiond-1.4-old/wpa_actiond.c
++++ wpa_actiond-1.4-new/wpa_actiond.c
+@@ -72,6 +72,23 @@
+ WPA_ACTIOND_LOG_CUSTOM_ERROR
+ };
+
++/* wpa_supplicant control structure */
++static struct wpa_ctrl *ctrl;
++
++/* states and events */
++static enum wpastate state = WPA_ACTIOND_STATE_UNDEFINED;
++static enum wpaevent ev;
++/* select stuff */
++static int ctrl_fd;
++static fd_set ctrl_fds;
++/* save ssid */
++static char ssid[SSIDLEN], old_ssid[SSIDLEN];
++static char idstr[IDSTRLEN], old_idstr[IDSTRLEN];
++/* for terminate handler*/
++static const char *iface;
++static const char *script;
++static const char *pidfile;
++
+ static void logevent(enum wpa_actiond_logevent l, const char *iface, const char *arg) {
+ static int isopen = 0, tostderr = 0;
+
+@@ -270,48 +287,43 @@
+ }
+ }
+
+-static void loop(const char *iface, const char *ctrlpath, const int disconnect_timeout, const char *script, const char *pidfile) {
+- /* wpa_supplicant control structure */
+- struct wpa_ctrl *ctrl;
++static void terminate(int s) {
++ if(state == WPA_ACTIOND_STATE_CONNECTED || state == WPA_ACTIOND_STATE_CONNECTION_LOST) {
++ logevent(WPA_ACTIOND_LOG_DISCONNECTED, iface, ssid);
++ action(WPA_ACTIOND_ACTION_DISCONNECT, iface, ssid, idstr, wpa_ctrl_get_fd(ctrl), script);
++ }
++ logevent(WPA_ACTIOND_LOG_TERMINATE, iface, "");
++
++ FD_ZERO(&ctrl_fds);
++ wpa_ctrl_detach(ctrl);
++ wpa_ctrl_close(ctrl);
++ unlink(pidfile);
++ exit(0);
++}
++
++static void loop(const char *_iface, const char *ctrlpath, const int disconnect_timeout, const char *_script, const char *_pidfile) {
+ /* buffer for wpa_supplicant replies */
+ char reply[BUFLEN];
+ size_t reply_len;
+- /* states and events */
+- enum wpastate state = WPA_ACTIOND_STATE_UNDEFINED;
+- enum wpaevent ev;
+- /* select stuff */
+- int ctrl_fd;
+- fd_set ctrl_fds;
+ int r;
+ /* select timeout */
+ struct timeval timeout;
+ struct timeval ping_timeout;
+- /* save ssid */
+- char ssid[SSIDLEN], old_ssid[SSIDLEN];
+- char idstr[IDSTRLEN], old_idstr[IDSTRLEN];
+ /* path to control socket */
+ char *ctrlsock = NULL;
+ int ctrlsocklen;
+
++ /* set up globals for terminate signal handler */
++ iface = _iface;
++ script = _script;
++ pidfile = _pidfile;
++
+ ssid[0] = '\0';
+ old_ssid[0] = '\0';
+ idstr[0] = '\0';
+ old_idstr[0] = '\0';
+
+ /* set up signals */
+- void terminate(int s) {
+- if(state == WPA_ACTIOND_STATE_CONNECTED || state == WPA_ACTIOND_STATE_CONNECTION_LOST) {
+- logevent(WPA_ACTIOND_LOG_DISCONNECTED, iface, ssid);
+- action(WPA_ACTIOND_ACTION_DISCONNECT, iface, ssid, idstr, wpa_ctrl_get_fd(ctrl), script);
+- }
+- logevent(WPA_ACTIOND_LOG_TERMINATE, iface, "");
+-
+- FD_ZERO(&ctrl_fds);
+- wpa_ctrl_detach(ctrl);
+- wpa_ctrl_close(ctrl);
+- unlink(pidfile);
+- exit(0);
+- }
+ signal(SIGTERM, terminate);
+ signal(SIGHUP, SIG_IGN);
+