[Asterisk-code-review] res pjproject: Fix sockaddr conversion routines for non-bund... (asterisk[13])

Sean Bright asteriskteam at digium.com
Wed Sep 12 07:25:32 CDT 2018


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/10097


Change subject: res_pjproject: Fix sockaddr conversion routines for non-bundled PJSIP
......................................................................

res_pjproject: Fix sockaddr conversion routines for non-bundled PJSIP

The bundled version of pjproject has a patch for Solaris compatability
that changes the definition of various socket structures which we need
to account for when compiling against a non-bundled version.

ASTERISK-28049 #close

Change-Id: Ia1ea47c433fc2d915115193ee889a752373925f0
---
M res/res_pjproject.c
1 file changed, 10 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/97/10097/1

diff --git a/res/res_pjproject.c b/res/res_pjproject.c
index ec5e4b6..ec99279 100644
--- a/res/res_pjproject.c
+++ b/res/res_pjproject.c
@@ -490,7 +490,11 @@
 	if (addr->ss.ss_family == AF_INET) {
 		struct sockaddr_in *sin = (struct sockaddr_in *) &addr->ss;
 		pjaddr->ipv4.sin_family = pj_AF_INET();
-		pjaddr->ipv4.sin_addr   = sin->sin_addr;
+#ifdef HAVE_PJPROJECT_BUNDLED
+		pjaddr->ipv4.sin_addr = sin->sin_addr;
+#else
+		pjaddr->ipv4.sin_addr.s_addr = sin->sin_addr.s_addr;
+#endif
 		pjaddr->ipv4.sin_port   = sin->sin_port;
 	} else if (addr->ss.ss_family == AF_INET6) {
 		struct sockaddr_in6 *sin = (struct sockaddr_in6 *) &addr->ss;
@@ -511,7 +515,11 @@
 	if (pjaddr->addr.sa_family == pj_AF_INET()) {
 		struct sockaddr_in *sin = (struct sockaddr_in *) &addr->ss;
 		sin->sin_family = AF_INET;
-		sin->sin_addr   = pjaddr->ipv4.sin_addr;
+#ifdef HAVE_PJPROJECT_BUNDLED
+		sin->sin_addr = pjaddr->ipv4.sin_addr;
+#else
+		sin->sin_addr.s_addr = pjaddr->ipv4.sin_addr.s_addr;
+#endif
 		sin->sin_port   = pjaddr->ipv4.sin_port;
 		addr->len = sizeof(struct sockaddr_in);
 	} else if (pjaddr->addr.sa_family == pj_AF_INET6()) {

-- 
To view, visit https://gerrit.asterisk.org/10097
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1ea47c433fc2d915115193ee889a752373925f0
Gerrit-Change-Number: 10097
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180912/4d3153fc/attachment.html>


More information about the asterisk-code-review mailing list