gprs_ns2: add gprs_ns2_ip_vc_local() return the local sockaddr

Change-Id: I65a739772596015b90473045d32d4934d924e43f
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index e689118..a3e9da6 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -393,6 +393,23 @@
 	return nsvc;
 }
 
+/*! Return the socket address of the local peer of a NS-VC.
+ *  \param[in] nsvc NS-VC whose local peer we want to know
+ *  \return address of the local peer; NULL in case of error */
+const struct osmo_sockaddr *gprs_ns2_ip_vc_local(const struct gprs_ns2_vc *nsvc)
+{
+	struct priv_bind *priv;
+
+	if (nsvc->ll != GPRS_NS_LL_UDP)
+		return NULL;
+
+	if (nsvc->bind->driver != &vc_driver_ip)
+		return NULL;
+
+	priv = nsvc->bind->priv;
+	return &priv->addr;
+}
+
 /*! Return the socket address of the remote peer of a NS-VC.
  *  \param[in] nsvc NS-VC whose remote peer we want to know
  *  \return address of the remote peer; NULL in case of error */