[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/LWIP PATCH 2/5] Add getaddrinfo() wrapper



Hi Bogdan, Costin, this patch looks good.

-- Felipe

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On 02.08.19, 14:57, "Costin Lupu" <costin.lupu@xxxxxxxxx> wrote:

    From: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
    
    ... and freeaddrinfo() and gai_strerror().
    
    Signed-off-by: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
    Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
    ---
     exportsyms.uk   |  3 +++
     include/netdb.h |  8 +++++++-
     inet.c          | 23 +++++++++++++++++++++++
     3 files changed, 33 insertions(+), 1 deletion(-)
    
    diff --git a/exportsyms.uk b/exportsyms.uk
    index ca0a748..7362abb 100644
    --- a/exportsyms.uk
    +++ b/exportsyms.uk
    @@ -35,3 +35,6 @@ getservbyname
     getservbyport
     inet_ntop
     inet_pton
    +lwip_getaddrinfo
    +lwip_freeaddrinfo
    +gai_strerror
    diff --git a/include/netdb.h b/include/netdb.h
    index dbed0cd..0cbcb5e 100644
    --- a/include/netdb.h
    +++ b/include/netdb.h
    @@ -4,7 +4,11 @@
     
     #define gethostbyname(name) lwip_gethostbyname(name)
     #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
    -       lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
    +           lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
    +
    +#define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
    +#define getaddrinfo(nodname, servname, hints, res) \
    +           lwip_getaddrinfo(nodname, servname, hints, res)
     
     #endif /* LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS) */
     
    @@ -20,3 +24,5 @@ struct protoent {
        char    **p_aliases;    /* alias list */
        int     p_proto;        /* protocol # */
     };
    +
    +const char *gai_strerror(int errcode);
    diff --git a/inet.c b/inet.c
    index 07dafe6..f718e38 100644
    --- a/inet.c
    +++ b/inet.c
    @@ -43,3 +43,26 @@ int inet_pton(int af, const char *src, void *dst)
     {
        return lwip_inet_pton(af, src, dst);
     }
    +
    +/* Note: lwip implementation of getaddrinfo does not return all the errors
    + * codes mentioned in its man page.
    + */
    +const char *gai_strerror(int errcode)
    +{
    +   switch (errcode) {
    +#if LWIP_DNS_API_DEFINE_ERRORS
    +   case EAI_NONAME:
    +           return "The node or service is not known; or both node and 
service are NULL.";
    +   case EAI_SERVICE:
    +           return "The requested service is not available for the 
requested socket type.";
    +   case EAI_FAIL:
    +           return "The name server returned a permanent failure 
indication.";
    +   case EAI_MEMORY:
    +           return "Out of memory.";
    +   case EAI_FAMILY:
    +           return "The requested address family is not supported.";
    +#endif /* LWIP_DNS_API_DEFINE_ERRORS */
    +   default:
    +           return "Error on getaddrinfo.";
    +   }
    +}
    -- 
    2.20.1
    
    

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.