Change in libosmocore[master]: socket.c add osmo_sockaddr_valid()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Jul 6 09:04:29 UTC 2020


pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/19144 )

Change subject: socket.c add osmo_sockaddr_valid()
......................................................................


Patch Set 2: Code-Review-1

(3 comments)

https://gerrit.osmocom.org/c/libosmocore/+/19144/2/src/socket.c 
File src/socket.c:

https://gerrit.osmocom.org/c/libosmocore/+/19144/2/src/socket.c@1526 
PS2, Line 1526: int osmo_sockaddr_valid(struct osmo_sockaddr *addr)
the return type/values look strange. Looks like a boolean checker but then it returns 0 on true...


https://gerrit.osmocom.org/c/libosmocore/+/19144/2/src/socket.c@1532 
PS2, Line 1532: 	if (addr->u.sas.ss_family == AF_INET) {
So indeed you are using one of the fields in a substruct of the union to find out the type. Did you really take care to look this makes sense and that it cannot contain other content based on the union being populated by different ways?


https://gerrit.osmocom.org/c/libosmocore/+/19144/2/src/socket.c@1543 
PS2, Line 1543: 	return -ENOTSUP;
So in IPv6 it never returns 0, so no ipv6 adr is ever valid.

In any case, this function makes no sense to me. An IP addr being 0.0.0.0 or port 0 is completely fine when binding.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib6fb050e1bfe3f3a8d8bbe5e762351ce6b7cc48c
Gerrit-Change-Number: 19144
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Mon, 06 Jul 2020 09:04:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200706/6f3d54b6/attachment.htm>


More information about the gerrit-log mailing list