1From a41cbeee3cf660663a9baac80545050a8d960898 Mon Sep 17 00:00:00 2001 2From: Khem Raj <raj.khem@gmail.com> 3Date: Tue, 28 Mar 2017 18:09:58 -0700 4Subject: [PATCH 2/2] user ipv6 structures 5 6Signed-off-by: Khem Raj <raj.khem@gmail.com> 7 8Update for ipv6 address compare 9Signed-off-by: Changqing Li <changqing.li@windriver.com> 10--- 11 l2tp_api.c | 8 +++++--- 12 1 file changed, 5 insertions(+), 3 deletions(-) 13 14diff --git a/l2tp_api.c b/l2tp_api.c 15index 9d6f60a..f0946fd 100644 16--- a/l2tp_api.c 17+++ b/l2tp_api.c 18@@ -450,10 +450,12 @@ int l2tp_api_rpc_check_request(SVCXPRT *xprt) 19 * non-loopback interface, reject the request. 20 */ 21 if ((!l2tp_opt_remote_rpc) && 22- ((xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) && 23- (xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_ANY)))) { 24+ ((memcmp(&xprt->xp_raddr.sin6_addr, &in6addr_loopback, sizeof(struct in6_addr)) != 0) && 25+ (memcmp(&xprt->xp_raddr.sin6_addr, &in6addr_any, sizeof(struct in6_addr)) != 0))) { 26+ char straddr[INET6_ADDRSTRLEN]; 27+ inet_ntop(AF_INET6, &xprt->xp_raddr.sin6_addr, straddr, sizeof(straddr)); 28 if (l2tp_opt_trace_flags & L2TP_DEBUG_API) { 29- l2tp_log(LOG_ERR, "Rejecting RPC request from %s", inet_ntoa(xprt->xp_raddr.sin_addr)); 30+ l2tp_log(LOG_ERR, "Rejecting RPC request from %s", straddr); 31 } 32 svcerr_auth(xprt, AUTH_TOOWEAK); 33 return -EPERM; 34-- 352.12.1 36 37