aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gprs/gprs_ns.h10
-rw-r--r--src/gb/gprs_ns.c19
-rw-r--r--src/gb/libosmogb.map1
3 files changed, 24 insertions, 6 deletions
diff --git a/include/osmocom/gprs/gprs_ns.h b/include/osmocom/gprs/gprs_ns.h
index e77ca42b..d5a605df 100644
--- a/include/osmocom/gprs/gprs_ns.h
+++ b/include/osmocom/gprs/gprs_ns.h
@@ -23,6 +23,9 @@
"Alive Timer (Tns-alive) timeout\n" \
"Alive Timer (Tns-alive) number of retries\n"
+#define NS_ALLOC_SIZE 2048
+#define NS_ALLOC_HEADROOM 20
+
enum ns_timeout {
NS_TOUT_TNS_BLOCK,
NS_TOUT_TNS_BLOCK_RETRIES,
@@ -186,12 +189,7 @@ void gprs_ns_ll_copy(struct gprs_nsvc *nsvc, struct gprs_nsvc *other);
/* Clear the link layer info (will never match a real link then) */
void gprs_ns_ll_clear(struct gprs_nsvc *nsvc);
-#define NS_ALLOC_SIZE 2048
-#define NS_ALLOC_HEADROOM 20
-static inline struct msgb *gprs_ns_msgb_alloc(void)
-{
- return msgb_alloc_headroom(NS_ALLOC_SIZE, NS_ALLOC_HEADROOM, "GPRS/NS");
-}
+struct msgb *gprs_ns_msgb_alloc(void);
enum signal_ns {
S_NS_RESET,
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 27968e30..827d09d7 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -131,6 +131,17 @@ static const struct rate_ctr_group_desc nsvc_ctrg_desc = {
LOGP(DNS, LOGL_ERROR, "TX failed (%d) to peer %s\n", \
rc, gprs_ns_ll_str(nsvc));
+struct msgb *gprs_ns_msgb_alloc(void)
+{
+ struct msgb *msg = msgb_alloc_headroom(NS_ALLOC_SIZE, NS_ALLOC_HEADROOM,
+ "GPRS/NS");
+ if (!msg) {
+ LOGP(DNS, LOGL_ERROR, "Failed to allocate NS message of size %d\n",
+ NS_ALLOC_SIZE);
+ }
+ return msg;
+}
+
/*! \brief Lookup struct gprs_nsvc based on NSVCI
* \param[in] nsi NS instance in which to search
@@ -298,9 +309,17 @@ static int gprs_ns_tx(struct gprs_nsvc *nsvc, struct msgb *msg)
switch (nsvc->ll) {
case GPRS_NS_LL_UDP:
ret = nsip_sendmsg(nsvc, msg);
+ if (ret < 0)
+ LOGP(DNS, LOGL_INFO,
+ "failed to send NS message via UDP: %s\n",
+ strerror(-ret));
break;
case GPRS_NS_LL_FR_GRE:
ret = gprs_ns_frgre_sendmsg(nsvc, msg);
+ if (ret < 0)
+ LOGP(DNS, LOGL_INFO,
+ "failed to send NS message via FR/GRE: %s\n",
+ strerror(-ret));
break;
default:
LOGP(DNS, LOGL_ERROR, "unsupported NS linklayer %u\n", nsvc->ll);
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index a21a7ac6..43ebbf8b 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -57,6 +57,7 @@ gprs_ns_vty_init;
gprs_ns_ll_str;
gprs_ns_ll_copy;
gprs_ns_ll_clear;
+gprs_ns_msgb_alloc;
gprs_nsvc_create;
gprs_nsvc_delete;