From 8e0eb02df52d15dd4317abeddec427cdbac4da3c Mon Sep 17 00:00:00 2001 From: huyan Date: Mon, 8 Jul 2019 02:10:44 +0000 Subject: [PATCH] backport bugfix rpcbind GETADDR return client ip --- src/util.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util.c b/src/util.c index 4af8b9b..8b06c87 100644 --- a/src/util.c +++ b/src/util.c @@ -178,6 +178,11 @@ addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr, if (!bitmaskcmp(&SA2SINADDR(ifsa), &SA2SINADDR(hint_sa), &SA2SINADDR(ifmasksa), sizeof(struct in_addr))) { + if (getenv("RPCBIND_GETADDR_RETURN_CLIENT_IP") == NULL) { + bestif = ifap; + goto found; + } + if(!bestif) /* for compatibility with previous code */ bestif = ifap; /* Is this an exact match? */ @@ -208,6 +213,11 @@ addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr, } else if (!bitmaskcmp(&SA2SIN6ADDR(ifsa), &SA2SIN6ADDR(hint_sa), &SA2SIN6ADDR(ifmasksa), sizeof(struct in6_addr))) { + if (getenv("RPCBIND_GETADDR_RETURN_CLIENT_IP") == NULL) { + bestif = ifap; + goto found; + } + if(!bestif) /* for compatibility with previous code */ bestif = ifap; /* Is this an exact match? */ -- 2.23.0