<p>Alexander Traud has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9778">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjproject_bundled: Fix for Solaris builds. Do not undef s_addr.<br><br>The authors of PJProject undef s_addr because of some issue in Microsoft<br>Windows. However in Oracle Solaris, s_addr is not a structure member, but<br>defined to map to the real structure member.<br><br>ASTERISK-27997<br><br>Change-Id: I8223026d4d54e2a46521085fcc94bfa6ebe35b11<br>---<br>M res/res_pjsip/pjsip_resolver.c<br>A third-party/pjproject/patches/0120-solaris.patch<br>2 files changed, 121 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/78/9778/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip/pjsip_resolver.c b/res/res_pjsip/pjsip_resolver.c</span><br><span>index bc53990..5aa0582 100644</span><br><span>--- a/res/res_pjsip/pjsip_resolver.c</span><br><span>+++ b/res/res_pjsip/pjsip_resolver.c</span><br><span>@@ -327,7 +327,7 @@</span><br><span> resolve->addresses.entry[address_count].addr_len = sizeof(pj_sockaddr_in);</span><br><span> pj_sockaddr_init(pj_AF_INET(), &resolve->addresses.entry[address_count].addr, NULL,</span><br><span> target->port);</span><br><span style="color: hsl(0, 100%, 40%);">- resolve->addresses.entry[address_count].addr.ipv4.sin_addr = *(struct pj_in_addr*)ast_dns_record_get_data(record);</span><br><span style="color: hsl(120, 100%, 40%);">+ resolve->addresses.entry[address_count].addr.ipv4.sin_addr = *(pj_in_addr*)ast_dns_record_get_data(record);</span><br><span> } else {</span><br><span> ast_debug(2, "[%p] AAAA record received on target '%s'\n", resolve, ast_dns_query_get_name(query));</span><br><span> resolve->addresses.entry[address_count].addr_len = sizeof(pj_sockaddr_in6);</span><br><span>diff --git a/third-party/pjproject/patches/0120-solaris.patch b/third-party/pjproject/patches/0120-solaris.patch</span><br><span>new file mode 100644</span><br><span>index 0000000..399beee</span><br><span>--- /dev/null</span><br><span>+++ b/third-party/pjproject/patches/0120-solaris.patch</span><br><span>@@ -0,0 +1,120 @@</span><br><span style="color: hsl(120, 100%, 40%);">+From e98e9e5323acc8af811c70a0d5bab1decf068ec9 Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(120, 100%, 40%);">+From: Shaun Ruffell <sruffell@digium.com></span><br><span style="color: hsl(120, 100%, 40%);">+Date: Fri, 7 Sep 2012 14:31:19 -0500</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: [PATCH 1/2] [RFC] pjproject: Fix for Solaris builds. Do not undef</span><br><span style="color: hsl(120, 100%, 40%);">+ s_addr.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+pjproject, in order to solve build problems on Windows [1], undefines s_addr in</span><br><span style="color: hsl(120, 100%, 40%);">+one of it's headers that is included in res_rtp_asterisk.c. On Solaris s_addr is</span><br><span style="color: hsl(120, 100%, 40%);">+not a structure member, but defined to map to the real strucuture member,</span><br><span style="color: hsl(120, 100%, 40%);">+therefore when building on Solaris it's possible to get build errors like:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ [CC] res_rtp_asterisk.c -> res_rtp_asterisk.o</span><br><span style="color: hsl(120, 100%, 40%);">+ In file included from /export/home/admin/asterisk-11-svn/include/asterisk/stun.h:29,</span><br><span style="color: hsl(120, 100%, 40%);">+ from res_rtp_asterisk.c:51:</span><br><span style="color: hsl(120, 100%, 40%);">+ /export/home/admin/asterisk-11-svn/include/asterisk/network.h: In function `inaddrcmp':</span><br><span style="color: hsl(120, 100%, 40%);">+ /export/home/admin/asterisk-11-svn/include/asterisk/network.h:92: error: structure has no member named `s_addr'</span><br><span style="color: hsl(120, 100%, 40%);">+ /export/home/admin/asterisk-11-svn/include/asterisk/network.h:92: error: structure has no member named `s_addr'</span><br><span style="color: hsl(120, 100%, 40%);">+ res_rtp_asterisk.c: In function `ast_rtp_on_ice_tx_pkt':</span><br><span style="color: hsl(120, 100%, 40%);">+ res_rtp_asterisk.c:706: warning: dereferencing type-punned pointer will break strict-aliasing rules</span><br><span style="color: hsl(120, 100%, 40%);">+ res_rtp_asterisk.c:710: warning: dereferencing type-punned pointer will break strict-aliasing rules</span><br><span style="color: hsl(120, 100%, 40%);">+ res_rtp_asterisk.c: In function `rtp_add_candidates_to_ice':</span><br><span style="color: hsl(120, 100%, 40%);">+ res_rtp_asterisk.c:1085: error: structure has no member named `s_addr'</span><br><span style="color: hsl(120, 100%, 40%);">+ make[2]: *** [res_rtp_asterisk.o] Error 1</span><br><span style="color: hsl(120, 100%, 40%);">+ make[1]: *** [res] Error 2</span><br><span style="color: hsl(120, 100%, 40%);">+ make[1]: Leaving directory `/export/home/admin/asterisk-11-svn'</span><br><span style="color: hsl(120, 100%, 40%);">+ gmake: *** [_cleantest_all] Error 2</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Unfortunately, in order to make this work, I also had to make sure pjproject</span><br><span style="color: hsl(120, 100%, 40%);">+only used the typdef pj_in_addr and not the struct pj_in_addr so that when</span><br><span style="color: hsl(120, 100%, 40%);">+building Asterisk I could "typedef struct in_addr pj_in_addr". It's possible</span><br><span style="color: hsl(120, 100%, 40%);">+then that the library and users of those interfaces in Asterisk have a different</span><br><span style="color: hsl(120, 100%, 40%);">+idea about the type of the argument. While on the surface it looks like they are</span><br><span style="color: hsl(120, 100%, 40%);">+all 32 bit big endian values.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[1] http://trac.pjsip.org/repos/changeset/484</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Reported-by: Ben Klang</span><br><span style="color: hsl(120, 100%, 40%);">+(issues ASTERISK-20366)</span><br><span style="color: hsl(120, 100%, 40%);">+---</span><br><span style="color: hsl(120, 100%, 40%);">+ res/pjproject/pjlib/include/pj/sock.h | 8 +++++++-</span><br><span style="color: hsl(120, 100%, 40%);">+ res/pjproject/pjlib/src/pj/sock_bsd.c | 2 +-</span><br><span style="color: hsl(120, 100%, 40%);">+ res/pjproject/pjlib/src/pj/sock_linux_kernel.c | 2 +-</span><br><span style="color: hsl(120, 100%, 40%);">+ res/pjproject/pjlib/src/pj/sock_symbian.cpp | 2 +-</span><br><span style="color: hsl(120, 100%, 40%);">+ 4 files changed, 10 insertions(+), 4 deletions(-)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h</span><br><span style="color: hsl(120, 100%, 40%);">+index 83d35db..0f8850d 100644</span><br><span style="color: hsl(120, 100%, 40%);">+--- a/pjlib/include/pj/sock.h</span><br><span>++++ b/pjlib/include/pj/sock.h</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -471,6 +471,7 @@ typedef enum pj_socket_sd_type</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ #define PJ_INVALID_SOCKET (-1)</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">++#ifndef _ASTERISK_H</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Must undefine s_addr because of pj_in_addr below */</span><br><span style="color: hsl(120, 100%, 40%);">+ #undef s_addr</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+@@ -482,6 +483,11 @@ typedef struct pj_in_addr</span><br><span style="color: hsl(120, 100%, 40%);">+ pj_uint32_t s_addr; /**< The 32bit IP address. */</span><br><span style="color: hsl(120, 100%, 40%);">+ } pj_in_addr;</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">++#else</span><br><span style="color: hsl(120, 100%, 40%);">++#include <sys/types.h></span><br><span style="color: hsl(120, 100%, 40%);">++#include <netinet/in.h></span><br><span style="color: hsl(120, 100%, 40%);">++typedef struct in_addr pj_in_addr;</span><br><span style="color: hsl(120, 100%, 40%);">++#endif</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+ /**</span><br><span style="color: hsl(120, 100%, 40%);">+ * Maximum length of text representation of an IPv4 address.</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -675,7 +681,7 @@ PJ_DECL(char*) pj_inet_ntoa(pj_in_addr inaddr);</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * @return nonzero if the address is valid, zero if not.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+-PJ_DECL(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp);</span><br><span style="color: hsl(120, 100%, 40%);">++PJ_DECL(int) pj_inet_aton(const pj_str_t *cp, pj_in_addr *inp);</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+ /**</span><br><span style="color: hsl(120, 100%, 40%);">+ * This function converts an address in its standard text presentation form</span><br><span style="color: hsl(120, 100%, 40%);">+diff --git a/pjlib/src/pj/sock_bsd.c b/pjlib/src/pj/sock_bsd.c</span><br><span style="color: hsl(120, 100%, 40%);">+index 9bd0356..3bd7121 100644</span><br><span style="color: hsl(120, 100%, 40%);">+--- a/pjlib/src/pj/sock_bsd.c</span><br><span>++++ b/pjlib/src/pj/sock_bsd.c</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -232,7 +232,7 @@ PJ_DEF(char*) pj_inet_ntoa(pj_in_addr inaddr)</span><br><span style="color: hsl(120, 100%, 40%);">+ * numbers-and-dots notation into binary data and stores it in the structure</span><br><span style="color: hsl(120, 100%, 40%);">+ * that inp points to. </span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+-PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp)</span><br><span style="color: hsl(120, 100%, 40%);">++PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, pj_in_addr *inp)</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ char tempaddr[PJ_INET_ADDRSTRLEN];</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+diff --git a/pjlib/src/pj/sock_linux_kernel.c b/pjlib/src/pj/sock_linux_kernel.c</span><br><span style="color: hsl(120, 100%, 40%);">+index 89c2f0e..c7a8097 100644</span><br><span style="color: hsl(120, 100%, 40%);">+--- a/pjlib/src/pj/sock_linux_kernel.c</span><br><span>++++ b/pjlib/src/pj/sock_linux_kernel.c</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -147,7 +147,7 @@ PJ_DEF(char*) pj_inet_ntoa(pj_in_addr in)</span><br><span style="color: hsl(120, 100%, 40%);">+ * numbers-and-dots notation into binary data and stores it in the structure</span><br><span style="color: hsl(120, 100%, 40%);">+ * that inp points to. </span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+-PJ_DEF(int) pj_inet_aton(const pj_str_t *ccp, struct pj_in_addr *addr)</span><br><span style="color: hsl(120, 100%, 40%);">++PJ_DEF(int) pj_inet_aton(const pj_str_t *ccp, pj_in_addr *addr)</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ pj_uint32_t val;</span><br><span style="color: hsl(120, 100%, 40%);">+ int base, n;</span><br><span style="color: hsl(120, 100%, 40%);">+diff --git a/pjlib/src/pj/sock_symbian.cpp b/pjlib/src/pj/sock_symbian.cpp</span><br><span style="color: hsl(120, 100%, 40%);">+index 09239b0..e72bbda 100644</span><br><span style="color: hsl(120, 100%, 40%);">+--- a/pjlib/src/pj/sock_symbian.cpp</span><br><span>++++ b/pjlib/src/pj/sock_symbian.cpp</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -299,7 +299,7 @@ PJ_DEF(char*) pj_inet_ntoa(pj_in_addr inaddr)</span><br><span style="color: hsl(120, 100%, 40%);">+ * numbers-and-dots notation into binary data and stores it in the structure</span><br><span style="color: hsl(120, 100%, 40%);">+ * that inp points to. </span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+-PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp)</span><br><span style="color: hsl(120, 100%, 40%);">++PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, pj_in_addr *inp)</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ enum { MAXIPLEN = PJ_INET_ADDRSTRLEN };</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+-- </span><br><span style="color: hsl(120, 100%, 40%);">+1.7.12</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9778">change 9778</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.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.asterisk.org/9778"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I8223026d4d54e2a46521085fcc94bfa6ebe35b11 </div>
<div style="display:none"> Gerrit-Change-Number: 9778 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>