2 * The olsr.org Optimized Link-State Routing daemon(olsrd)
3 * Copyright (c) 2004, 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.
51 #include "scheduler.h"
53 #include "generate_msg.h"
54 #include "plugin_loader.h"
55 #include "socket_parser.h"
58 #include "build_msg.h"
61 #include "mpr_selector_set.h"
63 #if LINUX_POLICY_ROUTING
64 #include <linux/types.h>
65 #include <linux/rtnetlink.h>
66 #include "kernel_routes.h"
71 #define close(x) closesocket(x)
72 int __stdcall SignalHandler(unsigned long signo) __attribute__ ((noreturn));
73 void ListInterfaces(void);
74 void DisableIcmpRedirects(void);
75 bool olsr_win32_end_request = false;
76 bool olsr_win32_end_flag = false;
78 static void olsr_shutdown(int) __attribute__ ((noreturn));
81 #define DEF_NIIT_IFNAME "niit4to6"
84 * Local function prototypes
86 void olsr_reconfigure(int) __attribute__ ((noreturn));
88 static void print_usage(void);
90 static int set_default_ifcnfs(struct olsr_if *, struct if_config_options *);
92 static int olsr_process_arguments(int, char *[], struct olsrd_config *,
93 struct if_config_options *);
96 static char **olsr_argv;
100 copyright_string[] __attribute__ ((unused)) =
101 "The olsr.org Optimized Link-State Routing daemon(olsrd) Copyright (c) 2004, Andreas Tonnesen(andreto@olsr.org) All rights reserved.";
103 /* Data for OLSR locking */
105 static int lock_fd = 0;
107 static char lock_file_name[FILENAME_MAX];
110 * Creates a zero-length locking file and use fcntl to
111 * place an exclusive lock over it. The lock will be
112 * automatically erased when the olsrd process ends,
113 * so it will even work well with a SIGKILL.
115 * Additionally the lock can be killed by removing the
118 static void olsr_create_lock_file(void) {
120 HANDLE lck = CreateEvent(NULL, TRUE, FALSE, lock_file_name);
121 if (NULL == lck || ERROR_ALREADY_EXISTS == GetLastError()) {
124 "Error, cannot create OLSR lock '%s'.\n",
129 "Error, cannot aquire OLSR lock '%s'.\n"
130 "Another OLSR instance might be running.\n",
133 olsr_exit("", EXIT_FAILURE);
138 /* create file for lock */
139 lock_fd = open(lock_file_name, O_WRONLY | O_CREAT, S_IRWXU);
143 "Error, cannot create OLSR lock '%s'.\n",
145 olsr_exit("", EXIT_FAILURE);
148 /* create exclusive lock for the whole file */
149 lck.l_type = F_WRLCK;
150 lck.l_whence = SEEK_SET;
155 if (fcntl(lock_fd, F_SETLK, &lck) == -1) {
158 "Error, cannot aquire OLSR lock '%s'.\n"
159 "Another OLSR instance might be running.\n",
161 olsr_exit("", EXIT_FAILURE);
168 static void handle_niit_config(void) {
171 if (olsr_cnf->ip_version == AF_INET || !olsr_cnf->use_niit) {
175 if_index = if_nametoindex(DEF_NIIT_IFNAME);
176 if (if_index > 0 && olsr_check_ifup(DEF_NIIT_IFNAME)) {
177 olsr_cnf->niit_if_index = if_index;
183 * loads a config file
184 * @return <0 if load failed, 0 otherwise
187 olsrmain_load_config(char *file) {
190 if (stat(file, &statbuf) < 0) {
191 fprintf(stderr, "Could not find specified config file %s!\n%s\n\n",
192 file, strerror(errno));
196 if (olsrd_parse_cnf(file) < 0) {
197 fprintf(stderr, "Error while reading config file %s!\n", file);
207 int main(int argc, char *argv[]) {
208 struct if_config_options *default_ifcnf;
209 char conf_file_name[FILENAME_MAX];
210 struct ipaddr_str buf;
211 bool loadedConfig = false;
218 /* paranoia checks */
219 assert(sizeof(uint8_t) == 1);
220 assert(sizeof(uint16_t) == 2);
221 assert(sizeof(uint32_t) == 4);
222 assert(sizeof(int8_t) == 1);
223 assert(sizeof(int16_t) == 2);
224 assert(sizeof(int32_t) == 4);
226 debug_handle = stdout;
230 setbuf(stdout, NULL);
231 setbuf(stderr, NULL);
234 /* Check if user is root */
236 fprintf(stderr, "You must be root(uid = 0) to run olsrd!\nExiting\n\n");
240 DisableIcmpRedirects();
242 if (WSAStartup(0x0202, &WsaData)) {
243 fprintf(stderr, "Could not initialize WinSock.\n");
244 olsr_exit(__func__, EXIT_FAILURE);
249 olsr_openlog("olsrd");
251 printf("\n *** %s ***\n Build date: %s on %s\n http://www.olsr.org\n\n",
252 olsrd_version, build_date, build_host);
254 /* Using PID as random seed */
257 /* Init widely used statics */
258 memset(&all_zero, 0, sizeof(union olsr_ip_addr));
261 * Set configfile name and
262 * check if a configfile name was given as parameter
266 GetWindowsDirectory(conf_file_name, FILENAME_MAX - 11);
268 conf_file_name[0] = 0;
271 len = strlen(conf_file_name);
273 if (len == 0 || conf_file_name[len - 1] != '\\')
274 conf_file_name[len++] = '\\';
276 strscpy(conf_file_name + len, "olsrd.conf", sizeof(conf_file_name) - len);
278 strscpy(conf_file_name, OLSRD_GLOBAL_CONF_FILE, sizeof(conf_file_name));
281 olsr_cnf = olsrd_get_default_cnf();
282 for (i=1; i < argc-1;) {
283 if (strcmp(argv[i], "-f") == 0) {
286 if (olsrmain_load_config(argv[i+1]) < 0) {
291 memmove(&argv[i], &argv[i+2], sizeof(*argv) * (argc-i-1));
301 * set up configuration prior to processing commandline options
303 if (!loadedConfig && olsrmain_load_config(conf_file_name) == 0) {
308 olsrd_free_cnf(olsr_cnf);
309 olsr_cnf = olsrd_get_default_cnf();
312 default_ifcnf = get_default_if_config();
313 if (default_ifcnf == NULL) {
314 fprintf(stderr, "No default ifconfig found!\n");
318 /* Initialize timers */
322 * Process olsrd options.
324 if (olsr_process_arguments(argc, argv, olsr_cnf, default_ifcnf) < 0) {
326 olsr_exit(__func__, EXIT_FAILURE);
330 * Set configuration for command-line specified interfaces
332 set_default_ifcnfs(olsr_cnf->interfaces, default_ifcnf);
334 /* free the default ifcnf */
337 /* Sanity check configuration */
338 if (olsrd_sanity_check_cnf(olsr_cnf) < 0) {
339 fprintf(stderr, "Bad configuration!\n");
340 olsr_exit(__func__, EXIT_FAILURE);
344 * Establish file lock to prevent multiple instances
346 if (olsr_cnf->lock_file) {
347 strscpy(lock_file_name, olsr_cnf->lock_file, sizeof(lock_file_name));
349 strscpy(lock_file_name, conf_file_name, sizeof(lock_file_name));
350 strscat(lock_file_name, ".lock", sizeof(lock_file_name));
354 * Print configuration
356 if (olsr_cnf->debug_level > 1) {
357 olsrd_print_cnf(olsr_cnf);
360 /* Disable redirects globally */
361 disable_redirects_global(olsr_cnf->ip_version);
365 * socket for ioctl calls
367 olsr_cnf->ioctl_s = socket(olsr_cnf->ip_version, SOCK_DGRAM, 0);
368 if (olsr_cnf->ioctl_s < 0) {
370 olsr_syslog(OLSR_LOG_ERR, "ioctl socket: %m");
372 olsr_exit(__func__, 0);
374 #if LINUX_POLICY_ROUTING
375 olsr_cnf->rtnl_s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
376 if (olsr_cnf->rtnl_s < 0) {
377 olsr_syslog(OLSR_LOG_ERR, "rtnetlink socket: %m");
378 olsr_exit(__func__, 0);
380 fcntl(olsr_cnf->rtnl_s, F_SETFL, O_NONBLOCK);
384 * create routing socket
386 #if defined __FreeBSD__ || __FreeBSD_kernel__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
387 olsr_cnf->rts = socket(PF_ROUTE, SOCK_RAW, 0);
388 if (olsr_cnf->rts < 0) {
389 olsr_syslog(OLSR_LOG_ERR, "routing socket: %m");
390 olsr_exit(__func__, 0);
395 /* initialize niit if index */
396 handle_niit_config();
399 /* Init empty TC timer */
400 set_empty_tc_timer(GET_TIMESTAMP(0));
403 *enable ip forwarding on host
405 enable_ip_forwarding(olsr_cnf->ip_version);
407 /* Initialize parser */
410 /* Initialize route-exporter */
411 olsr_init_export_route();
413 /* Initialize message sequencnumber */
416 /* Initialize dynamic willingness calculation */
417 olsr_init_willingness();
420 *Set up willingness/APM
422 if (olsr_cnf->willingness_auto) {
423 if (apm_init() < 0) {
424 OLSR_PRINTF(1, "Could not read APM info - setting default willingness(%d)\n", WILL_DEFAULT);
426 olsr_syslog(OLSR_LOG_ERR,
427 "Could not read APM info - setting default willingness(%d)\n",
430 olsr_cnf->willingness_auto = 0;
431 olsr_cnf->willingness = WILL_DEFAULT;
433 olsr_cnf->willingness = olsr_calculate_willingness();
435 OLSR_PRINTF(1, "Willingness set to %d - next update in %.1f secs\n", olsr_cnf->willingness, olsr_cnf->will_int);
442 /* Initializing networkinterfaces */
444 if (olsr_cnf->allow_no_interfaces) {
447 "No interfaces detected! This might be intentional, but it also might mean that your configuration is fubar.\nI will continue after 5 seconds...\n");
448 olsr_startup_sleep(5);
450 fprintf(stderr, "No interfaces detected!\nBailing out!\n");
451 olsr_exit(__func__, EXIT_FAILURE);
455 olsr_do_startup_sleep();
457 /* Print heartbeat to stdout */
460 if (olsr_cnf->debug_level > 0 && isatty(STDOUT_FILENO)) {
461 olsr_start_timer(STDOUT_PULSE_INT, 0, OLSR_TIMER_PERIODIC,
462 &generate_stdout_pulse, NULL, 0);
466 /* Initialize the IPC socket */
468 if (olsr_cnf->ipc_connections > 0) {
471 /* Initialisation of different tables to be used. */
476 if (olsr_cnf->debug_level == 0 && !olsr_cnf->no_fork) {
477 printf("%s detaching from the current process...\n", olsrd_version);
478 if (daemon(0, 0) < 0) {
479 printf("daemon(3) failed: %s\n", strerror(errno));
486 * Create locking file for olsrd, will be cleared after olsrd exits
488 olsr_create_lock_file();
493 OLSR_PRINTF(1, "Main address: %s\n\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
495 #if LINUX_POLICY_ROUTING
496 /* Create rule for RtTable to resolve route insertion problems*/
497 if ((olsr_cnf->rttable < 253) & (olsr_cnf->rttable > 0)) {
498 olsr_netlink_rule(olsr_cnf->ip_version, olsr_cnf->rttable, RTM_NEWRULE);
501 /* Create rtnetlink socket to listen on interface change events RTMGRP_LINK and RTMGRP_IPV4_ROUTE */
503 #if LINUX_RTNETLINK_LISTEN
504 rtnetlink_register_socket(RTMGRP_LINK);
505 #endif /*LINUX_RTNETLINK_LISTEN*/
509 /* Start syslog entry */
510 olsr_syslog(OLSR_LOG_INFO, "%s successfully started", olsrd_version);
516 /* ctrl-C and friends */
519 SetConsoleCtrlHandler(SignalHandler, true);
522 signal(SIGHUP, olsr_reconfigure);
523 signal(SIGINT, olsr_shutdown);
524 signal(SIGQUIT, olsr_shutdown);
525 signal(SIGILL, olsr_shutdown);
526 signal(SIGABRT, olsr_shutdown);
527 // signal(SIGSEGV, olsr_shutdown);
528 signal(SIGTERM, olsr_shutdown);
529 signal(SIGPIPE, SIG_IGN);
532 link_changes = false;
534 /* Starting scheduler */
537 /* Like we're ever going to reach this ;-) */
542 * Reconfigure olsrd. Currently kind of a hack...
544 *@param signal the signal that triggered this callback
547 void olsr_reconfigure(int signo __attribute__ ((unused))) {
548 /* if we are started with -nofork, we do not weant to go into the
549 * background here. So we can simply stop on -HUP
551 olsr_syslog(OLSR_LOG_INFO, "sot: olsr_reconfigure()\n");
552 if (!olsr_cnf->no_fork) {
559 sigaddset(&sigs, SIGHUP);
560 sigprocmask(SIG_UNBLOCK, &sigs, NULL);
561 for (i = sysconf(_SC_OPEN_MAX); --i > STDERR_FILENO;) {
564 printf("Restarting %s\n", olsr_argv[0]);
565 olsr_syslog(OLSR_LOG_INFO, "Restarting %s\n", olsr_argv[0]);
566 execv(olsr_argv[0], olsr_argv);
567 olsr_syslog(OLSR_LOG_ERR, "execv(%s) fails: %s!\n", olsr_argv[0],
570 olsr_syslog(OLSR_LOG_INFO, "RECONFIGURING!\n");
577 static void olsr_shutdown_messages(void) {
578 struct interface *ifn;
581 for (ifn = ifnet; ifn; ifn = ifn->int_next) {
582 /* clean output buffer */
585 /* send 'I'm gone' messages */
586 if (olsr_cnf->lq_level > 0) {
587 olsr_output_lq_tc(ifn);
588 olsr_output_lq_hello(ifn);
599 *Function called at shutdown. Signal handler
601 * @param signal the signal that triggered this call
605 SignalHandler(unsigned long signo)
607 static void olsr_shutdown(int signo __attribute__ ((unused)))
610 struct interface *ifn;
613 OLSR_PRINTF(1, "Received signal %d - shutting down\n", (int)signo);
616 OLSR_PRINTF(1, "Waiting for the scheduler to stop.\n");
618 olsr_win32_end_request = TRUE;
620 while (!olsr_win32_end_flag)
623 OLSR_PRINTF(1, "Scheduler stopped.\n");
626 /* clear all links and send empty hellos/tcs */
627 olsr_reset_all_links();
629 /* deactivate fisheye and immediate TCs */
630 olsr_cnf->lq_fish = 0;
631 for (ifn = ifnet; ifn; ifn = ifn->int_next) {
632 ifn->immediate_send_tc = false;
634 increase_local_ansn();
636 /* send first shutdown message burst */
637 olsr_shutdown_messages();
639 /* delete all routes */
640 olsr_delete_all_kernel_routes();
642 /* send second shutdown message burst */
643 olsr_shutdown_messages();
645 /* now try to cleanup the rest of the mess */
646 olsr_delete_all_tc_entries();
648 olsr_delete_all_mid_entries();
650 olsr_destroy_parser();
652 OLSR_PRINTF(1, "Closing sockets...\n");
654 /* front-end IPC socket */
655 if (olsr_cnf->ipc_connections > 0) {
660 for (ifn = ifnet; ifn; ifn = ifn->int_next) {
661 close(ifn->olsr_socket);
662 close(ifn->send_socket);
665 /* Closing plug-ins */
666 olsr_close_plugins();
668 /* Reset network settings */
669 restore_settings(olsr_cnf->ip_version);
672 close(olsr_cnf->ioctl_s);
674 #if LINUX_POLICY_ROUTING
675 /* RtTable (linux only!!) */
676 if ((olsr_cnf->rttable < 253) & (olsr_cnf->rttable > 0)) {
677 olsr_netlink_rule(olsr_cnf->ip_version, olsr_cnf->rttable, RTM_DELRULE);
680 close(olsr_cnf->rtnl_s);
683 #if defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
685 close(olsr_cnf->rts);
688 /* Free cookies and memory pools attached. */
689 OLSR_PRINTF(0, "Free all memory...\n");
690 olsr_delete_all_cookies();
692 olsr_syslog(OLSR_LOG_INFO, "%s stopped", olsrd_version);
694 OLSR_PRINTF(1, "\n <<<< %s - terminating >>>>\n http://www.olsr.org\n", olsrd_version);
696 exit_value = olsr_cnf->exit_value;
697 olsrd_free_cnf(olsr_cnf);
703 * Print the command line usage
705 static void print_usage(void) {
709 "An error occured somwhere between your keyboard and your chair!\n"
710 "usage: olsrd [-f <configfile>] [ -i interface1 interface2 ... ]\n"
711 " [-d <debug_level>] [-ipv6] [-multi <IPv6 multicast address>]\n"
712 " [-lql <LQ level>] [-lqw <LQ winsize>] [-lqnt <nat threshold>]\n"
713 " [-bcast <broadcastaddr>] [-ipc] [-dispin] [-dispout] [-delgw]\n"
714 " [-hint <hello interval (secs)>] [-tcint <tc interval (secs)>]\n"
715 " [-midint <mid interval (secs)>] [-hnaint <hna interval (secs)>]\n"
716 " [-T <Polling Rate (secs)>] [-nofork] [-hemu <ip_address>]\n" " [-lql <LQ level>] [-lqa <LQ aging factor>]\n");
720 * Sets the provided configuration on all unconfigured
723 * @param ifs a linked list of interfaces to check and possible update
724 * @param cnf the default configuration to set on unconfigured interfaces
726 int set_default_ifcnfs(struct olsr_if *ifs, struct if_config_options *cnf) {
730 if (ifs->cnf == NULL) {
731 ifs->cnf = olsr_malloc(sizeof(struct if_config_options),
732 "Set default config");
741 #define NEXT_ARG do { argv++;argc--; } while (0)
742 #define CHECK_ARGC do { if(!argc) { \
743 if((argc - 1) == 1){ \
744 fprintf(stderr, "Error parsing command line options!\n"); \
747 fprintf(stderr, "You must provide a parameter when using the %s switch!\n", *argv); \
749 olsr_exit(__func__, EXIT_FAILURE); \
753 * Process command line arguments passed to olsrd
756 static int olsr_process_arguments(int argc, char *argv[],
757 struct olsrd_config *cnf, struct if_config_options *ifcnf) {
764 if (strcmp(*argv, "-int") == 0) {
773 if (strcmp(*argv, "-f") == 0) {
774 fprintf(stderr, "Configfilename must ALWAYS be first argument!\n\n");
775 olsr_exit(__func__, EXIT_FAILURE);
781 if (strcmp(*argv, "-ipv6") == 0) {
782 cnf->ip_version = AF_INET6;
789 if (strcmp(*argv, "-bcast") == 0) {
794 if (inet_aton(*argv, &in) == 0) {
795 printf("Invalid broadcast address! %s\nSkipping it!\n", *argv);
798 memcpy(&ifcnf->ipv4_multicast.v4, &in.s_addr, sizeof(ifcnf->ipv4_multicast.v4));
805 if (strcmp(*argv, "-lql") == 0) {
810 /* Sanity checking is done later */
811 sscanf(*argv, "%d", &tmp_lq_level);
812 olsr_cnf->lq_level = tmp_lq_level;
819 if (strcmp(*argv, "-lqa") == 0) {
824 sscanf(*argv, "%f", &tmp_lq_aging);
826 if (tmp_lq_aging < MIN_LQ_AGING || tmp_lq_aging > MAX_LQ_AGING) {
827 printf("LQ aging factor %f not allowed. Range [%f-%f]\n", tmp_lq_aging,
828 MIN_LQ_AGING, MAX_LQ_AGING);
829 olsr_exit(__func__, EXIT_FAILURE);
831 olsr_cnf->lq_aging = tmp_lq_aging;
838 if (strcmp(*argv, "-lqnt") == 0) {
839 float tmp_lq_nat_thresh;
843 sscanf(*argv, "%f", &tmp_lq_nat_thresh);
845 if (tmp_lq_nat_thresh < 0.1 || tmp_lq_nat_thresh > 1.0) {
846 printf("NAT threshold %f not allowed. Range [%f-%f]\n",
847 tmp_lq_nat_thresh, 0.1, 1.0);
848 olsr_exit(__func__, EXIT_FAILURE);
850 olsr_cnf->lq_nat_thresh = tmp_lq_nat_thresh;
855 * Enable additional debugging information to be logged.
857 if (strcmp(*argv, "-d") == 0) {
861 sscanf(*argv, "%d", &cnf->debug_level);
866 * Interfaces to be used by olsrd.
868 if (strcmp(*argv, "-i") == 0) {
872 if (*argv[0] == '-') {
873 fprintf(stderr, "You must provide an interface label!\n");
874 olsr_exit(__func__, EXIT_FAILURE);
876 printf("Queuing if %s\n", *argv);
877 queue_if(*argv, false);
879 while ((argc - 1) && (argv[1][0] != '-')) {
881 printf("Queuing if %s\n", *argv);
882 queue_if(*argv, false);
888 * Set the hello interval to be used by olsrd.
891 if (strcmp(*argv, "-hint") == 0) {
894 sscanf(*argv, "%f", &ifcnf->hello_params.emission_interval);
895 ifcnf->hello_params.validity_time = ifcnf->hello_params.emission_interval
901 * Set the HNA interval to be used by olsrd.
904 if (strcmp(*argv, "-hnaint") == 0) {
907 sscanf(*argv, "%f", &ifcnf->hna_params.emission_interval);
908 ifcnf->hna_params.validity_time = ifcnf->hna_params.emission_interval * 3;
913 * Set the MID interval to be used by olsrd.
916 if (strcmp(*argv, "-midint") == 0) {
919 sscanf(*argv, "%f", &ifcnf->mid_params.emission_interval);
920 ifcnf->mid_params.validity_time = ifcnf->mid_params.emission_interval * 3;
925 * Set the tc interval to be used by olsrd.
928 if (strcmp(*argv, "-tcint") == 0) {
931 sscanf(*argv, "%f", &ifcnf->tc_params.emission_interval);
932 ifcnf->tc_params.validity_time = ifcnf->tc_params.emission_interval * 3;
937 * Set the polling interval to be used by olsrd.
939 if (strcmp(*argv, "-T") == 0) {
942 sscanf(*argv, "%f", &cnf->pollrate);
947 * Should we display the contents of packages beeing sent?
949 if (strcmp(*argv, "-dispin") == 0) {
950 parser_set_disp_pack_in(true);
955 * Should we display the contents of incoming packages?
957 if (strcmp(*argv, "-dispout") == 0) {
958 net_set_disp_pack_out(true);
963 * Should we set up and send on a IPC socket for the front-end?
965 if (strcmp(*argv, "-ipc") == 0) {
966 cnf->ipc_connections = 1;
971 * IPv6 multicast addr
973 if (strcmp(*argv, "-multi") == 0) {
977 if (inet_pton(AF_INET6, *argv, &in6) <= 0) {
978 fprintf(stderr, "Failed converting IP address %s\n", *argv);
982 memcpy(&ifcnf->ipv6_multicast, &in6, sizeof(struct in6_addr));
990 if (strcmp(*argv, "-hemu") == 0) {
996 if (inet_pton(AF_INET, *argv, &in) <= 0) {
997 fprintf(stderr, "Failed converting IP address %s\n", *argv);
1000 /* Add hemu interface */
1002 ifa = queue_if("hcif01", true);
1007 ifa->cnf = get_default_if_config();
1008 ifa->host_emul = true;
1009 memcpy(&ifa->hemu_ip, &in, sizeof(union olsr_ip_addr));
1010 cnf->host_emul = true;
1016 * Delete possible default GWs
1018 if (strcmp(*argv, "-delgw") == 0) {
1019 olsr_cnf->del_gws = true;
1023 if (strcmp(*argv, "-nofork") == 0) {
1024 cnf->no_fork = true;
1036 * indent-tabs-mode: nil