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