Change in libosmo-sccp[master]: Introduce SS7 IPv6 support

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Aug 27 08:11:38 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/19732 )

Change subject: Introduce SS7 IPv6 support
......................................................................

Introduce SS7 IPv6 support

In osmo_ss7_vty_go_parent, "127.0.0.1" is changed to "localhost" to let
local NSS decide whether to use IPv4 or IPv6. In newish systems, IPv6
::1 will be selected since IPv6 takes precedence over IPv4.

Similarly, the default source addr needs to be changed from NULL to "localhost"
since for some yet unknwon reason, getaddrinfo(AF_UNSPEC, NULL) returns
first IPv4 "0.0.0.0" and later "::", which is inconsistent with
getaddrinfo("localhost") result, resulting in src=IPv4(0.0.0.0) and
dst=IPv6(::1), which is incompatible and will fail.
In any case, this change doesn't affect users of osmo_sccp_simple_client
because the APIs set both src and dst addresses.

Change-Id: I69c48819b70635c92fa404cafd917af7802d517c
Depends: libosmo-netif.git Change-Id Ie6bb17a9af6ca21d5e350f9c9d2d74c97c5a00af
---
M doc/examples/osmo-stp-multihome.cfg
M doc/manuals/vty/osmo-stp_vty_reference.xml
M src/osmo_ss7_vty.c
M tests/vty/ss7_asp_test.vty
M tests/vty/vty_test_runner.py
5 files changed, 38 insertions(+), 18 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/doc/examples/osmo-stp-multihome.cfg b/doc/examples/osmo-stp-multihome.cfg
index 5b0c84f..64874da 100644
--- a/doc/examples/osmo-stp-multihome.cfg
+++ b/doc/examples/osmo-stp-multihome.cfg
@@ -20,3 +20,4 @@
   accept-asp-connections dynamic-permitted
   local-ip 127.0.0.2
   local-ip 127.0.0.1
+  local-ip ::1
diff --git a/doc/manuals/vty/osmo-stp_vty_reference.xml b/doc/manuals/vty/osmo-stp_vty_reference.xml
index e904469..ff8103a 100644
--- a/doc/manuals/vty/osmo-stp_vty_reference.xml
+++ b/doc/manuals/vty/osmo-stp_vty_reference.xml
@@ -1741,16 +1741,18 @@
         <param name='.TEXT' doc='Text until the end of the line' />
       </params>
     </command>
-    <command id='remote-ip A.B.C.D'>
+    <command id='remote-ip (A.B.C.D|X:X::X:X)'>
       <params>
         <param name='remote-ip' doc='Specify Remote IP Address of ASP' />
-        <param name='A.B.C.D' doc='Remote IP Address of ASP' />
+        <param name='A.B.C.D' doc='Remote IPv4 Address of ASP' />
+        <param name='X:X::X:X' doc='Remote IPv6 Address of ASP' />
       </params>
     </command>
-    <command id='local-ip A.B.C.D'>
+    <command id='local-ip (A.B.C.D|X:X::X:X)'>
       <params>
         <param name='local-ip' doc='Specify Local IP Address from which to contact ASP' />
-        <param name='A.B.C.D' doc='Local IP Address from which to contact of ASP' />
+        <param name='A.B.C.D' doc='Local IPv4 Address from which to contact of ASP' />
+        <param name='X:X::X:X' doc='Local IPv6 Address from which to contact of ASP' />
       </params>
     </command>
     <command id='qos-class <0-255>'>
@@ -1787,10 +1789,11 @@
   </node>
   <node id='config-cs7-listen'>
     <name>config-cs7-listen</name>
-    <command id='local-ip A.B.C.D'>
+    <command id='local-ip (A.B.C.D|X:X::X:X)'>
       <params>
         <param name='local-ip' doc='Configure the Local IP Address for xUA' />
-        <param name='A.B.C.D' doc='IP Address to use for XUA' />
+        <param name='A.B.C.D' doc='IPv4 Address to use for XUA' />
+        <param name='X:X::X:X' doc='IPv6 Address to use for XUA' />
       </params>
     </command>
     <command id='accept-asp-connections (pre-configured|dynamic-permitted)'>
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 9c31c00..fad93f5 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -470,9 +470,10 @@
 }
 
 DEFUN(xua_local_ip, xua_local_ip_cmd,
-	"local-ip A.B.C.D",
+	"local-ip " VTY_IPV46_CMD,
 	"Configure the Local IP Address for xUA\n"
-	"IP Address to use for XUA\n")
+	"IPv4 Address to use for XUA\n"
+	"IPv6 Address to use for XUA\n")
 {
 	struct osmo_xua_server *xs = vty->index;
 
@@ -623,9 +624,10 @@
 }
 
 DEFUN(asp_local_ip, asp_local_ip_cmd,
-	"local-ip A.B.C.D",
+	"local-ip " VTY_IPV46_CMD,
 	"Specify Local IP Address from which to contact ASP\n"
-	"Local IP Address from which to contact of ASP\n")
+	"Local IPv4 Address from which to contact of ASP\n"
+	"Local IPv6 Address from which to contact of ASP\n")
 {
 	struct osmo_ss7_asp *asp = vty->index;
 	osmo_ss7_asp_peer_add_host(&asp->cfg.local, asp, argv[0]);
@@ -633,9 +635,10 @@
 }
 
 DEFUN(asp_remote_ip, asp_remote_ip_cmd,
-	"remote-ip A.B.C.D",
+	"remote-ip " VTY_IPV46_CMD,
 	"Specify Remote IP Address of ASP\n"
-	"Remote IP Address of ASP\n")
+	"Remote IPv4 Address of ASP\n"
+	"Remote IPv6 Address of ASP\n")
 {
 	struct osmo_ss7_asp *asp = vty->index;
 	osmo_ss7_asp_peer_add_host(&asp->cfg.remote, asp, argv[0]);
@@ -1806,10 +1809,10 @@
 		asp = vty->index;
 		/* If no local addr was set */
 		if (!asp->cfg.local.host_cnt)
-			osmo_ss7_asp_peer_add_host(&asp->cfg.local, asp, NULL);
+			osmo_ss7_asp_peer_add_host(&asp->cfg.local, asp, "localhost");
 		/* If no remote addr was set */
 		if (!asp->cfg.remote.host_cnt)
-			osmo_ss7_asp_peer_add_host(&asp->cfg.remote, asp, "127.0.0.1");
+			osmo_ss7_asp_peer_add_host(&asp->cfg.remote, asp, "localhost");
 		osmo_ss7_asp_restart(asp);
 		vty->node = L_CS7_NODE;
 		vty->index = asp->inst;
diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty
index 7411b1f..ee1b3e5 100644
--- a/tests/vty/ss7_asp_test.vty
+++ b/tests/vty/ss7_asp_test.vty
@@ -215,8 +215,8 @@
 ss7_asp_vty_test(config-cs7-asp)# list
 ...
   description .TEXT
-  remote-ip A.B.C.D
-  local-ip A.B.C.D
+  remote-ip (A.B.C.D|X:X::X:X)
+  local-ip (A.B.C.D|X:X::X:X)
   qos-class <0-255>
   role (sg|asp|ipsp)
   sctp-role (client|server)
diff --git a/tests/vty/vty_test_runner.py b/tests/vty/vty_test_runner.py
index 605bc93..dff26c3 100755
--- a/tests/vty/vty_test_runner.py
+++ b/tests/vty/vty_test_runner.py
@@ -111,7 +111,9 @@
         # first check if STP is listening in required addresses:
         found = False
         for i in range(5):
-            if self.check_sctp_sock_local(['127.0.0.1', '127.0.0.2'], 2905):
+            if self.check_sctp_sock_local(['127.0.0.1', '127.0.0.2',
+                                           '0000:0000:0000:0000:0000:0000:0000:0001'],
+                                          2905):
                 found = True
                 break
             else:
@@ -122,6 +124,7 @@
             proto = socket.IPPROTO_SCTP
         except AttributeError: # it seems to be not defined under python2?
             proto = 132
+        # IPv4:
         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, proto)
         s.bind(('127.0.0.3', 0))
         try:
@@ -129,7 +132,17 @@
         except socket.error as msg:
             s.close()
             self.assertTrue(False)
-        print("Connected to STP through SCTP")
+        print("Connected to STP through SCTP (IPv4)")
+        s.close()
+        # IPv6:
+        s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, proto)
+        s.bind(('::1', 0))
+        try:
+            s.connect(('::1',2905))
+        except socket.error as msg:
+            s.close()
+            self.assertTrue(False)
+        print("Connected to STP through SCTP (IPv6)")
         s.close()
 
 if __name__ == '__main__':

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/19732
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I69c48819b70635c92fa404cafd917af7802d517c
Gerrit-Change-Number: 19732
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200827/29579743/attachment.htm>


More information about the gerrit-log mailing list