From c481da67f2a32e7bfad4c7e6b7662e9ae544073c Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 26 Jun 2011 18:45:38 +1000 Subject: [PATCH] add function to extract the sockaddr from which we received the current rpc pdu (useful when parsing replies from broadcast rpc calls) --- include/libnfs-private.h | 2 ++ lib/socket.c | 5 +++++ 2 files changed, 7 insertions(+) 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; +} -- 2.34.1