<p>lynxis lazus has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/19419">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pcuif_proto: version 0xa: add support for NSVC IPv6 support<br><br>Introduce a remote_proto to define the given protocol.<br>IPPROTO is more universal than address_family and is defined by an RFC.<br>IPPROTO_IPIP is used for IPv4, IPPROTO_IPV6 for IPv6. 0 means unset or<br>unused entry.<br><br>The remote_ip is network byte order, the default encoding for in_addr and in6_addr.<br><br>Change-Id: If26958d5b584973dca79159cf9e7f3f266519ce9<br>---<br>M include/osmocom/pcu/pcuif_proto.h<br>M src/pcu_l1_if.cpp<br>2 files changed, 15 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/19/19419/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h</span><br><span>index e88607e..c5ab8f6 100644</span><br><span>--- a/include/osmocom/pcu/pcuif_proto.h</span><br><span>+++ b/include/osmocom/pcu/pcuif_proto.h</span><br><span>@@ -2,10 +2,11 @@</span><br><span> #define _PCUIF_PROTO_H</span><br><span> </span><br><span> #include <osmocom/gsm/l1sap.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <arpa/inet.h></span><br><span> </span><br><span> #define PCU_SOCK_DEFAULT "/tmp/pcu_bts"</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define PCU_IF_VERSION              0x09</span><br><span style="color: hsl(120, 100%, 40%);">+#define PCU_IF_VERSION            0x0a</span><br><span> #define TXT_MAX_LEN     128</span><br><span> </span><br><span> /* msg_type */</span><br><span>@@ -155,7 +156,13 @@</span><br><span>     uint16_t        nsvci[2];</span><br><span>    uint16_t        local_port[2];</span><br><span>       uint16_t        remote_port[2];</span><br><span style="color: hsl(0, 100%, 40%);">- uint32_t        remote_ip[2];</span><br><span style="color: hsl(120, 100%, 40%);">+ /* use IP PROTOCOL instead of address_family, because address_family is</span><br><span style="color: hsl(120, 100%, 40%);">+        * OS dependent. IPIP => v4, IPV6 => v6, 0 => unused */</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t         remote_proto[2];</span><br><span style="color: hsl(120, 100%, 40%);">+      union {</span><br><span style="color: hsl(120, 100%, 40%);">+               struct in_addr ipv4;</span><br><span style="color: hsl(120, 100%, 40%);">+          struct in6_addr ipv6;</span><br><span style="color: hsl(120, 100%, 40%);">+ } remote_ip[2];</span><br><span> } __attribute__ ((packed));</span><br><span> </span><br><span> struct gsm_pcu_if_act_req {</span><br><span>diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp</span><br><span>index 7fa82fb..8df9156 100644</span><br><span>--- a/src/pcu_l1_if.cpp</span><br><span>+++ b/src/pcu_l1_if.cpp</span><br><span>@@ -568,11 +568,15 @@</span><br><span>   LOGP(DL1IF, LOGL_DEBUG, " nsvci=%d\n", info_ind->nsvci[0]);</span><br><span>     LOGP(DL1IF, LOGL_DEBUG, " local_port=%d\n", info_ind->local_port[0]);</span><br><span>   LOGP(DL1IF, LOGL_DEBUG, " remote_port=%d\n", info_ind->remote_port[0]);</span><br><span style="color: hsl(0, 100%, 40%);">-    ia.s_addr = htonl(info_ind->remote_ip[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+ ia.s_addr = info_ind->remote_ip[0].ipv4.s_addr;</span><br><span>   LOGP(DL1IF, LOGL_DEBUG, " remote_ip=%s\n", inet_ntoa(ia));</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      if (info_ind->remote_proto[0] != IPPROTO_IPIP) {</span><br><span style="color: hsl(120, 100%, 40%);">+           goto bssgp_failed;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  pcu = gprs_bssgp_create_and_connect(bts, info_ind->local_port[0],</span><br><span style="color: hsl(0, 100%, 40%);">-            info_ind->remote_ip[0], info_ind->remote_port[0],</span><br><span style="color: hsl(120, 100%, 40%);">+               ntohl(info_ind->remote_ip[0].ipv4.s_addr), info_ind->remote_port[0],</span><br><span>           info_ind->nsei, info_ind->nsvci[0], info_ind->bvci,</span><br><span>                 info_ind->mcc, info_ind->mnc, info_ind->mnc_3_digits, info_ind->lac, info_ind->rac,</span><br><span>           info_ind->cell_id);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/19419">change 19419</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-pcu/+/19419"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If26958d5b584973dca79159cf9e7f3f266519ce9 </div>
<div style="display:none"> Gerrit-Change-Number: 19419 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>