[riot-notifications] [RIOT-OS/RIOT] Fixed AF_INET6 number to match C-library defines (#12145)

Daniele Lacamera notifications at github.com
Mon Sep 2 12:01:13 CEST 2019


### Contribution description

AF_INET and AF_INET6 have POSIX-wide accepted numbers across different systems (4 and 10 respectively).

Violating this assignment may cause library calls related, e.g. to IP address handling, to fail.

This patch keeps the enum type, but assigns the right numbers to AF_INET and AF_INET6 so that libraries are not confused by the label mismatch.

### Testing procedure

Simply calling `inet_pton()` with the wrong address family on native triggers the problem.
`inet_pton()` returns '0' (error) and sets errno to 97 (EAFNOSUPPORT).

See simple test to reproduce:
https://github.com/danielinux/RIOT-OS-posix-tcp-socket-example

### Issues/PRs references

This defect has been discovered while working on PR #10308 - but it's not related to TLS sockets.

See also: #12130 which can be blocking for the test.

cc: @miri64 
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/12145

-- Commit Summary --

  * Fixed AF_INET6 number to match C-library defines

-- File Changes --

    M sys/include/net/af.h (7)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/12145.patch
https://github.com/RIOT-OS/RIOT/pull/12145.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12145
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190902/f1cf5fe5/attachment.htm>


More information about the notifications mailing list