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