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

Joshua Colp asteriskteam at digium.com
Thu Sep 13 07:11:41 CDT 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10100 )

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(-)

Approvals:
  Jaco Kroon: Looks good to me, but someone else must approve
  Michael L. Young: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/res/res_pjproject.c b/res/res_pjproject.c
index 5b133ec..2bb5d3b 100644
--- a/res/res_pjproject.c
+++ b/res/res_pjproject.c
@@ -478,7 +478,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;
@@ -499,7 +503,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/10100
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia1ea47c433fc2d915115193ee889a752373925f0
Gerrit-Change-Number: 10100
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Michael L. Young <elgueromexicano at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180913/29750e92/attachment.html>


More information about the asterisk-code-review mailing list