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

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


From: Ferry Huberts <(spam-protected)>

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

diff --git a/lib/txtinfo/src/olsrd_txtinfo.c b/lib/txtinfo/src/olsrd_txtinfo.c
index c6b8191..19d984b 100644
--- a/lib/txtinfo/src/olsrd_txtinfo.c
+++ b/lib/txtinfo/src/olsrd_txtinfo.c
@@ -92,6 +92,9 @@
 #define info_accept_ip txtinfo_accept_ip
 #define info_listen_ip txtinfo_listen_ip
 #define info_ipv6_only txtinfo_ipv6_only
+#ifdef TXTINFO_ALLOW_LOCALHOST
+#define INFO_ALLOW_LOCALHOST TXTINFO_ALLOW_LOCALHOST
+#endif
 
 static int ipc_socket;
 
@@ -279,15 +282,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 TXTINFO_ALLOW_LOCALHOST
+#ifdef INFO_ALLOW_LOCALHOST
       if (ntohl(pin.in4.sin_addr.s_addr) != INADDR_LOOPBACK) {
-#endif /* TXTINFO_ALLOW_LOCALHOST */
+#endif /* INFO_ALLOW_LOCALHOST */
       olsr_printf(1, "("PLUGIN_NAME") From host(%s) not allowed!\n", addr);
       close(ipc_connection);
       return;
-#ifdef TXTINFO_ALLOW_LOCALHOST
+#ifdef INFO_ALLOW_LOCALHOST
     }
-#endif /* TXTINFO_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