From 2553b7701c4dae03ee032fb8f527da40bd6b12ed Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 6 Mar 2023 13:02:11 +0800 Subject: [PATCH] net: Remove the empty si_getpeername implementation Signed-off-by: Xiang Xiao --- net/can/can_sockif.c | 39 +------------------------------------- net/icmp/icmp_sockif.c | 38 +------------------------------------ net/icmpv6/icmpv6_sockif.c | 38 +------------------------------------ net/pkt/pkt_sockif.c | 38 +------------------------------------ net/socket/getpeername.c | 1 - 5 files changed, 4 insertions(+), 150 deletions(-) diff --git a/net/can/can_sockif.c b/net/can/can_sockif.c index 4fca599633..bfb0f24ec4 100644 --- a/net/can/can_sockif.c +++ b/net/can/can_sockif.c @@ -53,8 +53,6 @@ static sockcaps_t can_sockcaps(FAR struct socket *psock); static void can_addref(FAR struct socket *psock); static int can_bind(FAR struct socket *psock, FAR const struct sockaddr *addr, socklen_t addrlen); -static int can_getpeername(FAR struct socket *psock, - FAR struct sockaddr *addr, FAR socklen_t *addrlen); static int can_listen(FAR struct socket *psock, int backlog); static int can_connect(FAR struct socket *psock, FAR const struct sockaddr *addr, socklen_t addrlen); @@ -75,7 +73,7 @@ const struct sock_intf_s g_can_sockif = can_addref, /* si_addref */ can_bind, /* si_bind */ NULL, /* si_getsockname */ - can_getpeername, /* si_getpeername */ + NULL, /* si_getpeername */ can_listen, /* si_listen */ can_connect, /* si_connect */ can_accept, /* si_accept */ @@ -340,41 +338,6 @@ static int can_bind(FAR struct socket *psock, return OK; } -/**************************************************************************** - * Name: can_getpeername - * - * Description: - * The can_getpeername() function retrieves the remote-connected name - * of the specified packet socket, stores this address in the sockaddr - * structure pointed to by the 'addr' argument, and stores the length of - * this address in the object pointed to by the 'addrlen' argument. - * - * If the actual length of the address is greater than the length of the - * supplied sockaddr structure, the stored address will be truncated. - * - * If the socket has not been bound to a local name, the value stored in - * the object pointed to by address is unspecified. - * - * Parameters: - * psock Socket structure of the socket to be queried - * addr sockaddr structure to receive data [out] - * addrlen Length of sockaddr structure [in/out] - * - * Returned Value: - * On success, 0 is returned, the 'addr' argument points to the address - * of the socket, and the 'addrlen' argument points to the length of the - * address. Otherwise, a negated errno value is returned. See - * getpeername() for the list of appropriate error numbers. - * - ****************************************************************************/ - -static int can_getpeername(FAR struct socket *psock, - FAR struct sockaddr *addr, - FAR socklen_t *addrlen) -{ - return -EOPNOTSUPP; -} - /**************************************************************************** * Name: can_listen * diff --git a/net/icmp/icmp_sockif.c b/net/icmp/icmp_sockif.c index b9e74aaa48..9733ebc75a 100644 --- a/net/icmp/icmp_sockif.c +++ b/net/icmp/icmp_sockif.c @@ -47,8 +47,6 @@ static int icmp_setup(FAR struct socket *psock); static sockcaps_t icmp_sockcaps(FAR struct socket *psock); static void icmp_addref(FAR struct socket *psock); -static int icmp_getpeername(FAR struct socket *psock, - FAR struct sockaddr *addr, FAR socklen_t *addrlen); static int icmp_listen(FAR struct socket *psock, int backlog); static int icmp_connect(FAR struct socket *psock, FAR const struct sockaddr *addr, socklen_t addrlen); @@ -70,7 +68,7 @@ const struct sock_intf_s g_icmp_sockif = icmp_addref, /* si_addref */ NULL, /* si_bind */ NULL, /* si_getsockname */ - icmp_getpeername, /* si_getpeername */ + NULL, /* si_getpeername */ icmp_listen, /* si_listen */ icmp_connect, /* si_connect */ icmp_accept, /* si_accept */ @@ -275,40 +273,6 @@ static int icmp_accept(FAR struct socket *psock, FAR struct sockaddr *addr, return -EAFNOSUPPORT; } -/**************************************************************************** - * Name: icmp_getpeername - * - * Description: - * The icmp_getpeername() function retrieves the remote-connected name of - * the specified packet socket, stores this address in the sockaddr - * structure pointed to by the 'addr' argument, and stores the length of - * this address in the object pointed to by the 'addrlen' argument. - * - * If the actual length of the address is greater than the length of the - * supplied sockaddr structure, the stored address will be truncated. - * - * If the socket has not been bound to a local name, the value stored in - * the object pointed to by address is unspecified. - * - * Parameters: - * psock Socket structure of the socket to be queried - * addr sockaddr structure to receive data [out] - * addrlen Length of sockaddr structure [in/out] - * - * Returned Value: - * On success, 0 is returned, the 'addr' argument points to the address - * of the socket, and the 'addrlen' argument points to the length of the - * address. Otherwise, a negated errno value is returned. See - * getpeername() for the list of appropriate error numbers. - * - ****************************************************************************/ - -static int icmp_getpeername(FAR struct socket *psock, - FAR struct sockaddr *addr, FAR socklen_t *addrlen) -{ - return -EAFNOSUPPORT; -} - /**************************************************************************** * Name: icmp_listen * diff --git a/net/icmpv6/icmpv6_sockif.c b/net/icmpv6/icmpv6_sockif.c index aba5c4a9ee..89113ec59d 100644 --- a/net/icmpv6/icmpv6_sockif.c +++ b/net/icmpv6/icmpv6_sockif.c @@ -47,8 +47,6 @@ static int icmpv6_setup(FAR struct socket *psock); static sockcaps_t icmpv6_sockcaps(FAR struct socket *psock); static void icmpv6_addref(FAR struct socket *psock); -static int icmpv6_getpeername(FAR struct socket *psock, - FAR struct sockaddr *addr, FAR socklen_t *addrlen); static int icmpv6_listen(FAR struct socket *psock, int backlog); static int icmpv6_connect(FAR struct socket *psock, FAR const struct sockaddr *addr, socklen_t addrlen); @@ -70,7 +68,7 @@ const struct sock_intf_s g_icmpv6_sockif = icmpv6_addref, /* si_addref */ NULL, /* si_bind */ NULL, /* si_getsockname */ - icmpv6_getpeername, /* si_getpeername */ + NULL, /* si_getpeername */ icmpv6_listen, /* si_listen */ icmpv6_connect, /* si_connect */ icmpv6_accept, /* si_accept */ @@ -275,40 +273,6 @@ static int icmpv6_accept(FAR struct socket *psock, FAR struct sockaddr *addr, return -EAFNOSUPPORT; } -/**************************************************************************** - * Name: icmpv6_getpeername - * - * Description: - * The icmpv6_getpeername() function retrieves the remote-connected name of - * the specified packet socket, stores this address in the sockaddr - * structure pointed to by the 'addr' argument, and stores the length of - * this address in the object pointed to by the 'addrlen' argument. - * - * If the actual length of the address is greater than the length of the - * supplied sockaddr structure, the stored address will be truncated. - * - * If the socket has not been bound to a local name, the value stored in - * the object pointed to by address is unspecified. - * - * Parameters: - * psock Socket structure of the socket to be queried - * addr sockaddr structure to receive data [out] - * addrlen Length of sockaddr structure [in/out] - * - * Returned Value: - * On success, 0 is returned, the 'addr' argument points to the address - * of the socket, and the 'addrlen' argument points to the length of the - * address. Otherwise, a negated errno value is returned. See - * getpeername() for the list of appropriate error numbers. - * - ****************************************************************************/ - -static int icmpv6_getpeername(FAR struct socket *psock, - FAR struct sockaddr *addr, FAR socklen_t *addrlen) -{ - return -EAFNOSUPPORT; -} - /**************************************************************************** * Name: icmpv6_listen * diff --git a/net/pkt/pkt_sockif.c b/net/pkt/pkt_sockif.c index 7af123891e..99beb66fc2 100644 --- a/net/pkt/pkt_sockif.c +++ b/net/pkt/pkt_sockif.c @@ -52,8 +52,6 @@ static sockcaps_t pkt_sockcaps(FAR struct socket *psock); static void pkt_addref(FAR struct socket *psock); static int pkt_bind(FAR struct socket *psock, FAR const struct sockaddr *addr, socklen_t addrlen); -static int pkt_getpeername(FAR struct socket *psock, - FAR struct sockaddr *addr, FAR socklen_t *addrlen); static int pkt_listen(FAR struct socket *psock, int backlog); static int pkt_connect(FAR struct socket *psock, FAR const struct sockaddr *addr, socklen_t addrlen); @@ -75,7 +73,7 @@ const struct sock_intf_s g_pkt_sockif = pkt_addref, /* si_addref */ pkt_bind, /* si_bind */ NULL, /* si_getsockname */ - pkt_getpeername, /* si_getpeername */ + NULL, /* si_getpeername */ pkt_listen, /* si_listen */ pkt_connect, /* si_connect */ pkt_accept, /* si_accept */ @@ -370,40 +368,6 @@ static int pkt_bind(FAR struct socket *psock, } } -/**************************************************************************** - * Name: pkt_getpeername - * - * Description: - * The pkt_getpeername() function retrieves the remote-connected name of - * the specified packet socket, stores this address in the sockaddr - * structure pointed to by the 'addr' argument, and stores the length of - * this address in the object pointed to by the 'addrlen' argument. - * - * If the actual length of the address is greater than the length of the - * supplied sockaddr structure, the stored address will be truncated. - * - * If the socket has not been bound to a local name, the value stored in - * the object pointed to by address is unspecified. - * - * Parameters: - * psock Socket structure of the socket to be queried - * addr sockaddr structure to receive data [out] - * addrlen Length of sockaddr structure [in/out] - * - * Returned Value: - * On success, 0 is returned, the 'addr' argument points to the address - * of the socket, and the 'addrlen' argument points to the length of the - * address. Otherwise, a negated errno value is returned. See - * getpeername() for the list of appropriate error numbers. - * - ****************************************************************************/ - -static int pkt_getpeername(FAR struct socket *psock, - FAR struct sockaddr *addr, FAR socklen_t *addrlen) -{ - return -EAFNOSUPPORT; -} - /**************************************************************************** * Name: pkt_listen * diff --git a/net/socket/getpeername.c b/net/socket/getpeername.c index b86a746ae7..5a0ec7ae11 100644 --- a/net/socket/getpeername.c +++ b/net/socket/getpeername.c @@ -98,7 +98,6 @@ int psock_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr, /* Let the address family's send() method handle the operation */ DEBUGASSERT(psock->s_sockif != NULL); - if (psock->s_sockif->si_getpeername == NULL) { return -EOPNOTSUPP;