[Olsr-dev] [PATCH v1 31/44] jsoninfo: use a define to rename TXTINFO_ALLOW_LOCALHOST

Ferry Huberts (spam-protected)
Fri Nov 27 10:43:24 CET 2015


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/jsoninfo/src/olsrd_jsoninfo.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c b/lib/jsoninfo/src/olsrd_jsoninfo.c
index dbd6482..4818143 100644
--- a/lib/jsoninfo/src/olsrd_jsoninfo.c
+++ b/lib/jsoninfo/src/olsrd_jsoninfo.c
@@ -100,6 +100,9 @@
 #define info_accept_ip jsoninfo_accept_ip
 #define info_listen_ip jsoninfo_listen_ip
 #define info_ipv6_only jsoninfo_ipv6_only
+#ifdef JSONINFO_ALLOW_LOCALHOST
+#define INFO_ALLOW_LOCALHOST JSONINFO_ALLOW_LOCALHOST
+#endif
 
 static int ipc_socket;
 
@@ -461,15 +464,15 @@ static void ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int
     if (inet_ntop(olsr_cnf->ip_version, &pin.in4.sin_addr, addr, INET6_ADDRSTRLEN) == NULL)
       addr[0] = '\0';
     if (!ip4equal(&pin.in4.sin_addr, &info_accept_ip.v4) && info_accept_ip.v4.s_addr != INADDR_ANY) {
-#ifdef JSONINFO_ALLOW_LOCALHOST
+#ifdef INFO_ALLOW_LOCALHOST
       if (pin.in4.sin_addr.s_addr != INADDR_LOOPBACK) {
-#endif /* JSONINFO_ALLOW_LOCALHOST */
+#endif /* INFO_ALLOW_LOCALHOST */
       olsr_printf(1, "("PLUGIN_NAME") From host(%s) not allowed!\n", addr);
       close(ipc_connection);
       return;
-#ifdef JSONINFO_ALLOW_LOCALHOST
+#ifdef INFO_ALLOW_LOCALHOST
     }
-#endif /* JSONINFO_ALLOW_LOCALHOST */
+#endif /* INFO_ALLOW_LOCALHOST */
     }
   } else {
     if (inet_ntop(olsr_cnf->ip_version, &pin.in6.sin6_addr, addr, INET6_ADDRSTRLEN) == NULL)
-- 
2.5.0




More information about the Olsr-dev mailing list