--- a/Makefile.inc +++ b/Makefile.inc @@ -207,6 +207,10 @@ $(warning Use CPPFLAGS instead of DEFINES for -D) endif +ifeq ($(SVEN_OLA_UNBLOAT),1) +CPPFLAGS += -DSVEN_OLA_UNBLOAT -DNODEBUG +endif + TAGFILE ?= src/TAGS help: --- a/lib/bmf/src/NetworkInterfaces.c +++ b/lib/bmf/src/NetworkInterfaces.c @@ -541,7 +541,9 @@ OLSR_PRINTF(9, "%s: ----> Not forwarding to %s: no link found\n", PLUGIN_NAME_SHORT, olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); } else { +#ifndef DEBUG struct interface *bestIntf = if_ifwithaddr(&bestLinkToNeighbor->local_iface_addr); +#endif OLSR_PRINTF(9, "%s: ----> Not forwarding to %s: \"%s\" gives a better link to this neighbor, costing %5.2f\n", PLUGIN_NAME_SHORT, olsr_ip_to_string(&buf, &walker->neighbor_iface_addr), bestIntf->int_name, --- a/lib/httpinfo/Makefile +++ b/lib/httpinfo/Makefile @@ -47,7 +47,11 @@ CPPFLAGS += -DADMIN_INTERFACE endif +ifdef SVEN_OLA_UNBLOAT + CFLAGS += -DSVEN_OLA +else OBJS += $(TOPDIR)/src/cfgparser/cfgfile_gen.o +endif default_target: $(PLUGIN_FULLNAME) ifdef ADMIN_INTERFACE --- a/lib/httpinfo/src/olsrd_httpinfo.c +++ b/lib/httpinfo/src/olsrd_httpinfo.c @@ -67,7 +67,9 @@ #include "olsrd_httpinfo.h" #include "admin_interface.h" +#ifndef SVEN_OLA_UNBLOAT #include "gfx.h" +#endif /* SVEN_OLA_UNBLOAT */ #ifdef OS #undef OS @@ -222,10 +224,13 @@ {"Admin", "admin", build_admin_body, true}, #endif {"About", "about", build_about_body, true}, +#ifndef SVEN_OLA_UNBLOAT {"FOO", "cfgfile", build_cfgfile_body, false}, +#endif /* SVEN_OLA_UNBLOAT */ {NULL, NULL, NULL, false} }; +#ifndef SVEN_OLA_UNBLOAT static const struct static_bin_file_entry static_bin_files[] = { {"favicon.ico", favicon_ico, sizeof(favicon_ico)} , @@ -235,6 +240,7 @@ , {NULL, NULL, 0} }; +#endif /* SVEN_OLA_UNBLOAT */ static const struct static_txt_file_entry static_txt_files[] = { {"httpinfo.css", httpinfo_css}, @@ -428,6 +434,7 @@ } else if (!strcmp(req_type, "GET")) { int i = 0; +#ifndef SVEN_OLA_UNBLOAT for (i = 0; static_bin_files[i].filename; i++) { if (FILENREQ_MATCH(filename, static_bin_files[i].filename)) { break; @@ -442,6 +449,7 @@ } i = 0; +#endif /* SVEN_OLA_UNBLOAT */ while (static_txt_files[i].filename) { if (FILENREQ_MATCH(filename, static_txt_files[i].filename)) { break; @@ -480,16 +488,22 @@ abuf_appendf(&body_abuf, "\n" "\n" "\n" - "olsr.org httpinfo plugin\n" "\n" + "olsr.org httpinfo plugin\n" +#ifndef SVEN_OLA_UNBLOAT + "\n" "\n" +#endif /* SVEN_OLA_UNBLOAT */ "\n" "\n" "\n" +#ifndef SVEN_OLA_UNBLOAT "\n" "\n" "\n" "\n" "\n" - "\n" "
\n" "   olsr.org OLSR daemon\n" "\"olsrd
\n", FRAMEWIDTH); + "\n" "\n", FRAMEWIDTH +#endif /* SVEN_OLA_UNBLOAT */ + ); build_tabs(&body_abuf, i); build_frame(&body_abuf, "Current Routes", "routes", FRAMEWIDTH, tab_entries[i].build_body_cb); @@ -894,7 +908,7 @@ abuf_puts(abuf, "Status: DOWN\n"); continue; } - +#ifndef SVEN_OLA_UNBLOAT if (olsr_cnf->ip_version == AF_INET) { struct ipaddr_str addrbuf, maskbuf, bcastbuf; abuf_appendf(abuf, "\n" "IP: %s\n" "MASK: %s\n" "BCAST: %s\n" "\n", @@ -905,6 +919,7 @@ abuf_appendf(abuf, "\n" "IP: %s\n" "MCAST: %s\n" "\n" "\n", ip6_to_string(&addrbuf, &rifs->int6_addr.sin6_addr), ip6_to_string(&maskbuf, &rifs->int6_multaddr.sin6_addr)); } +#endif /* SVEN_OLA_UNBLOAT */ abuf_appendf(abuf, "\n" "MTU: %d\n" "WLAN: %s\n" "STATUS: UP\n" "\n", rifs->int_mtu, rifs->is_wireless ? "Yes" : "No"); } @@ -1155,6 +1170,7 @@ #endif } +#ifndef SVEN_OLA_UNBLOAT static int check_allowed_ip(const struct allowed_net *const my_allowed_nets, const union olsr_ip_addr *const addr) { @@ -1166,6 +1182,7 @@ } return 0; } +#endif /* SVEN_OLA_UNBLOAT */ #if 0 --- a/lib/nameservice/src/nameservice.c +++ b/lib/nameservice/src/nameservice.c @@ -67,6 +67,11 @@ #include "mapwrite.h" #include "compat.h" +#ifdef SVEN_OLA_UNBLOAT +#undef OLSR_PRINTF +#define OLSR_PRINTF(...) +#endif /* SVEN_OLA_UNBLOAT */ + /* config parameters */ static char my_hosts_file[MAX_FILE + 1]; static char my_sighup_pid_file[MAX_FILE + 1]; @@ -383,6 +388,7 @@ name->ip = olsr_cnf->main_addr; } } + for (name = my_forwarders; name != NULL; name = name->next) { if (name->ip.v4.s_addr == 0) { OLSR_PRINTF(2, "NAME PLUGIN: insert main addr for name %s \n", name->name); @@ -903,9 +909,11 @@ pos += sizeof(struct name); pos += 1 + ((ntohs(from_packet->len) - 1) | 3); } +#ifdef DEBUG if (i != 0) OLSR_PRINTF(4, "NAME PLUGIN: Lost %d entries in received packet due to length inconsistency (%s)\n", i, olsr_ip_to_string(&strbuf, originator)); +#endif } /** --- a/src/apm.h +++ b/src/apm.h @@ -41,6 +41,7 @@ #ifndef _OLSR_APM #define _OLSR_APM +#ifndef SVEN_OLA_UNBLOAT /* * Interface to OS dependent power management information @@ -69,6 +70,7 @@ int apm_read(struct olsr_apm_info *); #endif +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/cfgparser/cfgfile_gen.c +++ b/src/cfgparser/cfgfile_gen.c @@ -57,7 +57,9 @@ struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; struct plugin_param *pp; +#ifndef SVEN_OLA_UNBLOAT struct ip_prefix_list *ie = cnf->ipc_nets; +#endif /* SVEN_OLA_UNBLOAT */ struct olsr_lq_mult *mult; char ipv6_buf[100]; /* buffer for IPv6 inet_htop */ @@ -133,6 +135,7 @@ else fprintf(fd, "Willingness\t%d\n\n", cnf->willingness); +#ifndef SVEN_OLA_UNBLOAT /* IPC */ fprintf(fd, "# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n"); fprintf(fd, "IpcConnect {\n"); @@ -149,6 +152,7 @@ } fprintf(fd, "}\n\n"); +#endif /* SVEN_OLA_UNBLOAT */ /* Hysteresis */ fprintf(fd, "# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n"); @@ -367,7 +371,9 @@ struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; struct plugin_param *pp; +#ifndef SVEN_OLA_UNBLOAT struct ip_prefix_list *ie = cnf->ipc_nets; +#endif /* SVEN_OLA_UNBLOAT */ struct olsr_lq_mult *mult; int size = 0; @@ -434,6 +440,7 @@ else WRITE_TO_BUF("Willingness\t%d\n\n", cnf->willingness); +#ifndef SVEN_OLA_UNBLOAT /* IPC */ WRITE_TO_BUF("# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n"); WRITE_TO_BUF("IpcConnect {\n"); @@ -449,6 +456,7 @@ } WRITE_TO_BUF("}\n\n"); +#endif /* SVEN_OLA_UNBLOAT */ /* Hysteresis */ WRITE_TO_BUF("# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n"); --- a/src/cfgparser/local.mk +++ b/src/cfgparser/local.mk @@ -41,8 +41,13 @@ C=$(if $(CFGDIR),$(CFGDIR)/) # add the variables as we may have others already there +ifeq ($(SVEN_OLA_UNBLOAT),1) +SRCS += $(foreach file,olsrd_conf oparse oscan,$(C)$(file).c) +OBJS += $(foreach file,olsrd_conf oparse oscan,$(C)$(file).o) +else SRCS += $(foreach file,olsrd_conf oparse oscan cfgfile_gen,$(C)$(file).c) OBJS += $(foreach file,olsrd_conf oparse oscan cfgfile_gen,$(C)$(file).o) +endif HDRS += $(foreach file,olsrd_conf oparse,$(C)$(file).h) $(C)oscan.c: $(C)oscan.lex $(C)Makefile --- a/src/cfgparser/olsrd_conf.c +++ b/src/cfgparser/olsrd_conf.c @@ -81,11 +81,13 @@ } if ((cnf = olsrd_parse_cnf(argv[1])) != NULL) { +#ifndef SVEN_OLA_UNBLOAT if ((argc > 2) && (!strcmp(argv[2], "-print"))) { olsrd_print_cnf(cnf); olsrd_write_cnf(cnf, "./out.conf"); } else printf("Use -print to view parsed values\n"); +#endif /* SVEN_OLA_UNBLOAT */ printf("Configfile parsed OK\n"); } else { printf("Failed parsing \"%s\"\n", argv[1]); @@ -152,7 +154,9 @@ /* set various stuff */ in->configured = false; in->interf = NULL; +#ifndef SVEN_OLA_UNBLOAT in->host_emul = false; +#endif /* SVEN_OLA_UNBLOAT */ } return olsr_cnf; } @@ -416,7 +420,9 @@ cnf->debug_level = DEF_DEBUGLVL; cnf->no_fork = false; +#ifndef SVEN_OLA_UNBLOAT cnf->host_emul = false; +#endif /* SVEN_OLA_UNBLOAT */ cnf->ip_version = AF_INET; cnf->ipsize = sizeof(struct in_addr); cnf->maxplen = 32; @@ -427,7 +433,9 @@ cnf->rtproto = DEF_RTPROTO; cnf->rttable_default = 0; cnf->willingness_auto = DEF_WILL_AUTO; +#ifndef SVEN_OLA_UNBLOAT cnf->ipc_connections = DEF_IPC_CONNECTIONS; +#endif /* SVEN_OLA_UNBLOAT */ cnf->fib_metric = DEF_FIB_METRIC; cnf->use_hysteresis = DEF_USE_HYST; @@ -506,6 +514,7 @@ } +#ifndef SVEN_OLA_UNBLOAT void olsrd_print_cnf(struct olsrd_config *cnf) { @@ -649,6 +658,7 @@ } } } +#endif /* SVEN_OLA_UNBLOAT */ #if defined WIN32 struct ioinfo { --- a/src/cfgparser/oparse.y +++ b/src/cfgparser/oparse.y @@ -178,7 +178,6 @@ %token TOK_RTPROTO %token TOK_RTTABLE_DEFAULT %token TOK_WILLINGNESS -%token TOK_IPCCON %token TOK_FIBMETRIC %token TOK_USEHYST %token TOK_HYSTSCALE @@ -203,7 +202,6 @@ %token TOK_HOSTLABEL %token TOK_NETLABEL -%token TOK_MAXIPC %token TOK_IP4BROADCAST %token TOK_IFMODE @@ -267,7 +265,6 @@ block: TOK_HNA4 hna4body | TOK_HNA6 hna6body - | TOK_IPCCON ipcbody | ifblock ifbody | plblock plbody ; @@ -292,18 +289,6 @@ | ihna6entry ; -ipcbody: TOK_OPEN ipcstmts TOK_CLOSE -; - -ipcstmts: | ipcstmts ipcstmt -; - -ipcstmt: vcomment - | imaxipc - | ipchost - | ipcnet -; - ifblock: ifstart ifnicks ; @@ -345,77 +330,6 @@ | vcomment ; -imaxipc: TOK_MAXIPC TOK_INTEGER -{ - olsr_cnf->ipc_connections = $2->integer; - free($2); -} -; - -ipchost: TOK_HOSTLABEL TOK_IP4_ADDR -{ - union olsr_ip_addr ipaddr; - PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string); - - if (inet_aton($2->string, &ipaddr.v4) == 0) { - fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string); - YYABORT; - } - - ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_cnf->maxplen); - - free($2->string); - free($2); -} -; - -ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR -{ - union olsr_ip_addr ipaddr, netmask; - - PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string); - - if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) { - fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string); - YYABORT; - } - - if (inet_pton(AF_INET, $3->string, &netmask.v4) == 0) { - fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string); - YYABORT; - } - - ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_netmask_to_prefix(&netmask)); - - free($2->string); - free($2); - free($3->string); - free($3); -} - | TOK_NETLABEL TOK_IP4_ADDR TOK_SLASH TOK_INTEGER -{ - union olsr_ip_addr ipaddr; - - PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string); - - if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) { - fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string); - YYABORT; - } - - if ($4->integer > olsr_cnf->maxplen) { - fprintf(stderr, "ipcnet: Prefix len %u > %d is not allowed!\n", $4->integer, olsr_cnf->maxplen); - YYABORT; - } - - ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, $4->integer); - - free($2->string); - free($2); - free($4); -} -; - iifweight: TOK_IFWEIGHT TOK_INTEGER { int ifcnt = ifs_in_curr_cfg; --- a/src/cfgparser/oscan.lex +++ b/src/cfgparser/oscan.lex @@ -252,11 +252,6 @@ return TOK_NETLABEL; } -"MaxConnections" { - yylval = NULL; - return TOK_MAXIPC; -} - "DebugLevel" { yylval = NULL; return TOK_DEBUGLEVEL; @@ -333,11 +328,6 @@ return TOK_WILLINGNESS; } -"IpcConnect" { - yylval = NULL; - return TOK_IPCCON; -} - "FIBMetric" { yylval = NULL; return TOK_FIBMETRIC; --- a/src/defs.h +++ b/src/defs.h @@ -189,6 +189,8 @@ uint32_t olsr_times(void); +#ifndef SVEN_OLA_UNBLOAT + /* *IPC functions *These are moved to a plugin soon @@ -206,6 +208,7 @@ int ipc_output(struct olsr *); #endif +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/duplicate_set.c +++ b/src/duplicate_set.c @@ -177,6 +177,7 @@ return false; /* no duplicate */ } +#ifndef SVEN_OLA_UNBLOAT void olsr_print_duplicate_table(void) { @@ -195,6 +196,7 @@ } OLSR_FOR_ALL_DUP_ENTRIES_END(entry); #endif } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/hna_set.c +++ b/src/hna_set.c @@ -280,6 +280,7 @@ * *@return nada */ +#ifndef SVEN_OLA_UNBLOAT void olsr_print_hna_set(void) { @@ -321,6 +322,7 @@ } #endif } +#endif /* SVEN_OLA_UNBLOAT */ /** *Process incoming HNA message. --- a/src/interfaces.c +++ b/src/interfaces.c @@ -93,12 +93,16 @@ OLSR_PRINTF(1, "\n ---- Interface configuration ---- \n\n"); /* Run trough all interfaces immedeatly */ for (tmp_if = olsr_cnf->interfaces; tmp_if != NULL; tmp_if = tmp_if->next) { +#ifndef SVEN_OLA_UNBLOAT if (!tmp_if->host_emul) { if (!olsr_cnf->host_emul) /* XXX: TEMPORARY! */ +#endif /* SVEN_OLA_UNBLOAT */ chk_if_up(tmp_if, 1); +#ifndef SVEN_OLA_UNBLOAT } else { add_hemu_if(tmp_if); } +#endif /* SVEN_OLA_UNBLOAT */ } /* Kick a periodic timer for the network interface update function */ @@ -244,7 +248,11 @@ *@return nada */ struct olsr_if * +#ifdef SVEN_OLA_UNBLOAT +queue_if(const char *name) +#else /* SVEN_OLA_UNBLOAT */ queue_if(const char *name, int hemu) +#endif /* SVEN_OLA_UNBLOAT */ { struct olsr_if *interf_n = olsr_cnf->interfaces; size_t name_size; @@ -268,7 +276,9 @@ interf_n->interf = NULL; interf_n->configured = 0; +#ifndef SVEN_OLA_UNBLOAT interf_n->host_emul = hemu ? true : false; +#endif /* SVEN_OLA_UNBLOAT */ strscpy(interf_n->name, name, name_size); interf_n->next = olsr_cnf->interfaces; --- a/src/interfaces.h +++ b/src/interfaces.h @@ -200,7 +200,12 @@ struct interface *if_ifwithindex(const int if_index); -struct olsr_if *queue_if(const char *, int); +struct olsr_if * +#ifdef SVEN_OLA_UNBLOAT + queue_if(const char *); +#else /* SVEN_OLA_UNBLOAT */ + queue_if(const char *, int); +#endif /* SVEN_OLA_UNBLOAT */ int add_ifchgf(int (*f) (struct interface *, int)); --- a/src/ipc_frontend.c +++ b/src/ipc_frontend.c @@ -46,6 +46,7 @@ * */ +#ifndef SVEN_OLA_UNBLOAT #include "ipc_frontend.h" #include "link_set.h" #include "olsr.h" @@ -423,6 +424,7 @@ return 1; } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/ipc_frontend.h +++ b/src/ipc_frontend.h @@ -48,6 +48,7 @@ #ifndef _OLSR_IPC #define _OLSR_IPC +#ifndef SVEN_OLA_UNBLOAT #include #include @@ -103,6 +104,7 @@ int ipc_route_send_rtentry(const union olsr_ip_addr *, const union olsr_ip_addr *, int, int, const char *); #endif +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/ipcalc.c +++ b/src/ipcalc.c @@ -121,6 +121,7 @@ return prefix; } +#ifndef SVEN_OLA_UNBLOAT const char * olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix) { @@ -147,6 +148,7 @@ } return rv; } +#endif /* SVEN_OLA_UNBLOAT */ /* see if the ipaddr is in the net. That is equivalent to the fact that the net part * of both are equal. So we must compare the first bits. --- a/src/ipcalc.h +++ b/src/ipcalc.h @@ -146,7 +146,9 @@ return inet_ntop(olsr_cnf->ip_version, addr, buf->buf, sizeof(buf->buf)); } +#ifndef SVEN_OLA_UNBLOAT const char *olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix); +#endif /* SVEN_OLA_UNBLOAT */ static INLINE const char * sockaddr4_to_string(struct ipaddr_str *const buf, const struct sockaddr *const addr) --- a/src/link_set.c +++ b/src/link_set.c @@ -770,6 +770,7 @@ return ret; } +#ifndef SVEN_OLA_UNBLOAT void olsr_print_link_set(void) { @@ -791,6 +792,7 @@ } OLSR_FOR_ALL_LINK_ENTRIES_END(walker); #endif } +#endif /* SVEN_OLA_UNBLOAT */ /* * called for every LQ HELLO message. --- a/src/linux/apm.c +++ b/src/linux/apm.c @@ -44,6 +44,7 @@ * Acpi-Power Enlightenment epplet */ +#ifndef SVEN_OLA_UNBLOAT #include "apm.h" #include "defs.h" #include @@ -348,6 +349,7 @@ /* No battery found */ return -1; } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/linux/kernel_routes.c +++ b/src/linux/kernel_routes.c @@ -486,7 +486,11 @@ } /* send ipc update on success */ if ( ( cmd != RTM_NEWRULE ) && ( cmd != RTM_DELRULE ) - && (flag = RT_ORIG_REQUEST) && (0 <= rt_ret && olsr_cnf->ipc_connections > 0) ) { + && (flag = RT_ORIG_REQUEST) && (0 <= rt_ret +#ifndef SVEN_OLA_UNBLOAT + && olsr_cnf->ipc_connections > 0 +#endif /* SVEN_OLA_UNBLOAT */ + ) ) { ipc_route_send_rtentry(&rt->rt_dst.prefix, &nexthop->gateway, metric, RTM_NEWROUTE == cmd, if_ifwithindex_name(nexthop->iif_index)); } @@ -528,7 +532,9 @@ int rslt; #endif /* LINUX_POLICY_ROUTING */ +#ifndef SVEN_OLA_UNBLOAT OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); +#endif /* SVEN_OLA_UNBLOAT */ #if !LINUX_POLICY_ROUTING memset(&kernel_route, 0, sizeof(struct rtentry)); @@ -604,7 +610,9 @@ struct in6_rtmsg kernel_route; int rslt; +#ifndef SVEN_OLA_UNBLOAT OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); +#endif /* SVEN_OLA_UNBLOAT */ memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); @@ -658,7 +666,9 @@ int rslt; #endif /* LINUX_POLICY_ROUTING */ +#ifndef SVEN_OLA_UNBLOAT OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); +#endif /* SVEN_OLA_UNBLOAT */ #if !LINUX_POLICY_ROUTING memset(&kernel_route, 0, sizeof(struct rtentry)); @@ -727,7 +737,9 @@ int rslt; #endif /* LINUX_POLICY_ROUTING */ +#ifndef SVEN_OLA_UNBLOAT OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); +#endif /* SVEN_OLA_UNBLOAT */ #if !LINUX_POLICY_ROUTING memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); --- a/src/linux/net.c +++ b/src/linux/net.c @@ -70,8 +70,10 @@ #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ /* The original state of the IP forwarding proc entry */ +#ifndef SVEN_OLA_UNBLOAT static char orig_fwd_state; static char orig_global_redirect_state; +#endif /* SVEN_OLA_UNBLOAT */ /** *Bind a socket to a device @@ -92,6 +94,8 @@ return setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, dev_name, strlen(dev_name) + 1); } +#ifndef SVEN_OLA_UNBLOAT + /** *Enable IP forwarding. *Just writing "1" to the /proc/sys/net/ipv4/ip_forward @@ -111,6 +115,9 @@ const char *const procfile = version == AF_INET ? "/proc/sys/net/ipv4/ip_forward" : "/proc/sys/net/ipv6/conf/all/forwarding"; if ((proc_fwd = fopen(procfile, "r")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else /* IPv4 */ if (version == AF_INET) fprintf(stderr, @@ -123,6 +130,7 @@ procfile); sleep(3); +#endif return 0; } @@ -132,9 +140,13 @@ OLSR_PRINTF(3, "\nIP forwarding is enabled on this system\n"); } else { if ((proc_fwd = fopen(procfile, "w")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "Could not open %s for writing!\n", procfile); fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that IP forwarding is enabeled!\n\n"); sleep(3); +#endif return 0; } else { syslog(LOG_INFO, "Writing \"1\" to %s\n", procfile); @@ -155,11 +167,15 @@ return -1; if ((proc_redirect = fopen(procfile, "r")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "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", procfile); sleep(3); +#endif return -1; } orig_global_redirect_state = fgetc(proc_redirect); @@ -169,9 +185,13 @@ return 0; if ((proc_redirect = fopen(procfile, "w")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "Could not open %s for writing!\n", procfile); fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that ICMP redirect is disabeled!\n\n"); sleep(3); +#endif return 0; } syslog(LOG_INFO, "Writing \"0\" to %s", procfile); @@ -197,19 +217,27 @@ snprintf(procfile, sizeof(procfile), REDIRECT_PROC, if_name); if ((proc_redirect = fopen(procfile, "r")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "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", procfile); sleep(3); +#endif return 0; } iface->nic_state.redirect = fgetc(proc_redirect); fclose(proc_redirect); if ((proc_redirect = fopen(procfile, "w")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "Could not open %s for writing!\n", procfile); fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that ICMP redirect is disabeled!\n\n"); sleep(3); +#endif return 0; } syslog(LOG_INFO, "Writing \"0\" to %s", procfile); @@ -235,20 +263,28 @@ sprintf(procfile, SPOOF_PROC, if_name); if ((proc_spoof = fopen(procfile, "r")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "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", procfile); sleep(3); +#endif return 0; } iface->nic_state.spoof = fgetc(proc_spoof); fclose(proc_spoof); if ((proc_spoof = fopen(procfile, "w")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "Could not open %s for writing!\n", procfile); fprintf(stderr, "I will continue(in 3 sec) - but you should mannually ensure that IP spoof filtering is disabeled!\n\n"); sleep(3); +#endif return 0; } syslog(LOG_INFO, "Writing \"0\" to %s", procfile); @@ -273,7 +309,11 @@ FILE *proc_fd; if ((proc_fd = fopen(procfile, "w")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile); +#endif } else { syslog(LOG_INFO, "Resetting %s to %c\n", procfile, orig_fwd_state); fputc(orig_fwd_state, proc_fd); @@ -288,7 +328,11 @@ FILE *proc_fd; if ((proc_fd = fopen(procfile, "w")) == NULL) { +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile); +#endif } else { syslog(LOG_INFO, "Resetting %s to %c\n", procfile, orig_global_redirect_state); fputc(orig_global_redirect_state, proc_fd); @@ -312,7 +356,11 @@ snprintf(procfile, sizeof(procfile), REDIRECT_PROC, ifs->int_name); if ((proc_fd = fopen(procfile, "w")) == NULL) +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile); +#endif else { syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.redirect); @@ -325,7 +373,11 @@ /* Generate the procfile name */ sprintf(procfile, SPOOF_PROC, ifs->int_name); if ((proc_fd = fopen(procfile, "w")) == NULL) +#ifdef SVEN_OLA_UNBLOAT_OLD + perror(procfile); +#else fprintf(stderr, "Could not open %s for writing!\nSettings not restored!\n", procfile); +#endif else { syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.spoof); @@ -373,6 +425,8 @@ return sock; } +#endif /* SVEN_OLA_UNBLOAT */ + /** *Creates a nonblocking broadcast socket. *@param sa sockaddr struct. Used for bind(2). --- a/src/lq_plugin.c +++ b/src/lq_plugin.c @@ -67,12 +67,18 @@ init_lq_handler_tree(void) { avl_init(&lq_handler_tree, &avl_strcasecmp); +#ifndef SVEN_OLA_UNBLOAT register_lq_handler(&lq_etx_float_handler, LQ_ALGORITHM_ETX_FLOAT_NAME); register_lq_handler(&lq_etx_fpm_handler, LQ_ALGORITHM_ETX_FPM_NAME); +#endif /* SVEN_OLA_UNBLOAT */ register_lq_handler(&lq_etx_ff_handler, LQ_ALGORITHM_ETX_FF_NAME); +#ifndef SVEN_OLA_UNBLOAT if (activate_lq_handler(olsr_cnf->lq_algorithm)) { activate_lq_handler(LQ_ALGORITHM_ETX_FPM_NAME); } +#else /* SVEN_OLA_UNBLOAT */ + activate_lq_handler(LQ_ALGORITHM_ETX_FF_NAME); +#endif /* SVEN_OLA_UNBLOAT */ } /* @@ -385,7 +391,11 @@ * @return pointer to hello_neighbor */ struct hello_neighbor * +#ifndef SVEN_OLA_UNBLOAT olsr_malloc_hello_neighbor(const char *id) +#else /* SVEN_OLA_UNBLOAT */ +olsr_malloc_hello_neighbor(const char *id __attribute__ ((unused))) +#endif /* SVEN_OLA_UNBLOAT */ { struct hello_neighbor *h; @@ -407,7 +417,11 @@ * @return pointer to tc_mpr_addr */ struct tc_mpr_addr * +#ifndef SVEN_OLA_UNBLOAT olsr_malloc_tc_mpr_addr(const char *id) +#else /* SVEN_OLA_UNBLOAT */ +olsr_malloc_tc_mpr_addr(const char *id __attribute__ ((unused))) +#endif /* SVEN_OLA_UNBLOAT */ { struct tc_mpr_addr *t; @@ -429,7 +443,11 @@ * @return pointer to lq_hello_neighbor */ struct lq_hello_neighbor * +#ifndef SVEN_OLA_UNBLOAT olsr_malloc_lq_hello_neighbor(const char *id) +#else /* SVEN_OLA_UNBLOAT */ +olsr_malloc_lq_hello_neighbor(const char *id __attribute__ ((unused))) +#endif /* SVEN_OLA_UNBLOAT */ { struct lq_hello_neighbor *h; @@ -451,7 +469,11 @@ * @return pointer to link_entry */ struct link_entry * +#ifndef SVEN_OLA_UNBLOAT olsr_malloc_link_entry(const char *id) +#else /* SVEN_OLA_UNBLOAT */ +olsr_malloc_link_entry(const char *id __attribute__ ((unused))) +#endif /* SVEN_OLA_UNBLOAT */ { struct link_entry *h; --- a/src/lq_plugin_default_float.c +++ b/src/lq_plugin_default_float.c @@ -39,6 +39,7 @@ * */ +#ifndef SVEN_OLA_UNBLOAT #include "tc_set.h" #include "link_set.h" #include "olsr_spf.h" @@ -228,6 +229,7 @@ return buffer->buf; } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/lq_plugin_default_float.h +++ b/src/lq_plugin_default_float.h @@ -39,6 +39,7 @@ * */ +#ifndef SVEN_OLA_UNBLOAT #ifndef LQ_PLUGIN_DEFAULT_H_ #define LQ_PLUGIN_DEFAULT_H_ @@ -57,6 +58,7 @@ extern struct lq_handler lq_etx_float_handler; #endif /*LQ_PLUGIN_DEFAULT_H_ */ +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/lq_plugin_default_fpm.c +++ b/src/lq_plugin_default_fpm.c @@ -39,6 +39,7 @@ * */ +#ifndef SVEN_OLA_UNBLOAT #include "tc_set.h" #include "link_set.h" #include "lq_plugin.h" @@ -239,6 +240,7 @@ snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", (float)(cost) / LQ_FPM_LINKCOST_MULTIPLIER); return buffer->buf; } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/lq_plugin_default_fpm.h +++ b/src/lq_plugin_default_fpm.h @@ -39,6 +39,7 @@ * */ +#ifndef SVEN_OLA_UNBLOAT #ifndef LQ_ETX_FPM_ #define LQ_ETX_FPM_ @@ -61,6 +62,7 @@ extern struct lq_handler lq_etx_fpm_handler; #endif /*LQ_ETX_FPM_ */ +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/main.c +++ b/src/main.c @@ -289,13 +289,17 @@ /* * Print configuration */ +#ifndef SVEN_OLA_UNBLOAT if (olsr_cnf->debug_level > 1) { olsrd_print_cnf(olsr_cnf); } +#endif /* SVEN_OLA_UNBLOAT */ #ifndef WIN32 +#ifndef SVEN_OLA_UNBLOAT /* Disable redirects globally */ disable_redirects_global(olsr_cnf->ip_version); #endif +#endif /* SVEN_OLA_UNBLOAT */ /* * socket for ioctl calls @@ -331,7 +335,9 @@ /* *enable ip forwarding on host */ +#ifndef SVEN_OLA_UNBLOAT enable_ip_forwarding(olsr_cnf->ip_version); +#endif /* SVEN_OLA_UNBLOAT */ /* Initialize parser */ olsr_init_parser(); @@ -349,6 +355,7 @@ *Set up willingness/APM */ if (olsr_cnf->willingness_auto) { +#ifndef SVEN_OLA_UNBLOAT if (apm_init() < 0) { OLSR_PRINTF(1, "Could not read APM info - setting default willingness(%d)\n", WILL_DEFAULT); @@ -359,10 +366,13 @@ olsr_cnf->willingness_auto = 0; olsr_cnf->willingness = WILL_DEFAULT; } else { +#endif /* SVEN_OLA_UNBLOAT */ olsr_cnf->willingness = olsr_calculate_willingness(); OLSR_PRINTF(1, "Willingness set to %d - next update in %.1f secs\n", olsr_cnf->willingness, olsr_cnf->will_int); +#ifndef SVEN_OLA_UNBLOAT } +#endif /* SVEN_OLA_UNBLOAT */ } /* Initialize net */ @@ -392,9 +402,11 @@ /* Initialize the IPC socket */ +#ifndef SVEN_OLA_UNBLOAT if (olsr_cnf->ipc_connections > 0) { ipc_init(); } +#endif /* SVEN_OLA_UNBLOAT */ /* Initialisation of different tables to be used. */ olsr_init_tables(); @@ -533,9 +545,11 @@ OLSR_PRINTF(1, "Closing sockets...\n"); /* front-end IPC socket */ +#ifndef SVEN_OLA_UNBLOAT if (olsr_cnf->ipc_connections > 0) { shutdown_ipc(); } +#endif /* SVEN_OLA_UNBLOAT */ /* OLSR sockets */ for (ifn = ifnet; ifn; ifn = ifn->int_next) @@ -545,7 +559,9 @@ olsr_close_plugins(); /* Reset network settings */ +#ifndef SVEN_OLA_UNBLOAT restore_settings(olsr_cnf->ip_version); +#endif /* SVEN_OLA_UNBLOAT */ /* ioctl socket */ close(olsr_cnf->ioctl_s); @@ -585,7 +601,11 @@ "usage: olsrd [-f ] [ -i interface1 interface2 ... ]\n" " [-d ] [-ipv6] [-multi ]\n" " [-lql ] [-lqw ] [-lqnt ]\n" +#ifdef SVEN_OLA_UNBLOAT + " [-bcast ] [-delgw] (Note: no -ipc,-dispin,-dispout)\n" +#else " [-bcast ] [-ipc] [-dispin] [-dispout] [-delgw]\n" +#endif /* SVEN_OLA_UNBLOAT */ " [-hint ] [-tcint ]\n" " [-midint ] [-hnaint ]\n" " [-T ] [-nofork] [-hemu ]\n" " [-lql ] [-lqa ]\n"); @@ -749,12 +769,20 @@ olsr_exit(__func__, EXIT_FAILURE); } printf("Queuing if %s\n", *argv); +#ifdef SVEN_OLA_UNBLOAT + queue_if(*argv); +#else /* SVEN_OLA_UNBLOAT */ queue_if(*argv, false); +#endif /* SVEN_OLA_UNBLOAT */ while ((argc - 1) && (argv[1][0] != '-')) { NEXT_ARG; printf("Queuing if %s\n", *argv); +#ifdef SVEN_OLA_UNBLOAT + queue_if(*argv); +#else /* SVEN_OLA_UNBLOAT */ queue_if(*argv, false); +#endif /* SVEN_OLA_UNBLOAT */ } continue; @@ -817,7 +845,7 @@ sscanf(*argv, "%f", &cnf->pollrate); continue; } - +#ifndef SVEN_OLA_UNBLOAT /* * Should we display the contents of packages beeing sent? */ @@ -841,6 +869,7 @@ cnf->ipc_connections = 1; continue; } +#endif /* SVEN_OLA_UNBLOAT */ /* * IPv6 multicast addr @@ -858,7 +887,7 @@ continue; } - +#ifndef SVEN_OLA_UNBLOAT /* * Host emulation */ @@ -886,6 +915,7 @@ continue; } +#endif /* SVEN_OLA_UNBLOAT */ /* * Delete possible default GWs --- a/src/neighbor_table.c +++ b/src/neighbor_table.c @@ -362,6 +362,7 @@ * *@return nada */ +#ifndef SVEN_OLA_UNBLOAT void olsr_print_neighbor_table(void) { @@ -391,6 +392,7 @@ } #endif } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/net_olsr.c +++ b/src/net_olsr.c @@ -44,7 +44,9 @@ #include "log.h" #include "olsr.h" #include "net_os.h" +#ifndef SVEN_OLA_UNBLOAT #include "print_packet.h" +#endif /* SVEN_OLA_UNBLOAT */ #include "link_set.h" #include "lq_packet.h" @@ -385,8 +387,10 @@ *if the -dispout option was given *we print the content of the packets */ +#ifndef SVEN_OLA_UNBLOAT if (disp_pack_out) print_olsr_serialized_packet(stdout, (union olsr_packet *)ifp->netbuf.buff, ifp->netbuf.pending, &ifp->ip_addr); +#endif /* SVEN_OLA_UNBLOAT */ if (olsr_cnf->ip_version == AF_INET) { /* IP version 4 */ @@ -400,12 +404,16 @@ /* IP version 6 */ if (olsr_sendto(ifp->olsr_socket, ifp->netbuf.buff, ifp->netbuf.pending, MSG_DONTROUTE, (struct sockaddr *)sin6, sizeof(*sin6)) < 0) { +#ifndef SVEN_OLA_UNBLOAT struct ipaddr_str buf; +#endif /* SVEN_OLA_UNBLOAT */ perror("sendto(v6)"); olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv6 %m"); +#ifndef SVEN_OLA_UNBLOAT fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_index); fprintf(stderr, "To: %s (size: %u)\n", ip6_to_string(&buf, &sin6->sin6_addr), (unsigned int)sizeof(*sin6)); fprintf(stderr, "Outputsize: %d\n", ifp->netbuf.pending); +#endif /* SVEN_OLA_UNBLOAT */ retval = -1; } } --- a/src/olsr.c +++ b/src/olsr.c @@ -150,7 +150,9 @@ return; if (olsr_cnf->debug_level > 0 && olsr_cnf->clear_screen && isatty(1)) { +#ifndef SVEN_OLA_UNBLOAT clear_console(); +#endif /* SVEN_OLA_UNBLOAT */ printf(" *** %s (%s on %s) ***\n", olsrd_version, build_date, build_host); } @@ -166,7 +168,7 @@ if (changes_neighborhood || changes_topology || changes_hna) { olsr_calculate_routing_table(); } - +#ifndef SVEN_OLA_UNBLOAT if (olsr_cnf->debug_level > 0) { if (olsr_cnf->debug_level > 2) { olsr_print_mid_set(); @@ -185,6 +187,7 @@ olsr_print_tc_table(); #endif } +#endif /* SVEN_OLA_UNBLOAT */ for (tmp_pc_list = pcf_list; tmp_pc_list != NULL; tmp_pc_list = tmp_pc_list->next) { tmp_pc_list->function(changes_neighborhood, changes_topology, changes_hna); @@ -421,12 +424,15 @@ uint8_t olsr_calculate_willingness(void) { +#ifndef SVEN_OLA_UNBLOAT struct olsr_apm_info ainfo; +#endif /* SVEN_OLA_UNBLOAT */ /* If fixed willingness */ if (!olsr_cnf->willingness_auto) return olsr_cnf->willingness; +#ifndef SVEN_OLA_UNBLOAT if (apm_read(&ainfo) < 1) return WILL_DEFAULT; @@ -443,8 +449,12 @@ * 26% > juice will: 1 */ return (ainfo.battery_percentage / 26); +#else /* SVEN_OLA_UNBLOAT */ + return WILL_DEFAULT; +#endif /* SVEN_OLA_UNBLOAT */ } +#ifndef SVEN_OLA_UNBLOAT const char * olsr_msgtype_to_string(uint8_t msgtype) { @@ -514,6 +524,7 @@ snprintf(type, sizeof(type), "UNKNOWN(%d)", status); return type; } +#endif /* SVEN_OLA_UNBLOAT */ /** *Termination function to be called whenever a error occures @@ -542,6 +553,7 @@ * * @return a void pointer to the memory allocated */ +#ifndef SVEN_OLA_UNBLOAT void * olsr_malloc(size_t size, const char *id) { @@ -566,6 +578,7 @@ return ptr; } +#endif /* SVEN_OLA_UNBLOAT */ /** *Wrapper for printf that prints to a specific --- a/src/olsr.h +++ b/src/olsr.h @@ -72,15 +72,21 @@ uint8_t olsr_calculate_willingness(void); +#ifndef SVEN_OLA_UNBLOAT const char *olsr_msgtype_to_string(uint8_t); const char *olsr_link_to_string(uint8_t); const char *olsr_status_to_string(uint8_t); +#endif /* SVEN_OLA_UNBLOAT */ void olsr_exit(const char *, int); +#ifdef SVEN_OLA_UNBLOAT +#define olsr_malloc(size, msg) calloc(1, size) +#else /* SVEN_OLA_UNBLOAT */ void *olsr_malloc(size_t, const char *); +#endif /* SVEN_OLA_UNBLOAT */ int olsr_printf(int, const char *, ...) __attribute__ ((format(printf, 2, 3))); --- a/src/olsr_cfg.h +++ b/src/olsr_cfg.h @@ -154,8 +154,10 @@ char *name; char *config; bool configured; +#ifndef SVEN_OLA_UNBLOAT bool host_emul; union olsr_ip_addr hemu_ip; +#endif /* SVEN_OLA_UNBLOAT */ struct interface *interf; struct if_config_options *cnf; struct olsr_if *next; @@ -198,7 +200,9 @@ uint16_t olsrport; int debug_level; bool no_fork; +#ifndef SVEN_OLA_UNBLOAT bool host_emul; +#endif /* SVEN_OLA_UNBLOAT */ int ip_version; bool allow_no_interfaces; uint16_t tos; @@ -207,13 +211,17 @@ uint8_t rttable_default; uint8_t willingness; bool willingness_auto; +#ifndef SVEN_OLA_UNBLOAT int ipc_connections; +#endif /* SVEN_OLA_UNBLOAT */ bool use_hysteresis; olsr_fib_metric_options fib_metric; struct hyst_param hysteresis_param; struct plugin_entry *plugins; struct ip_prefix_list *hna_entries; +#ifndef SVEN_OLA_UNBLOAT struct ip_prefix_list *ipc_nets; +#endif /* SVEN_OLA_UNBLOAT */ struct olsr_if *interfaces; float pollrate; float nic_chgs_pollrate; @@ -275,7 +283,9 @@ void olsrd_free_cnf(struct olsrd_config *); +#ifndef SVEN_OLA_UNBLOAT void olsrd_print_cnf(struct olsrd_config *); +#endif /* SVEN_OLA_UNBLOAT */ int olsrd_write_cnf(struct olsrd_config *, const char *); --- a/src/parser.c +++ b/src/parser.c @@ -51,7 +51,9 @@ #include "rebuild_packet.h" #include "net_os.h" #include "log.h" +#ifndef SVEN_OLA_UNBLOAT #include "print_packet.h" +#endif /* SVEN_OLA_UNBLOAT */ #include "net_olsr.h" #ifdef WIN32 @@ -281,8 +283,10 @@ //printf("Message from %s\n\n", olsr_ip_to_string(&buf, from_addr)); /* Display packet */ +#ifndef SVEN_OLA_UNBLOAT if (disp_pack_in) print_olsr_serialized_packet(stdout, (union olsr_packet *)olsr, size, from_addr); +#endif /* SVEN_OLA_UNBLOAT */ if (olsr_cnf->ip_version == AF_INET) msgsize = ntohs(m->v4.olsr_msgsize); --- a/src/print_packet.c +++ b/src/print_packet.c @@ -39,6 +39,7 @@ * */ +#ifndef SVEN_OLA_UNBLOAT #include "print_packet.h" #include "ipcalc.h" #include "mantissa.h" @@ -339,6 +340,7 @@ remsize -= olsr_cnf->ipsize; } } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/process_routes.c +++ b/src/process_routes.c @@ -158,6 +158,7 @@ static void olsr_delete_kernel_route(struct rt_entry *rt) { +#ifndef SVEN_OLA_UNBLOAT if (!olsr_cnf->host_emul) { int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_delroute_function(rt) : olsr_delroute6_function(rt); @@ -169,6 +170,12 @@ olsr_syslog(OLSR_LOG_ERR, "Delete route %s: %s", routestr, err_msg); } } +#else /* SVEN_OLA_UNBLOAT */ + int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_delroute_function(rt) : olsr_delroute6_function(rt); + if (0 > error) { + olsr_syslog(OLSR_LOG_ERR, "Delete route: %s", strerror(errno)); + } +#endif /* SVEN_OLA_UNBLOAT */ } /** @@ -180,6 +187,7 @@ olsr_add_kernel_route(struct rt_entry *rt) { +#ifndef SVEN_OLA_UNBLOAT if (!olsr_cnf->host_emul) { int16_t error = (olsr_cnf->ip_version == AF_INET) ? olsr_addroute_function(rt) : olsr_addroute6_function(rt); @@ -198,6 +206,14 @@ rt->rt_metric = rt->rt_best->rtp_metric; } } +#else /* SVEN_OLA_UNBLOAT */ + int16_t error = olsr_cnf->ip_version == AF_INET ? olsr_addroute_function(rt) : olsr_addroute6_function(rt); + if (0 > error) { + olsr_syslog(OLSR_LOG_ERR, "Add route: %s", strerror(errno)); + } else { + rt->rt_nexthop = rt->rt_best->rtp_nexthop; + } +#endif /* SVEN_OLA_UNBLOAT */ } /** @@ -348,9 +364,11 @@ /* route changes */ olsr_chg_kernel_routes(&chg_kernel_list); -#if DEBUG +#ifndef SVEN_OLA_UNBLOAT +#ifdef DEBUG olsr_print_routing_table(&routingtree); #endif +#endif /* SVEN_OLA_UNBLOAT */ } /* --- a/src/rebuild_packet.c +++ b/src/rebuild_packet.c @@ -60,7 +60,11 @@ mid_chgestruct(struct mid_message *mmsg, const union olsr_message *m) { int i; +#ifndef SVEN_OLA_UNBLOAT struct mid_alias *alias, *alias_tmp; +#else /* SVEN_OLA_UNBLOAT */ + struct mid_alias *alias; +#endif /* SVEN_OLA_UNBLOAT */ int no_aliases; /* Checking if everything is ok */ @@ -100,6 +104,7 @@ maddr++; } +#ifndef SVEN_OLA_UNBLOAT if (olsr_cnf->debug_level > 1) { struct ipaddr_str buf; OLSR_PRINTF(3, "Alias list for %s: ", olsr_ip_to_string(&buf, &mmsg->mid_origaddr)); @@ -111,6 +116,7 @@ } OLSR_PRINTF(3, "\n"); } +#endif /* SVEN_OLA_UNBLOAT */ } else { /* IPv6 */ const struct midaddr6 *maddr6 = m->v6.message.mid.mid_addr; @@ -144,6 +150,7 @@ maddr6++; } +#ifndef SVEN_OLA_UNBLOAT if (olsr_cnf->debug_level > 1) { struct ipaddr_str buf; OLSR_PRINTF(3, "Alias list for %s", ip6_to_string(&buf, &mmsg->mid_origaddr.v6)); @@ -156,6 +163,7 @@ } OLSR_PRINTF(3, "\n"); } +#endif /* SVEN_OLA_UNBLOAT */ } } --- a/src/routing_table.c +++ b/src/routing_table.c @@ -628,6 +628,7 @@ /** * format a route entry into a buffer */ +#ifndef SVEN_OLA_UNBLOAT char * olsr_rt_to_string(const struct rt_entry *rt) { @@ -659,11 +660,13 @@ return buff; } +#endif /* SVEN_OLA_UNBLOAT */ /** * Print the routingtree to STDOUT * */ +#ifndef SVEN_OLA_UNBLOAT void olsr_print_routing_table(struct avl_tree *tree) { @@ -697,6 +700,7 @@ #endif tree = NULL; /* squelch compiler warnings */ } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/routing_table.h +++ b/src/routing_table.h @@ -210,9 +210,11 @@ bool olsr_cmp_rt(const struct rt_entry *, const struct rt_entry *); uint8_t olsr_fib_metric(const struct rt_metric *); +#ifndef SVEN_OLA_UNBLOAT char *olsr_rt_to_string(const struct rt_entry *); char *olsr_rtp_to_string(const struct rt_path *); void olsr_print_routing_table(struct avl_tree *); +#endif /* SVEN_OLA_UNBLOAT */ const struct rt_nexthop *olsr_get_nh(const struct rt_entry *); --- a/src/tc_set.c +++ b/src/tc_set.c @@ -336,6 +336,7 @@ /** * Format tc_edge contents into a buffer. */ +#ifndef SVEN_OLA_UNBLOAT char * olsr_tc_edge_to_string(struct tc_edge_entry *tc_edge) { @@ -350,6 +351,7 @@ return buf; } +#endif /* SVEN_OLA_UNBLOAT */ /** * Wrapper for the timer callback. @@ -693,6 +695,7 @@ /** * Print the topology table to stdout */ +#ifndef SVEN_OLA_UNBLOAT void olsr_print_tc_table(void) { @@ -718,6 +721,7 @@ } OLSR_FOR_ALL_TC_ENTRIES_END(tc); #endif } +#endif /* SVEN_OLA_UNBLOAT */ /* * calculate the border IPs of a tc edge set according to the border flags --- a/src/tc_set.h +++ b/src/tc_set.h @@ -157,7 +157,9 @@ /* tc_edge_entry manipulation */ bool olsr_delete_outdated_tc_edges(struct tc_entry *); +#ifndef SVEN_OLA_UNBLOAT char *olsr_tc_edge_to_string(struct tc_edge_entry *); +#endif /* SVEN_OLA_UNBLOAT */ struct tc_edge_entry *olsr_lookup_tc_edge(struct tc_entry *, union olsr_ip_addr *); struct tc_edge_entry *olsr_add_tc_edge_entry(struct tc_entry *, union olsr_ip_addr *, uint16_t); void olsr_delete_tc_entry(struct tc_entry *); --- a/src/two_hop_neighbor_table.c +++ b/src/two_hop_neighbor_table.c @@ -203,6 +203,8 @@ return NULL; } +#ifndef SVEN_OLA_UNBLOAT + /** *Print the two hop neighbor table to STDOUT. * @@ -240,6 +242,7 @@ } #endif } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: --- a/src/unix/ifnet.c +++ b/src/unix/ifnet.c @@ -70,6 +70,8 @@ #define BUFSPACE (127*1024) /* max. input buffer size to request */ +#ifndef SVEN_OLA_UNBLOAT + int set_flag(char *ifname, short flag __attribute__ ((unused))) { @@ -100,6 +102,8 @@ } +#endif /* SVEN_OLA_UNBLOAT */ + void check_interface_updates(void *foo __attribute__ ((unused))) { @@ -110,11 +114,13 @@ #endif for (tmp_if = olsr_cnf->interfaces; tmp_if != NULL; tmp_if = tmp_if->next) { +#ifndef SVEN_OLA_UNBLOAT if (tmp_if->host_emul) continue; if (olsr_cnf->host_emul) /* XXX: TEMPORARY! */ continue; +#endif /* SVEN_OLA_UNBLOAT */ if (!tmp_if->cnf->autodetect_chg) { #ifdef DEBUG @@ -154,8 +160,10 @@ OLSR_PRINTF(3, "Checking if %s is set down or changed\n", iface->name); #endif +#ifndef SVEN_OLA_UNBLOAT if (iface->host_emul) return -1; +#endif /* SVEN_OLA_UNBLOAT */ ifp = iface->interf; @@ -278,7 +286,9 @@ } else /* IP version 4 */ { +#ifndef SVEN_OLA_UNBLOAT struct ipaddr_str buf; +#endif /* SVEN_OLA_UNBLOAT */ /* Check interface address (IPv4) */ if (ioctl(olsr_cnf->ioctl_s, SIOCGIFADDR, &ifr) < 0) { OLSR_PRINTF(1, "\tCould not get address of interface - removing it\n"); @@ -291,17 +301,21 @@ if (memcmp (&((struct sockaddr_in *)(ARM_NOWARN_ALIGN)&ifp->int_addr)->sin_addr.s_addr, &((struct sockaddr_in *)(ARM_NOWARN_ALIGN)&ifr.ifr_addr)->sin_addr.s_addr, olsr_cnf->ipsize) != 0) { +#ifndef SVEN_OLA_UNBLOAT /* New address */ OLSR_PRINTF(1, "IPv4 address changed for %s\n", ifr.ifr_name); OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_addr.sin_addr)); OLSR_PRINTF(1, "\tNew:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); +#endif /* SVEN_OLA_UNBLOAT */ ifp->int_addr = *(struct sockaddr_in *)(ARM_NOWARN_ALIGN)&ifr.ifr_addr; /* deactivated to prevent change of originator IP */ #if 0 if (memcmp(&olsr_cnf->main_addr, &ifp->ip_addr, olsr_cnf->ipsize) == 0) { OLSR_PRINTF(1, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); +#ifndef SVEN_OLA_UNBLOAT olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); +#endif /* SVEN_OLA_UNBLOAT */ memcpy(&olsr_cnf->main_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, olsr_cnf->ipsize); } #endif @@ -375,7 +389,9 @@ ifp = iface->interf; OLSR_PRINTF(1, "Removing interface %s\n", iface->name); +#ifndef SVEN_OLA_UNBLOAT olsr_syslog(OLSR_LOG_INFO, "Removing interface %s\n", iface->name); +#endif /* SVEN_OLA_UNBLOAT */ olsr_delete_link_entry_by_ip(&ifp->ip_addr); @@ -417,10 +433,14 @@ memset(&olsr_cnf->main_addr, 0, olsr_cnf->ipsize); OLSR_PRINTF(1, "No more interfaces...\n"); } else { +#if !defined(SVEN_OLA_UNBLOAT) struct ipaddr_str buf; +#endif /* SVEN_OLA_UNBLOAT */ olsr_cnf->main_addr = ifnet->ip_addr; OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); +#ifndef SVEN_OLA_UNBLOAT olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); +#endif /* SVEN_OLA_UNBLOAT */ } } #endif @@ -444,13 +464,17 @@ if ((ifnet == NULL) && (!olsr_cnf->allow_no_interfaces)) { OLSR_PRINTF(1, "No more active interfaces - exiting.\n"); +#ifndef SVEN_OLA_UNBLOAT olsr_syslog(OLSR_LOG_INFO, "No more active interfaces - exiting.\n"); +#endif /* SVEN_OLA_UNBLOAT */ olsr_cnf->exit_value = EXIT_FAILURE; kill(getpid(), SIGINT); } } +#ifndef SVEN_OLA_UNBLOAT + /** * Initializes the special interface used in * host-client emulation @@ -602,6 +626,7 @@ return 1; } +#endif /* SVEN_OLA_UNBLOAT */ static char basenamestr[32]; static const char *if_basename(const char *name); @@ -637,8 +662,10 @@ int tos_bits = IPTOS_TOS(olsr_cnf->tos); #endif +#ifndef SVEN_OLA_UNBLOAT if (iface->host_emul) return -1; +#endif /* SVEN_OLA_UNBLOAT */ memset(&ifr, 0, sizeof(struct ifreq)); memset(&ifs, 0, sizeof(struct interface)); @@ -745,11 +772,13 @@ ifs.int_broadaddr = *(struct sockaddr_in *)(ARM_NOWARN_ALIGN)&ifr.ifr_broadaddr; } +#ifndef SVEN_OLA_UNBLOAT /* Deactivate IP spoof filter */ deactivate_spoof(if_basename(ifr.ifr_name), &ifs, olsr_cnf->ip_version); /* Disable ICMP redirects */ disable_redirects(if_basename(ifr.ifr_name), &ifs, olsr_cnf->ip_version); +#endif /* SVEN_OLA_UNBLOAT */ } @@ -779,7 +808,9 @@ OLSR_PRINTF(1, "\tMTU - IPhdr: %d\n", ifs.int_mtu); +#ifndef SVEN_OLA_UNBLOAT olsr_syslog(OLSR_LOG_INFO, "Adding interface %s\n", iface->name); +#endif /* SVEN_OLA_UNBLOAT */ OLSR_PRINTF(1, "\tIndex %d\n", ifs.if_index); if (olsr_cnf->ip_version == AF_INET) { @@ -884,10 +915,14 @@ */ memset(&null_addr, 0, olsr_cnf->ipsize); if (ipequal(&null_addr, &olsr_cnf->main_addr)) { +#ifndef SVEN_OLA_UNBLOAT struct ipaddr_str buf; +#endif olsr_cnf->main_addr = ifp->ip_addr; +#ifndef SVEN_OLA_UNBLOAT OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); +#endif /* SVEN_OLA_UNBLOAT */ } /* --- a/src/unix/misc.c +++ b/src/unix/misc.c @@ -44,6 +44,7 @@ #include "misc.h" #include "olsr_types.h" +#ifndef SVEN_OLA_UNBLOAT void clear_console(void) { @@ -69,6 +70,7 @@ fflush(stdout); } +#endif /* SVEN_OLA_UNBLOAT */ /* * Local Variables: