gtphub: wrap gtphub_write() for test suite.

Sponsored-by: On-Waves ehi
diff --git a/openbsc/tests/gtphub/Makefile.am b/openbsc/tests/gtphub/Makefile.am
index bcaf4fa..dcb7211 100644
--- a/openbsc/tests/gtphub/Makefile.am
+++ b/openbsc/tests/gtphub/Makefile.am
@@ -13,7 +13,8 @@
 gtphub_test_SOURCES = gtphub_test.c
 gtphub_test_LDFLAGS = \
 	-Wl,--wrap=gtphub_resolve_ggsn_addr \
-	-Wl,--wrap=gtphub_ares_init
+	-Wl,--wrap=gtphub_ares_init \
+	-Wl,--wrap=gtphub_write
 
 gtphub_test_LDADD = \
 	$(top_builddir)/src/gprs/gtphub.o \
diff --git a/openbsc/tests/gtphub/gtphub_test.c b/openbsc/tests/gtphub/gtphub_test.c
index 0d93e5a..0992d79 100644
--- a/openbsc/tests/gtphub/gtphub_test.c
+++ b/openbsc/tests/gtphub/gtphub_test.c
@@ -508,6 +508,24 @@
 	return 0;
 }
 
+/* override, requires '-Wl,--wrap=gtphub_write' */
+int __real_gtphub_write(const struct osmo_fd *to,
+			const struct osmo_sockaddr *to_addr,
+			const uint8_t *buf, size_t buf_len);
+
+int __wrap_gtphub_write(const struct osmo_fd *to,
+			const struct osmo_sockaddr *to_addr,
+			const uint8_t *buf, size_t buf_len)
+{
+	printf("Out-of-band gtphub_write(%d):\n"
+	       "to %s\n"
+	       "%s\n",
+	       (int)buf_len,
+	       osmo_sockaddr_to_str(to_addr),
+	       osmo_hexdump(buf, buf_len));
+	return 0;
+}
+
 #define buf_len 1024
 static uint8_t buf[buf_len];
 static uint8_t *reply_buf;