diff --git a/src/core/sock/sock-extra.cpp b/src/core/sock/sock-extra.cpp index 1b75376fd..f35538ced 100644 --- a/src/core/sock/sock-extra.cpp +++ b/src/core/sock/sock-extra.cpp @@ -382,6 +382,7 @@ struct xlio_api_t *extra_api() SET_EXTRA_API(xlio_socket_destroy, xlio_socket_destroy, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_update, xlio_socket_update, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_setsockopt, xlio_socket_setsockopt, XLIO_EXTRA_API_XLIO_SOCKET); + SET_EXTRA_API(xlio_socket_getsockname, xlio_socket_getsockname, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_getpeername, xlio_socket_getpeername, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_bind, xlio_socket_bind, XLIO_EXTRA_API_XLIO_SOCKET); SET_EXTRA_API(xlio_socket_connect, xlio_socket_connect, XLIO_EXTRA_API_XLIO_SOCKET); @@ -530,6 +531,13 @@ extern "C" int xlio_socket_setsockopt(xlio_socket_t sock, int level, int optname return rc; } +extern "C" int xlio_socket_getsockname(xlio_socket_t sock, struct sockaddr *addr, + socklen_t *addrlen) +{ + sockinfo_tcp *si = reinterpret_cast(sock); + return si->getsockname(addr, addrlen); +} + extern "C" int xlio_socket_getpeername(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen) { diff --git a/src/core/xlio.h b/src/core/xlio.h index d71cee26d..f1c2a4fca 100644 --- a/src/core/xlio.h +++ b/src/core/xlio.h @@ -451,6 +451,7 @@ int xlio_socket_update(xlio_socket_t sock, unsigned flags, uintptr_t userdata_sq int xlio_socket_setsockopt(xlio_socket_t sock, int level, int optname, const void *optval, socklen_t optlen); +int xlio_socket_getsockname(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen); int xlio_socket_getpeername(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen); int xlio_socket_bind(xlio_socket_t sock, const struct sockaddr *addr, socklen_t addrlen); diff --git a/src/core/xlio_extra.h b/src/core/xlio_extra.h index ce7a5deb1..ea4e55863 100644 --- a/src/core/xlio_extra.h +++ b/src/core/xlio_extra.h @@ -331,6 +331,7 @@ struct __attribute__((packed)) xlio_api_t { int (*xlio_socket_update)(xlio_socket_t sock, unsigned flags, uintptr_t userdata_sq); int (*xlio_socket_setsockopt)(xlio_socket_t sock, int level, int optname, const void *optval, socklen_t optlen); + int (*xlio_socket_getsockname)(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen); int (*xlio_socket_getpeername)(xlio_socket_t sock, struct sockaddr *addr, socklen_t *addrlen); int (*xlio_socket_bind)(xlio_socket_t sock, const struct sockaddr *addr, socklen_t addrlen); int (*xlio_socket_connect)(xlio_socket_t sock, const struct sockaddr *to, socklen_t tolen);