jerpelea opened a new pull request, #21277:
URL: https://github.com/apache/nuttx/pull/21277

   ## Summary
   
   gethostentbyname_r() previously set *h_errnop to EAI_NONAME when 
AI_NUMERICHOST was specified and the hostname was non-numeric. Because 
*h_errnop is an h_errno output parameter used by gethostbyname_r() and 
gethostbyname2_r(), setting EAI_NONAME (6) corrupted h_errno with an invalid 
value.
   
   Additionally, getaddrinfo() passed &ret as the h_errnop argument to 
gethostentbyname_r(), ignored gethostentbyname_r()'s actual return status 
(OK/ERROR), and returned ret directly. As a result, getaddrinfo() returned raw 
h_errno values (e.g., HOST_NOT_FOUND = 1, TRY_AGAIN = 4) instead of standard 
POSIX EAI_xxx error codes (EAI_NONAME = 6, EAI_AGAIN = 2).
   
   This patch:
   1. Sets *h_errnop to HOST_NOT_FOUND (or TRY_AGAIN on transient DNS 
timeouts/errors) in gethostentbyname_r().
   2. Passes a dedicated &herrno variable from getaddrinfo() to 
gethostentbyname_r() and checks the function return value.
   3. Explicitly maps h_errno codes to POSIX EAI_xxx codes (HOST_NOT_FOUND and 
NO_DATA -> EAI_NONAME, TRY_AGAIN -> EAI_AGAIN, NO_RECOVERY -> EAI_FAIL).
   
   Fixes #15752
   
   ## Impact
   
   RELEASE
   
   ## Testing
   
   CI


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to