[PATCH] libosmo-sccp[master]: sua: Add IPv4 encoding/decoding in SUA SCCP Addresses

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Feb 15 23:05:56 UTC 2017


Review at  https://gerrit.osmocom.org/1835

sua: Add IPv4 encoding/decoding in SUA SCCP Addresses

Change-Id: Ic5c70360c6bf3a0d12f9ffc83a86d70f34c98f62
---
M src/sua.c
M src/xua_msg.c
2 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/35/1835/1

diff --git a/src/sua.c b/src/sua.c
index 3864587..71c7b46 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -724,6 +724,14 @@
 			/* TODO */
 			out->presence |= OSMO_SCCP_ADDR_T_GT;
 			break;
+		case SUA_IEI_IPv4:
+			if (par_datalen != 4)
+				goto subpar_fail;
+			p32 = (uint32_t*)par->data;
+			/* no endian conversion, both network order */
+			out->ip.v4.s_addr = *p32;
+			out->presence |= OSMO_SCCP_ADDR_T_IPv4;
+			break;
 		default:
 			LOGP(DSUA, LOGL_ERROR, "SUA IEI 0x%04x: Unknown subpart tag %hd\n",
 			     param->tag, par_tag);
diff --git a/src/xua_msg.c b/src/xua_msg.c
index f7b0386..1693b76 100644
--- a/src/xua_msg.c
+++ b/src/xua_msg.c
@@ -278,7 +278,7 @@
 		msgb_t16l16vp_put_u32(tmp, SUA_IEI_SSN, addr->ssn);
 	}
 	if (addr->presence & OSMO_SCCP_ADDR_T_IPv4) {
-		/* FIXME: IPv4 address */
+		msgb_t16l16vp_put_u32(tmp, SUA_IEI_IPv4, ntohl(addr->ip.v4.s_addr));
 	} else if (addr->presence & OSMO_SCCP_ADDR_T_IPv6) {
 		/* FIXME: IPv6 address */
 	}

-- 
To view, visit https://gerrit.osmocom.org/1835
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5c70360c6bf3a0d12f9ffc83a86d70f34c98f62
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list