From: Ronnie Sahlberg Date: Sun, 26 Jun 2011 08:45:38 +0000 (+1000) Subject: add function to extract the sockaddr from which we received the current rpc pdu X-Git-Tag: upstream/1.9.6^2~371 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c481da67f2a32e7bfad4c7e6b7662e9ae544073c;p=deb_libnfs.git add function to extract the sockaddr from which we received the current rpc pdu (useful when parsing replies from broadcast rpc calls) --- diff --git a/include/libnfs-private.h b/include/libnfs-private.h index 1d59faf..3131a20 100644 --- a/include/libnfs-private.h +++ b/include/libnfs-private.h @@ -80,3 +80,5 @@ struct rpc_context *nfs_get_rpc_context(struct nfs_context *nfs); int rpc_bind_udp(struct rpc_context *rpc, char *addr, int port); int rpc_set_udp_destination(struct rpc_context *rpc, char *addr, int port, int is_broadcast); struct rpc_context *rpc_init_udp_context(void); +struct sockaddr *rpc_get_recv_sockaddr(struct rpc_context *rpc); + diff --git a/lib/socket.c b/lib/socket.c index a26afe1..0bed751 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -422,3 +422,8 @@ int rpc_set_udp_destination(struct rpc_context *rpc, char *addr, int port, int i return 0; } + +struct sockaddr *rpc_get_recv_sockaddr(struct rpc_context *rpc) +{ + return (struct sockaddr *)&rpc->udp_src; +}