[Olsr-dev] [PATCH v1 08/44] txtinfo: use defines for some variables
Ferry Huberts
(spam-protected)
Fri Nov 27 10:43:01 CET 2015
From: Ferry Huberts <(spam-protected)>
Signed-off-by: Ferry Huberts <(spam-protected)>
---
lib/txtinfo/src/olsrd_txtinfo.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/txtinfo/src/olsrd_txtinfo.c b/lib/txtinfo/src/olsrd_txtinfo.c
index 7199652..c6b8191 100644
--- a/lib/txtinfo/src/olsrd_txtinfo.c
+++ b/lib/txtinfo/src/olsrd_txtinfo.c
@@ -89,6 +89,9 @@
/* defines to make txtinfo and jsoninfo look alike */
#define PLUGIN_NAME "TXTINFO"
+#define info_accept_ip txtinfo_accept_ip
+#define info_listen_ip txtinfo_listen_ip
+#define info_ipv6_only txtinfo_ipv6_only
static int ipc_socket;
@@ -194,7 +197,7 @@ static int plugin_ipc_init(void) {
}
#endif /* (defined __FreeBSD__ || defined __FreeBSD_kernel__) && defined SO_NOSIGPIPE */
#if defined linux && defined IPV6_V6ONLY
- if (txtinfo_ipv6_only && olsr_cnf->ip_version == AF_INET6) {
+ if (info_ipv6_only && olsr_cnf->ip_version == AF_INET6) {
if (setsockopt(ipc_socket, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &yes, sizeof(yes)) < 0) {
perror("IPV6_V6ONLY failed");
return 0;
@@ -211,7 +214,7 @@ static int plugin_ipc_init(void) {
#ifdef SIN6_LEN
sst.in4.sin_len = addrlen;
#endif /* SIN6_LEN */
- sst.in4.sin_addr.s_addr = txtinfo_listen_ip.v4.s_addr;
+ sst.in4.sin_addr.s_addr = info_listen_ip.v4.s_addr;
sst.in4.sin_port = htons(ipc_port);
} else {
sst.in6.sin6_family = AF_INET6;
@@ -219,7 +222,7 @@ static int plugin_ipc_init(void) {
#ifdef SIN6_LEN
sst.in6.sin6_len = addrlen;
#endif /* SIN6_LEN */
- sst.in6.sin6_addr = txtinfo_listen_ip.v6;
+ sst.in6.sin6_addr = info_listen_ip.v6;
sst.in6.sin6_port = htons(ipc_port);
}
@@ -275,7 +278,7 @@ static void ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int
if (olsr_cnf->ip_version == AF_INET) {
if (inet_ntop(olsr_cnf->ip_version, &pin.in4.sin_addr, addr, INET6_ADDRSTRLEN) == NULL)
addr[0] = '\0';
- if (!ip4equal(&pin.in4.sin_addr, &txtinfo_accept_ip.v4) && txtinfo_accept_ip.v4.s_addr != INADDR_ANY) {
+ if (!ip4equal(&pin.in4.sin_addr, &info_accept_ip.v4) && info_accept_ip.v4.s_addr != INADDR_ANY) {
#ifdef TXTINFO_ALLOW_LOCALHOST
if (ntohl(pin.in4.sin_addr.s_addr) != INADDR_LOOPBACK) {
#endif /* TXTINFO_ALLOW_LOCALHOST */
@@ -290,7 +293,7 @@ static void ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int
if (inet_ntop(olsr_cnf->ip_version, &pin.in6.sin6_addr, addr, INET6_ADDRSTRLEN) == NULL)
addr[0] = '\0';
/* Use in6addr_any (::) in olsr.conf to allow anybody. */
- if (!ip6equal(&in6addr_any, &txtinfo_accept_ip.v6) && !ip6equal(&pin.in6.sin6_addr, &txtinfo_accept_ip.v6)) {
+ if (!ip6equal(&in6addr_any, &info_accept_ip.v6) && !ip6equal(&pin.in6.sin6_addr, &info_accept_ip.v6)) {
olsr_printf(1, "("PLUGIN_NAME") From host(%s) not allowed!\n", addr);
close(ipc_connection);
return;
--
2.5.0
More information about the Olsr-dev
mailing list