[Olsr-dev] [PATCH v1 101/115] info: add a function to initialise the config
Ferry Huberts
(spam-protected)
Thu Dec 3 11:45:23 CET 2015
Shall I do that as a follow-up patch?
On 03/12/15 11:23, Henning Rogge wrote:
> On Wed, Dec 2, 2015 at 9:29 PM, Ferry Huberts <(spam-protected)> wrote:
>> From: Ferry Huberts <(spam-protected)>
>>
>> Signed-off-by: Ferry Huberts <(spam-protected)>
>> ---
>> lib/info/info_types.h | 20 ++++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>>
>> diff --git a/lib/info/info_types.h b/lib/info/info_types.h
>> index 6a30ee7..de0c750 100644
>> --- a/lib/info/info_types.h
>> +++ b/lib/info/info_types.h
>> @@ -43,6 +43,8 @@
>> #define _OLSRD_LIB_INFO_INFO_TYPES_H_
>>
>> #include <stdbool.h>
>> +#include <assert.h>
>> +#include <netinet/in.h>
>>
>> #include "common/autobuf.h"
>>
>> @@ -118,4 +120,22 @@ typedef struct {
>> { .name = "allowlocalhost", .set_plugin_parameter = &set_plugin_boolean, .data = &config.allow_localhost }, \
>> { .name = "ipv6only", .set_plugin_parameter = &set_plugin_boolean, .data = &config.ipv6_only }
>>
>> +static inline void info_plugin_config_init(info_plugin_config_t *config, unsigned short port) {
>
> static INLINE ....
>
> Otherwise we can run into compiler errors when optimizing for size.
>
> see src/defs.h:
> #define INLINE inline __attribute__((always_inline))
>
>> + assert(config);
>> +
>> + if (olsr_cnf->ip_version == AF_INET) {
>> + config->accept_ip.v4.s_addr = htonl(INADDR_LOOPBACK);
>> + config->listen_ip.v4.s_addr = htonl(INADDR_ANY);
>> + } else {
>> + config->accept_ip.v6 = in6addr_loopback;
>> + config->listen_ip.v6 = in6addr_any;
>> + }
>> +
>> + config->ipc_port = port;
>> + config->nompr = 0;
>> + config->http_headers = true;
>> + config->allow_localhost = false;
>> + config->ipv6_only = false;
>> +}
>> +
>> #endif /* _OLSRD_LIB_INFO_INFO_TYPES_H_ */
>> --
>> 2.5.0
>>
>>
>> --
>> Olsr-dev mailing list
>> (spam-protected)
>> https://lists.olsr.org/mailman/listinfo/olsr-dev
--
Ferry Huberts
More information about the Olsr-dev
mailing list