Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
2214-erts-esock-Socket-address-dl-size-calculat...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2214-erts-esock-Socket-address-dl-size-calculation-on-Ope.patch of Package erlang
From 09fcb29b4216db9532ce7d32c45d587fa2d4d665 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Mon, 4 Apr 2022 17:02:09 +0200 Subject: [PATCH 4/5] [erts|esock] Socket address dl size calculation on OpenIndiana On OpenIndiana (Solaris), the sockaddr_dl struct does not contain a length field. So in that case we will instead add the 'nlen' and 'alen' fields to get the length of the 'data' array, and from there calculate the length of the entire sockaddr_dl. OTP-18020 --- erts/emulator/nifs/common/socket_util.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/erts/emulator/nifs/common/socket_util.c b/erts/emulator/nifs/common/socket_util.c index f4d34dd4db..584eeb02b3 100644 --- a/erts/emulator/nifs/common/socket_util.c +++ b/erts/emulator/nifs/common/socket_util.c @@ -535,9 +535,28 @@ void esock_encode_sockaddr(ErlNifEnv* env, * char sdl_data[46]; // minimum work area, can be larger; * // contains both if name and ll address * }; + * + * OpenIndiana 2021.10 + * struct sockaddr_dl { + * ushort_t sdl_family; // AF_LINK + * ushort_t sdl_index; // if != 0, + * // system given index for interface + * uchar_t sdl_type; // interface type + * uchar_t sdl_nlen; // interface name length, no trailing 0 reqd + * uchar_t sdl_alen; // link level address length + * uchar_t sdl_slen; // link layer selector length + * char sdl_data[244]; // contains both if name and ll address + * }; + * */ - // len = SALEN(addrLen, sizeof(struct sockaddr_dl)); +#if defined(ESOCK_SDL_LEN) len = SALEN(addrLen, sockAddrP->dl.sdl_len); +#else + // The data area is dlen = nlen + alen + len = SALEN(addrLen, + (CHARP(sockAddrP->dl.sdl_data) - CHARP(sockAddrP)) + + sockAddrP->dl.sdl_nlen + sockAddrP->dl.sdl_alen); +#endif esock_encode_sockaddr_dl(env, &sockAddrP->dl, len, eSockAddr); break; #endif -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor