[Olsr-dev] [PATCH v1 061/115] info: rename info_plugin_config to config
Ferry Huberts
(spam-protected)
Wed Dec 2 21:28:34 CET 2015
From: Ferry Huberts <(spam-protected)>
Signed-off-by: Ferry Huberts <(spam-protected)>
---
lib/info/olsrd_info.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/info/olsrd_info.c b/lib/info/olsrd_info.c
index dbad9a8..d97e1cb 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -64,7 +64,7 @@ typedef struct {
static const char * PLUGIN_NAME = NULL;
static info_plugin_functions_t *functions = NULL;
-static info_plugin_config_t *info_plugin_config;
+static info_plugin_config_t *config;
static int ipc_socket = -1;
@@ -186,7 +186,7 @@ static void send_info(unsigned int send_what, int the_socket) {
abuf_init(&abuf, 2 * 4096);
- if (info_plugin_config->http_headers) {
+ if (config->http_headers) {
http_header_build(PLUGIN_NAME, HTTP_200, content_type, &abuf, &contentLengthIndex);
headerLength = abuf.len;
}
@@ -230,7 +230,7 @@ static void send_info(unsigned int send_what, int the_socket) {
(*(*functions).olsrd_conf)(&abuf);
}
- if (info_plugin_config->http_headers) {
+ if (config->http_headers) {
http_header_adjust_content_length(&abuf, contentLengthIndex, abuf.len - headerLength);
}
@@ -278,8 +278,8 @@ 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, &info_plugin_config->accept_ip.v4) && info_plugin_config->accept_ip.v4.s_addr != INADDR_ANY) {
- if (!info_plugin_config->allow_localhost || ntohl(pin.in4.sin_addr.s_addr) != INADDR_LOOPBACK) {
+ if (!ip4equal(&pin.in4.sin_addr, &config->accept_ip.v4) && config->accept_ip.v4.s_addr != INADDR_ANY) {
+ if (!config->allow_localhost || ntohl(pin.in4.sin_addr.s_addr) != INADDR_LOOPBACK) {
olsr_printf(1, "(%s) From host(%s) not allowed!\n", PLUGIN_NAME, addr);
close(ipc_connection);
return;
@@ -289,7 +289,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, &info_plugin_config->accept_ip.v6) && !ip6equal(&pin.in6.sin6_addr, &info_plugin_config->accept_ip.v6)) {
+ if (!ip6equal(&in6addr_any, &config->accept_ip.v6) && !ip6equal(&pin.in6.sin6_addr, &config->accept_ip.v6)) {
olsr_printf(1, "(%s) From host(%s) not allowed!\n", PLUGIN_NAME, addr);
close(ipc_connection);
return;
@@ -352,7 +352,7 @@ static int plugin_ipc_init(void) {
}
#endif /* (defined __FreeBSD__ || defined __FreeBSD_kernel__) && defined SO_NOSIGPIPE */
#if defined linux && defined IPV6_V6ONLY
- if (info_plugin_config->ipv6_only && olsr_cnf->ip_version == AF_INET6) {
+ if (config->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;
@@ -369,16 +369,16 @@ static int plugin_ipc_init(void) {
#ifdef SIN6_LEN
sst.in4.sin_len = addrlen;
#endif /* SIN6_LEN */
- sst.in4.sin_addr.s_addr = info_plugin_config->listen_ip.v4.s_addr;
- sst.in4.sin_port = htons(info_plugin_config->ipc_port);
+ sst.in4.sin_addr.s_addr = config->listen_ip.v4.s_addr;
+ sst.in4.sin_port = htons(config->ipc_port);
} else {
sst.in6.sin6_family = AF_INET6;
addrlen = sizeof(struct sockaddr_in6);
#ifdef SIN6_LEN
sst.in6.sin6_len = addrlen;
#endif /* SIN6_LEN */
- sst.in6.sin6_addr = info_plugin_config->listen_ip.v6;
- sst.in6.sin6_port = htons(info_plugin_config->ipc_port);
+ sst.in6.sin6_addr = config->listen_ip.v6;
+ sst.in6.sin6_port = htons(config->ipc_port);
}
/* bind the socket to the port number */
@@ -401,7 +401,7 @@ static int plugin_ipc_init(void) {
add_olsr_socket(ipc_socket, &ipc_action, NULL, NULL, SP_PR_READ);
#ifndef NODEBUG
- olsr_printf(2, "(%s) listening on port %d\n", PLUGIN_NAME, info_plugin_config->ipc_port);
+ olsr_printf(2, "(%s) listening on port %d\n", PLUGIN_NAME, config->ipc_port);
#endif /* NODEBUG */
}
return 1;
@@ -416,7 +416,7 @@ static int plugin_ipc_init(void) {
int info_plugin_init(const char * plugin_name, info_plugin_functions_t *plugin_functions, info_plugin_config_t *plugin_config) {
functions = plugin_functions;
PLUGIN_NAME = plugin_name;
- info_plugin_config = plugin_config;
+ config = plugin_config;
/* Initial IPC value */
ipc_socket = -1;
--
2.5.0
More information about the Olsr-dev
mailing list