<p><a href="https://gerrit.osmocom.org/13123">View Change</a></p><p>2 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h">File include/osmocom/core/ip_port.h:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h@47">Patch Set #4, Line 47:</a> <code style="font-family:monospace,monospace">osmo_ip_port</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">basically this looks like you're reinventing sockaddr_storage which is usually typecast to sockaddr_ […]</blockquote></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">- sockaddr stores the port in network byte order, each log line would have to remember to call ntohs().<br>- we want the IP address string for<br>  - MGCP messages<br>  - straightforward logging<br>- in MGCP the string comes in from MGCP messages, and I want to convert that to in_addr or sockaddr_in in a standardized way.</pre><p style="white-space: pre-wrap; word-wrap: break-word;">In the end, a string is a string and a uint16_t is a uint16_t without any special cases about them,<br>and the sockaddr API is just a lot of clutter around that.</p><p style="white-space: pre-wrap; word-wrap: break-word;">(at first, this implementation had no 'af' indicating AF_INET or AF_INET6, maybe it would be better to drop that and leave it to string interpretation, see osmo_ip_str_type())</p><p style="white-space: pre-wrap; word-wrap: break-word;">I could also actually place this in osmo-mgw.git, as its usefulness is associated with MGCP, and then we'd avoid the ARM architecture nonsense where netinet/in.h isn't known...?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h@51">Patch Set #4, Line 51:</a> <code style="font-family:monospace,monospace">46</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">INET6_ADDRSTRLEN in arpa/inet. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I had used that at first, but it causes a dependency on #include <netinet/in.h> which then fails to compile on ARM. </p><p style="white-space: pre-wrap; word-wrap: break-word;">Then it would be nice to conditionally include that header, but we must not include "config.h" in system-installed header files.</p><p style="white-space: pre-wrap; word-wrap: break-word;">That is the single reason why I am using a magic number.<br>If you look in the .c file then you'll see there is an osmo_static_assert ensuring the size >= INET6_ADDRSTRLEN</p><p style="white-space: pre-wrap; word-wrap: break-word;">Oh wait, arpa/inet.h you say?</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/13123">change 13123</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/13123"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: Id617265337f09dfb6ddfe111ef5e578cd3dc9f63 </div>
<div style="display:none"> Gerrit-Change-Number: 13123 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Max <msuraev@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 05 Mar 2019 22:50:41 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: No </div>