2 * The olsr.org Optimized Link-State Routing daemon(olsrd)
3 * Copyright (c) 2005, Andreas Tønnesen(andreto@olsr.org)
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of olsr.org, olsrd nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
33 * Visit http://www.olsr.org for more information.
35 * If you find this software useful feel free to make a donation
36 * to the project. For more information see the website or contact
37 * the copyright holders.
41 #include "olsrd_conf.h"
42 #include "../ipcalc.h"
43 #include "../net_olsr.h"
48 #include <sys/types.h>
49 #include <netinet/in.h>
50 #include <arpa/inet.h>
54 olsrd_write_cnf(struct olsrd_config *cnf, const char *fname)
56 struct ip_prefix_list *h = cnf->hna_entries;
57 struct olsr_if *in = cnf->interfaces;
58 struct plugin_entry *pe = cnf->plugins;
59 struct plugin_param *pp;
60 struct ip_prefix_list *ie = cnf->ipc_nets;
61 struct olsr_lq_mult *mult;
63 char ipv6_buf[100]; /* buffer for IPv6 inet_htop */
67 fd = fopen(fname, "w");
71 fprintf(stderr, "Could not open file %s for writing\n%s\n", fname, strerror(errno));
75 printf("Writing config to file \"%s\".... ", fname);
77 fprintf(fd, "#\n# Configuration file for s%s\n# automatically generated by olsrd-cnf parser v. %s\n#\n\n", olsrd_version, PARSER_VERSION);
80 fprintf(fd, "# Debug level(0-9)\n# If set to 0 the daemon runs in the background\n\nDebugLevel\t%d\n\n", cnf->debug_level);
83 fprintf(fd, "# IP version to use (4 or 6)\n\nIpVersion\t%d\n\n", cnf->ip_version == AF_INET ? 4 : 6);
86 fprintf(fd, "# FIBMetric (\"%s\", \"%s\", or \"%s\")\n\nFIBMetric\t\"%s\"\n\n", CFG_FIBM_FLAT, CFG_FIBM_CORRECT, CFG_FIBM_APPROX,
87 FIBM_FLAT == cnf->fib_metric ? CFG_FIBM_FLAT : FIBM_CORRECT == cnf->fib_metric ? CFG_FIBM_CORRECT : CFG_FIBM_APPROX);
90 fprintf(fd, "# HNA IPv%d routes\n# syntax: netaddr/prefix\n\nHna%d {\n", cnf->ip_version == AF_INET ? 4 : 6, cnf->ip_version == AF_INET ? 4 : 6);
92 struct ipaddr_str strbuf;
93 fprintf(fd, " %s/%d\n", olsr_ip_to_string(&strbuf, &h->net.prefix), h->net.prefix_len);
99 fprintf(fd, "# Should olsrd keep on running even if there are\n# no interfaces available? This is a good idea\n# for a PCMCIA/USB hotswap environment.\n# \"yes\" OR \"no\"\n\nAllowNoInt\t");
100 if(cnf->allow_no_interfaces)
101 fprintf(fd, "yes\n\n");
103 fprintf(fd, "no\n\n");
106 fprintf(fd, "# TOS(type of service) to use. Default is 16\n\n");
107 fprintf(fd, "TosValue\t%d\n\n", cnf->tos);
110 fprintf(fd, "# Policy Routing Table to use. Default is 254\n\n");
111 fprintf(fd, "RtTable\t\t%d\n\n", cnf->rttable);
114 fprintf(fd, "# The fixed willingness to use(0-7)\n# If not set willingness will be calculated\n# dynammically based on battery/power status\n\n");
115 if(cnf->willingness_auto)
116 fprintf(fd, "#Willingness\t4\n\n");
118 fprintf(fd, "Willingness\t%d\n\n", cnf->willingness);
121 fprintf(fd, "# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n");
122 fprintf(fd, "IpcConnect {\n");
123 fprintf(fd, " MaxConnections\t%d\n", cnf->ipc_connections);
127 struct ipaddr_str strbuf;
128 if (ie->net.prefix_len == olsr_cnf->maxplen) {
129 fprintf(fd, " Host\t\t%s\n", olsr_ip_to_string(&strbuf, &ie->net.prefix));
131 fprintf(fd, " Net\t\t\t%s/%d\n", olsr_ip_to_string(&strbuf, &ie->net.prefix), ie->net.prefix_len);
136 fprintf(fd, "}\n\n");
139 fprintf(fd, "# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n");
141 if(cnf->use_hysteresis)
143 fprintf(fd, "UseHysteresis\tyes\n\n");
144 fprintf(fd, "# Hysteresis parameters\n# Do not alter these unless you know \n# what you are doing!\n# Set to auto by default. Allowed\n# values are floating point values\n# in the interval 0,1\n# THR_LOW must always be lower than\n# THR_HIGH!!\n\n");
145 fprintf(fd, "HystScaling\t%0.2f\n", cnf->hysteresis_param.scaling);
146 fprintf(fd, "HystThrHigh\t%0.2f\n", cnf->hysteresis_param.thr_high);
147 fprintf(fd, "HystThrLow\t%0.2f\n\n", cnf->hysteresis_param.thr_low);
151 fprintf(fd, "UseHysteresis\tno\n\n");
152 fprintf(fd, "# Hysteresis parameters\n# Do not alter these unless you know \n# what you are doing!\n# Set to auto by default. Allowed\n# values are floating point values\n# in the interval 0,1\n# THR_LOW must always be lower than\n# THR_HIGH!!\n\n");
153 fprintf(fd, "#HystScaling\t%0.2f\n", cnf->hysteresis_param.scaling);
154 fprintf(fd, "#HystThrHigh\t%0.2f\n", cnf->hysteresis_param.thr_high);
155 fprintf(fd, "#HystThrLow\t%0.2f\n\n", cnf->hysteresis_param.thr_low);
159 fprintf(fd, "# Polling rate in seconds(float).\n# Auto uses default value 0.05 sec\n\n");
160 fprintf(fd, "Pollrate\t%0.2f\n", cnf->pollrate);
162 /* NIC Changes Pollrate */
163 fprintf(fd, "# Interval to poll network interfaces for configuration\n# changes. Defaults to 2.5 seconds\n");
164 fprintf(fd, "NicChgsPollInt\t%0.2f\n", cnf->nic_chgs_pollrate);
167 fprintf(fd, "# TC redundancy\n# Specifies how much neighbor info should\n# be sent in TC messages\n# Possible values are:\n# 0 - only send MPR selectors\n# 1 - send MPR selectors and MPRs\n# 2 - send all neighbors\n#\n# defaults to 0\n\n");
168 fprintf(fd, "TcRedundancy\t%d\n\n", cnf->tc_redundancy);
171 fprintf(fd, "# MPR coverage\n# Specifies how many MPRs a node should\n# try select to reach every 2 hop neighbor\n# Can be set to any integer >0\n# defaults to 1\n\n");
173 fprintf(fd, "MprCoverage\t%d\n\n", cnf->mpr_coverage);
175 fprintf(fd, "# Link quality level\n# 0 = do not use link quality\n# 1 = use link quality for MPR selection\n# 2 = use link quality for MPR selection and routing\n\n");
176 fprintf(fd, "LinkQualityLevel\t%d\n\n", cnf->lq_level);
178 fprintf(fd, "# Fish Eye algorithm\n# 0 = do not use fish eye\n# 1 = use fish eye\n\n");
179 fprintf(fd, "LinkQualityFishEye\t%d\n\n", cnf->lq_fish);
181 fprintf(fd, "# Link quality window size\n\n");
182 fprintf(fd, "LinkQualityWinSize\t%d\n\n", cnf->lq_wsize);
184 fprintf(fd, "# NAT threshold\n\n");
185 fprintf(fd, "NatThreshold\t%f\n\n", cnf->lq_nat_thresh);
187 fprintf(fd, "# Clear screen when printing debug output?\n\n");
188 fprintf(fd, "ClearScreen\t%s\n\n", cnf->clear_screen ? "yes" : "no");
191 fprintf(fd, "# Olsrd plugins to load\n# This must be the absolute path to the file\n# or the loader will use the following scheme:\n# - Try the paths in the LD_LIBRARY_PATH \n# environment variable.\n# - The list of libraries cached in /etc/ld.so.cache\n# - /lib, followed by /usr/lib\n\n");
196 fprintf(fd, "LoadPlugin \"%s\" {\n", pe->name);
200 fprintf(fd, " PlParam \"%s\"\t\"%s\"\n", pp->key, pp->value);
213 fprintf(fd, "# Interfaces\n# Multiple interfaces with the same configuration\n# can shar the same config block. Just list the\n# interfaces(e.g. Interface \"eth0\" \"eth2\"\n\n");
219 fprintf(fd, "Interface \"%s\" {\n", in->name);
222 fprintf(fd, " # IPv4 broadcast address to use. The\n # one usefull example would be 255.255.255.255\n # If not defined the broadcastaddress\n # every card is configured with is used\n\n");
225 if(in->cnf->ipv4_broadcast.v4.s_addr)
227 fprintf(fd, " Ip4Broadcast\t%s\n\n", inet_ntoa(in->cnf->ipv4_broadcast.v4));
231 fprintf(fd, " #Ip4Broadcast\t255.255.255.255\n\n");
235 fprintf(fd, " # IPv6 address scope to use.\n # Must be 'site-local' or 'global'\n\n");
236 if(in->cnf->ipv6_addrtype)
237 fprintf(fd, " Ip6AddrType \tsite-local\n\n");
239 fprintf(fd, " Ip6AddrType \tglobal\n\n");
241 fprintf(fd, " # IPv6 multicast address to use when\n # using site-local addresses.\n # If not defined, ff05::15 is used\n");
242 fprintf(fd, " Ip6MulticastSite\t%s\n\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf)));
243 fprintf(fd, " # IPv6 multicast address to use when\n # using global addresses\n # If not defined, ff0e::1 is used\n");
244 fprintf(fd, " Ip6MulticastGlobal\t%s\n\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf)));
247 fprintf(fd, " # Olsrd can autodetect changes in\n # interface configurations. Enabled by default\n # turn off to save CPU.\n AutoDetectChanges: %s\n", in->cnf->autodetect_chg ? "yes" : "no");
249 fprintf(fd, " # Emission and validity intervals.\n # If not defined, RFC proposed values will\n # in most cases be used.\n\n");
252 if(in->cnf->hello_params.emission_interval != HELLO_INTERVAL)
253 fprintf(fd, " HelloInterval\t%0.2f\n", in->cnf->hello_params.emission_interval);
255 fprintf(fd, " #HelloInterval\t%0.2f\n", in->cnf->hello_params.emission_interval);
256 if(in->cnf->hello_params.validity_time != NEIGHB_HOLD_TIME)
257 fprintf(fd, " HelloValidityTime\t%0.2f\n", in->cnf->hello_params.validity_time);
259 fprintf(fd, " #HelloValidityTime\t%0.2f\n", in->cnf->hello_params.validity_time);
260 if(in->cnf->tc_params.emission_interval != TC_INTERVAL)
261 fprintf(fd, " TcInterval\t\t%0.2f\n", in->cnf->tc_params.emission_interval);
263 fprintf(fd, " #TcInterval\t\t%0.2f\n", in->cnf->tc_params.emission_interval);
264 if(in->cnf->tc_params.validity_time != TOP_HOLD_TIME)
265 fprintf(fd, " TcValidityTime\t%0.2f\n", in->cnf->tc_params.validity_time);
267 fprintf(fd, " #TcValidityTime\t%0.2f\n", in->cnf->tc_params.validity_time);
268 if(in->cnf->mid_params.emission_interval != MID_INTERVAL)
269 fprintf(fd, " MidInterval\t\t%0.2f\n", in->cnf->mid_params.emission_interval);
271 fprintf(fd, " #MidInterval\t%0.2f\n", in->cnf->mid_params.emission_interval);
272 if(in->cnf->mid_params.validity_time != MID_HOLD_TIME)
273 fprintf(fd, " MidValidityTime\t%0.2f\n", in->cnf->mid_params.validity_time);
275 fprintf(fd, " #MidValidityTime\t%0.2f\n", in->cnf->mid_params.validity_time);
276 if(in->cnf->hna_params.emission_interval != HNA_INTERVAL)
277 fprintf(fd, " HnaInterval\t\t%0.2f\n", in->cnf->hna_params.emission_interval);
279 fprintf(fd, " #HnaInterval\t%0.2f\n", in->cnf->hna_params.emission_interval);
280 if(in->cnf->hna_params.validity_time != HNA_HOLD_TIME)
281 fprintf(fd, " HnaValidityTime\t%0.2f\n", in->cnf->hna_params.validity_time);
283 fprintf(fd, " #HnaValidityTime\t%0.2f\n", in->cnf->hna_params.validity_time);
285 mult = in->cnf->lq_mult;
289 fprintf(fd, " #LinkQualityMult\tdefault 1.0\n");
295 fprintf(fd, " LinkQualityMult\t%s %0.2f\n", inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf, sizeof(ipv6_buf)), mult->val);
300 fprintf(fd, " # When multiple links exist between hosts\n");
301 fprintf(fd, " # the weight of interface is used to determine\n");
302 fprintf(fd, " # the link to use. Normally the weight is\n");
303 fprintf(fd, " # automatically calculated by olsrd based\n");
304 fprintf(fd, " # on the characteristics of the interface,\n");
305 fprintf(fd, " # but here you can specify a fixed value.\n");
306 fprintf(fd, " # Olsrd will choose links with the lowest value.\n");
307 fprintf(fd, " # Note:\n");
308 fprintf(fd, " # Interface weight is used only when LinkQualityLevel is 0.\n");
309 fprintf(fd, " # For any other value of LinkQualityLevel, the interface ETX\n");
310 fprintf(fd, " # value is used instead.\n\n");
311 if(in->cnf->weight.fixed)
313 fprintf(fd, " Weight\t %d\n\n", in->cnf->weight.value);
317 fprintf(fd, " #Weight\t 0\n\n");
321 fprintf(fd, "}\n\n");
328 fprintf(fd, "\n# END AUTOGENERATED CONFIG\n");
336 #define MAX_LINESIZE 250
338 #define WRITE_TO_BUF(fmt, args...) \
340 if((bufsize - size) < MAX_LINESIZE) { \
343 size += snprintf(&buf[size], MAX_LINESIZE, fmt, ##args); \
347 olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize)
349 struct ip_prefix_list *h = cnf->hna_entries;
350 struct olsr_if *in = cnf->interfaces;
351 struct plugin_entry *pe = cnf->plugins;
352 struct plugin_param *pp;
353 struct ip_prefix_list *ie = cnf->ipc_nets;
354 struct olsr_lq_mult *mult;
358 char ipv6_buf[100]; /* buffer for IPv6 inet_htop */
361 printf("\n\n\n\nolsrd_write_cnf_buf bufsize %d\n\n\n\n\n", bufsize);
363 if (buf == NULL || bufsize < MAX_LINESIZE) {
367 WRITE_TO_BUF("#\n# Configuration file for olsr.org olsrd\n# automatically generated by olsrd-cnf %s\n#\n\n\n", PARSER_VERSION);
370 WRITE_TO_BUF("# Debug level(0-9)\n# If set to 0 the daemon runs in the background\n\nDebugLevel\t%d\n\n", cnf->debug_level);
373 WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t%d\n\n", cnf->ip_version == AF_INET ? 4 : 6);
376 WRITE_TO_BUF("# FIBMetric (\"%s\", \"%s\", or \"%s\")\n\nFIBMetric\t\"%s\"\n\n", CFG_FIBM_FLAT, CFG_FIBM_CORRECT, CFG_FIBM_APPROX,
377 FIBM_FLAT == cnf->fib_metric ? CFG_FIBM_FLAT : FIBM_CORRECT == cnf->fib_metric ? CFG_FIBM_CORRECT : CFG_FIBM_APPROX);
380 WRITE_TO_BUF("# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna%1$d {\n", cnf->ip_version == AF_INET ? 4 : 6);
382 struct ipaddr_str strbuf;
383 WRITE_TO_BUF(" %s/%d\n", olsr_ip_to_string(&strbuf, &h->net.prefix), h->net.prefix_len);
386 WRITE_TO_BUF("}\n\n");
389 WRITE_TO_BUF("# Should olsrd keep on running even if there are\n# no interfaces available? This is a good idea\n# for a PCMCIA/USB hotswap environment.\n# \"yes\" OR \"no\"\n\nAllowNoInt\t");
390 if(cnf->allow_no_interfaces)
391 WRITE_TO_BUF("yes\n\n");
393 WRITE_TO_BUF("no\n\n");
396 WRITE_TO_BUF("# TOS(type of service) to use. Default is 16\n\n");
397 WRITE_TO_BUF("TosValue\t%d\n\n", cnf->tos);
400 WRITE_TO_BUF("# Policy Routing Tableto use. Default is 254\n\n");
401 WRITE_TO_BUF("RtTable\t\t%d\n\n", cnf->rttable);
404 WRITE_TO_BUF("# The fixed willingness to use(0-7)\n# If not set willingness will be calculated\n# dynammically based on battery/power status\n\n");
405 if(cnf->willingness_auto)
406 WRITE_TO_BUF("#Willingness\t4\n\n");
408 WRITE_TO_BUF("Willingness\t%d\n\n", cnf->willingness);
411 WRITE_TO_BUF("# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n");
412 WRITE_TO_BUF("IpcConnect {\n");
413 WRITE_TO_BUF(" MaxConnections\t%d\n", cnf->ipc_connections);
416 struct ipaddr_str strbuf;
417 if (ie->net.prefix_len == olsr_cnf->maxplen) {
418 WRITE_TO_BUF(" Host\t\t%s\n", olsr_ip_to_string(&strbuf, &ie->net.prefix));
420 WRITE_TO_BUF(" Net\t\t\t%s/%d\n", olsr_ip_to_string(&strbuf, &ie->net.prefix), ie->net.prefix_len);
425 WRITE_TO_BUF("}\n\n");
430 WRITE_TO_BUF("# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n");
432 if(cnf->use_hysteresis)
434 WRITE_TO_BUF("UseHysteresis\tyes\n\n");
435 WRITE_TO_BUF("# Hysteresis parameters\n# Do not alter these unless you know \n# what you are doing!\n# Set to auto by default. Allowed\n# values are floating point values\n# in the interval 0,1\n# THR_LOW must always be lower than\n# THR_HIGH!!\n\n");
436 WRITE_TO_BUF("HystScaling\t%0.2f\n", cnf->hysteresis_param.scaling);
437 WRITE_TO_BUF("HystThrHigh\t%0.2f\n", cnf->hysteresis_param.thr_high);
438 WRITE_TO_BUF("HystThrLow\t%0.2f\n\n", cnf->hysteresis_param.thr_low);
442 WRITE_TO_BUF("UseHysteresis\tno\n\n");
443 WRITE_TO_BUF("# Hysteresis parameters\n# Do not alter these unless you know \n# what you are doing!\n# Set to auto by default. Allowed\n# values are floating point values\n# in the interval 0,1\n# THR_LOW must always be lower than\n# THR_HIGH!!\n\n");
444 WRITE_TO_BUF("#HystScaling\t%0.2f\n", cnf->hysteresis_param.scaling);
445 WRITE_TO_BUF("#HystThrHigh\t%0.2f\n", cnf->hysteresis_param.thr_high);
446 WRITE_TO_BUF("#HystThrLow\t%0.2f\n\n", cnf->hysteresis_param.thr_low);
450 WRITE_TO_BUF("# Polling rate in seconds(float).\n# Auto uses default value 0.05 sec\n\n");
451 WRITE_TO_BUF("Pollrate\t%0.2f\n", cnf->pollrate);
454 WRITE_TO_BUF("# TC redundancy\n# Specifies how much neighbor info should\n# be sent in TC messages\n# Possible values are:\n# 0 - only send MPR selectors\n# 1 - send MPR selectors and MPRs\n# 2 - send all neighbors\n#\n# defaults to 0\n\n");
455 WRITE_TO_BUF("TcRedundancy\t%d\n\n", cnf->tc_redundancy);
458 WRITE_TO_BUF("# MPR coverage\n# Specifies how many MPRs a node should\n# try select to reach every 2 hop neighbor\n# Can be set to any integer >0\n# defaults to 1\n\n");
460 WRITE_TO_BUF("MprCoverage\t%d\n\n", cnf->mpr_coverage);
462 WRITE_TO_BUF("# Link quality level\n# 0 = do not use link quality\n# 1 = use link quality for MPR selection\n# 2 = use link quality for MPR selection and routing\n\n");
463 WRITE_TO_BUF("LinkQualityLevel\t%d\n\n", cnf->lq_level);
465 WRITE_TO_BUF("# Link quality window size\n\n");
466 WRITE_TO_BUF("LinkQualityWinSize\t%d\n\n", cnf->lq_wsize);
468 WRITE_TO_BUF("# NAT threshold\n\n");
469 WRITE_TO_BUF("NatThreshold\t%f\n\n", cnf->lq_nat_thresh);
471 WRITE_TO_BUF("# Clear screen when printing debug output?\n\n");
472 WRITE_TO_BUF("ClearScreen\t%s\n\n", cnf->clear_screen ? "yes" : "no");
475 WRITE_TO_BUF("# Olsrd plugins to load\n# This must be the absolute path to the file\n# or the loader will use the following scheme:\n");
476 WRITE_TO_BUF("# - Try the paths in the LD_LIBRARY_PATH \n# environment variable.\n# - The list of libraries cached in /etc/ld.so.cache\n# - /lib, followed by /usr/lib\n\n");
481 WRITE_TO_BUF("LoadPlugin \"%s\" {\n", pe->name);
485 WRITE_TO_BUF(" PlParam \"%s\"\t\"%s\"\n", pp->key, pp->value);
498 WRITE_TO_BUF("# Interfaces\n# Multiple interfaces with the same configuration\n");
499 WRITE_TO_BUF("# can shar the same config block. Just list the\n# interfaces(e.g. Interface \"eth0\" \"eth2\"\n\n");
503 olsr_bool first = OLSR_TRUE;
506 WRITE_TO_BUF("Interface \"%s\" {\n", in->name);
509 WRITE_TO_BUF(" # IPv4 broadcast address to use. The\n # one usefull example would be 255.255.255.255\n # If not defined the broadcastaddress\n # every card is configured with is used\n\n");
512 if(in->cnf->ipv4_broadcast.v4.s_addr)
514 WRITE_TO_BUF(" Ip4Broadcast\t%s\n", inet_ntoa(in->cnf->ipv4_broadcast.v4));
519 WRITE_TO_BUF(" #Ip4Broadcast\t255.255.255.255\n");
522 if(first) WRITE_TO_BUF("\n");
525 WRITE_TO_BUF(" # IPv6 address scope to use.\n # Must be 'site-local' or 'global'\n\n");
526 if(in->cnf->ipv6_addrtype)
527 WRITE_TO_BUF(" Ip6AddrType \tsite-local\n");
529 WRITE_TO_BUF(" Ip6AddrType \tglobal\n");
531 if(first) WRITE_TO_BUF("\n");
534 WRITE_TO_BUF(" # IPv6 multicast address to use when\n # using site-local addresses.\n # If not defined, ff05::15 is used\n");
535 WRITE_TO_BUF(" Ip6MulticastSite\t%s\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf)));
536 if(first) WRITE_TO_BUF("\n");
538 WRITE_TO_BUF(" # IPv6 multicast address to use when\n # using global addresses\n # If not defined, ff0e::1 is used\n");
539 WRITE_TO_BUF(" Ip6MulticastGlobal\t%s\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf)));
540 if(first) WRITE_TO_BUF("\n");
544 WRITE_TO_BUF(" # Emission and validity intervals.\n # If not defined, RFC proposed values will\n # in most cases be used.\n\n");
547 if(in->cnf->hello_params.emission_interval != HELLO_INTERVAL)
548 WRITE_TO_BUF(" HelloInterval\t%0.2f\n", in->cnf->hello_params.emission_interval);
550 WRITE_TO_BUF(" #HelloInterval\t%0.2f\n", in->cnf->hello_params.emission_interval);
551 if(in->cnf->hello_params.validity_time != NEIGHB_HOLD_TIME)
552 WRITE_TO_BUF(" HelloValidityTime\t%0.2f\n", in->cnf->hello_params.validity_time);
554 WRITE_TO_BUF(" #HelloValidityTime\t%0.2f\n", in->cnf->hello_params.validity_time);
555 if(in->cnf->tc_params.emission_interval != TC_INTERVAL)
556 WRITE_TO_BUF(" TcInterval\t\t%0.2f\n", in->cnf->tc_params.emission_interval);
558 WRITE_TO_BUF(" #TcInterval\t\t%0.2f\n", in->cnf->tc_params.emission_interval);
559 if(in->cnf->tc_params.validity_time != TOP_HOLD_TIME)
560 WRITE_TO_BUF(" TcValidityTime\t%0.2f\n", in->cnf->tc_params.validity_time);
562 WRITE_TO_BUF(" #TcValidityTime\t%0.2f\n", in->cnf->tc_params.validity_time);
563 if(in->cnf->mid_params.emission_interval != MID_INTERVAL)
564 WRITE_TO_BUF(" MidInterval\t\t%0.2f\n", in->cnf->mid_params.emission_interval);
566 WRITE_TO_BUF(" #MidInterval\t%0.2f\n", in->cnf->mid_params.emission_interval);
567 if(in->cnf->mid_params.validity_time != MID_HOLD_TIME)
568 WRITE_TO_BUF(" MidValidityTime\t%0.2f\n", in->cnf->mid_params.validity_time);
570 WRITE_TO_BUF(" #MidValidityTime\t%0.2f\n", in->cnf->mid_params.validity_time);
571 if(in->cnf->hna_params.emission_interval != HNA_INTERVAL)
572 WRITE_TO_BUF(" HnaInterval\t\t%0.2f\n", in->cnf->hna_params.emission_interval);
574 WRITE_TO_BUF(" #HnaInterval\t%0.2f\n", in->cnf->hna_params.emission_interval);
575 if(in->cnf->hna_params.validity_time != HNA_HOLD_TIME)
576 WRITE_TO_BUF(" HnaValidityTime\t%0.2f\n", in->cnf->hna_params.validity_time);
578 WRITE_TO_BUF(" #HnaValidityTime\t%0.2f\n", in->cnf->hna_params.validity_time);
580 mult = in->cnf->lq_mult;
585 WRITE_TO_BUF(" #LinkQualityMult\tdefault 1.0\n");
591 WRITE_TO_BUF(" LinkQualityMult\t%s %0.2f\n", inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf, sizeof (ipv6_buf)), mult->val);
598 WRITE_TO_BUF(" # When multiple links exist between hosts\n");;
599 WRITE_TO_BUF(" # the weight of interface is used to determine\n");;
600 WRITE_TO_BUF(" # the link to use. Normally the weight is\n");
601 WRITE_TO_BUF(" # automatically calculated by olsrd based\n");;
602 WRITE_TO_BUF(" # on the characteristics of the interface,\n");;
603 WRITE_TO_BUF(" # but here you can specify a fixed value.\n");;
604 WRITE_TO_BUF(" # Olsrd will choose links with the lowest value.\n");
605 WRITE_TO_BUF(" # Note:\n");;
606 WRITE_TO_BUF(" # Interface weight is used only when LinkQualityLevel is 0.\n");;
607 WRITE_TO_BUF(" # For any other value of LinkQualityLevel, the interface ETX\n");;
608 WRITE_TO_BUF(" # value is used instead.\n\n");;
610 if(in->cnf->weight.fixed)
612 WRITE_TO_BUF(" Weight\t %d\n\n", in->cnf->weight.value);
617 WRITE_TO_BUF(" #Weight\t 0\n\n");
621 WRITE_TO_BUF("}\n\n");
629 WRITE_TO_BUF("\n# END AUTOGENERATED CONFIG\n");