Change in libosmocore[master]: add osmo_ip_port API

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Mar 5 10:05:32 UTC 2019


Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13123 )

Change subject: add osmo_ip_port API
......................................................................


Patch Set 4:

(3 comments)

I'm not opposed to merging this, I'm just raising some random questions that come to my mind.  Feel free to use or ignore them.  To me it seems like quite a bit of extra "abstraction" for what is essentialy containing the exact same information as sockaddr_storage.

https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h
File include/osmocom/core/ip_port.h:

https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h@47
PS4, Line 47: osmo_ip_port
basically this looks like you're reinventing sockaddr_storage which is usually typecast to sockaddr_in / sockaddr_in6?

I guess the only difference is that you're keeping the ip address as string, where as sockaddr_* keeps it in binary format.

Is that really worth it?  Could we not simply have a set of utility functions that work on sockaddr_storage instead?  O r are our accesses 99% of the time for the string, and we basically want to cache the string and avoid converting from binary to string all the time?


https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h@51
PS4, Line 51: 46
there is a #define for the maximum length of an IPv6 address in string format somewhere in libc, AFAIR


https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h@80
PS4, Line 80: osmo_ip_port_to_32
normal convention in osmocom is lke memcpy(): Output argument is first, followed by input argument[s].



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id617265337f09dfb6ddfe111ef5e578cd3dc9f63
Gerrit-Change-Number: 13123
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-CC: Harald Welte <laforge at gnumonks.org>
Gerrit-Comment-Date: Tue, 05 Mar 2019 10:05:32 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190305/e2513405/attachment.html>


More information about the gerrit-log mailing list