e0f5a6a13ae3f37072befb35e971b57fcdc68253
[project/luci.git] / contrib / package / olsrd-luci / patches / 140-olsrd-optimize-size.patch
1 --- a/Makefile.inc
2 +++ b/Makefile.inc
3 @@ -204,6 +204,10 @@
4  $(warning Use CPPFLAGS instead of DEFINES for -D)
5  endif
6  
7 +ifeq ($(SVEN_OLA_UNBLOAT),1)
8 +CPPFLAGS += -DSVEN_OLA_UNBLOAT -DNODEBUG
9 +endif
10 +
11  TAGFILE ?=     src/TAGS
12  
13  help:
14 --- a/lib/bmf/src/NetworkInterfaces.c
15 +++ b/lib/bmf/src/NetworkInterfaces.c
16 @@ -544,7 +544,9 @@
17            OLSR_PRINTF(9, "%s: ----> Not forwarding to %s: no link found\n", PLUGIN_NAME_SHORT,
18                        olsr_ip_to_string(&buf, &walker->neighbor_iface_addr));
19          } else {
20 +#ifndef DEBUG
21            struct interface *bestIntf = if_ifwithaddr(&bestLinkToNeighbor->local_iface_addr);
22 +#endif
23  
24            OLSR_PRINTF(9, "%s: ----> Not forwarding to %s: \"%s\" gives a better link to this neighbor, costing %5.2f\n",
25                        PLUGIN_NAME_SHORT, olsr_ip_to_string(&buf, &walker->neighbor_iface_addr), bestIntf->int_name,
26 --- a/lib/httpinfo/Makefile
27 +++ b/lib/httpinfo/Makefile
28 @@ -47,7 +47,11 @@
29  CPPFLAGS +=    -DADMIN_INTERFACE
30  endif
31  
32 +ifdef SVEN_OLA_UNBLOAT
33 +       CFLAGS += -DSVEN_OLA
34 +else
35  OBJS += $(TOPDIR)/src/cfgparser/cfgfile_gen.o
36 +endif
37  
38  default_target: $(PLUGIN_FULLNAME)
39  ifdef ADMIN_INTERFACE
40 --- a/lib/httpinfo/src/olsrd_httpinfo.c
41 +++ b/lib/httpinfo/src/olsrd_httpinfo.c
42 @@ -67,7 +67,9 @@
43  
44  #include "olsrd_httpinfo.h"
45  #include "admin_interface.h"
46 +#ifndef SVEN_OLA_UNBLOAT
47  #include "gfx.h"
48 +#endif /* SVEN_OLA_UNBLOAT */
49  
50  #ifdef OS
51  #undef OS
52 @@ -181,7 +183,9 @@
53  
54  static int build_about_body(char *, uint32_t);
55  
56 +#ifndef SVEN_OLA_UNBLOAT
57  static int build_cfgfile_body(char *, uint32_t);
58 +#endif /* SVEN_OLA_UNBLOAT */
59  
60  static int check_allowed_ip(const struct allowed_net *const allowed_nets, const union olsr_ip_addr *const addr);
61  
62 @@ -216,10 +220,13 @@
63    {"Admin", "admin", build_admin_body, true},
64  #endif
65    {"About", "about", build_about_body, true},
66 +#ifndef SVEN_OLA_UNBLOAT
67    {"FOO", "cfgfile", build_cfgfile_body, false},
68 +#endif /* SVEN_OLA_UNBLOAT */
69    {NULL, NULL, NULL, false}
70  };
71  
72 +#ifndef SVEN_OLA_UNBLOAT
73  static const struct static_bin_file_entry static_bin_files[] = {
74    {"favicon.ico", favicon_ico, sizeof(favicon_ico)}
75    ,
76 @@ -229,6 +236,7 @@
77    ,
78    {NULL, NULL, 0}
79  };
80 +#endif /* SVEN_OLA_UNBLOAT */
81  
82  static const struct static_txt_file_entry static_txt_files[] = {
83    {"httpinfo.css", httpinfo_css},
84 @@ -407,6 +415,7 @@
85    } else if (!strcmp(req_type, "GET")) {
86      int i = 0;
87  
88 +#ifndef SVEN_OLA_UNBLOAT
89      for (i = 0; static_bin_files[i].filename; i++) {
90        if (FILENREQ_MATCH(filename, static_bin_files[i].filename)) {
91          break;
92 @@ -422,6 +431,7 @@
93      }
94  
95      i = 0;
96 +#endif /* SVEN_OLA_UNBLOAT */
97      while (static_txt_files[i].filename) {
98        if (FILENREQ_MATCH(filename, static_txt_files[i].filename)) {
99          break;
100 @@ -461,16 +471,22 @@
101          snprintf(&body[size], sizeof(body) - size,
102                   "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" "<head>\n"
103                   "<meta http-equiv=\"Content-type\" content=\"text/html; charset=ISO-8859-1\">\n"
104 -                 "<title>olsr.org httpinfo plugin</title>\n" "<link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n"
105 +                 "<title>olsr.org httpinfo plugin</title>\n"
106 +#ifndef SVEN_OLA_UNBLOAT
107 +                 "<link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n"
108                   "<link rel=\"shortcut icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n"
109 +#endif /* SVEN_OLA_UNBLOAT */
110                   "<link rel=\"stylesheet\" type=\"text/css\" href=\"httpinfo.css\">\n" "</head>\n"
111                   "<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
112 +#ifndef SVEN_OLA_UNBLOAT
113                   "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"%d\">\n"
114                   "<tbody><tr bgcolor=\"#ffffff\">\n" "<td align=\"left\" height=\"69\" valign=\"middle\" width=\"80%%\">\n"
115                   "<font color=\"black\" face=\"timesroman\" size=\"6\">&nbsp;&nbsp;&nbsp;<a href=\"http://www.olsr.org/\">olsr.org OLSR daemon</a></font></td>\n"
116                   "<td height=\"69\" valign=\"middle\" width=\"20%%\">\n"
117                   "<a href=\"http://www.olsr.org/\"><img border=\"0\" src=\"/logo.gif\" alt=\"olsrd logo\"></a></td>\n" "</tr>\n"
118 -                 "</tbody>\n" "</table>\n", FRAMEWIDTH);
119 +                 "</tbody>\n" "</table>\n", FRAMEWIDTH
120 +#endif /* SVEN_OLA_UNBLOAT */
121 +        );
122  
123        size += build_tabs(&body[size], sizeof(body) - size, i);
124        size += build_frame(&body[size], sizeof(body) - size, "Current Routes", "routes", FRAMEWIDTH, tab_entries[i].build_body_cb);
125 @@ -854,7 +870,7 @@
126        size += snprintf(&buf[size], bufsize - size, "<tr><td colspan=\"3\">Status: DOWN</td></tr>\n");
127        continue;
128      }
129 -
130 +#ifndef SVEN_OLA_UNBLOAT
131      if (olsr_cnf->ip_version == AF_INET) {
132        struct ipaddr_str addrbuf, maskbuf, bcastbuf;
133        size +=
134 @@ -867,6 +883,7 @@
135          snprintf(&buf[size], bufsize - size, "<tr>\n" "<td>IP: %s</td>\n" "<td>MCAST: %s</td>\n" "<td></td>\n" "</tr>\n",
136                   ip6_to_string(&addrbuf, &rifs->int6_addr.sin6_addr), ip6_to_string(&maskbuf, &rifs->int6_multaddr.sin6_addr));
137      }
138 +#endif /* SVEN_OLA_UNBLOAT */
139      size +=
140        snprintf(&buf[size], bufsize - size, "<tr>\n" "<td>MTU: %d</td>\n" "<td>WLAN: %s</td>\n" "<td>STATUS: UP</td>\n" "</tr>\n",
141                 rifs->int_mtu, rifs->is_wireless ? "Yes" : "No");
142 @@ -1115,6 +1132,7 @@
143                    build_host);
144  }
145  
146 +#ifndef SVEN_OLA_UNBLOAT
147  static int
148  build_cfgfile_body(char *buf, uint32_t bufsize)
149  {
150 @@ -1149,6 +1167,7 @@
151  #endif
152    return size;
153  }
154 +#endif /* SVEN_OLA_UNBLOAT */
155  
156  static int
157  check_allowed_ip(const struct allowed_net *const allowed_nets, const union olsr_ip_addr *const addr)
158 --- a/lib/nameservice/src/nameservice.c
159 +++ b/lib/nameservice/src/nameservice.c
160 @@ -65,6 +65,11 @@
161  #include "mapwrite.h"
162  #include "compat.h"
163  
164 +#ifdef SVEN_OLA_UNBLOAT
165 +#undef OLSR_PRINTF
166 +#define OLSR_PRINTF(...)
167 +#endif /* SVEN_OLA_UNBLOAT */
168 +
169  /* config parameters */
170  static char my_hosts_file[MAX_FILE + 1];
171  static char my_sighup_pid_file[MAX_FILE + 1];
172 @@ -381,6 +386,7 @@
173        name->ip = olsr_cnf->main_addr;
174      }
175    }
176 +
177    for (name = my_forwarders; name != NULL; name = name->next) {
178      if (name->ip.v4.s_addr == 0) {
179        OLSR_PRINTF(2, "NAME PLUGIN: insert main addr for name %s \n", name->name);
180 @@ -901,9 +907,11 @@
181      pos += sizeof(struct name);
182      pos += 1 + ((ntohs(from_packet->len) - 1) | 3);
183    }
184 +#ifdef DEBUG
185    if (i != 0)
186      OLSR_PRINTF(4, "NAME PLUGIN: Lost %d entries in received packet due to length inconsistency (%s)\n", i,
187                  olsr_ip_to_string(&strbuf, originator));
188 +#endif
189  }
190  
191  /**
192 --- a/src/apm.h
193 +++ b/src/apm.h
194 @@ -41,6 +41,7 @@
195  
196  #ifndef _OLSR_APM
197  #define _OLSR_APM
198 +#ifndef SVEN_OLA_UNBLOAT
199  
200  /*
201   * Interface to OS dependent power management information
202 @@ -69,6 +70,7 @@
203  int apm_read(struct olsr_apm_info *);
204  
205  #endif
206 +#endif /* SVEN_OLA_UNBLOAT */
207  
208  /*
209   * Local Variables:
210 --- a/src/cfgparser/cfgfile_gen.c
211 +++ b/src/cfgparser/cfgfile_gen.c
212 @@ -57,7 +57,9 @@
213    struct olsr_if *in = cnf->interfaces;
214    struct plugin_entry *pe = cnf->plugins;
215    struct plugin_param *pp;
216 +#ifndef SVEN_OLA_UNBLOAT
217    struct ip_prefix_list *ie = cnf->ipc_nets;
218 +#endif /* SVEN_OLA_UNBLOAT */
219    struct olsr_lq_mult *mult;
220  
221    char ipv6_buf[100];                  /* buffer for IPv6 inet_htop */
222 @@ -133,6 +135,7 @@
223    else
224      fprintf(fd, "Willingness\t%d\n\n", cnf->willingness);
225  
226 +#ifndef SVEN_OLA_UNBLOAT
227    /* IPC */
228    fprintf(fd, "# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n");
229    fprintf(fd, "IpcConnect {\n");
230 @@ -149,6 +152,7 @@
231    }
232  
233    fprintf(fd, "}\n\n");
234 +#endif /* SVEN_OLA_UNBLOAT */
235  
236    /* Hysteresis */
237    fprintf(fd, "# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n");
238 @@ -367,7 +371,9 @@
239    struct olsr_if *in = cnf->interfaces;
240    struct plugin_entry *pe = cnf->plugins;
241    struct plugin_param *pp;
242 +#ifndef SVEN_OLA_UNBLOAT
243    struct ip_prefix_list *ie = cnf->ipc_nets;
244 +#endif /* SVEN_OLA_UNBLOAT */
245    struct olsr_lq_mult *mult;
246  
247    int size = 0;
248 @@ -434,6 +440,7 @@
249    else
250      WRITE_TO_BUF("Willingness\t%d\n\n", cnf->willingness);
251  
252 +#ifndef SVEN_OLA_UNBLOAT
253    /* IPC */
254    WRITE_TO_BUF("# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n");
255    WRITE_TO_BUF("IpcConnect {\n");
256 @@ -449,6 +456,7 @@
257    }
258  
259    WRITE_TO_BUF("}\n\n");
260 +#endif /* SVEN_OLA_UNBLOAT */
261  
262    /* Hysteresis */
263    WRITE_TO_BUF("# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n");
264 --- a/src/cfgparser/local.mk
265 +++ b/src/cfgparser/local.mk
266 @@ -41,8 +41,13 @@
267  C=$(if $(CFGDIR),$(CFGDIR)/)
268  
269  # add the variables as we may have others already there
270 +ifeq ($(SVEN_OLA_UNBLOAT),1)
271 +SRCS += $(foreach file,olsrd_conf oparse oscan,$(C)$(file).c)
272 +OBJS += $(foreach file,olsrd_conf oparse oscan,$(C)$(file).o)
273 +else
274  SRCS += $(foreach file,olsrd_conf oparse oscan cfgfile_gen,$(C)$(file).c)
275  OBJS += $(foreach file,olsrd_conf oparse oscan cfgfile_gen,$(C)$(file).o)
276 +endif
277  HDRS += $(foreach file,olsrd_conf oparse,$(C)$(file).h)
278  
279  $(C)oscan.c: $(C)oscan.lex $(C)Makefile
280 --- a/src/cfgparser/olsrd_conf.c
281 +++ b/src/cfgparser/olsrd_conf.c
282 @@ -81,11 +81,13 @@
283    }
284  
285    if ((cnf = olsrd_parse_cnf(argv[1])) != NULL) {
286 +#ifndef SVEN_OLA_UNBLOAT
287      if ((argc > 2) && (!strcmp(argv[2], "-print"))) {
288        olsrd_print_cnf(cnf);
289        olsrd_write_cnf(cnf, "./out.conf");
290      } else
291        printf("Use -print to view parsed values\n");
292 +#endif /* SVEN_OLA_UNBLOAT */
293      printf("Configfile parsed OK\n");
294    } else {
295      printf("Failed parsing \"%s\"\n", argv[1]);
296 @@ -152,7 +154,9 @@
297      /* set various stuff */
298      in->configured = false;
299      in->interf = NULL;
300 +#ifndef SVEN_OLA_UNBLOAT
301      in->host_emul = false;
302 +#endif /* SVEN_OLA_UNBLOAT */
303    }
304    return olsr_cnf;
305  }
306 @@ -405,7 +409,9 @@
307  
308    cnf->debug_level = DEF_DEBUGLVL;
309    cnf->no_fork = false;
310 +#ifndef SVEN_OLA_UNBLOAT
311    cnf->host_emul = false;
312 +#endif /* SVEN_OLA_UNBLOAT */
313    cnf->ip_version = AF_INET;
314    cnf->ipsize = sizeof(struct in_addr);
315    cnf->maxplen = 32;
316 @@ -416,7 +422,9 @@
317    cnf->rtproto = DEF_RTPROTO;
318    cnf->rttable_default = 0;
319    cnf->willingness_auto = DEF_WILL_AUTO;
320 +#ifndef SVEN_OLA_UNBLOAT
321    cnf->ipc_connections = DEF_IPC_CONNECTIONS;
322 +#endif /* SVEN_OLA_UNBLOAT */
323    cnf->fib_metric = DEF_FIB_METRIC;
324  
325    cnf->use_hysteresis = DEF_USE_HYST;
326 @@ -495,6 +503,7 @@
327  
328  }
329  
330 +#ifndef SVEN_OLA_UNBLOAT
331  void
332  olsrd_print_cnf(struct olsrd_config *cnf)
333  {
334 @@ -638,6 +647,7 @@
335      }
336    }
337  }
338 +#endif /* SVEN_OLA_UNBLOAT */
339  
340  #if defined WIN32
341  struct ioinfo {
342 --- a/src/cfgparser/oparse.y
343 +++ b/src/cfgparser/oparse.y
344 @@ -178,7 +178,6 @@
345  %token TOK_RTPROTO
346  %token TOK_RTTABLE_DEFAULT
347  %token TOK_WILLINGNESS
348 -%token TOK_IPCCON
349  %token TOK_FIBMETRIC
350  %token TOK_USEHYST
351  %token TOK_HYSTSCALE
352 @@ -203,7 +202,6 @@
353  
354  %token TOK_HOSTLABEL
355  %token TOK_NETLABEL
356 -%token TOK_MAXIPC
357  
358  %token TOK_IP4BROADCAST
359  %token TOK_IFMODE
360 @@ -267,7 +265,6 @@
361  
362  block:      TOK_HNA4 hna4body
363            | TOK_HNA6 hna6body
364 -          | TOK_IPCCON ipcbody
365            | ifblock ifbody
366            | plblock plbody
367  ;
368 @@ -292,18 +289,6 @@
369           | ihna6entry
370  ;
371  
372 -ipcbody:    TOK_OPEN ipcstmts TOK_CLOSE
373 -;
374 -
375 -ipcstmts: | ipcstmts ipcstmt
376 -;
377 -
378 -ipcstmt:  vcomment
379 -          | imaxipc
380 -          | ipchost
381 -          | ipcnet
382 -;
383 -
384  ifblock:   ifstart ifnicks
385  ;
386  
387 @@ -345,77 +330,6 @@
388            | vcomment
389  ;
390  
391 -imaxipc: TOK_MAXIPC TOK_INTEGER
392 -{
393 -  olsr_cnf->ipc_connections = $2->integer;
394 -  free($2);
395 -}
396 -;
397 -
398 -ipchost: TOK_HOSTLABEL TOK_IP4_ADDR
399 -{
400 -  union olsr_ip_addr ipaddr;
401 -  PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string);
402 -  
403 -  if (inet_aton($2->string, &ipaddr.v4) == 0) {
404 -    fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string);
405 -    YYABORT;
406 -  }
407 -
408 -  ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_cnf->maxplen);
409 -
410 -  free($2->string);
411 -  free($2);
412 -}
413 -;
414 -
415 -ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR
416 -{
417 -  union olsr_ip_addr ipaddr, netmask;
418 -
419 -  PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string);
420 -  
421 -  if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) {
422 -    fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string);
423 -    YYABORT;
424 -  }
425 -
426 -  if (inet_pton(AF_INET, $3->string, &netmask.v4) == 0) {
427 -    fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string);
428 -    YYABORT;
429 -  }
430 -
431 -  ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_netmask_to_prefix(&netmask));
432 -
433 -  free($2->string);
434 -  free($2);
435 -  free($3->string);
436 -  free($3);
437 -}
438 -        |       TOK_NETLABEL TOK_IP4_ADDR TOK_SLASH TOK_INTEGER
439 -{
440 -  union olsr_ip_addr ipaddr;
441 -
442 -  PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string);
443 -  
444 -  if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) {
445 -    fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string);
446 -    YYABORT;
447 -  }
448 -
449 -  if ($4->integer > olsr_cnf->maxplen) {
450 -    fprintf(stderr, "ipcnet: Prefix len %u > %d is not allowed!\n", $4->integer, olsr_cnf->maxplen);
451 -    YYABORT;
452 -  }
453 -
454 -  ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, $4->integer);
455 -
456 -  free($2->string);
457 -  free($2);
458 -  free($4);
459 -}
460 -;
461 -
462  iifweight:       TOK_IFWEIGHT TOK_INTEGER
463  {
464    int ifcnt = ifs_in_curr_cfg;
465 --- a/src/cfgparser/oscan.lex
466 +++ b/src/cfgparser/oscan.lex
467 @@ -253,11 +253,6 @@
468      return TOK_NETLABEL;
469  }
470  
471 -"MaxConnections" {
472 -    yylval = NULL;
473 -    return TOK_MAXIPC;
474 -}
475 -
476  "DebugLevel" {
477      yylval = NULL;
478      return TOK_DEBUGLEVEL;
479 @@ -334,11 +329,6 @@
480      return TOK_WILLINGNESS;
481  }
482  
483 -"IpcConnect" {
484 -    yylval = NULL;
485 -    return TOK_IPCCON;
486 -}
487 -
488  "FIBMetric" {
489      yylval = NULL;
490      return TOK_FIBMETRIC;
491 --- a/src/defs.h
492 +++ b/src/defs.h
493 @@ -190,6 +190,8 @@
494   */
495  clock_t olsr_times(void);
496  
497 +#ifndef SVEN_OLA_UNBLOAT
498 +
499  /*
500   *IPC functions
501   *These are moved to a plugin soon
502 @@ -207,6 +209,7 @@
503  int ipc_output(struct olsr *);
504  
505  #endif
506 +#endif /* SVEN_OLA_UNBLOAT */
507  
508  /*
509   * Local Variables:
510 --- a/src/duplicate_set.c
511 +++ b/src/duplicate_set.c
512 @@ -174,6 +174,7 @@
513    return false;                 /* no duplicate */
514  }
515  
516 +#ifndef SVEN_OLA_UNBLOAT
517  void
518  olsr_print_duplicate_table(void)
519  {
520 @@ -192,6 +193,7 @@
521    } OLSR_FOR_ALL_DUP_ENTRIES_END(entry);
522  #endif
523  }
524 +#endif /* SVEN_OLA_UNBLOAT */
525  
526  /*
527   * Local Variables:
528 --- a/src/hna_set.c
529 +++ b/src/hna_set.c
530 @@ -280,6 +280,7 @@
531   *
532   *@return nada
533   */
534 +#ifndef SVEN_OLA_UNBLOAT
535  void
536  olsr_print_hna_set(void)
537  {
538 @@ -321,6 +322,7 @@
539    }
540  #endif
541  }
542 +#endif /* SVEN_OLA_UNBLOAT */
543  
544  /**
545   *Process incoming HNA message.
546 --- a/src/interfaces.c
547 +++ b/src/interfaces.c
548 @@ -93,12 +93,16 @@
549    OLSR_PRINTF(1, "\n ---- Interface configuration ---- \n\n");
550    /* Run trough all interfaces immedeatly */
551    for (tmp_if = olsr_cnf->interfaces; tmp_if != NULL; tmp_if = tmp_if->next) {
552 +#ifndef SVEN_OLA_UNBLOAT
553      if (!tmp_if->host_emul) {
554        if (!olsr_cnf->host_emul) /* XXX: TEMPORARY! */
555 +#endif /* SVEN_OLA_UNBLOAT */
556          chk_if_up(tmp_if, 1);
557 +#ifndef SVEN_OLA_UNBLOAT
558      } else {
559        add_hemu_if(tmp_if);
560      }
561 +#endif /* SVEN_OLA_UNBLOAT */
562    }
563  
564    /* Kick a periodic timer for the network interface update function */
565 @@ -244,7 +248,11 @@
566   *@return nada
567   */
568  struct olsr_if *
569 +#ifdef SVEN_OLA_UNBLOAT
570 +queue_if(const char *name)
571 +#else                                  /* SVEN_OLA_UNBLOAT */
572  queue_if(const char *name, int hemu)
573 +#endif                                 /* SVEN_OLA_UNBLOAT */
574  {
575    struct olsr_if *interf_n = olsr_cnf->interfaces;
576    size_t name_size;
577 @@ -268,7 +276,9 @@
578    interf_n->interf = NULL;
579    interf_n->configured = 0;
580  
581 +#ifndef SVEN_OLA_UNBLOAT
582    interf_n->host_emul = hemu ? true : false;
583 +#endif /* SVEN_OLA_UNBLOAT */
584  
585    strscpy(interf_n->name, name, name_size);
586    interf_n->next = olsr_cnf->interfaces;
587 --- a/src/interfaces.h
588 +++ b/src/interfaces.h
589 @@ -200,7 +200,12 @@
590  
591  struct interface *if_ifwithindex(const int if_index);
592  
593 -struct olsr_if *queue_if(const char *, int);
594 +struct olsr_if *
595 +#ifdef SVEN_OLA_UNBLOAT
596 +  queue_if(const char *);
597 +#else                                  /* SVEN_OLA_UNBLOAT */
598 +  queue_if(const char *, int);
599 +#endif /* SVEN_OLA_UNBLOAT */
600  
601  int add_ifchgf(int (*f) (struct interface *, int));
602  
603 --- a/src/ipc_frontend.c
604 +++ b/src/ipc_frontend.c
605 @@ -46,6 +46,7 @@
606   *
607   */
608  
609 +#ifndef SVEN_OLA_UNBLOAT
610  #include "ipc_frontend.h"
611  #include "link_set.h"
612  #include "olsr.h"
613 @@ -423,6 +424,7 @@
614  
615    return 1;
616  }
617 +#endif /* SVEN_OLA_UNBLOAT */
618  
619  /*
620   * Local Variables:
621 --- a/src/ipc_frontend.h
622 +++ b/src/ipc_frontend.h
623 @@ -48,6 +48,7 @@
624  
625  #ifndef _OLSR_IPC
626  #define _OLSR_IPC
627 +#ifndef SVEN_OLA_UNBLOAT
628  
629  #include <sys/types.h>
630  #include <netinet/in.h>
631 @@ -103,6 +104,7 @@
632  int ipc_route_send_rtentry(const union olsr_ip_addr *, const union olsr_ip_addr *, int, int, const char *);
633  
634  #endif
635 +#endif /* SVEN_OLA_UNBLOAT */
636  
637  /*
638   * Local Variables:
639 --- a/src/ipcalc.c
640 +++ b/src/ipcalc.c
641 @@ -121,6 +121,7 @@
642    return prefix;
643  }
644  
645 +#ifndef SVEN_OLA_UNBLOAT
646  const char *
647  olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix)
648  {
649 @@ -147,6 +148,7 @@
650    }
651    return rv;
652  }
653 +#endif /* SVEN_OLA_UNBLOAT */
654  
655  /* see if the ipaddr is in the net. That is equivalent to the fact that the net part
656   * of both are equal. So we must compare the first <prefixlen> bits.
657 --- a/src/ipcalc.h
658 +++ b/src/ipcalc.h
659 @@ -146,7 +146,9 @@
660    return inet_ntop(olsr_cnf->ip_version, addr, buf->buf, sizeof(buf->buf));
661  }
662  
663 +#ifndef SVEN_OLA_UNBLOAT
664  const char *olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix);
665 +#endif /* SVEN_OLA_UNBLOAT */
666  
667  static INLINE const char *
668  sockaddr4_to_string(struct ipaddr_str *const buf, const struct sockaddr *const addr)
669 --- a/src/link_set.c
670 +++ b/src/link_set.c
671 @@ -762,6 +762,7 @@
672    return ret;
673  }
674  
675 +#ifndef SVEN_OLA_UNBLOAT
676  void
677  olsr_print_link_set(void)
678  {
679 @@ -783,6 +784,7 @@
680    } OLSR_FOR_ALL_LINK_ENTRIES_END(walker);
681  #endif
682  }
683 +#endif /* SVEN_OLA_UNBLOAT */
684  
685  /*
686   * called for every LQ HELLO message.
687 --- a/src/linux/apm.c
688 +++ b/src/linux/apm.c
689 @@ -44,6 +44,7 @@
690   * Acpi-Power Enlightenment epplet
691   */
692  
693 +#ifndef SVEN_OLA_UNBLOAT
694  #include "apm.h"
695  #include "defs.h"
696  #include <stdio.h>
697 @@ -348,6 +349,7 @@
698    /* No battery found */
699    return -1;
700  }
701 +#endif /* SVEN_OLA_UNBLOAT */
702  
703  /*
704   * Local Variables:
705 --- a/src/linux/kernel_routes.c
706 +++ b/src/linux/kernel_routes.c
707 @@ -300,11 +300,13 @@
708      if (rt_ret > 0) rt_ret = 0; /* successful recovery */
709      else rt_ret = -1; /* unrecoverable error */
710    }
711 +#ifndef SVEN_OLA_UNBLOAT
712    //send ipc update on success
713    if ( ( cmd != RTM_NEWRULE ) && ( cmd != RTM_DELRULE ) && (flag = RT_ORIG_REQUEST) && (0 <= rt_ret && olsr_cnf->ipc_connections > 0)) {
714      ipc_route_send_rtentry(&rt->rt_dst.prefix, &nexthop->gateway, metric, RTM_NEWROUTE == cmd,
715                               if_ifwithindex_name(nexthop->iif_index));
716    }
717 +#endif /* SVEN_OLA_UNBLOAT */
718    if (rt_ret == -2) olsr_syslog(OLSR_LOG_ERR,"no rtnetlink response! (no system ressources left?, everything may happen now ...)");
719    return rt_ret;
720  }
721 @@ -342,7 +344,9 @@
722    int rslt;
723  #endif /* LINUX_POLICY_ROUTING */
724  
725 +#ifndef SVEN_OLA_UNBLOAT
726    OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best));
727 +#endif /* SVEN_OLA_UNBLOAT */
728  
729  #if !LINUX_POLICY_ROUTING
730    memset(&kernel_route, 0, sizeof(struct rtentry));
731 @@ -416,7 +420,9 @@
732    struct in6_rtmsg kernel_route;
733    int rslt;
734  
735 +#ifndef SVEN_OLA_UNBLOAT
736    OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best));
737 +#endif /* SVEN_OLA_UNBLOAT */
738  
739    memset(&kernel_route, 0, sizeof(struct in6_rtmsg));
740  
741 @@ -468,7 +474,9 @@
742    int rslt;
743  #endif /* LINUX_POLICY_ROUTING */
744  
745 +#ifndef SVEN_OLA_UNBLOAT
746    OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt));
747 +#endif /* SVEN_OLA_UNBLOAT */
748  
749  #if !LINUX_POLICY_ROUTING
750    memset(&kernel_route, 0, sizeof(struct rtentry));
751 @@ -535,7 +543,9 @@
752    int rslt;
753  #endif /* LINUX_POLICY_ROUTING */
754  
755 +#ifndef SVEN_OLA_UNBLOAT
756    OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt));
757 +#endif /* SVEN_OLA_UNBLOAT */
758  
759  #if !LINUX_POLICY_ROUTING
760    memset(&kernel_route, 0, sizeof(struct in6_rtmsg));
761 --- a/src/linux/net.c
762 +++ b/src/linux/net.c
763 @@ -69,8 +69,10 @@
764  #define SIOCGIWRATE    0x8B21  /* get default bit rate (bps) */
765  
766  /* The original state of the IP forwarding proc entry */
767 +#ifndef SVEN_OLA_UNBLOAT
768  static char orig_fwd_state;
769  static char orig_global_redirect_state;
770 +#endif /* SVEN_OLA_UNBLOAT */
771  
772  /**
773   *Bind a socket to a device
774 @@ -91,6 +93,8 @@
775    return setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, dev_name, strlen(dev_name) + 1);
776  }
777  
778 +#ifndef SVEN_OLA_UNBLOAT
779 +
780  /**
781   *Enable IP forwarding.
782   *Just writing "1" to the /proc/sys/net/ipv4/ip_forward
783 @@ -110,6 +114,9 @@
784    const char *const procfile = version == AF_INET ? "/proc/sys/net/ipv4/ip_forward" : "/proc/sys/net/ipv6/conf/all/forwarding";
785  
786    if ((proc_fwd = fopen(procfile, "r")) == NULL) {
787 +#ifdef SVEN_OLA_UNBLOAT_OLD
788 +    perror(procfile);
789 +#else
790      /* IPv4 */
791      if (version == AF_INET)
792        fprintf(stderr,
793 @@ -122,6 +129,7 @@
794                procfile);
795  
796      sleep(3);
797 +#endif
798      return 0;
799    }
800  
801 @@ -131,9 +139,13 @@
802      OLSR_PRINTF(3, "\nIP forwarding is enabled on this system\n");
803    } else {
804      if ((proc_fwd = fopen(procfile, "w")) == NULL) {
805 +#ifdef SVEN_OLA_UNBLOAT_OLD
806 +      perror(procfile);
807 +#else
808        fprintf(stderr, "Could not open %s for writing!\n", procfile);
809        fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that IP forwarding is enabeled!\n\n");
810        sleep(3);
811 +#endif
812        return 0;
813      } else {
814        syslog(LOG_INFO, "Writing \"1\" to %s\n", procfile);
815 @@ -154,11 +166,15 @@
816      return -1;
817  
818    if ((proc_redirect = fopen(procfile, "r")) == NULL) {
819 +#ifdef SVEN_OLA_UNBLOAT_OLD
820 +    perror(procfile);
821 +#else
822      fprintf(stderr,
823              "WARNING! Could not open the %s file to check/disable ICMP redirects!\nAre you using the procfile filesystem?\nDoes your system support IPv4?\nI will continue(in 3 sec) - but you should mannually ensure that ICMP redirects are disabled!\n\n",
824              procfile);
825  
826      sleep(3);
827 +#endif
828      return -1;
829    }
830    orig_global_redirect_state = fgetc(proc_redirect);
831 @@ -168,9 +184,13 @@
832      return 0;
833  
834    if ((proc_redirect = fopen(procfile, "w")) == NULL) {
835 +#ifdef SVEN_OLA_UNBLOAT_OLD
836 +    perror(procfile);
837 +#else
838      fprintf(stderr, "Could not open %s for writing!\n", procfile);
839      fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that ICMP redirect is disabeled!\n\n");
840      sleep(3);
841 +#endif
842      return 0;
843    }
844    syslog(LOG_INFO, "Writing \"0\" to %s", procfile);
845 @@ -196,19 +216,27 @@
846    snprintf(procfile, sizeof(procfile), REDIRECT_PROC, if_name);
847  
848    if ((proc_redirect = fopen(procfile, "r")) == NULL) {
849 +#ifdef SVEN_OLA_UNBLOAT_OLD
850 +    perror(procfile);
851 +#else
852      fprintf(stderr,
853              "WARNING! Could not open the %s file to check/disable ICMP redirects!\nAre you using the procfile filesystem?\nDoes your system support IPv4?\nI will continue(in 3 sec) - but you should mannually ensure that ICMP redirects are disabled!\n\n",
854              procfile);
855      sleep(3);
856 +#endif
857      return 0;
858    }
859    iface->nic_state.redirect = fgetc(proc_redirect);
860    fclose(proc_redirect);
861  
862    if ((proc_redirect = fopen(procfile, "w")) == NULL) {
863 +#ifdef SVEN_OLA_UNBLOAT_OLD
864 +    perror(procfile);
865 +#else
866      fprintf(stderr, "Could not open %s for writing!\n", procfile);
867      fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that ICMP redirect is disabeled!\n\n");
868      sleep(3);
869 +#endif
870      return 0;
871    }
872    syslog(LOG_INFO, "Writing \"0\" to %s", procfile);
873 @@ -234,20 +262,28 @@
874    sprintf(procfile, SPOOF_PROC, if_name);
875  
876    if ((proc_spoof = fopen(procfile, "r")) == NULL) {
877 +#ifdef SVEN_OLA_UNBLOAT_OLD
878 +    perror(procfile);
879 +#else
880      fprintf(stderr,
881              "WARNING! Could not open the %s file to check/disable the IP spoof filter!\nAre you using the procfile filesystem?\nDoes your system support IPv4?\nI will continue(in 3 sec) - but you should mannually ensure that IP spoof filtering is disabled!\n\n",
882              procfile);
883  
884      sleep(3);
885 +#endif
886      return 0;
887    }
888    iface->nic_state.spoof = fgetc(proc_spoof);
889    fclose(proc_spoof);
890  
891    if ((proc_spoof = fopen(procfile, "w")) == NULL) {
892 +#ifdef SVEN_OLA_UNBLOAT_OLD
893 +    perror(procfile);
894 +#else
895      fprintf(stderr, "Could not open %s for writing!\n", procfile);
896      fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that IP spoof filtering is disabeled!\n\n");
897      sleep(3);
898 +#endif
899      return 0;
900    }
901    syslog(LOG_INFO, "Writing \"0\" to %s", procfile);
902 @@ -272,7 +308,11 @@
903      FILE *proc_fd;
904  
905      if ((proc_fd = fopen(procfile, "w")) == NULL) {
906 +#ifdef SVEN_OLA_UNBLOAT_OLD
907 +      perror(procfile);
908 +#else
909        fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile);
910 +#endif
911      } else {
912        syslog(LOG_INFO, "Resetting %s to %c\n", procfile, orig_fwd_state);
913        fputc(orig_fwd_state, proc_fd);
914 @@ -287,7 +327,11 @@
915        FILE *proc_fd;
916  
917        if ((proc_fd = fopen(procfile, "w")) == NULL) {
918 +#ifdef SVEN_OLA_UNBLOAT_OLD
919 +        perror(procfile);
920 +#else
921          fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile);
922 +#endif
923        } else {
924          syslog(LOG_INFO, "Resetting %s to %c\n", procfile, orig_global_redirect_state);
925          fputc(orig_global_redirect_state, proc_fd);
926 @@ -311,7 +355,11 @@
927      snprintf(procfile, sizeof(procfile), REDIRECT_PROC, ifs->int_name);
928  
929      if ((proc_fd = fopen(procfile, "w")) == NULL)
930 +#ifdef SVEN_OLA_UNBLOAT_OLD
931 +      perror(procfile);
932 +#else
933        fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile);
934 +#endif
935      else {
936        syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.redirect);
937  
938 @@ -324,7 +372,11 @@
939      /* Generate the procfile name */
940      sprintf(procfile, SPOOF_PROC, ifs->int_name);
941      if ((proc_fd = fopen(procfile, "w")) == NULL)
942 +#ifdef SVEN_OLA_UNBLOAT_OLD
943 +      perror(procfile);
944 +#else
945        fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile);
946 +#endif
947      else {
948        syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.spoof);
949  
950 @@ -372,6 +424,8 @@
951    return sock;
952  }
953  
954 +#endif /* SVEN_OLA_UNBLOAT */
955 +
956  /**
957   *Creates a nonblocking broadcast socket.
958   *@param sa sockaddr struct. Used for bind(2).
959 --- a/src/lq_plugin.c
960 +++ b/src/lq_plugin.c
961 @@ -67,12 +67,18 @@
962  init_lq_handler_tree(void)
963  {
964    avl_init(&lq_handler_tree, &avl_strcasecmp);
965 +#ifndef SVEN_OLA_UNBLOAT
966    register_lq_handler(&lq_etx_float_handler, LQ_ALGORITHM_ETX_FLOAT_NAME);
967    register_lq_handler(&lq_etx_fpm_handler, LQ_ALGORITHM_ETX_FPM_NAME);
968 +#endif /* SVEN_OLA_UNBLOAT */
969    register_lq_handler(&lq_etx_ff_handler, LQ_ALGORITHM_ETX_FF_NAME);
970 +#ifndef SVEN_OLA_UNBLOAT
971    if (activate_lq_handler(olsr_cnf->lq_algorithm)) {
972      activate_lq_handler(LQ_ALGORITHM_ETX_FPM_NAME);
973    }
974 +#else /* SVEN_OLA_UNBLOAT */
975 +  activate_lq_handler(LQ_ALGORITHM_ETX_FF_NAME);
976 +#endif /* SVEN_OLA_UNBLOAT */
977  }
978  
979  /*
980 @@ -399,7 +405,11 @@
981   * @return pointer to hello_neighbor
982   */
983  struct hello_neighbor *
984 +#ifndef SVEN_OLA_UNBLOAT
985  olsr_malloc_hello_neighbor(const char *id)
986 +#else                                  /* SVEN_OLA_UNBLOAT */
987 +olsr_malloc_hello_neighbor(const char *id __attribute__ ((unused)))
988 +#endif /* SVEN_OLA_UNBLOAT */
989  {
990    struct hello_neighbor *h;
991  
992 @@ -421,7 +431,11 @@
993   * @return pointer to tc_mpr_addr
994   */
995  struct tc_mpr_addr *
996 +#ifndef SVEN_OLA_UNBLOAT
997  olsr_malloc_tc_mpr_addr(const char *id)
998 +#else                                  /* SVEN_OLA_UNBLOAT */
999 +olsr_malloc_tc_mpr_addr(const char *id __attribute__ ((unused)))
1000 +#endif /* SVEN_OLA_UNBLOAT */
1001  {
1002    struct tc_mpr_addr *t;
1003  
1004 @@ -443,7 +457,11 @@
1005   * @return pointer to lq_hello_neighbor
1006   */
1007  struct lq_hello_neighbor *
1008 +#ifndef SVEN_OLA_UNBLOAT
1009  olsr_malloc_lq_hello_neighbor(const char *id)
1010 +#else                                  /* SVEN_OLA_UNBLOAT */
1011 +olsr_malloc_lq_hello_neighbor(const char *id __attribute__ ((unused)))
1012 +#endif /* SVEN_OLA_UNBLOAT */
1013  {
1014    struct lq_hello_neighbor *h;
1015  
1016 @@ -465,7 +483,11 @@
1017   * @return pointer to link_entry
1018   */
1019  struct link_entry *
1020 +#ifndef SVEN_OLA_UNBLOAT
1021  olsr_malloc_link_entry(const char *id)
1022 +#else                                  /* SVEN_OLA_UNBLOAT */
1023 +olsr_malloc_link_entry(const char *id __attribute__ ((unused)))
1024 +#endif /* SVEN_OLA_UNBLOAT */
1025  {
1026    struct link_entry *h;
1027  
1028 --- a/src/lq_plugin_default_float.c
1029 +++ b/src/lq_plugin_default_float.c
1030 @@ -39,6 +39,7 @@
1031   *
1032   */
1033  
1034 +#ifndef SVEN_OLA_UNBLOAT
1035  #include "tc_set.h"
1036  #include "link_set.h"
1037  #include "olsr_spf.h"
1038 @@ -212,6 +213,7 @@
1039  
1040    return buffer->buf;
1041  }
1042 +#endif /* SVEN_OLA_UNBLOAT */
1043  
1044  /*
1045   * Local Variables:
1046 --- a/src/lq_plugin_default_float.h
1047 +++ b/src/lq_plugin_default_float.h
1048 @@ -39,6 +39,7 @@
1049   *
1050   */
1051  
1052 +#ifndef SVEN_OLA_UNBLOAT
1053  #ifndef LQ_PLUGIN_DEFAULT_H_
1054  #define LQ_PLUGIN_DEFAULT_H_
1055  
1056 @@ -75,6 +76,7 @@
1057  extern struct lq_handler lq_etx_float_handler;
1058  
1059  #endif /*LQ_PLUGIN_DEFAULT_H_ */
1060 +#endif /* SVEN_OLA_UNBLOAT */
1061  
1062  /*
1063   * Local Variables:
1064 --- a/src/lq_plugin_default_fpm.c
1065 +++ b/src/lq_plugin_default_fpm.c
1066 @@ -39,6 +39,7 @@
1067   *
1068   */
1069  
1070 +#ifndef SVEN_OLA_UNBLOAT
1071  #include "tc_set.h"
1072  #include "link_set.h"
1073  #include "lq_plugin.h"
1074 @@ -238,6 +239,7 @@
1075    snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", (float)(cost) / LQ_FPM_LINKCOST_MULTIPLIER);
1076    return buffer->buf;
1077  }
1078 +#endif /* SVEN_OLA_UNBLOAT */
1079  
1080  /*
1081   * Local Variables:
1082 --- a/src/lq_plugin_default_fpm.h
1083 +++ b/src/lq_plugin_default_fpm.h
1084 @@ -39,6 +39,7 @@
1085   *
1086   */
1087  
1088 +#ifndef SVEN_OLA_UNBLOAT
1089  #ifndef LQ_ETX_FPM_
1090  #define LQ_ETX_FPM_
1091  
1092 @@ -79,6 +80,7 @@
1093  extern struct lq_handler lq_etx_fpm_handler;
1094  
1095  #endif /*LQ_ETX_FPM_ */
1096 +#endif /* SVEN_OLA_UNBLOAT */
1097  
1098  /*
1099   * Local Variables:
1100 --- a/src/main.c
1101 +++ b/src/main.c
1102 @@ -312,13 +312,17 @@
1103    /*
1104     * Print configuration
1105     */
1106 +#ifndef SVEN_OLA_UNBLOAT
1107    if (olsr_cnf->debug_level > 1) {
1108      olsrd_print_cnf(olsr_cnf);
1109    }
1110 +#endif /* SVEN_OLA_UNBLOAT */
1111  #ifndef WIN32
1112 +#ifndef SVEN_OLA_UNBLOAT
1113    /* Disable redirects globally */
1114    disable_redirects_global(olsr_cnf->ip_version);
1115  #endif
1116 +#endif /* SVEN_OLA_UNBLOAT */
1117  
1118    /*
1119     * socket for ioctl calls
1120 @@ -354,7 +358,9 @@
1121    /*
1122     *enable ip forwarding on host
1123     */
1124 +#ifndef SVEN_OLA_UNBLOAT
1125    enable_ip_forwarding(olsr_cnf->ip_version);
1126 +#endif /* SVEN_OLA_UNBLOAT */
1127  
1128    /* Initialize parser */
1129    olsr_init_parser();
1130 @@ -372,6 +378,7 @@
1131     *Set up willingness/APM
1132     */
1133    if (olsr_cnf->willingness_auto) {
1134 +#ifndef SVEN_OLA_UNBLOAT
1135      if (apm_init() < 0) {
1136        OLSR_PRINTF(1, "Could not read APM info - setting default willingness(%d)\n", WILL_DEFAULT);
1137  
1138 @@ -382,10 +389,13 @@
1139        olsr_cnf->willingness_auto = 0;
1140        olsr_cnf->willingness = WILL_DEFAULT;
1141      } else {
1142 +#endif /* SVEN_OLA_UNBLOAT */
1143        olsr_cnf->willingness = olsr_calculate_willingness();
1144  
1145        OLSR_PRINTF(1, "Willingness set to %d - next update in %.1f secs\n", olsr_cnf->willingness, olsr_cnf->will_int);
1146 +#ifndef SVEN_OLA_UNBLOAT
1147      }
1148 +#endif /* SVEN_OLA_UNBLOAT */
1149    }
1150  
1151    /* Initialize net */
1152 @@ -415,9 +425,11 @@
1153  
1154    /* Initialize the IPC socket */
1155  
1156 +#ifndef SVEN_OLA_UNBLOAT
1157    if (olsr_cnf->ipc_connections > 0) {
1158      ipc_init();
1159    }
1160 +#endif /* SVEN_OLA_UNBLOAT */
1161    /* Initialisation of different tables to be used. */
1162    olsr_init_tables();
1163  
1164 @@ -549,9 +561,11 @@
1165    OLSR_PRINTF(1, "Closing sockets...\n");
1166  
1167    /* front-end IPC socket */
1168 +#ifndef SVEN_OLA_UNBLOAT
1169    if (olsr_cnf->ipc_connections > 0) {
1170      shutdown_ipc();
1171    }
1172 +#endif /* SVEN_OLA_UNBLOAT */
1173  
1174    /* OLSR sockets */
1175    for (ifn = ifnet; ifn; ifn = ifn->int_next)
1176 @@ -561,7 +575,9 @@
1177    olsr_close_plugins();
1178  
1179    /* Reset network settings */
1180 +#ifndef SVEN_OLA_UNBLOAT
1181    restore_settings(olsr_cnf->ip_version);
1182 +#endif /* SVEN_OLA_UNBLOAT */
1183  
1184    /* ioctl socket */
1185    close(olsr_cnf->ioctl_s);
1186 @@ -601,7 +617,11 @@
1187          "usage: olsrd [-f <configfile>] [ -i interface1 interface2 ... ]\n"
1188          "  [-d <debug_level>] [-ipv6] [-multi <IPv6 multicast address>]\n"
1189          "  [-lql <LQ level>] [-lqw <LQ winsize>] [-lqnt <nat threshold>]\n"
1190 +#ifdef SVEN_OLA_UNBLOAT
1191 +        "  [-bcast <broadcastaddr>] [-delgw] (Note: no -ipc,-dispin,-dispout)\n"
1192 +#else
1193          "  [-bcast <broadcastaddr>] [-ipc] [-dispin] [-dispout] [-delgw]\n"
1194 +#endif /* SVEN_OLA_UNBLOAT */
1195          "  [-hint <hello interval (secs)>] [-tcint <tc interval (secs)>]\n"
1196          "  [-midint <mid interval (secs)>] [-hnaint <hna interval (secs)>]\n"
1197          "  [-T <Polling Rate (secs)>] [-nofork] [-hemu <ip_address>]\n" "  [-lql <LQ level>] [-lqa <LQ aging factor>]\n");
1198 @@ -765,12 +785,20 @@
1199          olsr_exit(__func__, EXIT_FAILURE);
1200        }
1201        printf("Queuing if %s\n", *argv);
1202 +#ifdef SVEN_OLA_UNBLOAT
1203 +      queue_if(*argv);
1204 +#else /* SVEN_OLA_UNBLOAT */
1205        queue_if(*argv, false);
1206 +#endif /* SVEN_OLA_UNBLOAT */
1207  
1208        while ((argc - 1) && (argv[1][0] != '-')) {
1209          NEXT_ARG;
1210          printf("Queuing if %s\n", *argv);
1211 +#ifdef SVEN_OLA_UNBLOAT
1212 +        queue_if(*argv);
1213 +#else /* SVEN_OLA_UNBLOAT */
1214          queue_if(*argv, false);
1215 +#endif /* SVEN_OLA_UNBLOAT */
1216        }
1217  
1218        continue;
1219 @@ -833,7 +861,7 @@
1220        sscanf(*argv, "%f", &cnf->pollrate);
1221        continue;
1222      }
1223 -
1224 +#ifndef SVEN_OLA_UNBLOAT
1225      /*
1226       * Should we display the contents of packages beeing sent?
1227       */
1228 @@ -857,6 +885,7 @@
1229        cnf->ipc_connections = 1;
1230        continue;
1231      }
1232 +#endif /* SVEN_OLA_UNBLOAT */
1233  
1234      /*
1235       * IPv6 multicast addr
1236 @@ -874,7 +903,7 @@
1237  
1238        continue;
1239      }
1240 -
1241 +#ifndef SVEN_OLA_UNBLOAT
1242      /*
1243       * Host emulation
1244       */
1245 @@ -902,6 +931,7 @@
1246  
1247        continue;
1248      }
1249 +#endif /* SVEN_OLA_UNBLOAT */
1250  
1251      /*
1252       * Delete possible default GWs
1253 --- a/src/neighbor_table.c
1254 +++ b/src/neighbor_table.c
1255 @@ -362,6 +362,7 @@
1256   *
1257   *@return nada
1258   */
1259 +#ifndef SVEN_OLA_UNBLOAT
1260  void
1261  olsr_print_neighbor_table(void)
1262  {
1263 @@ -391,6 +392,7 @@
1264    }
1265  #endif
1266  }
1267 +#endif /* SVEN_OLA_UNBLOAT */
1268  
1269  /*
1270   * Local Variables:
1271 --- a/src/net_olsr.c
1272 +++ b/src/net_olsr.c
1273 @@ -44,7 +44,9 @@
1274  #include "log.h"
1275  #include "olsr.h"
1276  #include "net_os.h"
1277 +#ifndef SVEN_OLA_UNBLOAT
1278  #include "print_packet.h"
1279 +#endif /* SVEN_OLA_UNBLOAT */
1280  #include "link_set.h"
1281  #include "lq_packet.h"
1282  
1283 @@ -385,8 +387,10 @@
1284     *if the -dispout option was given
1285     *we print the content of the packets
1286     */
1287 +#ifndef SVEN_OLA_UNBLOAT
1288    if (disp_pack_out)
1289      print_olsr_serialized_packet(stdout, (union olsr_packet *)ifp->netbuf.buff, ifp->netbuf.pending, &ifp->ip_addr);
1290 +#endif /* SVEN_OLA_UNBLOAT */
1291  
1292    if (olsr_cnf->ip_version == AF_INET) {
1293      /* IP version 4 */
1294 @@ -400,12 +404,16 @@
1295      /* IP version 6 */
1296      if (olsr_sendto(ifp->olsr_socket, ifp->netbuf.buff, ifp->netbuf.pending, MSG_DONTROUTE, (struct sockaddr *)sin6, sizeof(*sin6))
1297          < 0) {
1298 +#ifndef SVEN_OLA_UNBLOAT
1299        struct ipaddr_str buf;
1300 +#endif /* SVEN_OLA_UNBLOAT */
1301        perror("sendto(v6)");
1302        olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv6 %m");
1303 +#ifndef SVEN_OLA_UNBLOAT
1304        fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_index);
1305        fprintf(stderr, "To: %s (size: %u)\n", ip6_to_string(&buf, &sin6->sin6_addr), (unsigned int)sizeof(*sin6));
1306        fprintf(stderr, "Outputsize: %d\n", ifp->netbuf.pending);
1307 +#endif /* SVEN_OLA_UNBLOAT */
1308        retval = -1;
1309      }
1310    }
1311 --- a/src/olsr.c
1312 +++ b/src/olsr.c
1313 @@ -149,7 +149,9 @@
1314      return;
1315  
1316    if (olsr_cnf->debug_level > 0 && olsr_cnf->clear_screen && isatty(1)) {
1317 +#ifndef SVEN_OLA_UNBLOAT
1318      clear_console();
1319 +#endif /* SVEN_OLA_UNBLOAT */
1320      printf("       *** %s (%s on %s) ***\n", olsrd_version, build_date, build_host);
1321    }
1322  
1323 @@ -165,7 +167,7 @@
1324    if (changes_neighborhood || changes_topology || changes_hna) {
1325      olsr_calculate_routing_table();
1326    }
1327 -
1328 +#ifndef SVEN_OLA_UNBLOAT
1329    if (olsr_cnf->debug_level > 0) {
1330      if (olsr_cnf->debug_level > 2) {
1331        olsr_print_mid_set();
1332 @@ -184,6 +186,7 @@
1333      olsr_print_tc_table();
1334  #endif
1335    }
1336 +#endif /* SVEN_OLA_UNBLOAT */
1337  
1338    for (tmp_pc_list = pcf_list; tmp_pc_list != NULL; tmp_pc_list = tmp_pc_list->next) {
1339      tmp_pc_list->function(changes_neighborhood, changes_topology, changes_hna);
1340 @@ -420,12 +423,15 @@
1341  uint8_t
1342  olsr_calculate_willingness(void)
1343  {
1344 +#ifndef SVEN_OLA_UNBLOAT
1345    struct olsr_apm_info ainfo;
1346 +#endif /* SVEN_OLA_UNBLOAT */
1347  
1348    /* If fixed willingness */
1349    if (!olsr_cnf->willingness_auto)
1350      return olsr_cnf->willingness;
1351  
1352 +#ifndef SVEN_OLA_UNBLOAT
1353    if (apm_read(&ainfo) < 1)
1354      return WILL_DEFAULT;
1355  
1356 @@ -442,8 +448,12 @@
1357     * 26% > juice will: 1
1358     */
1359    return (ainfo.battery_percentage / 26);
1360 +#else /* SVEN_OLA_UNBLOAT */
1361 +  return WILL_DEFAULT;
1362 +#endif /* SVEN_OLA_UNBLOAT */
1363  }
1364  
1365 +#ifndef SVEN_OLA_UNBLOAT
1366  const char *
1367  olsr_msgtype_to_string(uint8_t msgtype)
1368  {
1369 @@ -513,6 +523,7 @@
1370    snprintf(type, sizeof(type), "UNKNOWN(%d)", status);
1371    return type;
1372  }
1373 +#endif /* SVEN_OLA_UNBLOAT */
1374  
1375  /**
1376   *Termination function to be called whenever a error occures
1377 @@ -541,6 +552,7 @@
1378   *
1379   * @return a void pointer to the memory allocated
1380   */
1381 +#ifndef SVEN_OLA_UNBLOAT
1382  void *
1383  olsr_malloc(size_t size, const char *id)
1384  {
1385 @@ -565,6 +577,7 @@
1386  
1387    return ptr;
1388  }
1389 +#endif /* SVEN_OLA_UNBLOAT */
1390  
1391  /**
1392   *Wrapper for printf that prints to a specific
1393 --- a/src/olsr.h
1394 +++ b/src/olsr.h
1395 @@ -72,15 +72,21 @@
1396  
1397  uint8_t olsr_calculate_willingness(void);
1398  
1399 +#ifndef SVEN_OLA_UNBLOAT
1400  const char *olsr_msgtype_to_string(uint8_t);
1401  
1402  const char *olsr_link_to_string(uint8_t);
1403  
1404  const char *olsr_status_to_string(uint8_t);
1405 +#endif /* SVEN_OLA_UNBLOAT */
1406  
1407  void olsr_exit(const char *, int);
1408  
1409 +#ifdef SVEN_OLA_UNBLOAT
1410 +#define olsr_malloc(size, msg) calloc(1, size)
1411 +#else /* SVEN_OLA_UNBLOAT */
1412  void *olsr_malloc(size_t, const char *);
1413 +#endif /* SVEN_OLA_UNBLOAT */
1414  
1415  int olsr_printf(int, const char *, ...) __attribute__ ((format(printf, 2, 3)));
1416  
1417 --- a/src/olsr_cfg.h
1418 +++ b/src/olsr_cfg.h
1419 @@ -149,8 +149,10 @@
1420    char *name;
1421    char *config;
1422    bool configured;
1423 +#ifndef SVEN_OLA_UNBLOAT
1424    bool host_emul;
1425    union olsr_ip_addr hemu_ip;
1426 +#endif /* SVEN_OLA_UNBLOAT */
1427    struct interface *interf;
1428    struct if_config_options *cnf;
1429    struct olsr_if *next;
1430 @@ -193,7 +195,9 @@
1431    uint16_t olsrport;
1432    int debug_level;
1433    bool no_fork;
1434 +#ifndef SVEN_OLA_UNBLOAT
1435    bool host_emul;
1436 +#endif /* SVEN_OLA_UNBLOAT */
1437    int ip_version;
1438    bool allow_no_interfaces;
1439    uint16_t tos;
1440 @@ -202,13 +206,17 @@
1441    uint8_t rttable_default;
1442    uint8_t willingness;
1443    bool willingness_auto;
1444 +#ifndef SVEN_OLA_UNBLOAT
1445    int ipc_connections;
1446 +#endif /* SVEN_OLA_UNBLOAT */
1447    bool use_hysteresis;
1448    olsr_fib_metric_options fib_metric;
1449    struct hyst_param hysteresis_param;
1450    struct plugin_entry *plugins;
1451    struct ip_prefix_list *hna_entries;
1452 +#ifndef SVEN_OLA_UNBLOAT
1453    struct ip_prefix_list *ipc_nets;
1454 +#endif /* SVEN_OLA_UNBLOAT */
1455    struct olsr_if *interfaces;
1456    float pollrate;
1457    float nic_chgs_pollrate;
1458 @@ -271,7 +279,9 @@
1459  
1460    void olsrd_free_cnf(struct olsrd_config *);
1461  
1462 +#ifndef SVEN_OLA_UNBLOAT
1463    void olsrd_print_cnf(struct olsrd_config *);
1464 +#endif                                 /* SVEN_OLA_UNBLOAT */
1465  
1466    int olsrd_write_cnf(struct olsrd_config *, const char *);
1467  
1468 --- a/src/parser.c
1469 +++ b/src/parser.c
1470 @@ -51,7 +51,9 @@
1471  #include "rebuild_packet.h"
1472  #include "net_os.h"
1473  #include "log.h"
1474 +#ifndef SVEN_OLA_UNBLOAT
1475  #include "print_packet.h"
1476 +#endif /* SVEN_OLA_UNBLOAT */
1477  #include "net_olsr.h"
1478  
1479  #ifdef WIN32
1480 @@ -281,8 +283,10 @@
1481    //printf("Message from %s\n\n", olsr_ip_to_string(&buf, from_addr));
1482  
1483    /* Display packet */
1484 +#ifndef SVEN_OLA_UNBLOAT
1485    if (disp_pack_in)
1486      print_olsr_serialized_packet(stdout, (union olsr_packet *)olsr, size, from_addr);
1487 +#endif /* SVEN_OLA_UNBLOAT */
1488  
1489    if (olsr_cnf->ip_version == AF_INET)
1490      msgsize = ntohs(m->v4.olsr_msgsize);
1491 --- a/src/print_packet.c
1492 +++ b/src/print_packet.c
1493 @@ -39,6 +39,7 @@
1494   *
1495   */
1496  
1497 +#ifndef SVEN_OLA_UNBLOAT
1498  #include "print_packet.h"
1499  #include "ipcalc.h"
1500  #include "mantissa.h"
1501 @@ -339,6 +340,7 @@
1502      remsize -= olsr_cnf->ipsize;
1503    }
1504  }
1505 +#endif /* SVEN_OLA_UNBLOAT */
1506  
1507  /*
1508   * Local Variables:
1509 --- a/src/process_routes.c
1510 +++ b/src/process_routes.c
1511 @@ -159,6 +159,7 @@
1512  static void
1513  olsr_delete_kernel_route(struct rt_entry *rt)
1514  {
1515 +#ifndef SVEN_OLA_UNBLOAT
1516    if (!olsr_cnf->host_emul) {
1517      int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_delroute_function(rt) : olsr_delroute6_function(rt);
1518  
1519 @@ -170,6 +171,12 @@
1520        olsr_syslog(OLSR_LOG_ERR, "Delete route %s: %s", routestr, err_msg);
1521      }
1522    }
1523 +#else /* SVEN_OLA_UNBLOAT */
1524 +  int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_delroute_function(rt) : olsr_delroute6_function(rt);
1525 +  if (0 > error) {
1526 +    olsr_syslog(OLSR_LOG_ERR, "Delete route: %s", strerror(errno));
1527 +  }
1528 +#endif /* SVEN_OLA_UNBLOAT */
1529  }
1530  
1531  /**
1532 @@ -181,6 +188,7 @@
1533  olsr_add_kernel_route(struct rt_entry *rt)
1534  {
1535  
1536 +#ifndef SVEN_OLA_UNBLOAT
1537    if (!olsr_cnf->host_emul) {
1538      int16_t error = (olsr_cnf->ip_version == AF_INET) ? olsr_addroute_function(rt) : olsr_addroute6_function(rt);
1539  
1540 @@ -199,6 +207,14 @@
1541        rt->rt_metric = rt->rt_best->rtp_metric;
1542      }
1543    }
1544 +#else /* SVEN_OLA_UNBLOAT */
1545 +  int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_addroute_function(rt) : olsr_addroute6_function(rt);
1546 +  if (0 > error) {
1547 +    olsr_syslog(OLSR_LOG_ERR, "Add route: %s", strerror(errno));
1548 +  } else {
1549 +    rt->rt_nexthop = rt->rt_best->rtp_nexthop;
1550 +  }
1551 +#endif /* SVEN_OLA_UNBLOAT */
1552  }
1553  
1554  /**
1555 @@ -385,9 +401,11 @@
1556    /* route additions */
1557    olsr_add_kernel_routes(&add_kernel_list);
1558  
1559 -#if DEBUG
1560 +#ifndef SVEN_OLA_UNBLOAT
1561 +#ifdef DEBUG
1562    olsr_print_routing_table(&routingtree);
1563  #endif
1564 +#endif /* SVEN_OLA_UNBLOAT */
1565  }
1566  
1567  /*
1568 --- a/src/rebuild_packet.c
1569 +++ b/src/rebuild_packet.c
1570 @@ -60,7 +60,11 @@
1571  mid_chgestruct(struct mid_message *mmsg, const union olsr_message *m)
1572  {
1573    int i;
1574 +#ifndef SVEN_OLA_UNBLOAT
1575    struct mid_alias *alias, *alias_tmp;
1576 +#else /* SVEN_OLA_UNBLOAT */
1577 +  struct mid_alias *alias;
1578 +#endif /* SVEN_OLA_UNBLOAT */
1579    int no_aliases;
1580  
1581    /* Checking if everything is ok */
1582 @@ -100,6 +104,7 @@
1583        maddr++;
1584      }
1585  
1586 +#ifndef SVEN_OLA_UNBLOAT
1587      if (olsr_cnf->debug_level > 1) {
1588        struct ipaddr_str buf;
1589        OLSR_PRINTF(3, "Alias list for %s: ", olsr_ip_to_string(&buf, &mmsg->mid_origaddr));
1590 @@ -111,6 +116,7 @@
1591        }
1592        OLSR_PRINTF(3, "\n");
1593      }
1594 +#endif /* SVEN_OLA_UNBLOAT */
1595    } else {
1596      /* IPv6 */
1597      const struct midaddr6 *maddr6 = m->v6.message.mid.mid_addr;
1598 @@ -144,6 +150,7 @@
1599        maddr6++;
1600      }
1601  
1602 +#ifndef SVEN_OLA_UNBLOAT
1603      if (olsr_cnf->debug_level > 1) {
1604        struct ipaddr_str buf;
1605        OLSR_PRINTF(3, "Alias list for %s", ip6_to_string(&buf, &mmsg->mid_origaddr.v6));
1606 @@ -156,6 +163,7 @@
1607        }
1608        OLSR_PRINTF(3, "\n");
1609      }
1610 +#endif /* SVEN_OLA_UNBLOAT */
1611    }
1612  
1613  }
1614 --- a/src/routing_table.c
1615 +++ b/src/routing_table.c
1616 @@ -628,6 +628,7 @@
1617  /**
1618   * format a route entry into a buffer
1619   */
1620 +#ifndef SVEN_OLA_UNBLOAT
1621  char *
1622  olsr_rt_to_string(const struct rt_entry *rt)
1623  {
1624 @@ -659,11 +660,13 @@
1625  
1626    return buff;
1627  }
1628 +#endif /* SVEN_OLA_UNBLOAT */
1629  
1630  /**
1631   * Print the routingtree to STDOUT
1632   *
1633   */
1634 +#ifndef SVEN_OLA_UNBLOAT
1635  void
1636  olsr_print_routing_table(struct avl_tree *tree)
1637  {
1638 @@ -697,6 +700,7 @@
1639  #endif
1640    tree = NULL;                  /* squelch compiler warnings */
1641  }
1642 +#endif /* SVEN_OLA_UNBLOAT */
1643  
1644  /*
1645   * Local Variables:
1646 --- a/src/routing_table.h
1647 +++ b/src/routing_table.h
1648 @@ -210,9 +210,11 @@
1649  bool olsr_cmp_rt(const struct rt_entry *, const struct rt_entry *);
1650  uint8_t olsr_fib_metric(const struct rt_metric *);
1651  
1652 +#ifndef SVEN_OLA_UNBLOAT
1653  char *olsr_rt_to_string(const struct rt_entry *);
1654  char *olsr_rtp_to_string(const struct rt_path *);
1655  void olsr_print_routing_table(struct avl_tree *);
1656 +#endif /* SVEN_OLA_UNBLOAT */
1657  
1658  const struct rt_nexthop *olsr_get_nh(const struct rt_entry *);
1659  
1660 --- a/src/tc_set.c
1661 +++ b/src/tc_set.c
1662 @@ -336,6 +336,7 @@
1663  /**
1664   * Format tc_edge contents into a buffer.
1665   */
1666 +#ifndef SVEN_OLA_UNBLOAT
1667  char *
1668  olsr_tc_edge_to_string(struct tc_edge_entry *tc_edge)
1669  {
1670 @@ -350,6 +351,7 @@
1671  
1672    return buf;
1673  }
1674 +#endif /* SVEN_OLA_UNBLOAT */
1675  
1676  /**
1677   * Wrapper for the timer callback.
1678 @@ -693,6 +695,7 @@
1679  /**
1680   * Print the topology table to stdout
1681   */
1682 +#ifndef SVEN_OLA_UNBLOAT
1683  void
1684  olsr_print_tc_table(void)
1685  {
1686 @@ -718,6 +721,7 @@
1687    } OLSR_FOR_ALL_TC_ENTRIES_END(tc);
1688  #endif
1689  }
1690 +#endif /* SVEN_OLA_UNBLOAT */
1691  
1692  /*
1693   * calculate the border IPs of a tc edge set according to the border flags
1694 --- a/src/tc_set.h
1695 +++ b/src/tc_set.h
1696 @@ -157,7 +157,9 @@
1697  
1698  /* tc_edge_entry manipulation */
1699  bool olsr_delete_outdated_tc_edges(struct tc_entry *);
1700 +#ifndef SVEN_OLA_UNBLOAT
1701  char *olsr_tc_edge_to_string(struct tc_edge_entry *);
1702 +#endif /* SVEN_OLA_UNBLOAT */
1703  struct tc_edge_entry *olsr_lookup_tc_edge(struct tc_entry *, union olsr_ip_addr *);
1704  struct tc_edge_entry *olsr_add_tc_edge_entry(struct tc_entry *, union olsr_ip_addr *, uint16_t);
1705  void olsr_delete_tc_entry(struct tc_entry *);
1706 --- a/src/two_hop_neighbor_table.c
1707 +++ b/src/two_hop_neighbor_table.c
1708 @@ -203,6 +203,8 @@
1709    return NULL;
1710  }
1711  
1712 +#ifndef SVEN_OLA_UNBLOAT
1713 +
1714  /**
1715   *Print the two hop neighbor table to STDOUT.
1716   *
1717 @@ -240,6 +242,7 @@
1718    }
1719  #endif
1720  }
1721 +#endif /* SVEN_OLA_UNBLOAT */
1722  
1723  /*
1724   * Local Variables:
1725 --- a/src/unix/ifnet.c
1726 +++ b/src/unix/ifnet.c
1727 @@ -70,6 +70,8 @@
1728  
1729  #define BUFSPACE  (127*1024)    /* max. input buffer size to request */
1730  
1731 +#ifndef SVEN_OLA_UNBLOAT
1732 +
1733  int
1734  set_flag(char *ifname, short flag __attribute__ ((unused)))
1735  {
1736 @@ -100,6 +102,8 @@
1737  
1738  }
1739  
1740 +#endif /* SVEN_OLA_UNBLOAT */
1741 +
1742  void
1743  check_interface_updates(void *foo __attribute__ ((unused)))
1744  {
1745 @@ -110,11 +114,13 @@
1746  #endif
1747  
1748    for (tmp_if = olsr_cnf->interfaces; tmp_if != NULL; tmp_if = tmp_if->next) {
1749 +#ifndef SVEN_OLA_UNBLOAT
1750      if (tmp_if->host_emul)
1751        continue;
1752  
1753      if (olsr_cnf->host_emul)    /* XXX: TEMPORARY! */
1754        continue;
1755 +#endif /* SVEN_OLA_UNBLOAT */
1756  
1757      if (!tmp_if->cnf->autodetect_chg) {
1758  #ifdef DEBUG
1759 @@ -154,8 +160,10 @@
1760    OLSR_PRINTF(3, "Checking if %s is set down or changed\n", iface->name);
1761  #endif
1762  
1763 +#ifndef SVEN_OLA_UNBLOAT
1764    if (iface->host_emul)
1765      return -1;
1766 +#endif /* SVEN_OLA_UNBLOAT */
1767  
1768    ifp = iface->interf;
1769  
1770 @@ -281,7 +289,9 @@
1771    } else
1772      /* IP version 4 */
1773    {
1774 +#ifndef SVEN_OLA_UNBLOAT
1775      struct ipaddr_str buf;
1776 +#endif /* SVEN_OLA_UNBLOAT */
1777      /* Check interface address (IPv4) */
1778      if (ioctl(olsr_cnf->ioctl_s, SIOCGIFADDR, &ifr) < 0) {
1779        OLSR_PRINTF(1, "\tCould not get address of interface - removing it\n");
1780 @@ -294,17 +304,21 @@
1781      if (memcmp
1782          (&((struct sockaddr_in *)&ifp->int_addr)->sin_addr.s_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr,
1783           olsr_cnf->ipsize) != 0) {
1784 +#ifndef SVEN_OLA_UNBLOAT
1785        /* New address */
1786        OLSR_PRINTF(1, "IPv4 address changed for %s\n", ifr.ifr_name);
1787        OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_addr.sin_addr));
1788        OLSR_PRINTF(1, "\tNew:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr));
1789 +#endif /* SVEN_OLA_UNBLOAT */
1790  
1791        ifp->int_addr = *(struct sockaddr_in *)&ifr.ifr_addr;
1792        /* deactivated to prevent change of originator IP */
1793  #if 0
1794        if (memcmp(&olsr_cnf->main_addr, &ifp->ip_addr, olsr_cnf->ipsize) == 0) {
1795          OLSR_PRINTF(1, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr));
1796 +#ifndef SVEN_OLA_UNBLOAT
1797          olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr));
1798 +#endif /* SVEN_OLA_UNBLOAT */
1799          memcpy(&olsr_cnf->main_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, olsr_cnf->ipsize);
1800        }
1801  #endif
1802 @@ -366,7 +380,9 @@
1803  
1804  remove_interface:
1805    OLSR_PRINTF(1, "Removing interface %s\n", iface->name);
1806 +#ifndef SVEN_OLA_UNBLOAT
1807    olsr_syslog(OLSR_LOG_INFO, "Removing interface %s\n", iface->name);
1808 +#endif /* SVEN_OLA_UNBLOAT */
1809  
1810    olsr_delete_link_entry_by_ip(&ifp->ip_addr);
1811  
1812 @@ -398,10 +414,14 @@
1813        memset(&olsr_cnf->main_addr, 0, olsr_cnf->ipsize);
1814        OLSR_PRINTF(1, "No more interfaces...\n");
1815      } else {
1816 +#if !defined(SVEN_OLA_UNBLOAT)
1817        struct ipaddr_str buf;
1818 +#endif /* SVEN_OLA_UNBLOAT */
1819        olsr_cnf->main_addr = ifnet->ip_addr;
1820        OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
1821 +#ifndef SVEN_OLA_UNBLOAT
1822        olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
1823 +#endif /* SVEN_OLA_UNBLOAT */
1824      }
1825    }
1826  #endif
1827 @@ -425,7 +445,9 @@
1828  
1829    if ((ifnet == NULL) && (!olsr_cnf->allow_no_interfaces)) {
1830      OLSR_PRINTF(1, "No more active interfaces - exiting.\n");
1831 +#ifndef SVEN_OLA_UNBLOAT
1832      olsr_syslog(OLSR_LOG_INFO, "No more active interfaces - exiting.\n");
1833 +#endif /* SVEN_OLA_UNBLOAT */
1834      olsr_cnf->exit_value = EXIT_FAILURE;
1835      kill(getpid(), SIGINT);
1836    }
1837 @@ -434,6 +456,8 @@
1838  
1839  }
1840  
1841 +#ifndef SVEN_OLA_UNBLOAT
1842 +
1843  /**
1844   * Initializes the special interface used in
1845   * host-client emulation
1846 @@ -585,6 +609,7 @@
1847  
1848    return 1;
1849  }
1850 +#endif /* SVEN_OLA_UNBLOAT */
1851  
1852  static char basenamestr[32];
1853  static const char *if_basename(const char *name);
1854 @@ -620,8 +645,10 @@
1855    int tos_bits = IPTOS_TOS(olsr_cnf->tos);
1856  #endif
1857  
1858 +#ifndef SVEN_OLA_UNBLOAT
1859    if (iface->host_emul)
1860      return -1;
1861 +#endif /* SVEN_OLA_UNBLOAT */
1862  
1863    memset(&ifr, 0, sizeof(struct ifreq));
1864    memset(&ifs, 0, sizeof(struct interface));
1865 @@ -728,11 +755,13 @@
1866        ifs.int_broadaddr = *(struct sockaddr_in *)&ifr.ifr_broadaddr;
1867      }
1868  
1869 +#ifndef SVEN_OLA_UNBLOAT
1870      /* Deactivate IP spoof filter */
1871      deactivate_spoof(if_basename(ifr.ifr_name), &ifs, olsr_cnf->ip_version);
1872  
1873      /* Disable ICMP redirects */
1874      disable_redirects(if_basename(ifr.ifr_name), &ifs, olsr_cnf->ip_version);
1875 +#endif /* SVEN_OLA_UNBLOAT */
1876  
1877    }
1878  
1879 @@ -762,7 +791,9 @@
1880  
1881    OLSR_PRINTF(1, "\tMTU - IPhdr: %d\n", ifs.int_mtu);
1882  
1883 +#ifndef SVEN_OLA_UNBLOAT
1884    olsr_syslog(OLSR_LOG_INFO, "Adding interface %s\n", iface->name);
1885 +#endif /* SVEN_OLA_UNBLOAT */
1886    OLSR_PRINTF(1, "\tIndex %d\n", ifs.if_index);
1887  
1888    if (olsr_cnf->ip_version == AF_INET) {
1889 @@ -867,10 +898,14 @@
1890     */
1891    memset(&null_addr, 0, olsr_cnf->ipsize);
1892    if (ipequal(&null_addr, &olsr_cnf->main_addr)) {
1893 +#ifndef SVEN_OLA_UNBLOAT
1894      struct ipaddr_str buf;
1895 +#endif
1896      olsr_cnf->main_addr = ifp->ip_addr;
1897 +#ifndef SVEN_OLA_UNBLOAT
1898      OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
1899      olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
1900 +#endif /* SVEN_OLA_UNBLOAT */
1901    }
1902  
1903    /*
1904 --- a/src/unix/misc.c
1905 +++ b/src/unix/misc.c
1906 @@ -44,6 +44,7 @@
1907  #include "misc.h"
1908  #include "olsr_types.h"
1909  
1910 +#ifndef SVEN_OLA_UNBLOAT
1911  void
1912  clear_console(void)
1913  {
1914 @@ -69,6 +70,7 @@
1915  
1916    fflush(stdout);
1917  }
1918 +#endif /* SVEN_OLA_UNBLOAT */
1919  
1920  /*
1921   * Local Variables: