2 * The olsr.org Optimized Link-State Routing daemon(olsrd)
3 * Copyright (c) 2005, Andreas Tonnesen(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"
44 #include "../common/autobuf.h"
50 #include <sys/types.h>
51 #include <netinet/in.h>
52 #include <arpa/inet.h>
54 int olsrd_write_cnf(struct olsrd_config *cnf, const char *fname) {
58 fd = fopen(fname, "w");
61 fprintf(stderr, "Could not open file %s for writing\n%s\n", fname, strerror(errno));
65 printf("Writing config to file \"%s\".... ", fname);
66 abuf_init(&abuf, 1024);
67 olsrd_write_cnf_autobuf(&abuf, cnf);
68 fwrite(abuf.buf, abuf.len, 1, fd);
78 if_appendf(struct autobuf *autobuf, bool comments, const char *fmt, ...) __attribute__ ((format(printf, 3, 4)));
81 if_appendf(struct autobuf *autobuf, bool comments, const char *fmt, ...)
88 first = va_arg(ap, char*);
90 if (!comments && *first) {
95 rv = abuf_vappendf(autobuf, fmt, ap);
100 static void olsrd_write_if_autobuf(struct autobuf *out, struct if_config_options *cnfi, bool comments) {
101 struct ipaddr_str ipbuf;
102 struct olsr_lq_mult *mult;
104 abuf_puts(out, "{\n");
105 if (comments) abuf_puts(out,
106 " # Interface Mode is used to prevent unnecessary\n"
107 " # packet forwarding on switched ethernet interfaces\n"
108 " # valid Modes are \"mesh\" and \"ether\"\n"
109 " # (default is \"mesh\")\n"
111 if_appendf(out, comments, " %sMode \"%s\"\n",
112 cnfi->mode == DEF_IF_MODE ? "# " : "",
113 OLSR_IF_MODE[cnfi->mode]);
114 if (comments) abuf_puts(out,
116 " # IPv4 broadcast address for outgoing OLSR packets.\n"
117 " # One usefull example would be 255.255.255.255\n"
118 " # The second useful value would be to\n"
119 " # specify the peer adress of an ptp-tunnel.\n"
120 " # another name of this parameter is \"IPv4Multicast\"\n"
121 " # (default is 0.0.0.0, which triggers the usage of the\n"
122 " # interface broadcast IP)\n"
124 if_appendf(out, comments, " %sIp4Broadcast %s\n",
125 cnfi->ipv4_multicast.v4.s_addr == 0 ? "# " : "",
126 inet_ntop(AF_INET, &cnfi->ipv4_multicast, ipbuf.buf, sizeof(ipbuf)));
127 if (comments) abuf_puts(out,
129 " # IPv6 multicast address\n"
130 " # (default is FF02::6D, the manet-router linklocal multicast)\n"
132 if_appendf(out, comments, " %sIPv6Multicast %s\n",
133 memcmp(&cnfi->ipv6_multicast, &ipv6_def_multicast, sizeof(ipv6_def_multicast)) == 0 ? "# " : "",
134 inet_ntop(AF_INET6, &cnfi->ipv6_multicast, ipbuf.buf, sizeof(ipbuf)));
135 if (comments) abuf_puts(out,
137 " # IPv4 src address for outgoing OLSR packages\n"
138 " # (default is 0.0.0.0, which triggers usage of the interface IP)\n"
140 if_appendf(out, comments, " %sIPv4Src %s\n",
141 cnfi->ipv4_src.v4.s_addr == 0 ? "# " : "",
142 inet_ntop(AF_INET, &cnfi->ipv4_src, ipbuf.buf, sizeof(ipbuf)));
143 if (comments) abuf_puts(out,
145 " # IPv6 src prefix. OLSRd will choose one of the interface IPs\n"
146 " # which matches the prefix of this parameter.\n"
147 " # (default is 0::/0, which triggers the usage\n"
148 " # of a not-linklocal interface IP)\n"
150 if_appendf(out, comments, " %sIPv6Src %s\n",
151 cnfi->ipv6_src.prefix_len == 0 ? "# " : "",
152 inet_ntop(AF_INET6, &cnfi->ipv6_src, ipbuf.buf, sizeof(ipbuf)));
153 if (comments) abuf_puts(out,
155 " # Emission intervals in seconds.\n"
156 " # If not defined, Freifunk network defaults are used\n"
157 " # (default is 2.0/20.0 for Hello and 5.0/300.0 for Tc/Mid/Hna)\n"
159 if_appendf(out, comments, " %sHelloInterval %3.1f\n",
160 cnfi->hello_params.emission_interval == HELLO_INTERVAL ? "# " : "",
161 cnfi->hello_params.emission_interval);
162 if_appendf(out, comments, " %sHelloValidityTime %3.1f\n",
163 cnfi->hello_params.validity_time == NEIGHB_HOLD_TIME ? "# " : "",
164 cnfi->hello_params.validity_time);
165 if_appendf(out, comments, " %sTcInterval %3.1f\n",
166 cnfi->tc_params.emission_interval == TC_INTERVAL ? "# " : "",
167 cnfi->tc_params.emission_interval);
168 if_appendf(out, comments, " %sTcValidityTime %3.1f\n",
169 cnfi->tc_params.validity_time == TOP_HOLD_TIME ? "# " : "",
170 cnfi->tc_params.validity_time);
171 if_appendf(out, comments, " %sMidInterval %3.1f\n",
172 cnfi->mid_params.emission_interval == MID_INTERVAL ? "# " : "",
173 cnfi->mid_params.emission_interval);
174 if_appendf(out, comments, " %sMidValidityTime %3.1f\n",
175 cnfi->mid_params.validity_time == MID_HOLD_TIME ? "# " : "",
176 cnfi->mid_params.validity_time);
177 if_appendf(out, comments, " %sHnaInterval %3.1f\n",
178 cnfi->hna_params.emission_interval == HNA_INTERVAL ? "# " : "",
179 cnfi->hna_params.emission_interval);
180 if_appendf(out, comments, " %sHnaValidityTime %3.1f\n",
181 cnfi->hna_params.validity_time == HNA_HOLD_TIME ? "# " : "",
182 cnfi->hna_params.validity_time);
183 if (comments) abuf_puts(out,
185 " # When multiple links exist between hosts\n"
186 " # the weight of interface is used to determine\n"
187 " # the link to use. Normally the weight is\n"
188 " # automatically calculated by olsrd based\n"
189 " # on the characteristics of the interface,\n"
190 " # but here you can specify a fixed value.\n"
191 " # Olsrd will choose links with the lowest value.\n"
193 " # Interface weight is used only when LinkQualityLevel is set to 0.\n"
194 " # For any other value of LinkQualityLevel, the interface ETX\n"
195 " # value is used instead.\n");
196 if_appendf(out, comments, " %sWeight %d\n",
197 !cnfi->weight.fixed ? "# " : "",
199 if (comments) abuf_puts(out,
201 " # If a certain route should be preferred\n"
202 " # or ignored by the mesh, the Link Quality\n"
203 " # value of a node can be multiplied with a factor\n"
204 " # entered here. In the example the route\n"
205 " # using 192.168.0.1 would rather be ignored.\n"
206 " # A multiplier of 0.5 will result in a small\n"
207 " # (bad) LinkQuality value and a high (bad)\n"
210 " # Link quality multiplier is used only when\n"
211 " # LinkQualityLevel is > 0.\n"
213 mult = cnfi->lq_mult;
216 if (comments) abuf_puts(out, " # LinkQualityMult 192.168.0.1 0.5\n");
218 while (mult != NULL) {
219 if_appendf(out, comments, " LinkQualityMult %s %0.2f\n",
220 olsr_ip_to_string(&ipbuf, &mult->addr),
221 (float)(mult->value) / 65536.0);
225 abuf_puts(out, "}\n");
228 void olsrd_write_cnf_autobuf(struct autobuf *out, struct olsrd_config *cnf) {
229 struct ip_prefix_list *hna = cnf->hna_entries;
230 struct olsr_if *interf = cnf->interfaces;
231 struct plugin_entry *plugins = cnf->plugins;
232 struct plugin_param *pl_param;
233 struct ip_prefix_list *ipc_nets = cnf->ipc_nets;
235 struct ipaddr_str ipbuf;
238 abuf_appendf(out, "#\n"
239 "# Configuration file for %s\n"
240 "# automatically generated by olsrd-cnf parser v. %s\n"
243 olsrd_version, PARSER_VERSION);
245 "# OLSR.org routing daemon config file\n"
246 "# This file contains ALL available options and explanations about them\n"
248 "# Lines starting with a # are discarded\n"
251 "#### ATTENTION for IPv6 users ####\n"
252 "# Because of limitations in the parser IPv6 addresses must NOT\n"
253 "# begin with a \":\", so please add a \"0\" as a prefix.\n"
255 "###########################\n"
256 "### Basic configuration ###\n"
257 "###########################\n"
258 "# keep this settings at the beginning of your first configuration file\n"
260 "# Debug level (0-9)\n"
261 "# If set to 0 the daemon runs in the background, unless \"NoFork\" is set to true\n"
264 abuf_appendf(out, "%sDebugLevel %d\n",
265 cnf->debug_level == DEF_DEBUGLVL ? "# " : "",
269 "# IP version to use (4 or 6)\n"
272 abuf_appendf(out, "%sIpVersion %d\n",
273 cnf->ip_version == DEF_IP_VERSION ? "# " : "",
274 cnf->ip_version == AF_INET ? 4 : 6);
277 "#################################\n"
278 "### OLSRd agent configuration ###\n"
279 "#################################\n"
280 "# this parameters control the settings of the routing agent which are not\n"
281 "# related to the OLSR protocol and it's extensions\n"
283 "# Clear the screen each time the internal state changes\n"
284 "# (Default is yes)\n"
286 abuf_appendf(out, "%sClearScreen %s\n",
287 cnf->clear_screen == DEF_CLEAR_SCREEN ? "# " : "",
288 cnf->clear_screen ? "yes" : "no");
291 "# Should olsrd keep on running even if there are\n"
292 "# no interfaces available? This is a good idea\n"
293 "# for a PCMCIA/USB hotswap environment.\n"
294 "# (Default is yes)\n"
296 abuf_appendf(out, "%sAllowNoInt %s\n",
297 cnf->allow_no_interfaces == DEF_ALLOW_NO_INTS ? "# " : "",
298 cnf->allow_no_interfaces ? "yes" : "no");
302 "# The lockfile is used to prevent multiple OLSR instances running at the same\n"
304 "# (Linux/BSD default is \"/var/run/olsrd-ipv(4/6).lock\")\n"
305 "# (Win32 default is \"<configfile>-ipv(4/6).lock\")\n"
307 abuf_appendf(out, "%sLockFile \"%s\"\n",
308 cnf->lock_file == NULL ? "# " : "",
309 cnf->lock_file ? cnf->lock_file : "lockfile");
312 "# Polling rate for OLSR sockets in seconds (float). \n"
313 "# (Default is 0.05)\n"
315 abuf_appendf(out, "%sPollrate %.2f\n",
316 cnf->pollrate == DEF_POLLRATE ? "# " : "",
320 "# Interval to poll network interfaces for configuration changes (in seconds).\n"
321 "# Linux systems can detect interface statechange via netlink sockets.\n"
322 "# (Defaults is 2.5)\n"
324 abuf_appendf(out, "%sNicChgsPollInt %.1f\n",
325 cnf->nic_chgs_pollrate == DEF_NICCHGPOLLRT ? "# " : "",
326 cnf->nic_chgs_pollrate);
329 "# TOS(type of service) value for the IP header of control traffic.\n"
330 "# (Default is 16)\n"
332 abuf_appendf(out, "%sTosValue %u\n",
333 cnf->tos == DEF_TOS ? "# " : "",
337 "# FIBMetric controls the metric value of the host-routes OLSRd sets.\n"
338 "# - \"flat\" means that the metric value is always 2. This is the preferred value\n"
339 "# because it helps the linux kernel routing to clean up older routes\n"
340 "# - \"correct\" use the hopcount as the metric value.\n"
341 "# - \"approx\" use the hopcount as the metric value too, but does only update the\n"
342 "# hopcount if the nexthop changes too\n"
343 "# (Default is \"flat\")\n"
345 abuf_appendf(out, "%sFIBMetric \"%s\"\n",
346 cnf->fib_metric == DEF_FIB_METRIC ? "# " : "",
347 FIB_METRIC_TXT[cnf->fib_metric]);
350 "#######################################\n"
351 "### Linux specific OLSRd extensions ###\n"
352 "#######################################\n"
353 "# these parameters are only working on linux at the moment, but might become\n"
354 "# useful on BSD in the future\n"
356 "# SrcIpRoutes tells OLSRd to set the Src flag of host routes to the originator-ip\n"
357 "# of the node. In addition to this an additional localhost device is created\n"
358 "# to make sure the returning traffic can be received.\n"
359 "# (Default is \"no\")\n"
361 abuf_appendf(out, "%sSrcIpRoutes %s\n",
362 cnf->use_src_ip_routes == DEF_USE_SRCIP_ROUTES ? "# " : "",
363 cnf->use_src_ip_routes ? "yes" : "no");
366 "# Specify the proto tag to be used for routes olsr inserts into kernel\n"
367 "# currently only implemented for linux\n"
368 "# valid values under linux are 1 .. 254\n"
369 "# 1 gets remapped by olsrd to 0 UNSPECIFIED (1 is reserved for ICMP redirects)\n"
370 "# 2 KERNEL routes (not very wise to use)\n"
371 "# 3 BOOT (should in fact not be used by routing daemons)\n"
373 "# 8 .. 15 various routing daemons (gated, zebra, bird, & co)\n"
374 "# (defaults to 0 which gets replaced by an OS-specific default value\n"
375 "# under linux 3 (BOOT) (for backward compatibility)\n"
377 abuf_appendf(out, "%sRtProto %u\n",
378 cnf->rt_proto == DEF_RTPROTO ? "# " : "",
382 "# RtPolicy activates the usage of routing tables and policy rules for OLSRd\n"
383 "# routing. It's used to keep host and default route in different tables and\n"
384 "# to handle more complicated routing setups with SmartGateway\n"
385 "# (Default is \"yes\")\n"
387 abuf_appendf(out, "%sRtPolicy %s\n",
388 cnf->rt_policy == DEF_RTPOLICY ? "# " : "",
389 cnf->rt_policy ? "yes" : "no");
392 "# Specifies the routing Table olsr uses\n"
393 "# RtTable is for host routes, RtTableDefault for the route to the default\n"
394 "# internet gateway (2 in case of IPv6+NIIT) and RtTableTunnel is for\n"
395 "# routes to the ipip tunnels, valid values are 1 to 254\n"
396 "# (default is 254/112/113, the first is the \"main\" table in linux)\n"
398 abuf_appendf(out, "%sRtTable %u\n",
399 cnf->rt_policy ? "# " : "",
401 abuf_appendf(out, "%sRtTableDefault %u\n",
402 cnf->rt_policy ? "# " : "",
403 cnf->rt_table_default);
404 abuf_appendf(out, "%sRtTableTunnel %u\n",
405 cnf->rt_policy ? "# " : "",
406 cnf->rt_table_tunnel);
409 "# Specifies the policy rule priorities for the three routing tables and\n"
410 "# a special rule for smartgateway routing (see README_NIIT_SMARTGW)\n"
411 "# Priorities can only be set if three different routing tables are set.\n"
412 "# 0 means \"set no policy rule\", if set the values must obey to condition\n"
413 "# RtTablePriority < RtTableDefaultOlsrPriority\n"
414 "# < RtTableTunnelPriority < RtTableDefaultPriority\n"
415 "# (default is 32766/32776/32786/32796)\n"
417 abuf_appendf(out, "%sRtTablePriority %u\n",
418 cnf->rt_policy ? "# " : "",
420 abuf_appendf(out, "%sRtTableDefaultOlsrPriority %u\n",
421 cnf->rt_policy ? "# " : "",
422 cnf->rt_table_default_pri);
423 abuf_appendf(out, "%sRtTableTunnelPriority %u\n",
424 cnf->rt_policy ? "# " : "",
425 cnf->rt_table_tunnel_pri);
426 abuf_appendf(out, "%sRtTableDefaultPriority %u\n",
427 cnf->rt_policy ? "# " : "",
428 cnf->rt_table_defaultolsr_pri);
431 "# Activates (in IPv6 mode) the automatic use of NIIT\n"
432 "# (see README_NIIT_SMARTGW)\n"
433 "# (default is \"yes\")\n"
435 abuf_appendf(out, "%sUseNiit %s\n",
436 cnf->use_niit == DEF_USE_NIIT ? "# " : "",
437 cnf->use_niit ? "yes" : "no");
440 "# Activates the smartgateway ipip tunnel feature.\n"
441 "# See README_NIIT_SMARTGW for a description of smartgateways.\n"
442 "# (default is \"yes\")\n"
444 abuf_appendf(out, "%sSmartGateway %s\n",
445 cnf->smart_gw_active == DEF_SMART_GW ? "# " : "",
446 cnf->smart_gw_active ? "yes" : "no");
449 "# Allows the selection of a smartgateway with NAT (only for IPv4)\n"
450 "# (default is \"yes\")\n"
452 abuf_appendf(out, "%sSmartGatewayAllowNAT %s\n",
453 cnf->smart_gw_allow_nat == DEF_GW_ALLOW_NAT ? "# " : "",
454 cnf->smart_gw_allow_nat ? "yes" : "no");
457 "# Defines what kind of Uplink this node will publish as a\n"
458 "# smartgateway. The existence of the uplink is detected by\n"
459 "# a route to 0.0.0.0/0, ::ffff:0:0/96 and/or 2000::/3.\n"
460 "# possible values are \"none\", \"ipv4\", \"ipv6\", \"both\"\n"
461 "# (default is \"both\")\n"
463 abuf_appendf(out, "%sSmartGatewayUplink \"%s\"\n",
464 cnf->smart_gw_type == DEF_GW_TYPE ? "# " : "",
465 GW_UPLINK_TXT[cnf->smart_gw_type]);
468 "# Specifies if the local ipv4 uplink use NAT\n"
469 "# (default is \"yes\")\n"
471 abuf_appendf(out, "%sSmartGatewayUplinkNAT %s\n",
472 cnf->smart_gw_uplink_nat == DEF_GW_UPLINK_NAT ? "# " : "",
473 cnf->smart_gw_uplink_nat ? "yes" : "no");
476 "# Specifies the speed of the uplink in kilobit/s.\n"
477 "# First parameter is upstream, second parameter is downstream\n"
478 "# (default is 128/1024)\n"
480 abuf_appendf(out, "%sSmartGatewaySpeed %d %d\n",
481 cnf->smart_gw_uplink == DEF_UPLINK_SPEED && cnf->smart_gw_downlink == DEF_DOWNLINK_SPEED ? "# " : "",
482 cnf->smart_gw_uplink, cnf->smart_gw_downlink);
485 "# Specifies the EXTERNAL ipv6 prefix of the uplink. A prefix\n"
486 "# length of more than 64 is not allowed.\n"
487 "# (default is 0::/0\n"
489 abuf_appendf(out, "%sSmartGatewayPrefix %s\n",
490 cnf->smart_gw_prefix.prefix_len == 0 ? "# " : "",
491 olsr_ip_prefix_to_string(&cnf->smart_gw_prefix));
494 "##############################\n"
495 "### OLSR protocol settings ###\n"
496 "##############################\n"
498 "# For testing purposes it may be nice to use another port for olsrd\n"
499 "# for using another port than the IANA assigned one \n"
500 "# for a production network, there should be a good reason!!\n"
501 "# valid values are integers >1, please be careful with using reserved\n"
503 "# (default is 698, the IANA assigned olsr-port)\n"
505 abuf_appendf(out, "%sOlsrPort %u\n",
506 cnf->olsrport == DEF_OLSRPORT ? "# " : "",
510 "# Sets the main IP (originator ip) of the router. This IP will NEVER\n"
511 "# change during the uptime of olsrd.\n"
512 "# (default is 0.0.0.0, which triggers usage of the IP of the first interface)\n"
514 abuf_appendf(out, "MainIp %s\n",
515 olsr_ip_to_string(&ipbuf, &cnf->main_addr));
518 "# The fixed willingness to use (0-7)\n"
519 "# If not set willingness will be calculated\n"
520 "# dynamically based on battery/power status\n"
523 abuf_appendf(out, "%sWillingness %u\n",
524 cnf->willingness == DEF_WILLINGNESS ? "# " : "",
528 "# HNA (Host network association) allows the OLSR to announce\n"
529 "# additional IPs or IP subnets to the net that are reachable\n"
530 "# through this node.\n"
531 "# Syntax for HNA4 is \"network-address network-mask\"\n"
532 "# Syntax for HNA6 is \"network-address prefix-length\"\n"
533 "# (default is no HNA)\n");
534 abuf_appendf(out, "Hna%u\n"
536 cnf->ip_version == AF_INET ? 4 : 6);
538 struct ipaddr_str strbuf;
539 abuf_appendf(out, " %s\n", olsr_ip_prefix_to_string(&hna->net));
545 "# Hysteresis for link sensing (only for hopcount metric)\n"
546 "# Hysteresis adds more robustness to the link sensing\n"
547 "# but delays neighbor registration.\n"
548 "# (defaults to yes)\n"
550 abuf_appendf(out, "%sUseHysteresis %s\n",
551 cnf->use_hysteresis == DEF_USE_HYST ? "# " : "",
552 cnf->use_hysteresis ? "yes" : "no");
555 "# Hysteresis parameters (only for hopcount metric)\n"
556 "# Do not alter these unless you know what you are doing!\n"
557 "# Set to auto by default. Allowed values are floating point\n"
558 "# values in the interval 0,1\n"
559 "# THR_LOW must always be lower than THR_HIGH!!\n"
560 "# (default is 0.5/0.8/0.3)\n"
562 abuf_appendf(out, "%sHystScaling %.2f\n",
563 cnf->hysteresis_param.scaling == HYST_SCALING ? "# " : "",
564 cnf->hysteresis_param.scaling);
565 abuf_appendf(out, "%sHystThrHigh %.2f\n",
566 cnf->hysteresis_param.thr_high == HYST_THRESHOLD_HIGH ? "# " : "",
567 cnf->hysteresis_param.thr_high);
568 abuf_appendf(out, "%sHystThrLow %.2f\n",
569 cnf->hysteresis_param.thr_low == HYST_THRESHOLD_LOW ? "# " : "",
570 cnf->hysteresis_param.thr_low);
574 "# Specifies how much neighbor info should be sent in\n"
575 "# TC messages. Because of a design problem in the 0.5.x\n"
576 "# dijkstra implementation this value must be set to 2.\n"
577 "# 2 - send all neighbors\n"
580 abuf_appendf(out, "%sTcRedundancy %d\n",
581 cnf->tc_redundancy == TC_REDUNDANCY ? "# " : "",
585 "# MPR coverage specifies how many MPRs a node should\n"
586 "# try select to reach every 2 hop neighbor. Because of\n"
587 "# a design problem in the 0.5.x dijkstra algorithm this\n"
588 "# value should be set to 7.\n"
591 abuf_appendf(out, "%sMprCoverage %d\n",
592 cnf->mpr_coverage == MPR_COVERAGE ? "# " : "",
596 "################################\n"
597 "### OLSR protocol extensions ###\n"
598 "################################\n"
600 "# Link quality level switch between hopcount and \n"
601 "# cost-based (mostly ETX) routing. Because of\n"
602 "# a design problem in the 0.5.x dijkstra algorithm this\n"
603 "# value should not be set to 1.\n"
604 "# 0 = do not use link quality\n"
605 "# 2 = use link quality for MPR selection and routing\n"
608 abuf_appendf(out, "%sLinkQualityLevel %d\n",
609 cnf->lq_level == DEF_LQ_LEVEL ? "# " : "",
613 "# Link quality algorithm (only for lq level 2)\n"
614 "# (see README_LQ_ALGORITHMS)\n"
615 "# - \"etx_float\", a floating point ETX with exponential aging\n"
616 "# - \"etx_fpm\", same as ext_float, but with integer arithmetic\n"
617 "# - \"etx_ff\" (ETX freifunk), an etx variant which use all OLSR\n"
618 "# traffic (instead of only hellos) for ETX calculation\n"
619 "# - \"etx_ffeth\", an incompatible variant of etx_ff that allows\n"
620 "# ethernet links with ETX 0.1.\n"
621 "# (defaults to \"etx_ff\")\n"
623 abuf_appendf(out, "%sLinkQualityAlgorithm \"%s\"\n",
624 cnf->lq_algorithm == NULL ? "# " : "",
625 cnf->lq_algorithm == NULL ? DEF_LQ_ALGORITHM : cnf->lq_algorithm);
628 "# Link quality aging factor (only for lq level 2)\n"
629 "# Tuning parameter for etx_float and etx_fpm, smaller values\n"
630 "# mean slower changes of ETX value. (allowed values are\n"
631 "# between 0.01 and 1.0)\n"
632 "# (default is 0.05)\n"
634 abuf_appendf(out, "%sLinkQualityAging %.2f\n",
635 cnf->lq_aging == DEF_LQ_AGING ? "# " : "",
639 "# Fisheye mechanism for TCs (0 meansoff, 1 means on)\n"
642 abuf_appendf(out, "%sLinkQualityFishEye %d\n",
643 cnf->lq_fish == DEF_LQ_FISH ? "# " : "",
650 "# (currently this is only in the freifunk firmware)\n"
651 "# If the NAT-Endpoint (the preferred 0/0 HNA emitting node)\n"
652 "# is to be changed, the ETX value of the current 0/0 is \n"
653 "# multiplied with the NatThreshold value before being\n"
654 "# compared to the new one.\n"
655 "# The parameter can be a value between 0.1 and 1.0, but\n"
656 "# should be close to 1.0 if changed.\n"
657 "# WARNING: This parameter should not be used together with\n"
658 "# the etx_ffeth metric !!\n"
659 "# (defaults to 1.0)\n"
661 abuf_appendf(out, "%sNatThreshold %.1f\n",
662 cnf->lq_nat_thresh == DEF_LQ_NAT_THRESH ? "# " : "",
667 "#############################################################\n"
668 "### Configuration of the IPC to the windows GUI interface ###\n"
669 "#############################################################\n"
673 " # Determines how many simultaneously\n"
674 " # IPC connections that will be allowed\n"
675 " # Setting this to 0 disables IPC\n"
677 abuf_appendf(out, " %sMaxConnections %d\n",
678 cnf->ipc_connections == DEF_IPC_CONNECTIONS ? "# " : "",
679 cnf->ipc_connections);
682 " # By default only 127.0.0.1 is allowed\n"
683 " # to connect. Here allowed hosts and networks can\n"
688 if (ipc_nets->net.prefix_len == olsr_cnf->maxplen) {
689 abuf_appendf(out, " Host %s\n", olsr_ip_to_string(&ipbuf, &ipc_nets->net.prefix));
691 abuf_appendf(out, " Net %s\n", olsr_ip_prefix_to_string(&ipc_nets->net));
693 ipc_nets = ipc_nets->next;
698 "#####################################\n"
699 "### Example plugin configurations ###\n"
700 "#####################################\n"
701 "# Olsrd plugins to load\n"
702 "# This must be the absolute path to the file\n"
703 "# or the loader will use the following scheme:\n"
704 "# - Try the paths in the LD_LIBRARY_PATH \n"
705 "# environment variable.\n"
706 "# - The list of libraries cached in /etc/ld.so.cache\n"
707 "# - /lib, followed by /usr/lib\n"
711 abuf_appendf(out, "LoadPlugin \"%s\" {\n", plugins->name);
712 pl_param = plugins->params;
714 abuf_appendf(out, " PlParam \"%s\"\t\"%s\"\n", pl_param->key, pl_param->value);
715 pl_param = pl_param->next;
719 plugins = plugins->next;
723 "#############################################\n"
724 "### OLSRD default interface configuration ###\n"
725 "#############################################\n"
726 "# the default interface section can have the same values as the following\n"
727 "# interface configuration. It will allow you so set common options for all\n"
730 "InterfaceDefaults\n");
731 olsrd_write_if_autobuf(out, cnf->interface_defaults, false);
734 "######################################\n"
735 "### OLSRd Interfaces configuration ###\n"
736 "######################################\n"
737 "# multiple interfaces can be specified for a single configuration block\n"
738 "# multiple configuration blocks can be specified\n"
742 abuf_appendf(out, "Interface \"%s\"\n", interf->name);
743 olsrd_write_if_autobuf(out, interf->cnf, first);
746 interf = interf->next;
751 "# END AUTOGENERATED CONFIG\n");
756 * indent-tabs-mode: nil