From 7253f64bcb2f7537773637c79b2da8f797ba9732 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 25 May 2009 14:00:30 +0000 Subject: [PATCH] luci-0.8: merge r4599 and r4600 --- .../luasrc/model/cbi/ffwizard.lua | 35 +- .../patches/140-olsrd-optimize-size.patch | 549 ++++-------------- modules/freifunk/root/etc/init.d/freifunk | 4 + modules/freifunk/root/usr/sbin/ff_mapupdate | 49 ++ 4 files changed, 204 insertions(+), 433 deletions(-) create mode 100755 modules/freifunk/root/usr/sbin/ff_mapupdate diff --git a/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua b/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua index fa88f0150..e82353031 100644 --- a/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua +++ b/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua @@ -80,10 +80,15 @@ client = f:field(Flag, "client", "WLAN-DHCP anbieten") client:depends("wifi", "1") client.rmempty = true - olsr = f:field(Flag, "olsr", "OLSR einrichten") olsr.rmempty = true +lat = f:field(Value, "lat", "Latitude") +lat:depends("olsr", "1") + +lon = f:field(Value, "lon", "Longitude") +lon:depends("olsr", "1") + share = f:field(Flag, "sharenet", "Eigenen Internetzugang freigeben") share.rmempty = true @@ -265,6 +270,10 @@ function olsr.write(self, section, value) local community = net:formvalue(section) local external = community and uci:get("freifunk", community, "external") or "" + local latval = tonumber(lat:formvalue(section)) + local lonval = tonumber(lon:formvalue(section)) + + -- Delete old interface uci:delete_all("olsrd", "Interface", {interface=device}) @@ -285,6 +294,29 @@ function olsr.write(self, section, value) interval = "30" }) + -- Delete old nameservice settings + uci:delete_all("olsrd", "LoadPlugin", {library="olsrd_nameservice.so.0.3"}) + + -- Write new nameservice settings + uci:section("olsrd", "LoadPlugin", nil, { + library = "olsrd_nameservice.so.0.3", + latlon_file = "/var/run/latlon.js", + lat = latval and string.format("%.15f", latval) or "", + lon = lonval and string.format("%.15f", lonval) or "" + }) + + -- Save latlon to system too + if latval and lonval then + uci:foreach("system", "system", function(s) + uci:set("system", s[".name"], "latlon", + string.format("%.15f %.15f", latval, lonval)) + end) + else + uci:foreach("system", "system", function(s) + uci:delete("system", s[".name"], "latlon") + end) + end + -- Import hosts uci:foreach("dhcp", "dnsmasq", function(s) uci:set("dhcp", s[".name"], "addnhosts", "/var/etc/hosts.olsr") @@ -305,6 +337,7 @@ function share.write(self, section, value) end uci:save("firewall") uci:save("olsrd") + uci:save("system") end diff --git a/contrib/package/olsrd-luci/patches/140-olsrd-optimize-size.patch b/contrib/package/olsrd-luci/patches/140-olsrd-optimize-size.patch index a87ee5dbb..5ff1519e1 100644 --- a/contrib/package/olsrd-luci/patches/140-olsrd-optimize-size.patch +++ b/contrib/package/olsrd-luci/patches/140-olsrd-optimize-size.patch @@ -1,6 +1,5 @@ -diff -ur olsrd-0.5.6-r4.orig/Makefile.inc olsrd-0.5.6-r4/Makefile.inc ---- olsrd-0.5.6-r4.orig/Makefile.inc 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/Makefile.inc 2009-03-27 17:33:00.000000000 +0000 +--- a/Makefile.inc ++++ b/Makefile.inc @@ -204,6 +204,10 @@ $(warning Use CPPFLAGS instead of DEFINES for -D) endif @@ -12,9 +11,8 @@ diff -ur olsrd-0.5.6-r4.orig/Makefile.inc olsrd-0.5.6-r4/Makefile.inc TAGFILE ?= src/TAGS help: -diff -ur olsrd-0.5.6-r4.orig/lib/bmf/src/NetworkInterfaces.c olsrd-0.5.6-r4/lib/bmf/src/NetworkInterfaces.c ---- olsrd-0.5.6-r4.orig/lib/bmf/src/NetworkInterfaces.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/lib/bmf/src/NetworkInterfaces.c 2009-03-27 17:33:00.000000000 +0000 +--- a/lib/bmf/src/NetworkInterfaces.c ++++ b/lib/bmf/src/NetworkInterfaces.c @@ -544,7 +544,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)); @@ -25,9 +23,8 @@ diff -ur olsrd-0.5.6-r4.orig/lib/bmf/src/NetworkInterfaces.c olsrd-0.5.6-r4/lib/ 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, -diff -ur olsrd-0.5.6-r4.orig/lib/httpinfo/Makefile olsrd-0.5.6-r4/lib/httpinfo/Makefile ---- olsrd-0.5.6-r4.orig/lib/httpinfo/Makefile 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/lib/httpinfo/Makefile 2009-03-27 17:33:00.000000000 +0000 +--- a/lib/httpinfo/Makefile ++++ b/lib/httpinfo/Makefile @@ -47,7 +47,11 @@ CPPFLAGS += -DADMIN_INTERFACE endif @@ -40,9 +37,8 @@ diff -ur olsrd-0.5.6-r4.orig/lib/httpinfo/Makefile olsrd-0.5.6-r4/lib/httpinfo/M default_target: $(PLUGIN_FULLNAME) ifdef ADMIN_INTERFACE -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 ---- olsrd-0.5.6-r4.orig/lib/httpinfo/src/olsrd_httpinfo.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/lib/httpinfo/src/olsrd_httpinfo.c 2009-03-27 17:33:00.000000000 +0000 +--- a/lib/httpinfo/src/olsrd_httpinfo.c ++++ b/lib/httpinfo/src/olsrd_httpinfo.c @@ -67,7 +67,9 @@ #include "olsrd_httpinfo.h" @@ -159,9 +155,8 @@ diff -ur olsrd-0.5.6-r4.orig/lib/httpinfo/src/olsrd_httpinfo.c olsrd-0.5.6-r4/li static int check_allowed_ip(const struct allowed_net *const allowed_nets, const union olsr_ip_addr *const addr) -diff -ur olsrd-0.5.6-r4.orig/lib/nameservice/src/nameservice.c olsrd-0.5.6-r4/lib/nameservice/src/nameservice.c ---- olsrd-0.5.6-r4.orig/lib/nameservice/src/nameservice.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/lib/nameservice/src/nameservice.c 2009-03-27 17:33:00.000000000 +0000 +--- a/lib/nameservice/src/nameservice.c ++++ b/lib/nameservice/src/nameservice.c @@ -65,6 +65,11 @@ #include "mapwrite.h" #include "compat.h" @@ -174,198 +169,15 @@ diff -ur olsrd-0.5.6-r4.orig/lib/nameservice/src/nameservice.c olsrd-0.5.6-r4/li /* config parameters */ static char my_hosts_file[MAX_FILE + 1]; static char my_sighup_pid_file[MAX_FILE + 1]; -@@ -73,12 +78,16 @@ - static char my_suffix[MAX_SUFFIX]; - static int my_interval = EMISSION_INTERVAL; - static double my_timeout = NAME_VALID_TIME; -+#ifndef SVEN_OLA_UNBLOAT - static char my_resolv_file[MAX_FILE + 1]; -+#endif /* SVEN_OLA_UNBLOAT */ - static char my_services_file[MAX_FILE + 1]; - static char my_macs_file[MAX_FILE + 1]; -+#ifndef SVEN_OLA_UNBLOAT - static char my_name_change_script[MAX_FILE + 1]; - static char my_services_change_script[MAX_FILE + 1]; - static char my_macs_change_script[MAX_FILE + 1]; -+#endif - static char latlon_in_file[MAX_FILE + 1]; - static char my_latlon_file[MAX_FILE + 1]; - float my_lat = 0.0, my_lon = 0.0; -@@ -102,9 +111,11 @@ - static struct name_entry *my_macs = NULL; - static bool mac_table_changed = true; - -+#ifndef SVEN_OLA_UNBLOAT - static struct list_node forwarder_list[HASHSIZE]; - static struct name_entry *my_forwarders = NULL; - static bool forwarder_table_changed = true; -+#endif /* SVEN_OLA_UNBLOAT */ - - struct list_node latlon_list[HASHSIZE]; - static bool latlon_table_changed = true; -@@ -138,7 +149,9 @@ - GetWindowsDirectory(my_hosts_file, MAX_FILE - 12); - GetWindowsDirectory(my_services_file, MAX_FILE - 12); - GetWindowsDirectory(my_macs_file, MAX_FILE - 12); -+#ifndef SVEN_OLA_UNBLOAT - GetWindowsDirectory(my_resolv_file, MAX_FILE - 12); -+#endif /* SVEN_OLA_UNBLOAT */ - - len = strlen(my_hosts_file); - if (my_hosts_file[len - 1] != '\\') -@@ -155,15 +168,19 @@ - strscat(my_macs_file, "\\", sizeof(my_macs_file)); - strscat(my_macs_file, "macs_olsr", sizeof(my_macs_file)); - -+#ifndef SVEN_OLA_UNBLOAT - len = strlen(my_resolv_file); - if (my_resolv_file[len - 1] != '\\') - strscat(my_resolv_file, "\\", sizeof(my_resolv_file)); - strscat(my_resolv_file, "resolvconf_olsr", sizeof(my_resolv_file)); -+#endif /* SVEN_OLA_UNBLOAT */ - #else - strscpy(my_hosts_file, "/var/run/hosts_olsr", sizeof(my_hosts_file)); - strscpy(my_services_file, "/var/run/services_olsr", sizeof(my_services_file)); - strscpy(my_macs_file, "/var/run/macs_olsr", sizeof(my_macs_file)); -+#ifndef SVEN_OLA_UNBLOAT - strscpy(my_resolv_file, "/var/run/resolvconf_olsr", sizeof(my_resolv_file)); -+#endif /* SVEN_OLA_UNBLOAT */ - *my_sighup_pid_file = 0; - #endif - -@@ -171,14 +188,18 @@ - my_add_hosts[0] = '\0'; - my_latlon_file[0] = '\0'; - latlon_in_file[0] = '\0'; -+#ifndef SVEN_OLA_UNBLOAT - my_name_change_script[0] = '\0'; - my_services_change_script[0] = '\0'; - my_macs_change_script[0] = '\0'; -+#endif /* SVEN_OLA_UNBLOAT */ - - /* init the lists heads */ - for (i = 0; i < HASHSIZE; i++) { - list_head_init(&name_list[i]); -+#ifndef SVEN_OLA_UNBLOAT - list_head_init(&forwarder_list[i]); -+#endif /* SVEN_OLA_UNBLOAT */ - list_head_init(&service_list[i]); - list_head_init(&mac_list[i]); - list_head_init(&latlon_list[i]); -@@ -186,6 +207,7 @@ - - } - -+#ifndef SVEN_OLA_UNBLOAT - static int - set_nameservice_server(const char *value, void *data, set_plugin_parameter_addon addon) - { -@@ -204,6 +226,7 @@ - } - return 1; - } -+#endif /* SVEN_OLA_UNBLOAT */ - - static int - set_nameservice_name(const char *value, void *data, set_plugin_parameter_addon addon) -@@ -253,10 +276,12 @@ - { .name = "timeout", .set_plugin_parameter = &set_nameservice_float, .data = &my_timeout }, - { .name = "sighup-pid-file", .set_plugin_parameter = &set_plugin_string, .data = &my_sighup_pid_file, .addon = {sizeof(my_sighup_pid_file)} }, - { .name = "hosts-file", .set_plugin_parameter = &set_plugin_string, .data = &my_hosts_file, .addon = {sizeof(my_hosts_file)} }, -+#ifndef SVEN_OLA_UNBLOAT - { .name = "name-change-script", .set_plugin_parameter = &set_plugin_string, .data = &my_name_change_script, .addon = {sizeof(my_name_change_script)} }, - { .name = "services-change-script", .set_plugin_parameter = &set_plugin_string, .data = &my_services_change_script, .addon = {sizeof(my_services_change_script)} }, - { .name = "macs-change-script", .set_plugin_parameter = &set_plugin_string, .data = &my_macs_change_script, .addon = {sizeof(my_macs_change_script)} }, - { .name = "resolv-file", .set_plugin_parameter = &set_plugin_string, .data = &my_resolv_file, .addon = {sizeof(my_resolv_file)} }, -+#endif /* SVEN_OLA_UNBLOAT */ - { .name = "suffix", .set_plugin_parameter = &set_plugin_string, .data = &my_suffix, .addon = {sizeof(my_suffix)} }, - { .name = "add-hosts", .set_plugin_parameter = &set_plugin_string, .data = &my_add_hosts, .addon = {sizeof(my_add_hosts)} }, - { .name = "services-file", .set_plugin_parameter = &set_plugin_string, .data = &my_services_file, .addon = {sizeof(my_services_file)} }, -@@ -265,7 +290,9 @@ - { .name = "lon", .set_plugin_parameter = &set_nameservice_float, .data = &my_lon }, - { .name = "latlon-file", .set_plugin_parameter = &set_plugin_string, .data = &my_latlon_file, .addon = {sizeof(my_latlon_file)} }, - { .name = "latlon-infile", .set_plugin_parameter = &set_plugin_string, .data = &latlon_in_file, .addon = {sizeof(latlon_in_file)} }, -+#ifndef SVEN_OLA_UNBLOAT - { .name = "dns-server", .set_plugin_parameter = &set_nameservice_server, .data = &my_forwarders, .addon = {NAME_FORWARDER} }, -+#endif /* SVEN_OLA_UNBLOAT */ - { .name = "name", .set_plugin_parameter = &set_nameservice_name, .data = &my_names, .addon = {NAME_HOST} }, - { .name = "service", .set_plugin_parameter = &set_nameservice_name, .data = &my_services, .addon = {NAME_SERVICE} }, - { .name = "mac", .set_plugin_parameter = &set_nameservice_name, .data = &my_macs, .addon = {NAME_MACADDR} }, -@@ -381,16 +408,20 @@ +@@ -381,6 +386,7 @@ name->ip = olsr_cnf->main_addr; } } -+#ifndef SVEN_OLA_UNBLOAT ++ 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); - name->ip = olsr_cnf->main_addr; - } - } -+#endif /* SVEN_OLA_UNBLOAT */ - - //check if entries I want to announce myself are valid and allowed - my_names = remove_nonvalid_names_from_list(my_names, NAME_HOST); -+#ifndef SVEN_OLA_UNBLOAT - my_forwarders = remove_nonvalid_names_from_list(my_forwarders, NAME_FORWARDER); -+#endif /* SVEN_OLA_UNBLOAT */ - my_services = remove_nonvalid_names_from_list(my_services, NAME_SERVICE); - my_macs = remove_nonvalid_names_from_list(my_macs, NAME_MACADDR); - -@@ -463,12 +494,16 @@ - free_name_entry_list(&my_names); - free_name_entry_list(&my_services); - free_name_entry_list(&my_macs); -+#ifndef SVEN_OLA_UNBLOAT - free_name_entry_list(&my_forwarders); -+#endif /* SVEN_OLA_UNBLOAT */ - - free_all_list_entries(name_list); - free_all_list_entries(service_list); - free_all_list_entries(mac_list); -+#ifndef SVEN_OLA_UNBLOAT - free_all_list_entries(forwarder_list); -+#endif /* SVEN_OLA_UNBLOAT */ - free_all_list_entries(latlon_list); - - olsr_stop_timer(write_file_timer); -@@ -511,7 +546,9 @@ - { - write_file_timer = NULL; - -+#ifndef SVEN_OLA_UNBLOAT - write_resolv_file(); /* if forwarder_table_changed */ -+#endif /* SVEN_OLA_UNBLOAT */ - write_hosts_file(); /* if name_table_changed */ - write_services_file(false); /* if service_table_changed */ - write_services_file(true); /* if mac_table_changed */ -@@ -693,11 +730,13 @@ - pos = create_packet((struct name *)pos, my_name); - i++; - } -+#ifndef SVEN_OLA_UNBLOAT - // forwarders - for (my_name = my_forwarders; my_name != NULL; my_name = my_name->next) { - pos = create_packet((struct name *)pos, my_name); - i++; - } -+#endif /* SVEN_OLA_UNBLOAT */ - // services - for (my_name = my_services; my_name != NULL; my_name = my_name->next) { - pos = create_packet((struct name *)pos, my_name); -@@ -880,9 +919,11 @@ - case NAME_HOST: - insert_new_name_in_list(originator, name_list, from_packet, &name_table_changed, vtime); - break; -+#ifndef SVEN_OLA_UNBLOAT - case NAME_FORWARDER: - insert_new_name_in_list(originator, forwarder_list, from_packet, &forwarder_table_changed, vtime); - break; -+#endif /* SVEN_OLA_UNBLOAT */ - case NAME_SERVICE: - insert_new_name_in_list(originator, service_list, from_packet, &service_table_changed, vtime); - break; -@@ -901,9 +942,11 @@ +@@ -901,9 +907,11 @@ pos += sizeof(struct name); pos += 1 + ((ntohs(from_packet->len) - 1) | 3); } @@ -377,95 +189,8 @@ diff -ur olsrd-0.5.6-r4.orig/lib/nameservice/src/nameservice.c olsrd-0.5.6-r4/li } /** -@@ -1120,6 +1163,7 @@ - #endif - name_table_changed = false; - -+#ifndef SVEN_OLA_UNBLOAT - // Executes my_name_change_script after writing the hosts file - if (my_name_change_script[0] != '\0') { - if (system(my_name_change_script) != -1) { -@@ -1128,6 +1172,7 @@ - OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on hosts change\n", my_name_change_script); - } - } -+#endif /* SVEN_OLA_UNBLOAT */ - } - - /** -@@ -1193,6 +1238,7 @@ - - fclose(file); - if (writemacs) { -+#ifndef SVEN_OLA_UNBLOAT - // Executes my_macs_change_script after writing the macs file - if (my_macs_change_script[0] != '\0') { - if (system(my_macs_change_script) != -1) { -@@ -1201,9 +1247,11 @@ - OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on mac change\n", my_macs_change_script); - } - } -+#endif /* SVEN_OLA_UNBLOAT */ - mac_table_changed = false; - } - else { -+#ifndef SVEN_OLA_UNBLOAT - // Executes my_services_change_script after writing the services file - if (my_services_change_script[0] != '\0') { - if (system(my_services_change_script) != -1) { -@@ -1212,6 +1260,7 @@ - OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on service change\n", my_services_change_script); - } - } -+#endif /* SVEN_OLA_UNBLOAT */ - service_table_changed = false; - } - } -@@ -1222,6 +1271,7 @@ - * fresh entries are at the beginning of the array and - * the best entry is at the end of the array. - */ -+#ifndef SVEN_OLA_UNBLOAT - static void - select_best_nameserver(struct rt_entry **rt) - { -@@ -1253,11 +1303,13 @@ - } - } - } -+#endif /* SVEN_OLA_UNBLOAT */ - - /** - * write the 3 best upstream DNS servers to resolv.conf file - * best means the 3 with the best etx value in routing table - */ -+#ifndef SVEN_OLA_UNBLOAT - void - write_resolv_file(void) - { -@@ -1341,6 +1393,7 @@ - fclose(resolv); - forwarder_table_changed = false; - } -+#endif /* SVEN_OLA_UNBLOAT */ - - /** - * completely free a list of name_entries -@@ -1359,9 +1412,11 @@ - case NAME_HOST: - name_table_changed = true; - break; -+#ifndef SVEN_OLA_UNBLOAT - case NAME_FORWARDER: - forwarder_table_changed = true; - break; -+#endif /* SVEN_OLA_UNBLOAT */ - case NAME_SERVICE: - service_table_changed = true; - break; -diff -ur olsrd-0.5.6-r4.orig/src/apm.h olsrd-0.5.6-r4/src/apm.h ---- olsrd-0.5.6-r4.orig/src/apm.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/apm.h 2009-03-27 17:33:00.000000000 +0000 +--- a/src/apm.h ++++ b/src/apm.h @@ -41,6 +41,7 @@ #ifndef _OLSR_APM @@ -482,9 +207,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/apm.h olsrd-0.5.6-r4/src/apm.h /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/cfgfile_gen.c olsrd-0.5.6-r4/src/cfgparser/cfgfile_gen.c ---- olsrd-0.5.6-r4.orig/src/cfgparser/cfgfile_gen.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/cfgparser/cfgfile_gen.c 2009-03-27 17:33:00.000000000 +0000 +--- 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; @@ -537,9 +261,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/cfgfile_gen.c olsrd-0.5.6-r4/src/cfgp /* Hysteresis */ WRITE_TO_BUF("# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n"); -diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/local.mk olsrd-0.5.6-r4/src/cfgparser/local.mk ---- olsrd-0.5.6-r4.orig/src/cfgparser/local.mk 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/cfgparser/local.mk 2009-03-27 17:33:00.000000000 +0000 +--- a/src/cfgparser/local.mk ++++ b/src/cfgparser/local.mk @@ -41,8 +41,13 @@ C=$(if $(CFGDIR),$(CFGDIR)/) @@ -554,9 +277,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/local.mk olsrd-0.5.6-r4/src/cfgparser HDRS += $(foreach file,olsrd_conf oparse,$(C)$(file).h) $(C)oscan.c: $(C)oscan.lex $(C)Makefile -diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.6-r4/src/cfgparser/olsrd_conf.c ---- olsrd-0.5.6-r4.orig/src/cfgparser/olsrd_conf.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/cfgparser/olsrd_conf.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/cfgparser/olsrd_conf.c ++++ b/src/cfgparser/olsrd_conf.c @@ -81,11 +81,13 @@ } @@ -581,7 +303,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.6-r4/src/cfgpa } return olsr_cnf; } -@@ -389,7 +393,9 @@ +@@ -401,7 +405,9 @@ cnf->debug_level = DEF_DEBUGLVL; cnf->no_fork = false; @@ -591,7 +313,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.6-r4/src/cfgpa cnf->ip_version = AF_INET; cnf->ipsize = sizeof(struct in_addr); cnf->maxplen = 32; -@@ -400,7 +406,9 @@ +@@ -412,7 +418,9 @@ cnf->rtproto = DEF_RTPROTO; cnf->rttable_default = 0; cnf->willingness_auto = DEF_WILL_AUTO; @@ -601,7 +323,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.6-r4/src/cfgpa cnf->fib_metric = DEF_FIB_METRIC; cnf->use_hysteresis = DEF_USE_HYST; -@@ -479,6 +487,7 @@ +@@ -491,6 +499,7 @@ } @@ -609,7 +331,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.6-r4/src/cfgpa void olsrd_print_cnf(struct olsrd_config *cnf) { -@@ -622,6 +631,7 @@ +@@ -634,6 +643,7 @@ } } } @@ -617,9 +339,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.6-r4/src/cfgpa #if defined WIN32 struct ioinfo { -diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oparse.y olsrd-0.5.6-r4/src/cfgparser/oparse.y ---- olsrd-0.5.6-r4.orig/src/cfgparser/oparse.y 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/cfgparser/oparse.y 2009-03-27 17:33:00.000000000 +0000 +--- a/src/cfgparser/oparse.y ++++ b/src/cfgparser/oparse.y @@ -178,7 +178,6 @@ %token TOK_RTPROTO %token TOK_RTTABLE_DEFAULT @@ -628,7 +349,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oparse.y olsrd-0.5.6-r4/src/cfgparser %token TOK_FIBMETRIC %token TOK_USEHYST %token TOK_HYSTSCALE -@@ -201,7 +200,6 @@ +@@ -202,7 +201,6 @@ %token TOK_HOSTLABEL %token TOK_NETLABEL @@ -636,7 +357,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oparse.y olsrd-0.5.6-r4/src/cfgparser %token TOK_IP4BROADCAST %token TOK_IFMODE -@@ -263,7 +261,6 @@ +@@ -265,7 +263,6 @@ block: TOK_HNA4 hna4body | TOK_HNA6 hna6body @@ -644,7 +365,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oparse.y olsrd-0.5.6-r4/src/cfgparser | ifblock ifbody | plblock plbody ; -@@ -288,18 +285,6 @@ +@@ -290,18 +287,6 @@ | ihna6entry ; @@ -663,7 +384,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oparse.y olsrd-0.5.6-r4/src/cfgparser ifblock: ifstart ifnicks ; -@@ -341,77 +326,6 @@ +@@ -343,77 +328,6 @@ | vcomment ; @@ -741,9 +462,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oparse.y olsrd-0.5.6-r4/src/cfgparser iifweight: TOK_IFWEIGHT TOK_INTEGER { int ifcnt = ifs_in_curr_cfg; -diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oscan.lex olsrd-0.5.6-r4/src/cfgparser/oscan.lex ---- olsrd-0.5.6-r4.orig/src/cfgparser/oscan.lex 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/cfgparser/oscan.lex 2009-03-27 17:33:00.000000000 +0000 +--- a/src/cfgparser/oscan.lex ++++ b/src/cfgparser/oscan.lex @@ -253,11 +253,6 @@ return TOK_NETLABEL; } @@ -768,9 +488,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/cfgparser/oscan.lex olsrd-0.5.6-r4/src/cfgparse "FIBMetric" { yylval = NULL; return TOK_FIBMETRIC; -diff -ur olsrd-0.5.6-r4.orig/src/defs.h olsrd-0.5.6-r4/src/defs.h ---- olsrd-0.5.6-r4.orig/src/defs.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/defs.h 2009-03-27 17:33:00.000000000 +0000 +--- a/src/defs.h ++++ b/src/defs.h @@ -190,6 +190,8 @@ */ clock_t olsr_times(void); @@ -788,9 +507,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/defs.h olsrd-0.5.6-r4/src/defs.h /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/duplicate_set.c olsrd-0.5.6-r4/src/duplicate_set.c ---- olsrd-0.5.6-r4.orig/src/duplicate_set.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/duplicate_set.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/duplicate_set.c ++++ b/src/duplicate_set.c @@ -174,6 +174,7 @@ return false; /* no duplicate */ } @@ -807,9 +525,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/duplicate_set.c olsrd-0.5.6-r4/src/duplicate_se /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/hna_set.c olsrd-0.5.6-r4/src/hna_set.c ---- olsrd-0.5.6-r4.orig/src/hna_set.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/hna_set.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/hna_set.c ++++ b/src/hna_set.c @@ -279,6 +279,7 @@ * *@return nada @@ -826,9 +543,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/hna_set.c olsrd-0.5.6-r4/src/hna_set.c /** *Process incoming HNA message. -diff -ur olsrd-0.5.6-r4.orig/src/interfaces.c olsrd-0.5.6-r4/src/interfaces.c ---- olsrd-0.5.6-r4.orig/src/interfaces.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/interfaces.c 2009-03-27 17:33:00.000000000 +0000 +--- 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 */ @@ -868,9 +584,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/interfaces.c olsrd-0.5.6-r4/src/interfaces.c strscpy(interf_n->name, name, name_size); interf_n->next = olsr_cnf->interfaces; -diff -ur olsrd-0.5.6-r4.orig/src/interfaces.h olsrd-0.5.6-r4/src/interfaces.h ---- olsrd-0.5.6-r4.orig/src/interfaces.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/interfaces.h 2009-03-27 17:33:00.000000000 +0000 +--- a/src/interfaces.h ++++ b/src/interfaces.h @@ -200,7 +200,12 @@ struct interface *if_ifwithindex(const int if_index); @@ -885,9 +600,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/interfaces.h olsrd-0.5.6-r4/src/interfaces.h int add_ifchgf(int (*f) (struct interface *, int)); -diff -ur olsrd-0.5.6-r4.orig/src/ipc_frontend.c olsrd-0.5.6-r4/src/ipc_frontend.c ---- olsrd-0.5.6-r4.orig/src/ipc_frontend.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/ipc_frontend.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/ipc_frontend.c ++++ b/src/ipc_frontend.c @@ -46,6 +46,7 @@ * */ @@ -904,9 +618,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/ipc_frontend.c olsrd-0.5.6-r4/src/ipc_frontend. /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/ipc_frontend.h olsrd-0.5.6-r4/src/ipc_frontend.h ---- olsrd-0.5.6-r4.orig/src/ipc_frontend.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/ipc_frontend.h 2009-03-27 17:33:00.000000000 +0000 +--- a/src/ipc_frontend.h ++++ b/src/ipc_frontend.h @@ -48,6 +48,7 @@ #ifndef _OLSR_IPC @@ -923,9 +636,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/ipc_frontend.h olsrd-0.5.6-r4/src/ipc_frontend. /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/ipcalc.c olsrd-0.5.6-r4/src/ipcalc.c ---- olsrd-0.5.6-r4.orig/src/ipcalc.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/ipcalc.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/ipcalc.c ++++ b/src/ipcalc.c @@ -121,6 +121,7 @@ return prefix; } @@ -942,9 +654,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/ipcalc.c olsrd-0.5.6-r4/src/ipcalc.c /* 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. -diff -ur olsrd-0.5.6-r4.orig/src/ipcalc.h olsrd-0.5.6-r4/src/ipcalc.h ---- olsrd-0.5.6-r4.orig/src/ipcalc.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/ipcalc.h 2009-03-27 17:33:00.000000000 +0000 +--- 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)); } @@ -955,10 +666,9 @@ diff -ur olsrd-0.5.6-r4.orig/src/ipcalc.h olsrd-0.5.6-r4/src/ipcalc.h static INLINE const char * sockaddr4_to_string(struct ipaddr_str *const buf, const struct sockaddr *const addr) -diff -ur olsrd-0.5.6-r4.orig/src/link_set.c olsrd-0.5.6-r4/src/link_set.c ---- olsrd-0.5.6-r4.orig/src/link_set.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/link_set.c 2009-03-27 17:33:00.000000000 +0000 -@@ -761,6 +761,7 @@ +--- a/src/link_set.c ++++ b/src/link_set.c +@@ -762,6 +762,7 @@ return ret; } @@ -966,7 +676,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/link_set.c olsrd-0.5.6-r4/src/link_set.c void olsr_print_link_set(void) { -@@ -782,6 +783,7 @@ +@@ -783,6 +784,7 @@ } OLSR_FOR_ALL_LINK_ENTRIES_END(walker); #endif } @@ -974,9 +684,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/link_set.c olsrd-0.5.6-r4/src/link_set.c /* * called for every LQ HELLO message. -diff -ur olsrd-0.5.6-r4.orig/src/linux/apm.c olsrd-0.5.6-r4/src/linux/apm.c ---- olsrd-0.5.6-r4.orig/src/linux/apm.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/linux/apm.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/linux/apm.c ++++ b/src/linux/apm.c @@ -44,6 +44,7 @@ * Acpi-Power Enlightenment epplet */ @@ -993,9 +702,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/linux/apm.c olsrd-0.5.6-r4/src/linux/apm.c /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/linux/kernel_routes.c olsrd-0.5.6-r4/src/linux/kernel_routes.c ---- olsrd-0.5.6-r4.orig/src/linux/kernel_routes.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/linux/kernel_routes.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/linux/kernel_routes.c ++++ b/src/linux/kernel_routes.c @@ -300,11 +300,13 @@ if (rt_ret > 0) rt_ret = 0; /* successful recovery */ else rt_ret = -1; /* unrecoverable error */ @@ -1050,9 +758,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/linux/kernel_routes.c olsrd-0.5.6-r4/src/linux/ #if !LINUX_POLICY_ROUTING memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); -diff -ur olsrd-0.5.6-r4.orig/src/linux/net.c olsrd-0.5.6-r4/src/linux/net.c ---- olsrd-0.5.6-r4.orig/src/linux/net.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/linux/net.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/linux/net.c ++++ b/src/linux/net.c @@ -69,8 +69,10 @@ #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ @@ -1249,9 +956,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/linux/net.c olsrd-0.5.6-r4/src/linux/net.c /** *Creates a nonblocking broadcast socket. *@param sa sockaddr struct. Used for bind(2). -diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin.c olsrd-0.5.6-r4/src/lq_plugin.c ---- olsrd-0.5.6-r4.orig/src/lq_plugin.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/lq_plugin.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/lq_plugin.c ++++ b/src/lq_plugin.c @@ -67,12 +67,18 @@ init_lq_handler_tree(void) { @@ -1319,9 +1025,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin.c olsrd-0.5.6-r4/src/lq_plugin.c { struct link_entry *h; -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 ---- olsrd-0.5.6-r4.orig/src/lq_plugin_default_float.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/lq_plugin_default_float.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/lq_plugin_default_float.c ++++ b/src/lq_plugin_default_float.c @@ -39,6 +39,7 @@ * */ @@ -1338,9 +1043,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin_default_float.c olsrd-0.5.6-r4/src/lq /* * Local Variables: -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 ---- olsrd-0.5.6-r4.orig/src/lq_plugin_default_float.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/lq_plugin_default_float.h 2009-03-27 17:33:00.000000000 +0000 +--- a/src/lq_plugin_default_float.h ++++ b/src/lq_plugin_default_float.h @@ -39,6 +39,7 @@ * */ @@ -1357,9 +1061,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin_default_float.h olsrd-0.5.6-r4/src/lq /* * Local Variables: -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 ---- olsrd-0.5.6-r4.orig/src/lq_plugin_default_fpm.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/lq_plugin_default_fpm.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/lq_plugin_default_fpm.c ++++ b/src/lq_plugin_default_fpm.c @@ -39,6 +39,7 @@ * */ @@ -1376,9 +1079,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin_default_fpm.c olsrd-0.5.6-r4/src/lq_p /* * Local Variables: -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 ---- olsrd-0.5.6-r4.orig/src/lq_plugin_default_fpm.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/lq_plugin_default_fpm.h 2009-03-27 17:33:00.000000000 +0000 +--- a/src/lq_plugin_default_fpm.h ++++ b/src/lq_plugin_default_fpm.h @@ -39,6 +39,7 @@ * */ @@ -1395,9 +1097,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/lq_plugin_default_fpm.h olsrd-0.5.6-r4/src/lq_p /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/main.c olsrd-0.5.6-r4/src/main.c ---- olsrd-0.5.6-r4.orig/src/main.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/main.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/main.c ++++ b/src/main.c @@ -256,13 +256,17 @@ /* * Print configuration @@ -1448,7 +1149,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/main.c olsrd-0.5.6-r4/src/main.c } /* Initialize net */ -@@ -362,9 +372,11 @@ +@@ -355,9 +365,11 @@ /* Initialize the IPC socket */ @@ -1549,9 +1250,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/main.c olsrd-0.5.6-r4/src/main.c /* * Delete possible default GWs -diff -ur olsrd-0.5.6-r4.orig/src/neighbor_table.c olsrd-0.5.6-r4/src/neighbor_table.c ---- olsrd-0.5.6-r4.orig/src/neighbor_table.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/neighbor_table.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/neighbor_table.c ++++ b/src/neighbor_table.c @@ -362,6 +362,7 @@ * *@return nada @@ -1568,9 +1268,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/neighbor_table.c olsrd-0.5.6-r4/src/neighbor_ta /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/net_olsr.c olsrd-0.5.6-r4/src/net_olsr.c ---- olsrd-0.5.6-r4.orig/src/net_olsr.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/net_olsr.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/net_olsr.c ++++ b/src/net_olsr.c @@ -44,7 +44,9 @@ #include "log.h" #include "olsr.h" @@ -1609,9 +1308,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/net_olsr.c olsrd-0.5.6-r4/src/net_olsr.c retval = -1; } } -diff -ur olsrd-0.5.6-r4.orig/src/olsr.c olsrd-0.5.6-r4/src/olsr.c ---- olsrd-0.5.6-r4.orig/src/olsr.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/olsr.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/olsr.c ++++ b/src/olsr.c @@ -149,7 +149,9 @@ return; @@ -1692,9 +1390,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/olsr.c olsrd-0.5.6-r4/src/olsr.c /** *Wrapper for printf that prints to a specific -diff -ur olsrd-0.5.6-r4.orig/src/olsr.h olsrd-0.5.6-r4/src/olsr.h ---- olsrd-0.5.6-r4.orig/src/olsr.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/olsr.h 2009-03-27 17:33:00.000000000 +0000 +--- a/src/olsr.h ++++ b/src/olsr.h @@ -72,15 +72,21 @@ uint8_t olsr_calculate_willingness(void); @@ -1717,10 +1414,9 @@ diff -ur olsrd-0.5.6-r4.orig/src/olsr.h olsrd-0.5.6-r4/src/olsr.h int olsr_printf(int, const char *, ...) __attribute__ ((format(printf, 2, 3))); -diff -ur olsrd-0.5.6-r4.orig/src/olsr_cfg.h olsrd-0.5.6-r4/src/olsr_cfg.h ---- olsrd-0.5.6-r4.orig/src/olsr_cfg.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/olsr_cfg.h 2009-03-27 17:33:00.000000000 +0000 -@@ -148,8 +148,10 @@ +--- a/src/olsr_cfg.h ++++ b/src/olsr_cfg.h +@@ -149,8 +149,10 @@ char *name; char *config; bool configured; @@ -1731,7 +1427,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/olsr_cfg.h olsrd-0.5.6-r4/src/olsr_cfg.h struct interface *interf; struct if_config_options *cnf; struct olsr_if *next; -@@ -192,7 +194,9 @@ +@@ -193,7 +195,9 @@ uint16_t olsrport; int debug_level; bool no_fork; @@ -1741,7 +1437,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/olsr_cfg.h olsrd-0.5.6-r4/src/olsr_cfg.h int ip_version; bool allow_no_interfaces; uint16_t tos; -@@ -201,13 +205,17 @@ +@@ -202,13 +206,17 @@ uint8_t rttable_default; uint8_t willingness; bool willingness_auto; @@ -1759,7 +1455,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/olsr_cfg.h olsrd-0.5.6-r4/src/olsr_cfg.h struct olsr_if *interfaces; float pollrate; float nic_chgs_pollrate; -@@ -267,7 +275,9 @@ +@@ -269,7 +277,9 @@ void olsrd_free_cnf(struct olsrd_config *); @@ -1769,9 +1465,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/olsr_cfg.h olsrd-0.5.6-r4/src/olsr_cfg.h int olsrd_write_cnf(struct olsrd_config *, const char *); -diff -ur olsrd-0.5.6-r4.orig/src/parser.c olsrd-0.5.6-r4/src/parser.c ---- olsrd-0.5.6-r4.orig/src/parser.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/parser.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/parser.c ++++ b/src/parser.c @@ -51,7 +51,9 @@ #include "rebuild_packet.h" #include "net_os.h" @@ -1793,9 +1488,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/parser.c olsrd-0.5.6-r4/src/parser.c if (olsr_cnf->ip_version == AF_INET) msgsize = ntohs(m->v4.olsr_msgsize); -diff -ur olsrd-0.5.6-r4.orig/src/print_packet.c olsrd-0.5.6-r4/src/print_packet.c ---- olsrd-0.5.6-r4.orig/src/print_packet.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/print_packet.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/print_packet.c ++++ b/src/print_packet.c @@ -39,6 +39,7 @@ * */ @@ -1812,9 +1506,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/print_packet.c olsrd-0.5.6-r4/src/print_packet. /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/process_routes.c olsrd-0.5.6-r4/src/process_routes.c ---- olsrd-0.5.6-r4.orig/src/process_routes.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/process_routes.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/process_routes.c ++++ b/src/process_routes.c @@ -159,6 +159,7 @@ static void olsr_delete_kernel_route(struct rt_entry *rt) @@ -1868,9 +1561,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/process_routes.c olsrd-0.5.6-r4/src/process_rou olsr_print_routing_table(&routingtree); #endif } -diff -ur olsrd-0.5.6-r4.orig/src/rebuild_packet.c olsrd-0.5.6-r4/src/rebuild_packet.c ---- olsrd-0.5.6-r4.orig/src/rebuild_packet.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/rebuild_packet.c 2009-03-27 17:33:00.000000000 +0000 +--- 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) { @@ -1915,9 +1607,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/rebuild_packet.c olsrd-0.5.6-r4/src/rebuild_pac } } -diff -ur olsrd-0.5.6-r4.orig/src/routing_table.c olsrd-0.5.6-r4/src/routing_table.c ---- olsrd-0.5.6-r4.orig/src/routing_table.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/routing_table.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/routing_table.c ++++ b/src/routing_table.c @@ -628,6 +628,7 @@ /** * format a route entry into a buffer @@ -1948,9 +1639,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/routing_table.c olsrd-0.5.6-r4/src/routing_tabl /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/routing_table.h olsrd-0.5.6-r4/src/routing_table.h ---- olsrd-0.5.6-r4.orig/src/routing_table.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/routing_table.h 2009-03-27 17:33:00.000000000 +0000 +--- 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 *); @@ -1963,9 +1653,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/routing_table.h olsrd-0.5.6-r4/src/routing_tabl const struct rt_nexthop *olsr_get_nh(const struct rt_entry *); -diff -ur olsrd-0.5.6-r4.orig/src/tc_set.c olsrd-0.5.6-r4/src/tc_set.c ---- olsrd-0.5.6-r4.orig/src/tc_set.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/tc_set.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/tc_set.c ++++ b/src/tc_set.c @@ -336,6 +336,7 @@ /** * Format tc_edge contents into a buffer. @@ -1982,7 +1671,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/tc_set.c olsrd-0.5.6-r4/src/tc_set.c /** * Wrapper for the timer callback. -@@ -686,6 +688,7 @@ +@@ -694,6 +696,7 @@ /** * Print the topology table to stdout */ @@ -1990,7 +1679,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/tc_set.c olsrd-0.5.6-r4/src/tc_set.c void olsr_print_tc_table(void) { -@@ -711,6 +714,7 @@ +@@ -719,6 +722,7 @@ } OLSR_FOR_ALL_TC_ENTRIES_END(tc); #endif } @@ -1998,9 +1687,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/tc_set.c olsrd-0.5.6-r4/src/tc_set.c /* * calculate the border IPs of a tc edge set according to the border flags -diff -ur olsrd-0.5.6-r4.orig/src/tc_set.h olsrd-0.5.6-r4/src/tc_set.h ---- olsrd-0.5.6-r4.orig/src/tc_set.h 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/tc_set.h 2009-03-27 17:33:00.000000000 +0000 +--- a/src/tc_set.h ++++ b/src/tc_set.h @@ -157,7 +157,9 @@ /* tc_edge_entry manipulation */ @@ -2011,9 +1699,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/tc_set.h olsrd-0.5.6-r4/src/tc_set.h 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 *); -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 ---- olsrd-0.5.6-r4.orig/src/two_hop_neighbor_table.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/two_hop_neighbor_table.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/two_hop_neighbor_table.c ++++ b/src/two_hop_neighbor_table.c @@ -203,6 +203,8 @@ return NULL; } @@ -2031,9 +1718,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/two_hop_neighbor_table.c olsrd-0.5.6-r4/src/two /* * Local Variables: -diff -ur olsrd-0.5.6-r4.orig/src/unix/ifnet.c olsrd-0.5.6-r4/src/unix/ifnet.c ---- olsrd-0.5.6-r4.orig/src/unix/ifnet.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/unix/ifnet.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/unix/ifnet.c ++++ b/src/unix/ifnet.c @@ -70,6 +70,8 @@ #define BUFSPACE (127*1024) /* max. input buffer size to request */ @@ -2153,7 +1839,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/unix/ifnet.c olsrd-0.5.6-r4/src/unix/ifnet.c /** * Initializes the special interface used in * host-client emulation -@@ -583,6 +607,7 @@ +@@ -585,6 +609,7 @@ return 1; } @@ -2161,7 +1847,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/unix/ifnet.c olsrd-0.5.6-r4/src/unix/ifnet.c static char basenamestr[32]; static const char *if_basename(const char *name); -@@ -618,8 +643,10 @@ +@@ -620,8 +645,10 @@ int tos_bits = IPTOS_TOS(olsr_cnf->tos); #endif @@ -2172,7 +1858,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/unix/ifnet.c olsrd-0.5.6-r4/src/unix/ifnet.c memset(&ifr, 0, sizeof(struct ifreq)); memset(&ifs, 0, sizeof(struct interface)); -@@ -726,11 +753,13 @@ +@@ -728,11 +755,13 @@ ifs.int_broadaddr = *(struct sockaddr_in *)&ifr.ifr_broadaddr; } @@ -2186,7 +1872,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/unix/ifnet.c olsrd-0.5.6-r4/src/unix/ifnet.c } -@@ -760,7 +789,9 @@ +@@ -762,7 +791,9 @@ OLSR_PRINTF(1, "\tMTU - IPhdr: %d\n", ifs.int_mtu); @@ -2196,7 +1882,7 @@ diff -ur olsrd-0.5.6-r4.orig/src/unix/ifnet.c olsrd-0.5.6-r4/src/unix/ifnet.c OLSR_PRINTF(1, "\tIndex %d\n", ifs.if_index); if (olsr_cnf->ip_version == AF_INET) { -@@ -865,10 +896,14 @@ +@@ -867,10 +898,14 @@ */ memset(&null_addr, 0, olsr_cnf->ipsize); if (ipequal(&null_addr, &olsr_cnf->main_addr)) { @@ -2211,9 +1897,8 @@ diff -ur olsrd-0.5.6-r4.orig/src/unix/ifnet.c olsrd-0.5.6-r4/src/unix/ifnet.c } /* -diff -ur olsrd-0.5.6-r4.orig/src/unix/misc.c olsrd-0.5.6-r4/src/unix/misc.c ---- olsrd-0.5.6-r4.orig/src/unix/misc.c 2009-03-27 17:32:46.000000000 +0000 -+++ olsrd-0.5.6-r4/src/unix/misc.c 2009-03-27 17:33:00.000000000 +0000 +--- a/src/unix/misc.c ++++ b/src/unix/misc.c @@ -44,6 +44,7 @@ #include "misc.h" #include "olsr_types.h" diff --git a/modules/freifunk/root/etc/init.d/freifunk b/modules/freifunk/root/etc/init.d/freifunk index d90e3ff5e..3a668b11f 100755 --- a/modules/freifunk/root/etc/init.d/freifunk +++ b/modules/freifunk/root/etc/init.d/freifunk @@ -23,6 +23,10 @@ boot() { echo "0 */4 * * * /usr/sbin/ff_rdate" >> /etc/crontabs/root } + grep -q '/usr/sbin/ff_mapupdate' /etc/crontabs/root || { + echo "17 * * * * /usr/sbin/ff_mapupdate >> /etc/crontabs/root + } + [ -f /etc/rc.local ] && . /etc/rc.local [ -d /etc/rc.local.d ] && { for file in /etc/rc.local.d/*; do diff --git a/modules/freifunk/root/usr/sbin/ff_mapupdate b/modules/freifunk/root/usr/sbin/ff_mapupdate new file mode 100755 index 000000000..132546c6b --- /dev/null +++ b/modules/freifunk/root/usr/sbin/ff_mapupdate @@ -0,0 +1,49 @@ +#!/usr/bin/lua + +local uci = require "luci.model.uci" +local x = uci.cursor() + +local update_url = "http://www.layereight.de/freifunkmap.php?update=%.15f,%.15f&olsrip=%s¬e=%s&robot=%s" +local update_all = ( arg[1] and arg[1] == "all" ) and true or false + +local file +x:foreach("olsrd", "LoadPlugin", function(s) + if s.library == "olsrd_nameservice.so.0.3" then + file = io.open(s.latlon_file) + end +end) + +if file then + local ln + local count = 0 + while true do + ln = file:read("*l") + if not ln then break end + if update_all and ln:match("^Node%(") then + local ip, lat, lon, note = ln:match("Node%('(%S+)',([%d%.]+),([%d%.]+),%d+,'%S+','(%S+)'%)") + lat = tonumber(lat) + lon = tonumber(lon) + + if ip and lat ~= 0.0 and lon ~= 0.0 and note then + note = note:gsub("[^%w%-%.]+", "_") + os.execute("wget -qO/dev/null %q" % string.format(update_url, lat, lon, ip, note, "luci-massupdate")) + count = count + 1 + end + + elseif ln:match("^Self%(") then + local ip, lat, lon, note = ln:match("Self%('(%S+)',([%d%.]+),([%d%.]+),%d+,'%S+','(%S+)'%)") + lat = tonumber(lat) + lot = tonumber(lon) + + if ip and lat ~= 0.0 and lon ~= 0.0 and note then + note = note:gsub("[^%w%-%.]+", "_") + os.execute("wget -qO/dev/null %q" % string.format(update_url, lat, lon, ip, note, "luci-selfupdate")) + count = count + 1 + end + end + end + + os.execute("logger -t 'mapupdate' 'Updated %d entries in freifunk map'" % count) + + file:close() +end -- 2.25.1