contrib/package/olsrd-luci:
- switch from r3 to 0.5.6 stable branch - rebase unbloat patch - remove ipv4 broadcast from example config - tweak tc and hello intervals in init script
This commit is contained in:
parent
fc62fe46d0
commit
7e01a250b1
5 changed files with 311 additions and 826 deletions
|
@ -12,21 +12,21 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_BASENAME:=olsrd
|
PKG_BASENAME:=olsrd
|
||||||
PKG_NAME:=$(PKG_BASENAME)-luci
|
PKG_NAME:=$(PKG_BASENAME)-luci
|
||||||
PKG_BASEVER:=0.5.6-r3
|
PKG_BASEVER:=0.5.6-r3
|
||||||
PKG_VERSION:=$(PKG_BASEVER)+freifunk
|
PKG_VERSION:=$(PKG_BASEVER)+hg1765
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
#PKG_HGREV:=a7316f987848
|
PKG_HGREV:=fc691af9a18d
|
||||||
#PKG_SOURCE:=$(PKG_HGREV).tar.gz
|
PKG_SOURCE:=$(PKG_HGREV).tar.gz
|
||||||
#PKG_SOURCE_URL:=http://gredler.at/hg/olsrd/archive
|
PKG_SOURCE_URL:=http://gredler.at/hg/olsrd-0.5.6/archive
|
||||||
#PKG_MD5SUM:=b228b5452af158cd4313f9ed416d9c84
|
PKG_MD5SUM:=17fe345abf208ea1411d0a2041cf3c4e
|
||||||
#PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_HGREV)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_HGREV)
|
||||||
#PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
|
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_BASENAME)-$(PKG_BASEVER).tar.bz2
|
#PKG_SOURCE:=$(PKG_BASENAME)-$(PKG_BASEVER).tar.bz2
|
||||||
PKG_SOURCE_URL:=http://www.olsr.org/releases/0.5
|
#PKG_SOURCE_URL:=http://www.olsr.org/releases/0.5
|
||||||
PKG_MD5SUM:=0935688fa0fb5b0e073fe53ec654c5b2
|
#PKG_MD5SUM:=0935688fa0fb5b0e073fe53ec654c5b2
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_BASEVER)
|
#PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_BASEVER)
|
||||||
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xjf $(DL_DIR)/$(PKG_SOURCE)
|
#PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xjf $(DL_DIR)/$(PKG_SOURCE)
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ config 'olsrd'
|
||||||
config 'Interface'
|
config 'Interface'
|
||||||
option 'ignore' '1'
|
option 'ignore' '1'
|
||||||
option 'interface' 'ff'
|
option 'interface' 'ff'
|
||||||
option 'Ip4Broadcast' '255.255.255.255'
|
|
||||||
|
|
||||||
config 'LoadPlugin'
|
config 'LoadPlugin'
|
||||||
option 'library' 'olsrd_dyn_gw_plain.so.0.4'
|
option 'library' 'olsrd_dyn_gw_plain.so.0.4'
|
||||||
|
|
|
@ -10,7 +10,7 @@ PID=/var/run/olsrd.pid
|
||||||
OLSRD_OLSRD_SCHEMA='ignore:internal config_file:internal DebugLevel=0 IpVersion=4 AllowNoInt:bool=1 Pollrate=0.025 TcRedundancy=2 MprCoverage=3 LinkQualityFishEye=1 LinkQualityDijkstraLimit=0+9.0 FIBMetric=flat ClearScreen:bool=1 Willingness=3 LinkQualityAging=0.1 LinkQualityAlgorithm=etx_fpm'
|
OLSRD_OLSRD_SCHEMA='ignore:internal config_file:internal DebugLevel=0 IpVersion=4 AllowNoInt:bool=1 Pollrate=0.025 TcRedundancy=2 MprCoverage=3 LinkQualityFishEye=1 LinkQualityDijkstraLimit=0+9.0 FIBMetric=flat ClearScreen:bool=1 Willingness=3 LinkQualityAging=0.1 LinkQualityAlgorithm=etx_fpm'
|
||||||
OLSRD_IPCCONNECT_SCHEMA='ignore:internal Host:list Net:list2'
|
OLSRD_IPCCONNECT_SCHEMA='ignore:internal Host:list Net:list2'
|
||||||
OLSRD_LOADPLUGIN_SCHEMA='ignore:internal library:internal Host:list Net:list2 Ping:list redistribute:list NonOlsrIf:list name:list lat lon latlon_infile HNA:list2 hosts:list2'
|
OLSRD_LOADPLUGIN_SCHEMA='ignore:internal library:internal Host:list Net:list2 Ping:list redistribute:list NonOlsrIf:list name:list lat lon latlon_infile HNA:list2 hosts:list2'
|
||||||
OLSRD_INTERFACE_SCHEMA='ignore:internal interface:internal AutoDetectChanges:bool Ip4Broadcast HelloInterval=2.0 HelloValidityTime=40.0 TcInterval=5.0 TcValidityTime=100.0 MidInterval=18.0 MidValidityTime=324.0 HnaInterval=18.0 HnaValidityTime=108.0'
|
OLSRD_INTERFACE_SCHEMA='ignore:internal interface:internal AutoDetectChanges:bool Ip4Broadcast HelloInterval=5.0 HelloValidityTime=40.0 TcInterval=2.0 TcValidityTime=100.0 MidInterval=18.0 MidValidityTime=324.0 HnaInterval=18.0 HnaValidityTime=108.0'
|
||||||
|
|
||||||
T=' '
|
T=' '
|
||||||
N='
|
N='
|
||||||
|
|
|
@ -1,500 +0,0 @@
|
||||||
diff --exclude='.hg*' -Nur olsrd-0.5.6-r3/lib/nameservice/README_NAMESERVICE /home/sven-ola/olsrd-0.5.6/lib/nameservice/README_NAMESERVICE
|
|
||||||
--- olsrd-0.5.6-r3/lib/nameservice/README_NAMESERVICE 2008-12-02 11:42:54.000000000 +0100
|
|
||||||
+++ /home/sven-ola/olsrd-0.5.6/lib/nameservice/README_NAMESERVICE 2008-12-03 09:11:11.000000000 +0100
|
|
||||||
@@ -112,12 +112,32 @@
|
|
||||||
table. Useful for executing a script that uses the hosts file
|
|
||||||
to keep a website or a database updated.
|
|
||||||
|
|
||||||
+PlParam "service" "http://me.olsr:80|tcp|my little homepage"
|
|
||||||
+ Add a new service announcement to be spreaded in the mesh.
|
|
||||||
+
|
|
||||||
+PlParam "services-file" "/path/to/services_file"
|
|
||||||
+ File to write (default: /var/run/services_olsr)
|
|
||||||
+
|
|
||||||
PlParam "services-change-script" "/path/to/script"
|
|
||||||
Similar to the previous parameter. Script to execute when there
|
|
||||||
is a change in the services list propagated by the nameserver
|
|
||||||
plugin. Useful for executing a script that uses the services file
|
|
||||||
to keep a website or a database updated.
|
|
||||||
|
|
||||||
+PlParam "mac" "xx:xx:xx:xx:xx:xx[,0-255]"
|
|
||||||
+ Add a new MAC addr to be spreaded in the mesh. This MAC addr
|
|
||||||
+ may be used to fine control nerve-wreck-page solutions based
|
|
||||||
+ on MAC adresses. The optional dec. number designates a class.
|
|
||||||
+
|
|
||||||
+PlParam "macs-file" "/path/to/macs_file"
|
|
||||||
+ File to write (default: /var/run/macs_olsr)
|
|
||||||
+
|
|
||||||
+PlParam "macs-change-script" "/path/to/script"
|
|
||||||
+ Similar to the previous parameter. Script to execute when there
|
|
||||||
+ is a change in the macs list propagated by the nameserver
|
|
||||||
+ plugin. Useful for executing a script that uses the services file
|
|
||||||
+ to keep a website or a database updated.
|
|
||||||
+
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
SAMPLE CONFIG
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
diff --exclude='.hg*' -Nur olsrd-0.5.6-r3/lib/nameservice/src/nameservice.c /home/sven-ola/olsrd-0.5.6/lib/nameservice/src/nameservice.c
|
|
||||||
--- olsrd-0.5.6-r3/lib/nameservice/src/nameservice.c 2008-12-02 11:50:01.000000000 +0100
|
|
||||||
+++ /home/sven-ola/olsrd-0.5.6/lib/nameservice/src/nameservice.c 2008-12-03 09:20:01.000000000 +0100
|
|
||||||
@@ -75,8 +75,10 @@
|
|
||||||
static double my_timeout = NAME_VALID_TIME;
|
|
||||||
static char my_resolv_file[MAX_FILE + 1];
|
|
||||||
static char my_services_file[MAX_FILE + 1];
|
|
||||||
+static char my_macs_file[MAX_FILE + 1];
|
|
||||||
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];
|
|
||||||
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;
|
|
||||||
@@ -96,6 +98,10 @@
|
|
||||||
static struct name_entry *my_services = NULL;
|
|
||||||
static olsr_bool service_table_changed = OLSR_TRUE;
|
|
||||||
|
|
||||||
+static struct list_node mac_list[HASHSIZE];
|
|
||||||
+static struct name_entry *my_macs = NULL;
|
|
||||||
+static olsr_bool mac_table_changed = OLSR_TRUE;
|
|
||||||
+
|
|
||||||
static struct list_node forwarder_list[HASHSIZE];
|
|
||||||
static struct name_entry *my_forwarders = NULL;
|
|
||||||
static olsr_bool forwarder_table_changed = OLSR_TRUE;
|
|
||||||
@@ -131,6 +137,7 @@
|
|
||||||
|
|
||||||
GetWindowsDirectory(my_hosts_file, MAX_FILE - 12);
|
|
||||||
GetWindowsDirectory(my_services_file, MAX_FILE - 12);
|
|
||||||
+ GetWindowsDirectory(my_macs_file, MAX_FILE - 12);
|
|
||||||
GetWindowsDirectory(my_resolv_file, MAX_FILE - 12);
|
|
||||||
|
|
||||||
len = strlen(my_hosts_file);
|
|
||||||
@@ -143,6 +150,11 @@
|
|
||||||
strscat(my_services_file, "\\", sizeof(my_services_file));
|
|
||||||
strscat(my_services_file, "services_olsr", sizeof(my_services_file));
|
|
||||||
|
|
||||||
+ len = strlen(my_macs_file);
|
|
||||||
+ if (my_macs_file[len - 1] != '\\')
|
|
||||||
+ strscat(my_macs_file, "\\", sizeof(my_macs_file));
|
|
||||||
+ strscat(my_macs_file, "macs_olsr", sizeof(my_macs_file));
|
|
||||||
+
|
|
||||||
len = strlen(my_resolv_file);
|
|
||||||
if (my_resolv_file[len - 1] != '\\')
|
|
||||||
strscat(my_resolv_file, "\\", sizeof(my_resolv_file));
|
|
||||||
@@ -150,6 +162,7 @@
|
|
||||||
#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));
|
|
||||||
strscpy(my_resolv_file, "/var/run/resolvconf_olsr", sizeof(my_resolv_file));
|
|
||||||
*my_sighup_pid_file = 0;
|
|
||||||
#endif
|
|
||||||
@@ -160,12 +173,14 @@
|
|
||||||
latlon_in_file[0] = '\0';
|
|
||||||
my_name_change_script[0] = '\0';
|
|
||||||
my_services_change_script[0] = '\0';
|
|
||||||
+ my_macs_change_script[0] = '\0';
|
|
||||||
|
|
||||||
/* init the lists heads */
|
|
||||||
for (i = 0; i < HASHSIZE; i++) {
|
|
||||||
list_head_init(&name_list[i]);
|
|
||||||
list_head_init(&forwarder_list[i]);
|
|
||||||
list_head_init(&service_list[i]);
|
|
||||||
+ list_head_init(&mac_list[i]);
|
|
||||||
list_head_init(&latlon_list[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -232,58 +247,31 @@
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* *INDENT-OFF* */
|
|
||||||
static const struct olsrd_plugin_parameters plugin_parameters[] = {
|
|
||||||
- {.name = "interval",.set_plugin_parameter = &set_plugin_int,.data = &my_interval},
|
|
||||||
- {.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)}
|
|
||||||
- }
|
|
||||||
- ,
|
|
||||||
- {.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 = "resolv-file",.set_plugin_parameter = &set_plugin_string,.data = &my_resolv_file,.addon = {sizeof(my_resolv_file)}
|
|
||||||
- }
|
|
||||||
- ,
|
|
||||||
- {.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)}
|
|
||||||
- }
|
|
||||||
- ,
|
|
||||||
- {.name = "lat",.set_plugin_parameter = &set_nameservice_float,.data = &my_lat}
|
|
||||||
- ,
|
|
||||||
- {.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)}
|
|
||||||
- }
|
|
||||||
- ,
|
|
||||||
- {.name = "dns-server",.set_plugin_parameter = &set_nameservice_server,.data = &my_forwarders,.addon = {NAME_FORWARDER}
|
|
||||||
- }
|
|
||||||
- ,
|
|
||||||
- {.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 = "",.set_plugin_parameter = &set_nameservice_host,.data = &my_names}
|
|
||||||
- ,
|
|
||||||
+ { .name = "interval", .set_plugin_parameter = &set_plugin_int, .data = &my_interval },
|
|
||||||
+ { .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)} },
|
|
||||||
+ { .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)} },
|
|
||||||
+ { .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)} },
|
|
||||||
+ { .name = "macs-file", .set_plugin_parameter = &set_plugin_string, .data = &my_macs_file, .addon = {sizeof(my_macs_file)} },
|
|
||||||
+ { .name = "lat", .set_plugin_parameter = &set_nameservice_float, .data = &my_lat },
|
|
||||||
+ { .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)} },
|
|
||||||
+ { .name = "dns-server", .set_plugin_parameter = &set_nameservice_server, .data = &my_forwarders, .addon = {NAME_FORWARDER} },
|
|
||||||
+ { .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} },
|
|
||||||
+ { .name = "", .set_plugin_parameter = &set_nameservice_host, .data = &my_names },
|
|
||||||
};
|
|
||||||
+/* *INDENT-OFF* */
|
|
||||||
|
|
||||||
void
|
|
||||||
olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size)
|
|
||||||
@@ -404,6 +392,7 @@
|
|
||||||
my_names = remove_nonvalid_names_from_list(my_names, NAME_HOST);
|
|
||||||
my_forwarders = remove_nonvalid_names_from_list(my_forwarders, NAME_FORWARDER);
|
|
||||||
my_services = remove_nonvalid_names_from_list(my_services, NAME_SERVICE);
|
|
||||||
+ my_macs = remove_nonvalid_names_from_list(my_macs, NAME_MACADDR);
|
|
||||||
|
|
||||||
/* register functions with olsrd */
|
|
||||||
olsr_parser_add_function(&olsr_parser, PARSER_TYPE);
|
|
||||||
@@ -435,6 +424,9 @@
|
|
||||||
case NAME_SERVICE:
|
|
||||||
valid = allowed_service(my_list->name);
|
|
||||||
break;
|
|
||||||
+ case NAME_MACADDR:
|
|
||||||
+ valid = is_mac_wellformed(my_list->name);
|
|
||||||
+ break;
|
|
||||||
case NAME_LATLON:
|
|
||||||
valid = is_latlon_wellformed(my_list->name);
|
|
||||||
break;
|
|
||||||
@@ -470,10 +462,12 @@
|
|
||||||
|
|
||||||
free_name_entry_list(&my_names);
|
|
||||||
free_name_entry_list(&my_services);
|
|
||||||
+ free_name_entry_list(&my_macs);
|
|
||||||
free_name_entry_list(&my_forwarders);
|
|
||||||
|
|
||||||
free_all_list_entries(name_list);
|
|
||||||
free_all_list_entries(service_list);
|
|
||||||
+ free_all_list_entries(mac_list);
|
|
||||||
free_all_list_entries(forwarder_list);
|
|
||||||
free_all_list_entries(latlon_list);
|
|
||||||
|
|
||||||
@@ -517,11 +511,12 @@
|
|
||||||
{
|
|
||||||
write_file_timer = NULL;
|
|
||||||
|
|
||||||
- write_resolv_file(); /* if forwarder_table_changed */
|
|
||||||
- write_hosts_file(); /* if name_table_changed */
|
|
||||||
- write_services_file(); /* if service_table_changed */
|
|
||||||
+ write_resolv_file(); /* if forwarder_table_changed */
|
|
||||||
+ write_hosts_file(); /* if name_table_changed */
|
|
||||||
+ write_services_file(OLSR_FALSE); /* if service_table_changed */
|
|
||||||
+ write_services_file(OLSR_TRUE); /* if mac_table_changed */
|
|
||||||
#ifdef WIN32
|
|
||||||
- write_latlon_file(); /* if latlon_table_changed */
|
|
||||||
+ write_latlon_file(); /* if latlon_table_changed */
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -688,7 +683,6 @@
|
|
||||||
encap_namemsg(struct namemsg *msg)
|
|
||||||
{
|
|
||||||
struct name_entry *my_name;
|
|
||||||
- struct name_entry *my_service;
|
|
||||||
|
|
||||||
// add the hostname, service and forwarder entries after the namemsg header
|
|
||||||
char *pos = (char *)msg + sizeof(struct namemsg);
|
|
||||||
@@ -705,8 +699,13 @@
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
// services
|
|
||||||
- for (my_service = my_services; my_service != NULL; my_service = my_service->next) {
|
|
||||||
- pos = create_packet((struct name *)pos, my_service);
|
|
||||||
+ for (my_name = my_services; my_name != NULL; my_name = my_name->next) {
|
|
||||||
+ pos = create_packet((struct name *)pos, my_name);
|
|
||||||
+ i++;
|
|
||||||
+ }
|
|
||||||
+ // macs
|
|
||||||
+ for (my_name = my_macs; my_name != NULL; my_name = my_name->next) {
|
|
||||||
+ pos = create_packet((struct name *)pos, my_name);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
// latlon
|
|
||||||
@@ -779,6 +778,7 @@
|
|
||||||
//XXX: should I check the from_packet->ip here? If so, why not also check the ip from HOST and SERVICE?
|
|
||||||
if ((type_of_from_packet == NAME_HOST && !is_name_wellformed(name))
|
|
||||||
|| (type_of_from_packet == NAME_SERVICE && !is_service_wellformed(name))
|
|
||||||
+ || (type_of_from_packet == NAME_MACADDR && !is_mac_wellformed(name))
|
|
||||||
|| (type_of_from_packet == NAME_LATLON && !is_latlon_wellformed(name))) {
|
|
||||||
OLSR_PRINTF(4, "NAME PLUGIN: invalid name [%s] received, skipping.\n", name);
|
|
||||||
return;
|
|
||||||
@@ -886,6 +886,9 @@
|
|
||||||
case NAME_SERVICE:
|
|
||||||
insert_new_name_in_list(originator, service_list, from_packet, &service_table_changed, vtime);
|
|
||||||
break;
|
|
||||||
+ case NAME_MACADDR:
|
|
||||||
+ insert_new_name_in_list(originator, mac_list, from_packet, &mac_table_changed, vtime);
|
|
||||||
+ break;
|
|
||||||
case NAME_LATLON:
|
|
||||||
insert_new_name_in_list(originator, latlon_list, from_packet, &latlon_table_changed, vtime);
|
|
||||||
break;
|
|
||||||
@@ -1128,45 +1131,47 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
- * write services to a file in the format:
|
|
||||||
- * service #originator ip
|
|
||||||
+ * write services or macs to a file in the format:
|
|
||||||
+ * service-or-mac #originator ip
|
|
||||||
*
|
|
||||||
* since service has a special format
|
|
||||||
* each line will look similar to e.g.
|
|
||||||
* http://me.olsr:80|tcp|my little homepage
|
|
||||||
+ * while a mac line will look similar to
|
|
||||||
+ * 02:ca:ff:ee:ba:be,1
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
-write_services_file(void)
|
|
||||||
+write_services_file(olsr_bool writemacs)
|
|
||||||
{
|
|
||||||
int hash;
|
|
||||||
struct name_entry *name;
|
|
||||||
struct db_entry *entry;
|
|
||||||
struct list_node *list_head, *list_node;
|
|
||||||
- FILE *services_file;
|
|
||||||
+ FILE *file;
|
|
||||||
time_t currtime;
|
|
||||||
|
|
||||||
- if (!service_table_changed)
|
|
||||||
+ if ((writemacs && !mac_table_changed) || (!writemacs && !service_table_changed))
|
|
||||||
return;
|
|
||||||
|
|
||||||
- OLSR_PRINTF(2, "NAME PLUGIN: writing services file\n");
|
|
||||||
+ OLSR_PRINTF(2, "NAME PLUGIN: writing %s file\n", writemacs ? "macs" : "services");
|
|
||||||
|
|
||||||
- services_file = fopen(my_services_file, "w");
|
|
||||||
- if (services_file == NULL) {
|
|
||||||
- OLSR_PRINTF(2, "NAME PLUGIN: cant write services_file file\n");
|
|
||||||
+ file = fopen(writemacs ? my_macs_file : my_services_file, "w");
|
|
||||||
+ if (file == NULL) {
|
|
||||||
+ OLSR_PRINTF(2, "NAME PLUGIN: cant write %s\n", writemacs ? my_macs_file : my_services_file);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- fprintf(services_file, "### this file is overwritten regularly by olsrd\n");
|
|
||||||
- fprintf(services_file, "### do not edit\n\n");
|
|
||||||
+ fprintf(file, "### this file is overwritten regularly by olsrd\n");
|
|
||||||
+ fprintf(file, "### do not edit\n\n");
|
|
||||||
|
|
||||||
- // write own services
|
|
||||||
- for (name = my_services; name != NULL; name = name->next) {
|
|
||||||
- fprintf(services_file, "%s\t# my own service\n", name->name);
|
|
||||||
+ // write own services or macs
|
|
||||||
+ for (name = writemacs ? my_macs : my_services; name != NULL; name = name->next) {
|
|
||||||
+ fprintf(file, "%s\t# my own %s\n", name->name, writemacs ? "mac" : "service");
|
|
||||||
}
|
|
||||||
|
|
||||||
- // write received services
|
|
||||||
+ // write received services or macs
|
|
||||||
for (hash = 0; hash < HASHSIZE; hash++) {
|
|
||||||
- list_head = &service_list[hash];
|
|
||||||
+ list_head = writemacs ? &mac_list[hash] : &service_list[hash];
|
|
||||||
for (list_node = list_head->next; list_node != list_head; list_node = list_node->next) {
|
|
||||||
|
|
||||||
entry = list2db(list_node);
|
|
||||||
@@ -1176,26 +1181,38 @@
|
|
||||||
OLSR_PRINTF(6, "%s\t", name->name);
|
|
||||||
OLSR_PRINTF(6, "\t#%s\n", olsr_ip_to_string(&strbuf, &entry->originator));
|
|
||||||
|
|
||||||
- fprintf(services_file, "%s\t", name->name);
|
|
||||||
- fprintf(services_file, "\t#%s\n", olsr_ip_to_string(&strbuf, &entry->originator));
|
|
||||||
+ fprintf(file, "%s\t", name->name);
|
|
||||||
+ fprintf(file, "\t#%s\n", olsr_ip_to_string(&strbuf, &entry->originator));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time(&currtime)) {
|
|
||||||
- fprintf(services_file, "\n### written by olsrd at %s", ctime(&currtime));
|
|
||||||
+ fprintf(file, "\n### written by olsrd at %s", ctime(&currtime));
|
|
||||||
}
|
|
||||||
|
|
||||||
- fclose(services_file);
|
|
||||||
- service_table_changed = OLSR_FALSE;
|
|
||||||
-
|
|
||||||
- // Executes my_services_change_script after writing the services file
|
|
||||||
- if (my_services_change_script[0] != '\0') {
|
|
||||||
- if (system(my_services_change_script) != -1) {
|
|
||||||
- OLSR_PRINTF(2, "NAME PLUGIN: Service changed, %s executed\n", my_services_change_script);
|
|
||||||
- } else {
|
|
||||||
- OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on service change\n", my_services_change_script);
|
|
||||||
+ fclose(file);
|
|
||||||
+ if (writemacs) {
|
|
||||||
+ // Executes my_macs_change_script after writing the macs file
|
|
||||||
+ if (my_macs_change_script[0] != '\0') {
|
|
||||||
+ if (system(my_macs_change_script) != -1) {
|
|
||||||
+ OLSR_PRINTF(2, "NAME PLUGIN: Service changed, %s executed\n", my_macs_change_script);
|
|
||||||
+ } else {
|
|
||||||
+ OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on mac change\n", my_macs_change_script);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
+ mac_table_changed = OLSR_FALSE;
|
|
||||||
+ }
|
|
||||||
+ else {
|
|
||||||
+ // Executes my_services_change_script after writing the services file
|
|
||||||
+ if (my_services_change_script[0] != '\0') {
|
|
||||||
+ if (system(my_services_change_script) != -1) {
|
|
||||||
+ OLSR_PRINTF(2, "NAME PLUGIN: Service changed, %s executed\n", my_services_change_script);
|
|
||||||
+ } else {
|
|
||||||
+ OLSR_PRINTF(2, "NAME PLUGIN: WARNING! Failed to execute %s on service change\n", my_services_change_script);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ service_table_changed = OLSR_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1348,6 +1365,9 @@
|
|
||||||
case NAME_SERVICE:
|
|
||||||
service_table_changed = OLSR_TRUE;
|
|
||||||
break;
|
|
||||||
+ case NAME_MACADDR:
|
|
||||||
+ mac_table_changed = OLSR_TRUE;
|
|
||||||
+ break;
|
|
||||||
case NAME_LATLON:
|
|
||||||
latlon_table_changed = OLSR_TRUE;
|
|
||||||
break;
|
|
||||||
@@ -1498,6 +1518,22 @@
|
|
||||||
return regexec(®ex_t_service, service_line, pmatch_service, regmatch_t_service, 0) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * check if the mac matches the syntax
|
|
||||||
+ */
|
|
||||||
+olsr_bool
|
|
||||||
+is_mac_wellformed(const char *mac_line)
|
|
||||||
+{
|
|
||||||
+ size_t i;
|
|
||||||
+ olsr_bool ret;
|
|
||||||
+ int x[6], d = -1;
|
|
||||||
+ for(i = 0; i < ARRAYSIZE(x); i++) x[i] = -1;
|
|
||||||
+ sscanf(mac_line, "%02x:%02x:%02x:%02x:%02x:%02x,%d\n", &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &d);
|
|
||||||
+ ret = 0 <= d && d <= 0xffff;
|
|
||||||
+ for(i = 0; i < ARRAYSIZE(x); i++) ret = ret && 0 <= x[i];
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* check if the latlot matches the syntax
|
|
||||||
*/
|
|
||||||
diff --exclude='.hg*' -Nur olsrd-0.5.6-r3/lib/nameservice/src/nameservice.h /home/sven-ola/olsrd-0.5.6/lib/nameservice/src/nameservice.h
|
|
||||||
--- olsrd-0.5.6-r3/lib/nameservice/src/nameservice.h 2008-12-02 11:50:01.000000000 +0100
|
|
||||||
+++ /home/sven-ola/olsrd-0.5.6/lib/nameservice/src/nameservice.h 2008-12-03 09:20:01.000000000 +0100
|
|
||||||
@@ -145,7 +145,7 @@
|
|
||||||
|
|
||||||
void write_hosts_file(void);
|
|
||||||
|
|
||||||
-void write_services_file(void);
|
|
||||||
+void write_services_file(olsr_bool writemacs);
|
|
||||||
|
|
||||||
void write_resolv_file(void);
|
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@
|
|
||||||
|
|
||||||
olsr_bool is_service_wellformed(const char *service_line);
|
|
||||||
|
|
||||||
-olsr_bool is_service_wellformed(const char *service_line);
|
|
||||||
+olsr_bool is_mac_wellformed(const char *service_line);
|
|
||||||
|
|
||||||
olsr_bool is_latlon_wellformed(const char *latlon_line);
|
|
||||||
|
|
||||||
diff --exclude='.hg*' -Nur olsrd-0.5.6-r3/lib/nameservice/src/nameservice_msg.h /home/sven-ola/olsrd-0.5.6/lib/nameservice/src/nameservice_msg.h
|
|
||||||
--- olsrd-0.5.6-r3/lib/nameservice/src/nameservice_msg.h 2008-12-02 11:50:01.000000000 +0100
|
|
||||||
+++ /home/sven-ola/olsrd-0.5.6/lib/nameservice/src/nameservice_msg.h 2008-12-03 09:11:13.000000000 +0100
|
|
||||||
@@ -43,6 +43,7 @@
|
|
||||||
NAME_FORWARDER = 1,
|
|
||||||
NAME_SERVICE = 2,
|
|
||||||
NAME_LATLON = 3,
|
|
||||||
+ NAME_MACADDR = 4,
|
|
||||||
} NAME_TYPE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
diff --exclude='.hg*' -Nur olsrd-0.5.6-r3/lib/tas/src/lua/lobject.c /home/sven-ola/olsrd-0.5.6/lib/tas/src/lua/lobject.c
|
|
||||||
--- olsrd-0.5.6-r3/lib/tas/src/lua/lobject.c 2008-12-02 11:50:01.000000000 +0100
|
|
||||||
+++ /home/sven-ola/olsrd-0.5.6/lib/tas/src/lua/lobject.c 2008-12-03 09:19:32.000000000 +0100
|
|
||||||
@@ -42,11 +42,11 @@
|
|
||||||
return (m << 3) | cast(int, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* *INDENT-OFF* */
|
|
||||||
int
|
|
||||||
luaO_log2(unsigned int x)
|
|
||||||
{
|
|
||||||
static const lu_byte log_8[255] = {
|
|
||||||
-/* *INDENT-OFF* */
|
|
||||||
0,
|
|
||||||
1,1,
|
|
||||||
2,2,2,2,
|
|
||||||
@@ -59,7 +59,6 @@
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
|
|
||||||
-/* *INDENT-ON* */
|
|
||||||
};
|
|
||||||
if (x >= 0x00010000) {
|
|
||||||
if (x >= 0x01000000)
|
|
||||||
@@ -74,6 +73,7 @@
|
|
||||||
return -1; /* special `log' for 0 */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+/* *INDENT-ON* */
|
|
||||||
|
|
||||||
int
|
|
||||||
luaO_rawequalObj(const TObject * t1, const TObject * t2)
|
|
||||||
diff --exclude='.hg*' -Nur olsrd-0.5.6-r3/Makefile /home/sven-ola/olsrd-0.5.6/Makefile
|
|
||||||
--- olsrd-0.5.6-r3/Makefile 2008-12-02 11:50:01.000000000 +0100
|
|
||||||
+++ /home/sven-ola/olsrd-0.5.6/Makefile 2008-12-03 09:11:10.000000000 +0100
|
|
||||||
@@ -39,7 +39,7 @@
|
|
||||||
# Please also write a new version to:
|
|
||||||
# gui/win32/Main/Frontend.rc (line 71, around "CAPTION [...]")
|
|
||||||
# gui/win32/Inst/installer.nsi (line 57, around "MessageBox MB_YESNO [...]")
|
|
||||||
-VERS = 0.5.6-r3
|
|
||||||
+VERS = pre-0.5.6-r4
|
|
||||||
|
|
||||||
TOPDIR = .
|
|
||||||
include Makefile.inc
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue