Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58cc8a55 authored by Anna Schumaker's avatar Anna Schumaker Committed by Trond Myklebust
Browse files

SUNRPC: Add an rpc_cmp_addr_port() function



This function is to help determine if two sockaddrs are really the same
socket.

Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 7b0ce60c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -130,6 +130,19 @@ static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
	return false;
}

/**
 * rpc_cmp_addr_port - compare the address and port number of two sockaddrs.
 * @sap1: first sockaddr
 * @sap2: second sockaddr
 */
static inline bool rpc_cmp_addr_port(const struct sockaddr *sap1,
				     const struct sockaddr *sap2)
{
	if (!rpc_cmp_addr(sap1, sap2))
		return false;
	return rpc_get_port(sap1) == rpc_get_port(sap2);
}

/**
 * rpc_copy_addr - copy the address portion of one sockaddr to another
 * @dst: destination sockaddr