clatd: move stop_loop() into main.c am: 8ab7e13332

Original change: https://android-review.googlesource.com/c/platform/external/android-clat/+/1574002

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I88221b6c178ddc5e1044e947a7c712dd620ca9f7
diff --git a/clatd.c b/clatd.c
index 422cded..3ffe934 100644
--- a/clatd.c
+++ b/clatd.c
@@ -58,11 +58,6 @@
 
 volatile sig_atomic_t running = 1;
 
-/* function: stop_loop
- * signal handler: stop the event loop
- */
-void stop_loop() { running = 0; }
-
 /* function: configure_packet_socket
  * Binds the packet socket and attaches the receive filter to it.
  *   sock - the socket to configure
diff --git a/clatd.h b/clatd.h
index a3f9326..899458c 100644
--- a/clatd.h
+++ b/clatd.h
@@ -18,6 +18,7 @@
 #ifndef __CLATD_H__
 #define __CLATD_H__
 
+#include <signal.h>
 #include <stdlib.h>
 #include <sys/uio.h>
 
@@ -35,7 +36,8 @@
 // how frequently (in seconds) to poll for an address change while there is no traffic
 #define NO_TRAFFIC_INTERFACE_POLL_FREQUENCY 90
 
-void stop_loop();
+extern volatile sig_atomic_t running;
+
 void configure_tun_ip(const struct tun_data *tunnel, const char *v4_addr, int mtu);
 void set_capability(uint64_t target_cap);
 void drop_root_but_keep_caps();
diff --git a/main.c b/main.c
index 683b507..bfcad48 100644
--- a/main.c
+++ b/main.c
@@ -35,6 +35,11 @@
 
 #define DEVICEPREFIX "v4-"
 
+/* function: stop_loop
+ * signal handler: stop the event loop
+ */
+static void stop_loop() { running = 0; };
+
 /* function: print_help
  * in case the user is running this on the command line
  */