root/luci/branches/luci-0.8/contrib/package/olsrd-luci/patches/140-olsrd-optimize-size.patch
@
4379
| Revision 4379, 68.6 KB (checked in by jow, 4 years ago) |
|---|
-
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/Makefile.inc olsrd-0.5.6-r4/Makefile.inc
old new 204 204 $(warning Use CPPFLAGS instead of DEFINES for -D) 205 205 endif 206 206 207 ifeq ($(SVEN_OLA_UNBLOAT),1) 208 CPPFLAGS += -DSVEN_OLA_UNBLOAT -DNODEBUG 209 endif 210 207 211 TAGFILE ?= src/TAGS 208 212 209 213 help: -
lib/bmf/src/NetworkInterfaces.c
diff -ur olsrd-0.5.6-r4.orig/lib/bmf/src/NetworkInterfaces.c olsrd-0.5.6-r4/lib/bmf/src/NetworkInterfaces.c
old new 544 544 OLSR_PRINTF(9, "%s: ----> Not forwarding to %s: no link found\n", PLUGIN_NAME_SHORT, 545 545 olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); 546 546 } else { 547 #ifndef DEBUG 547 548 struct interface *bestIntf = if_ifwithaddr(&bestLinkToNeighbor->local_iface_addr); 549 #endif 548 550 549 551 OLSR_PRINTF(9, "%s: ----> Not forwarding to %s: \"%s\" gives a better link to this neighbor, costing %5.2f\n", 550 552 PLUGIN_NAME_SHORT, olsr_ip_to_string(&buf, &walker->neighbor_iface_addr), bestIntf->int_name, -
lib/httpinfo/Makefile
diff -ur olsrd-0.5.6-r4.orig/lib/httpinfo/Makefile olsrd-0.5.6-r4/lib/httpinfo/Makefile
old new 47 47 CPPFLAGS += -DADMIN_INTERFACE 48 48 endif 49 49 50 ifdef SVEN_OLA_UNBLOAT 51 CFLAGS += -DSVEN_OLA 52 else 50 53 OBJS += $(TOPDIR)/src/cfgparser/cfgfile_gen.o 54 endif 51 55 52 56 default_target: $(PLUGIN_FULLNAME) 53 57 ifdef ADMIN_INTERFACE -
lib/httpinfo/src/olsrd_httpinfo.c
diff -ur olsrd-0.5.6-r4.orig/lib/httpinfo/src/olsrd_httpinfo.c olsrd-0.5.6-r4/lib/httpinfo/src/olsrd_httpinfo.c
old new 67 67 68 68 #include "olsrd_httpinfo.h" 69 69 #include "admin_interface.h" 70 #ifndef SVEN_OLA_UNBLOAT 70 71 #include "gfx.h" 72 #endif /* SVEN_OLA_UNBLOAT */ 71 73 72 74 #ifdef OS 73 75 #undef OS … … 181 183 182 184 static int build_about_body(char *, uint32_t); 183 185 186 #ifndef SVEN_OLA_UNBLOAT 184 187 static int build_cfgfile_body(char *, uint32_t); 188 #endif /* SVEN_OLA_UNBLOAT */ 185 189 186 190 static int check_allowed_ip(const struct allowed_net *const allowed_nets, const union olsr_ip_addr *const addr); 187 191 … … 216 220 {"Admin", "admin", build_admin_body, true}, 217 221 #endif 218 222 {"About", "about", build_about_body, true}, 223 #ifndef SVEN_OLA_UNBLOAT 219 224 {"FOO", "cfgfile", build_cfgfile_body, false}, 225 #endif /* SVEN_OLA_UNBLOAT */ 220 226 {NULL, NULL, NULL, false} 221 227 }; 222 228 229 #ifndef SVEN_OLA_UNBLOAT 223 230 static const struct static_bin_file_entry static_bin_files[] = { 224 231 {"favicon.ico", favicon_ico, sizeof(favicon_ico)} 225 232 , … … 229 236 , 230 237 {NULL, NULL, 0} 231 238 }; 239 #endif /* SVEN_OLA_UNBLOAT */ 232 240 233 241 static const struct static_txt_file_entry static_txt_files[] = { 234 242 {"httpinfo.css", httpinfo_css}, … … 407 415 } else if (!strcmp(req_type, "GET")) { 408 416 int i = 0; 409 417 418 #ifndef SVEN_OLA_UNBLOAT 410 419 for (i = 0; static_bin_files[i].filename; i++) { 411 420 if (FILENREQ_MATCH(filename, static_bin_files[i].filename)) { 412 421 break; … … 422 431 } 423 432 424 433 i = 0; 434 #endif /* SVEN_OLA_UNBLOAT */ 425 435 while (static_txt_files[i].filename) { 426 436 if (FILENREQ_MATCH(filename, static_txt_files[i].filename)) { 427 437 break; … … 461 471 snprintf(&body[size], sizeof(body) - size, 462 472 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" "<head>\n" 463 473 "<meta http-equiv=\"Content-type\" content=\"text/html; charset=ISO-8859-1\">\n" 464 "<title>olsr.org httpinfo plugin</title>\n" "<link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n" 474 "<title>olsr.org httpinfo plugin</title>\n" 475 #ifndef SVEN_OLA_UNBLOAT 476 "<link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n" 465 477 "<link rel=\"shortcut icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n" 478 #endif /* SVEN_OLA_UNBLOAT */ 466 479 "<link rel=\"stylesheet\" type=\"text/css\" href=\"httpinfo.css\">\n" "</head>\n" 467 480 "<body bgcolor=\"#ffffff\" text=\"#000000\">\n" 481 #ifndef SVEN_OLA_UNBLOAT 468 482 "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"%d\">\n" 469 483 "<tbody><tr bgcolor=\"#ffffff\">\n" "<td align=\"left\" height=\"69\" valign=\"middle\" width=\"80%%\">\n" 470 484 "<font color=\"black\" face=\"timesroman\" size=\"6\"> <a href=\"http://www.olsr.org/\">olsr.org OLSR daemon</a></font></td>\n" 471 485 "<td height=\"69\" valign=\"middle\" width=\"20%%\">\n" 472 486 "<a href=\"http://www.olsr.org/\"><img border=\"0\" src=\"/logo.gif\" alt=\"olsrd logo\"></a></td>\n" "</tr>\n" 473 "</tbody>\n" "</table>\n", FRAMEWIDTH); 487 "</tbody>\n" "</table>\n", FRAMEWIDTH 488 #endif /* SVEN_OLA_UNBLOAT */ 489 ); 474 490 475 491 size += build_tabs(&body[size], sizeof(body) - size, i); 476 492 size += build_frame(&body[size], sizeof(body) - size, "Current Routes", "routes", FRAMEWIDTH, tab_entries[i].build_body_cb); … … 854 870 size += snprintf(&buf[size], bufsize - size, "<tr><td colspan=\"3\">Status: DOWN</td></tr>\n"); 855 871 continue; 856 872 } 857 873 #ifndef SVEN_OLA_UNBLOAT 858 874 if (olsr_cnf->ip_version == AF_INET) { 859 875 struct ipaddr_str addrbuf, maskbuf, bcastbuf; 860 876 size += … … 867 883 snprintf(&buf[size], bufsize - size, "<tr>\n" "<td>IP: %s</td>\n" "<td>MCAST: %s</td>\n" "<td></td>\n" "</tr>\n", 868 884 ip6_to_string(&addrbuf, &rifs->int6_addr.sin6_addr), ip6_to_string(&maskbuf, &rifs->int6_multaddr.sin6_addr)); 869 885 } 886 #endif /* SVEN_OLA_UNBLOAT */ 870 887 size += 871 888 snprintf(&buf[size], bufsize - size, "<tr>\n" "<td>MTU: %d</td>\n" "<td>WLAN: %s</td>\n" "<td>STATUS: UP</td>\n" "</tr>\n", 872 889 rifs->int_mtu, rifs->is_wireless ? "Yes" : "No"); … … 1115 1132 build_host); 1116 1133 } 1117 1134 1135 #ifndef SVEN_OLA_UNBLOAT 1118 1136 static int 1119 1137 build_cfgfile_body(char *buf, uint32_t bufsize) 1120 1138 { … … 1149 1167 #endif 1150 1168 return size; 1151 1169 } 1170 #endif /* SVEN_OLA_UNBLOAT */ 1152 1171 1153 1172 static int 1154 1173 check_allowed_ip(const struct allowed_net *const allowed_nets, const union olsr_ip_addr *const addr) -
lib/nameservice/src/nameservice.c
diff -ur olsrd-0.5.6-r4.orig/lib/nameservice/src/nameservice.c olsrd-0.5.6-r4/lib/nameservice/src/nameservice.c
old new 65 65 #include "mapwrite.h" 66 66 #include "compat.h" 67 67 68 #ifdef SVEN_OLA_UNBLOAT 69 #undef OLSR_PRINTF 70 #define OLSR_PRINTF(...) 71 #endif /* SVEN_OLA_UNBLOAT */ 72 68 73 /* config parameters */ 69 74 static char my_hosts_file[MAX_FILE + 1]; 70 75 static char my_sighup_pid_file[MAX_FILE + 1]; … … 73 78 static char my_suffix[MAX_SUFFIX]; 74 79 static int my_interval = EMISSION_INTERVAL; 75 80 static double my_timeout = NAME_VALID_TIME; 81 #ifndef SVEN_OLA_UNBLOAT 76 82 static char my_resolv_file[MAX_FILE + 1]; 83 #endif /* SVEN_OLA_UNBLOAT */ 77 84 static char my_services_file[MAX_FILE + 1]; 78 85 static char my_macs_file[MAX_FILE + 1]; 86 #ifndef SVEN_OLA_UNBLOAT 79 87 static char my_name_change_script[MAX_FILE + 1]; 80 88 static char my_services_change_script[MAX_FILE + 1]; 81 89 static char my_macs_change_script[MAX_FILE + 1]; 90 #endif 82 91 static char latlon_in_file[MAX_FILE + 1]; 83 92 static char my_latlon_file[MAX_FILE + 1]; 84 93 float my_lat = 0.0, my_lon = 0.0; … … 102 111 static struct name_entry *my_macs = NULL; 103 112 static bool mac_table_changed = true; 104 113 114 #ifndef SVEN_OLA_UNBLOAT 105 115 static struct list_node forwarder_list[HASHSIZE]; 106 116 static struct name_entry *my_forwarders = NULL; 107 117 static bool forwarder_table_changed = true; 118 #endif /* SVEN_OLA_UNBLOAT */ 108 119 109 120 struct list_node latlon_list[HASHSIZE]; 110 121 static bool latlon_table_changed = true; … … 138 149 GetWindowsDirectory(my_hosts_file, MAX_FILE - 12); 139 150 GetWindowsDirectory(my_services_file, MAX_FILE - 12); 140 151 GetWindowsDirectory(my_macs_file, MAX_FILE - 12); 152 #ifndef SVEN_OLA_UNBLOAT 141 153 GetWindowsDirectory(my_resolv_file, MAX_FILE - 12); 154 #endif /* SVEN_OLA_UNBLOAT */ 142 155 143 156 len = strlen(my_hosts_file); 144 157 if (my_hosts_file[len - 1] != '\\') … … 155 168 strscat(my_macs_file, "\\", sizeof(my_macs_file)); 156 169 strscat(my_macs_file, "macs_olsr", sizeof(my_macs_file)); 157 170 171 #ifndef SVEN_OLA_UNBLOAT 158 172 len = strlen(my_resolv_file); 159 173 if (my_resolv_file[len - 1] != '\\') 160 174 strscat(my_resolv_file, "\\", sizeof(my_resolv_file)); 161 175 strscat(my_resolv_file, "resolvconf_olsr", sizeof(my_resolv_file)); 176 #endif /* SVEN_OLA_UNBLOAT */ 162 177 #else 163 178 strscpy(my_hosts_file, "/var/run/hosts_olsr", sizeof(my_hosts_file)); 164 179 strscpy(my_services_file, "/var/run/services_olsr", sizeof(my_services_file)); 165 180 strscpy(my_macs_file, "/var/run/macs_olsr", sizeof(my_macs_file)); 181 #ifndef SVEN_OLA_UNBLOAT 166 182 strscpy(my_resolv_file, "/var/run/resolvconf_olsr", sizeof(my_resolv_file)); 183 #endif /* SVEN_OLA_UNBLOAT */ 167 184 *my_sighup_pid_file = 0; 168 185 #endif 169 186 … … 171 188 my_add_hosts[0] = '\0'; 172 189 my_latlon_file[0] = '\0'; 173 190 latlon_in_file[0] = '\0'; 191 #ifndef SVEN_OLA_UNBLOAT 174 192 my_name_change_script[0] = '\0'; 175 193 my_services_change_script[0] = '\0'; 176 194 my_macs_change_script[0] = '\0'; 195 #endif /* SVEN_OLA_UNBLOAT */ 177 196 178 197 /* init the lists heads */ 179 198 for (i = 0; i < HASHSIZE; i++) { 180 199 list_head_init(&name_list[i]); 200 #ifndef SVEN_OLA_UNBLOAT 181 201 list_head_init(&forwarder_list[i]); 202 #endif /* SVEN_OLA_UNBLOAT */ 182 203 list_head_init(&service_list[i]); 183 204 list_head_init(&mac_list[i]); 184 205 list_head_init(&latlon_list[i]); … … 186 207 187 208 } 188 209 210 #ifndef SVEN_OLA_UNBLOAT 189 211 static int 190 212 set_nameservice_server(const char *value, void *data, set_plugin_parameter_addon addon) 191 213 { … … 204 226 } 205 227 return 1; 206 228 } 229 #endif /* SVEN_OLA_UNBLOAT */ 207 230 208 231 static int 209 232 set_nameservice_name(const char *value, void *data, set_plugin_parameter_addon addon) … … 253 276 { .name = "timeout", .set_plugin_parameter = &set_nameservice_float, .data = &my_timeout }, 254 277 { .name = "sighup-pid-file", .set_plugin_parameter = &set_plugin_string, .data = &my_sighup_pid_file, .addon = {sizeof(my_sighup_pid_file)} }, 255 278 { .name = "hosts-file", .set_plugin_parameter = &set_plugin_string, .data = &my_hosts_file, .addon = {sizeof(my_hosts_file)} }, 279 #ifndef SVEN_OLA_UNBLOAT 256 280 { .name = "name-change-script", .set_plugin_parameter = &set_plugin_string, .data = &my_name_change_script, .addon = {sizeof(my_name_change_script)} }, 257 281 { .name = "services-change-script", .set_plugin_parameter = &set_plugin_string, .data = &my_services_change_script, .addon = {sizeof(my_services_change_script)} }, 258 282 { .name = "macs-change-script", .set_plugin_parameter = &set_plugin_string, .data = &my_macs_change_script, .addon = {sizeof(my_macs_change_script)} }, 259 283 { .name = "resolv-file", .set_plugin_parameter = &set_plugin_string, .data = &my_resolv_file, .addon = {sizeof(my_resolv_file)} }, 284 #endif /* SVEN_OLA_UNBLOAT */ 260 285 { .name = "suffix", .set_plugin_parameter = &set_plugin_string, .data = &my_suffix, .addon = {sizeof(my_suffix)} }, 261 286 { .name = "add-hosts", .set_plugin_parameter = &set_plugin_string, .data = &my_add_hosts, .addon = {sizeof(my_add_hosts)} }, 262 287 { .name = "services-file", .set_plugin_parameter = &set_plugin_string, .data = &my_services_file, .addon = {sizeof(my_services_file)} }, … … 265 290 { .name = "lon", .set_plugin_parameter = &set_nameservice_float, .data = &my_lon }, 266 291 { .name = "latlon-file", .set_plugin_parameter = &set_plugin_string, .data = &my_latlon_file, .addon = {sizeof(my_latlon_file)} }, 267 292 { .name = "latlon-infile", .set_plugin_parameter = &set_plugin_string, .data = &latlon_in_file, .addon = {sizeof(latlon_in_file)} }, 293 #ifndef SVEN_OLA_UNBLOAT 268 294 { .name = "dns-server", .set_plugin_parameter = &set_nameservice_server, .data = &my_forwarders, .addon = {NAME_FORWARDER} }, 295 #endif /* SVEN_OLA_UNBLOAT */ 269 296 { .name = "name", .set_plugin_parameter = &set_nameservice_name, .data = &my_names, .addon = {NAME_HOST} }, 270 297 { .name = "service", .set_plugin_parameter = &set_nameservice_name, .data = &my_services, .addon = {NAME_SERVICE} }, 271 298 { .name = "mac", .set_plugin_parameter = &set_nameservice_name, .data = &my_macs, .addon = {NAME_MACADDR} }, … … 381 408 name->ip = olsr_cnf->main_addr; 382 409 } 383 410 } 411 #ifndef SVEN_OLA_UNBLOAT 384 412 for (name = my_forwarders; name != NULL; name = name->next) { 385 413 if (name->ip.v4.s_addr == 0) { 386 414 OLSR_PRINTF(2, "NAME PLUGIN: insert main addr for name %s \n", name->name); 387 415 name->ip = olsr_cnf->main_addr; 388 416 } 389 417 } 418 #endif /* SVEN_OLA_UNBLOAT */ 390 419 391 420 //check if entries I want to announce myself are valid and allowed 392 421 my_names = remove_nonvalid_names_from_list(my_names, NAME_HOST); 422 #ifndef SVEN_OLA_UNBLOAT 393 423 my_forwarders = remove_nonvalid_names_from_list(my_forwarders, NAME_FORWARDER); 424 #endif /* SVEN_OLA_UNBLOAT */ 394 425 my_services = remove_nonvalid_names_from_list(my_services, NAME_SERVICE); 395 426 my_macs = remove_nonvalid_names_from_list(my_macs, NAME_MACADDR); 396 427 … … 463 494 free_name_entry_list(&my_names); 464 495 free_name_entry_list(&my_services); 465 496 free_name_entry_list(&my_macs); 497 #ifndef SVEN_OLA_UNBLOAT 466 498 free_name_entry_list(&my_forwarders); 499 #endif /* SVEN_OLA_UNBLOAT */ 467 500 468 501 free_all_list_entries(name_list); 469 502 free_all_list_entries(service_list); 470 503 free_all_list_entries(mac_list); 504 #ifndef SVEN_OLA_UNBLOAT 471 505 free_all_list_entries(forwarder_list); 506 #endif /* SVEN_OLA_UNBLOAT */ 472 507 free_all_list_entries(latlon_list); 473 508 474 509 olsr_stop_timer(write_file_timer); … … 511 546 { 512 547 write_file_timer = NULL; 513 548 549 #ifndef SVEN_OLA_UNBLOAT 514 550 write_resolv_file(); /* if forwarder_table_changed */ 551 #endif /* SVEN_OLA_UNBLOAT */ 515 552 write_hosts_file(); /* if name_table_changed */ 516 553 write_services_file(false); /* if service_table_changed */ 517 554 write_services_file(true); /* if mac_table_changed */ … … 693 730 pos = create_packet((struct name *)pos, my_name); 694 731 i++; 695 732 } 733 #ifndef SVEN_OLA_UNBLOAT 696 734 // forwarders 697 735 for (my_name = my_forwarders; my_name != NULL; my_name = my_name->next) { 698 736 pos = create_packet((struct name *)pos, my_name); 699 737 i++; 700 738 } 739 #endif /* SVEN_OLA_UNBLOAT */ 701 740 // services 702 741 for (my_name = my_services; my_name != NULL; my_name = my_name->next) { 703 742 pos = create_packet((struct name *)pos, my_name); … … 880 919 case NAME_HOST: 881 920 insert_new_name_in_list(originator, name_list, from_packet, &name_table_changed, vtime); 882 921 break; 922 #ifndef SVEN_OLA_UNBLOAT 883 923 case NAME_FORWARDER: 884 924 insert_new_name_in_list(originator, forwarder_list, from_packet, &forwarder_table_changed, vtime); 885 925 break; 926 #endif /* SVEN_OLA_UNBLOAT */ 886 927 case NAME_SERVICE: 887 928 insert_new_name_in_list(originator, service_list, from_packet, &service_table_changed, vtime); 888 929 break; … … 901 942 pos += sizeof(struct name); 902 943 pos += 1 + ((ntohs(from_packet->len) - 1) | 3); 903 944 } 945 #ifdef DEBUG 904 946 if (i != 0) 905 947 OLSR_PRINTF(4, "NAME PLUGIN: Lost %d entries in received packet due to length inconsistency (%s)\n", i, 906 948 olsr_ip_to_string(&strbuf, originator)); 949 #endif 907 950 } 908 951 909 952 /** … … 1120 1163 #endif 1121 1164 name_table_changed = false; 1122 1165 1166 #ifndef SVEN_OLA_UNBLOAT 1123 1167 // Executes my_name_change_script after writing the hosts file 1124 1168 if (my_name_change_script[0] != '\0') { 1125 1169 if (system(my_name_change_script) != -1) { … … 1128 1172 OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on hosts change\n", my_name_change_script); 1129 1173 } 1130 1174 } 1175 #endif /* SVEN_OLA_UNBLOAT */ 1131 1176 } 1132 1177 1133 1178 /** … … 1193 1238 1194 1239 fclose(file); 1195 1240 if (writemacs) { 1241 #ifndef SVEN_OLA_UNBLOAT 1196 1242 // Executes my_macs_change_script after writing the macs file 1197 1243 if (my_macs_change_script[0] != '\0') { 1198 1244 if (system(my_macs_change_script) != -1) { … … 1201 1247 OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on mac change\n", my_macs_change_script); 1202 1248 } 1203 1249 } 1250 #endif /* SVEN_OLA_UNBLOAT */ 1204 1251 mac_table_changed = false; 1205 1252 } 1206 1253 else { 1254 #ifndef SVEN_OLA_UNBLOAT 1207 1255 // Executes my_services_change_script after writing the services file 1208 1256 if (my_services_change_script[0] != '\0') { 1209 1257 if (system(my_services_change_script) != -1) { … … 1212 1260 OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on service change\n", my_services_change_script); 1213 1261 } 1214 1262 } 1263 #endif /* SVEN_OLA_UNBLOAT */ 1215 1264 service_table_changed = false; 1216 1265 } 1217 1266 } … … 1222 1271 * fresh entries are at the beginning of the array and 1223 1272 * the best entry is at the end of the array. 1224 1273 */ 1274 #ifndef SVEN_OLA_UNBLOAT 1225 1275 static void 1226 1276 select_best_nameserver(struct rt_entry **rt) 1227 1277 { … … 1253 1303 } 1254 1304 } 1255 1305 } 1306 #endif /* SVEN_OLA_UNBLOAT */ 1256 1307 1257 1308 /** 1258 1309 * write the 3 best upstream DNS servers to resolv.conf file 1259 1310 * best means the 3 with the best etx value in routing table 1260 1311 */ 1312 #ifndef SVEN_OLA_UNBLOAT 1261 1313 void 1262 1314 write_resolv_file(void) 1263 1315 { … … 1341 1393 fclose(resolv); 1342 1394 forwarder_table_changed = false; 1343 1395 } 1396 #endif /* SVEN_OLA_UNBLOAT */ 1344 1397 1345 1398 /** 1346 1399 * completely free a list of name_entries … … 1359 1412 case NAME_HOST: 1360 1413 name_table_changed = true; 1361 1414 break; 1415 #ifndef SVEN_OLA_UNBLOAT 1362 1416 case NAME_FORWARDER: 1363 1417 forwarder_table_changed = true; 1364 1418 break; 1419 #endif /* SVEN_OLA_UNBLOAT */ 1365 1420 case NAME_SERVICE: 1366 1421 service_table_changed = true; 1367 1422 break; -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/apm.h olsrd-0.5.6-r4/src/apm.h
old new 41 41 42 42 #ifndef _OLSR_APM 43 43 #define _OLSR_APM 44 #ifndef SVEN_OLA_UNBLOAT 44 45 45 46 /* 46 47 * Interface to OS dependent power management information … … 69 70 int apm_read(struct olsr_apm_info *); 70 71 71 72 #endif 73 #endif /* SVEN_OLA_UNBLOAT */ 72 74 73 75 /* 74 76 * Local Variables: -
src/cfgparser/cfgfile_gen.c
diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/cfgfile_gen.c olsrd-0.5.6-r4/src/cfgparser/cfgfile_gen.c
old new 57 57 struct olsr_if *in = cnf->interfaces; 58 58 struct plugin_entry *pe = cnf->plugins; 59 59 struct plugin_param *pp; 60 #ifndef SVEN_OLA_UNBLOAT 60 61 struct ip_prefix_list *ie = cnf->ipc_nets; 62 #endif /* SVEN_OLA_UNBLOAT */ 61 63 struct olsr_lq_mult *mult; 62 64 63 65 char ipv6_buf[100]; /* buffer for IPv6 inet_htop */ … … 133 135 else 134 136 fprintf(fd, "Willingness\t%d\n\n", cnf->willingness); 135 137 138 #ifndef SVEN_OLA_UNBLOAT 136 139 /* IPC */ 137 140 fprintf(fd, "# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n"); 138 141 fprintf(fd, "IpcConnect {\n"); … … 149 152 } 150 153 151 154 fprintf(fd, "}\n\n"); 155 #endif /* SVEN_OLA_UNBLOAT */ 152 156 153 157 /* Hysteresis */ 154 158 fprintf(fd, "# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n"); … … 367 371 struct olsr_if *in = cnf->interfaces; 368 372 struct plugin_entry *pe = cnf->plugins; 369 373 struct plugin_param *pp; 374 #ifndef SVEN_OLA_UNBLOAT 370 375 struct ip_prefix_list *ie = cnf->ipc_nets; 376 #endif /* SVEN_OLA_UNBLOAT */ 371 377 struct olsr_lq_mult *mult; 372 378 373 379 int size = 0; … … 434 440 else 435 441 WRITE_TO_BUF("Willingness\t%d\n\n", cnf->willingness); 436 442 443 #ifndef SVEN_OLA_UNBLOAT 437 444 /* IPC */ 438 445 WRITE_TO_BUF("# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n"); 439 446 WRITE_TO_BUF("IpcConnect {\n"); … … 449 456 } 450 457 451 458 WRITE_TO_BUF("}\n\n"); 459 #endif /* SVEN_OLA_UNBLOAT */ 452 460 453 461 /* Hysteresis */ 454 462 WRITE_TO_BUF("# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n"); -
src/cfgparser/local.mk
diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/local.mk olsrd-0.5.6-r4/src/cfgparser/local.mk
old new 41 41 C=$(if $(CFGDIR),$(CFGDIR)/) 42 42 43 43 # add the variables as we may have others already there 44 ifeq ($(SVEN_OLA_UNBLOAT),1) 45 SRCS += $(foreach file,olsrd_conf oparse oscan,$(C)$(file).c) 46 OBJS += $(foreach file,olsrd_conf oparse oscan,$(C)$(file).o) 47 else 44 48 SRCS += $(foreach file,olsrd_conf oparse oscan cfgfile_gen,$(C)$(file).c) 45 49 OBJS += $(foreach file,olsrd_conf oparse oscan cfgfile_gen,$(C)$(file).o) 50 endif 46 51 HDRS += $(foreach file,olsrd_conf oparse,$(C)$(file).h) 47 52 48 53 $(C)oscan.c: $(C)oscan.lex $(C)Makefile -
src/cfgparser/olsrd_conf.c
diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.6-r4/src/cfgparser/olsrd_conf.c
old new 81 81 } 82 82 83 83 if ((cnf = olsrd_parse_cnf(argv[1])) != NULL) { 84 #ifndef SVEN_OLA_UNBLOAT 84 85 if ((argc > 2) && (!strcmp(argv[2], "-print"))) { 85 86 olsrd_print_cnf(cnf); 86 87 olsrd_write_cnf(cnf, "./out.conf"); 87 88 } else 88 89 printf("Use -print to view parsed values\n"); 90 #endif /* SVEN_OLA_UNBLOAT */ 89 91 printf("Configfile parsed OK\n"); 90 92 } else { 91 93 printf("Failed parsing \"%s\"\n", argv[1]); … … 152 154 /* set various stuff */ 153 155 in->configured = false; 154 156 in->interf = NULL; 157 #ifndef SVEN_OLA_UNBLOAT 155 158 in->host_emul = false; 159 #endif /* SVEN_OLA_UNBLOAT */ 156 160 } 157 161 return olsr_cnf; 158 162 } … … 389 393 390 394 cnf->debug_level = DEF_DEBUGLVL; 391 395 cnf->no_fork = false; 396 #ifndef SVEN_OLA_UNBLOAT 392 397 cnf->host_emul = false; 398 #endif /* SVEN_OLA_UNBLOAT */ 393 399 cnf->ip_version = AF_INET; 394 400 cnf->ipsize = sizeof(struct in_addr); 395 401 cnf->maxplen = 32; … … 400 406 cnf->rtproto = DEF_RTPROTO; 401 407 cnf->rttable_default = 0; 402 408 cnf->willingness_auto = DEF_WILL_AUTO; 409 #ifndef SVEN_OLA_UNBLOAT 403 410 cnf->ipc_connections = DEF_IPC_CONNECTIONS; 411 #endif /* SVEN_OLA_UNBLOAT */ 404 412 cnf->fib_metric = DEF_FIB_METRIC; 405 413 406 414 cnf->use_hysteresis = DEF_USE_HYST; … … 479 487 480 488 } 481 489 490 #ifndef SVEN_OLA_UNBLOAT 482 491 void 483 492 olsrd_print_cnf(struct olsrd_config *cnf) 484 493 { … … 622 631 } 623 632 } 624 633 } 634 #endif /* SVEN_OLA_UNBLOAT */ 625 635 626 636 #if defined WIN32 627 637 struct ioinfo { -
src/cfgparser/oparse.y
diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oparse.y olsrd-0.5.6-r4/src/cfgparser/oparse.y
old new 178 178 %token TOK_RTPROTO 179 179 %token TOK_RTTABLE_DEFAULT 180 180 %token TOK_WILLINGNESS 181 %token TOK_IPCCON182 181 %token TOK_FIBMETRIC 183 182 %token TOK_USEHYST 184 183 %token TOK_HYSTSCALE … … 201 200 202 201 %token TOK_HOSTLABEL 203 202 %token TOK_NETLABEL 204 %token TOK_MAXIPC205 203 206 204 %token TOK_IP4BROADCAST 207 205 %token TOK_IFMODE … … 263 261 264 262 block: TOK_HNA4 hna4body 265 263 | TOK_HNA6 hna6body 266 | TOK_IPCCON ipcbody267 264 | ifblock ifbody 268 265 | plblock plbody 269 266 ; … … 288 285 | ihna6entry 289 286 ; 290 287 291 ipcbody: TOK_OPEN ipcstmts TOK_CLOSE292 ;293 294 ipcstmts: | ipcstmts ipcstmt295 ;296 297 ipcstmt: vcomment298 | imaxipc299 | ipchost300 | ipcnet301 ;302 303 288 ifblock: ifstart ifnicks 304 289 ; 305 290 … … 341 326 | vcomment 342 327 ; 343 328 344 imaxipc: TOK_MAXIPC TOK_INTEGER345 {346 olsr_cnf->ipc_connections = $2->integer;347 free($2);348 }349 ;350 351 ipchost: TOK_HOSTLABEL TOK_IP4_ADDR352 {353 union olsr_ip_addr ipaddr;354 PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string);355 356 if (inet_aton($2->string, &ipaddr.v4) == 0) {357 fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string);358 YYABORT;359 }360 361 ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_cnf->maxplen);362 363 free($2->string);364 free($2);365 }366 ;367 368 ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR369 {370 union olsr_ip_addr ipaddr, netmask;371 372 PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string);373 374 if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) {375 fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string);376 YYABORT;377 }378 379 if (inet_pton(AF_INET, $3->string, &netmask.v4) == 0) {380 fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string);381 YYABORT;382 }383 384 ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_netmask_to_prefix(&netmask));385 386 free($2->string);387 free($2);388 free($3->string);389 free($3);390 }391 | TOK_NETLABEL TOK_IP4_ADDR TOK_SLASH TOK_INTEGER392 {393 union olsr_ip_addr ipaddr;394 395 PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string);396 397 if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) {398 fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string);399 YYABORT;400 }401 402 if ($4->integer > olsr_cnf->maxplen) {403 fprintf(stderr, "ipcnet: Prefix len %u > %d is not allowed!\n", $4->integer, olsr_cnf->maxplen);404 YYABORT;405 }406 407 ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, $4->integer);408 409 free($2->string);410 free($2);411 free($4);412 }413 ;414 415 329 iifweight: TOK_IFWEIGHT TOK_INTEGER 416 330 { 417 331 int ifcnt = ifs_in_curr_cfg; -
src/cfgparser/oscan.lex
diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oscan.lex olsrd-0.5.6-r4/src/cfgparser/oscan.lex
old new 253 253 return TOK_NETLABEL; 254 254 } 255 255 256 "MaxConnections" {257 yylval = NULL;258 return TOK_MAXIPC;259 }260 261 256 "DebugLevel" { 262 257 yylval = NULL; 263 258 return TOK_DEBUGLEVEL; … … 334 329 return TOK_WILLINGNESS; 335 330 } 336 331 337 "IpcConnect" {338 yylval = NULL;339 return TOK_IPCCON;340 }341 342 332 "FIBMetric" { 343 333 yylval = NULL; 344 334 return TOK_FIBMETRIC; -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/defs.h olsrd-0.5.6-r4/src/defs.h
old new 190 190 */ 191 191 clock_t olsr_times(void); 192 192 193 #ifndef SVEN_OLA_UNBLOAT 194 193 195 /* 194 196 *IPC functions 195 197 *These are moved to a plugin soon … … 207 209 int ipc_output(struct olsr *); 208 210 209 211 #endif 212 #endif /* SVEN_OLA_UNBLOAT */ 210 213 211 214 /* 212 215 * Local Variables: -
src/duplicate_set.c
diff -ur olsrd-0.5.6-r4.orig/src/duplicate_set.c olsrd-0.5.6-r4/src/duplicate_set.c
old new 174 174 return false; /* no duplicate */ 175 175 } 176 176 177 #ifndef SVEN_OLA_UNBLOAT 177 178 void 178 179 olsr_print_duplicate_table(void) 179 180 { … … 192 193 } OLSR_FOR_ALL_DUP_ENTRIES_END(entry); 193 194 #endif 194 195 } 196 #endif /* SVEN_OLA_UNBLOAT */ 195 197 196 198 /* 197 199 * Local Variables: -
src/hna_set.c
diff -ur olsrd-0.5.6-r4.orig/src/hna_set.c olsrd-0.5.6-r4/src/hna_set.c
old new 279 279 * 280 280 *@return nada 281 281 */ 282 #ifndef SVEN_OLA_UNBLOAT 282 283 void 283 284 olsr_print_hna_set(void) 284 285 { … … 320 321 } 321 322 #endif 322 323 } 324 #endif /* SVEN_OLA_UNBLOAT */ 323 325 324 326 /** 325 327 *Process incoming HNA message. -
src/interfaces.c
diff -ur olsrd-0.5.6-r4.orig/src/interfaces.c olsrd-0.5.6-r4/src/interfaces.c
old new 93 93 OLSR_PRINTF(1, "\n ---- Interface configuration ---- \n\n"); 94 94 /* Run trough all interfaces immedeatly */ 95 95 for (tmp_if = olsr_cnf->interfaces; tmp_if != NULL; tmp_if = tmp_if->next) { 96 #ifndef SVEN_OLA_UNBLOAT 96 97 if (!tmp_if->host_emul) { 97 98 if (!olsr_cnf->host_emul) /* XXX: TEMPORARY! */ 99 #endif /* SVEN_OLA_UNBLOAT */ 98 100 chk_if_up(tmp_if, 1); 101 #ifndef SVEN_OLA_UNBLOAT 99 102 } else { 100 103 add_hemu_if(tmp_if); 101 104 } 105 #endif /* SVEN_OLA_UNBLOAT */ 102 106 } 103 107 104 108 /* Kick a periodic timer for the network interface update function */ … … 244 248 *@return nada 245 249 */ 246 250 struct olsr_if * 251 #ifdef SVEN_OLA_UNBLOAT 252 queue_if(const char *name) 253 #else /* SVEN_OLA_UNBLOAT */ 247 254 queue_if(const char *name, int hemu) 255 #endif /* SVEN_OLA_UNBLOAT */ 248 256 { 249 257 struct olsr_if *interf_n = olsr_cnf->interfaces; 250 258 size_t name_size; … … 268 276 interf_n->interf = NULL; 269 277 interf_n->configured = 0; 270 278 279 #ifndef SVEN_OLA_UNBLOAT 271 280 interf_n->host_emul = hemu ? true : false; 281 #endif /* SVEN_OLA_UNBLOAT */ 272 282 273 283 strscpy(interf_n->name, name, name_size); 274 284 interf_n->next = olsr_cnf->interfaces; -
src/interfaces.h
diff -ur olsrd-0.5.6-r4.orig/src/interfaces.h olsrd-0.5.6-r4/src/interfaces.h
old new 200 200 201 201 struct interface *if_ifwithindex(const int if_index); 202 202 203 struct olsr_if *queue_if(const char *, int); 203 struct olsr_if * 204 #ifdef SVEN_OLA_UNBLOAT 205 queue_if(const char *); 206 #else /* SVEN_OLA_UNBLOAT */ 207 queue_if(const char *, int); 208 #endif /* SVEN_OLA_UNBLOAT */ 204 209 205 210 int add_ifchgf(int (*f) (struct interface *, int)); 206 211 -
src/ipc_frontend.c
diff -ur olsrd-0.5.6-r4.orig/src/ipc_frontend.c olsrd-0.5.6-r4/src/ipc_frontend.c
old new 46 46 * 47 47 */ 48 48 49 #ifndef SVEN_OLA_UNBLOAT 49 50 #include "ipc_frontend.h" 50 51 #include "link_set.h" 51 52 #include "olsr.h" … … 423 424 424 425 return 1; 425 426 } 427 #endif /* SVEN_OLA_UNBLOAT */ 426 428 427 429 /* 428 430 * Local Variables: -
src/ipc_frontend.h
diff -ur olsrd-0.5.6-r4.orig/src/ipc_frontend.h olsrd-0.5.6-r4/src/ipc_frontend.h
old new 48 48 49 49 #ifndef _OLSR_IPC 50 50 #define _OLSR_IPC 51 #ifndef SVEN_OLA_UNBLOAT 51 52 52 53 #include <sys/types.h> 53 54 #include <netinet/in.h> … … 103 104 int ipc_route_send_rtentry(const union olsr_ip_addr *, const union olsr_ip_addr *, int, int, const char *); 104 105 105 106 #endif 107 #endif /* SVEN_OLA_UNBLOAT */ 106 108 107 109 /* 108 110 * Local Variables: -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/ipcalc.c olsrd-0.5.6-r4/src/ipcalc.c
old new 121 121 return prefix; 122 122 } 123 123 124 #ifndef SVEN_OLA_UNBLOAT 124 125 const char * 125 126 olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix) 126 127 { … … 147 148 } 148 149 return rv; 149 150 } 151 #endif /* SVEN_OLA_UNBLOAT */ 150 152 151 153 /* see if the ipaddr is in the net. That is equivalent to the fact that the net part 152 154 * of both are equal. So we must compare the first <prefixlen> bits. -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/ipcalc.h olsrd-0.5.6-r4/src/ipcalc.h
old new 146 146 return inet_ntop(olsr_cnf->ip_version, addr, buf->buf, sizeof(buf->buf)); 147 147 } 148 148 149 #ifndef SVEN_OLA_UNBLOAT 149 150 const char *olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix); 151 #endif /* SVEN_OLA_UNBLOAT */ 150 152 151 153 static INLINE const char * 152 154 sockaddr4_to_string(struct ipaddr_str *const buf, const struct sockaddr *const addr) -
src/link_set.c
diff -ur olsrd-0.5.6-r4.orig/src/link_set.c olsrd-0.5.6-r4/src/link_set.c
old new 761 761 return ret; 762 762 } 763 763 764 #ifndef SVEN_OLA_UNBLOAT 764 765 void 765 766 olsr_print_link_set(void) 766 767 { … … 782 783 } OLSR_FOR_ALL_LINK_ENTRIES_END(walker); 783 784 #endif 784 785 } 786 #endif /* SVEN_OLA_UNBLOAT */ 785 787 786 788 /* 787 789 * called for every LQ HELLO message. -
src/linux/apm.c
diff -ur olsrd-0.5.6-r4.orig/src/linux/apm.c olsrd-0.5.6-r4/src/linux/apm.c
old new 44 44 * Acpi-Power Enlightenment epplet 45 45 */ 46 46 47 #ifndef SVEN_OLA_UNBLOAT 47 48 #include "apm.h" 48 49 #include "defs.h" 49 50 #include <stdio.h> … … 348 349 /* No battery found */ 349 350 return -1; 350 351 } 352 #endif /* SVEN_OLA_UNBLOAT */ 351 353 352 354 /* 353 355 * Local Variables: -
src/linux/kernel_routes.c
diff -ur olsrd-0.5.6-r4.orig/src/linux/kernel_routes.c olsrd-0.5.6-r4/src/linux/kernel_routes.c
old new 300 300 if (rt_ret > 0) rt_ret = 0; /* successful recovery */ 301 301 else rt_ret = -1; /* unrecoverable error */ 302 302 } 303 #ifndef SVEN_OLA_UNBLOAT 303 304 //send ipc update on success 304 305 if ( ( cmd != RTM_NEWRULE ) & ( cmd != RTM_DELRULE ) & (flag = RT_ORIG_REQUEST) & (0 <= rt_ret && olsr_cnf->ipc_connections > 0)) { 305 306 ipc_route_send_rtentry(&rt->rt_dst.prefix, &nexthop->gateway, metric, RTM_NEWROUTE == cmd, 306 307 if_ifwithindex_name(nexthop->iif_index)); 307 308 } 309 #endif /* SVEN_OLA_UNBLOAT */ 308 310 if (rt_ret == -2) olsr_syslog(OLSR_LOG_ERR,"no rtnetlink response! (no system ressources left?, everything may happen now ...)"); 309 311 return rt_ret; 310 312 } … … 342 344 int rslt; 343 345 #endif /* LINUX_POLICY_ROUTING */ 344 346 347 #ifndef SVEN_OLA_UNBLOAT 345 348 OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); 349 #endif /* SVEN_OLA_UNBLOAT */ 346 350 347 351 #if !LINUX_POLICY_ROUTING 348 352 memset(&kernel_route, 0, sizeof(struct rtentry)); … … 416 420 struct in6_rtmsg kernel_route; 417 421 int rslt; 418 422 423 #ifndef SVEN_OLA_UNBLOAT 419 424 OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); 425 #endif /* SVEN_OLA_UNBLOAT */ 420 426 421 427 memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); 422 428 … … 469 475 int rslt; 470 476 #endif /* LINUX_POLICY_ROUTING */ 471 477 478 #ifndef SVEN_OLA_UNBLOAT 472 479 OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); 480 #endif /* SVEN_OLA_UNBLOAT */ 473 481 474 482 #if !LINUX_POLICY_ROUTING 475 483 memset(&kernel_route, 0, sizeof(struct rtentry)); … … 536 544 int rslt; 537 545 #endif /* LINUX_POLICY_ROUTING */ 538 546 547 #ifndef SVEN_OLA_UNBLOAT 539 548 OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); 549 #endif /* SVEN_OLA_UNBLOAT */ 540 550 541 551 #if !LINUX_POLICY_ROUTING 542 552 memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); -
src/linux/net.c
diff -ur olsrd-0.5.6-r4.orig/src/linux/net.c olsrd-0.5.6-r4/src/linux/net.c
old new 69 69 #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ 70 70 71 71 /* The original state of the IP forwarding proc entry */ 72 #ifndef SVEN_OLA_UNBLOAT 72 73 static char orig_fwd_state; 73 74 static char orig_global_redirect_state; 75 #endif /* SVEN_OLA_UNBLOAT */ 74 76 75 77 /** 76 78 *Bind a socket to a device … … 91 93 return setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, dev_name, strlen(dev_name) + 1); 92 94 } 93 95 96 #ifndef SVEN_OLA_UNBLOAT 97 94 98 /** 95 99 *Enable IP forwarding. 96 100 *Just writing "1" to the /proc/sys/net/ipv4/ip_forward … … 110 114 const char *const procfile = version == AF_INET ? "/proc/sys/net/ipv4/ip_forward" : "/proc/sys/net/ipv6/conf/all/forwarding"; 111 115 112 116 if ((proc_fwd = fopen(procfile, "r")) == NULL) { 117 #ifdef SVEN_OLA_UNBLOAT_OLD 118 perror(procfile); 119 #else 113 120 /* IPv4 */ 114 121 if (version == AF_INET) 115 122 fprintf(stderr, … … 122 129 procfile); 123 130 124 131 sleep(3); 132 #endif 125 133 return 0; 126 134 } 127 135 … … 131 139 OLSR_PRINTF(3, "\nIP forwarding is enabled on this system\n"); 132 140 } else { 133 141 if ((proc_fwd = fopen(procfile, "w")) == NULL) { 142 #ifdef SVEN_OLA_UNBLOAT_OLD 143 perror(procfile); 144 #else 134 145 fprintf(stderr, "Could not open %s for writing!\n", procfile); 135 146 fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that IP forwarding is enabeled!\n\n"); 136 147 sleep(3); 148 #endif 137 149 return 0; 138 150 } else { 139 151 syslog(LOG_INFO, "Writing \"1\" to %s\n", procfile); … … 154 166 return -1; 155 167 156 168 if ((proc_redirect = fopen(procfile, "r")) == NULL) { 169 #ifdef SVEN_OLA_UNBLOAT_OLD 170 perror(procfile); 171 #else 157 172 fprintf(stderr, 158 173 "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", 159 174 procfile); 160 175 161 176 sleep(3); 177 #endif 162 178 return -1; 163 179 } 164 180 orig_global_redirect_state = fgetc(proc_redirect); … … 168 184 return 0; 169 185 170 186 if ((proc_redirect = fopen(procfile, "w")) == NULL) { 187 #ifdef SVEN_OLA_UNBLOAT_OLD 188 perror(procfile); 189 #else 171 190 fprintf(stderr, "Could not open %s for writing!\n", procfile); 172 191 fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that ICMP redirect is disabeled!\n\n"); 173 192 sleep(3); 193 #endif 174 194 return 0; 175 195 } 176 196 syslog(LOG_INFO, "Writing \"0\" to %s", procfile); … … 196 216 snprintf(procfile, sizeof(procfile), REDIRECT_PROC, if_name); 197 217 198 218 if ((proc_redirect = fopen(procfile, "r")) == NULL) { 219 #ifdef SVEN_OLA_UNBLOAT_OLD 220 perror(procfile); 221 #else 199 222 fprintf(stderr, 200 223 "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", 201 224 procfile); 202 225 sleep(3); 226 #endif 203 227 return 0; 204 228 } 205 229 iface->nic_state.redirect = fgetc(proc_redirect); 206 230 fclose(proc_redirect); 207 231 208 232 if ((proc_redirect = fopen(procfile, "w")) == NULL) { 233 #ifdef SVEN_OLA_UNBLOAT_OLD 234 perror(procfile); 235 #else 209 236 fprintf(stderr, "Could not open %s for writing!\n", procfile); 210 237 fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that ICMP redirect is disabeled!\n\n"); 211 238 sleep(3); 239 #endif 212 240 return 0; 213 241 } 214 242 syslog(LOG_INFO, "Writing \"0\" to %s", procfile); … … 234 262 sprintf(procfile, SPOOF_PROC, if_name); 235 263 236 264 if ((proc_spoof = fopen(procfile, "r")) == NULL) { 265 #ifdef SVEN_OLA_UNBLOAT_OLD 266 perror(procfile); 267 #else 237 268 fprintf(stderr, 238 269 "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", 239 270 procfile); 240 271 241 272 sleep(3); 273 #endif 242 274 return 0; 243 275 } 244 276 iface->nic_state.spoof = fgetc(proc_spoof); 245 277 fclose(proc_spoof); 246 278 247 279 if ((proc_spoof = fopen(procfile, "w")) == NULL) { 280 #ifdef SVEN_OLA_UNBLOAT_OLD 281 perror(procfile); 282 #else 248 283 fprintf(stderr, "Could not open %s for writing!\n", procfile); 249 284 fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that IP spoof filtering is disabeled!\n\n"); 250 285 sleep(3); 286 #endif 251 287 return 0; 252 288 } 253 289 syslog(LOG_INFO, "Writing \"0\" to %s", procfile); … … 272 308 FILE *proc_fd; 273 309 274 310 if ((proc_fd = fopen(procfile, "w")) == NULL) { 311 #ifdef SVEN_OLA_UNBLOAT_OLD 312 perror(procfile); 313 #else 275 314 fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile); 315 #endif 276 316 } else { 277 317 syslog(LOG_INFO, "Resetting %s to %c\n", procfile, orig_fwd_state); 278 318 fputc(orig_fwd_state, proc_fd); … … 287 327 FILE *proc_fd; 288 328 289 329 if ((proc_fd = fopen(procfile, "w")) == NULL) { 330 #ifdef SVEN_OLA_UNBLOAT_OLD 331 perror(procfile); 332 #else 290 333 fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile); 334 #endif 291 335 } else { 292 336 syslog(LOG_INFO, "Resetting %s to %c\n", procfile, orig_global_redirect_state); 293 337 fputc(orig_global_redirect_state, proc_fd); … … 311 355 snprintf(procfile, sizeof(procfile), REDIRECT_PROC, ifs->int_name); 312 356 313 357 if ((proc_fd = fopen(procfile, "w")) == NULL) 358 #ifdef SVEN_OLA_UNBLOAT_OLD 359 perror(procfile); 360 #else 314 361 fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile); 362 #endif 315 363 else { 316 364 syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.redirect); 317 365 … … 324 372 /* Generate the procfile name */ 325 373 sprintf(procfile, SPOOF_PROC, ifs->int_name); 326 374 if ((proc_fd = fopen(procfile, "w")) == NULL) 375 #ifdef SVEN_OLA_UNBLOAT_OLD 376 perror(procfile); 377 #else 327 378 fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile); 379 #endif 328 380 else { 329 381 syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.spoof); 330 382 … … 372 424 return sock; 373 425 } 374 426 427 #endif /* SVEN_OLA_UNBLOAT */ 428 375 429 /** 376 430 *Creates a nonblocking broadcast socket. 377 431 *@param sa sockaddr struct. Used for bind(2). -
src/lq_plugin.c
diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin.c olsrd-0.5.6-r4/src/lq_plugin.c
old new 67 67 init_lq_handler_tree(void) 68 68 { 69 69 avl_init(&lq_handler_tree, &avl_strcasecmp); 70 #ifndef SVEN_OLA_UNBLOAT 70 71 register_lq_handler(&lq_etx_float_handler, LQ_ALGORITHM_ETX_FLOAT_NAME); 71 72 register_lq_handler(&lq_etx_fpm_handler, LQ_ALGORITHM_ETX_FPM_NAME); 73 #endif /* SVEN_OLA_UNBLOAT */ 72 74 register_lq_handler(&lq_etx_ff_handler, LQ_ALGORITHM_ETX_FF_NAME); 75 #ifndef SVEN_OLA_UNBLOAT 73 76 if (activate_lq_handler(olsr_cnf->lq_algorithm)) { 74 77 activate_lq_handler(LQ_ALGORITHM_ETX_FPM_NAME); 75 78 } 79 #else /* SVEN_OLA_UNBLOAT */ 80 activate_lq_handler(LQ_ALGORITHM_ETX_FF_NAME); 81 #endif /* SVEN_OLA_UNBLOAT */ 76 82 } 77 83 78 84 /* … … 417 423 * @return pointer to hello_neighbor 418 424 */ 419 425 struct hello_neighbor * 426 #ifndef SVEN_OLA_UNBLOAT 420 427 olsr_malloc_hello_neighbor(const char *id) 428 #else /* SVEN_OLA_UNBLOAT */ 429 olsr_malloc_hello_neighbor(const char *id __attribute__ ((unused))) 430 #endif /* SVEN_OLA_UNBLOAT */ 421 431 { 422 432 struct hello_neighbor *h; 423 433 … … 439 449 * @return pointer to tc_mpr_addr 440 450 */ 441 451 struct tc_mpr_addr * 452 #ifndef SVEN_OLA_UNBLOAT 442 453 olsr_malloc_tc_mpr_addr(const char *id) 454 #else /* SVEN_OLA_UNBLOAT */ 455 olsr_malloc_tc_mpr_addr(const char *id __attribute__ ((unused))) 456 #endif /* SVEN_OLA_UNBLOAT */ 443 457 { 444 458 struct tc_mpr_addr *t; 445 459 … … 461 475 * @return pointer to lq_hello_neighbor 462 476 */ 463 477 struct lq_hello_neighbor * 478 #ifndef SVEN_OLA_UNBLOAT 464 479 olsr_malloc_lq_hello_neighbor(const char *id) 480 #else /* SVEN_OLA_UNBLOAT */ 481 olsr_malloc_lq_hello_neighbor(const char *id __attribute__ ((unused))) 482 #endif /* SVEN_OLA_UNBLOAT */ 465 483 { 466 484 struct lq_hello_neighbor *h; 467 485 … … 483 501 * @return pointer to link_entry 484 502 */ 485 503 struct link_entry * 504 #ifndef SVEN_OLA_UNBLOAT 486 505 olsr_malloc_link_entry(const char *id) 506 #else /* SVEN_OLA_UNBLOAT */ 507 olsr_malloc_link_entry(const char *id __attribute__ ((unused))) 508 #endif /* SVEN_OLA_UNBLOAT */ 487 509 { 488 510 struct link_entry *h; 489 511 -
src/lq_plugin_default_float.c
diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin_default_float.c olsrd-0.5.6-r4/src/lq_plugin_default_float.c
old new 39 39 * 40 40 */ 41 41 42 #ifndef SVEN_OLA_UNBLOAT 42 43 #include "tc_set.h" 43 44 #include "link_set.h" 44 45 #include "olsr_spf.h" … … 223 224 224 225 return buffer->buf; 225 226 } 227 #endif /* SVEN_OLA_UNBLOAT */ 226 228 227 229 /* 228 230 * Local Variables: -
src/lq_plugin_default_float.h
diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin_default_float.h olsrd-0.5.6-r4/src/lq_plugin_default_float.h
old new 39 39 * 40 40 */ 41 41 42 #ifndef SVEN_OLA_UNBLOAT 42 43 #ifndef LQ_PLUGIN_DEFAULT_H_ 43 44 #define LQ_PLUGIN_DEFAULT_H_ 44 45 … … 77 78 extern struct lq_handler lq_etx_float_handler; 78 79 79 80 #endif /*LQ_PLUGIN_DEFAULT_H_ */ 81 #endif /* SVEN_OLA_UNBLOAT */ 80 82 81 83 /* 82 84 * Local Variables: -
src/lq_plugin_default_fpm.c
diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin_default_fpm.c olsrd-0.5.6-r4/src/lq_plugin_default_fpm.c
old new 39 39 * 40 40 */ 41 41 42 #ifndef SVEN_OLA_UNBLOAT 42 43 #include "tc_set.h" 43 44 #include "link_set.h" 44 45 #include "lq_plugin.h" … … 235 236 snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", (float)(cost) / LQ_FPM_LINKCOST_MULTIPLIER); 236 237 return buffer->buf; 237 238 } 239 #endif /* SVEN_OLA_UNBLOAT */ 238 240 239 241 /* 240 242 * Local Variables: -
src/lq_plugin_default_fpm.h
diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin_default_fpm.h olsrd-0.5.6-r4/src/lq_plugin_default_fpm.h
old new 39 39 * 40 40 */ 41 41 42 #ifndef SVEN_OLA_UNBLOAT 42 43 #ifndef LQ_ETX_FPM_ 43 44 #define LQ_ETX_FPM_ 44 45 … … 83 84 extern struct lq_handler lq_etx_fpm_handler; 84 85 85 86 #endif /*LQ_ETX_FPM_ */ 87 #endif /* SVEN_OLA_UNBLOAT */ 86 88 87 89 /* 88 90 * Local Variables: -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/main.c olsrd-0.5.6-r4/src/main.c
old new 256 256 /* 257 257 * Print configuration 258 258 */ 259 #ifndef SVEN_OLA_UNBLOAT 259 260 if (olsr_cnf->debug_level > 1) { 260 261 olsrd_print_cnf(olsr_cnf); 261 262 } 263 #endif /* SVEN_OLA_UNBLOAT */ 262 264 #ifndef WIN32 265 #ifndef SVEN_OLA_UNBLOAT 263 266 /* Disable redirects globally */ 264 267 disable_redirects_global(olsr_cnf->ip_version); 265 268 #endif 269 #endif /* SVEN_OLA_UNBLOAT */ 266 270 267 271 /* 268 272 * socket for ioctl calls … … 298 302 /* 299 303 *enable ip forwarding on host 300 304 */ 305 #ifndef SVEN_OLA_UNBLOAT 301 306 enable_ip_forwarding(olsr_cnf->ip_version); 307 #endif /* SVEN_OLA_UNBLOAT */ 302 308 303 309 /* Initialize parser */ 304 310 olsr_init_parser(); … … 316 322 *Set up willingness/APM 317 323 */ 318 324 if (olsr_cnf->willingness_auto) { 325 #ifndef SVEN_OLA_UNBLOAT 319 326 if (apm_init() < 0) { 320 327 OLSR_PRINTF(1, "Could not read APM info - setting default willingness(%d)\n", WILL_DEFAULT); 321 328 … … 324 331 olsr_cnf->willingness_auto = 0; 325 332 olsr_cnf->willingness = WILL_DEFAULT; 326 333 } else { 334 #endif /* SVEN_OLA_UNBLOAT */ 327 335 olsr_cnf->willingness = olsr_calculate_willingness(); 328 336 329 337 OLSR_PRINTF(1, "Willingness set to %d - next update in %.1f secs\n", olsr_cnf->willingness, olsr_cnf->will_int); 338 #ifndef SVEN_OLA_UNBLOAT 330 339 } 340 #endif /* SVEN_OLA_UNBLOAT */ 331 341 } 332 342 333 343 /* Initialize net */ … … 362 372 363 373 /* Initialize the IPC socket */ 364 374 375 #ifndef SVEN_OLA_UNBLOAT 365 376 if (olsr_cnf->ipc_connections > 0) { 366 377 ipc_init(); 367 378 } 379 #endif /* SVEN_OLA_UNBLOAT */ 368 380 /* Initialisation of different tables to be used. */ 369 381 olsr_init_tables(); 370 382 … … 487 499 OLSR_PRINTF(1, "Closing sockets...\n"); 488 500 489 501 /* front-end IPC socket */ 502 #ifndef SVEN_OLA_UNBLOAT 490 503 if (olsr_cnf->ipc_connections > 0) { 491 504 shutdown_ipc(); 492 505 } 506 #endif /* SVEN_OLA_UNBLOAT */ 493 507 494 508 /* OLSR sockets */ 495 509 for (ifn = ifnet; ifn; ifn = ifn->int_next) … … 499 513 olsr_close_plugins(); 500 514 501 515 /* Reset network settings */ 516 #ifndef SVEN_OLA_UNBLOAT 502 517 restore_settings(olsr_cnf->ip_version); 518 #endif /* SVEN_OLA_UNBLOAT */ 503 519 504 520 /* ioctl socket */ 505 521 close(olsr_cnf->ioctl_s); … … 540 556 "usage: olsrd [-f <configfile>] [ -i interface1 interface2 ... ]\n" 541 557 " [-d <debug_level>] [-ipv6] [-multi <IPv6 multicast address>]\n" 542 558 " [-lql <LQ level>] [-lqw <LQ winsize>] [-lqnt <nat threshold>]\n" 559 #ifdef SVEN_OLA_UNBLOAT 560 " [-bcast <broadcastaddr>] [-delgw] (Note: no -ipc,-dispin,-dispout)\n" 561 #else /* SVEN_OLA_UNBLOAT */ 543 562 " [-bcast <broadcastaddr>] [-ipc] [-dispin] [-dispout] [-delgw]\n" 563 #endif /* SVEN_OLA_UNBLOAT */ 544 564 " [-hint <hello interval (secs)>] [-tcint <tc interval (secs)>]\n" 545 565 " [-midint <mid interval (secs)>] [-hnaint <hna interval (secs)>]\n" 546 566 " [-T <Polling Rate (secs)>] [-nofork] [-hemu <ip_address>]\n" " [-lql <LQ level>] [-lqa <LQ aging factor>]\n"); … … 704 724 olsr_exit(__func__, EXIT_FAILURE); 705 725 } 706 726 printf("Queuing if %s\n", *argv); 727 #ifdef SVEN_OLA_UNBLOAT 728 queue_if(*argv); 729 #else /* SVEN_OLA_UNBLOAT */ 707 730 queue_if(*argv, false); 731 #endif /* SVEN_OLA_UNBLOAT */ 708 732 709 733 while ((argc - 1) && (argv[1][0] != '-')) { 710 734 NEXT_ARG; 711 735 printf("Queuing if %s\n", *argv); 736 #ifdef SVEN_OLA_UNBLOAT 737 queue_if(*argv); 738 #else /* SVEN_OLA_UNBLOAT */ 712 739 queue_if(*argv, false); 740 #endif /* SVEN_OLA_UNBLOAT */ 713 741 } 714 742 715 743 continue; … … 771 799 sscanf(*argv, "%f", &cnf->pollrate); 772 800 continue; 773 801 } 774 802 #ifndef SVEN_OLA_UNBLOAT 775 803 /* 776 804 * Should we display the contents of packages beeing sent? 777 805 */ … … 795 823 cnf->ipc_connections = 1; 796 824 continue; 797 825 } 826 #endif /* SVEN_OLA_UNBLOAT */ 798 827 799 828 /* 800 829 * IPv6 multicast addr … … 812 841 813 842 continue; 814 843 } 815 844 #ifndef SVEN_OLA_UNBLOAT 816 845 /* 817 846 * Host emulation 818 847 */ … … 840 869 841 870 continue; 842 871 } 872 #endif /* SVEN_OLA_UNBLOAT */ 843 873 844 874 /* 845 875 * Delete possible default GWs -
src/neighbor_table.c
diff -ur olsrd-0.5.6-r4.orig/src/neighbor_table.c olsrd-0.5.6-r4/src/neighbor_table.c
old new 362 362 * 363 363 *@return nada 364 364 */ 365 #ifndef SVEN_OLA_UNBLOAT 365 366 void 366 367 olsr_print_neighbor_table(void) 367 368 { … … 391 392 } 392 393 #endif 393 394 } 395 #endif /* SVEN_OLA_UNBLOAT */ 394 396 395 397 /* 396 398 * Local Variables: -
src/net_olsr.c
diff -ur olsrd-0.5.6-r4.orig/src/net_olsr.c olsrd-0.5.6-r4/src/net_olsr.c
old new 44 44 #include "log.h" 45 45 #include "olsr.h" 46 46 #include "net_os.h" 47 #ifndef SVEN_OLA_UNBLOAT 47 48 #include "print_packet.h" 49 #endif /* SVEN_OLA_UNBLOAT */ 48 50 #include "link_set.h" 49 51 #include "lq_packet.h" 50 52 … … 385 387 *if the -dispout option was given 386 388 *we print the content of the packets 387 389 */ 390 #ifndef SVEN_OLA_UNBLOAT 388 391 if (disp_pack_out) 389 392 print_olsr_serialized_packet(stdout, (union olsr_packet *)ifp->netbuf.buff, ifp->netbuf.pending, &ifp->ip_addr); 393 #endif /* SVEN_OLA_UNBLOAT */ 390 394 391 395 if (olsr_cnf->ip_version == AF_INET) { 392 396 /* IP version 4 */ … … 400 404 /* IP version 6 */ 401 405 if (olsr_sendto(ifp->olsr_socket, ifp->netbuf.buff, ifp->netbuf.pending, MSG_DONTROUTE, (struct sockaddr *)sin6, sizeof(*sin6)) 402 406 < 0) { 407 #ifndef SVEN_OLA_UNBLOAT 403 408 struct ipaddr_str buf; 409 #endif /* SVEN_OLA_UNBLOAT */ 404 410 perror("sendto(v6)"); 405 411 olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv6 %m"); 412 #ifndef SVEN_OLA_UNBLOAT 406 413 fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_index); 407 414 fprintf(stderr, "To: %s (size: %u)\n", ip6_to_string(&buf, &sin6->sin6_addr), (unsigned int)sizeof(*sin6)); 408 415 fprintf(stderr, "Outputsize: %d\n", ifp->netbuf.pending); 416 #endif /* SVEN_OLA_UNBLOAT */ 409 417 retval = -1; 410 418 } 411 419 } -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/olsr.c olsrd-0.5.6-r4/src/olsr.c
old new 149 149 return; 150 150 151 151 if (olsr_cnf->debug_level > 0 && olsr_cnf->clear_screen && isatty(1)) { 152 #ifndef SVEN_OLA_UNBLOAT 152 153 clear_console(); 154 #endif /* SVEN_OLA_UNBLOAT */ 153 155 printf(" *** %s (%s on %s) ***\n", olsrd_version, build_date, build_host); 154 156 } 155 157 … … 165 167 if (changes_neighborhood || changes_topology || changes_hna) { 166 168 olsr_calculate_routing_table(); 167 169 } 168 170 #ifndef SVEN_OLA_UNBLOAT 169 171 if (olsr_cnf->debug_level > 0) { 170 172 if (olsr_cnf->debug_level > 2) { 171 173 olsr_print_mid_set(); … … 184 186 olsr_print_tc_table(); 185 187 #endif 186 188 } 189 #endif /* SVEN_OLA_UNBLOAT */ 187 190 188 191 for (tmp_pc_list = pcf_list; tmp_pc_list != NULL; tmp_pc_list = tmp_pc_list->next) { 189 192 tmp_pc_list->function(changes_neighborhood, changes_topology, changes_hna); … … 420 423 uint8_t 421 424 olsr_calculate_willingness(void) 422 425 { 426 #ifndef SVEN_OLA_UNBLOAT 423 427 struct olsr_apm_info ainfo; 428 #endif /* SVEN_OLA_UNBLOAT */ 424 429 425 430 /* If fixed willingness */ 426 431 if (!olsr_cnf->willingness_auto) 427 432 return olsr_cnf->willingness; 428 433 434 #ifndef SVEN_OLA_UNBLOAT 429 435 if (apm_read(&ainfo) < 1) 430 436 return WILL_DEFAULT; 431 437 … … 442 448 * 26% > juice will: 1 443 449 */ 444 450 return (ainfo.battery_percentage / 26); 451 #else /* SVEN_OLA_UNBLOAT */ 452 return WILL_DEFAULT; 453 #endif /* SVEN_OLA_UNBLOAT */ 445 454 } 446 455 456 #ifndef SVEN_OLA_UNBLOAT 447 457 const char * 448 458 olsr_msgtype_to_string(uint8_t msgtype) 449 459 { … … 513 523 snprintf(type, sizeof(type), "UNKNOWN(%d)", status); 514 524 return type; 515 525 } 526 #endif /* SVEN_OLA_UNBLOAT */ 516 527 517 528 /** 518 529 *Termination function to be called whenever a error occures … … 541 552 * 542 553 * @return a void pointer to the memory allocated 543 554 */ 555 #ifndef SVEN_OLA_UNBLOAT 544 556 void * 545 557 olsr_malloc(size_t size, const char *id) 546 558 { … … 565 577 566 578 return ptr; 567 579 } 580 #endif /* SVEN_OLA_UNBLOAT */ 568 581 569 582 /** 570 583 *Wrapper for printf that prints to a specific -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/olsr.h olsrd-0.5.6-r4/src/olsr.h
old new 72 72 73 73 uint8_t olsr_calculate_willingness(void); 74 74 75 #ifndef SVEN_OLA_UNBLOAT 75 76 const char *olsr_msgtype_to_string(uint8_t); 76 77 77 78 const char *olsr_link_to_string(uint8_t); 78 79 79 80 const char *olsr_status_to_string(uint8_t); 81 #endif /* SVEN_OLA_UNBLOAT */ 80 82 81 83 void olsr_exit(const char *, int); 82 84 85 #ifdef SVEN_OLA_UNBLOAT 86 #define olsr_malloc(size, msg) calloc(1, size) 87 #else /* SVEN_OLA_UNBLOAT */ 83 88 void *olsr_malloc(size_t, const char *); 89 #endif /* SVEN_OLA_UNBLOAT */ 84 90 85 91 int olsr_printf(int, const char *, ...) __attribute__ ((format(printf, 2, 3))); 86 92 -
src/olsr_cfg.h
diff -ur olsrd-0.5.6-r4.orig/src/olsr_cfg.h olsrd-0.5.6-r4/src/olsr_cfg.h
old new 148 148 char *name; 149 149 char *config; 150 150 bool configured; 151 #ifndef SVEN_OLA_UNBLOAT 151 152 bool host_emul; 152 153 union olsr_ip_addr hemu_ip; 154 #endif /* SVEN_OLA_UNBLOAT */ 153 155 struct interface *interf; 154 156 struct if_config_options *cnf; 155 157 struct olsr_if *next; … … 192 194 uint16_t olsrport; 193 195 int debug_level; 194 196 bool no_fork; 197 #ifndef SVEN_OLA_UNBLOAT 195 198 bool host_emul; 199 #endif /* SVEN_OLA_UNBLOAT */ 196 200 int ip_version; 197 201 bool allow_no_interfaces; 198 202 uint16_t tos; … … 201 205 uint8_t rttable_default; 202 206 uint8_t willingness; 203 207 bool willingness_auto; 208 #ifndef SVEN_OLA_UNBLOAT 204 209 int ipc_connections; 210 #endif /* SVEN_OLA_UNBLOAT */ 205 211 bool use_hysteresis; 206 212 olsr_fib_metric_options fib_metric; 207 213 struct hyst_param hysteresis_param; 208 214 struct plugin_entry *plugins; 209 215 struct ip_prefix_list *hna_entries; 216 #ifndef SVEN_OLA_UNBLOAT 210 217 struct ip_prefix_list *ipc_nets; 218 #endif /* SVEN_OLA_UNBLOAT */ 211 219 struct olsr_if *interfaces; 212 220 float pollrate; 213 221 float nic_chgs_pollrate; … … 267 275 268 276 void olsrd_free_cnf(struct olsrd_config *); 269 277 278 #ifndef SVEN_OLA_UNBLOAT 270 279 void olsrd_print_cnf(struct olsrd_config *); 280 #endif /* SVEN_OLA_UNBLOAT */ 271 281 272 282 int olsrd_write_cnf(struct olsrd_config *, const char *); 273 283 -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/parser.c olsrd-0.5.6-r4/src/parser.c
old new 51 51 #include "rebuild_packet.h" 52 52 #include "net_os.h" 53 53 #include "log.h" 54 #ifndef SVEN_OLA_UNBLOAT 54 55 #include "print_packet.h" 56 #endif /* SVEN_OLA_UNBLOAT */ 55 57 #include "net_olsr.h" 56 58 57 59 #ifdef WIN32 … … 281 283 //printf("Message from %s\n\n", olsr_ip_to_string(&buf, from_addr)); 282 284 283 285 /* Display packet */ 286 #ifndef SVEN_OLA_UNBLOAT 284 287 if (disp_pack_in) 285 288 print_olsr_serialized_packet(stdout, (union olsr_packet *)olsr, size, from_addr); 289 #endif /* SVEN_OLA_UNBLOAT */ 286 290 287 291 if (olsr_cnf->ip_version == AF_INET) 288 292 msgsize = ntohs(m->v4.olsr_msgsize); -
src/print_packet.c
diff -ur olsrd-0.5.6-r4.orig/src/print_packet.c olsrd-0.5.6-r4/src/print_packet.c
old new 39 39 * 40 40 */ 41 41 42 #ifndef SVEN_OLA_UNBLOAT 42 43 #include "print_packet.h" 43 44 #include "ipcalc.h" 44 45 #include "mantissa.h" … … 339 340 remsize -= olsr_cnf->ipsize; 340 341 } 341 342 } 343 #endif /* SVEN_OLA_UNBLOAT */ 342 344 343 345 /* 344 346 * Local Variables: -
src/process_routes.c
diff -ur olsrd-0.5.6-r4.orig/src/process_routes.c olsrd-0.5.6-r4/src/process_routes.c
old new 159 159 static void 160 160 olsr_delete_kernel_route(struct rt_entry *rt) 161 161 { 162 #ifndef SVEN_OLA_UNBLOAT 162 163 if (!olsr_cnf->host_emul) { 163 164 int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_delroute_function(rt) : olsr_delroute6_function(rt); 164 165 … … 170 171 olsr_syslog(OLSR_LOG_ERR, "Delete route %s: %s", routestr, err_msg); 171 172 } 172 173 } 174 #else /* SVEN_OLA_UNBLOAT */ 175 int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_delroute_function(rt) : olsr_delroute6_function(rt); 176 if (0 > error) { 177 olsr_syslog(OLSR_LOG_ERR, "Delete route: %s", strerror(errno)); 178 } 179 #endif /* SVEN_OLA_UNBLOAT */ 173 180 } 174 181 175 182 /** … … 181 188 olsr_add_kernel_route(struct rt_entry *rt) 182 189 { 183 190 191 #ifndef SVEN_OLA_UNBLOAT 184 192 if (!olsr_cnf->host_emul) { 185 193 int16_t error = (olsr_cnf->ip_version == AF_INET) ? olsr_addroute_function(rt) : olsr_addroute6_function(rt); 186 194 … … 199 207 rt->rt_metric = rt->rt_best->rtp_metric; 200 208 } 201 209 } 210 #else /* SVEN_OLA_UNBLOAT */ 211 int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_addroute_function(rt) : olsr_addroute6_function(rt); 212 if (0 > error) { 213 olsr_syslog(OLSR_LOG_ERR, "Add route: %s", strerror(errno)); 214 } else { 215 rt->rt_nexthop = rt->rt_best->rtp_nexthop; 216 } 217 #endif /* SVEN_OLA_UNBLOAT */ 202 218 } 203 219 204 220 /** … … 385 401 /* route additions */ 386 402 olsr_add_kernel_routes(&add_kernel_list); 387 403 388 #if DEBUG404 #ifdef DEBUG 389 405 olsr_print_routing_table(&routingtree); 390 406 #endif 391 407 } -
src/rebuild_packet.c
diff -ur olsrd-0.5.6-r4.orig/src/rebuild_packet.c olsrd-0.5.6-r4/src/rebuild_packet.c
old new 60 60 mid_chgestruct(struct mid_message *mmsg, const union olsr_message *m) 61 61 { 62 62 int i; 63 #ifndef SVEN_OLA_UNBLOAT 63 64 struct mid_alias *alias, *alias_tmp; 65 #else /* SVEN_OLA_UNBLOAT */ 66 struct mid_alias *alias; 67 #endif /* SVEN_OLA_UNBLOAT */ 64 68 int no_aliases; 65 69 66 70 /* Checking if everything is ok */ … … 100 104 maddr++; 101 105 } 102 106 107 #ifndef SVEN_OLA_UNBLOAT 103 108 if (olsr_cnf->debug_level > 1) { 104 109 struct ipaddr_str buf; 105 110 OLSR_PRINTF(3, "Alias list for %s: ", olsr_ip_to_string(&buf, &mmsg->mid_origaddr)); … … 111 116 } 112 117 OLSR_PRINTF(3, "\n"); 113 118 } 119 #endif /* SVEN_OLA_UNBLOAT */ 114 120 } else { 115 121 /* IPv6 */ 116 122 const struct midaddr6 *maddr6 = m->v6.message.mid.mid_addr; … … 144 150 maddr6++; 145 151 } 146 152 153 #ifndef SVEN_OLA_UNBLOAT 147 154 if (olsr_cnf->debug_level > 1) { 148 155 struct ipaddr_str buf; 149 156 OLSR_PRINTF(3, "Alias list for %s", ip6_to_string(&buf, &mmsg->mid_origaddr.v6)); … … 156 163 } 157 164 OLSR_PRINTF(3, "\n"); 158 165 } 166 #endif /* SVEN_OLA_UNBLOAT */ 159 167 } 160 168 161 169 } -
src/routing_table.c
diff -ur olsrd-0.5.6-r4.orig/src/routing_table.c olsrd-0.5.6-r4/src/routing_table.c
old new 628 628 /** 629 629 * format a route entry into a buffer 630 630 */ 631 #ifndef SVEN_OLA_UNBLOAT 631 632 char * 632 633 olsr_rt_to_string(const struct rt_entry *rt) 633 634 { … … 659 660 660 661 return buff; 661 662 } 663 #endif /* SVEN_OLA_UNBLOAT */ 662 664 663 665 /** 664 666 * Print the routingtree to STDOUT 665 667 * 666 668 */ 669 #ifndef SVEN_OLA_UNBLOAT 667 670 void 668 671 olsr_print_routing_table(struct avl_tree *tree) 669 672 { … … 697 700 #endif 698 701 tree = NULL; /* squelch compiler warnings */ 699 702 } 703 #endif /* SVEN_OLA_UNBLOAT */ 700 704 701 705 /* 702 706 * Local Variables: -
src/routing_table.h
diff -ur olsrd-0.5.6-r4.orig/src/routing_table.h olsrd-0.5.6-r4/src/routing_table.h
old new 210 210 bool olsr_cmp_rt(const struct rt_entry *, const struct rt_entry *); 211 211 uint8_t olsr_fib_metric(const struct rt_metric *); 212 212 213 #ifndef SVEN_OLA_UNBLOAT 213 214 char *olsr_rt_to_string(const struct rt_entry *); 214 215 char *olsr_rtp_to_string(const struct rt_path *); 215 216 void olsr_print_routing_table(struct avl_tree *); 217 #endif /* SVEN_OLA_UNBLOAT */ 216 218 217 219 const struct rt_nexthop *olsr_get_nh(const struct rt_entry *); 218 220 -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/tc_set.c olsrd-0.5.6-r4/src/tc_set.c
old new 336 336 /** 337 337 * Format tc_edge contents into a buffer. 338 338 */ 339 #ifndef SVEN_OLA_UNBLOAT 339 340 char * 340 341 olsr_tc_edge_to_string(struct tc_edge_entry *tc_edge) 341 342 { … … 350 351 351 352 return buf; 352 353 } 354 #endif /* SVEN_OLA_UNBLOAT */ 353 355 354 356 /** 355 357 * Wrapper for the timer callback. … … 686 688 /** 687 689 * Print the topology table to stdout 688 690 */ 691 #ifndef SVEN_OLA_UNBLOAT 689 692 void 690 693 olsr_print_tc_table(void) 691 694 { … … 711 714 } OLSR_FOR_ALL_TC_ENTRIES_END(tc); 712 715 #endif 713 716 } 717 #endif /* SVEN_OLA_UNBLOAT */ 714 718 715 719 /* 716 720 * calculate the border IPs of a tc edge set according to the border flags -
olsrd-0.5.6-r4
diff -ur olsrd-0.5.6-r4.orig/src/tc_set.h olsrd-0.5.6-r4/src/tc_set.h
old new 157 157 158 158 /* tc_edge_entry manipulation */ 159 159 bool olsr_delete_outdated_tc_edges(struct tc_entry *); 160 #ifndef SVEN_OLA_UNBLOAT 160 161 char *olsr_tc_edge_to_string(struct tc_edge_entry *); 162 #endif /* SVEN_OLA_UNBLOAT */ 161 163 struct tc_edge_entry *olsr_lookup_tc_edge(struct tc_entry *, union olsr_ip_addr *); 162 164 struct tc_edge_entry *olsr_add_tc_edge_entry(struct tc_entry *, union olsr_ip_addr *, uint16_t); 163 165 void olsr_delete_tc_entry(struct tc_entry *); -
src/two_hop_neighbor_table.c
diff -ur olsrd-0.5.6-r4.orig/src/two_hop_neighbor_table.c olsrd-0.5.6-r4/src/two_hop_neighbor_table.c
old new 203 203 return NULL; 204 204 } 205 205 206 #ifndef SVEN_OLA_UNBLOAT 207 206 208 /** 207 209 *Print the two hop neighbor table to STDOUT. 208 210 * … … 240 242 } 241 243 #endif 242 244 } 245 #endif /* SVEN_OLA_UNBLOAT */ 243 246 244 247 /* 245 248 * Local Variables: -
src/unix/ifnet.c
diff -ur olsrd-0.5.6-r4.orig/src/unix/ifnet.c olsrd-0.5.6-r4/src/unix/ifnet.c
old new 70 70 71 71 #define BUFSPACE (127*1024) /* max. input buffer size to request */ 72 72 73 #ifndef SVEN_OLA_UNBLOAT 74 73 75 int 74 76 set_flag(char *ifname, short flag __attribute__ ((unused))) 75 77 { … … 100 102 101 103 } 102 104 105 #endif /* SVEN_OLA_UNBLOAT */ 106 103 107 void 104 108 check_interface_updates(void *foo __attribute__ ((unused))) 105 109 { … … 110 114 #endif 111 115 112 116 for (tmp_if = olsr_cnf->interfaces; tmp_if != NULL; tmp_if = tmp_if->next) { 117 #ifndef SVEN_OLA_UNBLOAT 113 118 if (tmp_if->host_emul) 114 119 continue; 115 120 116 121 if (olsr_cnf->host_emul) /* XXX: TEMPORARY! */ 117 122 continue; 123 #endif /* SVEN_OLA_UNBLOAT */ 118 124 119 125 if (!tmp_if->cnf->autodetect_chg) { 120 126 #ifdef DEBUG … … 154 160 OLSR_PRINTF(3, "Checking if %s is set down or changed\n", iface->name); 155 161 #endif 156 162 163 #ifndef SVEN_OLA_UNBLOAT 157 164 if (iface->host_emul) 158 165 return -1; 166 #endif /* SVEN_OLA_UNBLOAT */ 159 167 160 168 ifp = iface->interf; 161 169 … … 281 289 } else 282 290 /* IP version 4 */ 283 291 { 292 #ifndef SVEN_OLA_UNBLOAT 284 293 struct ipaddr_str buf; 294 #endif /* SVEN_OLA_UNBLOAT */ 285 295 /* Check interface address (IPv4) */ 286 296 if (ioctl(olsr_cnf->ioctl_s, SIOCGIFADDR, &ifr) < 0) { 287 297 OLSR_PRINTF(1, "\tCould not get address of interface - removing it\n"); … … 294 304 if (memcmp 295 305 (&((struct sockaddr_in *)&ifp->int_addr)->sin_addr.s_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, 296 306 olsr_cnf->ipsize) != 0) { 307 #ifndef SVEN_OLA_UNBLOAT 297 308 /* New address */ 298 309 OLSR_PRINTF(1, "IPv4 address changed for %s\n", ifr.ifr_name); 299 310 OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_addr.sin_addr)); 300 311 OLSR_PRINTF(1, "\tNew:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); 312 #endif /* SVEN_OLA_UNBLOAT */ 301 313 302 314 ifp->int_addr = *(struct sockaddr_in *)&ifr.ifr_addr; 303 315 /* deactivated to prevent change of originator IP */ 304 316 #if 0 305 317 if (memcmp(&olsr_cnf->main_addr, &ifp->ip_addr, olsr_cnf->ipsize) == 0) { 306 318 OLSR_PRINTF(1, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); 319 #ifndef SVEN_OLA_UNBLOAT 307 320 olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); 321 #endif /* SVEN_OLA_UNBLOAT */ 308 322 memcpy(&olsr_cnf->main_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, olsr_cnf->ipsize); 309 323 } 310 324 #endif … … 366 380 367 381 remove_interface: 368 382 OLSR_PRINTF(1, "Removing interface %s\n", iface->name); 383 #ifndef SVEN_OLA_UNBLOAT 369 384 olsr_syslog(OLSR_LOG_INFO, "Removing interface %s\n", iface->name); 385 #endif /* SVEN_OLA_UNBLOAT */ 370 386 371 387 olsr_delete_link_entry_by_ip(&ifp->ip_addr); 372 388 … … 398 414 memset(&olsr_cnf->main_addr, 0, olsr_cnf->ipsize); 399 415 OLSR_PRINTF(1, "No more interfaces...\n"); 400 416 } else { 417 #if !defined(SVEN_OLA_UNBLOAT) 401 418 struct ipaddr_str buf; 419 #endif /* SVEN_OLA_UNBLOAT */ 402 420 olsr_cnf->main_addr = ifnet->ip_addr; 403 421 OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); 422 #ifndef SVEN_OLA_UNBLOAT 404 423 olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); 424 #endif /* SVEN_OLA_UNBLOAT */ 405 425 } 406 426 } 407 427 #endif … … 425 445 426 446 if ((ifnet == NULL) && (!olsr_cnf->allow_no_interfaces)) { 427 447 OLSR_PRINTF(1, "No more active interfaces - exiting.\n"); 448 #ifndef SVEN_OLA_UNBLOAT 428 449 olsr_syslog(OLSR_LOG_INFO, "No more active interfaces - exiting.\n"); 450 #endif /* SVEN_OLA_UNBLOAT */ 429 451 olsr_cnf->exit_value = EXIT_FAILURE; 430 452 kill(getpid(), SIGINT); 431 453 } … … 434 456 435 457 } 436 458 459 #ifndef SVEN_OLA_UNBLOAT 460 437 461 /** 438 462 * Initializes the special interface used in 439 463 * host-client emulation … … 583 607 584 608 return 1; 585 609 } 610 #endif /* SVEN_OLA_UNBLOAT */ 586 611 587 612 static char basenamestr[32]; 588 613 static const char *if_basename(const char *name); … … 618 643 int tos_bits = IPTOS_TOS(olsr_cnf->tos); 619 644 #endif 620 645 646 #ifndef SVEN_OLA_UNBLOAT 621 647 if (iface->host_emul) 622 648 return -1; 649 #endif /* SVEN_OLA_UNBLOAT */ 623 650 624 651 memset(&ifr, 0, sizeof(struct ifreq)); 625 652 memset(&ifs, 0, sizeof(struct interface)); … … 726 753 ifs.int_broadaddr = *(struct sockaddr_in *)&ifr.ifr_broadaddr; 727 754 } 728 755 756 #ifndef SVEN_OLA_UNBLOAT 729 757 /* Deactivate IP spoof filter */ 730 758 deactivate_spoof(if_basename(ifr.ifr_name), &ifs, olsr_cnf->ip_version); 731 759 732 760 /* Disable ICMP redirects */ 733 761 disable_redirects(if_basename(ifr.ifr_name), &ifs, olsr_cnf->ip_version); 762 #endif /* SVEN_OLA_UNBLOAT */ 734 763 735 764 } 736 765 … … 760 789 761 790 OLSR_PRINTF(1, "\tMTU - IPhdr: %d\n", ifs.int_mtu); 762 791 792 #ifndef SVEN_OLA_UNBLOAT 763 793 olsr_syslog(OLSR_LOG_INFO, "Adding interface %s\n", iface->name); 794 #endif /* SVEN_OLA_UNBLOAT */ 764 795 OLSR_PRINTF(1, "\tIndex %d\n", ifs.if_index); 765 796 766 797 if (olsr_cnf->ip_version == AF_INET) { … … 865 896 */ 866 897 memset(&null_addr, 0, olsr_cnf->ipsize); 867 898 if (ipequal(&null_addr, &olsr_cnf->main_addr)) { 899 #ifndef SVEN_OLA_UNBLOAT 868 900 struct ipaddr_str buf; 901 #endif 869 902 olsr_cnf->main_addr = ifp->ip_addr; 903 #ifndef SVEN_OLA_UNBLOAT 870 904 OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); 871 905 olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); 906 #endif /* SVEN_OLA_UNBLOAT */ 872 907 } 873 908 874 909 /* -
src/unix/misc.c
diff -ur olsrd-0.5.6-r4.orig/src/unix/misc.c olsrd-0.5.6-r4/src/unix/misc.c
old new 44 44 #include "misc.h" 45 45 #include "olsr_types.h" 46 46 47 #ifndef SVEN_OLA_UNBLOAT 47 48 void 48 49 clear_console(void) 49 50 { … … 69 70 70 71 fflush(stdout); 71 72 } 73 #endif /* SVEN_OLA_UNBLOAT */ 72 74 73 75 /* 74 76 * Local Variables:
Note: See TracBrowser
for help on using the browser.
