summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-06-16 14:59:56 +0800
committerHarald Welte <laforge@gnumonks.org>2012-06-16 15:14:00 +0800
commitea34a4e3a7741c0b03fc421e2850234b82a0977c (patch)
tree6a57247a94bf85ac6b24261fcff831eeb3593920
parent704cb8680bbdf62cdaa2583fd5072791b7589a90 (diff)
split libgb into a separate library for outside use
This also removes the dependency to osmo_sock() inside libcommon and replaces it with osmo_sock_* from libosmocore
-rw-r--r--openbsc/configure.ac2
-rw-r--r--openbsc/include/Makefile.am2
-rw-r--r--openbsc/include/openbsc/Makefile.am4
-rw-r--r--openbsc/include/openbsc/gb_proxy.h2
-rw-r--r--openbsc/include/openbsc/sgsn.h2
-rw-r--r--openbsc/include/osmocom/Makefile.am1
-rw-r--r--openbsc/include/osmocom/gprs/Makefile.am3
-rw-r--r--openbsc/include/osmocom/gprs/gprs_bssgp.h (renamed from openbsc/include/openbsc/gprs_bssgp.h)2
-rw-r--r--openbsc/include/osmocom/gprs/gprs_ns.h (renamed from openbsc/include/openbsc/gprs_ns.h)0
-rw-r--r--openbsc/include/osmocom/gprs/gprs_ns_frgre.h (renamed from openbsc/include/openbsc/gprs_ns_frgre.h)0
-rw-r--r--openbsc/src/gprs/gb_proxy.c5
-rw-r--r--openbsc/src/gprs/gb_proxy_main.c5
-rw-r--r--openbsc/src/gprs/gb_proxy_vty.c3
-rw-r--r--openbsc/src/gprs/gprs_gmm.c3
-rw-r--r--openbsc/src/gprs/gprs_llc.c2
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c5
-rw-r--r--openbsc/src/gprs/gprs_sndcp.c2
-rw-r--r--openbsc/src/gprs/sgsn_libgtp.c4
-rw-r--r--openbsc/src/gprs/sgsn_main.c5
-rw-r--r--openbsc/src/gprs/sgsn_vty.c2
-rw-r--r--openbsc/src/libbsc/bsc_vty.c2
-rw-r--r--openbsc/src/libgb/gprs_bssgp.c8
-rw-r--r--openbsc/src/libgb/gprs_bssgp_bss.c4
-rw-r--r--openbsc/src/libgb/gprs_bssgp_util.c4
-rw-r--r--openbsc/src/libgb/gprs_bssgp_vty.c13
-rw-r--r--openbsc/src/libgb/gprs_ns.c21
-rw-r--r--openbsc/src/libgb/gprs_ns_frgre.c14
-rw-r--r--openbsc/src/libgb/gprs_ns_vty.c13
28 files changed, 80 insertions, 53 deletions
diff --git a/openbsc/configure.ac b/openbsc/configure.ac
index 16eb732b6..3f9333a31 100644
--- a/openbsc/configure.ac
+++ b/openbsc/configure.ac
@@ -114,6 +114,8 @@ AM_CONFIG_HEADER(bscconfig.h)
AC_OUTPUT(
openbsc.pc
include/openbsc/Makefile
+ include/osmocom/Makefile
+ include/osmocom/gprs/Makefile
include/Makefile
src/Makefile
src/libtrau/Makefile
diff --git a/openbsc/include/Makefile.am b/openbsc/include/Makefile.am
index 4596b6e3c..2cc8bee71 100644
--- a/openbsc/include/Makefile.am
+++ b/openbsc/include/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = openbsc
+SUBDIRS = openbsc osmocom
noinst_HEADERS = mISDNif.h compat_af_isdn.h
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index 8e64ff8d3..58fa691b0 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -7,9 +7,9 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
system_information.h handover.h mgcp_internal.h \
vty.h socket.h e1_config.h trau_upqueue.h token_auth.h \
handover_decision.h rrlp.h control_if.h \
- crc24.h gprs_bssgp.h gprs_llc.h gprs_ns.h gprs_gmm.h \
+ crc24.h gprs_llc.h gprs_gmm.h \
gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \
- gprs_ns_frgre.h auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
+ auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h \
osmo_msc_data.h osmo_bsc_grace.h sms_queue.h abis_om2000.h \
bss.h gsm_data_shared.h control_cmd.h ipaccess.h mncc_int.h
diff --git a/openbsc/include/openbsc/gb_proxy.h b/openbsc/include/openbsc/gb_proxy.h
index c0cdcbf05..2c8ddb334 100644
--- a/openbsc/include/openbsc/gb_proxy.h
+++ b/openbsc/include/openbsc/gb_proxy.h
@@ -4,7 +4,7 @@
#include <osmocom/core/msgb.h>
-#include <openbsc/gprs_ns.h>
+#include <osmocom/gprs/gprs_ns.h>
#include <osmocom/vty/command.h>
struct gbproxy_config {
diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h
index 966b4e68b..48a7b3474 100644
--- a/openbsc/include/openbsc/sgsn.h
+++ b/openbsc/include/openbsc/sgsn.h
@@ -4,7 +4,7 @@
#include <osmocom/core/msgb.h>
-#include <openbsc/gprs_ns.h>
+#include <osmocom/gprs/gprs_ns.h>
#include <openbsc/gprs_sgsn.h>
struct sgsn_config {
diff --git a/openbsc/include/osmocom/Makefile.am b/openbsc/include/osmocom/Makefile.am
new file mode 100644
index 000000000..596ce23fc
--- /dev/null
+++ b/openbsc/include/osmocom/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = gprs
diff --git a/openbsc/include/osmocom/gprs/Makefile.am b/openbsc/include/osmocom/gprs/Makefile.am
new file mode 100644
index 000000000..fe5714ea8
--- /dev/null
+++ b/openbsc/include/osmocom/gprs/Makefile.am
@@ -0,0 +1,3 @@
+libgb_HEADERS = gprs_bssgp.h gprs_ns.h gprs_ns_frgre.h
+
+libgbdir = $(includedir)/osmocom/gprs
diff --git a/openbsc/include/openbsc/gprs_bssgp.h b/openbsc/include/osmocom/gprs/gprs_bssgp.h
index df93f5b2c..bfc7d331d 100644
--- a/openbsc/include/openbsc/gprs_bssgp.h
+++ b/openbsc/include/osmocom/gprs/gprs_bssgp.h
@@ -143,6 +143,8 @@ enum gprs_bssgp_cause {
/* Our implementation */
+#include <osmocom/gsm/gsm48.h>
+
/* gprs_bssgp_util.c */
extern struct gprs_ns_inst *bssgp_nsi;
struct msgb *bssgp_msgb_alloc(void);
diff --git a/openbsc/include/openbsc/gprs_ns.h b/openbsc/include/osmocom/gprs/gprs_ns.h
index 7045d84d1..7045d84d1 100644
--- a/openbsc/include/openbsc/gprs_ns.h
+++ b/openbsc/include/osmocom/gprs/gprs_ns.h
diff --git a/openbsc/include/openbsc/gprs_ns_frgre.h b/openbsc/include/osmocom/gprs/gprs_ns_frgre.h
index abcd43ffb..abcd43ffb 100644
--- a/openbsc/include/openbsc/gprs_ns_frgre.h
+++ b/openbsc/include/osmocom/gprs/gprs_ns_frgre.h
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index 1261cccae..afe793d49 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -32,10 +32,11 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
+#include <osmocom/gprs/gprs_ns.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+
#include <openbsc/signal.h>
#include <openbsc/debug.h>
-#include <openbsc/gprs_ns.h>
-#include <openbsc/gprs_bssgp.h>
#include <openbsc/gb_proxy.h>
struct gbprox_peer {
diff --git a/openbsc/src/gprs/gb_proxy_main.c b/openbsc/src/gprs/gb_proxy_main.c
index 0bfc6cf3b..5791dab39 100644
--- a/openbsc/src/gprs/gb_proxy_main.c
+++ b/openbsc/src/gprs/gb_proxy_main.c
@@ -37,10 +37,11 @@
#include <osmocom/core/select.h>
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/gprs/gprs_ns.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+
#include <openbsc/signal.h>
#include <openbsc/debug.h>
-#include <openbsc/gprs_ns.h>
-#include <openbsc/gprs_bssgp.h>
#include <openbsc/vty.h>
#include <openbsc/gb_proxy.h>
diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c
index 09395ed6b..574f45f78 100644
--- a/openbsc/src/gprs/gb_proxy_vty.c
+++ b/openbsc/src/gprs/gb_proxy_vty.c
@@ -24,9 +24,10 @@
#include <osmocom/core/talloc.h>
+#include <osmocom/gprs/gprs_ns.h>
+
#include <openbsc/debug.h>
#include <openbsc/gb_proxy.h>
-#include <openbsc/gprs_ns.h>
#include <openbsc/vty.h>
#include <osmocom/vty/command.h>
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index cc9d2972e..0ed716290 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -38,6 +38,8 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/gsm_subscriber.h>
@@ -45,7 +47,6 @@
#include <openbsc/gsm_04_08_gprs.h>
#include <openbsc/paging.h>
#include <openbsc/transaction.h>
-#include <openbsc/gprs_bssgp.h>
#include <openbsc/gprs_llc.h>
#include <openbsc/gprs_sgsn.h>
#include <openbsc/gprs_gmm.h>
diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c
index 708c4c69c..b26f263f2 100644
--- a/openbsc/src/gprs/gprs_llc.c
+++ b/openbsc/src/gprs/gprs_llc.c
@@ -26,12 +26,12 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/gprs/gprs_bssgp.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
#include <openbsc/gprs_sgsn.h>
#include <openbsc/gprs_gmm.h>
-#include <openbsc/gprs_bssgp.h>
#include <openbsc/gprs_llc.h>
#include <openbsc/crc24.h>
#include <openbsc/sgsn.h>
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 85f710500..d8da84661 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -25,11 +25,12 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/gprs/gprs_ns.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+
#include <openbsc/gsm_subscriber.h>
#include <openbsc/debug.h>
#include <openbsc/gprs_sgsn.h>
-#include <openbsc/gprs_ns.h>
-#include <openbsc/gprs_bssgp.h>
#include <openbsc/sgsn.h>
#include <openbsc/gsm_04_08_gprs.h>
#include <openbsc/gprs_gmm.h>
diff --git a/openbsc/src/gprs/gprs_sndcp.c b/openbsc/src/gprs/gprs_sndcp.c
index e422426a1..853f8dbc9 100644
--- a/openbsc/src/gprs/gprs_sndcp.c
+++ b/openbsc/src/gprs/gprs_sndcp.c
@@ -27,10 +27,10 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/gprs/gprs_bssgp.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
-#include <openbsc/gprs_bssgp.h>
#include <openbsc/gprs_llc.h>
#include <openbsc/sgsn.h>
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index 71694a433..a45d344e1 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -36,13 +36,13 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/rate_ctr.h>
-#include <openbsc/gsm_04_08_gprs.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+#include <openbsc/gsm_04_08_gprs.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
#include <openbsc/sgsn.h>
#include <openbsc/gprs_llc.h>
-#include <openbsc/gprs_bssgp.h>
#include <openbsc/gprs_sgsn.h>
#include <openbsc/gprs_gmm.h>
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index f7eb2214d..640388d80 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -38,6 +38,9 @@
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/logging.h>
+#include <osmocom/gprs/gprs_ns.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/logging.h>
@@ -45,8 +48,6 @@
#include <openbsc/debug.h>
#include <openbsc/vty.h>
#include <openbsc/sgsn.h>
-#include <openbsc/gprs_ns.h>
-#include <openbsc/gprs_bssgp.h>
#include <openbsc/gprs_llc.h>
#include <gtp.h>
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index 0125dad3b..f4a8083a3 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -28,7 +28,7 @@
#include <openbsc/debug.h>
#include <openbsc/sgsn.h>
-#include <openbsc/gprs_ns.h>
+#include <osmocom/gprs/gprs_ns.h>
#include <openbsc/gprs_sgsn.h>
#include <openbsc/vty.h>
#include <openbsc/gsm_04_08_gprs.h>
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index cacc6b048..413eac44d 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -41,7 +41,7 @@
#include <openbsc/db.h>
#include <osmocom/core/talloc.h>
#include <openbsc/vty.h>
-#include <openbsc/gprs_ns.h>
+#include <osmocom/gprs/gprs_ns.h>
#include <openbsc/system_information.h>
#include <openbsc/debug.h>
#include <openbsc/paging.h>
diff --git a/openbsc/src/libgb/gprs_bssgp.c b/openbsc/src/libgb/gprs_bssgp.c
index 6722cafba..e93b3de9a 100644
--- a/openbsc/src/libgb/gprs_bssgp.c
+++ b/openbsc/src/libgb/gprs_bssgp.c
@@ -35,10 +35,10 @@
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/gsm_04_08_gprs.h>
-#include <openbsc/gprs_bssgp.h>
-#include <openbsc/gprs_llc.h>
-#include <openbsc/gprs_ns.h>
-#include <openbsc/gprs_sgsn.h>
+
+#include <osmocom/gprs/gprs_bssgp.h>
+#include <osmocom/gprs/gprs_ns.h>
+
#include <openbsc/gprs_gmm.h>
void *bssgp_tall_ctx = NULL;
diff --git a/openbsc/src/libgb/gprs_bssgp_bss.c b/openbsc/src/libgb/gprs_bssgp_bss.c
index 9d76c3aa0..a53423ca1 100644
--- a/openbsc/src/libgb/gprs_bssgp_bss.c
+++ b/openbsc/src/libgb/gprs_bssgp_bss.c
@@ -28,11 +28,11 @@
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+#include <osmocom/gprs/gprs_ns.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
-#include <openbsc/gprs_bssgp.h>
-#include <openbsc/gprs_ns.h>
uint8_t *bssgp_msgb_tlli_put(struct msgb *msg, uint32_t tlli)
{
diff --git a/openbsc/src/libgb/gprs_bssgp_util.c b/openbsc/src/libgb/gprs_bssgp_util.c
index a1eb37e18..c794a590e 100644
--- a/openbsc/src/libgb/gprs_bssgp_util.c
+++ b/openbsc/src/libgb/gprs_bssgp_util.c
@@ -27,11 +27,11 @@
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+#include <osmocom/gprs/gprs_ns.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
-#include <openbsc/gprs_bssgp.h>
-#include <openbsc/gprs_ns.h>
struct gprs_ns_inst *bssgp_nsi;
diff --git a/openbsc/src/libgb/gprs_bssgp_vty.c b/openbsc/src/libgb/gprs_bssgp_vty.c
index a0d74ac94..256e8af7f 100644
--- a/openbsc/src/libgb/gprs_bssgp_vty.c
+++ b/openbsc/src/libgb/gprs_bssgp_vty.c
@@ -26,17 +26,13 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/rate_ctr.h>
-#include <openbsc/debug.h>
-#include <openbsc/signal.h>
-#include <openbsc/gprs_ns.h>
-#include <openbsc/gprs_bssgp.h>
-#include <openbsc/vty.h>
+#include <osmocom/gprs/gprs_ns.h>
+#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/command.h>
@@ -44,6 +40,11 @@
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
+#include <openbsc/vty.h>
+#include <openbsc/gsm_data.h>
+#include <openbsc/debug.h>
+
+
/* FIXME: this should go to some common file as it is copied
* in vty_interface.c of the BSC */
static const struct value_string gprs_bssgp_timer_strs[] = {
diff --git a/openbsc/src/libgb/gprs_ns.c b/openbsc/src/libgb/gprs_ns.c
index 39ccd2851..c1efa4318 100644
--- a/openbsc/src/libgb/gprs_ns.c
+++ b/openbsc/src/libgb/gprs_ns.c
@@ -68,18 +68,18 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/socket.h>
+#include <osmocom/gprs/gprs_ns.h>
+#include <osmocom/gprs/gprs_bssgp.h>
+#include <osmocom/gprs/gprs_ns_frgre.h>
+
#include <openbsc/debug.h>
#include <openbsc/signal.h>
-#include <openbsc/gprs_ns.h>
-#include <openbsc/gprs_bssgp.h>
-#include <openbsc/gprs_ns_frgre.h>
-#include <openbsc/socket.h>
static const struct tlv_definition ns_att_tlvdef = {
.def = {
@@ -1026,14 +1026,19 @@ static int nsip_fd_cb(struct osmo_fd *bfd, unsigned int what)
*/
int gprs_ns_nsip_listen(struct gprs_ns_inst *nsi)
{
+ struct in_addr in;
int ret;
- ret = make_sock(&nsi->nsip.fd, IPPROTO_UDP, nsi->nsip.local_ip,
- nsi->nsip.local_port, 0, nsip_fd_cb, NULL);
+ in.s_addr = htonl(nsi->nsip.local_ip);
+
+ nsi->nsip.fd.cb = nsip_fd_cb;
+ nsi->nsip.fd.data = nsi;
+ ret = osmo_sock_init_ofd(&nsi->nsip.fd, AF_INET, SOCK_DGRAM,
+ IPPROTO_UDP, inet_ntoa(in),
+ nsi->nsip.local_port, OSMO_SOCK_F_BIND);
if (ret < 0)
return ret;
- nsi->nsip.fd.data = nsi;
return ret;
}
diff --git a/openbsc/src/libgb/gprs_ns_frgre.c b/openbsc/src/libgb/gprs_ns_frgre.c
index 27c5c57b7..9be9f2a8f 100644
--- a/openbsc/src/libgb/gprs_ns_frgre.c
+++ b/openbsc/src/libgb/gprs_ns_frgre.c
@@ -34,10 +34,10 @@
#include <osmocom/core/select.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/socket.h>
+#include <osmocom/gprs/gprs_ns.h>
-#include <openbsc/socket.h>
#include <openbsc/debug.h>
-#include <openbsc/gprs_ns.h>
#define GRE_PTYPE_FR 0x6559
#define GRE_PTYPE_IPv4 0x0800
@@ -282,8 +282,11 @@ static int nsfrgre_fd_cb(struct osmo_fd *bfd, unsigned int what)
int gprs_ns_frgre_listen(struct gprs_ns_inst *nsi)
{
+ struct in_addr in;
int rc;
+ in.s_addr = htonl(nsi->frgre.local_ip);
+
/* Make sure we close any existing socket before changing it */
if (nsi->frgre.fd.fd)
close(nsi->frgre.fd.fd);
@@ -291,8 +294,11 @@ int gprs_ns_frgre_listen(struct gprs_ns_inst *nsi)
if (!nsi->frgre.enabled)
return 0;
- rc = make_sock(&nsi->frgre.fd, IPPROTO_GRE, nsi->frgre.local_ip,
- 0, 0, nsfrgre_fd_cb, NULL);
+ nsi->frgre.fd.cb = nsfrgre_fd_cb;
+ nsi->frgre.fd.data = nsi;
+ rc = osmo_sock_init_ofd(&nsi->frgre.fd, AF_INET, SOCK_RAW,
+ IPPROTO_GRE, inet_ntoa(in), 0,
+ OSMO_SOCK_F_BIND);
if (rc < 0) {
LOGP(DNS, LOGL_ERROR, "Error creating GRE socket (%s)\n",
strerror(errno));
diff --git a/openbsc/src/libgb/gprs_ns_vty.c b/openbsc/src/libgb/gprs_ns_vty.c
index 1e485ac9d..f1ab28731 100644
--- a/openbsc/src/libgb/gprs_ns_vty.c
+++ b/openbsc/src/libgb/gprs_ns_vty.c
@@ -26,17 +26,13 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/rate_ctr.h>
-#include <openbsc/debug.h>
-#include <openbsc/signal.h>
-#include <openbsc/gprs_ns.h>
-#include <openbsc/gprs_bssgp.h>
-#include <openbsc/vty.h>
+#include <osmocom/gprs/gprs_ns.h>
+#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/command.h>
@@ -44,6 +40,11 @@
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
+#include <openbsc/gsm_data.h>
+#include <openbsc/debug.h>
+#include <openbsc/signal.h>
+#include <openbsc/vty.h>
+
static struct gprs_ns_inst *vty_nsi = NULL;
/* FIXME: this should go to some common file as it is copied