From (spam-protected) Sun Sep 2 23:04:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 02 Sep 2007 21:04:45 +0000 Subject: [Olsr-cvs] olsrd-current/src plugin_util.c,1.3,1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1413/src Modified Files: plugin_util.c Log Message: * use "__attribute__((unused))" instead of empty code Index: plugin_util.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_util.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** plugin_util.c 25 Aug 2007 19:48:42 -0000 1.3 --- plugin_util.c 2 Sep 2007 21:04:42 -0000 1.4 *************** *** 45,53 **** #include "defs.h" ! int set_plugin_port(const char *value, void *data, unsigned int addon) { char *endptr; const unsigned int port = strtoul(value, &endptr, 0); - if (addon) {} if (*endptr != '\0' || endptr == value) { OLSR_PRINTF(0, "Illegal port number \"%s\"", value); --- 45,52 ---- #include "defs.h" ! int set_plugin_port(const char *value, void *data, unsigned int addon __attribute__((unused))) { char *endptr; const unsigned int port = strtoul(value, &endptr, 0); if (*endptr != '\0' || endptr == value) { OLSR_PRINTF(0, "Illegal port number \"%s\"", value); *************** *** 68,76 **** } ! int set_plugin_ipaddress(const char *value, void *data, unsigned int addon) { char buf[INET6_ADDRSTRLEN]; union olsr_ip_addr ip_addr; - if (addon) {} if (inet_pton(olsr_cnf->ip_version, value, &ip_addr) <= 0) { OLSR_PRINTF(0, "Illegal IP address \"%s\"", value); --- 67,74 ---- } ! int set_plugin_ipaddress(const char *value, void *data, unsigned int addon __attribute__((unused))) { char buf[INET6_ADDRSTRLEN]; union olsr_ip_addr ip_addr; if (inet_pton(olsr_cnf->ip_version, value, &ip_addr) <= 0) { OLSR_PRINTF(0, "Illegal IP address \"%s\"", value); *************** *** 89,96 **** ! int set_boolean(const char *value, void *data, unsigned int addon) { int *v = data; - if (addon) {} if (strcasecmp (value, "yes") == 0) { *v = 1; --- 87,93 ---- ! int set_boolean(const char *value, void *data, unsigned int addon __attribute__((unused))) { int *v = data; if (strcasecmp (value, "yes") == 0) { *v = 1; *************** *** 103,111 **** } ! int set_plugin_int(const char *value, void *data, unsigned int addon) { char *endptr; const int theint = strtol(value, &endptr, 0); - if (addon) {} if (*endptr != '\0' || endptr == value) { OLSR_PRINTF(0, "Illegal int \"%s\"", value); --- 100,107 ---- } ! int set_plugin_int(const char *value, void *data, unsigned int addon __attribute__((unused))) { char *endptr; const int theint = strtol(value, &endptr, 0); if (*endptr != '\0' || endptr == value) { OLSR_PRINTF(0, "Illegal int \"%s\"", value); From (spam-protected) Sun Sep 2 23:37:51 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 02 Sep 2007 21:37:51 +0000 Subject: [Olsr-cvs] olsrd-current/lib/mini version-script.txt,1.2,1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/mini In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14201/lib/mini Modified Files: version-script.txt Log Message: * converted it to plugin interface version 5. It doesn't make much sense to leave version 1 there Index: version-script.txt =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/version-script.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** version-script.txt 29 May 2005 12:47:41 -0000 1.2 --- version-script.txt 2 Sep 2007 21:37:49 -0000 1.3 *************** *** 3,8 **** global: olsrd_plugin_interface_version; - olsrd_plugin_register_param; olsrd_plugin_init; local: --- 3,8 ---- global: olsrd_plugin_interface_version; olsrd_plugin_init; + olsrd_get_plugin_parameters; local: From (spam-protected) Sun Sep 2 23:37:51 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 02 Sep 2007 21:37:51 +0000 Subject: [Olsr-cvs] olsrd-current/lib/mini/src olsrd_plugin.c, 1.3, 1.4 olsrd_plugin.h, 1.3, 1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/mini/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14201/lib/mini/src Modified Files: olsrd_plugin.c olsrd_plugin.h Log Message: * converted it to plugin interface version 5. It doesn't make much sense to leave version 1 there Index: olsrd_plugin.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/src/olsrd_plugin.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** olsrd_plugin.h 20 Apr 2007 14:18:56 -0000 1.3 --- olsrd_plugin.h 2 Sep 2007 21:37:49 -0000 1.4 *************** *** 47,53 **** olsrd_plugin_init(void); - int - olsrd_plugin_register_param(char *, char *); - int olsrd_plugin_interface_version(void); --- 47,50 ---- Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/src/olsrd_plugin.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** olsrd_plugin.c 20 Apr 2007 13:46:02 -0000 1.3 --- olsrd_plugin.c 2 Sep 2007 21:37:49 -0000 1.4 *************** *** 41,48 **** #include #include "olsrd_plugin.h" #include "olsr.h" ! #define PLUGIN_INTERFACE_VERSION 1 --- 41,50 ---- #include + #include "../../../src/olsrd_plugin.h" + #include "olsrd_plugin.h" #include "olsr.h" ! #define PLUGIN_INTERFACE_VERSION 5 *************** *** 55,77 **** * Used by main olsrd to check plugin interface version */ ! int ! olsrd_plugin_interface_version(void) { ! return PLUGIN_INTERFACE_VERSION; } /** * Register parameters from config file * Called for all plugin parameters */ ! int ! olsrd_plugin_register_param(char *key, char *value) { ! if(!strcmp(key, "test")) { ! printf("\n*** MINI: parameter test: %s\n", value); ! return 1; ! } ! return 0; } --- 57,84 ---- * Used by main olsrd to check plugin interface version */ ! int olsrd_plugin_interface_version(void) { ! return PLUGIN_INTERFACE_VERSION; } + static int set_plugin_test(const char *value, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) + { + printf("\n*** MINI: parameter test: %s\n", value); + return 0; + } + /** * Register parameters from config file * Called for all plugin parameters */ ! static const struct olsrd_plugin_parameters plugin_parameters[] = { ! { .name = "test", .set_plugin_parameter = &set_plugin_test, .data = NULL }, ! }; ! ! void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size) { ! *params = plugin_parameters; ! *size = sizeof(plugin_parameters)/sizeof(*plugin_parameters); } *************** *** 99,107 **** /* attention: make static to avoid name clashes */ ! static void __attribute__ ((constructor)) ! my_init(void); ! ! static void __attribute__ ((destructor)) ! my_fini(void); --- 106,111 ---- /* attention: make static to avoid name clashes */ ! static void my_init(void) __attribute__ ((constructor)); ! static void my_fini(void) __attribute__ ((destructor)); *************** *** 109,116 **** * Optional Private Constructor */ ! static void ! my_init(void) { ! printf("*** MINI: constructor\n"); } --- 113,119 ---- * Optional Private Constructor */ ! static void my_init(void) { ! printf("*** MINI: constructor\n"); } *************** *** 119,125 **** * Optional Private Destructor */ ! static void ! my_fini(void) { ! printf("*** MINI: destructor\n"); } --- 122,127 ---- * Optional Private Destructor */ ! static void my_fini(void) { ! printf("*** MINI: destructor\n"); } From (spam-protected) Mon Sep 3 00:17:03 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 02 Sep 2007 22:17:03 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src http.c, 1.5, 1.6 http.h, 1.1, 1.2 plugin.c, 1.8, 1.9 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29712/lib/tas/src Modified Files: http.c http.h plugin.c Log Message: * converted TAS plugin interface to version 5. Untested since I have not test cases. But it looks pretty obvious Index: http.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** http.h 12 Apr 2005 17:17:26 -0000 1.1 --- http.h 2 Sep 2007 22:17:00 -0000 1.2 *************** *** 118,133 **** extern void httpInit(void); ! extern int httpSetAddress(const char *addrStr); ! extern int httpSetPort(const char *portStr); ! extern int httpSetRootDir(const char *rootDir); ! extern int httpSetWorkDir(const char *workDir); ! extern void httpSetIndexFile(const char *indexFile); ! extern void httpSetUser(const char *user); ! extern void httpSetPassword(const char *password); ! extern int httpSetSessTime(const char *timeStr); ! extern void httpSetPubDir(const char *pref); ! extern int httpSetQuantum(const char *quantumStr); ! extern int httpSetMessTime(const char *timeStr); ! extern int httpSetMessLimit(const char *limitStr); extern int httpSetup(void); --- 118,133 ---- extern void httpInit(void); ! extern int httpSetAddress(const char *addrStr, void *data, unsigned int addon); ! extern int httpSetPort(const char *portStr, void *data, unsigned int addon); ! extern int httpSetRootDir(const char *rootDir, void *data, unsigned int addon); ! extern int httpSetWorkDir(const char *workDir, void *data, unsigned int addon); ! extern int httpSetIndexFile(const char *indexFile, void *data, unsigned int addon); ! extern int httpSetUser(const char *user, void *data, unsigned int addon); ! extern int httpSetPassword(const char *password, void *data, unsigned int addon); ! extern int httpSetSessTime(const char *timeStr, void *data, unsigned int addon); ! extern int httpSetPubDir(const char *pref, void *data, unsigned int addon); ! extern int httpSetQuantum(const char *quantumStr, void *data, unsigned int addon); ! extern int httpSetMessTime(const char *timeStr, void *data, unsigned int addon); ! extern int httpSetMessLimit(const char *limitStr, void *data, unsigned int addon); extern int httpSetup(void); Index: plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/plugin.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** plugin.c 20 Apr 2007 13:46:03 -0000 1.8 --- plugin.c 2 Sep 2007 22:17:00 -0000 1.9 *************** *** 51,54 **** --- 51,55 ---- #include "glua.h" #include "glua_ext.h" + #include "olsrd_plugin.h" #include *************** *** 68,71 **** --- 69,74 ---- #include + #define PLUGIN_INTERFACE_VERSION 5 + #define MESSAGE_TYPE 129 *************** *** 463,467 **** int olsrd_plugin_interface_version(void) { ! return 4; } --- 466,470 ---- int olsrd_plugin_interface_version(void) { ! return PLUGIN_INTERFACE_VERSION; } *************** *** 487,580 **** } ! int olsrd_plugin_register_param(char *name, char *value) ! { ! if (strcmp(name, "address") == 0) ! { ! if (httpSetAddress(value) < 0) ! return 0; ! ! return 1; ! } ! ! if (strcmp(name, "port") == 0) ! { ! if (httpSetPort(value) < 0) ! return 0; ! ! return 1; ! } ! ! if (strcmp(name, "rootdir") == 0) ! { ! if (httpSetRootDir(value) < 0) ! return 0; ! ! return 1; ! } ! ! if (strcmp(name, "workdir") == 0) ! { ! if (httpSetWorkDir(value) < 0) ! return 0; ! ! return 1; ! } ! ! if (strcmp(name, "indexfile") == 0) ! { ! httpSetIndexFile(value); ! return 1; ! } ! ! if (strcmp(name, "user") == 0) ! { ! httpSetUser(value); ! return 1; ! } ! ! if (strcmp(name, "password") == 0) ! { ! httpSetPassword(value); ! return 1; ! } ! ! if (strcmp(name, "sesstime") == 0) ! { ! if (httpSetSessTime(value) < 0) ! return 0; ! ! return 1; ! } ! ! if (strcmp(name, "pubdir") == 0) ! { ! httpSetPubDir(value); ! return 1; ! } ! ! if (strcmp(name, "quantum") == 0) ! { ! if (httpSetQuantum(value) < 0) ! return 0; ! ! return 1; ! } ! ! if (strcmp(name, "messtime") == 0) ! { ! if (httpSetMessTime(value) < 0) ! return 0; ! ! return 1; ! } ! ! if (strcmp(name, "messlimit") == 0) ! { ! if (httpSetMessLimit(value) < 0) ! return 0; ! ! return 1; ! } ! return 0; } --- 490,511 ---- } ! static const struct olsrd_plugin_parameters plugin_parameters[] = { ! { .name = "address", .set_plugin_parameter = &httpSetAddress, .data = NULL }, ! { .name = "port", .set_plugin_parameter = &httpSetPort, .data = NULL }, ! { .name = "rootdir", .set_plugin_parameter = &httpSetRootDir, .data = NULL }, ! { .name = "workdir", .set_plugin_parameter = &httpSetWorkDir, .data = NULL }, ! { .name = "indexfile", .set_plugin_parameter = &httpSetIndexFile, .data = NULL }, ! { .name = "user", .set_plugin_parameter = &httpSetUser, .data = NULL }, ! { .name = "password", .set_plugin_parameter = &httpSetPassword, .data = NULL }, ! { .name = "sesstime", .set_plugin_parameter = &httpSetSessTime, .data = NULL }, ! { .name = "pubdir", .set_plugin_parameter = &httpSetPubDir, .data = NULL }, ! { .name = "quantum", .set_plugin_parameter = &httpSetQuantum, .data = NULL }, ! { .name = "messtime", .set_plugin_parameter = &httpSetMessTime, .data = NULL }, ! { .name = "messlimit", .set_plugin_parameter = &httpSetMessLimit, .data = NULL }, ! }; ! void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size) ! { ! *params = plugin_parameters; ! *size = sizeof(plugin_parameters)/sizeof(*plugin_parameters); } Index: http.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** http.c 10 Nov 2005 19:50:42 -0000 1.5 --- http.c 2 Sep 2007 22:17:00 -0000 1.6 *************** *** 448,452 **** } ! int httpSetAddress(const char *addrStr) { if (parseIpAddr(&confAddr, addrStr) < 0) --- 448,452 ---- } ! int httpSetAddress(const char *addrStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (parseIpAddr(&confAddr, addrStr) < 0) *************** *** 459,463 **** } ! int httpSetPort(const char *portStr) { unsigned int port; --- 459,463 ---- } ! int httpSetPort(const char *portStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int port; *************** *** 480,484 **** } ! int httpSetRootDir(const char *rootDir) { if (checkAbsPath(rootDir) < 0) --- 480,484 ---- } ! int httpSetRootDir(const char *rootDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (checkAbsPath(rootDir) < 0) *************** *** 492,496 **** } ! int httpSetWorkDir(const char *workDir) { if (checkAbsPath(workDir) < 0) --- 492,496 ---- } ! int httpSetWorkDir(const char *workDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (checkAbsPath(workDir) < 0) *************** *** 504,523 **** } ! void httpSetIndexFile(const char *indexFile) { confIndexFile = myStrdup(indexFile); } ! void httpSetUser(const char *user) { confUser = myStrdup(user); } ! void httpSetPassword(const char *password) { confPassword = myStrdup(password); } ! int httpSetSessTime(const char *timeStr) { unsigned int time; --- 504,526 ---- } ! int httpSetIndexFile(const char *indexFile, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { confIndexFile = myStrdup(indexFile); + return 0; } ! int httpSetUser(const char *user, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { confUser = myStrdup(user); + return 0; } ! int httpSetPassword(const char *password, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { confPassword = myStrdup(password); + return 0; } ! int httpSetSessTime(const char *timeStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int time; *************** *** 540,549 **** } ! void httpSetPubDir(const char *pubDir) { confPubDir = myStrdup(pubDir); } ! int httpSetQuantum(const char *quantumStr) { unsigned int quantum; --- 543,553 ---- } ! int httpSetPubDir(const char *pubDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { confPubDir = myStrdup(pubDir); + return 0; } ! int httpSetQuantum(const char *quantumStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int quantum; *************** *** 566,570 **** } ! int httpSetMessTime(const char *timeStr) { unsigned int time; --- 570,574 ---- } ! int httpSetMessTime(const char *timeStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int time; *************** *** 587,591 **** } ! int httpSetMessLimit(const char *limitStr) { unsigned int limit; --- 591,595 ---- } ! int httpSetMessLimit(const char *limitStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int limit; From (spam-protected) Mon Sep 3 00:17:02 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 02 Sep 2007 22:17:02 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas test.c,1.2,1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29712/lib/tas Modified Files: test.c Log Message: * converted TAS plugin interface to version 5. Untested since I have not test cases. But it looks pretty obvious Index: test.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/test.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test.c 15 Jul 2007 17:48:55 -0000 1.2 --- test.c 2 Sep 2007 22:17:00 -0000 1.3 *************** *** 89,93 **** } ! if (httpSetAddress(av[i]) < 0) { fprintf(stderr, "cannot set address\n"); --- 89,93 ---- } ! if (httpSetAddress(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set address\n"); *************** *** 105,109 **** } ! if (httpSetPort(av[i]) < 0) { fprintf(stderr, "cannot set port\n"); --- 105,109 ---- } ! if (httpSetPort(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set port\n"); *************** *** 121,125 **** } ! if (httpSetWorkDir(av[i]) < 0) { fprintf(stderr, "cannot set work directory\n"); --- 121,125 ---- } ! if (httpSetWorkDir(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set work directory\n"); *************** *** 137,141 **** } ! if (httpSetRootDir(av[i]) < 0) { fprintf(stderr, "cannot set root directory\n"); --- 137,141 ---- } ! if (httpSetRootDir(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set root directory\n"); *************** *** 153,157 **** } ! httpSetIndexFile(av[i]); } --- 153,157 ---- } ! httpSetIndexFile(av[i], NULL, 0); } *************** *** 165,169 **** } ! httpSetUser(av[i]); } --- 165,169 ---- } ! httpSetUser(av[i], NULL, 0); } *************** *** 177,181 **** } ! httpSetPassword(av[i]); } --- 177,181 ---- } ! httpSetPassword(av[i], NULL, 0); } *************** *** 189,193 **** } ! if (httpSetSessTime(av[i]) < 0) { fprintf(stderr, "cannot set session timeout\n"); --- 189,193 ---- } ! if (httpSetSessTime(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set session timeout\n"); *************** *** 205,209 **** } ! httpSetPubDir(av[i]); } --- 205,209 ---- } ! httpSetPubDir(av[i], NULL, 0); } *************** *** 217,221 **** } ! if (httpSetQuantum(av[i]) < 0) { fprintf(stderr, "cannot set quantum\n"); --- 217,221 ---- } ! if (httpSetQuantum(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set quantum\n"); *************** *** 233,237 **** } ! if (httpSetMessTime(av[i]) < 0) { fprintf(stderr, "cannot set message timeout\n"); --- 233,237 ---- } ! if (httpSetMessTime(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set message timeout\n"); *************** *** 249,253 **** } ! if (httpSetMessLimit(av[i]) < 0) { fprintf(stderr, "cannot set message queue limit\n"); --- 249,253 ---- } ! if (httpSetMessLimit(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set message queue limit\n"); From (spam-protected) Mon Sep 3 00:51:35 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 02 Sep 2007 22:51:35 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas version-script.txt,1.2,1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11398/lib/tas Modified Files: version-script.txt Log Message: * and declare the correct function Index: version-script.txt =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/version-script.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** version-script.txt 29 May 2005 12:47:44 -0000 1.2 --- version-script.txt 2 Sep 2007 22:51:33 -0000 1.3 *************** *** 3,8 **** global: olsrd_plugin_interface_version; - olsrd_plugin_register_param; olsrd_plugin_init; local: --- 3,8 ---- global: olsrd_plugin_interface_version; olsrd_plugin_init; + olsrd_get_plugin_parameters; local: From (spam-protected) Wed Sep 5 18:11:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga/src quagga.c,1.5,1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/lib/quagga/src Modified Files: quagga.c Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: quagga.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/quagga.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** quagga.c 25 Aug 2007 19:48:42 -0000 1.5 --- quagga.c 5 Sep 2007 16:11:10 -0000 1.6 *************** *** 164,174 **** void zebra_cleanup (void) { int i; - struct rt_entry *tmp; if (zebra.options & OPTION_EXPORT) { ! for (i = 0; i < HASHSIZE; i++) { ! for (tmp = routingtable[i].next; tmp != &routingtable[i]; tmp = tmp->next) ! zebra_del_olsr_v4_route (tmp); ! for (tmp = hna_routes[i].next; tmp != &hna_routes[i]; tmp = tmp->next) ! zebra_del_olsr_v4_route (tmp) ; } } --- 164,172 ---- void zebra_cleanup (void) { int i; if (zebra.options & OPTION_EXPORT) { ! struct rt_entry *rt; ! OLSR_FOR_ALL_RT_ENTRIES(rt) { ! zebra_del_olsr_v4_route (rt); ! } OLSR_FOR_ALL_RT_ENTRIES_END(rt); } *************** *** 179,183 **** static void zebra_reconnect (void) { - struct rt_entry *tmp; int i; --- 177,180 ---- *************** *** 186,195 **** if (zebra.options & OPTION_EXPORT) { ! for (i = 0; i < HASHSIZE; i++) { ! for (tmp = routingtable[i].next; tmp != &routingtable[i]; tmp = tmp->next) ! zebra_add_olsr_v4_route (tmp); ! for (tmp = hna_routes[i].next; tmp != &hna_routes[i]; tmp = tmp->next) ! zebra_add_olsr_v4_route (tmp); ! } } --- 183,190 ---- if (zebra.options & OPTION_EXPORT) { ! struct rt_entry *rt; ! OLSR_FOR_ALL_RT_ENTRIES(rt) { ! zebra_add_olsr_v4_route (rt); ! } OLSR_FOR_ALL_RT_ENTRIES_END(rt); } *************** *** 741,752 **** route.message = ZAPI_MESSAGE_METRIC; route.flags = zebra.flags; ! route.prefixlen = masktoprefixlen (r->rt_mask.v4); ! route.prefix = r->rt_dst.v4; ! if ((r->rt_router.v4 == r->rt_dst.v4 && route.prefixlen == 32)){ route.message |= ZAPI_MESSAGE_IFINDEX | ZAPI_MESSAGE_NEXTHOP; route.ind_num = 1; route.index = olsr_malloc (sizeof *route.index, "zebra_add_olsr_v4_route"); ! *route.index = htonl(r->rt_if->if_index); route.nexthops = olsr_malloc (sizeof route.nexthops->type + sizeof route.nexthops->payload, --- 736,748 ---- route.message = ZAPI_MESSAGE_METRIC; route.flags = zebra.flags; ! route.prefixlen = r->rt_dst.prefix_len; ! route.prefix = r->rt_dst.prefix.v4; ! if ((r->rt_best->rtp_nexthop.gateway.v4 == r->rt_dst.prefix.v4 && ! route.prefixlen == 32)) { route.message |= ZAPI_MESSAGE_IFINDEX | ZAPI_MESSAGE_NEXTHOP; route.ind_num = 1; route.index = olsr_malloc (sizeof *route.index, "zebra_add_olsr_v4_route"); ! *route.index = htonl(r->rt_best->rtp_nexthop.iface->if_index); route.nexthops = olsr_malloc (sizeof route.nexthops->type + sizeof route.nexthops->payload, *************** *** 763,770 **** "zebra_add_olsr_v4_route"); route.nexthops->type = ZEBRA_NEXTHOP_IPV4; ! route.nexthops->payload.v4 = r->rt_router.v4; } ! route.metric = r->rt_metric; route.metric = htonl(route.metric); --- 759,766 ---- "zebra_add_olsr_v4_route"); route.nexthops->type = ZEBRA_NEXTHOP_IPV4; ! route.nexthops->payload.v4 = r->rt_best->rtp_nexthop.gateway.v4; } ! route.metric = r->rt_best->rtp_metric.hops; route.metric = htonl(route.metric); *************** *** 786,797 **** route.message = ZAPI_MESSAGE_METRIC; route.flags = zebra.flags; ! route.prefixlen = masktoprefixlen (r->rt_mask.v4); ! route.prefix = r->rt_dst.v4; ! if ((r->rt_router.v4 == r->rt_dst.v4 && route.prefixlen == 32)){ route.message |= ZAPI_MESSAGE_IFINDEX; route.ind_num = 1; route.index = olsr_malloc (sizeof *route.index, "zebra_add_olsr_v4_route"); ! *route.index = htonl (r->rt_if->if_index); route.nexthops = olsr_malloc (sizeof route.nexthops->type + sizeof route.nexthops->payload, --- 782,793 ---- route.message = ZAPI_MESSAGE_METRIC; route.flags = zebra.flags; ! route.prefixlen = r->rt_dst.prefix_len; ! route.prefix = r->rt_dst.prefix.v4; ! if ((r->rt_best->rtp_nexthop.gateway.v4 == r->rt_dst.prefix.v4 && route.prefixlen == 32)){ route.message |= ZAPI_MESSAGE_IFINDEX; route.ind_num = 1; route.index = olsr_malloc (sizeof *route.index, "zebra_add_olsr_v4_route"); ! *route.index = htonl (r->rt_best->rtp_nexthop.iface->if_index); route.nexthops = olsr_malloc (sizeof route.nexthops->type + sizeof route.nexthops->payload, *************** *** 808,814 **** "zebra_add_olsr_v4_route"); route.nexthops->type = ZEBRA_NEXTHOP_IPV4; ! route.nexthops->payload.v4 = r->rt_router.v4; } ! route.metric = r->rt_metric; route.metric = htonl (route.metric); --- 804,810 ---- "zebra_add_olsr_v4_route"); route.nexthops->type = ZEBRA_NEXTHOP_IPV4; ! route.nexthops->payload.v4 = r->rt_best->rtp_nexthop.gateway.v4; } ! route.metric = r->rt_best->rtp_metric.hops; route.metric = htonl (route.metric); From (spam-protected) Wed Sep 5 18:11:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c,1.7,1.8 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/lib/txtinfo/src Modified Files: olsrd_txtinfo.c Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** olsrd_txtinfo.c 15 Jul 2007 19:29:37 -0000 1.7 --- olsrd_txtinfo.c 5 Sep 2007 16:11:10 -0000 1.8 *************** *** 310,344 **** static void ipc_print_routes(void) { ! int size = 0, index; ! struct rt_entry *routes; ! ipc_sendf("Table: Routes\nDestination\tGateway\tMetric\tETX\tInterface\tType\n"); ! /* Neighbors */ ! for(index = 0;index < HASHSIZE; index++) { ! for(routes = routingtable[index].next; ! routes != &routingtable[index]; ! routes = routes->next) { ! size = 0; ! ipc_sendf( "%s\t%s\t%d\t%.2f\t%s\tHOST\n", ! olsr_ip_to_string(&routes->rt_dst), ! olsr_ip_to_string(&routes->rt_router), ! routes->rt_metric, ! routes->rt_etx, ! routes->rt_if->int_name); ! } ! } - /* HNA */ - for(index = 0;index < HASHSIZE;index++) { - for(routes = hna_routes[index].next; - routes != &hna_routes[index]; - routes = routes->next) { - ipc_sendf("%s\t%s\t%d\t%s\t\tHNA\n", - olsr_ip_to_string(&routes->rt_dst), - olsr_ip_to_string(&routes->rt_router), - routes->rt_metric, - routes->rt_if->int_name); - } } ipc_sendf("\n"); --- 310,333 ---- static void ipc_print_routes(void) { ! struct rt_entry *rt; ! struct avl_node *rt_tree_node; ! ipc_sendf("Table: Routes\nDestination\tGateway\tMetric\tETX\tInterface\n"); ! /* Walk the route table */ ! for (rt_tree_node = avl_walk_first(&routingtree); ! rt_tree_node; ! rt_tree_node = avl_walk_next(rt_tree_node)) { ! ! rt = rt_tree_node->data; ! ! ipc_sendf( "%s/%d\t%s\t%d\t%.3f\t%s\t\n", ! olsr_ip_to_string(&rt->rt_dst.prefix), ! rt->rt_dst.prefix_len, ! olsr_ip_to_string(&rt->rt_best->rtp_nexthop.gateway), ! rt->rt_best->rtp_metric.hops, ! rt->rt_best->rtp_metric.etx, ! rt->rt_best->rtp_nexthop.iface->int_name); } ipc_sendf("\n"); From (spam-protected) Wed Sep 5 18:11:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src plugin.c,1.9,1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/lib/tas/src Modified Files: plugin.c Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/plugin.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** plugin.c 2 Sep 2007 22:17:00 -0000 1.9 --- plugin.c 5 Sep 2007 16:11:10 -0000 1.10 *************** *** 85,89 **** static struct tc_entry *tcTab = NULL; static struct hna_entry *hnaTab = NULL; - static struct rt_entry *routeTab = NULL; static struct olsrd_config *config = NULL; --- 85,88 ---- *************** *** 222,245 **** int iterRouteTabNext(char *buff, int len) { if (iterRouteTab == NULL) return -1; snprintf(buff, len, "destination~%s~gateway~%s~interface~%s~metric~%d~", ! rawIpAddrToString(&iterRouteTab->rt_dst, ipAddrLen), ! rawIpAddrToString(&iterRouteTab->rt_router, ipAddrLen), ! iterRouteTab->rt_if->int_name, iterRouteTab->rt_metric); ! ! iterRouteTab = iterRouteTab->next; ! if (iterRouteTab == &routeTab[iterIndex]) ! { ! iterRouteTab = NULL; ! ! while (++iterIndex < HASHSIZE) ! if (routeTab[iterIndex].next != &routeTab[iterIndex]) ! { ! iterRouteTab = routeTab[iterIndex].next; ! break; ! } } --- 221,240 ---- int iterRouteTabNext(char *buff, int len) { + struct avl_node *rt_tree_node; + if (iterRouteTab == NULL) return -1; snprintf(buff, len, "destination~%s~gateway~%s~interface~%s~metric~%d~", ! rawIpAddrToString(&iterRouteTab->rt_dst.prefix, ipAddrLen), ! rawIpAddrToString(&iterRouteTab->rt_best->rtp_nexthop.gateway, ipAddrLen), ! iterRouteTab->rt_best->rtp_nexthop.iface->int_name, ! iterRouteTab->rt_best->rtp_metric.hops); ! rt_tree_node = avl_walk_next(&iterRouteTab->rt_tree_node); ! if (rt_tree_node) { ! iterRouteTab = rt_tree_node->data; ! } else { ! iterRouteTab = NULL; } *************** *** 249,263 **** void iterRouteTabInit(void) { ! iterRouteTab = NULL; ! ! if (routeTab == NULL) ! return; ! for (iterIndex = 0; iterIndex < HASHSIZE; iterIndex++) ! if (routeTab[iterIndex].next != &routeTab[iterIndex]) ! { ! iterRouteTab = routeTab[iterIndex].next; ! break; ! } } --- 244,251 ---- void iterRouteTabInit(void) { ! avl_init(&routingtree, avl_comp_prefix_default); ! routingtree_version = 0; ! iterRouteTab = (avl_walk_first(&routingtree)->data); } *************** *** 479,483 **** tcTab = tc_table; hnaTab = hna_set; - routeTab = routingtable; config = olsr_cnf; --- 467,470 ---- From (spam-protected) Wed Sep 5 18:11:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.27, 1.28 nameservice.h, 1.12, 1.13 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/lib/nameservice/src Modified Files: nameservice.c nameservice.h Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: nameservice.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** nameservice.h 2 Jul 2007 10:59:12 -0000 1.12 --- nameservice.h 5 Sep 2007 16:11:10 -0000 1.13 *************** *** 61,64 **** --- 61,65 ---- #define EMISSION_INTERVAL 120 /* two minutes */ #define NAME_VALID_TIME 1800 /* half one hour */ + #define NAMESERVER_COUNT 3 #define NAME_PROTOCOL_VERSION 1 Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** nameservice.c 28 Aug 2007 20:45:17 -0000 1.27 --- nameservice.c 5 Sep 2007 16:11:10 -0000 1.28 *************** *** 100,115 **** olsr_bool latlon_table_changed = OLSR_TRUE; ! /* regualar expression to be matched by valid hostnames, compiled in name_init() */ regex_t regex_t_name; regmatch_t regmatch_t_name; ! /* regualar expression to be matched by valid service_lines, compiled in name_init() */ regex_t regex_t_service; int pmatch_service = 10; regmatch_t regmatch_t_service[10]; - static void free_routing_table_list(struct rt_entry **list) ; - static struct rt_entry *host_lookup_routing_table(union olsr_ip_addr *); - /** * do initialization --- 100,112 ---- olsr_bool latlon_table_changed = OLSR_TRUE; ! /* regular expression to be matched by valid hostnames, compiled in name_init() */ regex_t regex_t_name; regmatch_t regmatch_t_name; ! /* regular expression to be matched by valid service_lines, compiled in name_init() */ regex_t regex_t_service; int pmatch_service = 10; regmatch_t regmatch_t_service[10]; /** * do initialization *************** *** 837,841 **** /** ! * unpack the received message and delegate to the decapsilation function for each * name/service/forwarder entry in the message */ --- 834,838 ---- /** ! * unpack the received message and delegate to the decapsulation function for each * name/service/forwarder entry in the message */ *************** *** 1077,1080 **** --- 1074,1115 ---- /** + * Sort the nameserver pointer array. + * + * fresh entries are at the beginning of the array and + * the best entry is at the end of the array. + */ + static void + select_best_nameserver(struct rt_entry **rt) + { + int nameserver_idx; + struct rt_entry *rt1, *rt2; + + for (nameserver_idx = 0; + nameserver_idx < NAMESERVER_COUNT; + nameserver_idx++) { + + rt1 = rt[nameserver_idx]; + rt2 = rt[nameserver_idx+1]; + + /* + * compare the next two pointers in the array. + * if the second pointer is NULL then percolate it up. + */ + if (!rt2 || olsr_cmp_rt(rt1, rt2)) { + + /* + * first is better, swap the pointers. + */ + OLSR_PRINTF(6, "NAME PLUGIN: nameserver %s, etx %.3f\n", + olsr_ip_to_string(&rt1->rt_dst.prefix), + rt1->rt_best->rtp_metric.etx); + + rt[nameserver_idx] = rt2; + rt[nameserver_idx+1] = rt1; + } + } + } + + /** * write the 3 best upstream DNS servers to resolv.conf file * best means the 3 with the best etx value in routing table *************** *** 1084,1098 **** { int hash; ! struct name_entry *name, *tmp_dns, *last_dns, *dnslist = NULL; struct db_entry *entry; ! struct rt_entry *best_routes = NULL; ! struct rt_entry *route, *tmp = NULL, *last; FILE* resolv; int i=0; time_t currtime; ! if (!forwarder_table_changed || my_forwarders != NULL || my_resolv_file[0] == '\0') return; for (hash = 0; hash < HASHSIZE; hash++) { --- 1119,1136 ---- { int hash; ! struct name_entry *name; struct db_entry *entry; ! struct rt_entry *route; ! static struct rt_entry *nameserver_routes[NAMESERVER_COUNT+1]; FILE* resolv; int i=0; time_t currtime; ! if (!forwarder_table_changed || my_forwarders != NULL || my_resolv_file[0] == '\0') return; + /* clear the array of 3+1 nameserver routes */ + memset(nameserver_routes, 0, sizeof(nameserver_routes)); + for (hash = 0; hash < HASHSIZE; hash++) { *************** *** 1101,1169 **** for (name = entry->names; name != NULL; name = name->next) { ! ! /* find the nearest one */ ! route = host_lookup_routing_table(&name->ip); if (route==NULL) // it's possible that route is not present yet continue; - - if (best_routes == NULL || route->rt_etx < best_routes->rt_etx) { - OLSR_PRINTF(6, "NAME PLUGIN: best nameserver %s\n", - olsr_ip_to_string(&name->ip)); - if (best_routes!=NULL) - OLSR_PRINTF(6, "NAME PLUGIN: better than %f (%s)\n", - best_routes->rt_etx, - olsr_ip_to_string(&best_routes->rt_dst)); - - tmp = olsr_malloc(sizeof(struct rt_entry), "new rt_entry"); - memcpy(&tmp->rt_dst, &route->rt_dst, olsr_cnf->ipsize); - tmp->rt_etx = route->rt_etx; - tmp->next = best_routes; - best_routes = tmp; - tmp_dns = olsr_malloc(sizeof(struct name_entry), "write_resolv name_entry"); - COPY_IP(&tmp_dns->ip, &name->ip); - tmp_dns->type = name->type; - tmp_dns->len = 0; - tmp_dns->name = NULL; - tmp_dns->next = dnslist; - dnslist = tmp_dns; - } else { - // queue in etx order - last = best_routes; - last_dns = dnslist; - while ( last->next!=NULL && i<3 ) { - if (last->next->rt_etx > route->rt_etx) - break; - last = last->next; - last_dns = last_dns->next; - i++; - } - if (i<3) { - OLSR_PRINTF(6, "NAME PLUGIN: queue %f (%s)", - route->rt_etx, - olsr_ip_to_string(&name->ip)); - OLSR_PRINTF(6, " after %f (%s)\n", - last->rt_etx, olsr_ip_to_string(&last_dns->ip)); - - tmp = olsr_malloc(sizeof(struct rt_entry), "new rt_entry"); - memcpy(&tmp->rt_dst, &route->rt_dst, olsr_cnf->ipsize); - tmp->rt_etx = route->rt_etx; - tmp->next = last->next; - last->next = tmp; ! tmp_dns = olsr_malloc(sizeof(struct name_entry), "write_resolv name_entry"); ! COPY_IP(&tmp_dns->ip, &name->ip); ! tmp_dns->type = name->type; ! tmp_dns->len = 0; ! tmp_dns->name = NULL; ! tmp_dns->next = last_dns->next; ! last_dns->next = tmp_dns; ! } else { ! OLSR_PRINTF(6, "NAME PLUGIN: don't need more than 3 nameservers\n"); ! } ! } } } } ! if (best_routes==NULL) return; --- 1139,1166 ---- for (name = entry->names; name != NULL; name = name->next) { ! ! route = olsr_lookup_routing_table(&name->ip); ! ! OLSR_PRINTF(6, "NAME PLUGIN: check route for nameserver %s %s", ! olsr_ip_to_string(&name->ip), ! route ? "suceeded" : "failed"); ! if (route==NULL) // it's possible that route is not present yet continue; ! /* enqueue it on the head of list */ ! *nameserver_routes = route; ! OLSR_PRINTF(6, "NAME PLUGIN: found nameserver %s, etx %.3f", ! olsr_ip_to_string(&name->ip), ! route->rt_best->rtp_metric.etx); ! ! /* find the closet one */ ! select_best_nameserver(nameserver_routes); } } } ! ! /* if there is no best route we are done */ ! if (nameserver_routes[NAMESERVER_COUNT]==NULL) return; *************** *** 1177,1189 **** fprintf(resolv, "### this file is overwritten regularly by olsrd\n"); fprintf(resolv, "### do not edit\n\n"); ! i=0; ! for (tmp_dns=dnslist; tmp_dns!=NULL && i<3; tmp_dns=tmp_dns->next) { ! OLSR_PRINTF(6, "NAME PLUGIN: nameserver %s\n", olsr_ip_to_string(&tmp_dns->ip)); ! fprintf(resolv, "nameserver %s\n", olsr_ip_to_string(&tmp_dns->ip)); ! i++; ! } ! free_name_entry_list(&dnslist); ! if(tmp != NULL) { ! free_routing_table_list(&tmp); } if (time(&currtime)) { --- 1174,1192 ---- fprintf(resolv, "### this file is overwritten regularly by olsrd\n"); fprintf(resolv, "### do not edit\n\n"); ! ! for (i = NAMESERVER_COUNT; i >= 0; i--) { ! ! route = nameserver_routes[i]; ! ! OLSR_PRINTF(2, "NAME PLUGIN: nameserver_routes #%d %p\n", i, route); ! ! if (!route) { ! continue; ! } ! ! OLSR_PRINTF(2, "NAME PLUGIN: nameserver %s\n", ! olsr_ip_to_string(&route->rt_dst.prefix)); ! fprintf(resolv, "nameserver %s\n", ! olsr_ip_to_string(&route->rt_dst.prefix)); } if (time(&currtime)) { *************** *** 1215,1235 **** /** - * completely free a list of rt_entries - */ - static void - free_routing_table_list(struct rt_entry **list) - { - struct rt_entry **tmp = list; - struct rt_entry *to_delete; - while (*tmp != NULL) { - to_delete = *tmp; - *tmp = (*tmp)->next; - free( to_delete ); - to_delete = NULL; - } - } - - - /** * we only allow names for IP addresses which we are * responsible for: --- 1218,1221 ---- *************** *** 1293,1341 **** } - static struct rt_entry * - host_lookup_routing_table(union olsr_ip_addr *dst) - { - olsr_u32_t index; - union olsr_ip_addr tmp_ip, tmp_msk; - struct rt_entry *walker; - - walker = olsr_lookup_routing_table(dst); - if (walker != NULL) - return walker; - - for (index = 0; index < HASHSIZE; index++) { - for (walker = hna_routes[index].next; - walker != &hna_routes[index]; walker = walker->next) { - if (COMP_IP(&walker->rt_dst, dst)) - return walker; - if (olsr_cnf->ip_version == AF_INET) { - if ( walker->rt_mask.v4 != 0 && - (dst->v4 & walker->rt_mask.v4) == - walker->rt_dst.v4 ) { - OLSR_PRINTF(6, "MATCHED\n"); - return walker; - } - } else { - int i; - - if ( walker->rt_mask.v6 == 0 ) - continue; - olsr_prefix_to_netmask(&tmp_msk, - walker->rt_mask.v6); - for (i = 0; i < 16; i++) { - tmp_ip.v6.s6_addr[i] = - dst->v6.s6_addr[i] & - tmp_msk.v6.s6_addr[i]; - } - if (COMP_IP(&tmp_ip, &walker->rt_dst)) { - OLSR_PRINTF(6, "MATCHED\n"); - return walker; - } - } - } - } - return NULL; - } - /** check if name has the right syntax, i.e. it must adhere to a special regex * stored in regex_t_name --- 1279,1282 ---- *************** *** 1462,1468 **** memset(ip, 0, sizeof(ip)); memset(&dest, 0, sizeof(dest)); ! if (NULL != (rt_hna = olsr_lookup_hna_routing_table(&dest))) { ! COPY_IP(ip, &rt_hna->rt_router); } } --- 1403,1409 ---- memset(ip, 0, sizeof(ip)); memset(&dest, 0, sizeof(dest)); ! if (NULL != (rt_hna = olsr_lookup_routing_table(&dest))) { ! COPY_IP(ip, &rt_hna->rt_best->rtp_nexthop.gateway); } } From (spam-protected) Wed Sep 5 18:11:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:13 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd kernel_routes.c,1.11,1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/src/bsd Modified Files: kernel_routes.c Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/kernel_routes.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** kernel_routes.c 2 May 2007 07:41:20 -0000 1.11 --- kernel_routes.c 5 Sep 2007 16:11:11 -0000 1.12 *************** *** 50,54 **** static unsigned int seq = 0; ! static int add_del_route(struct rt_entry *dest, int add) { struct rt_msghdr *rtm; --- 50,54 ---- static unsigned int seq = 0; ! static int add_del_route(struct rt_entry *rt, int add) { struct rt_msghdr *rtm; *************** *** 59,73 **** struct ifaddrs *addrs; struct ifaddrs *awalker; int step, step2; int len; - char Str1[16], Str2[16], Str3[16]; int flags; ! inet_ntop(AF_INET, &dest->rt_dst.v4, Str1, 16); ! inet_ntop(AF_INET, &dest->rt_mask.v4, Str2, 16); ! inet_ntop(AF_INET, &dest->rt_router.v4, Str3, 16); ! ! OLSR_PRINTF(1, "%s IPv4 route to %s/%s via %s.\n", ! (add != 0) ? "Adding" : "Removing", Str1, Str2, Str3); memset(buff, 0, sizeof (buff)); --- 59,73 ---- struct ifaddrs *addrs; struct ifaddrs *awalker; + struct rt_nexthop *nexthop; + union olsr_ip_addr mask; int step, step2; int len; int flags; ! if (add) { ! OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); ! } else { ! OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); ! } memset(buff, 0, sizeof (buff)); *************** *** 82,86 **** rtm = (struct rt_msghdr *)buff; ! flags = dest->rt_flags; // the host is directly reachable, so use cloning and a /32 net --- 82,86 ---- rtm = (struct rt_msghdr *)buff; ! flags = olsr_rt_flags(rt); // the host is directly reachable, so use cloning and a /32 net *************** *** 102,113 **** walker = buff + sizeof (struct rt_msghdr); ! sin.sin_addr.s_addr = dest->rt_dst.v4; memcpy(walker, &sin, sizeof (sin)); walker += step; if ((flags & RTF_GATEWAY) != 0) { ! sin.sin_addr.s_addr = dest->rt_router.v4; memcpy(walker, &sin, sizeof (sin)); --- 102,114 ---- walker = buff + sizeof (struct rt_msghdr); ! sin.sin_addr.s_addr = rt->rt_dst.prefix.v4; memcpy(walker, &sin, sizeof (sin)); walker += step; + nexthop = olsr_get_nh(rt); if ((flags & RTF_GATEWAY) != 0) { ! sin.sin_addr.s_addr = nexthop->gateway.v4; memcpy(walker, &sin, sizeof (sin)); *************** *** 128,137 **** for (awalker = addrs; awalker != NULL; awalker = awalker->ifa_next) if (awalker->ifa_addr->sa_family == AF_LINK && ! strcmp(awalker->ifa_name, dest->rt_if->int_name) == 0) break; if (awalker == NULL) { ! fprintf(stderr, "interface %s not found\n", dest->rt_if->int_name); freeifaddrs(addrs); return -1; --- 129,138 ---- for (awalker = addrs; awalker != NULL; awalker = awalker->ifa_next) if (awalker->ifa_addr->sa_family == AF_LINK && ! strcmp(awalker->ifa_name, nexthop->iface->int_name) == 0) break; if (awalker == NULL) { ! fprintf(stderr, "interface %s not found\n", nexthop->iface->int_name); freeifaddrs(addrs); return -1; *************** *** 146,150 **** } ! sin.sin_addr.s_addr = dest->rt_mask.v4; memcpy(walker, &sin, sizeof (sin)); --- 147,154 ---- } ! if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { ! return -1; ! } ! sin.sin_addr.s_addr = mask.v4; memcpy(walker, &sin, sizeof (sin)); *************** *** 161,175 **** } ! int olsr_ioctl_add_route(struct rt_entry *dest) { ! return add_del_route(dest, 1); } ! int olsr_ioctl_del_route(struct rt_entry *dest) { ! return add_del_route(dest, 0); } ! static int add_del_route6(struct rt_entry *dest, int add) { struct rt_msghdr *rtm; --- 165,179 ---- } ! int olsr_ioctl_add_route(struct rt_entry *rt) { ! return add_del_route(rt, 1); } ! int olsr_ioctl_del_route(struct rt_entry *rt) { ! return add_del_route(rt, 0); } ! static int add_del_route6(struct rt_entry *rt, int add) { struct rt_msghdr *rtm; *************** *** 178,190 **** struct sockaddr_in6 sin6; struct sockaddr_dl sdl; int step, step_dl; int len; - char Str1[40], Str2[40]; - - inet_ntop(AF_INET6, &dest->rt_dst.v6, Str1, 40); - inet_ntop(AF_INET6, &dest->rt_router.v6, Str2, 40); ! OLSR_PRINTF(1, "%s IPv6 route to %s/%d via %s.\n", ! (add != 0) ? "Adding" : "Removing", Str1, dest->rt_mask.v6, Str2); memset(buff, 0, sizeof (buff)); --- 182,194 ---- struct sockaddr_in6 sin6; struct sockaddr_dl sdl; + struct rt_nexthop *nexthop; int step, step_dl; int len; ! if (add) { ! OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); ! } else { ! OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); ! } memset(buff, 0, sizeof (buff)); *************** *** 204,208 **** rtm->rtm_type = (add != 0) ? RTM_ADD : RTM_DELETE; rtm->rtm_index = 0; ! rtm->rtm_flags = dest->rt_flags; rtm->rtm_addrs = RTA_DST | RTA_GATEWAY; rtm->rtm_seq = ++seq; --- 208,212 ---- rtm->rtm_type = (add != 0) ? RTM_ADD : RTM_DELETE; rtm->rtm_index = 0; ! rtm->rtm_flags = olsr_rt_flags(rt); rtm->rtm_addrs = RTA_DST | RTA_GATEWAY; rtm->rtm_seq = ++seq; *************** *** 210,221 **** walker = buff + sizeof (struct rt_msghdr); ! memcpy(&sin6.sin6_addr.s6_addr, &dest->rt_dst.v6, sizeof(struct in6_addr)); memcpy(walker, &sin6, sizeof (sin6)); walker += step; if ((rtm->rtm_flags & RTF_GATEWAY) != 0) { ! memcpy(&sin6.sin6_addr.s6_addr, &dest->rt_router.v6, sizeof(struct in6_addr)); memcpy(walker, &sin6, sizeof (sin6)); --- 214,226 ---- walker = buff + sizeof (struct rt_msghdr); ! memcpy(&sin6.sin6_addr.s6_addr, &rt->rt_dst.prefix.v6, sizeof(struct in6_addr)); memcpy(walker, &sin6, sizeof (sin6)); walker += step; + nexthop = olsr_get_nh(rt); if ((rtm->rtm_flags & RTF_GATEWAY) != 0) { ! memcpy(&sin6.sin6_addr.s6_addr, &nexthop->gateway.v6, sizeof(struct in6_addr)); memcpy(walker, &sin6, sizeof (sin6)); *************** *** 227,231 **** else { ! memcpy(&sin6.sin6_addr.s6_addr, &dest->rt_if->int6_addr.sin6_addr.s6_addr, sizeof(struct in6_addr)); --- 232,236 ---- else { ! memcpy(&sin6.sin6_addr.s6_addr, &nexthop->iface->int6_addr.sin6_addr.s6_addr, sizeof(struct in6_addr)); *************** *** 237,241 **** if ((rtm->rtm_flags & RTF_HOST) == 0) { ! olsr_prefix_to_netmask((union olsr_ip_addr *)&sin6.sin6_addr, dest->rt_mask.v6); memcpy(walker, &sin6, sizeof (sin6)); walker += step; --- 242,246 ---- if ((rtm->rtm_flags & RTF_HOST) == 0) { ! olsr_prefix_to_netmask((union olsr_ip_addr *)&sin6.sin6_addr, rt->rt_dst.prefix_len); memcpy(walker, &sin6, sizeof (sin6)); walker += step; *************** *** 245,250 **** if ((rtm->rtm_flags & RTF_GATEWAY) != 0) { ! strcpy(&sdl.sdl_data[0], dest->rt_if->int_name); ! sdl.sdl_nlen = (u_char)strlen(dest->rt_if->int_name); memcpy(walker, &sdl, sizeof (sdl)); walker += step_dl; --- 250,255 ---- if ((rtm->rtm_flags & RTF_GATEWAY) != 0) { ! strcpy(&sdl.sdl_data[0], nexthop->iface->int_name); ! sdl.sdl_nlen = (u_char)strlen(nexthop->iface->int_name); memcpy(walker, &sdl, sizeof (sdl)); walker += step_dl; *************** *** 262,272 **** } ! int olsr_ioctl_add_route6(struct rt_entry *dest) { ! return add_del_route6(dest, 1); } ! int olsr_ioctl_del_route6(struct rt_entry *dest) { ! return add_del_route6(dest, 0); } --- 267,283 ---- } ! int olsr_ioctl_add_route6(struct rt_entry *rt) { ! return add_del_route6(rt, 1); } ! int olsr_ioctl_del_route6(struct rt_entry *rt) { ! return add_del_route6(rt, 0); } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ From (spam-protected) Wed Sep 5 18:11:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:13 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.23,1.24 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/src/linux Modified Files: kernel_routes.c Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** kernel_routes.c 17 May 2007 20:30:09 -0000 1.23 --- kernel_routes.c 5 Sep 2007 16:11:11 -0000 1.24 *************** *** 51,78 **** - - static struct sockaddr_in6 null_addr6; /* Address used as Originator Address IPv6 */ - /** ! *Insert a route in the kernel routing table * ! *@param destination the route to add * ! *@return negative on error */ int ! olsr_ioctl_add_route(struct rt_entry *destination) { struct rtentry kernel_route; ! int tmp; ! char dst_str[INET_ADDRSTRLEN], mask_str[INET_ADDRSTRLEN], router_str[INET_ADDRSTRLEN]; - OLSR_PRINTF(1, "(ioctl)Adding route with metric %d to %s/%s via %s/%s.\n", - destination->rt_metric, - inet_ntop(AF_INET, &destination->rt_dst.v4, dst_str, sizeof(dst_str)), - inet_ntop(AF_INET, &destination->rt_mask.v4, mask_str, sizeof(mask_str)), - inet_ntop(AF_INET, &destination->rt_router.v4, router_str, sizeof(router_str)), - destination->rt_if->int_name); - memset(&kernel_route, 0, sizeof(struct rtentry)); --- 51,70 ---- /** ! * Insert a route in the kernel routing table * ! * @param destination the route to add * ! * @return negative on error */ int ! olsr_ioctl_add_route(struct rt_entry *rt) { struct rtentry kernel_route; ! union olsr_ip_addr mask; ! int rslt; ! ! OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); memset(&kernel_route, 0, sizeof(struct rtentry)); *************** *** 81,140 **** ((struct sockaddr_in*)&kernel_route.rt_genmask)->sin_family = AF_INET; ! ((struct sockaddr_in *)&kernel_route.rt_dst)->sin_addr.s_addr = destination->rt_dst.v4; ! ((struct sockaddr_in *)&kernel_route.rt_genmask)->sin_addr.s_addr = destination->rt_mask.v4; ! if(destination->rt_dst.v4 != destination->rt_router.v4) ! { ! ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_addr.s_addr=destination->rt_router.v4; ! } ! kernel_route.rt_flags = destination->rt_flags; ! ! kernel_route.rt_metric = destination->rt_metric + 1; ! if((olsr_cnf->del_gws) && ! (destination->rt_dst.v4 == INADDR_ANY) && ! (destination->rt_dst.v4 == INADDR_ANY)) ! { ! delete_all_inet_gws(); ! olsr_cnf->del_gws = OLSR_FALSE; ! } /* * Set interface */ ! kernel_route.rt_dev = destination->rt_if->int_name; ! ! //printf("Inserting route entry on device %s\n\n", kernel_route.rt_dev); ! ! /* ! printf("Adding route:\n\tdest: %s\n", olsr_ip_to_string(&destination->rt_dst)); ! printf("\trouter: %s\n", olsr_ip_to_string(&destination->rt_router)); ! printf("\tmask: %s\n", olsr_ip_to_string((union olsr_ip_addr *)&destination->rt_mask)); ! printf("\tmetric: %d\n", destination->rt_metric); ! */ ! //printf("\tiface: %s\n", kernel_route.rt_dev); ! ! tmp = ioctl(olsr_cnf->ioctl_s,SIOCADDRT,&kernel_route); ! /* kernel_route.rt_dev=*/ ! /* ! *Send IPC route update message ! */ ! ! if(olsr_cnf->open_ipc) ! { ! ipc_route_send_rtentry(&destination->rt_dst, ! &destination->rt_router, ! destination->rt_metric, ! 1, ! destination->rt_if->int_name); /* Send interface name */ ! } ! ! return tmp; ! } --- 73,117 ---- ((struct sockaddr_in*)&kernel_route.rt_genmask)->sin_family = AF_INET; ! ((struct sockaddr_in *)&kernel_route.rt_dst)->sin_addr.s_addr = ! rt->rt_dst.prefix.v4; ! if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { ! return -1; ! } ! ((struct sockaddr_in *)&kernel_route.rt_genmask)->sin_addr.s_addr = mask.v4; ! if (rt->rt_dst.prefix.v4 != rt->rt_best->rtp_nexthop.gateway.v4) { ! ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_addr.s_addr = ! rt->rt_best->rtp_nexthop.gateway.v4; ! } ! kernel_route.rt_flags = olsr_rt_flags(rt); ! kernel_route.rt_metric = RT_METRIC_DEFAULT; /* * Set interface */ ! kernel_route.rt_dev = rt->rt_best->rtp_nexthop.iface->int_name; ! /* delete existing default route before ? */ ! if((olsr_cnf->del_gws) && ! (rt->rt_dst.prefix.v4 == INADDR_ANY) && ! (rt->rt_dst.prefix_len == INADDR_ANY)) { ! delete_all_inet_gws(); ! olsr_cnf->del_gws = OLSR_FALSE; ! } ! if ((rslt = ioctl(olsr_cnf->ioctl_s, SIOCADDRT, &kernel_route)) >= 0) { + /* + * Send IPC route update message + */ + ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, + rt->rt_best->rtp_metric.hops, 1, + rt->rt_best->rtp_nexthop.iface->int_name); + } + return rslt; + } *************** *** 147,209 **** */ int ! olsr_ioctl_add_route6(struct rt_entry *destination) { struct in6_rtmsg kernel_route; ! int tmp; ! struct in6_addr zeroaddr; ! ! OLSR_PRINTF(2, "(ioctl)Adding route: %s(hopc %d)\n", ! olsr_ip_to_string(&destination->rt_dst), ! destination->rt_metric + 1); ! ! ! memset(&zeroaddr, 0, olsr_cnf->ipsize); /* Use for comparision */ memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); ! COPY_IP(&kernel_route.rtmsg_dst, &destination->rt_dst); ! ! kernel_route.rtmsg_flags = destination->rt_flags; ! kernel_route.rtmsg_metric = destination->rt_metric; ! ! kernel_route.rtmsg_dst_len = destination->rt_mask.v6; ! ! if(memcmp(&destination->rt_dst, &destination->rt_router, olsr_cnf->ipsize) != 0) ! { ! COPY_IP(&kernel_route.rtmsg_gateway, &destination->rt_router); ! } ! else ! { ! COPY_IP(&kernel_route.rtmsg_gateway, &destination->rt_dst); ! } ! ! /* ! * set interface ! */ ! kernel_route.rtmsg_ifindex = destination->rt_if->if_index; ! //OLSR_PRINTF(3, "Adding route to %s using gw ", olsr_ip_to_string((union olsr_ip_addr *)&kernel_route.rtmsg_dst)); ! //OLSR_PRINTF(3, "%s\n", olsr_ip_to_string((union olsr_ip_addr *)&kernel_route.rtmsg_gateway)); ! if((tmp = ioctl(olsr_cnf->ioctl_s, SIOCADDRT, &kernel_route)) >= 0) ! { ! if(olsr_cnf->open_ipc) ! { ! if(memcmp(&destination->rt_router, &null_addr6, olsr_cnf->ipsize) != 0) ! ipc_route_send_rtentry(&destination->rt_dst, ! &destination->rt_router, ! destination->rt_metric, ! 1, ! destination->rt_if->int_name); /* Send interface name */ ! } ! } ! return(tmp); ! } --- 124,164 ---- */ int ! olsr_ioctl_add_route6(struct rt_entry *rt) { struct in6_rtmsg kernel_route; ! int rslt; + OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); ! COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); ! kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; + COPY_IP(&kernel_route.rtmsg_gateway, &rt->rt_best->rtp_nexthop.gateway); + kernel_route.rtmsg_flags = olsr_rt_flags(rt); + kernel_route.rtmsg_metric = RT_METRIC_DEFAULT; ! /* ! * set interface ! */ ! kernel_route.rtmsg_ifindex = rt->rt_best->rtp_nexthop.iface->if_index; ! ! /* XXX delete 0/0 route before ? */ ! if((rslt = ioctl(olsr_cnf->ioctl_s, SIOCADDRT, &kernel_route)) >= 0) { ! /* ! * Send IPC route update message ! */ ! ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, ! rt->rt_best->rtp_metric.hops, 1, ! rt->rt_best->rtp_nexthop.iface->int_name); ! } + return rslt; + } *************** *** 216,231 **** */ int ! olsr_ioctl_del_route(struct rt_entry *destination) { struct rtentry kernel_route; ! int tmp; ! char dst_str[INET_ADDRSTRLEN], mask_str[INET_ADDRSTRLEN], router_str[INET_ADDRSTRLEN]; - OLSR_PRINTF(1, "(ioctl)Deleting route with metric %d to %s/%s via %s.\n", - destination->rt_metric, - inet_ntop(AF_INET, &destination->rt_dst.v4, dst_str, sizeof(dst_str)), - inet_ntop(AF_INET, &destination->rt_mask.v4, mask_str, sizeof(mask_str)), - inet_ntop(AF_INET, &destination->rt_router.v4, router_str, sizeof(router_str))); - memset(&kernel_route,0,sizeof(struct rtentry)); --- 171,182 ---- */ int ! olsr_ioctl_del_route(struct rt_entry *rt) { struct rtentry kernel_route; ! union olsr_ip_addr mask; ! int rslt; ! ! OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); memset(&kernel_route,0,sizeof(struct rtentry)); *************** *** 234,279 **** ((struct sockaddr_in*)&kernel_route.rt_genmask)->sin_family = AF_INET; ! ((struct sockaddr_in *)&kernel_route.rt_dst)->sin_addr.s_addr = destination->rt_dst.v4; ! if(destination->rt_dst.v4 != destination->rt_router.v4) ! ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_addr.s_addr = destination->rt_router.v4; ! ((struct sockaddr_in *)&kernel_route.rt_genmask)->sin_addr.s_addr = destination->rt_mask.v4; ! kernel_route.rt_dev = NULL; ! kernel_route.rt_flags = destination->rt_flags; ! ! kernel_route.rt_metric = destination->rt_metric + 1; /* ! printf("Deleteing route:\n\tdest: %s\n", olsr_ip_to_string(&destination->rt_dst)); ! printf("\trouter: %s\n", olsr_ip_to_string(&destination->rt_router)); ! printf("\tmask: %s\n", olsr_ip_to_string((union olsr_ip_addr *)&destination->rt_mask)); ! printf("\tmetric: %d\n", destination->rt_metric); ! //printf("\tiface: %s\n", kernel_route.rt_dev); ! */ ! ! tmp = ioctl(olsr_cnf->ioctl_s, SIOCDELRT, &kernel_route); /* ! *Send IPC route update message */ ! if(olsr_cnf->open_ipc) ! ipc_route_send_rtentry(&destination->rt_dst, ! NULL, ! destination->rt_metric, ! 0, ! NULL); /* Send interface name */ ! ! return tmp; } - - - - /** *Remove a route from the kernel --- 185,222 ---- ((struct sockaddr_in*)&kernel_route.rt_genmask)->sin_family = AF_INET; ! ((struct sockaddr_in *)&kernel_route.rt_dst)->sin_addr.s_addr = ! rt->rt_dst.prefix.v4; + if (rt->rt_dst.prefix.v4 != rt->rt_nexthop.gateway.v4) { + ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_addr.s_addr = + rt->rt_nexthop.gateway.v4; + } ! if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { ! return -1; ! } else { ! ((struct sockaddr_in *)&kernel_route.rt_genmask)->sin_addr.s_addr = mask.v4; ! } ! kernel_route.rt_flags = olsr_rt_flags(rt); ! kernel_route.rt_metric = RT_METRIC_DEFAULT; /* ! * Set interface ! */ ! kernel_route.rt_dev = NULL; + if ((rslt = ioctl(olsr_cnf->ioctl_s, SIOCDELRT, &kernel_route)) >= 0) { /* ! * Send IPC route update message */ + ipc_route_send_rtentry(&rt->rt_dst.prefix, NULL, 0, 0, NULL); + } ! return rslt; } /** *Remove a route from the kernel *************** *** 284,329 **** */ int ! olsr_ioctl_del_route6(struct rt_entry *destination) { struct in6_rtmsg kernel_route; ! int tmp; ! ! union olsr_ip_addr tmp_addr = destination->rt_dst; ! ! OLSR_PRINTF(2, "(ioctl)Deleting route: %s(hopc %d)\n", ! olsr_ip_to_string(&destination->rt_dst), ! destination->rt_metric); ! ! OLSR_PRINTF(1, "Deleting route: %s\n", olsr_ip_to_string(&tmp_addr)); memset(&kernel_route,0,sizeof(struct in6_rtmsg)); - kernel_route.rtmsg_dst_len = destination->rt_mask.v6; ! memcpy(&kernel_route.rtmsg_dst, &destination->rt_dst, olsr_cnf->ipsize); ! ! memcpy(&kernel_route.rtmsg_gateway, &destination->rt_router, olsr_cnf->ipsize); ! ! kernel_route.rtmsg_flags = destination->rt_flags; ! kernel_route.rtmsg_metric = destination->rt_metric; ! tmp = ioctl(olsr_cnf->ioctl_s, SIOCDELRT,&kernel_route); /* ! *Send IPC route update message */ ! if(olsr_cnf->open_ipc) ! ipc_route_send_rtentry(&destination->rt_dst, ! NULL, ! destination->rt_metric, ! 0, ! NULL); /* Send interface name */ ! ! return tmp; } --- 227,258 ---- */ int ! olsr_ioctl_del_route6(struct rt_entry *rt) { struct in6_rtmsg kernel_route; ! int rslt; ! OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); memset(&kernel_route,0,sizeof(struct in6_rtmsg)); ! COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); ! kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; + COPY_IP(&kernel_route.rtmsg_gateway, &rt->rt_best->rtp_nexthop.gateway); ! kernel_route.rtmsg_flags = olsr_rt_flags(rt); ! kernel_route.rtmsg_metric = RT_METRIC_DEFAULT; + if ((rslt = ioctl(olsr_cnf->ioctl_s, SIOCDELRT, &kernel_route) >= 0)) { /* ! * Send IPC route update message */ + ipc_route_send_rtentry(&rt->rt_dst.prefix, NULL, 0, 0, NULL); + } ! return rslt; } *************** *** 384,399 **** ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_family=AF_INET; ! //memcpy(&kernel_route.rt_gateway, gw, olsr_cnf->ipsize); ! ! ! kernel_route.rt_flags = RTF_UP | RTF_GATEWAY; - kernel_route.rt_dev = ifr->ifr_ifrn.ifrn_name; - - //printf("Inserting route entry on device %s\n\n", kernel_route.rt_dev); - if((ioctl(s, SIOCDELRT, &kernel_route)) < 0) OLSR_PRINTF(1, "NO\n"); --- 313,321 ---- ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_family=AF_INET; ! kernel_route.rt_flags = RTF_UP | RTF_GATEWAY; kernel_route.rt_dev = ifr->ifr_ifrn.ifrn_name; if((ioctl(s, SIOCDELRT, &kernel_route)) < 0) OLSR_PRINTF(1, "NO\n"); *************** *** 405,406 **** --- 327,334 ---- } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ From (spam-protected) Wed Sep 5 18:11:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.71, 1.72 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/lib/httpinfo/src Modified Files: olsrd_httpinfo.c Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** olsrd_httpinfo.c 15 Jul 2007 21:09:37 -0000 1.71 --- olsrd_httpinfo.c 5 Sep 2007 16:11:10 -0000 1.72 *************** *** 151,156 **** static int build_topo_body(char *, olsr_u32_t); - static int build_hna_body(char *, olsr_u32_t); - static int build_mid_body(char *, olsr_u32_t); --- 151,154 ---- *************** *** 165,173 **** static int check_allowed_ip(const struct allowed_net * const allowed_nets, const union olsr_ip_addr * const addr); ! static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, const char * const ipstr, const char * const maskstr); ! ! static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, const union olsr_ip_addr * const ipaddr, const union hna_netmask * const mask); ! static char *olsr_netmask_to_string(union hna_netmask *); static ssize_t writen(int fd, const void *buf, size_t count); --- 163,172 ---- static int check_allowed_ip(const struct allowed_net * const allowed_nets, const union olsr_ip_addr * const addr); ! static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, ! const union olsr_ip_addr * const ipaddr, const int prefix_len); ! static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, ! const union olsr_ip_addr * const ipaddr, ! const int prefix_len); static ssize_t writen(int fd, const void *buf, size_t count); *************** *** 680,698 **** } ! static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, const char * const ipstr, const char * const maskstr) { int size = 0; ! if (want_link && maskstr == NULL) { /* Print the link only if there is not netmask */ size += snprintf(&buf[size], bufsize-size, "", ! ipstr, http_port); } ! size += snprintf(&buf[size], bufsize-size, "%s", ipstr); ! if (maskstr) { ! size += snprintf(&buf[size], bufsize-size, "/%s", maskstr); } ! if (want_link && maskstr == NULL) { /* Print the link only if there is not netmask */ size += snprintf(&buf[size], bufsize-size, ""); } --- 679,703 ---- } ! static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, ! const union olsr_ip_addr * const ipaddr, const int prefix_len) { int size = 0; ! if (want_link && prefix_len == -1) { /* Print the link only if there is no prefix_len */ size += snprintf(&buf[size], bufsize-size, "", ! olsr_ip_to_string(ipaddr), http_port); } ! ! /* print ip address or ip prefix ? */ ! if (prefix_len == -1) { ! size += snprintf(&buf[size], bufsize-size, "%s", olsr_ip_to_string(ipaddr)); ! } else { ! size += snprintf(&buf[size], bufsize-size, "%s/%d", olsr_ip_to_string(ipaddr), ! prefix_len); } ! ! if (want_link && prefix_len == -1) { /* Print the link only if there is no prefix_len */ size += snprintf(&buf[size], bufsize-size, ""); } *************** *** 700,737 **** } ! static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, const union olsr_ip_addr * const ipaddr, const union hna_netmask * const mask) { int size = 0; - char maskbuf[32]; - char *maskstr; const struct hostent * const hp = #ifndef WIN32 ! resolve_ip_addresses ? gethostbyaddr(ipaddr, olsr_cnf->ipsize, olsr_cnf->ip_version) : #endif ! NULL; ! if (mask != NULL) { ! if (olsr_cnf->ip_version == AF_INET) { ! if (mask->v4 == ~0U) { ! maskstr = NULL; ! } else { ! struct in_addr in; ! in.s_addr = mask->v4; ! snprintf(maskbuf, sizeof(maskbuf), "%s", inet_ntoa(in)); ! maskstr = maskbuf; ! } ! } else { ! snprintf(maskbuf, sizeof(maskbuf), "%d", mask->v6); ! maskstr = maskbuf; ! } ! } else { ! maskstr = NULL; ! } size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ip_txt(&buf[size], bufsize-size, want_link, olsr_ip_to_string(ipaddr), maskstr); size += snprintf(&buf[size], bufsize-size, ""); if (resolve_ip_addresses) { if (hp) { size += snprintf(&buf[size], bufsize-size, "("); ! size += build_ip_txt(&buf[size], bufsize-size, want_link, hp->h_name, NULL); size += snprintf(&buf[size], bufsize-size, ")"); } else { --- 705,728 ---- } ! static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, ! const olsr_bool want_link, ! const union olsr_ip_addr * const ipaddr, ! const int prefix_len) { int size = 0; const struct hostent * const hp = #ifndef WIN32 ! resolve_ip_addresses ? gethostbyaddr(ipaddr, olsr_cnf->ipsize, olsr_cnf->ip_version) : #endif ! NULL; ! size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ip_txt(&buf[size], bufsize-size, want_link, ipaddr, prefix_len); size += snprintf(&buf[size], bufsize-size, ""); + if (resolve_ip_addresses) { if (hp) { size += snprintf(&buf[size], bufsize-size, "("); ! size += snprintf(&buf[size], bufsize-size, "%s", hp->h_name); size += snprintf(&buf[size], bufsize-size, ")"); } else { *************** *** 741,760 **** return size; } - #define build_ipaddr_with_link(buf, bufsize, ipaddr, mask) build_ipaddr_link((buf), (bufsize), OLSR_TRUE, (ipaddr), (mask)) - #define build_ipaddr_no_link(buf, bufsize, ipaddr, mask) build_ipaddr_link((buf), (bufsize), OLSR_FALSE, (ipaddr), (mask)) ! static int build_route(char *buf, olsr_u32_t bufsize, const struct rt_entry * const route, const char * const title, const int print_netmask) { int size = 0; size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize-size, &route->rt_dst, print_netmask ? &route->rt_mask : NULL); ! size += build_ipaddr_with_link(&buf[size], bufsize-size, &route->rt_router, NULL); ! size += snprintf(&buf[size], bufsize-size, "%d", route->rt_metric); ! if (olsr_cnf->lq_level > 0) { ! size += snprintf(&buf[size], bufsize-size, "%.2f", route->rt_etx); ! } ! size += snprintf(&buf[size], bufsize-size, "%s%s\n", route->rt_if->int_name, title); return size; } --- 732,757 ---- return size; } + #define build_ipaddr_with_link(buf, bufsize, ipaddr, plen) \ + build_ipaddr_link((buf), (bufsize), OLSR_TRUE, (ipaddr), (plen)) + #define build_ipaddr_no_link(buf, bufsize, ipaddr, plen) \ + build_ipaddr_link((buf), (bufsize), OLSR_FALSE, (ipaddr), (plen)) ! static int build_route(char *buf, olsr_u32_t bufsize, const struct rt_entry * rt) { int size = 0; + size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize-size, &rt->rt_dst.prefix, ! rt->rt_dst.prefix_len); ! size += build_ipaddr_with_link(&buf[size], bufsize-size, ! &rt->rt_best->rtp_nexthop.gateway, -1); ! size += snprintf(&buf[size], bufsize-size, "%d", ! rt->rt_best->rtp_metric.hops); ! size += snprintf(&buf[size], bufsize-size, "%.3f", ! rt->rt_best->rtp_metric.etx); ! size += snprintf(&buf[size], bufsize-size, "%s\n", ! rt->rt_best->rtp_nexthop.iface->int_name); return size; } *************** *** 762,767 **** static int build_routes_body(char *buf, olsr_u32_t bufsize) { ! int size = 0, index; ! struct rt_entry *routes; size += snprintf(&buf[size], bufsize-size, "

OLSR routes in kernel

\n"); --- 759,764 ---- static int build_routes_body(char *buf, olsr_u32_t bufsize) { ! int size = 0; ! struct rt_entry *rt; size += snprintf(&buf[size], bufsize-size, "

OLSR routes in kernel

\n"); *************** *** 769,789 **** size += snprintf(&buf[size], bufsize-size, "DestinationGateway", resolve_ip_addresses ? " colspan=\"2\"" : ""); - if (olsr_cnf->lq_level > 0) - size += snprintf(&buf[size], bufsize-size, ""); - size += snprintf(&buf[size], bufsize-size, "\n"); ! /* Neighbors */ ! for(index = 0;index < HASHSIZE;index++) { ! for(routes = routingtable[index].next; routes != &routingtable[index]; routes = routes->next) { ! size += build_route(&buf[size], bufsize-size, routes, "HOST", OLSR_FALSE); ! } ! } ! /* HNA */ ! for(index = 0;index < HASHSIZE;index++) { ! for(routes = hna_routes[index].next; routes != &hna_routes[index];routes = routes->next) { ! size += build_route(&buf[size], bufsize-size, routes, "HNA", OLSR_TRUE); ! } ! } size += snprintf(&buf[size], bufsize-size, "
MetricETXInterfaceType
\n"); --- 766,777 ---- size += snprintf(&buf[size], bufsize-size, "DestinationGateway", resolve_ip_addresses ? " colspan=\"2\"" : ""); ! size += snprintf(&buf[size], bufsize-size, ""); ! size += snprintf(&buf[size], bufsize-size, "\n"); ! /* Walk the route table */ ! OLSR_FOR_ALL_RT_ENTRIES(rt) { ! size += build_route(&buf[size], bufsize-size, rt); ! } OLSR_FOR_ALL_RT_ENTRIES_END(rt); size += snprintf(&buf[size], bufsize-size, "
MetricETXInterface
\n"); *************** *** 1005,1010 **** { size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_no_link(&buf[size], bufsize, &link->local_iface_addr, NULL); ! size += build_ipaddr_with_link(&buf[size], bufsize, &link->neighbor_iface_addr, NULL); size += snprintf(&buf[size], bufsize-size, "%0.2f", --- 993,998 ---- { size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_no_link(&buf[size], bufsize, &link->local_iface_addr, -1); ! size += build_ipaddr_with_link(&buf[size], bufsize, &link->neighbor_iface_addr, -1); size += snprintf(&buf[size], bufsize-size, "%0.2f", *************** *** 1041,1045 **** { size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize, &neigh->neighbor_main_addr, NULL); size += snprintf(&buf[size], bufsize-size, "%s" --- 1029,1033 ---- { size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize, &neigh->neighbor_main_addr, -1); size += snprintf(&buf[size], bufsize-size, "%s" *************** *** 1100,1105 **** { size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize, &dst_entry->T_dest_addr, NULL); ! size += build_ipaddr_with_link(&buf[size], bufsize, &entry->T_last_addr, NULL); if (olsr_cnf->lq_level > 0) { --- 1088,1093 ---- { size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize, &dst_entry->T_dest_addr, -1); ! size += build_ipaddr_with_link(&buf[size], bufsize, &entry->T_last_addr, -1); if (olsr_cnf->lq_level > 0) { *************** *** 1126,1170 **** } - static int build_hna_body(char *buf, olsr_u32_t bufsize) - { - int size; - olsr_u8_t index; - struct hna_entry *tmp_hna; - struct hna_net *tmp_net; - - size = 0; - - size += snprintf(&buf[size], bufsize-size, "

HNA entries

\n\n"); - - /* HNA entries */ - for(index=0;indexnetworks.next; - - while(tmp_net != &tmp_hna->networks) - { - size += snprintf(&buf[size], bufsize-size, ""); - size += build_ipaddr_no_link(&buf[size], bufsize, &tmp_net->A_network_addr, NULL); - size += snprintf(&buf[size], bufsize-size, "", - olsr_netmask_to_string(&tmp_net->A_netmask)); - size += build_ipaddr_with_link(&buf[size], bufsize, &tmp_hna->A_gateway_addr, NULL); - tmp_net = tmp_net->next; - } - - tmp_hna = tmp_hna->next; - } - } - - size += snprintf(&buf[size], bufsize-size, "
NetworkNetmaskGateway
%s
\n"); - - return size; - } - - static int build_mid_body(char *buf, olsr_u32_t bufsize) { --- 1114,1117 ---- *************** *** 1183,1187 **** struct mid_address *alias; size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize, &entry->main_addr, NULL); size += snprintf(&buf[size], bufsize-size, "\n\n"); *************** *** 1210,1214 **** size += build_neigh_body(&buf[size], bufsize-size); size += build_topo_body(&buf[size], bufsize-size); - size += build_hna_body(&buf[size], bufsize-size); size += build_mid_body(&buf[size], bufsize-size); --- 1157,1160 ---- *************** *** 1224,1228 **** size += build_neigh_body(&buf[size], bufsize-size); size += build_topo_body(&buf[size], bufsize-size); - size += build_hna_body(&buf[size], bufsize-size); size += build_mid_body(&buf[size], bufsize-size); --- 1170,1173 ---- *************** *** 1290,1313 **** - /** - *This function is just as bad as the previous one :-( - */ - static char *olsr_netmask_to_string(union hna_netmask *mask) - { - char *ret; - if(olsr_cnf->ip_version == AF_INET) { - struct in_addr in; - in.s_addr = mask->v4; - ret = inet_ntoa(in); - } else { - static char netmask[5]; - /* IPv6 */ - snprintf(netmask, sizeof(netmask), "%d", mask->v6); - ret = netmask; - } - return ret; - } - - #if 0 /* --- 1235,1238 ---- From (spam-protected) Wed Sep 5 18:11:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:13 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 kernel_routes.c,1.20,1.21 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/src/win32 Modified Files: kernel_routes.c Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/kernel_routes.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** kernel_routes.c 25 Apr 2007 22:22:15 -0000 1.20 --- kernel_routes.c 5 Sep 2007 16:11:11 -0000 1.21 *************** *** 53,82 **** char *StrError(unsigned int ErrNo); ! int olsr_ioctl_add_route(struct rt_entry *Dest) { MIB_IPFORWARDROW Row; unsigned long Res; - char Str1[16], Str2[16], Str3[16]; - - inet_ntop(AF_INET, &Dest->rt_dst.v4, Str1, 16); - inet_ntop(AF_INET, &Dest->rt_mask.v4, Str2, 16); - inet_ntop(AF_INET, &Dest->rt_router.v4, Str3, 16); ! OLSR_PRINTF(1, "Adding IPv4 route with metric %d to %s/%s via %s and I/F 0x%x.\n", ! Dest->rt_metric + Dest->rt_if->int_metric, Str1, Str2, Str3, Dest->rt_if->if_index); memset(&Row, 0, sizeof (MIB_IPFORWARDROW)); ! Row.dwForwardDest = Dest->rt_dst.v4; ! Row.dwForwardMask = Dest->rt_mask.v4; Row.dwForwardPolicy = 0; ! Row.dwForwardNextHop = Dest->rt_router.v4; ! Row.dwForwardIfIndex = Dest->rt_if->if_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT ! Row.dwForwardType = (Dest->rt_dst.v4 == Dest->rt_router.v4) ? 3 : 4; Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT Row.dwForwardAge = INFINITE; Row.dwForwardNextHopAS = 0; ! Row.dwForwardMetric1 = Dest->rt_metric + Dest->rt_if->int_metric; Row.dwForwardMetric2 = -1; Row.dwForwardMetric3 = -1; --- 53,90 ---- char *StrError(unsigned int ErrNo); ! /** ! *Insert a route in the kernel routing table ! * ! *@param destination the route to add ! * ! *@return negative on error ! */ ! int olsr_ioctl_add_route(struct rt_entry *rt) { MIB_IPFORWARDROW Row; + union olsr_ip_addr mask; unsigned long Res; ! OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rt_to_string(rt)); memset(&Row, 0, sizeof (MIB_IPFORWARDROW)); ! Row.dwForwardDest = rt->rt_dst.prefix.v4; ! ! if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { ! return -1; ! } else { ! Row.dwForwardMask = mask.v4; ! } ! Row.dwForwardPolicy = 0; ! Row.dwForwardNextHop = rt->rt_best->rtp_nexthop.gateway.v4; ! Row.dwForwardIfIndex = rt->rt_best->rtp_nexthop.iface->if_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT ! Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_best->rtp_nexthop.gateway.v4) ? 3 : 4; Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT Row.dwForwardAge = INFINITE; Row.dwForwardNextHopAS = 0; ! Row.dwForwardMetric1 = RT_METRIC_DEFAULT; Row.dwForwardMetric2 = -1; Row.dwForwardMetric3 = -1; *************** *** 105,111 **** } ! if(olsr_cnf->open_ipc) ! ipc_route_send_rtentry(&Dest->rt_dst, &Dest->rt_router, Dest->rt_metric, ! 1, Dest->rt_if->int_name); return 0; --- 113,124 ---- } ! /* ! * Send IPC route update message ! */ ! if(olsr_cnf->open_ipc) { ! ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, ! rt->rt_best->rtp_metric.hops, 1, ! rt->rt_best->rtp_nexthop.iface->int_name); ! } return 0; *************** *** 114,148 **** // XXX - to be implemented ! int olsr_ioctl_add_route6(struct rt_entry *Dest __attribute__((unused))) { return 0; } ! int olsr_ioctl_del_route(struct rt_entry *Dest) { MIB_IPFORWARDROW Row; unsigned long Res; - char Str1[16], Str2[16], Str3[16]; ! inet_ntop(AF_INET, &Dest->rt_dst.v4, Str1, 16); ! inet_ntop(AF_INET, &Dest->rt_mask.v4, Str2, 16); ! inet_ntop(AF_INET, &Dest->rt_router.v4, Str3, 16); ! ! OLSR_PRINTF(1, "Deleting IPv4 route with metric %d to %s/%s via %s and I/F 0x%x.\n", ! Dest->rt_metric + Dest->rt_if->int_metric, Str1, Str2, Str3, Dest->rt_if->if_index); memset(&Row, 0, sizeof (MIB_IPFORWARDROW)); ! Row.dwForwardDest = Dest->rt_dst.v4; ! Row.dwForwardMask = Dest->rt_mask.v4; Row.dwForwardPolicy = 0; ! Row.dwForwardNextHop = Dest->rt_router.v4; ! Row.dwForwardIfIndex = Dest->rt_if->if_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT ! Row.dwForwardType = (Dest->rt_dst.v4 == Dest->rt_router.v4) ? 3 : 4; Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT Row.dwForwardAge = INFINITE; Row.dwForwardNextHopAS = 0; ! Row.dwForwardMetric1 = Dest->rt_metric + Dest->rt_if->int_metric; Row.dwForwardMetric2 = -1; Row.dwForwardMetric3 = -1; --- 127,169 ---- // XXX - to be implemented ! int olsr_ioctl_add_route6(struct rt_entry *rt __attribute__((unused))) { return 0; } ! /** ! *Remove a route from the kernel ! * ! *@param destination the route to remove ! * ! *@return negative on error ! */ ! int olsr_ioctl_del_route(struct rt_entry *rt) { MIB_IPFORWARDROW Row; + union olsr_ip_addr mask; unsigned long Res; ! OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); memset(&Row, 0, sizeof (MIB_IPFORWARDROW)); ! Row.dwForwardDest = rt->rt_dst.prefix.v4; ! ! if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { ! return -1; ! } else { ! Row.dwForwardMask = mask.v4; ! } ! Row.dwForwardPolicy = 0; ! Row.dwForwardNextHop = rt->rt_nexthop.gateway.v4; ! Row.dwForwardIfIndex = rt->rt_nexthop.iface->if_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT ! Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_nexthop.gateway.v4) ? 3 : 4; Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT Row.dwForwardAge = INFINITE; Row.dwForwardNextHopAS = 0; ! Row.dwForwardMetric1 = RT_METRIC_DEFAULT; Row.dwForwardMetric2 = -1; Row.dwForwardMetric3 = -1; *************** *** 163,168 **** } ! if(olsr_cnf->open_ipc) ! ipc_route_send_rtentry(&Dest->rt_dst, NULL, Dest->rt_metric, 0, NULL); return 0; --- 184,193 ---- } ! /* ! * Send IPC route update message ! */ ! if(olsr_cnf->open_ipc) { ! ipc_route_send_rtentry(&rt->rt_dst.prefix, NULL, 0 , 0, NULL); ! } return 0; *************** *** 171,175 **** // XXX - to be implemented ! int olsr_ioctl_del_route6(struct rt_entry *Dest __attribute__((unused))) { return 0; --- 196,200 ---- // XXX - to be implemented ! int olsr_ioctl_del_route6(struct rt_entry *rt __attribute__((unused))) { return 0; From (spam-protected) Wed Sep 5 18:17:37 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:17:37 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga/src quagga.c,1.6,1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/lib/quagga/src Modified Files: quagga.c Log Message: * applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke Index: quagga.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/quagga.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** quagga.c 5 Sep 2007 16:11:10 -0000 1.6 --- quagga.c 5 Sep 2007 16:17:35 -0000 1.7 *************** *** 744,748 **** route.index = olsr_malloc (sizeof *route.index, "zebra_add_olsr_v4_route"); ! *route.index = htonl(r->rt_best->rtp_nexthop.iface->if_index); route.nexthops = olsr_malloc (sizeof route.nexthops->type + sizeof route.nexthops->payload, --- 744,748 ---- route.index = olsr_malloc (sizeof *route.index, "zebra_add_olsr_v4_route"); ! *route.index = htonl(r->rt_best->rtp_nexthop.iif_index); route.nexthops = olsr_malloc (sizeof route.nexthops->type + sizeof route.nexthops->payload, *************** *** 789,793 **** route.index = olsr_malloc (sizeof *route.index, "zebra_add_olsr_v4_route"); ! *route.index = htonl (r->rt_best->rtp_nexthop.iface->if_index); route.nexthops = olsr_malloc (sizeof route.nexthops->type + sizeof route.nexthops->payload, --- 789,793 ---- route.index = olsr_malloc (sizeof *route.index, "zebra_add_olsr_v4_route"); ! *route.index = htonl (r->rt_best->rtp_nexthop.iif_index); route.nexthops = olsr_malloc (sizeof route.nexthops->type + sizeof route.nexthops->payload, From (spam-protected) Wed Sep 5 18:17:37 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:17:37 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.72, 1.73 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/lib/httpinfo/src Modified Files: olsrd_httpinfo.c Log Message: * applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** olsrd_httpinfo.c 5 Sep 2007 16:11:10 -0000 1.72 --- olsrd_httpinfo.c 5 Sep 2007 16:17:35 -0000 1.73 *************** *** 753,757 **** rt->rt_best->rtp_metric.etx); size += snprintf(&buf[size], bufsize-size, "%s\n", ! rt->rt_best->rtp_nexthop.iface->int_name); return size; } --- 753,757 ---- rt->rt_best->rtp_metric.etx); size += snprintf(&buf[size], bufsize-size, "%s\n", ! if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index)); return size; } From (spam-protected) Wed Sep 5 18:17:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:17:38 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src plugin.c,1.10,1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/lib/tas/src Modified Files: plugin.c Log Message: * applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke Index: plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/plugin.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** plugin.c 5 Sep 2007 16:11:10 -0000 1.10 --- plugin.c 5 Sep 2007 16:17:35 -0000 1.11 *************** *** 229,233 **** rawIpAddrToString(&iterRouteTab->rt_dst.prefix, ipAddrLen), rawIpAddrToString(&iterRouteTab->rt_best->rtp_nexthop.gateway, ipAddrLen), ! iterRouteTab->rt_best->rtp_nexthop.iface->int_name, iterRouteTab->rt_best->rtp_metric.hops); --- 229,233 ---- rawIpAddrToString(&iterRouteTab->rt_dst.prefix, ipAddrLen), rawIpAddrToString(&iterRouteTab->rt_best->rtp_nexthop.gateway, ipAddrLen), ! if_ifwithindex_name(iterRouteTab->rt_best->rtp_nexthop.iif_index), iterRouteTab->rt_best->rtp_metric.hops); From (spam-protected) Wed Sep 5 18:17:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:17:38 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c,1.8,1.9 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/lib/txtinfo/src Modified Files: olsrd_txtinfo.c Log Message: * applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** olsrd_txtinfo.c 5 Sep 2007 16:11:10 -0000 1.8 --- olsrd_txtinfo.c 5 Sep 2007 16:17:36 -0000 1.9 *************** *** 328,332 **** rt->rt_best->rtp_metric.hops, rt->rt_best->rtp_metric.etx, ! rt->rt_best->rtp_nexthop.iface->int_name); } --- 328,332 ---- rt->rt_best->rtp_metric.hops, rt->rt_best->rtp_metric.etx, ! if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index)); } From (spam-protected) Wed Sep 5 18:17:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:17:38 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd kernel_routes.c,1.12,1.13 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/src/bsd Modified Files: kernel_routes.c Log Message: * applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/kernel_routes.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** kernel_routes.c 5 Sep 2007 16:11:11 -0000 1.12 --- kernel_routes.c 5 Sep 2007 16:17:36 -0000 1.13 *************** *** 129,138 **** for (awalker = addrs; awalker != NULL; awalker = awalker->ifa_next) if (awalker->ifa_addr->sa_family == AF_LINK && ! strcmp(awalker->ifa_name, nexthop->iface->int_name) == 0) break; if (awalker == NULL) { ! fprintf(stderr, "interface %s not found\n", nexthop->iface->int_name); freeifaddrs(addrs); return -1; --- 129,138 ---- for (awalker = addrs; awalker != NULL; awalker = awalker->ifa_next) if (awalker->ifa_addr->sa_family == AF_LINK && ! strcmp(awalker->ifa_name, if_ifwithindex_name(nexthop->iif_index)) == 0) break; if (awalker == NULL) { ! fprintf(stderr, "interface %s not found\n", if_ifwithindex_name(nexthop->iif_index)); freeifaddrs(addrs); return -1; *************** *** 232,236 **** else { ! memcpy(&sin6.sin6_addr.s6_addr, &nexthop->iface->int6_addr.sin6_addr.s6_addr, sizeof(struct in6_addr)); --- 232,243 ---- else { ! // Sven-Ola: This looks really ugly (please compar to IPv4 above) ! struct interface* iface = if_ifwithindex(nexthop->iif_index); ! if (NULL == iface) ! { ! fprintf(stderr, "interface %s not found\n", if_ifwithindex_name(nexthop->iif_index)); ! return -1; ! } ! memcpy(&sin6.sin6_addr.s6_addr, &iface->int6_addr.sin6_addr.s6_addr, sizeof(struct in6_addr)); *************** *** 250,255 **** if ((rtm->rtm_flags & RTF_GATEWAY) != 0) { ! strcpy(&sdl.sdl_data[0], nexthop->iface->int_name); ! sdl.sdl_nlen = (u_char)strlen(nexthop->iface->int_name); memcpy(walker, &sdl, sizeof (sdl)); walker += step_dl; --- 257,262 ---- if ((rtm->rtm_flags & RTF_GATEWAY) != 0) { ! strcpy(&sdl.sdl_data[0], if_ifwithindex_name(nexthop->iif_index)); ! sdl.sdl_nlen = (u_char)strlen((char*)&sdl.sdl_data[0]); memcpy(walker, &sdl, sizeof (sdl)); walker += step_dl; From (spam-protected) Wed Sep 5 18:17:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:17:38 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 kernel_routes.c,1.21,1.22 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/src/win32 Modified Files: kernel_routes.c Log Message: * applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/kernel_routes.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** kernel_routes.c 5 Sep 2007 16:11:11 -0000 1.21 --- kernel_routes.c 5 Sep 2007 16:17:36 -0000 1.22 *************** *** 80,84 **** Row.dwForwardPolicy = 0; Row.dwForwardNextHop = rt->rt_best->rtp_nexthop.gateway.v4; ! Row.dwForwardIfIndex = rt->rt_best->rtp_nexthop.iface->if_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_best->rtp_nexthop.gateway.v4) ? 3 : 4; --- 80,84 ---- Row.dwForwardPolicy = 0; Row.dwForwardNextHop = rt->rt_best->rtp_nexthop.gateway.v4; ! Row.dwForwardIfIndex = rt->rt_best->rtp_nexthop.iif_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_best->rtp_nexthop.gateway.v4) ? 3 : 4; *************** *** 119,123 **** ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, ! rt->rt_best->rtp_nexthop.iface->int_name); } --- 119,123 ---- ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, ! if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_name)); } *************** *** 159,163 **** Row.dwForwardPolicy = 0; Row.dwForwardNextHop = rt->rt_nexthop.gateway.v4; ! Row.dwForwardIfIndex = rt->rt_nexthop.iface->if_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_nexthop.gateway.v4) ? 3 : 4; --- 159,163 ---- Row.dwForwardPolicy = 0; Row.dwForwardNextHop = rt->rt_nexthop.gateway.v4; ! Row.dwForwardIfIndex = rt->rt_nexthop.iif_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_nexthop.gateway.v4) ? 3 : 4; From (spam-protected) Wed Sep 5 18:17:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:17:38 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.24,1.25 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/src/linux Modified Files: kernel_routes.c Log Message: * applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** kernel_routes.c 5 Sep 2007 16:11:11 -0000 1.24 --- kernel_routes.c 5 Sep 2007 16:17:36 -0000 1.25 *************** *** 92,96 **** * Set interface */ ! kernel_route.rt_dev = rt->rt_best->rtp_nexthop.iface->int_name; /* delete existing default route before ? */ --- 92,96 ---- * Set interface */ ! kernel_route.rt_dev = if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index); /* delete existing default route before ? */ *************** *** 109,113 **** ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, ! rt->rt_best->rtp_nexthop.iface->int_name); } --- 109,113 ---- ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, ! if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index)); } *************** *** 145,149 **** * set interface */ ! kernel_route.rtmsg_ifindex = rt->rt_best->rtp_nexthop.iface->if_index; /* XXX delete 0/0 route before ? */ --- 145,149 ---- * set interface */ ! kernel_route.rtmsg_ifindex = rt->rt_best->rtp_nexthop.iif_index; /* XXX delete 0/0 route before ? */ *************** *** 156,160 **** ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, ! rt->rt_best->rtp_nexthop.iface->int_name); } --- 156,160 ---- ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, ! if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index)); } From (spam-protected) Wed Sep 5 18:17:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:17:38 +0000 Subject: [Olsr-cvs] olsrd-current/src interfaces.c, 1.33, 1.34 interfaces.h, 1.41, 1.42 ipc_frontend.c, 1.34, 1.35 lq_route.c, 1.49, 1.50 process_routes.c, 1.35, 1.36 routing_table.c, 1.29, 1.30 routing_table.h, 1.19, 1.20 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/src Modified Files: interfaces.c interfaces.h ipc_frontend.c lq_route.c process_routes.c routing_table.c routing_table.h Log Message: * applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** lq_route.c 5 Sep 2007 16:11:10 -0000 1.49 --- lq_route.c 5 Sep 2007 16:17:36 -0000 1.50 *************** *** 605,609 **** /* add a route to the main address of the destination node */ olsr_insert_routing_table(&vert->addr, max_host_plen, &vert->addr, ! &link->neighbor_iface_addr, inter, vert->hops, vert->path_etx); --- 605,609 ---- /* add a route to the main address of the destination node */ olsr_insert_routing_table(&vert->addr, max_host_plen, &vert->addr, ! &link->neighbor_iface_addr, inter->if_index, vert->hops, vert->path_etx); *************** *** 614,618 **** olsr_insert_routing_table(&mid_walker->alias, max_host_plen, &vert->addr, ! &link->neighbor_iface_addr, inter, vert->hops, vert->path_etx); } --- 614,618 ---- olsr_insert_routing_table(&mid_walker->alias, max_host_plen, &vert->addr, ! &link->neighbor_iface_addr, inter->if_index, vert->hops, vert->path_etx); } *************** *** 634,638 **** if (vert->path_etx != INFINITE_ETX) olsr_insert_routing_table(&hna->A_network_addr, plen, &vert->addr, ! &link->neighbor_iface_addr, inter, vert->hops, vert->path_etx); } --- 634,638 ---- if (vert->path_etx != INFINITE_ETX) olsr_insert_routing_table(&hna->A_network_addr, plen, &vert->addr, ! &link->neighbor_iface_addr, inter->if_index, vert->hops, vert->path_etx); } Index: interfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** interfaces.c 2 Aug 2007 21:51:40 -0000 1.33 --- interfaces.c 5 Sep 2007 16:17:36 -0000 1.34 *************** *** 311,314 **** --- 311,357 ---- /** + *Find the interface with a given interface index. + * + *@param iif_index of the interface to find. + * + *@return return the interface struct representing the interface + *that matched the iif_index. + */ + struct interface * + if_ifwithindex(int if_index) + { + struct interface *ifp = ifnet; + while (ifp) + { + if (ifp->if_index == if_index) + return ifp; + ifp = ifp->int_next; + } + return NULL; + } + + + /** + *Get an interface name for a given interface index + * + *@param iif_index of the interface to find. + * + *@return "" or interface name. + */ + char * + if_ifwithindex_name(int if_index) + { + struct interface *ifp = ifnet; + while (ifp) + { + if (ifp->if_index == if_index) + return ifp->int_name; + ifp = ifp->int_next; + } + return "void"; + } + + + /** *Create a new interf_name struct using a given *name and insert it into the interface list. Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** interfaces.h 2 Aug 2007 21:51:40 -0000 1.41 --- interfaces.h 5 Sep 2007 16:17:36 -0000 1.42 *************** *** 212,215 **** --- 212,221 ---- if_ifwithname(const char *); + struct interface * + if_ifwithindex(int if_index); + + char * + if_ifwithindex_name(int if_index); + struct olsr_if * queue_if(char *, int); Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** routing_table.c 5 Sep 2007 16:11:11 -0000 1.29 --- routing_table.c 5 Sep 2007 16:17:36 -0000 1.30 *************** *** 189,193 **** static void olsr_update_routing_entry(struct rt_path *rtp, union olsr_ip_addr *gateway, ! struct interface *iface, int metric, float etx) { --- 189,193 ---- static void olsr_update_routing_entry(struct rt_path *rtp, union olsr_ip_addr *gateway, ! int iif_index, int metric, float etx) { *************** *** 198,202 **** /* interface */ ! rtp->rtp_nexthop.iface = iface; /* etx */ --- 198,202 ---- /* interface */ ! rtp->rtp_nexthop.iif_index = iif_index; /* etx */ *************** *** 226,229 **** --- 226,232 ---- memset(rt, 0, sizeof(struct rt_entry)); + + /* Mark this entry as fresh (see process_routes.c:512) */ + rt->rt_nexthop.iif_index = -1; /* set key and backpointer prior to tree insertion */ *************** *** 280,284 **** { if ((!COMP_IP(&nh1->gateway, &nh2->gateway)) || ! (nh1->iface != nh2->iface)) { return OLSR_TRUE; } --- 283,287 ---- { if ((!COMP_IP(&nh1->gateway, &nh2->gateway)) || ! (nh1->iif_index != nh2->iif_index)) { return OLSR_TRUE; } *************** *** 401,405 **** union olsr_ip_addr *originator, union olsr_ip_addr *gateway, ! struct interface *iface, int metric, float etx) --- 404,408 ---- union olsr_ip_addr *originator, union olsr_ip_addr *gateway, ! int iif_index, int metric, float etx) *************** *** 457,461 **** /* update the version field and relevant parameters */ ! olsr_update_routing_entry(rtp, gateway, iface, metric, etx); return rtp; --- 460,464 ---- /* update the version field and relevant parameters */ ! olsr_update_routing_entry(rtp, gateway, iif_index, metric, etx); return rtp; *************** *** 564,568 **** &link->neighbor->neighbor_main_addr, &link->neighbor_iface_addr, ! iface, 1, etx); /* this is the nexthop route that all routes will be tracking */ --- 567,571 ---- &link->neighbor->neighbor_main_addr, &link->neighbor_iface_addr, ! iface->if_index, 1, etx); /* this is the nexthop route that all routes will be tracking */ *************** *** 570,574 **** &link->neighbor->neighbor_main_addr, &link->neighbor_iface_addr, ! iface, 1, etx); } } --- 573,577 ---- &link->neighbor->neighbor_main_addr, &link->neighbor_iface_addr, ! iface->if_index, 1, etx); } } *************** *** 618,622 **** &tmp_hna->A_gateway_addr, &rt->rt_best->rtp_nexthop.gateway, ! rt->rt_best->rtp_nexthop.iface, rt->rt_best->rtp_metric.hops, rt->rt_best->rtp_metric.etx); --- 621,625 ---- &tmp_hna->A_gateway_addr, &rt->rt_best->rtp_nexthop.gateway, ! rt->rt_best->rtp_nexthop.iif_index, rt->rt_best->rtp_metric.hops, rt->rt_best->rtp_metric.etx); *************** *** 669,673 **** rtp->rtp_metric.hops, olsr_ip_to_string(&rtp->rtp_nexthop.gateway), ! rtp->rtp_nexthop.iface->int_name, rtp->rtp_version); --- 672,676 ---- rtp->rtp_metric.hops, olsr_ip_to_string(&rtp->rtp_nexthop.gateway), ! if_ifwithindex_name(rt->rt_nexthop.iif_index), rtp->rtp_version); Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ipc_frontend.c 5 Sep 2007 16:11:10 -0000 1.34 --- ipc_frontend.c 5 Sep 2007 16:17:36 -0000 1.35 *************** *** 339,343 **** { struct rt_entry *rt; - struct interface *ifn; struct ipcmsg packet; char *tmp; --- 339,342 ---- *************** *** 349,354 **** OLSR_FOR_ALL_RT_ENTRIES(rt) { - ifn = rt->rt_nexthop.iface; - memset(&packet, 0, sizeof(struct ipcmsg)); packet.size = htons(IPC_PACK_SIZE); --- 348,351 ---- *************** *** 362,369 **** COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway); ! if(ifn) ! memcpy(&packet.device[0], ifn->int_name, 4); ! else ! memset(&packet.device[0], 0, 4); tmp = (char *) &packet; --- 359,363 ---- COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway); ! memcpy(&packet.device[0], if_ifwithindex_name(rt->rt_nexthop.iif_index), 4); tmp = (char *) &packet; Index: process_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** process_routes.c 5 Sep 2007 16:11:11 -0000 1.35 --- process_routes.c 5 Sep 2007 16:17:36 -0000 1.36 *************** *** 508,514 **** if (olsr_nh_change(&rt->rt_best->rtp_nexthop, &rt->rt_nexthop)) { ! if (!rt->rt_nexthop.iface) { ! /* fresh routes do have NULL pointers in the nexthop fields. */ olsr_enqueue_rt(&add_kernel_list, rt); } else { --- 508,514 ---- if (olsr_nh_change(&rt->rt_best->rtp_nexthop, &rt->rt_nexthop)) { ! if (0 > rt->rt_nexthop.iif_index) { ! /* fresh routes do have an interface index of -1. */ olsr_enqueue_rt(&add_kernel_list, rt); } else { Index: routing_table.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** routing_table.h 5 Sep 2007 16:11:11 -0000 1.19 --- routing_table.h 5 Sep 2007 16:17:36 -0000 1.20 *************** *** 66,70 **** /* a nexthop is a pointer to a gateway router plus an interface */ ! struct rt_nexthop { union olsr_ip_addr gateway; /* gateway router */ --- 66,70 ---- /* a nexthop is a pointer to a gateway router plus an interface */ ! struct rt_nexthop_soll_weg { union olsr_ip_addr gateway; /* gateway router */ *************** *** 72,75 **** --- 72,81 ---- }; + struct rt_nexthop + { + union olsr_ip_addr gateway; /* gateway router */ + int iif_index; /* outgoung interface index */ + }; + /* * Every prefix in our RIB needs a route entry that contains *************** *** 169,173 **** union olsr_ip_addr *, union olsr_ip_addr *, ! struct interface *, int, float); struct rt_entry * --- 175,179 ---- union olsr_ip_addr *, union olsr_ip_addr *, ! int, int, float); struct rt_entry * From (spam-protected) Wed Sep 5 18:30:52 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:30:52 +0000 Subject: [Olsr-cvs] olsrd-current/src lq_avl.c,1.12,1.13 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27235/src Modified Files: lq_avl.c Log Message: * #if 0 ... #endif out an unused function Index: lq_avl.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** lq_avl.c 5 Sep 2007 16:11:10 -0000 1.12 --- lq_avl.c 5 Sep 2007 16:30:50 -0000 1.13 *************** *** 479,482 **** --- 479,483 ---- } + #if 0 static struct avl_node *avl_local_max(struct avl_node *node) { *************** *** 486,489 **** --- 487,491 ---- return node; } + #endif static void avl_delete_worker(struct avl_tree *tree, struct avl_node *node) From (spam-protected) Wed Sep 5 18:32:48 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:32:48 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.79,1.80 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28053 Modified Files: CHANGELOG Log Message: * added blurb for the changelog Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** CHANGELOG 29 Aug 2007 23:17:13 -0000 1.79 --- CHANGELOG 5 Sep 2007 16:32:46 -0000 1.80 *************** *** 7,12 **** --- 7,88 ---- updated to svn version 33 + PATCH by Hannes Gredler which rewrites the route handling. + To quote him: + ---- snip ---- + change list: + - get rid of separate routing tables for HNA and per-node routes, everything is + now unified in an AVL routing tree (&routingtree) + + - introduce walking macros (OLSR_FOR_ALL_RT_ENTRIES()) that hide the internal + structure of the RIB for making life of the plugin authors easier. + + - get rid of different SPF implementations for LQ and non-LQ code paths. a + non-LQ edge is simply substituted with a cost of 1.0 + + - get rid of host masks - a new data type olsr_prefix is introduced which is + basically an ip address plus a prefix length. + + do not install the metric in the kernel FIB - for the kernel its pointless + if the route gets installed with a metric of N or M. + + we do not need to update the kernel FIB if we have hop count only changes + (for example if there is a reroute action further downstream) + + the only things which triggers a kernel FIB route update is a next hop + change (a next hop is neighboring gateway router plus an interface). + + all OLSR routes are installed with a metric of 2 + + - separate between rt_entry and rt_path - the former is a route installed in the + kernel with an next hop. the latter is a candidate for best path selection + after SPF calculation has been done. in the rt_entry we keep a pointer to the + best_path and also to the next hop that was installed in the kernel FIB. + + we always keep all originator of a route, if a route originator goes away we + can easy recompute the best path for the route. + + the next hop in the rt_entry gets only updated upon a successful route_add + call - that way we always remember what next hop to delete. + + stray routes should be history now. + + - tweak the linked list toolkit to operate on circular lists. + + - get rid of malloc calls for building the kernel update list. the list node is + now embedded in the rt_entry. + + - introduce three queues (add/chg/del) for kernel updates. + + - for neighbor route dependency tracking the neighbor routes are queued first or + last (depending on which queue you work on) + + - rework all the plugins which directly manipulate rt entries. + + - rework the plugins that read from the routing table (most notably nameserver, + httpinfo and quagga plugin) + + - lots of comments that explains the intentions and purpose of this code-piece. + + non RT related stuff: + - use a list rather than a tree for storing the post-SPF results, which further + improves the raw-SPF runtime. + + - add display of SPF runtime (masked behind #ifdef SPF_PROFILING) + ---- snip ---- + And Sven-Ola Tuecke fixed an instability issue on interface + up/down operations (see 102-olsrd-rt-refactoring-fixes.patch below). + PATCHES by Sven-Ola Tücke to be found on from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/ + - 102-olsrd-rt-refactoring-fixes.patch + Because you changed a lot of basics: It's time to handle a general + flaw in the routing system. Plase take a look at chk_if_changed(). This + will free() any "struct interface" pointer without warning at any time. + This is why it's possile to SEGV olsrd with a simple "ifdown xxx". + The patch replaces the (maybe) invalid pointer with an index reference + "iif_index". You can always ask the OS for a name. Please note, that I do + not have a working BSD toolchain, so I've placed an #error in the IPv6 + BSD-part where the author/porter has started to hack something funny. + - 110-olsrd-double-wlancard-neigh-hack.patch: This is a hack for Nodes having to wifi cards with the same channel, *************** *** 26,31 **** This is a new one. Opens a packet socket and listen to UDP(698), extract the sender MAC and refreshes the ARP cache whith that. Should speedup ! especially in cases, if you initially try to use a longer routing path which normally ! triggers a "ARP-Lookup-Chain". - 106-olsrd-nameserviceparams.patch: This patch converts more plugins to the new interface version. --- 102,107 ---- This is a new one. Opens a packet socket and listen to UDP(698), extract the sender MAC and refreshes the ARP cache whith that. Should speedup ! especially in cases, if you initially try to use a longer routing path which ! normally triggers a "ARP-Lookup-Chain". - 106-olsrd-nameserviceparams.patch: This patch converts more plugins to the new interface version. *************** *** 115,120 **** Sven-Ola Tuecke ! added the spf refactoring patch from Hannes Gredler whicht saves ! a noteworthy amount of CPU time. To quote him: ---- snip ---- 1. use of an AVL tree as a min-heap implementation --- 191,196 ---- Sven-Ola Tuecke ! added the spf refactoring patch from Hannes Gredler which ! saves a noteworthy amount of CPU time. To quote him: ---- snip ---- 1. use of an AVL tree as a min-heap implementation From (spam-protected) Wed Sep 5 18:11:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 16:11:13 +0000 Subject: [Olsr-cvs] olsrd-current/src hna_set.c, 1.20, 1.21 hna_set.h, 1.14, 1.15 ipc_frontend.c, 1.33, 1.34 kernel_routes.h, 1.8, 1.9 lq_avl.c, 1.11, 1.12 lq_avl.h, 1.9, 1.10 lq_list.c, 1.5, 1.6 lq_list.h, 1.5, 1.6 lq_route.c, 1.48, 1.49 lq_route.h, 1.4, 1.5 main.c, 1.96, 1.97 net_olsr.c, 1.28, 1.29 net_olsr.h, 1.10, 1.11 olsr.c, 1.56, 1.57 olsr_types.h, 1.8, 1.9 process_routes.c, 1.34, 1.35 process_routes.h, 1.10, 1.11 routing_table.c, 1.28, 1.29 routing_table.h, 1.18, 1.19 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/src Modified Files: hna_set.c hna_set.h ipc_frontend.c kernel_routes.h lq_avl.c lq_avl.h lq_list.c lq_list.h lq_route.c lq_route.h main.c net_olsr.c net_olsr.h olsr.c olsr_types.h process_routes.c process_routes.h routing_table.c routing_table.h Log Message: * applied rt-refactoring-6.diff from Hannes Gredler Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** lq_route.c 2 Aug 2007 22:07:19 -0000 1.48 --- lq_route.c 5 Sep 2007 16:11:10 -0000 1.49 *************** *** 66,73 **** struct avl_node tree_node; /* node keyed by ip address */ struct avl_node cand_tree_node; /* node keyed by etx */ ! struct avl_node path_tree_node; /* node keyed by etx */ union olsr_ip_addr addr; struct avl_tree edge_tree; ! union olsr_ip_addr *next_hop; /* the gateway router */ float path_etx; olsr_u8_t hops; --- 66,73 ---- struct avl_node tree_node; /* node keyed by ip address */ struct avl_node cand_tree_node; /* node keyed by etx */ ! struct list_node path_list_node; /* SPF result list */ union olsr_ip_addr addr; struct avl_tree edge_tree; ! struct link_entry *next_hop; /* the link to the 1st hop neighbor */ float path_etx; olsr_u8_t hops; *************** *** 138,160 **** /* ! * olsr_spf_add_path_tree * ! * Key an existing vertex to a path tree. */ static void ! olsr_spf_add_path_tree (struct avl_tree *tree, struct olsr_spf_vertex *vert) { ! vert->path_tree_node.key = &vert->path_etx; ! vert->path_tree_node.data = vert; #ifdef DEBUG ! OLSR_PRINTF(1, "SPF: insert path %s, cost %f, via %s\n", olsr_ip_to_string(&(vert->addr)), vert->path_etx, ! olsr_ip_to_string(vert->next_hop)); #endif ! avl_insert(tree, &vert->path_tree_node, 1); } --- 138,161 ---- /* ! * olsr_spf_add_path_list * ! * Insert an SPF result at the end of the path list. */ static void ! olsr_spf_add_path_list (struct list_node *head, ! int *path_count, struct olsr_spf_vertex *vert) { ! vert->path_list_node.data = vert; #ifdef DEBUG ! OLSR_PRINTF(1, "SPF: append path %s, cost %f, via %s\n", olsr_ip_to_string(&(vert->addr)), vert->path_etx, ! olsr_ip_to_string(vert->next_hop ? &vert->next_hop->neighbor_iface_addr : NULL)); #endif ! list_add_before(head, &vert->path_list_node); ! *path_count = *path_count + 1; } *************** *** 198,202 **** } ! static void olsr_spf_add_edge (struct avl_tree *vertex_tree, union olsr_ip_addr *src, union olsr_ip_addr *dst, --- 199,203 ---- } ! static struct olsr_spf_vertex * olsr_spf_add_edge (struct avl_tree *vertex_tree, union olsr_ip_addr *src, union olsr_ip_addr *dst, *************** *** 215,219 **** if (node == NULL) ! return; svert = node->data; --- 216,220 ---- if (node == NULL) ! return NULL; svert = node->data; *************** *** 226,230 **** if (node == NULL) ! return; dvert = node->data; --- 227,231 ---- if (node == NULL) ! return NULL; dvert = node->data; *************** *** 263,266 **** --- 264,269 ---- avl_insert(&dvert->edge_tree, &edge->tree_node, 0); } + + return svert; } *************** *** 384,388 **** olsr_etx_to_string(edge->dest->path_etx), olsr_etx_to_string(new_etx), ! olsr_ip_to_string(vert->next_hop), edge->dest->hops); #endif --- 387,392 ---- olsr_etx_to_string(edge->dest->path_etx), olsr_etx_to_string(new_etx), ! olsr_ip_to_string(vert->next_hop ? ! &vert->next_hop->neighbor_iface_addr : NULL), edge->dest->hops); #endif *************** *** 399,415 **** * Run the Dijkstra algorithm. * - * We are using two trees: the candidate and the path tree. * A node gets added to the candidate tree when one of its edges has * an overall better root path cost than the node itself. * The node with the shortest metric gets moved from the candidate to ! * the path tree every pass. * The SPF computation is completed when there are no more nodes * on the candidate tree. */ static void ! olsr_spf_run_full (struct avl_tree *cand_tree, struct avl_tree *path_tree) { struct olsr_spf_vertex *vert; while ((vert = olsr_spf_extract_best(cand_tree))) { --- 403,421 ---- * Run the Dijkstra algorithm. * * A node gets added to the candidate tree when one of its edges has * an overall better root path cost than the node itself. * The node with the shortest metric gets moved from the candidate to ! * the path list every pass. * The SPF computation is completed when there are no more nodes * on the candidate tree. */ static void ! olsr_spf_run_full (struct avl_tree *cand_tree, struct list_node *path_list, ! int *path_count) { struct olsr_spf_vertex *vert; + *path_count = 0; + while ((vert = olsr_spf_extract_best(cand_tree))) { *************** *** 418,434 **** /* * move the best path from the candidate tree ! * to the path tree. */ olsr_spf_del_cand_tree(cand_tree, vert); ! olsr_spf_add_path_tree(path_tree, vert); } } void ! olsr_calculate_lq_routing_table (void) { ! struct avl_tree vertex_tree, cand_tree, path_tree; ! struct avl_node *tree_node; ! int i; struct tc_entry *tcsrc; struct topo_dst *tcdst; --- 424,440 ---- /* * move the best path from the candidate tree ! * to the path list. */ olsr_spf_del_cand_tree(cand_tree, vert); ! olsr_spf_add_path_list(path_list, path_count, vert); } } void ! olsr_calculate_routing_table (void) { ! struct avl_tree vertex_tree, cand_tree; ! struct list_node path_list; ! int i, plen, max_host_plen, path_count = 0; struct tc_entry *tcsrc; struct topo_dst *tcdst; *************** *** 439,451 **** struct hna_entry *hna_gw; struct hna_net *hna; - struct rt_entry *gw_rt, *hna_rt, *head_rt; struct neighbor_2_entry *neigh2; - #if 0 - struct neighbor_list_entry *neigh_walker; - #endif struct interface *inter; ! if (olsr_cnf->ipsize != 4) ! avl_comp_default = avl_comp_ipv6; // initialize the graph --- 445,459 ---- struct hna_entry *hna_gw; struct hna_net *hna; struct neighbor_2_entry *neigh2; struct interface *inter; + struct link_entry *link; ! #ifdef SPF_PROFILING ! struct timeval t1, t2, t3, t4, t5, t6, spf_init, spf_run, route, kernel, cleanup, total; ! ! gettimeofday(&t1, NULL); ! #endif ! ! max_host_plen = olsr_host_rt_maxplen(); // initialize the graph *************** *** 453,457 **** avl_init(&vertex_tree, avl_comp_default); avl_init(&cand_tree, avl_comp_etx); ! avl_init(&path_tree, avl_comp_etx); // add ourselves to the vertex and candidate tree --- 461,467 ---- avl_init(&vertex_tree, avl_comp_default); avl_init(&cand_tree, avl_comp_etx); ! list_head_init(&path_list); ! ! olsr_bump_routingtree_version(); // add ourselves to the vertex and candidate tree *************** *** 466,488 **** for (neigh = neighbortable[i].next; neigh != &neighbortable[i]; neigh = neigh->next) { - if (neigh->status == SYM) { - - vert = olsr_spf_add_vertex(&vertex_tree, &neigh->neighbor_main_addr, - INFINITE_ETX); ! /* ! * Set the next-hop pointer to ourselves. ! * During olsr_spf_relax() the next_hop pointer will be ! * pulled up to the new candidate node. ! * At the End of the SPF computation every reachable node has ! * a pointer to its corresponding first hop router. ! */ ! vert->next_hop = &vert->addr; ! /* ! * one hop neighbors are just one hop away. ! */ ! vert->hops = 1; ! } } --- 476,484 ---- for (neigh = neighbortable[i].next; neigh != &neighbortable[i]; neigh = neigh->next) { ! if (neigh->status != SYM) ! continue; ! olsr_spf_add_vertex(&vertex_tree, &neigh->neighbor_main_addr, INFINITE_ETX); } *************** *** 494,504 **** neigh2 = neigh2->next) { ! vert = olsr_spf_add_vertex(&vertex_tree, &neigh2->neighbor_2_addr, ! INFINITE_ETX); ! ! /* ! * two hop neighbors are two hops away. ! */ ! vert->hops = 2; } // add remaining vertices --- 490,494 ---- neigh2 = neigh2->next) { ! olsr_spf_add_vertex(&vertex_tree, &neigh2->neighbor_2_addr, INFINITE_ETX); } // add remaining vertices *************** *** 522,595 **** for (i = 0; i < HASHSIZE; i++) for (neigh = neighbortable[i].next; neigh != &neighbortable[i]; ! neigh = neigh->next) ! if (neigh->status == SYM) ! { ! struct link_entry *lnk = get_best_link_to_neighbor(&neigh->neighbor_main_addr); ! if(!lnk) continue; ! if (lnk->loss_link_quality2 >= MIN_LINK_QUALITY && ! lnk->neigh_link_quality2 >= MIN_LINK_QUALITY) ! { ! etx = 1.0 / (lnk->loss_link_quality2 * lnk->neigh_link_quality2); ! olsr_spf_add_edge(&vertex_tree, &neigh->neighbor_main_addr, &olsr_cnf->main_addr, etx); ! } } ! // we now rely solely on TC messages for routes to our two-hop neighbours ! #if 0 ! // add edges between our neighbours and our two-hop neighbours ! for (i = 0; i < HASHSIZE; i++) ! for (neigh2 = two_hop_neighbortable[i].next; ! neigh2 != &two_hop_neighbortable[i]; ! neigh2 = neigh2->next) ! for (neigh_walker = neigh2->neighbor_2_nblist.next; ! neigh_walker != &neigh2->neighbor_2_nblist; ! neigh_walker = neigh_walker->next) ! { ! if (neigh_walker->second_hop_link_quality >= ! MIN_LINK_QUALITY * MIN_LINK_QUALITY) ! { ! neigh = neigh_walker->neighbor; ! etx = 1.0 / neigh_walker->second_hop_link_quality; ! olsr_spf_add_edge(&vertex_tree, &neigh2->neighbor_2_addr, ! &neigh->neighbor_main_addr, etx); } } #endif - // add remaining edges - - for (i = 0; i < HASHSIZE; i++) - for (tcsrc = tc_table[i].next; tcsrc != &tc_table[i]; tcsrc = tcsrc->next) - for (tcdst = tcsrc->destinations.next; tcdst != &tcsrc->destinations; - tcdst = tcdst->next) - { - if (tcdst->link_quality >= MIN_LINK_QUALITY && - tcdst->inverse_link_quality >= MIN_LINK_QUALITY) - { - etx = 1.0 / (tcdst->link_quality * tcdst->inverse_link_quality); - - olsr_spf_add_edge(&vertex_tree, &tcdst->T_dest_addr, &tcsrc->T_last_addr, - etx); - } - } - /* * Run the SPF calculation. */ ! olsr_spf_run_full(&cand_tree, &path_tree); ! ! // save the old routing table ! ! olsr_move_route_table(routingtable, old_routes); OLSR_PRINTF(2, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------- DIJKSTRA\n\n", --- 512,573 ---- for (i = 0; i < HASHSIZE; i++) for (neigh = neighbortable[i].next; neigh != &neighbortable[i]; ! neigh = neigh->next) { ! if (neigh->status == SYM) { ! ! link = get_best_link_to_neighbor(&neigh->neighbor_main_addr); ! if (!link) { continue; + } ! if (olsr_cnf->lq_level < 2) { ! /* for non-lq the etx is always 1.0 */ ! vert = olsr_spf_add_edge(&vertex_tree, &neigh->neighbor_main_addr, ! &olsr_cnf->main_addr, 1.0 ); ! vert->next_hop = link; ! } else if (link->loss_link_quality2 >= MIN_LINK_QUALITY && ! link->neigh_link_quality2 >= MIN_LINK_QUALITY) { ! ! etx = 1.0 / (link->loss_link_quality2 * link->neigh_link_quality2); ! ! vert = olsr_spf_add_edge(&vertex_tree, &neigh->neighbor_main_addr, ! &olsr_cnf->main_addr, etx); ! vert->next_hop = link; ! } } + } ! /* add remaining edges from TC messages */ ! for (i = 0; i < HASHSIZE; i++) ! for (tcsrc = tc_table[i].next; tcsrc != &tc_table[i]; tcsrc = tcsrc->next) ! for (tcdst = tcsrc->destinations.next; tcdst != &tcsrc->destinations; ! tcdst = tcdst->next) { ! if (olsr_cnf->lq_level < 2) { ! /* for non-lq the etx is always 1.0 */ ! olsr_spf_add_edge(&vertex_tree, &tcdst->T_dest_addr, ! &tcsrc->T_last_addr, 1.0); ! } else if (tcdst->link_quality >= MIN_LINK_QUALITY && ! tcdst->inverse_link_quality >= MIN_LINK_QUALITY) { ! etx = 1.0 / (tcdst->link_quality * tcdst->inverse_link_quality); ! ! olsr_spf_add_edge(&vertex_tree, &tcdst->T_dest_addr, ! &tcsrc->T_last_addr, etx); } } + #ifdef SPF_PROFILING + gettimeofday(&t2, NULL); #endif /* * Run the SPF calculation. */ ! olsr_spf_run_full(&cand_tree, &path_list, &path_count); OLSR_PRINTF(2, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------- DIJKSTRA\n\n", *************** *** 599,768 **** (int)now.tv_usec/10000); /* ! * In the path tree we have all the reachable nodes ! * in our topology sorted by etx metric. */ ! for (tree_node = avl_walk_first(&path_tree); ! tree_node != NULL; ! tree_node = avl_walk_next(tree_node)) { ! struct link_entry *lnk; ! vert = tree_node->data; ! if (!vert->next_hop) { OLSR_PRINTF(2, "%s no next-hop\n", olsr_ip_to_string(&vert->addr)); continue; } ! // find the best link to the one-hop neighbour ! ! lnk = get_best_link_to_neighbor(vert->next_hop); ! ! // we may see NULL here, if the one-hop neighbour is not in the ! // link and neighbour sets any longer, but we have derived an edge ! // between us and the one-hop neighbour from the TC set ! ! if (lnk != NULL) ! { ! // find the interface for the found link ! inter = lnk->if_name ? if_ifwithname(lnk->if_name) : ! if_ifwithaddr(&lnk->local_iface_addr); ! ! // we may see NULL here if the interface is down, but we have ! // links that haven't timed out, yet ! if (inter != NULL) ! { ! // XXX - fix me: structurally prevent duplicates, don't test via ! // olsr_lookup_routing_table() ! // route addition, case A - add a route to the main address of the ! // destination node ! if (olsr_lookup_routing_table(&vert->addr) == NULL) ! olsr_insert_routing_table(&vert->addr, &lnk->neighbor_iface_addr, ! inter, vert->hops, vert->path_etx); ! // route addition, case B - add routes to the remaining interfaces ! // of the destination node ! for (mid_walker = mid_lookup_aliases(&vert->addr); mid_walker != NULL; ! mid_walker = mid_walker->next_alias) ! if (olsr_lookup_routing_table(&mid_walker->alias) == NULL) ! olsr_insert_routing_table(&mid_walker->alias, ! &lnk->neighbor_iface_addr, inter, vert->hops, ! vert->path_etx); ! // XXX - we used to use olsr_lookup_routing_table() only here, but ! // this assumed that case A or case B had already happened for ! // this destination; if case A or case B happened after case C ! // for the same destination, we had duplicates, as cases A and ! // B would not test whether case C had already happened ! // route addition, case C - make sure that we have a route to the ! // router - e.g. in case the router's not the main address and it's ! // MID entry has timed out ! if (olsr_lookup_routing_table(&lnk->neighbor_iface_addr) == NULL) ! olsr_insert_routing_table(&lnk->neighbor_iface_addr, ! &lnk->neighbor_iface_addr, inter, 1, ! vert->path_etx); } } } ! // save the old HNA routing table ! ! olsr_move_route_table(hna_routes, old_hna); ! ! // add HNA routes ! ! /* ! * In the path tree we have all the reachable nodes ! * in our topology sorted by etx metric. ! */ ! for (tree_node = avl_walk_first(&path_tree); ! tree_node; ! tree_node = avl_walk_next(tree_node)) { ! ! if (!(vert = tree_node->data)) { ! break; ! } ! ! // find the node's HNAs ! ! hna_gw = olsr_lookup_hna_gw(&vert->addr); ! ! // node doesn't announce any HNAs ! ! if (hna_gw == NULL) ! continue; ! ! // find route to the node ! ! gw_rt = olsr_lookup_routing_table(&hna_gw->A_gateway_addr); ! ! // maybe we haven't found a link or an interface for the gateway above ! // and hence haven't added a route - skip the HNA in this case ! ! if (gw_rt == NULL) ! continue; ! ! // loop through the node's HNAs ! ! for (hna = hna_gw->networks.next; hna != &hna_gw->networks; ! hna = hna->next) ! { ! // we already have a route via a previous (better) node ! ! if (olsr_lookup_hna_routing_table(&hna->A_network_addr) != NULL) ! continue; ! ! // create route for the HNA ! ! hna_rt = olsr_malloc(sizeof(struct rt_entry), "LQ HNA route entry"); ! ! // set HNA IP address and netmask ! ! COPY_IP(&hna_rt->rt_dst, &hna->A_network_addr); ! hna_rt->rt_mask = hna->A_netmask; ! ! // copy remaining fields from the node's route ! ! COPY_IP(&hna_rt->rt_router, &gw_rt->rt_router); ! hna_rt->rt_metric = gw_rt->rt_metric; ! hna_rt->rt_etx = gw_rt->rt_etx; ! hna_rt->rt_if = gw_rt->rt_if; ! ! // we're not a host route ! ! hna_rt->rt_flags = RTF_UP | RTF_GATEWAY; ! ! // find the correct list ! ! head_rt = &hna_routes[olsr_hashing(&hna->A_network_addr)]; ! // enqueue ! head_rt->next->prev = hna_rt; ! hna_rt->next = head_rt->next; ! head_rt->next = hna_rt; ! hna_rt->prev = head_rt; ! } ! } ! // free the graph olsr_free_everything(&vertex_tree); ! // move the route changes into the kernel ! ! olsr_update_kernel_routes(); ! olsr_update_kernel_hna_routes(); ! ! // free the saved routing table ! olsr_free_routing_table(old_routes); ! olsr_free_routing_table(old_hna); } --- 577,673 ---- (int)now.tv_usec/10000); + #ifdef SPF_PROFILING + gettimeofday(&t3, NULL); + #endif + + olsr_fill_routing_table_with_neighbors(); + /* ! * In the path tree we have all the reachable nodes in our topology. */ ! for (; !list_is_empty(&path_list); list_remove(path_list.next)) { ! vert = path_list.next->data; ! link = vert->next_hop; ! ! if (!link) { OLSR_PRINTF(2, "%s no next-hop\n", olsr_ip_to_string(&vert->addr)); continue; } ! /* find the interface for the found link */ ! inter = link->if_name ? if_ifwithname(link->if_name) ! : if_ifwithaddr(&link->local_iface_addr); ! /* interface is up ? */ ! if (inter) { ! /* add a route to the main address of the destination node */ ! olsr_insert_routing_table(&vert->addr, max_host_plen, &vert->addr, ! &link->neighbor_iface_addr, inter, ! vert->hops, vert->path_etx); ! /* add routes to the remaining interfaces of the destination node */ ! for (mid_walker = mid_lookup_aliases(&vert->addr); ! mid_walker != NULL; ! mid_walker = mid_walker->next_alias) { ! olsr_insert_routing_table(&mid_walker->alias, max_host_plen, &vert->addr, ! &link->neighbor_iface_addr, inter, ! vert->hops, vert->path_etx); ! } ! /* find the node's HNAs */ ! hna_gw = olsr_lookup_hna_gw(&vert->addr); ! /* node doesn't announce any HNAs */ ! if (!hna_gw) { ! continue; ! } ! /* loop through the node's HNAs */ ! for (hna = hna_gw->networks.next; ! hna != &hna_gw->networks; ! hna = hna->next) { ! plen = olsr_get_hna_prefix_len(hna); ! if (vert->path_etx != INFINITE_ETX) ! olsr_insert_routing_table(&hna->A_network_addr, plen, &vert->addr, ! &link->neighbor_iface_addr, inter, ! vert->hops, vert->path_etx); } } } ! #ifdef SPF_PROFILING ! gettimeofday(&t4, NULL); ! #endif ! /* move the route changes into the kernel */ ! olsr_update_kernel_routes(); ! #ifdef SPF_PROFILING ! gettimeofday(&t5, NULL); ! #endif ! /* free the SPF graph */ olsr_free_everything(&vertex_tree); ! #ifdef SPF_PROFILING ! gettimeofday(&t6, NULL); ! timersub(&t2, &t1, &spf_init); ! timersub(&t3, &t2, &spf_run); ! timersub(&t4, &t3, &route); ! timersub(&t5, &t4, &kernel); ! timersub(&t6, &t5, &cleanup); ! timersub(&t6, &t1, &total); ! olsr_printf(1, "\n--- SPF-stats for %d nodes, %d routes (total/init/run/route/kern/cleanup): %d, %d, %d, %d, %d, %d\n", ! path_count, routingtree.count, ! (int)total.tv_usec, (int)spf_init.tv_usec, (int)spf_run.tv_usec, ! (int)route.tv_usec, (int)kernel.tv_usec, (int)cleanup.tv_usec); ! #endif } Index: kernel_routes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/kernel_routes.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** kernel_routes.h 21 Nov 2004 11:28:56 -0000 1.8 --- kernel_routes.h 5 Sep 2007 16:11:10 -0000 1.9 *************** *** 51,64 **** int ! olsr_ioctl_add_route(struct rt_entry *destination); int ! olsr_ioctl_add_route6(struct rt_entry *destination); int ! olsr_ioctl_del_route(struct rt_entry *destination); int ! olsr_ioctl_del_route6(struct rt_entry *destination); --- 51,64 ---- int ! olsr_ioctl_add_route(struct rt_entry *); int ! olsr_ioctl_add_route6(struct rt_entry *); int ! olsr_ioctl_del_route(struct rt_entry *); int ! olsr_ioctl_del_route6(struct rt_entry *); Index: lq_list.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_list.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** lq_list.h 10 Feb 2007 17:36:51 -0000 1.5 --- lq_list.h 5 Sep 2007 16:11:10 -0000 1.6 *************** *** 48,77 **** struct list_node *next; struct list_node *prev; - void *data; }; ! struct list ! { ! struct list_node *head; ! struct list_node *tail; ! }; ! ! void list_init(struct list *list); ! ! #define list_get_head(node) ((node)->head) ! #define list_get_tail(node) ((node)->tail) ! #define list_get_next(node) ((node)->next) ! #define list_get_prev(node) ((node)->prev) ! ! void list_add_head(struct list *list, struct list_node *node); ! void list_add_tail(struct list *list, struct list_node *node); ! void list_add_before(struct list *list, struct list_node *pos_node, ! struct list_node *node); ! void list_add_after(struct list *list, struct list_node *pos_node, ! struct list_node *node); ! void list_remove(struct list *list, struct list_node *node); #endif --- 48,63 ---- struct list_node *next; struct list_node *prev; void *data; }; ! void list_head_init(struct list_node *); ! void list_node_init(struct list_node *); ! int list_node_on_list(struct list_node *); ! int list_is_empty(struct list_node *); ! void list_add_before(struct list_node *, struct list_node *); ! void list_add_after(struct list_node *, struct list_node *); ! void list_remove(struct list_node *); #endif Index: lq_avl.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** lq_avl.h 5 Jul 2007 22:43:46 -0000 1.9 --- lq_avl.h 5 Sep 2007 16:11:10 -0000 1.10 *************** *** 60,66 **** --- 60,72 ---- { struct avl_node *root; + struct avl_node *first; + struct avl_node *last; + unsigned int count; int (*comp)(void *, void *); }; + #define AVL_DUP 1 + #define AVL_DUP_NO 0 + void avl_init(struct avl_tree *, int (*)(void *, void *)); struct avl_node *avl_find(struct avl_tree *, void *); *************** *** 73,76 **** --- 79,83 ---- extern int (*avl_comp_default)(void *, void *); + extern int (*avl_comp_prefix_default)(void *, void *); extern int avl_comp_ipv4(void *, void *); extern int avl_comp_ipv6(void *, void *); Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** net_olsr.h 20 Aug 2007 18:46:03 -0000 1.10 --- net_olsr.h 5 Sep 2007 16:11:11 -0000 1.11 *************** *** 91,94 **** --- 91,97 ---- olsr_netmask_to_prefix(const union olsr_ip_addr *); + int + olsr_host_rt_maxplen(void); + char * sockaddr_to_string(const struct sockaddr *); Index: hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** hna_set.c 2 Aug 2007 22:07:19 -0000 1.20 --- hna_set.c 5 Sep 2007 16:11:10 -0000 1.21 *************** *** 81,85 **** } ! --- 81,93 ---- } ! int ! olsr_get_hna_prefix_len(struct hna_net *hna) ! { ! if (olsr_cnf->ip_version == AF_INET) { ! return olsr_netmask_to_prefix((union olsr_ip_addr *)&hna->A_netmask.v4); ! } else { ! return hna->A_netmask.v6; ! } ! } *************** *** 366,368 **** } ! --- 374,380 ---- } ! /* ! * Local Variables: ! * c-basic-offset: 2 ! * End: ! */ Index: lq_list.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_list.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** lq_list.c 10 Feb 2007 17:36:51 -0000 1.5 --- lq_list.c 5 Sep 2007 16:11:10 -0000 1.6 *************** *** 44,123 **** #include "lq_list.h" ! void list_init(struct list *list) { ! list->head = NULL; ! list->tail = NULL; } ! void list_add_head(struct list *list, struct list_node *node) { - if (list->head != NULL) - list->head->prev = node; - - else - list->tail = node; - node->prev = NULL; ! node->next = list->head; ! ! list->head = node; } ! void list_add_tail(struct list *list, struct list_node *node) { ! if (list->tail != NULL) ! list->tail->next = node; ! ! else ! list->head = node; ! ! node->prev = list->tail; ! node->next = NULL; ! list->tail = node; } ! void list_add_before(struct list *list, struct list_node *pos_node, ! struct list_node *node) { ! if (pos_node->prev != NULL) ! pos_node->prev->next = node; ! ! else ! list->head = node; ! ! node->prev = pos_node->prev; ! node->next = pos_node; ! pos_node->prev = node; } ! void list_add_after(struct list *list, struct list_node *pos_node, ! struct list_node *node) { ! if (pos_node->next != NULL) ! pos_node->next->prev = node; ! ! else ! list->tail = node; ! ! node->prev = pos_node; ! node->next = pos_node->next; ! pos_node->next = node; } ! void list_remove(struct list *list, struct list_node *node) { ! if (node == list->head) ! list->head = node->next; ! else ! node->prev->next = node->next; ! if (node == list->tail) ! list->tail = node->prev; ! else ! node->next->prev = node->prev; } --- 44,107 ---- #include "lq_list.h" ! /* init a circular list */ ! void list_head_init(struct list_node *node) { ! node->prev = node; ! node->next = node; } ! void list_node_init(struct list_node *node) { node->prev = NULL; ! node->next = NULL; } ! int list_node_on_list(struct list_node *node) { ! if (node->prev || node->next) { ! return 1; ! } ! return 0; } ! int list_is_empty(struct list_node *node) { ! if (node->prev == node && node->next == node) { ! return 1; ! } ! return 0; } ! void list_add_after(struct list_node *pos_node, struct list_node *new_node) { ! new_node->next = pos_node->next; ! new_node->prev = pos_node; ! pos_node->next->prev = new_node; ! pos_node->next = new_node; } ! void list_add_before(struct list_node *pos_node, struct list_node *new_node) { ! new_node->prev = pos_node->prev; ! new_node->next = pos_node; ! pos_node->prev->next = new_node; ! pos_node->prev = new_node; ! } ! void list_remove(struct list_node *del_node) ! { ! del_node->next->prev = del_node->prev; ! del_node->prev->next = del_node->next; ! list_node_init(del_node); } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ Index: lq_route.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lq_route.h 5 Jul 2007 22:43:47 -0000 1.4 --- lq_route.h 5 Sep 2007 16:11:10 -0000 1.5 *************** *** 47,51 **** #define MIN_LINK_QUALITY 0.01 ! void olsr_calculate_lq_routing_table(void); #endif --- 47,51 ---- #define MIN_LINK_QUALITY 0.01 ! void olsr_calculate_routing_table(void); #endif Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** net_olsr.c 28 Aug 2007 20:10:16 -0000 1.28 --- net_olsr.c 5 Sep 2007 16:11:11 -0000 1.29 *************** *** 500,507 **** olsr_netmask_to_prefix(const union olsr_ip_addr *adr) { - int i; olsr_u16_t prefix = 0; ! for (i = 0; i < 16; i++) { if(adr->v6.s6_addr[i] == 0xff) --- 500,509 ---- olsr_netmask_to_prefix(const union olsr_ip_addr *adr) { olsr_u16_t prefix = 0; + unsigned int i; ! prefix = 0; ! ! for(i = 0; i < olsr_cnf->ipsize; i++) { if(adr->v6.s6_addr[i] == 0xff) *************** *** 526,529 **** --- 528,547 ---- } + /** + * olsr_host_rt_maxplen + * + * @return the maxium prefix length based wether v4 or v6 is configured + */ + int + olsr_host_rt_maxplen(void) + { + if(olsr_cnf->ip_version == AF_INET) { + /* IPv4 */ + return 32; + } else { + /* IPv6 */ + return 128; + } + } *************** *** 659,660 **** --- 677,684 ---- return OLSR_TRUE; } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ Index: olsr_types.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_types.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** olsr_types.h 28 Jun 2007 22:34:52 -0000 1.8 --- olsr_types.h 5 Sep 2007 16:11:11 -0000 1.9 *************** *** 99,102 **** --- 99,108 ---- }; + struct olsr_ip_prefix + { + union olsr_ip_addr prefix; + olsr_u8_t prefix_len; + }; + union hna_netmask { Index: process_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** process_routes.c 2 Aug 2007 22:07:19 -0000 1.34 --- process_routes.c 5 Sep 2007 16:11:11 -0000 1.35 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) + * RIB implementation (c) 2007, Hannes Gredler (hannes at gredler.at) * All rights reserved. * *************** *** 48,51 **** --- 49,53 ---- #include "kernel_routes.h" #include + #include "lq_avl.h" #ifdef WIN32 *************** *** 65,71 **** static struct export_route_entry *del_routes; ! struct rt_entry old_routes[HASHSIZE]; ! struct rt_entry old_hna[HASHSIZE]; void --- 67,100 ---- static struct export_route_entry *del_routes; + struct list_node add_kernel_list; + struct list_node chg_kernel_list; + struct list_node del_kernel_list; ! /** ! * ! * Calculate the kernel route flags. ! * Called before enqueuing a change/delete operation ! * ! */ ! olsr_u8_t ! olsr_rt_flags(struct rt_entry *rt) ! { ! struct rt_nexthop *nh; ! olsr_u8_t flags; ! ! flags = (RTF_UP); ! ! if (rt->rt_dst.prefix_len == olsr_host_rt_maxplen()) { ! flags |= RTF_HOST; ! } ! ! nh = olsr_get_nh(rt); ! ! if(!COMP_IP(&rt->rt_dst.prefix, &nh->gateway)) { ! flags |= RTF_GATEWAY; ! } ! ! return flags; ! } void *************** *** 158,162 **** int ! olsr_export_add_route (struct rt_entry *e) { int retval = 0; --- 187,191 ---- int ! olsr_export_add_route (struct rt_entry *rt) { int retval = 0; *************** *** 165,169 **** { if (tmp->type == AF_INET) ! retval = tmp->function(e); } return retval; --- 194,198 ---- { if (tmp->type == AF_INET) ! retval = tmp->function(rt); } return retval; *************** *** 171,175 **** int ! olsr_export_add_route6 (struct rt_entry *e) { int retval = 0; --- 200,204 ---- int ! olsr_export_add_route6 (struct rt_entry *rt) { int retval = 0; *************** *** 178,182 **** { if (tmp->type == AF_INET6) ! retval = tmp->function(e); } return retval; --- 207,211 ---- { if (tmp->type == AF_INET6) ! retval = tmp->function(rt); } return retval; *************** *** 184,188 **** int ! olsr_export_del_route (struct rt_entry *e) { int retval = 0; --- 213,217 ---- int ! olsr_export_del_route (struct rt_entry *rt) { int retval = 0; *************** *** 191,195 **** { if (tmp->type == AF_INET) ! retval = tmp->function(e); } return retval; --- 220,224 ---- { if (tmp->type == AF_INET) ! retval = tmp->function(rt); } return retval; *************** *** 197,201 **** int ! olsr_export_del_route6 (struct rt_entry *e) { int retval = 0; --- 226,230 ---- int ! olsr_export_del_route6 (struct rt_entry *rt) { int retval = 0; *************** *** 204,623 **** { if (tmp->type == AF_INET6) ! retval = tmp->function(e); } return retval; } - - - int - olsr_init_old_table(void) - { - int idx; - - for(idx=0;idxrt_dst); ! for(destination = table[hash].next; destination != &table[hash]; destination = destination->next) ! { ! //printf("Checking %s hc: %d ", olsr_ip_to_string(&dst->rt_dst), dst->rt_metric); ! //printf("vs %s hc: %d ... ", olsr_ip_to_string(&destination->rt_dst), destination->rt_metric); ! if (COMP_IP(&destination->rt_dst, &dst->rt_dst) && ! COMP_IP(&destination->rt_router, &dst->rt_router) && ! (destination->rt_if->if_index == dst->rt_if->if_index)) ! { ! if(destination->rt_metric == dst->rt_metric) ! { ! return 1; ! } ! else ! { ! return 0; ! } ! } ! } ! return 0; ! } /** ! *Create a list containing the entries in from_table ! *that do not exist in in_table ! * ! *@param from_table the table to use ! *@param in_table the routes already added ! * ! *@return a poiter to a linked list of routes to add */ ! struct destination_n * ! olsr_build_update_list(struct rt_entry *from_table,struct rt_entry *in_table) { ! struct destination_n *kernel_route_list = NULL; ! struct rt_entry *destination; ! int idx; ! ! for(idx=0;idxnext) ! { ! if (!olsr_find_up_route(destination, in_table)) ! { ! struct destination_n *route_list; ! route_list = olsr_malloc(sizeof(struct destination_n), "create route tmp list"); ! ! route_list->destination = destination; ! ! route_list->next = kernel_route_list; ! kernel_route_list = route_list; ! } ! } ! } ! ! return (kernel_route_list); ! } /** ! *Deletes all OLSR routes ! * * ! *@return 1 */ ! int ! olsr_delete_all_kernel_routes(void) ! { ! struct destination_n *delete_kernel_list; ! struct destination_n *tmp; ! ! OLSR_PRINTF(1, "Deleting all routes...\n"); ! delete_kernel_list = olsr_build_update_list(hna_routes, old_hna); ! OLSR_PRINTF(1, "HNA list:\n"); ! for(tmp = delete_kernel_list;tmp;tmp = tmp->next) ! { ! union olsr_ip_addr *tmp_addr = &tmp->destination->rt_dst; ! OLSR_PRINTF(1, "Dest: %s\n", olsr_ip_to_string(tmp_addr)); } ! olsr_delete_routes_from_kernel(delete_kernel_list); ! delete_kernel_list = olsr_build_update_list(routingtable,old_routes); - OLSR_PRINTF(1, "Route list:\n"); - for(tmp = delete_kernel_list;tmp;tmp = tmp->next) - { - union olsr_ip_addr *tmp_addr = &tmp->destination->rt_dst; - OLSR_PRINTF(1, "Dest: %s\n", olsr_ip_to_string(tmp_addr)); } ! olsr_delete_routes_from_kernel(delete_kernel_list); ! return 1; } - /** ! *Perform all neccessary actions for an update of the ! *routes in the kernel. * *@return nada */ ! void ! olsr_update_kernel_routes(void) { ! struct destination_n *delete_kernel_list; ! struct destination_n *add_kernel_list; ! OLSR_PRINTF(3, "Updating kernel routes...\n"); ! delete_kernel_list = olsr_build_update_list(old_routes, routingtable); ! add_kernel_list = olsr_build_update_list(routingtable, old_routes); ! olsr_delete_routes_from_kernel(delete_kernel_list); ! olsr_add_routes_in_kernel(add_kernel_list); ! } /** ! *Perform all neccessary actions for an update of the ! *HNA routes in the kernel. ! * ! *@return nada */ ! void ! olsr_update_kernel_hna_routes(void) { ! struct destination_n *delete_kernel_list; ! struct destination_n *add_kernel_list; ! OLSR_PRINTF(3, "Updating kernel HNA routes...\n"); ! delete_kernel_list = olsr_build_update_list(old_hna, hna_routes); ! add_kernel_list = olsr_build_update_list(hna_routes, old_hna); ! olsr_delete_routes_from_kernel(delete_kernel_list); ! olsr_add_routes_in_kernel(add_kernel_list); } - /** ! *Create a copy of the routing table and ! *clear the current table ! * ! *@param original the table to move from ! *@param the table to move to ! * ! *@return nada */ ! void ! olsr_move_route_table(struct rt_entry *original, struct rt_entry *new) { ! int idx; ! for(idx=0;idxprev = &new[idx]; ! new[idx].prev = original[idx].prev; ! new[idx].prev->next = &new[idx]; ! /* Clear original */ ! original[idx].next = &original[idx]; ! original[idx].prev = &original[idx]; ! } ! } ! } /** ! *Delete a linked list of routes from the kernel. ! * ! *@param delete_kernel_list the list to delete ! * ! *@return nada */ ! void ! olsr_delete_routes_from_kernel(struct destination_n *delete_kernel_list) { ! struct destination_n *destination_ptr; ! int metric_counter = 1; ! olsr_bool last_run = OLSR_FALSE; ! /* Find highest metric */ ! for(destination_ptr = delete_kernel_list; ! destination_ptr != NULL; ! destination_ptr = destination_ptr->next) ! { ! if(destination_ptr->destination->rt_metric > metric_counter) ! metric_counter = destination_ptr->destination->rt_metric; ! } ! #ifdef DEBUG ! OLSR_PRINTF(3, "%s highest metric %d\n", ! __func__, metric_counter); ! #endif ! ! while(delete_kernel_list!=NULL) ! { ! struct destination_n *previous_node = delete_kernel_list; ! assert(metric_counter); ! /* searching for all the items with metric equal to n */ ! for(destination_ptr = delete_kernel_list; destination_ptr != NULL; ) ! { ! if(destination_ptr->destination->rt_metric == metric_counter) ! { ! /* Make sure one-hop direct neighbors are deleted last */ ! if(metric_counter == 1 && ! (!last_run && ! COMP_IP(&destination_ptr->destination->rt_dst, ! &destination_ptr->destination->rt_router))) ! { ! previous_node = destination_ptr; ! destination_ptr = destination_ptr->next; ! } ! else ! { ! olsr_16_t error; ! #ifdef DEBUG ! OLSR_PRINTF(3, "Deleting route to %s hopcount %d\n", ! olsr_ip_to_string(&destination_ptr->destination->rt_dst), ! destination_ptr->destination->rt_metric); ! #endif ! if(!olsr_cnf->host_emul) ! { ! if(olsr_cnf->ip_version == AF_INET) ! error = olsr_export_del_route(destination_ptr->destination); ! else ! error = olsr_export_del_route6(destination_ptr->destination); ! ! if(error < 0) ! { ! const char * const err_msg = strerror(errno); ! OLSR_PRINTF(1, "Delete route(%s):%s\n", olsr_ip_to_string(&destination_ptr->destination->rt_dst), err_msg); ! olsr_syslog(OLSR_LOG_ERR, "Delete route:%s", err_msg); ! } ! } ! ! /* Getting rid of this node and hooking up the broken point */ ! if(destination_ptr == delete_kernel_list) ! { ! destination_ptr = delete_kernel_list->next; ! free(delete_kernel_list); ! delete_kernel_list = destination_ptr; ! previous_node = delete_kernel_list; ! } ! else ! { ! previous_node->next = destination_ptr->next; ! free(destination_ptr); ! destination_ptr = previous_node->next; ! } ! } ! } ! else ! { ! previous_node = destination_ptr; ! destination_ptr = destination_ptr->next; ! } ! ! } ! if((metric_counter == 1) && !last_run) ! { ! last_run = OLSR_TRUE; ! } ! else ! { ! metric_counter--; ! } } ! } /** ! *Add a list of routes to the kernel. Adding ! *is done by hopcount to be sure a route ! *to the nexthop is added. ! * ! *@param add_kernel_list the linked list of routes to add ! * ! *@return nada */ ! void ! olsr_add_routes_in_kernel(struct destination_n *add_kernel_list) { ! int metric_counter = 1; ! olsr_bool first_run = OLSR_TRUE; ! ! while(add_kernel_list != NULL) ! { ! struct destination_n *destination_kernel = NULL; ! struct destination_n *previous_node = add_kernel_list; ! /* searching for all the items with metric equal to n */ ! for(destination_kernel = add_kernel_list; destination_kernel != NULL; ) ! { ! if((destination_kernel->destination->rt_metric == metric_counter) && ! (!first_run || ! COMP_IP(&destination_kernel->destination->rt_dst, ! &destination_kernel->destination->rt_router))) ! { ! olsr_16_t error; ! /* First add all 1-hop routes that has themselves as GW */ ! #ifdef DEBUG ! OLSR_PRINTF(3, "Adding route to %s hopcount %d\n", ! olsr_ip_to_string(&destination_kernel->destination->rt_dst), ! destination_kernel->destination->rt_metric); ! #endif ! ! if(!olsr_cnf->host_emul) ! { ! if(olsr_cnf->ip_version == AF_INET) ! error=olsr_export_add_route(destination_kernel->destination); ! else ! error=olsr_export_add_route6(destination_kernel->destination); ! ! if(error < 0) ! { ! const char * const err_msg = strerror(errno); ! OLSR_PRINTF(1, "Add route(%s): %s\n", olsr_ip_to_string(&destination_kernel->destination->rt_dst), err_msg); ! olsr_syslog(OLSR_LOG_ERR, "Add route:%s", err_msg); ! } ! } ! ! /* Getting rid of this node and hooking up the broken point */ ! if(destination_kernel == add_kernel_list) ! { ! destination_kernel = add_kernel_list->next; ! free(add_kernel_list); ! add_kernel_list = destination_kernel; ! previous_node=add_kernel_list; ! } ! else ! { ! previous_node->next = destination_kernel->next; ! free(destination_kernel); ! destination_kernel = previous_node->next; ! } ! } ! else ! { ! previous_node = destination_kernel; ! destination_kernel = destination_kernel->next; ! } ! ! } ! if(first_run) ! { ! first_run = OLSR_FALSE; ! } ! else ! { ! metric_counter++; ! } } - - } --- 233,540 ---- { if (tmp->type == AF_INET6) ! retval = tmp->function(rt); } return retval; } /** ! *Deletes all OLSR routes * ! * This is extremely simple - Just increment the version of the ! * tree and then olsr_update_kernel_routes() will see ! * all routes in the tree as outdated and flush it. * ! *@return 1 */ int ! olsr_delete_all_kernel_routes(void) { ! OLSR_PRINTF(1, "Deleting all routes...\n"); ! olsr_bump_routingtree_version(); ! olsr_update_kernel_routes(); + return 1; + } /** ! * Enqueue a route on a kernel add/chg/del queue. */ ! static void ! olsr_enqueue_rt(struct list_node *head_node, struct rt_entry *rt) { ! struct rt_nexthop *nh; + /* if this node is already on some changelist we are done */ + if (list_node_on_list(&rt->rt_change_node)) { + return; + } + rt->rt_change_node.data = rt; + /* + * For easier route dependency tracking we enqueue nexthop routes + * at the head of the queue and non-nexthop routes at the tail of the queue. + */ + nh = olsr_get_nh(rt); + if (COMP_IP(&rt->rt_dst.prefix, &nh->gateway)) { + list_add_after(head_node, &rt->rt_change_node); + } else { + list_add_before(head_node, &rt->rt_change_node); + } + } /** ! * Process a route from the kernel deletion list. * ! *@return nada */ ! static void ! olsr_delete_kernel_route(struct rt_entry *rt) ! { ! olsr_16_t error; ! if(!olsr_cnf->host_emul) { ! if(olsr_cnf->ip_version == AF_INET) { ! error = olsr_export_del_route(rt); ! } else { ! error = olsr_export_del_route6(rt); } ! if(error < 0) { ! const char * const err_msg = strerror(errno); ! OLSR_PRINTF(1, "KERN: ERROR deleting %s: %s\n", ! olsr_rt_to_string(rt), err_msg); ! ! olsr_syslog(OLSR_LOG_ERR, "Delete route: %s", err_msg); } ! } } /** ! * Process a route from the kernel addition list. * *@return nada */ ! static void ! olsr_add_kernel_route(struct rt_entry *rt) { ! olsr_16_t error; ! if(!olsr_cnf->host_emul) { ! if(olsr_cnf->ip_version == AF_INET) { ! error = olsr_export_add_route(rt); ! } else { ! error = olsr_export_add_route6(rt); ! } ! ! if(error < 0) { ! const char * const err_msg = strerror(errno); ! OLSR_PRINTF(1, "KERN: ERROR adding %s: %s\n", ! olsr_rtp_to_string(rt->rt_best), err_msg); + olsr_syslog(OLSR_LOG_ERR, "Add route: %s", err_msg); + } else { + + /* route addition has suceeded */ + /* save the nexthop in the route entry */ + rt->rt_nexthop = rt->rt_best->rtp_nexthop; + } + } + } /** ! * process the kernel add list. ! * the routes are already ordered such that nexthop routes ! * are on the head of the queue. ! * nexthop routes need to be added first and therefore ! * the queue needs to be traversed from head to tail. */ ! static void ! olsr_add_kernel_routes(struct list_node *head_node) { ! struct rt_entry *rt; ! while (!list_is_empty(head_node)) { ! rt = head_node->next->data; ! olsr_add_kernel_route(rt); ! list_remove(&rt->rt_change_node); ! } } /** ! * process the kernel change list. ! * the routes are already ordered such that nexthop routes ! * are on the head of the queue. ! * non-nexthop routes need to be changed first and therefore ! * the queue needs to be traversed from tail to head. */ ! static void ! olsr_chg_kernel_routes(struct list_node *head_node) { ! struct rt_entry *rt; ! struct list_node *node; ! if (list_is_empty(head_node)) { ! return; ! } ! /* ! * First pass. ! * traverse from the end to the beginning of the list, ! * such that nexthop routes are deleted last. ! */ ! for (node = head_node->prev; head_node != node; node = node->prev) { ! ! rt = node->data; ! olsr_delete_kernel_route(rt); ! } + /* + * Second pass. + * Traverse from the beginning to the end of the list, + * such that nexthop routes are added first. + */ + while (!list_is_empty(head_node)) { + + rt = head_node->next->data; + olsr_add_kernel_route(rt); + + list_remove(&rt->rt_change_node); + } + } /** ! * process the kernel delete list. ! * the routes are already ordered such that nexthop routes ! * are on the head of the queue. ! * non-nexthop routes need to be deleted first and therefore ! * the queue needs to be traversed from tail to head. */ ! static void ! olsr_del_kernel_routes(struct list_node *head_node) { ! struct rt_entry *rt; + while (!list_is_empty(head_node)) { ! rt = head_node->prev->data; ! olsr_delete_kernel_route(rt); ! list_remove(&rt->rt_change_node); ! free(rt); ! } ! } ! /** ! * Check the version number of all route paths hanging off a route entry. ! * If a route does not match the current routing tree number, delete it. ! * Reset the best route pointer. ! */ ! static void ! olsr_delete_outdated_routes(struct rt_entry *rt) ! { ! struct rt_path *rtp; ! struct avl_node *rtp_tree_node, *next_rtp_tree_node; ! for (rtp_tree_node = avl_walk_first(&rt->rt_path_tree); ! rtp_tree_node; ! rtp_tree_node = next_rtp_tree_node) { ! /* ! * pre-fetch the next node before loosing context. ! */ ! next_rtp_tree_node = avl_walk_next(rtp_tree_node); ! ! rtp = rtp_tree_node->data; ! ! /* ! * check the version number which gets incremented on every SPF run. ! * comparing for unequalness avoids handling version number wraps. ! */ ! if (routingtree_version != rtp->rtp_version) { ! ! /* remove from the originator tree */ ! avl_delete(&rt->rt_path_tree, rtp_tree_node); ! free(rtp); } ! } ! ! /* safety measure against dangling pointers */ ! rt->rt_best = NULL; } /** ! * Walk all the routes, remove outdated routes and run ! * best path selection on the remaining set. ! * Finally compare the nexthop of the route head and the best ! * path and enqueue a add/chg operation. */ ! void ! olsr_update_kernel_routes(void) { ! struct rt_entry *rt; ! OLSR_PRINTF(3, "Updating kernel routes...\n"); ! /* walk all routes in the RIB. */ ! OLSR_FOR_ALL_RT_ENTRIES(rt) { ! ! /* eliminate first unused routes */ ! olsr_delete_outdated_routes(rt); ! ! if (!rt->rt_path_tree.count) { ! ! /* oops, all routes are gone - flush the route head */ ! avl_delete(&routingtree, rt_tree_node); ! ! olsr_enqueue_rt(&del_kernel_list, rt); ! continue; } + /* run best route election */ + olsr_rt_best(rt); + + /* nexthop change ? */ + if (olsr_nh_change(&rt->rt_best->rtp_nexthop, &rt->rt_nexthop)) { + + if (!rt->rt_nexthop.iface) { + + /* fresh routes do have NULL pointers in the nexthop fields. */ + olsr_enqueue_rt(&add_kernel_list, rt); + } else { + + /* this is a route change. */ + olsr_enqueue_rt(&chg_kernel_list, rt); + } + } + } OLSR_FOR_ALL_RT_ENTRIES_END(rt); + + /* delete unreachable routes */ + olsr_del_kernel_routes(&del_kernel_list); + + /* route changes */ + olsr_chg_kernel_routes(&chg_kernel_list); + /* route additions */ + olsr_add_kernel_routes(&add_kernel_list); + #if DEBUG + olsr_print_routing_table(&routingtree); + #endif + } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ipc_frontend.c 2 Aug 2007 22:07:19 -0000 1.33 --- ipc_frontend.c 5 Sep 2007 16:11:10 -0000 1.34 *************** *** 271,280 **** */ int ! ipc_route_send_rtentry(union olsr_ip_addr *dst, union olsr_ip_addr *gw, int met, int add, char *int_name) { struct ipcmsg packet; - //int i, x; char *tmp; if(!ipc_active) return 0; --- 271,284 ---- */ int ! ipc_route_send_rtentry(union olsr_ip_addr *dst, union olsr_ip_addr *gw, ! int met, int add, char *int_name) { struct ipcmsg packet; char *tmp; + if(!olsr_cnf->open_ipc) { + return -1; + } + if(!ipc_active) return 0; *************** *** 334,340 **** ipc_send_all_routes(int fd) { ! struct rt_entry *destination; struct interface *ifn; - int idx; struct ipcmsg packet; char *tmp; --- 338,343 ---- ipc_send_all_routes(int fd) { ! struct rt_entry *rt; struct interface *ifn; struct ipcmsg packet; char *tmp; *************** *** 344,440 **** return 0; ! for(idx=0;idxnext) ! { ! ifn = destination->rt_if; ! ! memset(&packet, 0, sizeof(struct ipcmsg)); ! packet.size = htons(IPC_PACK_SIZE); ! packet.msgtype = ROUTE_IPC; ! ! COPY_IP(&packet.target_addr, &destination->rt_dst); ! packet.add = 1; ! ! if(olsr_cnf->ip_version == AF_INET) ! { ! packet.metric = (olsr_u8_t)(destination->rt_metric - 1); ! } ! else ! { ! packet.metric = (olsr_u8_t)destination->rt_metric; ! } ! COPY_IP(&packet.gateway_addr, &destination->rt_router); ! ! if(ifn) ! memcpy(&packet.device[0], ifn->int_name, 4); ! else ! memset(&packet.device[0], 0, 4); ! ! ! tmp = (char *) &packet; ! ! if (send(fd, tmp, IPC_PACK_SIZE, MSG_NOSIGNAL) < 0) // MSG_NOSIGNAL to avoid sigpipe ! { ! OLSR_PRINTF(1, "(RT_ENTRY)IPC connection lost!\n"); ! CLOSE(ipc_conn); ! //olsr_cnf->open_ipc = 0; ! ipc_active = OLSR_FALSE; ! return -1; ! } ! ! } ! } ! ! for(idx=0;idxnext) ! { ! ifn = destination->rt_if; ! ! packet.size = htons(IPC_PACK_SIZE); ! packet.msgtype = ROUTE_IPC; ! COPY_IP(&packet.target_addr, &destination->rt_dst); ! packet.add = 1; ! ! if(olsr_cnf->ip_version == AF_INET) ! { ! packet.metric = (olsr_u8_t)(destination->rt_metric - 1); ! } ! else ! { ! packet.metric = (olsr_u8_t)destination->rt_metric; ! } ! COPY_IP(&packet.gateway_addr, &destination->rt_router); ! if(ifn) ! memcpy(&packet.device[0], ifn->int_name, 4); ! else ! memset(&packet.device[0], 0, 4); ! tmp = (char *) &packet; ! if (send(ipc_conn, tmp, IPC_PACK_SIZE, MSG_NOSIGNAL) < 0) // MSG_NOSIGNAL to avoid sigpipe ! { ! OLSR_PRINTF(1, "(RT_ENTRY)IPC connection lost!\n"); ! CLOSE(ipc_conn); ! //olsr_cnf->open_ipc = 0; ! ipc_active = OLSR_FALSE; ! return -1; ! } ! ! } } ! ! return 1; } --- 347,380 ---- return 0; ! OLSR_FOR_ALL_RT_ENTRIES(rt) { ! ifn = rt->rt_nexthop.iface; ! memset(&packet, 0, sizeof(struct ipcmsg)); ! packet.size = htons(IPC_PACK_SIZE); ! packet.msgtype = ROUTE_IPC; ! COPY_IP(&packet.target_addr, &rt->rt_dst.prefix); ! packet.add = 1; ! packet.metric = (olsr_u8_t)(rt->rt_best->rtp_metric.hops); ! COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway); + if(ifn) + memcpy(&packet.device[0], ifn->int_name, 4); + else + memset(&packet.device[0], 0, 4); ! tmp = (char *) &packet; ! /* MSG_NOSIGNAL to avoid sigpipe */ ! if (send(fd, tmp, IPC_PACK_SIZE, MSG_NOSIGNAL) < 0) { ! OLSR_PRINTF(1, "(RT_ENTRY)IPC connection lost!\n"); ! CLOSE(ipc_conn); ! ipc_active = OLSR_FALSE; ! return -1; } ! } OLSR_FOR_ALL_RT_ENTRIES_END(rt); return 1; } *************** *** 550,551 **** --- 490,497 ---- return 1; } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** routing_table.c 2 Aug 2007 21:54:54 -0000 1.28 --- routing_table.c 5 Sep 2007 16:11:11 -0000 1.29 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) + * RIB implementation (c) 2007, Hannes Gredler (hannes at gredler.at) * All rights reserved. * *************** *** 40,45 **** */ [...1319 lines suppressed...] ! ! rtp = rtp_tree_node->data; ! ! printf("\tfrom %s, etx %.3f, metric %u, via %s, %s, v %u\n", ! olsr_ip_to_string(&rtp->rtp_originator), ! rtp->rtp_metric.etx, ! rtp->rtp_metric.hops, ! olsr_ip_to_string(&rtp->rtp_nexthop.gateway), ! rtp->rtp_nexthop.iface->int_name, ! rtp->rtp_version); ! } + } } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ Index: process_routes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** process_routes.h 31 Jan 2007 12:36:50 -0000 1.10 --- process_routes.h 5 Sep 2007 16:11:11 -0000 1.11 *************** *** 48,53 **** #include ! extern struct rt_entry old_routes[HASHSIZE]; ! extern struct rt_entry old_hna[HASHSIZE]; void --- 48,54 ---- #include ! extern struct list_node add_kernel_list; ! extern struct list_node chg_kernel_list; ! extern struct list_node del_kernel_list; void *************** *** 78,108 **** olsr_export_del_route6 (struct rt_entry*); - - int - olsr_init_old_table(void); - - int - olsr_find_up_route(struct rt_entry *dst,struct rt_entry *table); - - struct destination_n * - olsr_build_update_list(struct rt_entry *from_table, struct rt_entry *in_table); - void olsr_update_kernel_routes(void); - void - olsr_update_kernel_hna_routes(void); - - void - olsr_move_route_table(struct rt_entry *, struct rt_entry *); - - void - olsr_delete_routes_from_kernel(struct destination_n *delete_kernel_list); - - void - olsr_add_routes_in_kernel(struct destination_n *add_kernel_list); - int olsr_delete_all_kernel_routes(void); #endif --- 79,90 ---- olsr_export_del_route6 (struct rt_entry*); void olsr_update_kernel_routes(void); int olsr_delete_all_kernel_routes(void); + olsr_u8_t + olsr_rt_flags(struct rt_entry *); + #endif Index: lq_avl.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** lq_avl.c 2 Aug 2007 22:00:46 -0000 1.11 --- lq_avl.c 5 Sep 2007 16:11:10 -0000 1.12 *************** *** 51,58 **** /* ! * dummy comparison pointer ! * set to zero for a fast inline ipv4 comparison */ int (*avl_comp_default)(void *, void *) = NULL; int avl_comp_ipv4(void *ip1, void *ip2) --- 51,61 ---- /* ! * default comparison pointers ! * set to the respective compare function. ! * if avl_comp_default is set to zero, a fast ! * inline ipv4 comparison will be executed. */ int (*avl_comp_default)(void *, void *) = NULL; + int (*avl_comp_prefix_default)(void *, void *); int avl_comp_ipv4(void *ip1, void *ip2) *************** *** 70,73 **** --- 73,79 ---- { tree->root = NULL; + tree->first = NULL; + tree->last = NULL; + tree->count = 0; tree->comp = comp; } *************** *** 260,267 **** } ! static void avl_insert_before(struct avl_node *pos_node, struct avl_node *node) { if (pos_node->prev != NULL) pos_node->prev->next = node; node->prev = pos_node->prev; --- 266,276 ---- } ! static void avl_insert_before(struct avl_tree *tree, struct avl_node *pos_node, ! struct avl_node *node) { if (pos_node->prev != NULL) pos_node->prev->next = node; + else + tree->first = node; node->prev = pos_node->prev; *************** *** 269,278 **** pos_node->prev = node; } ! static void avl_insert_after(struct avl_node *pos_node, struct avl_node *node) { if (pos_node->next != NULL) pos_node->next->prev = node; node->prev = pos_node; --- 278,292 ---- pos_node->prev = node; + + tree->count++; } ! static void avl_insert_after(struct avl_tree *tree, struct avl_node *pos_node, ! struct avl_node *node) { if (pos_node->next != NULL) pos_node->next->prev = node; + else + tree->last = node; node->prev = pos_node; *************** *** 280,292 **** pos_node->next = node; } ! static void avl_remove(struct avl_node *node) { if (node->prev != NULL) node->prev->next = node->next; if (node->next != NULL) node->next->prev = node->prev; } --- 294,314 ---- pos_node->next = node; + + tree->count++; } ! static void avl_remove(struct avl_tree *tree, struct avl_node *node) { if (node->prev != NULL) node->prev->next = node->next; + else + tree->first = node->next; if (node->next != NULL) node->next->prev = node->prev; + else + tree->last = node->prev; + + tree->count--; } *************** *** 311,314 **** --- 333,339 ---- { tree->root = new; + tree->first = new; + tree->last = new; + tree->count = 1; return 0; } *************** *** 329,338 **** if (diff == 0) { ! if (allow_duplicates == 0) return -1; new->leader = 0; ! avl_insert_after(last, new); return 0; } --- 354,363 ---- if (diff == 0) { ! if (allow_duplicates == AVL_DUP_NO) return -1; new->leader = 0; ! avl_insert_after(tree, last, new); return 0; } *************** *** 340,344 **** if (node->balance == 1) { ! avl_insert_before(node, new); node->balance = 0; --- 365,369 ---- if (node->balance == 1) { ! avl_insert_before(tree, node, new); node->balance = 0; *************** *** 350,354 **** if (node->balance == -1) { ! avl_insert_after(last, new); node->balance = 0; --- 375,379 ---- if (node->balance == -1) { ! avl_insert_after(tree, last, new); node->balance = 0; *************** *** 360,364 **** if (diff < 0) { ! avl_insert_before(node, new); node->balance = -1; --- 385,389 ---- if (diff < 0) { ! avl_insert_before(tree, node, new); node->balance = -1; *************** *** 369,373 **** } ! avl_insert_after(last, new); node->balance = 1; --- 394,398 ---- } ! avl_insert_after(tree, last, new); node->balance = 1; *************** *** 662,686 **** } ! avl_remove(node); } struct avl_node *avl_walk_first(struct avl_tree *tree) { ! struct avl_node *node = tree->root; ! ! if (node == NULL) ! return NULL; ! ! return avl_local_min(node); } struct avl_node *avl_walk_last(struct avl_tree *tree) { ! struct avl_node *node = tree->root; ! ! if (node == NULL) ! return NULL; ! ! return avl_local_max(node); } --- 687,701 ---- } ! avl_remove(tree, node); } struct avl_node *avl_walk_first(struct avl_tree *tree) { ! return tree->first; } struct avl_node *avl_walk_last(struct avl_tree *tree) { ! return tree->last; } Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** main.c 8 May 2007 23:10:37 -0000 1.96 --- main.c 5 Sep 2007 16:11:10 -0000 1.97 *************** *** 1,3 **** - /* * The olsr.org Optimized Link-State Routing daemon(olsrd) --- 1,2 ---- Index: olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** olsr.c 1 Aug 2007 16:22:57 -0000 1.56 --- olsr.c 5 Sep 2007 16:11:11 -0000 1.57 *************** *** 173,208 **** } ! if (olsr_cnf->lq_level < 2) ! { ! olsr_calculate_routing_table(); ! olsr_calculate_hna_routes(); ! } } ! else if (changes_topology) { /* calculate the routing table and HNA */ ! if (olsr_cnf->lq_level < 2) ! { ! olsr_calculate_routing_table(); ! olsr_calculate_hna_routes(); ! } } - else if (changes_hna) - { - /* update HNA routes */ - - if (olsr_cnf->lq_level < 2) - { - olsr_calculate_hna_routes(); - } - } - - if (olsr_cnf->lq_level >= 2) - { - olsr_calculate_lq_routing_table(); - } if (olsr_cnf->debug_level > 0) --- 173,188 ---- } ! olsr_calculate_routing_table(); ! olsr_calculate_hna_routes(); } ! else if (changes_topology || changes_hna) { /* calculate the routing table and HNA */ ! olsr_calculate_routing_table(); ! olsr_calculate_hna_routes(); } if (olsr_cnf->debug_level > 0) *************** *** 265,270 **** --- 245,252 ---- if (olsr_cnf->ipsize == 4) { avl_comp_default = NULL; + avl_comp_prefix_default = avl_comp_ipv4_prefix; } else { avl_comp_default = avl_comp_ipv6; + avl_comp_prefix_default = avl_comp_ipv6_prefix; } *************** *** 284,290 **** olsr_init_two_hop_table(); - /* Initialize old route table */ - olsr_init_old_table(); - /* Initialize topology */ olsr_init_tc(); --- 266,269 ---- Index: routing_table.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** routing_table.h 2 Aug 2007 21:54:54 -0000 1.18 --- routing_table.h 5 Sep 2007 16:11:11 -0000 1.19 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) + * RIB implementation (c) 2007, Hannes Gredler (hannes at gredler.at) * All rights reserved. * *************** *** 45,72 **** #include #include "hna_set.h" #define NETMASK_HOST 0xffffffff #define NETMASK_DEFAULT 0x0 ! struct rt_entry { ! union olsr_ip_addr rt_dst; ! union olsr_ip_addr rt_router; ! union hna_netmask rt_mask; ! olsr_u8_t rt_flags; ! olsr_u16_t rt_metric; ! float rt_etx; ! struct interface *rt_if; ! struct rt_entry *prev; ! struct rt_entry *next; }; ! struct destination_n { ! struct rt_entry *destination; ! struct destination_n *next; }; /** --- 46,123 ---- #include #include "hna_set.h" + #include "lq_avl.h" + #include "lq_list.h" #define NETMASK_HOST 0xffffffff #define NETMASK_DEFAULT 0x0 ! /* ! * the kernel FIB does not need to know the metric of a route. ! * this saves us from enqueuing/dequeueing hopcount only changes. ! */ ! #define RT_METRIC_DEFAULT 2 ! ! /* a composite metric is used for path selection */ ! struct rt_metric { ! float etx; ! olsr_u32_t hops; }; + /* a nexthop is a pointer to a gateway router plus an interface */ + struct rt_nexthop + { + union olsr_ip_addr gateway; /* gateway router */ + struct interface *iface; /* outgoing interface */ + }; ! /* ! * Every prefix in our RIB needs a route entry that contains ! * the nexthop of the best path as installed in the kernel FIB. ! * The route entry is the root of a rt_path tree of equal prefixes ! * originated by different routers. It also contains a shortcut ! * for accessing the best route among all contributing routes. ! */ ! struct rt_entry { ! struct olsr_ip_prefix rt_dst; ! struct avl_node rt_tree_node; ! struct rt_path *rt_best; /* shortcut to the best path */ ! struct rt_nexthop rt_nexthop; /* nexthop of FIB route */ ! struct avl_tree rt_path_tree; ! struct list_node rt_change_node; /* queue for kernel FIB add/chg/del */ ! }; ! ! /* ! * For every received route a rt_path is added to the RIB. ! * Depending on the results of the SPF calculation we perform a ! * best_path calculation and pick the one with the lowest etx/metric. ! */ ! struct rt_path ! { ! struct rt_entry *rtp_rt; /* backpointer to owning route head */ ! struct rt_nexthop rtp_nexthop; ! struct rt_metric rtp_metric; ! union olsr_ip_addr rtp_originator; /* originator of the route */ ! struct avl_node rtp_tree_node; ! olsr_u32_t rtp_version; }; + /* + * macro for traversing the entire routing table. + * it is recommended to use this because it hides all the internal + * datastructure from the callers. + * + * the loop prefetches the next node in order to not loose context if + * for example the caller wants to delete the current rt_entry. + */ + #define OLSR_FOR_ALL_RT_ENTRIES(rt) \ + { \ + struct avl_node *rt_tree_node, *next_rt_tree_node; \ + for (rt_tree_node = avl_walk_first(&routingtree); \ + rt_tree_node; rt_tree_node = next_rt_tree_node) { \ + next_rt_tree_node = avl_walk_next(rt_tree_node); \ + rt = rt_tree_node->data; + #define OLSR_FOR_ALL_RT_ENTRIES_END(rt) }} /** *************** *** 79,83 **** struct sockaddr rt_dst; struct sockaddr rt_gateway; ! olsr_u32_t rt_metric; } v4; --- 130,134 ---- struct sockaddr rt_dst; struct sockaddr rt_gateway; ! olsr_u32_t metric; } v4; *************** *** 91,121 **** ! extern struct rt_entry routingtable[HASHSIZE]; ! extern struct rt_entry hna_routes[HASHSIZE]; ! int olsr_init_routing_table(void); ! void ! olsr_calculate_routing_table(void); ! void ! olsr_calculate_hna_routes(void); ! void ! olsr_print_routing_table(struct rt_entry *); ! struct rt_entry * ! olsr_insert_routing_table(union olsr_ip_addr *, const union olsr_ip_addr *, struct interface *, int, float); ! struct rt_entry * ! olsr_lookup_routing_table(union olsr_ip_addr *); struct rt_entry * ! olsr_lookup_hna_routing_table(union olsr_ip_addr *dst); - void - olsr_free_routing_table(struct rt_entry *); #endif --- 142,183 ---- ! extern struct avl_tree routingtree; ! extern unsigned int routingtree_version; int olsr_init_routing_table(void); ! unsigned int olsr_bump_routingtree_version(void); ! int avl_comp_ipv4_prefix (void *, void *); ! int avl_comp_ipv6_prefix (void *, void *); ! void olsr_rt_best(struct rt_entry *); ! olsr_bool olsr_nh_change(struct rt_nexthop *, struct rt_nexthop *); ! olsr_bool olsr_cmp_rt(struct rt_entry *, struct rt_entry *); ! void olsr_calculate_hna_routes(void); ! int olsr_fill_routing_table_with_neighbors(void); ! char *olsr_rt_to_string(struct rt_entry *); ! char *olsr_rtp_to_string(struct rt_path *); ! void olsr_print_routing_table(struct avl_tree *); ! struct rt_nexthop * olsr_get_nh(struct rt_entry *); ! ! struct rt_path * ! olsr_insert_routing_table(union olsr_ip_addr *, int, ! union olsr_ip_addr *, ! union olsr_ip_addr *, ! struct interface *, int, float); struct rt_entry * ! olsr_lookup_routing_table(union olsr_ip_addr *); #endif + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ Index: hna_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** hna_set.h 29 May 2005 12:47:45 -0000 1.14 --- hna_set.h 5 Sep 2007 16:11:10 -0000 1.15 *************** *** 74,77 **** --- 74,80 ---- olsr_init_hna_set(void); + int + olsr_get_hna_prefix_len(struct hna_net *); + struct hna_net * olsr_lookup_hna_net(struct hna_net *, union olsr_ip_addr *, union hna_netmask *); From (spam-protected) Thu Sep 6 00:17:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 05 Sep 2007 22:17:28 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 kernel_routes.c,1.22,1.23 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv858/src/win32 Modified Files: kernel_routes.c Log Message: * fixed mistyped field name Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/kernel_routes.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** kernel_routes.c 5 Sep 2007 16:17:36 -0000 1.22 --- kernel_routes.c 5 Sep 2007 22:17:26 -0000 1.23 *************** *** 119,123 **** ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, ! if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_name)); } --- 119,123 ---- ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, ! if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index)); } From (spam-protected) Thu Sep 6 13:43:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 06 Sep 2007 11:43:44 +0000 Subject: [Olsr-cvs] olsrd-current/gui/win32/Main LQ-Default.olsr, 1.2, 1.3 RFC-Default.olsr, 1.2, 1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/gui/win32/Main In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24452/gui/win32/Main Modified Files: LQ-Default.olsr RFC-Default.olsr Log Message: * change the default window size to 12 Index: LQ-Default.olsr =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/win32/Main/LQ-Default.olsr,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LQ-Default.olsr 27 Mar 2007 03:01:06 -0000 1.2 --- LQ-Default.olsr 6 Sep 2007 11:43:42 -0000 1.3 *************** *** 34,38 **** # ! LinkQualityWinSize 10 # --- 34,38 ---- # ! LinkQualityWinSize 12 # Index: RFC-Default.olsr =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/win32/Main/RFC-Default.olsr,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RFC-Default.olsr 27 Mar 2007 03:01:07 -0000 1.2 --- RFC-Default.olsr 6 Sep 2007 11:43:42 -0000 1.3 *************** *** 34,38 **** # ! LinkQualityWinSize 10 # --- 34,38 ---- # ! LinkQualityWinSize 12 # From (spam-protected) Thu Sep 6 13:43:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 06 Sep 2007 11:43:44 +0000 Subject: [Olsr-cvs] olsrd-current/files olsrd.conf.win32.lq, 1.2, 1.3 olsrd.conf.default.rfc, 1.4, 1.5 olsrd.conf.win32.rfc, 1.2, 1.3 olsrd.conf.default.lq, 1.3, 1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/files In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24452/files Modified Files: olsrd.conf.win32.lq olsrd.conf.default.rfc olsrd.conf.win32.rfc olsrd.conf.default.lq Log Message: * change the default window size to 12 Index: olsrd.conf.win32.rfc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/files/olsrd.conf.win32.rfc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** olsrd.conf.win32.rfc 17 Apr 2006 18:31:08 -0000 1.2 --- olsrd.conf.win32.rfc 6 Sep 2007 11:43:42 -0000 1.3 *************** *** 37,41 **** # ! LinkQualityWinSize 10 # --- 37,41 ---- # ! LinkQualityWinSize 12 # Index: olsrd.conf.default.rfc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/files/olsrd.conf.default.rfc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** olsrd.conf.default.rfc 10 Feb 2007 19:27:32 -0000 1.4 --- olsrd.conf.default.rfc 6 Sep 2007 11:43:42 -0000 1.5 *************** *** 122,126 **** # Defaults to 10 ! #LinkQualityWinSize 10 # Polling rate in seconds(float). --- 122,126 ---- # Defaults to 10 ! #LinkQualityWinSize 12 # Polling rate in seconds(float). Index: olsrd.conf.default.lq =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/files/olsrd.conf.default.lq,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** olsrd.conf.default.lq 10 Feb 2007 19:27:32 -0000 1.3 --- olsrd.conf.default.lq 6 Sep 2007 11:43:42 -0000 1.4 *************** *** 127,131 **** # Defaults to 10 ! LinkQualityWinSize 10 # Polling rate in seconds(float). --- 127,131 ---- # Defaults to 10 ! LinkQualityWinSize 12 # Polling rate in seconds(float). Index: olsrd.conf.win32.lq =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/files/olsrd.conf.win32.lq,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** olsrd.conf.win32.lq 17 Apr 2006 18:31:08 -0000 1.2 --- olsrd.conf.win32.lq 6 Sep 2007 11:43:42 -0000 1.3 *************** *** 37,41 **** # ! LinkQualityWinSize 10 # --- 37,41 ---- # ! LinkQualityWinSize 12 # From (spam-protected) Thu Sep 6 13:45:11 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 06 Sep 2007 11:45:11 +0000 Subject: [Olsr-cvs] olsrd-current README-Link-Quality.html,1.4,1.5 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25226 Modified Files: README-Link-Quality.html Log Message: * change the default window size to 12 Index: README-Link-Quality.html =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/README-Link-Quality.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README-Link-Quality.html 30 Mar 2006 00:22:02 -0000 1.4 --- README-Link-Quality.html 6 Sep 2007 11:45:09 -0000 1.5 *************** *** 415,419 **** ClearScreen yes LinkQualityLevel 2 ! LinkQualityWinSize 10 UseHysteresis no --- 415,419 ---- ClearScreen yes LinkQualityLevel 2 ! LinkQualityWinSize 12 UseHysteresis no From (spam-protected) Thu Sep 6 14:08:31 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 06 Sep 2007 12:08:31 +0000 Subject: [Olsr-cvs] olsrd-current/src olsr_cfg.h,1.31,1.32 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1763/src Modified Files: olsr_cfg.h Log Message: * also change the default in the code Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** olsr_cfg.h 13 May 2007 22:23:55 -0000 1.31 --- olsr_cfg.h 6 Sep 2007 12:08:28 -0000 1.32 *************** *** 46,50 **** #include "olsr_types.h" ! /* Default valuse not declared in olsr_protocol.h */ #define DEF_POLLRATE 0.05 #define DEF_NICCHGPOLLRT 2.5 --- 46,50 ---- #include "olsr_types.h" ! /* Default values not declared in olsr_protocol.h */ #define DEF_POLLRATE 0.05 #define DEF_NICCHGPOLLRT 2.5 *************** *** 59,63 **** #define DEF_LQ_DIJK_LIMIT 255 #define DEF_LQ_DIJK_INTER 0.0 ! #define DEF_LQ_WSIZE 10 #define DEF_CLEAR_SCREEN OLSR_FALSE --- 59,63 ---- #define DEF_LQ_DIJK_LIMIT 255 #define DEF_LQ_DIJK_INTER 0.0 ! #define DEF_LQ_WSIZE 12 #define DEF_CLEAR_SCREEN OLSR_FALSE From (spam-protected) Fri Sep 7 10:53:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 07 Sep 2007 08:53:38 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd net.c,1.36,1.37 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6043/src/bsd Modified Files: net.c Log Message: * update for FreeBSD neew WLAN API - patch by John Hay Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/net.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** net.c 2 May 2007 07:41:20 -0000 1.36 --- net.c 7 Sep 2007 08:53:36 -0000 1.37 *************** *** 72,77 **** #include #include - #include - #include #endif #endif --- 72,75 ---- *************** *** 558,562 **** if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) continue; ! strncpy(ifr6.ifr_name, ifname, sizeof(ifname)); if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { --- 556,560 ---- if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) continue; ! strncpy(ifr6.ifr_name, ifname, sizeof(ifr6.ifr_name)); if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { *************** *** 827,843 **** { #if defined __FreeBSD__ && !defined FBSD_NO_80211 ! struct wi_req wreq; ! struct ifreq ifr; ! ! memset((char *)&wreq, 0, sizeof(wreq)); ! memset((char *)&ifr, 0, sizeof(ifr)); ! ! wreq.wi_len = WI_MAX_DATALEN; ! wreq.wi_type = WI_RID_IFACE_STATS; ! ! strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); ! ifr.ifr_data = (caddr_t)&wreq; ! return (ioctl(olsr_cnf->ioctl_s, SIOCGWAVELAN, &ifr) >= 0) ? 1 : 0; #else return 0; --- 825,838 ---- { #if defined __FreeBSD__ && !defined FBSD_NO_80211 ! /* From FreeBSD ifconfig/ifieee80211.c ieee80211_status() */ ! struct ieee80211req ireq; ! u_int8_t data[32]; ! memset(&ireq, 0, sizeof(ireq)); ! strlcpy(ireq.i_name, ifname, sizeof(ireq.i_name)); ! ireq.i_data = &data; ! ireq.i_type = IEEE80211_IOC_SSID; ! ireq.i_val = -1; ! return (ioctl(olsr_cnf->ioctl_s, SIOCG80211, &ireq) >= 0) ? 1 : 0; #else return 0; From (spam-protected) Fri Sep 7 10:53:50 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 07 Sep 2007 08:53:50 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.80,1.81 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6059 Modified Files: CHANGELOG Log Message: * update for FreeBSD neew WLAN API - patch by John Hay Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** CHANGELOG 5 Sep 2007 16:32:46 -0000 1.80 --- CHANGELOG 7 Sep 2007 08:53:48 -0000 1.81 *************** *** 126,129 **** --- 126,132 ---- data. + PATCH by John Hay + - update to new FreeBSD WLAN API + - paving the way to activate -Wshadow, much more to do - const-ify parameters here and there From (spam-protected) Fri Sep 7 11:07:27 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 07 Sep 2007 09:07:27 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG, 1.81, 1.82 Makefile.inc, 1.28, 1.29 gcc-warnings, 1.2, 1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11624 Modified Files: CHANGELOG Makefile.inc gcc-warnings Log Message: * use /bin/sh instead of /bin/bash - patch by John Hay, slightly modified by me Index: gcc-warnings =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gcc-warnings,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gcc-warnings 27 Jun 2007 20:20:57 -0000 1.2 --- gcc-warnings 7 Sep 2007 09:07:25 -0000 1.3 *************** *** 1,3 **** ! #!/bin/bash --norc # # We expect warning options for gcc as argumenst and return the ones which are accepted --- 1,3 ---- ! #!/bin/sh # # We expect warning options for gcc as argumenst and return the ones which are accepted *************** *** 17,32 **** done ! while read error; do ! case "$error" in ! *error:\ unrecognized\ option*) opt="${error#*\`}" ! opt="${opt%\'*}" ! OPTS="${OPTS//$opt/}" ! ;; ! esac ! done < <($CC $OPTS -E - 2>&1 >/dev/null <&1 <<- EOF ! int main(void) { ! return 0; ! } ! EOF ! } ! ! parsetest() { ! while read error; do ! case "$error" in ! *error:\ unrecognized\ *option*) ! opt="${error#*\`}" ! opt="${opt%\'*}" ! opt="${error#*\"}" ! opt="${opt%\"*}" ! OPTS=`echo $OPTS | sed -e s/$opt//g` ! ;; ! esac ! done ! echo $OPTS ! } ! ! testcompile | parsetest ! exit 0 Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Makefile.inc 29 Aug 2007 21:46:25 -0000 1.28 --- Makefile.inc 7 Sep 2007 09:07:25 -0000 1.29 *************** *** 1,4 **** # programs ! CCACHE ?= $(shell bash -c "type -path ccache") ifeq ($(origin CC),default) CC = $(CCACHE) gcc --- 1,4 ---- # programs ! CCACHE ?= $(shell which ccache 2> /dev/null) ifeq ($(origin CC),default) CC = $(CCACHE) gcc Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** CHANGELOG 7 Sep 2007 08:53:48 -0000 1.81 --- CHANGELOG 7 Sep 2007 09:07:25 -0000 1.82 *************** *** 126,131 **** data. ! PATCH by John Hay - update to new FreeBSD WLAN API - paving the way to activate -Wshadow, much more to do --- 126,132 ---- data. ! PATCHES by John Hay - update to new FreeBSD WLAN API + - do not require /bin/bash, use /bin/sh - paving the way to activate -Wshadow, much more to do From (spam-protected) Wed Sep 12 01:08:21 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 11 Sep 2007 23:08:21 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.82,1.83 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5369 Modified Files: CHANGELOG Log Message: * updated bmf plugin to 1.5.1 Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** CHANGELOG 7 Sep 2007 09:07:25 -0000 1.82 --- CHANGELOG 11 Sep 2007 23:08:19 -0000 1.83 *************** *** 4,9 **** 0.5.4 --------------------------------------------------------------------- ! QUAGGA ! updated to svn version 33 PATCH by Hannes Gredler which rewrites the route handling. --- 4,12 ---- 0.5.4 --------------------------------------------------------------------- ! QUAGGA by Immo 'FaUl' Wehrenberg ! - updated to svn version 33 ! ! BMF PLUGIN by Erik Tromp ! - updated to 1.5.1 PATCH by Hannes Gredler which rewrites the route handling. From (spam-protected) Wed Sep 12 01:08:22 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 11 Sep 2007 23:08:22 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf README_BMF.txt, 1.4, 1.5 version-script.txt, 1.1, 1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5369/lib/bmf Modified Files: README_BMF.txt version-script.txt Log Message: * updated bmf plugin to 1.5.1 Index: README_BMF.txt =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/README_BMF.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README_BMF.txt 30 Jun 2007 20:07:47 -0000 1.4 --- README_BMF.txt 11 Sep 2007 23:08:19 -0000 1.5 *************** *** 1,5 **** BASIC MULTICAST FORWARDING PLUGIN FOR OLSRD by Erik Tromp (erik.tromp at nl.thalesgroup.com, erik_tromp at hotmail.com) ! Version 1.5 1. Introduction --- 1,5 ---- BASIC MULTICAST FORWARDING PLUGIN FOR OLSRD by Erik Tromp (erik.tromp at nl.thalesgroup.com, erik_tromp at hotmail.com) ! Version 1.5.1 1. Introduction *************** *** 18,22 **** --------------------------- ! Download the olsr-bmf-v1.5.tar.gz file and save it into your OLSRD base install directory. --- 18,22 ---- --------------------------- ! Download the olsr-bmf-v1.5.1.tar.gz file and save it into your OLSRD base install directory. *************** *** 25,29 **** At the command prompt, type: ! tar -zxvf ./olsr-bmf-v1.5.tar.gz then type: --- 25,29 ---- At the command prompt, type: ! tar -zxvf ./olsr-bmf-v1.5.1.tar.gz then type: *************** *** 48,52 **** to load the BMF plugin. For example, add the following lines: ! LoadPlugin "olsrd_bmf.so.1.5" { # No PlParam entries required for basic operation --- 48,52 ---- to load the BMF plugin. For example, add the following lines: ! LoadPlugin "olsrd_bmf.so.1.5.1" { # No PlParam entries required for basic operation *************** *** 65,70 **** ---------- Plugin loader ---------- ! Library: olsrd_bmf.so.1.5 ! OLSRD Basic Multicast Forwarding plugin 1.5 (May 16 2007 14:30:57) (C) Thales Communications Huizen, Netherlands Erik Tromp (erik.tromp at nl.thalesgroup.com) --- 65,70 ---- ---------- Plugin loader ---------- ! Library: olsrd_bmf.so.1.5.1 ! OLSRD Basic Multicast Forwarding plugin 1.5.1 (Sep 4 2007 11:13:43) (C) Thales Communications Huizen, Netherlands Erik Tromp (erik.tromp at nl.thalesgroup.com) *************** *** 191,195 **** configured: ! LoadPlugin "olsrd_bmf.so.1.5" { # Specify the name of the BMF network interface. --- 191,195 ---- configured: ! LoadPlugin "olsrd_bmf.so.1.5.1" { # Specify the name of the BMF network interface. *************** *** 332,336 **** of /etc/olsrd.conf. For example: ! LoadPlugin "olsrd_bmf.so.1.5" { # Non-OLSR interfaces to participate in the multicast flooding --- 332,336 ---- of /etc/olsrd.conf. For example: ! LoadPlugin "olsrd_bmf.so.1.5.1" { # Non-OLSR interfaces to participate in the multicast flooding *************** *** 390,394 **** For example: ! LoadPlugin "olsrd_bmf.so.1.5" { PlParam "BmfInterfaceIp" "10.10.10.4/24" --- 390,394 ---- For example: ! LoadPlugin "olsrd_bmf.so.1.5.1" { PlParam "BmfInterfaceIp" "10.10.10.4/24" *************** *** 526,529 **** --- 526,538 ---- ------------------- + 3 September 2007: Version 1.5.1 + + * Fixed a bug that would cause BMF to crash (and OLSR with it) if a link + was timing out --> thanks to Frank Renwick + * Fixed bug in the checking of the packet length --> thanks to Frank Renwick + * Fixed a bug in shutdown, which cause a crash if the BMF thread was not + yet running --> thanks to Bernd Petrovitsch + * Updated to OLSR plugin interface version 5. + 16 May 2007: Version 1.5 Index: version-script.txt =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/version-script.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** version-script.txt 3 May 2006 08:59:04 -0000 1.1 --- version-script.txt 11 Sep 2007 23:08:20 -0000 1.2 *************** *** 3,8 **** global: olsrd_plugin_interface_version; - olsrd_plugin_register_param; olsrd_plugin_init; local: --- 3,8 ---- global: olsrd_plugin_interface_version; olsrd_plugin_init; + olsrd_get_plugin_parameters; local: From (spam-protected) Wed Sep 12 01:08:22 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 11 Sep 2007 23:08:22 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Address.c, 1.5, 1.6 Address.h, 1.4, 1.5 Bmf.c, 1.7, 1.8 Bmf.h, 1.4, 1.5 NetworkInterfaces.c, 1.6, 1.7 NetworkInterfaces.h, 1.4, 1.5 Packet.h, 1.4, 1.5 olsrd_plugin.c, 1.6, 1.7 DropList.c, 1.3, NONE DropList.h, 1.3, NONE Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5369/lib/bmf/src Modified Files: Address.c Address.h Bmf.c Bmf.h NetworkInterfaces.c NetworkInterfaces.h Packet.h olsrd_plugin.c Removed Files: DropList.c DropList.h Log Message: * updated bmf plugin to 1.5.1 Index: Packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Packet.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Packet.h 30 Jun 2007 20:07:47 -0000 1.4 --- Packet.h 11 Sep 2007 23:08:20 -0000 1.5 *************** *** 45,58 **** #include /* u_int8_t, u_int16_t */ - /* Offsets and sizes into IP-ethernet packets */ - #define IPV4_ADDR_SIZE 4 - #define ETH_TYPE_OFFSET (2*IFHWADDRLEN) - #define ETH_TYPE_LEN 2 - #define IP_HDR_OFFSET (ETH_TYPE_OFFSET + ETH_TYPE_LEN) - #define IPV4_OFFSET_SRCIP 12 - #define IPV4_OFFSET_DSTIP (IPV4_OFFSET_SRCIP + IPV4_ADDR_SIZE) - - #define IPV4_TYPE 0x0800 - /* BMF-encapsulated packets are Ethernet-IP-UDP packets, which start * with a 8-bytes BMF header (struct TEncapHeader), followed by the --- 45,48 ---- *************** *** 68,72 **** } __attribute__((__packed__)); ! #define ENCAP_HDR_LEN ((int)sizeof(struct TEncapHeader)) #define BMF_ENCAP_TYPE 1 #define BMF_ENCAP_LEN 6 --- 58,62 ---- } __attribute__((__packed__)); ! #define ENCAP_HDR_LEN ((int)sizeof(struct TEncapHeader)) #define BMF_ENCAP_TYPE 1 #define BMF_ENCAP_LEN 6 Index: Address.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Address.h 30 Jun 2007 20:07:47 -0000 1.4 --- Address.h 11 Sep 2007 23:08:20 -0000 1.5 *************** *** 48,52 **** extern int EnableLocalBroadcast; ! int DoLocalBroadcast(const char* enable); int IsMulticast(union olsr_ip_addr* ipAddress); int IsOlsrOrBmfPacket(unsigned char* ipPacket); --- 48,52 ---- extern int EnableLocalBroadcast; ! int DoLocalBroadcast(const char* enable, void* data); int IsMulticast(union olsr_ip_addr* ipAddress); int IsOlsrOrBmfPacket(unsigned char* ipPacket); --- DropList.h DELETED --- Index: Bmf.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Bmf.h 30 Jun 2007 20:07:47 -0000 1.4 --- Bmf.h 11 Sep 2007 23:08:20 -0000 1.5 *************** *** 44,51 **** #define PLUGIN_NAME "OLSRD Basic Multicast Forwarding (BMF) plugin" #define PLUGIN_NAME_SHORT "OLSRD BMF" ! #define PLUGIN_VERSION "1.5 (" __DATE__ " " __TIME__ ")" #define PLUGIN_COPYRIGHT " (C) Thales Communications Huizen, Netherlands" #define PLUGIN_AUTHOR " Erik Tromp (eriktromp at users.sourceforge.net)" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION "\n" PLUGIN_COPYRIGHT "\n" PLUGIN_AUTHOR /* UDP-Port on which multicast packets are encapsulated */ --- 44,52 ---- #define PLUGIN_NAME "OLSRD Basic Multicast Forwarding (BMF) plugin" #define PLUGIN_NAME_SHORT "OLSRD BMF" ! #define PLUGIN_VERSION "1.5.1 (" __DATE__ " " __TIME__ ")" #define PLUGIN_COPYRIGHT " (C) Thales Communications Huizen, Netherlands" #define PLUGIN_AUTHOR " Erik Tromp (eriktromp at users.sourceforge.net)" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION "\n" PLUGIN_COPYRIGHT "\n" PLUGIN_AUTHOR + #define PLUGIN_INTERFACE_VERSION 5 /* UDP-Port on which multicast packets are encapsulated */ Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/olsrd_plugin.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** olsrd_plugin.c 15 Jul 2007 17:41:33 -0000 1.6 --- olsrd_plugin.c 11 Sep 2007 23:08:20 -0000 1.7 *************** *** 50,55 **** #include "Bmf.h" /* InitBmf(), CloseBmf(), RegisterBmfParameter() */ #include "PacketHistory.h" /* InitPacketHistory() */ ! ! #define PLUGIN_INTERFACE_VERSION 4 static void __attribute__ ((constructor)) my_init(void); --- 50,55 ---- #include "Bmf.h" /* InitBmf(), CloseBmf(), RegisterBmfParameter() */ #include "PacketHistory.h" /* InitPacketHistory() */ ! #include "NetworkInterfaces.h" /* AddNonOlsrBmfIf(), SetBmfInterfaceIp(), ... */ ! #include "Address.h" /* DoLocalBroadcast() */ static void __attribute__ ((constructor)) my_init(void); *************** *** 117,137 **** } /* ------------------------------------------------------------------------- ! * Function : olsrd_plugin_register_param ! * Description: Register parameters from config file ! * Input : key - the parameter name ! * value - the parameter value ! * Output : none ! * Return : fatal error (<0), minor error (0) or success (>0) ! * Data Used : none ! * Notes : Called by main OLSR (init_olsr_plugin) for all plugin parameters * ------------------------------------------------------------------------- */ ! int olsrd_plugin_register_param(char* key, char* value) { ! assert(key != NULL && value != NULL); ! ! return RegisterBmfParameter(key, value); } ! /* ------------------------------------------------------------------------- * Function : my_init --- 117,145 ---- } + static const struct olsrd_plugin_parameters plugin_parameters[] = { + { .name = "NonOlsrIf", .set_plugin_parameter = &AddNonOlsrBmfIf, .data = NULL }, + { .name = "DoLocalBroadcast", .set_plugin_parameter = &DoLocalBroadcast, .data = NULL }, + { .name = "BmfInterface", .set_plugin_parameter = &SetBmfInterfaceName, .data = NULL }, + { .name = "BmfInterfaceIp", .set_plugin_parameter = &SetBmfInterfaceIp, .data = NULL }, + { .name = "CapturePacketsOnOlsrInterfaces", .set_plugin_parameter = &SetCapturePacketsOnOlsrInterfaces, .data = NULL }, + { .name = "BmfMechanism", .set_plugin_parameter = &SetBmfMechanism, .data = NULL }, + }; + /* ------------------------------------------------------------------------- ! * Function : olsrd_get_plugin_parameters ! * Description: Return the parameter table and its size ! * Input : none ! * Output : params - the parameter table ! * size - its size in no. of entries ! * Return : none ! * Data Used : plugin_parameters ! * Notes : Called by main OLSR (init_olsr_plugin) for all plugins * ------------------------------------------------------------------------- */ ! void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size) { ! *params = plugin_parameters; ! *size = sizeof(plugin_parameters)/sizeof(*plugin_parameters); } ! /* ------------------------------------------------------------------------- * Function : my_init --- DropList.c DELETED --- Index: Address.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Address.c 30 Jun 2007 20:07:47 -0000 1.5 --- Address.c 11 Sep 2007 23:08:20 -0000 1.6 *************** *** 63,85 **** * flooding of local broadcast packets * Input : enable - either "yes" or "no" * Output : none ! * Return : fail (0) or success (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int DoLocalBroadcast(const char* enable) { if (strcmp(enable, "yes") == 0) { EnableLocalBroadcast = 1; ! return 1; } else if (strcmp(enable, "no") == 0) { EnableLocalBroadcast = 0; ! return 1; } /* Value not recognized */ ! return 0; } --- 63,86 ---- * flooding of local broadcast packets * Input : enable - either "yes" or "no" + * data - not used * Output : none ! * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int DoLocalBroadcast(const char* enable, void* data) { if (strcmp(enable, "yes") == 0) { EnableLocalBroadcast = 1; ! return 0; } else if (strcmp(enable, "no") == 0) { EnableLocalBroadcast = 0; ! return 0; } /* Value not recognized */ ! return 1; } Index: NetworkInterfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NetworkInterfaces.h 30 Jun 2007 20:07:47 -0000 1.4 --- NetworkInterfaces.h 11 Sep 2007 23:08:20 -0000 1.5 *************** *** 121,128 **** extern enum TBmfMechanism BmfMechanism; ! int SetBmfInterfaceName(const char* ifname); ! int SetBmfInterfaceIp(const char* ip); ! int SetCapturePacketsOnOlsrInterfaces(const char* enable); ! int SetBmfMechanism(const char* mechanism); int DeactivateSpoofFilter(void); void RestoreSpoofFilter(void); --- 121,128 ---- extern enum TBmfMechanism BmfMechanism; ! int SetBmfInterfaceName(const char* ifname, void* data); ! int SetBmfInterfaceIp(const char* ip, void* data); ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data); ! int SetBmfMechanism(const char* mechanism, void* data); int DeactivateSpoofFilter(void); void RestoreSpoofFilter(void); *************** *** 133,137 **** }; ! struct TBestNeighbors GetBestTwoNeighbors( struct TBmfInterface* intf, union olsr_ip_addr* source, --- 133,138 ---- }; ! void GetBestTwoNeighbors( ! struct TBestNeighbors* result, struct TBmfInterface* intf, union olsr_ip_addr* source, *************** *** 143,147 **** void AddInterface(struct interface* newIntf); void CloseBmfNetworkInterfaces(void); ! int AddNonOlsrBmfIf(const char* ifName); int IsNonOlsrBmfIf(const char* ifName); void CheckAndUpdateLocalBroadcast(unsigned char* ipPacket, union olsr_ip_addr* broadAddr); --- 144,148 ---- void AddInterface(struct interface* newIntf); void CloseBmfNetworkInterfaces(void); ! int AddNonOlsrBmfIf(const char* ifName, void* data); int IsNonOlsrBmfIf(const char* ifName); void CheckAndUpdateLocalBroadcast(unsigned char* ipPacket, union olsr_ip_addr* broadAddr); Index: Bmf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Bmf.c 31 Jul 2007 12:02:18 -0000 1.7 --- Bmf.c 11 Sep 2007 23:08:20 -0000 1.8 *************** *** 64,71 **** #include "link_set.h" /* get_best_link_to_neighbor() */ ! /* Plugin includes */ #include "NetworkInterfaces.h" /* TBmfInterface, CreateBmfNetworkInterfaces(), CloseBmfNetworkInterfaces() */ #include "Address.h" /* IsMulticast() */ ! #include "Packet.h" /* ETH_TYPE_OFFSET, IFHWADDRLEN etc. */ #include "PacketHistory.h" /* InitPacketHistory() */ --- 64,71 ---- #include "link_set.h" /* get_best_link_to_neighbor() */ ! /* BMF includes */ #include "NetworkInterfaces.h" /* TBmfInterface, CreateBmfNetworkInterfaces(), CloseBmfNetworkInterfaces() */ #include "Address.h" /* IsMulticast() */ ! #include "Packet.h" /* ENCAP_HDR_LEN, BMF_ENCAP_TYPE, BMF_ENCAP_LEN etc. */ #include "PacketHistory.h" /* InitPacketHistory() */ *************** *** 159,163 **** /* Retrieve at most two best neigbors to forward the packet to */ ! bestNeighborLinks = GetBestTwoNeighbors(intf, NULL, NULL, NULL, &nPossibleNeighbors); if (nPossibleNeighbors <= 0) --- 159,163 ---- /* Retrieve at most two best neigbors to forward the packet to */ ! GetBestTwoNeighbors(&bestNeighborLinks, intf, NULL, NULL, NULL, &nPossibleNeighbors); if (nPossibleNeighbors <= 0) *************** *** 760,770 **** /* Retrieve at most two best neigbors to forward the packet to */ ! bestNeighborLinks = ! GetBestTwoNeighbors( ! walker, ! &mcSrc, ! forwardedBy, ! forwardedTo, ! &nPossibleNeighbors); if (nPossibleNeighbors <= 0) --- 760,770 ---- /* Retrieve at most two best neigbors to forward the packet to */ ! GetBestTwoNeighbors( ! &bestNeighborLinks, ! walker, ! &mcSrc, ! forwardedBy, ! forwardedTo, ! &nPossibleNeighbors); if (nPossibleNeighbors <= 0) *************** *** 1153,1157 **** * - the UDP header of the encapsulation IP packet * - the encapsulation header - * - the Ethernet header in the encapsulated Ethernet packet * - a minimum IP header inside the encapsulated packet * Note: on a VLAN interface, the value returned by 'recvfrom' may (but need --- 1153,1156 ---- *************** *** 1162,1166 **** sizeof(struct udphdr) + ENCAP_HDR_LEN + - IP_HDR_OFFSET + sizeof(struct ip); if (nBytes < minimumLength) --- 1161,1164 ---- *************** *** 1197,1200 **** --- 1195,1199 ---- socklen_t fromLen = sizeof(from); int nBytes; + int minimumLength; union olsr_ip_addr forwardedBy; *************** *** 1222,1228 **** * encapsulation packet, at least: * - the encapsulation header - * - the Ethernet header in the encapsulated Ethernet packet * - a minimum IP header inside the encapsulated packet */ ! if (nBytes < ENCAP_HDR_LEN + IP_HDR_OFFSET + (int)sizeof(struct ip)) { olsr_printf( --- 1221,1229 ---- * encapsulation packet, at least: * - the encapsulation header * - a minimum IP header inside the encapsulated packet */ ! minimumLength = ! ENCAP_HDR_LEN + ! sizeof(struct ip); ! if (nBytes < minimumLength) { olsr_printf( *************** *** 1474,1515 **** } /* CloseBmf */ - /* ------------------------------------------------------------------------- - * Function : RegisterBmfParameter - * Description: Register a configuration parameter with the BMF process - * Input : key - the parameter name, e.g. "DropMac" or "NonOlsrIf" - * value - the parameter value - * Output : none - * Return : fatal error (<0), minor error (0) or success (>0) - * Data Used : none - * ------------------------------------------------------------------------- */ - int RegisterBmfParameter(char* key, char* value) - { - if (strcmp(key, "NonOlsrIf") == 0) - { - return AddNonOlsrBmfIf(value); - } - else if (strcmp(key, "DoLocalBroadcast") == 0) - { - return DoLocalBroadcast(value); - } - else if (strcmp(key, "BmfInterface") == 0) - { - return SetBmfInterfaceName(value); - } - else if (strcmp(key, "BmfInterfaceIp") == 0) - { - return SetBmfInterfaceIp(value); - } - else if (strcmp(key, "CapturePacketsOnOlsrInterfaces") == 0) - { - return SetCapturePacketsOnOlsrInterfaces(value); - } - else if (strcmp(key, "BmfMechanism") == 0) - { - return SetBmfMechanism(value); - } - - /* Key not recognized */ - return 0; - } /* RegisterBmfParameter */ - --- 1475,1476 ---- Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NetworkInterfaces.c 30 Jun 2007 20:07:47 -0000 1.6 --- NetworkInterfaces.c 11 Sep 2007 23:08:20 -0000 1.7 *************** *** 122,134 **** * EtherTunTap interface * Input : ifname - network interface name (e.g. "mybmf0") * Output : none ! * Return : fail (0) or success (1) * Data Used : EtherTunTapIfName * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceName(const char* ifname) { strncpy(EtherTunTapIfName, ifname, IFNAMSIZ - 1); EtherTunTapIfName[IFNAMSIZ - 1] = '\0'; /* Ensures null termination */ ! return 1; } /* SetBmfInterfaceName */ --- 122,135 ---- * EtherTunTap interface * Input : ifname - network interface name (e.g. "mybmf0") + * data - not used * Output : none ! * Return : success (0) or fail (1) * Data Used : EtherTunTapIfName * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceName(const char* ifname, void* data) { strncpy(EtherTunTapIfName, ifname, IFNAMSIZ - 1); EtherTunTapIfName[IFNAMSIZ - 1] = '\0'; /* Ensures null termination */ ! return 0; } /* SetBmfInterfaceName */ *************** *** 138,147 **** * ("10.255.255.253/30") of the EtherTunTap interface * Input : ip - IP address string, followed by '/' and prefix length * Output : none ! * Return : fail (0) or success (1) * Data Used : EtherTunTapIp, EtherTunTapIpMask, EtherTunTapIpBroadcast, * TunTapIpOverruled * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceIp(const char* ip) { #define IPV4_MAX_ADDRLEN 16 --- 139,149 ---- * ("10.255.255.253/30") of the EtherTunTap interface * Input : ip - IP address string, followed by '/' and prefix length + * data - not used * Output : none ! * Return : success (0) or fail (1) * Data Used : EtherTunTapIp, EtherTunTapIpMask, EtherTunTapIpBroadcast, * TunTapIpOverruled * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceIp(const char* ip, void* data) { #define IPV4_MAX_ADDRLEN 16 *************** *** 163,167 **** { /* No prefix length specified, or IP address too long */ ! return 0; } --- 165,169 ---- { /* No prefix length specified, or IP address too long */ ! return 1; } *************** *** 171,175 **** { /* Invalid address passed */ ! return 0; } --- 173,177 ---- { /* Invalid address passed */ ! return 1; } *************** *** 180,185 **** if (prefixLen <= 0 || prefixLen > IPV4_MAX_PREFIXLEN) { ! return 0; ! } /* Compose IP subnet mask in host byte order */ --- 182,187 ---- if (prefixLen <= 0 || prefixLen > IPV4_MAX_PREFIXLEN) { ! return 1; ! } /* Compose IP subnet mask in host byte order */ *************** *** 199,203 **** TunTapIpOverruled = 1; ! return 1; } /* SetBmfInterfaceIp */ --- 201,205 ---- TunTapIpOverruled = 1; ! return 0; } /* SetBmfInterfaceIp */ *************** *** 207,229 **** * capturing of packets on OLSR-enabled interfaces. * Input : enable - either "yes" or "no" * Output : none ! * Return : fail (0) or success (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int SetCapturePacketsOnOlsrInterfaces(const char* enable) { if (strcmp(enable, "yes") == 0) { CapturePacketsOnOlsrInterfaces = 1; ! return 1; } else if (strcmp(enable, "no") == 0) { CapturePacketsOnOlsrInterfaces = 0; ! return 1; } /* Value not recognized */ ! return 0; } /* SetCapturePacketsOnOlsrInterfaces */ --- 209,232 ---- * capturing of packets on OLSR-enabled interfaces. * Input : enable - either "yes" or "no" + * data - not used * Output : none ! * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data) { if (strcmp(enable, "yes") == 0) { CapturePacketsOnOlsrInterfaces = 1; ! return 0; } else if (strcmp(enable, "no") == 0) { CapturePacketsOnOlsrInterfaces = 0; ! return 0; } /* Value not recognized */ ! return 1; } /* SetCapturePacketsOnOlsrInterfaces */ *************** *** 233,255 **** * BM_UNICAST_PROMISCUOUS. * Input : mechanism - either "Broadcast" or "UnicastPromiscuous" * Output : none ! * Return : fail (0) or success (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int SetBmfMechanism(const char* mechanism) { if (strcmp(mechanism, "Broadcast") == 0) { BmfMechanism = BM_BROADCAST; ! return 1; } else if (strcmp(mechanism, "UnicastPromiscuous") == 0) { BmfMechanism = BM_UNICAST_PROMISCUOUS; ! return 1; } /* Value not recognized */ ! return 0; } /* SetBmfMechanism */ --- 236,259 ---- * BM_UNICAST_PROMISCUOUS. * Input : mechanism - either "Broadcast" or "UnicastPromiscuous" + * data - not used * Output : none ! * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int SetBmfMechanism(const char* mechanism, void* data) { if (strcmp(mechanism, "Broadcast") == 0) { BmfMechanism = BM_BROADCAST; ! return 0; } else if (strcmp(mechanism, "UnicastPromiscuous") == 0) { BmfMechanism = BM_UNICAST_PROMISCUOUS; ! return 0; } /* Value not recognized */ ! return 1; } /* SetBmfMechanism */ *************** *** 403,413 **** * forwardedTo - the IP address of the node to which the BMF packet * was directed ! * Output : nPossibleNeighbors - number of found possible neighbors ! * Return : The list of the two best neighbors. If only one best neighbor is ! * found, the second list entry is NULL. If no neigbors are found, ! * the first and second list entries are both NULL. * Data Used : none * ------------------------------------------------------------------------- */ ! struct TBestNeighbors GetBestTwoNeighbors( struct TBmfInterface* intf, union olsr_ip_addr* source, --- 407,418 ---- * forwardedTo - the IP address of the node to which the BMF packet * was directed ! * Output : result - the list of the two best neighbors. If only one best ! * neighbor is found, the second list entry is NULL. If no neigbors ! * are found, the first and second list entries are both NULL. ! * nPossibleNeighbors - number of found possible neighbors * Data Used : none * ------------------------------------------------------------------------- */ ! void GetBestTwoNeighbors( ! struct TBestNeighbors* result, struct TBmfInterface* intf, union olsr_ip_addr* source, *************** *** 416,422 **** int* nPossibleNeighbors) { ! struct TBestNeighbors result; ! result.links[0] = NULL; ! result.links[1] = NULL; /* handle the non-LQ case */ --- 421,426 ---- int* nPossibleNeighbors) { ! result->links[0] = NULL; ! result->links[1] = NULL; /* handle the non-LQ case */ *************** *** 490,500 **** /* In the non-LQ case, it is not possible to select neigbors * by quality or cost. So just remember the first two found links. */ ! if (result.links[0] == NULL) { ! result.links[0] = walker; } ! else if (result.links[1] == NULL) { ! result.links[1] = walker; } /* if */ } /* for */ --- 494,504 ---- /* In the non-LQ case, it is not possible to select neigbors * by quality or cost. So just remember the first two found links. */ ! if (result->links[0] == NULL) { ! result->links[0] = walker; } ! else if (result->links[1] == NULL) { ! result->links[1] = walker; } /* if */ } /* for */ *************** *** 507,513 **** struct link_entry* walker; ! float previousLinkCost = INFINITE_COST; ! float bestLinkCost = INFINITE_COST; ! float oneButBestLinkCost = INFINITE_COST; *nPossibleNeighbors = 0; --- 511,517 ---- struct link_entry* walker; ! float previousLinkCost = 2 * INFINITE_COST; ! float bestLinkCost = 2 * INFINITE_COST; ! float oneButBestLinkCost = 2 * INFINITE_COST; *nPossibleNeighbors = 0; *************** *** 583,586 **** --- 587,601 ---- /* Found a candidate neighbor to direct our packet to */ + if (walker->link_cost >= INFINITE_COST) + { + OLSR_PRINTF( + 9, + "%s: ----> Not forwarding to %s: link is timing out\n", + PLUGIN_NAME_SHORT, + olsr_ip_to_string(&walker->neighbor_iface_addr)); + + continue; /* for */ + } + /* Compare costs to check if the candidate neighbor is best reached via 'intf' */ OLSR_PRINTF( *************** *** 671,681 **** if (walker->link_cost < bestLinkCost) { ! result.links[1] = result.links[0]; ! result.links[0] = walker; bestLinkCost = walker->link_cost; } else if (walker->link_cost < oneButBestLinkCost) { ! result.links[1] = walker; oneButBestLinkCost = walker->link_cost; } /* if */ --- 686,696 ---- if (walker->link_cost < bestLinkCost) { ! result->links[1] = result->links[0]; ! result->links[0] = walker; bestLinkCost = walker->link_cost; } else if (walker->link_cost < oneButBestLinkCost) { ! result->links[1] = walker; oneButBestLinkCost = walker->link_cost; } /* if */ *************** *** 685,691 **** struct link_entry* walker; ! float previousLinkEtx = INFINITE_ETX; ! float bestEtx = INFINITE_ETX; ! float oneButBestEtx = INFINITE_ETX; *nPossibleNeighbors = 0; --- 700,706 ---- struct link_entry* walker; ! float previousLinkEtx = 2 * INFINITE_ETX; ! float bestEtx = 2 * INFINITE_ETX; ! float oneButBestEtx = 2 * INFINITE_ETX; *nPossibleNeighbors = 0; *************** *** 770,773 **** --- 785,799 ---- walker->neigh_link_quality); + if (currEtx >= INFINITE_ETX) + { + OLSR_PRINTF( + 9, + "%s: ----> Not forwarding to %s: link is timing out\n", + PLUGIN_NAME_SHORT, + olsr_ip_to_string(&walker->neighbor_iface_addr)); + + continue; /* for */ + } + /* Compare costs to check if the candidate neighbor is best reached via 'intf' */ OLSR_PRINTF( *************** *** 866,876 **** if (currEtx < bestEtx) { ! result.links[1] = result.links[0]; ! result.links[0] = walker; bestEtx = currEtx; } else if (currEtx < oneButBestEtx) { ! result.links[1] = walker; oneButBestEtx = currEtx; } /* if */ --- 892,902 ---- if (currEtx < bestEtx) { ! result->links[1] = result->links[0]; ! result->links[0] = walker; bestEtx = currEtx; } else if (currEtx < oneButBestEtx) { ! result->links[1] = walker; oneButBestEtx = currEtx; } /* if */ *************** *** 882,886 **** /* Display the result of the neighbor search */ ! if (result.links[0] == NULL) { OLSR_PRINTF( --- 908,912 ---- /* Display the result of the neighbor search */ ! if (result->links[0] == NULL) { OLSR_PRINTF( *************** *** 902,913 **** 9, "%s", ! olsr_ip_to_string(&result.links[0]->neighbor_iface_addr)); ! if (result.links[1] != NULL) { OLSR_PRINTF( 9, ", %s", ! olsr_ip_to_string(&result.links[1]->neighbor_iface_addr)); } /* if */ --- 928,939 ---- 9, "%s", ! olsr_ip_to_string(&result->links[0]->neighbor_iface_addr)); ! if (result->links[1] != NULL) { OLSR_PRINTF( 9, ", %s", ! olsr_ip_to_string(&result->links[1]->neighbor_iface_addr)); } /* if */ *************** *** 915,919 **** } /* if */ - return result; } /* GetBestTwoNeighbors */ --- 941,944 ---- *************** *** 1735,1743 **** * network interfaces * Input : ifName - network interface (e.g. "eth0") * Output : none ! * Return : fail (0) or success (1) * Data Used : NonOlsrIfNames * ------------------------------------------------------------------------- */ ! int AddNonOlsrBmfIf(const char* ifName) { assert(ifName != NULL); --- 1760,1769 ---- * network interfaces * Input : ifName - network interface (e.g. "eth0") + * data - not used * Output : none ! * Return : success (0) or fail (1) * Data Used : NonOlsrIfNames * ------------------------------------------------------------------------- */ ! int AddNonOlsrBmfIf(const char* ifName, void* data) { assert(ifName != NULL); *************** *** 1750,1754 **** PLUGIN_NAME, MAX_NON_OLSR_IFS); ! return 0; } --- 1776,1780 ---- PLUGIN_NAME, MAX_NON_OLSR_IFS); ! return 1; } *************** *** 1756,1760 **** NonOlsrIfNames[nNonOlsrIfs][IFNAMSIZ - 1] = '\0'; /* Ensures null termination */ nNonOlsrIfs++; ! return 1; } /* AddNonOlsrBmfIf */ --- 1782,1786 ---- NonOlsrIfNames[nNonOlsrIfs][IFNAMSIZ - 1] = '\0'; /* Ensures null termination */ nNonOlsrIfs++; ! return 0; } /* AddNonOlsrBmfIf */ From (spam-protected) Wed Sep 12 01:22:40 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 11 Sep 2007 23:22:40 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.83,1.84 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12918 Modified Files: CHANGELOG Log Message: * fixed missing "addon" parameter and "unused" warnings Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** CHANGELOG 11 Sep 2007 23:08:19 -0000 1.83 --- CHANGELOG 11 Sep 2007 23:22:38 -0000 1.84 *************** *** 7,12 **** - updated to svn version 33 ! BMF PLUGIN by Erik Tromp - updated to 1.5.1 PATCH by Hannes Gredler which rewrites the route handling. --- 7,14 ---- - updated to svn version 33 ! BMF PLUGIN by Erik Tromp - updated to 1.5.1 + - updated to latest plugin interfaces changes and killed warnings (by Bernd + Petrovitsch ) PATCH by Hannes Gredler which rewrites the route handling. From (spam-protected) Wed Sep 12 01:22:40 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 11 Sep 2007 23:22:40 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Address.c, 1.6, 1.7 Address.h, 1.5, 1.6 NetworkInterfaces.c, 1.7, 1.8 NetworkInterfaces.h, 1.5, 1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12918/lib/bmf/src Modified Files: Address.c Address.h NetworkInterfaces.c NetworkInterfaces.h Log Message: * fixed missing "addon" parameter and "unused" warnings Index: Address.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Address.c 11 Sep 2007 23:08:20 -0000 1.6 --- Address.c 11 Sep 2007 23:22:38 -0000 1.7 *************** *** 64,72 **** * Input : enable - either "yes" or "no" * data - not used * Output : none * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int DoLocalBroadcast(const char* enable, void* data) { if (strcmp(enable, "yes") == 0) --- 64,73 ---- * Input : enable - either "yes" or "no" * data - not used + * addon - not used * Output : none * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int DoLocalBroadcast(const char* enable, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (strcmp(enable, "yes") == 0) Index: Address.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Address.h 11 Sep 2007 23:08:20 -0000 1.5 --- Address.h 11 Sep 2007 23:22:38 -0000 1.6 *************** *** 48,52 **** extern int EnableLocalBroadcast; ! int DoLocalBroadcast(const char* enable, void* data); int IsMulticast(union olsr_ip_addr* ipAddress); int IsOlsrOrBmfPacket(unsigned char* ipPacket); --- 48,52 ---- extern int EnableLocalBroadcast; ! int DoLocalBroadcast(const char* enable, void* data, unsigned int addon); int IsMulticast(union olsr_ip_addr* ipAddress); int IsOlsrOrBmfPacket(unsigned char* ipPacket); Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NetworkInterfaces.c 11 Sep 2007 23:08:20 -0000 1.7 --- NetworkInterfaces.c 11 Sep 2007 23:22:38 -0000 1.8 *************** *** 123,131 **** * Input : ifname - network interface name (e.g. "mybmf0") * data - not used * Output : none * Return : success (0) or fail (1) * Data Used : EtherTunTapIfName * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceName(const char* ifname, void* data) { strncpy(EtherTunTapIfName, ifname, IFNAMSIZ - 1); --- 123,132 ---- * Input : ifname - network interface name (e.g. "mybmf0") * data - not used + * addon - not used * Output : none * Return : success (0) or fail (1) * Data Used : EtherTunTapIfName * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceName(const char* ifname, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { strncpy(EtherTunTapIfName, ifname, IFNAMSIZ - 1); *************** *** 140,143 **** --- 141,145 ---- * Input : ip - IP address string, followed by '/' and prefix length * data - not used + * addon - not used * Output : none * Return : success (0) or fail (1) *************** *** 145,149 **** * TunTapIpOverruled * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceIp(const char* ip, void* data) { #define IPV4_MAX_ADDRLEN 16 --- 147,151 ---- * TunTapIpOverruled * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceIp(const char* ip, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { #define IPV4_MAX_ADDRLEN 16 *************** *** 210,218 **** * Input : enable - either "yes" or "no" * data - not used * Output : none * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data) { if (strcmp(enable, "yes") == 0) --- 212,221 ---- * Input : enable - either "yes" or "no" * data - not used + * addon - not used * Output : none * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (strcmp(enable, "yes") == 0) *************** *** 237,245 **** * Input : mechanism - either "Broadcast" or "UnicastPromiscuous" * data - not used * Output : none * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int SetBmfMechanism(const char* mechanism, void* data) { if (strcmp(mechanism, "Broadcast") == 0) --- 240,249 ---- * Input : mechanism - either "Broadcast" or "UnicastPromiscuous" * data - not used + * addon - not used * Output : none * Return : success (0) or fail (1) * Data Used : none * ------------------------------------------------------------------------- */ ! int SetBmfMechanism(const char* mechanism, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (strcmp(mechanism, "Broadcast") == 0) *************** *** 1761,1769 **** * Input : ifName - network interface (e.g. "eth0") * data - not used * Output : none * Return : success (0) or fail (1) * Data Used : NonOlsrIfNames * ------------------------------------------------------------------------- */ ! int AddNonOlsrBmfIf(const char* ifName, void* data) { assert(ifName != NULL); --- 1765,1774 ---- * Input : ifName - network interface (e.g. "eth0") * data - not used + * addon - not used * Output : none * Return : success (0) or fail (1) * Data Used : NonOlsrIfNames * ------------------------------------------------------------------------- */ ! int AddNonOlsrBmfIf(const char* ifName, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { assert(ifName != NULL); Index: NetworkInterfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NetworkInterfaces.h 11 Sep 2007 23:08:20 -0000 1.5 --- NetworkInterfaces.h 11 Sep 2007 23:22:38 -0000 1.6 *************** *** 121,128 **** extern enum TBmfMechanism BmfMechanism; ! int SetBmfInterfaceName(const char* ifname, void* data); ! int SetBmfInterfaceIp(const char* ip, void* data); ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data); ! int SetBmfMechanism(const char* mechanism, void* data); int DeactivateSpoofFilter(void); void RestoreSpoofFilter(void); --- 121,128 ---- extern enum TBmfMechanism BmfMechanism; ! int SetBmfInterfaceName(const char* ifname, void* data, unsigned int addon); ! int SetBmfInterfaceIp(const char* ip, void* data, unsigned int addon); ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data, unsigned int addon); ! int SetBmfMechanism(const char* mechanism, void* data, unsigned int addon); int DeactivateSpoofFilter(void); void RestoreSpoofFilter(void); *************** *** 144,148 **** void AddInterface(struct interface* newIntf); void CloseBmfNetworkInterfaces(void); ! int AddNonOlsrBmfIf(const char* ifName, void* data); int IsNonOlsrBmfIf(const char* ifName); void CheckAndUpdateLocalBroadcast(unsigned char* ipPacket, union olsr_ip_addr* broadAddr); --- 144,148 ---- void AddInterface(struct interface* newIntf); void CloseBmfNetworkInterfaces(void); ! int AddNonOlsrBmfIf(const char* ifName, void* data, unsigned int addon); int IsNonOlsrBmfIf(const char* ifName); void CheckAndUpdateLocalBroadcast(unsigned char* ipPacket, union olsr_ip_addr* broadAddr); From (spam-protected) Wed Sep 12 01:30:43 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 11 Sep 2007 23:30:43 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch Makefile,1.11,1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16410/src/olsr_switch Modified Files: Makefile Log Message: * just for consistency and simplicity also link against OS_LIB_PTHREAD Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/Makefile,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile 28 Jul 2007 19:33:48 -0000 1.11 --- Makefile 11 Sep 2007 23:30:41 -0000 1.12 *************** *** 10,14 **** default_target: $(OBJS) ! $(CC) $(LDFLAGS) -o $(TOPDIR)/$(BINNAME) $(OBJS) $(LIBS) clean: --- 10,14 ---- default_target: $(OBJS) ! $(CC) $(LDFLAGS) -o $(TOPDIR)/$(BINNAME) $(OBJS) $(LIBS) $(OS_LIB_PTHREAD) clean: From (spam-protected) Wed Sep 12 01:49:04 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 11 Sep 2007 23:49:04 +0000 Subject: [Olsr-cvs] olsrd-current/src link_set.c,1.70,1.71 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26342/src Modified Files: link_set.c Log Message: * minor cleanup by Hannes Gredler Index: link_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** link_set.c 19 Aug 2007 20:37:41 -0000 1.70 --- link_set.c 11 Sep 2007 23:49:02 -0000 1.71 *************** *** 70,74 **** static struct link_entry * ! add_new_entry(union olsr_ip_addr *, union olsr_ip_addr *, union olsr_ip_addr *, double, double, struct interface *); static void --- 70,74 ---- static struct link_entry * ! add_link_entry(union olsr_ip_addr *, union olsr_ip_addr *, union olsr_ip_addr *, double, double, struct interface *); static void *************** *** 459,463 **** static struct link_entry * ! add_new_entry(union olsr_ip_addr *local, union olsr_ip_addr *remote, union olsr_ip_addr *remote_main, double vtime, double htime, struct interface *local_if) { struct link_entry *tmp_link_set, *new_link; --- 459,463 ---- static struct link_entry * ! add_link_entry(union olsr_ip_addr *local, union olsr_ip_addr *remote, union olsr_ip_addr *remote_main, double vtime, double htime, struct interface *local_if) { struct link_entry *tmp_link_set, *new_link; *************** *** 670,674 **** /** *Update a link entry. This is the "main entrypoint" in ! *the link-sensing. This function is calles from the HELLO *parser function. *It makes sure a entry is updated or created. --- 670,674 ---- /** *Update a link entry. This is the "main entrypoint" in ! *the link-sensing. This function is called from the HELLO *parser function. *It makes sure a entry is updated or created. *************** *** 690,694 **** /* Add if not registered */ ! entry = add_new_entry(local, remote, &message->source_addr, message->vtime, message->htime, in_if); /* Update ASYM_time */ --- 690,694 ---- /* Add if not registered */ ! entry = add_link_entry(local, remote, &message->source_addr, message->vtime, message->htime, in_if); /* Update ASYM_time */ From (spam-protected) Wed Sep 12 16:06:21 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 12 Sep 2007 14:06:21 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c,1.6,1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19184/src/cfgparser Modified Files: cfgfile_gen.c Log Message: * commented debug stuff out Index: cfgfile_gen.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/cfgfile_gen.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** cfgfile_gen.c 27 Mar 2007 03:05:21 -0000 1.6 --- cfgfile_gen.c 12 Sep 2007 14:06:19 -0000 1.7 *************** *** 382,386 **** --- 382,388 ---- struct in_addr in4; + #if 0 printf("\n\n\n\nolsrd_write_cnf_buf bufsize %d\n\n\n\n\n", bufsize); + #endif if(buf == NULL || bufsize < MAX_LINESIZE) { From (spam-protected) Wed Sep 12 16:08:02 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 12 Sep 2007 14:08:02 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.73, 1.74 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19733/lib/httpinfo/src Modified Files: olsrd_httpinfo.c Log Message: * commented debug stuff out Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** olsrd_httpinfo.c 5 Sep 2007 16:17:35 -0000 1.73 --- olsrd_httpinfo.c 12 Sep 2007 14:08:00 -0000 1.74 *************** *** 1218,1222 **** --- 1218,1224 ---- i++; } + #if 0 printf("RETURNING %d\n", size); + #endif return size; } From (spam-protected) Thu Sep 13 01:40:16 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 12 Sep 2007 23:40:16 +0000 Subject: [Olsr-cvs] olsrd-current/src net_olsr.h,1.11,1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25853/src Modified Files: net_olsr.h Log Message: * include interfaces.h if we use the struct Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** net_olsr.h 5 Sep 2007 16:11:11 -0000 1.11 --- net_olsr.h 12 Sep 2007 23:40:14 -0000 1.12 *************** *** 46,49 **** --- 46,50 ---- #include "defs.h" + #include "interfaces.h" #include "process_routes.h" #include From (spam-protected) Thu Sep 13 01:40:49 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 12 Sep 2007 23:40:49 +0000 Subject: [Olsr-cvs] olsrd-current/src routing_table.h,1.20,1.21 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25921/src Modified Files: routing_table.h Log Message: * killed a dead struct and fixed a typo Index: routing_table.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** routing_table.h 5 Sep 2007 16:17:36 -0000 1.20 --- routing_table.h 12 Sep 2007 23:40:47 -0000 1.21 *************** *** 66,79 **** /* a nexthop is a pointer to a gateway router plus an interface */ - struct rt_nexthop_soll_weg - { - union olsr_ip_addr gateway; /* gateway router */ - struct interface *iface; /* outgoing interface */ - }; - struct rt_nexthop { union olsr_ip_addr gateway; /* gateway router */ ! int iif_index; /* outgoung interface index */ }; --- 66,73 ---- /* a nexthop is a pointer to a gateway router plus an interface */ struct rt_nexthop { union olsr_ip_addr gateway; /* gateway router */ ! int iif_index; /* outgoing interface index */ }; From (spam-protected) Thu Sep 13 17:32:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:00 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.84,1.85 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823 Modified Files: CHANGELOG Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** CHANGELOG 11 Sep 2007 23:22:38 -0000 1.84 --- CHANGELOG 13 Sep 2007 15:31:58 -0000 1.85 *************** *** 78,81 **** --- 78,92 ---- up/down operations (see 102-olsrd-rt-refactoring-fixes.patch below). + PATCH by Hannes Gredler which "consolidates + the link-state database and the spf-calculation in order + to calculate routes more efficiently". + To quote him (more): + ---- snip ---- + - use the link-state (tc) database for SPF calculations rather than + replicating the notion of vertices and edges for a SPF run. + this heavily reduces malloc() calls and shrinks the total CPU + load of the route calculation path between 60%-80%. + ---- snip ---- + PATCHES by Sven-Ola Tücke to be found on from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/ From (spam-protected) Thu Sep 13 17:32:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:01 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.74, 1.75 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823/lib/httpinfo/src Modified Files: olsrd_httpinfo.c Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** olsrd_httpinfo.c 12 Sep 2007 14:08:00 -0000 1.74 --- olsrd_httpinfo.c 13 Sep 2007 15:31:59 -0000 1.75 *************** *** 1065,1072 **** { int size = 0; ! olsr_u8_t index; ! struct tc_entry *entry; ! struct topo_dst *dst_entry; ! size += snprintf(&buf[size], bufsize-size, "

Topology entries

\n"); --- 1065,1070 ---- { int size = 0; ! struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; size += snprintf(&buf[size], bufsize-size, "

Topology entries

\n
Destination IPLast Hop IP
"); *************** *** 1075,1111 **** size += snprintf(&buf[size], bufsize-size, "\n"); ! /* Topology */ ! for(index=0;indexdestinations.next; ! while(dst_entry != &entry->destinations) ! { ! size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize, &dst_entry->T_dest_addr, -1); ! size += build_ipaddr_with_link(&buf[size], bufsize, &entry->T_last_addr, -1); ! if (olsr_cnf->lq_level > 0) ! { ! const double d = dst_entry->link_quality * dst_entry->inverse_link_quality; ! size += snprintf(&buf[size], bufsize-size, ! "" ! "" ! "\n", ! dst_entry->link_quality, ! dst_entry->inverse_link_quality, ! d ? 1.0 / d : 0.0); ! } ! size += snprintf(&buf[size], bufsize-size, "\n"); ! dst_entry = dst_entry->next; ! } ! entry = entry->next; ! } ! } size += snprintf(&buf[size], bufsize-size, "
Destination IPLast Hop IP
%0.2f%0.2f%0.2f
\n"); --- 1073,1097 ---- size += snprintf(&buf[size], bufsize-size, "\n"); + OLSR_FOR_ALL_TC_ENTRIES(tc) { + OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ipaddr_with_link(&buf[size], bufsize, &tc_edge->T_dest_addr, -1); ! size += build_ipaddr_with_link(&buf[size], bufsize, &tc->addr, -1); ! if (olsr_cnf->lq_level > 0) ! { ! const double d = tc_edge->link_quality * tc_edge->inverse_link_quality; ! size += snprintf(&buf[size], bufsize-size, ! "%0.2f" ! "%0.2f" ! "%0.2f\n", ! tc_edge->link_quality, ! tc_edge->inverse_link_quality, ! d ? 1.0 / d : 0.0); ! } ! size += snprintf(&buf[size], bufsize-size, "\n"); ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); size += snprintf(&buf[size], bufsize-size, "\n"); From (spam-protected) Thu Sep 13 17:32:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:01 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c,1.9,1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823/lib/txtinfo/src Modified Files: olsrd_txtinfo.c Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** olsrd_txtinfo.c 5 Sep 2007 16:17:36 -0000 1.9 --- olsrd_txtinfo.c 13 Sep 2007 15:31:59 -0000 1.10 *************** *** 337,366 **** static void ipc_print_topology(void) { ! int index; ! struct tc_entry *entry; ! struct topo_dst *dst_entry; ipc_sendf("Table: Topology\nDestination IP\tLast hop IP\tLQ\tILQ\tETX\n"); /* Topology */ ! for(index = 0; index < HASHSIZE; index++) { ! /* For all TC entries */ ! entry = tc_table[index].next; ! while(entry != &tc_table[index]) { ! /* For all destination entries of that TC entry */ ! dst_entry = entry->destinations.next; ! while(dst_entry != &entry->destinations) { ! ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%0.2f\n", ! olsr_ip_to_string(&dst_entry->T_dest_addr), ! olsr_ip_to_string(&entry->T_last_addr), ! dst_entry->link_quality, ! dst_entry->inverse_link_quality, ! (dst_entry->link_quality * dst_entry->inverse_link_quality) ? 1.0 / (dst_entry->link_quality * dst_entry->inverse_link_quality) : 0.0); ! ! dst_entry = dst_entry->next; ! } ! entry = entry->next; ! } ! } ipc_sendf("\n"); } --- 337,358 ---- static void ipc_print_topology(void) { ! struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; ipc_sendf("Table: Topology\nDestination IP\tLast hop IP\tLQ\tILQ\tETX\n"); /* Topology */ ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%0.2f\n", ! olsr_ip_to_string(&tc_edge->T_dest_addr), ! olsr_ip_to_string(&tc->addr), ! tc_edge->link_quality, ! tc_edge->inverse_link_quality, ! (tc_edge->link_quality * tc_edge->inverse_link_quality) ? 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality) : 0.0); ! ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); ! ipc_sendf("\n"); } From (spam-protected) Thu Sep 13 17:32:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:01 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.26, 1.27 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823/lib/dot_draw/src Modified Files: olsrd_dot_draw.c Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** olsrd_dot_draw.c 23 Jul 2007 12:58:38 -0000 1.26 --- olsrd_dot_draw.c 13 Sep 2007 15:31:58 -0000 1.27 *************** *** 103,107 **** static void ! ipc_print_tc_link(struct tc_entry *entry, struct topo_dst *dst_entry); static void --- 103,107 ---- static void ! ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry); static void *************** *** 298,303 **** olsr_u8_t index; struct neighbor_entry *neighbor_table_tmp; ! struct tc_entry *entry; ! struct topo_dst *dst_entry; struct hna_entry *tmp_hna; struct hna_net *tmp_net; --- 298,303 ---- olsr_u8_t index; struct neighbor_entry *neighbor_table_tmp; ! struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; struct hna_entry *tmp_hna; struct hna_net *tmp_net; *************** *** 324,343 **** /* Topology */ ! for(index=0;indexdestinations.next; ! while(dst_entry != &entry->destinations) ! { ! ipc_print_tc_link(entry, dst_entry); ! dst_entry = dst_entry->next; ! } ! entry = entry->next; ! } ! } /* HNA entries */ --- 324,332 ---- /* Topology */ ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! ipc_print_tc_link(tc, tc_edge); ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); /* HNA entries */ *************** *** 389,393 **** static void ! ipc_print_tc_link(struct tc_entry *entry, struct topo_dst *dst_entry) { char buf[256]; --- 378,382 ---- static void ! ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry) { char buf[256]; *************** *** 395,399 **** double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality ); ! adr = olsr_ip_to_string(&entry->T_last_addr); sprintf( buf, "\"%s\" -> ", adr ); ipc_send_str(buf); --- 384,388 ---- double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality ); ! adr = olsr_ip_to_string(&entry->addr); sprintf( buf, "\"%s\" -> ", adr ); ipc_send_str(buf); From (spam-protected) Thu Sep 13 17:32:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:00 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src NetworkInterfaces.c,1.8,1.9 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823/lib/bmf/src Modified Files: NetworkInterfaces.c Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NetworkInterfaces.c 11 Sep 2007 23:22:38 -0000 1.8 --- NetworkInterfaces.c 13 Sep 2007 15:31:58 -0000 1.9 *************** *** 863,876 **** if (tcLastHop != NULL) { ! struct topo_dst* tcDest; ! /* TODO: olsr_tc_lookup_dst() is not thread-safe. */ ! tcDest = olsr_tc_lookup_dst(tcLastHop, MainAddressOf(&walker->neighbor_iface_addr)); ! if (tcDest != NULL) { float tcEtx = CalcEtx( ! tcDest->link_quality, ! tcDest->inverse_link_quality); if (previousLinkEtx + currEtx > tcEtx) --- 863,876 ---- if (tcLastHop != NULL) { ! struct tc_edge_entry* tc_edge; ! /* TODO: olsr_lookup_tc_edge() is not thread-safe. */ ! tc_edge = olsr_lookup_tc_edge(tcLastHop, MainAddressOf(&walker->neighbor_iface_addr)); ! if (tc_edge != NULL) { float tcEtx = CalcEtx( ! tc_edge->link_quality, ! tc_edge->inverse_link_quality); if (previousLinkEtx + currEtx > tcEtx) From (spam-protected) Thu Sep 13 17:32:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:01 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src plugin.c,1.11,1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823/lib/tas/src Modified Files: plugin.c Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/plugin.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** plugin.c 5 Sep 2007 16:17:35 -0000 1.11 --- plugin.c 13 Sep 2007 15:31:59 -0000 1.12 *************** *** 83,87 **** static struct neighbor_entry *neighTab = NULL; static struct mid_entry *midTab = NULL; - static struct tc_entry *tcTab = NULL; static struct hna_entry *hnaTab = NULL; static struct olsrd_config *config = NULL; --- 83,86 ---- *************** *** 244,251 **** void iterRouteTabInit(void) { ! avl_init(&routingtree, avl_comp_prefix_default); ! routingtree_version = 0; - iterRouteTab = (avl_walk_first(&routingtree)->data); } --- 243,254 ---- void iterRouteTabInit(void) { ! struct avl_node *node; ! ! avl_init(&routingtree, avl_comp_prefix_default); ! routingtree_version = 0; ! ! node = avl_walk_first(&routingtree); ! iterRouteTab = node ? node->data : NULL; } *************** *** 254,258 **** int res; int i; ! struct topo_dst *dest; if (iterTcTab == NULL) --- 257,261 ---- int res; int i; ! struct tc_edge_entry *tc_edge; if (iterTcTab == NULL) *************** *** 261,267 **** res = snprintf(buff, len, "main~%s~[~destinations~", ! rawIpAddrToString(&iterTcTab->T_last_addr, ipAddrLen)); ! ! i = 0; len -= res; --- 264,268 ---- res = snprintf(buff, len, "main~%s~[~destinations~", ! rawIpAddrToString(&iterTcTab->addr, ipAddrLen)); len -= res; *************** *** 269,279 **** len -= 2; - for (dest = iterTcTab->destinations.next; dest != &iterTcTab->destinations; - dest = dest->next) - { res = snprintf(buff, len, "[~%d~address~%s~etx~%f~]~", i, ! rawIpAddrToString(&dest->T_dest_addr, ipAddrLen), ! lqToEtx(dest->link_quality, dest->inverse_link_quality)); if (res < len) --- 270,280 ---- len -= 2; + i = 0; + + OLSR_FOR_ALL_TC_EDGE_ENTRIES(iterTcTab, tc_edge) { res = snprintf(buff, len, "[~%d~address~%s~etx~%f~]~", i, ! rawIpAddrToString(&tc_edge->T_dest_addr, ipAddrLen), ! lqToEtx(tc_edge->link_quality, tc_edge->inverse_link_quality)); if (res < len) *************** *** 286,306 **** i++; ! } ! strcpy(buff, "]~"); ! iterTcTab = iterTcTab->next; ! ! if (iterTcTab == &tcTab[iterIndex]) ! { ! iterTcTab = NULL; ! ! while (++iterIndex < HASHSIZE) ! if (tcTab[iterIndex].next != &tcTab[iterIndex]) ! { ! iterTcTab = tcTab[iterIndex].next; ! break; ! } ! } return 0; --- 287,295 ---- i++; ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(iterTcTab, tc_edge); ! strcpy(buff, "]~"); ! iterTcTab = olsr_getnext_tc_entry(iterTcTab); return 0; *************** *** 309,323 **** void iterTcTabInit(void) { ! iterTcTab = NULL; ! ! if (tcTab == NULL) ! return; ! for (iterIndex = 0; iterIndex < HASHSIZE; iterIndex++) ! if (tcTab[iterIndex].next != &tcTab[iterIndex]) ! { ! iterTcTab = tcTab[iterIndex].next; ! break; ! } } --- 298,307 ---- void iterTcTabInit(void) { ! struct avl_node *node; ! ! avl_init(&tc_tree, avl_comp_prefix_default); ! node = avl_walk_first(&tc_tree); ! iterTcTab = node ? node->data : NULL; } *************** *** 465,469 **** neighTab = neighbortable; midTab = mid_set; - tcTab = tc_table; hnaTab = hna_set; config = olsr_cnf; --- 449,452 ---- *************** *** 497,498 **** --- 480,487 ---- *size = sizeof(plugin_parameters)/sizeof(*plugin_parameters); } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ From (spam-protected) Thu Sep 13 17:32:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:01 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.28, 1.29 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823/lib/nameservice/src Modified Files: nameservice.c Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** nameservice.c 5 Sep 2007 16:11:10 -0000 1.28 --- nameservice.c 13 Sep 2007 15:31:59 -0000 1.29 *************** *** 1441,1444 **** --- 1441,1446 ---- struct olsr_if *ifs; union olsr_ip_addr ip; + struct tc_entry *tc; + struct tc_edge_entry *tc_edge; if (!latlon_table_changed) return; *************** *** 1512,1536 **** } } ! for (hash = 0; hash < HASHSIZE; hash++) ! { ! struct tc_entry *entry = tc_table[hash].next; ! while(entry != &tc_table[hash]) ! { ! struct topo_dst *dst_entry = entry->destinations.next; ! while(dst_entry != &entry->destinations) ! { ! fprintf(js, "Link('%s','%s',%f,%f,%f);\n", ! olsr_ip_to_string(&dst_entry->T_dest_addr), ! olsr_ip_to_string(&entry->T_last_addr), ! dst_entry->link_quality, ! dst_entry->inverse_link_quality, ! (dst_entry->link_quality * dst_entry->inverse_link_quality) ? ! 1.0 / (dst_entry->link_quality * dst_entry->inverse_link_quality) : ! 0.0); ! dst_entry = dst_entry->next; ! } ! entry = entry->next; ! } ! } fclose(js); --- 1514,1532 ---- } } ! ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! ! fprintf(js, "Link('%s','%s',%f,%f,%f);\n", ! olsr_ip_to_string(&tc_edge->T_dest_addr), ! olsr_ip_to_string(&tc->addr), ! tc_edge->link_quality, ! tc_edge->inverse_link_quality, ! (tc_edge->link_quality * tc_edge->inverse_link_quality) ? ! 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality) : ! 0.0); ! ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); fclose(js); From (spam-protected) Thu Sep 13 17:32:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:01 +0000 Subject: [Olsr-cvs] olsrd-current/src lq_route.c, 1.50, 1.51 lq_route.h, 1.5, 1.6 process_package.c, 1.41, 1.42 tc_set.c, 1.27, 1.28 tc_set.h, 1.15, 1.16 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823/src Modified Files: lq_route.c lq_route.h process_package.c tc_set.c tc_set.h Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: tc_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tc_set.h 29 May 2005 12:47:46 -0000 1.15 --- tc_set.h 13 Sep 2007 15:31:59 -0000 1.16 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) + * LSDB rewrite (c) 2007, Hannes Gredler (hannes at gredler.at) * All rights reserved. * *************** *** 46,108 **** #include "packet.h" ! struct topo_dst { ! union olsr_ip_addr T_dest_addr; ! clock_t T_time; ! olsr_u16_t T_seq; ! struct topo_dst *next; ! struct topo_dst *prev; ! double link_quality; ! double inverse_link_quality; ! double saved_link_quality; ! double saved_inverse_link_quality; }; struct tc_entry { ! union olsr_ip_addr T_last_addr; ! struct topo_dst destinations; ! struct tc_entry *next; ! struct tc_entry *prev; }; ! /* Queue */ ! extern struct tc_entry tc_table[HASHSIZE]; ! ! ! int ! olsr_init_tc(void); ! ! ! int ! olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *); ! ! ! struct tc_entry * ! olsr_lookup_tc_entry(union olsr_ip_addr *); ! ! ! struct topo_dst * ! olsr_tc_lookup_dst(struct tc_entry *, union olsr_ip_addr *); ! ! ! int ! olsr_tc_delete_entry_if_empty(struct tc_entry *); ! ! ! struct tc_entry * ! olsr_add_tc_entry(union olsr_ip_addr *); ! int ! olsr_tc_update_mprs(struct tc_entry *, struct tc_message *); ! int ! olsr_print_tc_table(void); ! void ! olsr_time_out_tc_set(void); #endif --- 47,145 ---- #include "packet.h" ! /* ! * This file holds the definitions for the link state database. ! * The lsdb consists of nodes and edges. ! * During input parsing all nodes and edges are extracted and syntesized. ! * The SPF calculation operates on these datasets. ! */ ! ! struct tc_edge_entry { ! struct avl_node edge_node; /* edge_tree node in tc_entry */ ! union olsr_ip_addr T_dest_addr; /* edge_node key */ ! struct tc_edge_entry *edge_inv; /* shortcut, used during SPF calculation */ ! struct tc_entry *tc; /* backpointer to owning tc entry */ ! clock_t T_time; /* expiration timer, timer_node key */ ! olsr_u16_t T_seq; /* sequence number */ ! olsr_u16_t flags; /* misc flags */ ! float etx; /* metric used for SPF calculation */ ! float link_quality; ! float inverse_link_quality; }; + #define OLSR_TC_EDGE_DOWN (1 << 0) /* this edge is down */ + + /* + * Garbage collection time for downed edges + */ + #define OLSR_TC_EDGE_GC_TIME 15*1000 /* milliseconds */ struct tc_entry { ! struct avl_node vertex_node; /* node keyed by ip address */ ! struct avl_node cand_tree_node; /* SPF candidate heap, node keyed by path_etx */ ! struct list_node path_list_node; /* SPF result list */ ! union olsr_ip_addr addr; /* vertex_node key */ ! struct avl_tree edge_tree; /* subtree for edges */ ! struct link_entry *next_hop; /* SPF calculated link to the 1st hop neighbor */ ! float path_etx; /* SPF calculated distance, cand_tree_node key */ ! olsr_u8_t hops; /* SPF calculated hopcount */ }; + /* + * macros for traversing the vertices and edges in the link state database. + * it is recommended to use this because it hides all the internal + * datastructure from the callers. + * + * the loop prefetches the next node in order to not loose context if + * for example the caller wants to delete the current entry. + */ + #define OLSR_FOR_ALL_TC_ENTRIES(tc) \ + { \ + struct avl_node *tc_tree_node, *next_tc_tree_node; \ + for (tc_tree_node = avl_walk_first(&tc_tree); \ + tc_tree_node; tc_tree_node = next_tc_tree_node) { \ + next_tc_tree_node = avl_walk_next(tc_tree_node); \ + tc = tc_tree_node->data; + #define OLSR_FOR_ALL_TC_ENTRIES_END(tc) }} ! #define OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) \ ! { \ ! struct avl_node *tc_edge_node, *next_tc_edge_node; \ ! for (tc_edge_node = avl_walk_first(&tc->edge_tree); \ ! tc_edge_node; tc_edge_node = next_tc_edge_node) { \ ! next_tc_edge_node = avl_walk_next(tc_edge_node); \ ! tc_edge = tc_edge_node->data; ! #define OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge) }} + extern struct avl_tree tc_tree; + extern struct tc_entry *tc_myself; ! int olsr_init_tc(void); ! int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *); ! int olsr_tc_update_mprs(struct tc_entry *, struct tc_message *); ! int olsr_print_tc_table(void); ! void olsr_time_out_tc_set(void); ! /* tc_entry manipulation */ ! struct tc_entry *olsr_lookup_tc_entry(union olsr_ip_addr *); ! struct tc_entry *olsr_add_tc_entry(union olsr_ip_addr *); ! struct tc_entry *olsr_getnext_tc_entry(struct tc_entry *); ! /* tc_edge_entry manipulation */ ! char *olsr_tc_edge_to_string(struct tc_edge_entry *); ! 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 *, u_int16_t, ! unsigned int, float, float); ! void olsr_delete_tc_edge_entry(struct tc_edge_entry *); ! void olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *); #endif + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ Index: lq_route.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** lq_route.h 5 Sep 2007 16:11:10 -0000 1.5 --- lq_route.h 13 Sep 2007 15:31:59 -0000 1.6 *************** *** 48,51 **** --- 48,52 ---- void olsr_calculate_routing_table(void); + char *olsr_etx_to_string(float); #endif Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** process_package.c 2 Aug 2007 22:07:19 -0000 1.41 --- process_package.c 13 Sep 2007 15:31:59 -0000 1.42 *************** *** 229,234 **** } ! OLSR_PRINTF(3, "Processing TC from %s\n", ! olsr_ip_to_string(&message->originator)); /* --- 229,234 ---- } ! OLSR_PRINTF(3, "Processing TC from %s, seq 0x%04x\n", ! olsr_ip_to_string(&message->originator), message->ansn); /* *************** *** 273,280 **** if(olsr_tc_update_mprs(tc_last, message)) changes_topology = OLSR_TRUE; - - /* Delete possible empty TC entry */ - if(changes_topology) - olsr_tc_delete_entry_if_empty(tc_last); } --- 273,276 ---- Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tc_set.c 2 Aug 2007 22:07:19 -0000 1.27 --- tc_set.c 13 Sep 2007 15:31:59 -0000 1.28 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) + * LSDB rewrite (c) 2007, Hannes Gredler (hannes at gredler.at) * All rights reserved. * *************** *** 40,52 **** */ [...967 lines suppressed...] ! etx = 0.0; ! } else { ! etx = 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality); ! } ! ! OLSR_PRINTF(1, fstr, olsr_ip_to_string(&tc->addr), ! olsr_ip_to_string(&tc_edge->T_dest_addr), ! tc_edge->link_quality, tc_edge->inverse_link_quality, etx); ! ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); return 1; } + + /* + * Local Variables: + * c-basic-offset: 2 + * End: + */ Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** lq_route.c 5 Sep 2007 16:17:36 -0000 1.50 --- lq_route.c 13 Sep 2007 15:31:59 -0000 1.51 *************** *** 55,77 **** #include "lq_route.h" - struct olsr_spf_edge - { - struct avl_node tree_node; - struct olsr_spf_vertex *dest; - float etx; - }; - - struct olsr_spf_vertex - { - struct avl_node tree_node; /* node keyed by ip address */ - struct avl_node cand_tree_node; /* node keyed by etx */ - struct list_node path_list_node; /* SPF result list */ - union olsr_ip_addr addr; - struct avl_tree edge_tree; - struct link_entry *next_hop; /* the link to the 1st hop neighbor */ - float path_etx; - olsr_u8_t hops; - }; - /* * avl_comp_etx --- 55,58 ---- *************** *** 104,108 **** static void olsr_spf_add_cand_tree (struct avl_tree *tree, ! struct olsr_spf_vertex *vert) { vert->cand_tree_node.key = &vert->path_etx; --- 85,89 ---- static void olsr_spf_add_cand_tree (struct avl_tree *tree, ! struct tc_entry *vert) { vert->cand_tree_node.key = &vert->path_etx; *************** *** 115,119 **** #endif ! avl_insert(tree, &vert->cand_tree_node, 1); } --- 96,100 ---- #endif ! avl_insert(tree, &vert->cand_tree_node, AVL_DUP); } *************** *** 125,129 **** static void olsr_spf_del_cand_tree (struct avl_tree *tree, ! struct olsr_spf_vertex *vert) { --- 106,110 ---- static void olsr_spf_del_cand_tree (struct avl_tree *tree, ! struct tc_entry *vert) { *************** *** 145,149 **** olsr_spf_add_path_list (struct list_node *head, int *path_count, ! struct olsr_spf_vertex *vert) { vert->path_list_node.data = vert; --- 126,130 ---- olsr_spf_add_path_list (struct list_node *head, int *path_count, ! struct tc_entry *vert) { vert->path_list_node.data = vert; *************** *** 161,307 **** /* - * olsr_spf_add_vertex - * - * Add a node to the tree of all nodes in the network. - */ - static struct olsr_spf_vertex * - olsr_spf_add_vertex (struct avl_tree *vertex_tree, - union olsr_ip_addr *addr, float path_etx) - { - struct avl_node *node; - struct olsr_spf_vertex *vert; - - // see whether this destination is already in our tree - - node = avl_find(vertex_tree, addr); - - if (node) { - return node->data; - } - - // if it's not in our list, add it - - vert = olsr_malloc(sizeof (struct olsr_spf_vertex), "Dijkstra vertex"); - - vert->tree_node.data = vert; - vert->tree_node.key = &vert->addr; - - COPY_IP(&vert->addr, addr); - - vert->path_etx = path_etx; - vert->next_hop = NULL; - vert->hops = 0; - - avl_init(&vert->edge_tree, avl_comp_default); - - avl_insert(vertex_tree, &vert->tree_node, 0); - return vert; - } - - static struct olsr_spf_vertex * - olsr_spf_add_edge (struct avl_tree *vertex_tree, - union olsr_ip_addr *src, union olsr_ip_addr *dst, - float etx) - { - struct avl_node *node; - struct olsr_spf_vertex *svert; - struct olsr_spf_vertex *dvert; - struct olsr_spf_edge *edge; - - // source lookup - - node = avl_find(vertex_tree, src); - - // source vertex does not exist - - if (node == NULL) - return NULL; - - svert = node->data; - - // destination lookup - - node = avl_find(vertex_tree, dst); - - // destination vertex does not exist - - if (node == NULL) - return NULL; - - dvert = node->data; - - // check for existing forward edge - - if (avl_find(&svert->edge_tree, dst) == NULL) - { - // add forward edge - - edge = olsr_malloc(sizeof (struct olsr_spf_vertex), "Dijkstra forward edge"); - - edge->tree_node.data = edge; - edge->tree_node.key = &dvert->addr; - - edge->dest = dvert; - edge->etx = etx; - - avl_insert(&svert->edge_tree, &edge->tree_node, 0); - } - - // check for existing inverse edge - - if (avl_find(&dvert->edge_tree, src) == NULL) - { - // add inverse edge - - edge = olsr_malloc(sizeof (struct olsr_spf_vertex), "Dijkstra inverse edge"); - - edge->tree_node.data = edge; - edge->tree_node.key = &svert->addr; - - edge->dest = svert; - edge->etx = etx; - - avl_insert(&dvert->edge_tree, &edge->tree_node, 0); - } - - return svert; - } - - static void olsr_free_everything(struct avl_tree *vertex_tree) - { - struct avl_node *vert_node; - struct avl_node *edge_node; - struct olsr_spf_vertex *vert; - struct olsr_spf_edge *edge; - - vert_node = avl_walk_first(vertex_tree); - - // loop through all vertices - - while (vert_node) - { - vert = vert_node->data; - edge_node = avl_walk_first(&vert->edge_tree); - - // loop through all edges of the current vertex - - while (edge_node != NULL) - { - edge = edge_node->data; - edge_node = avl_walk_next(edge_node); - free(edge); - } - - vert_node = avl_walk_next(vert_node); - free(vert); - } - } - - /* * olsr_spf_extract_best * * return the node with the minimum pathcost. */ ! static struct olsr_spf_vertex * olsr_spf_extract_best (struct avl_tree *tree) { --- 142,150 ---- /* * olsr_spf_extract_best * * return the node with the minimum pathcost. */ ! static struct tc_entry * olsr_spf_extract_best (struct avl_tree *tree) { *************** *** 314,319 **** ! #ifdef DEBUG ! static char *olsr_etx_to_string(float etx) { static char buff[20]; --- 157,161 ---- ! char *olsr_etx_to_string(float etx) { static char buff[20]; *************** *** 325,329 **** return buff; } - #endif --- 167,170 ---- *************** *** 336,342 **** */ static void ! olsr_spf_relax (struct avl_tree *cand_tree, struct olsr_spf_vertex *vert) { ! struct olsr_spf_edge *edge; struct avl_node *edge_node; float new_etx; --- 177,184 ---- */ static void ! olsr_spf_relax (struct avl_tree *cand_tree, struct tc_entry *vert) { ! struct tc_entry *new_vert; ! struct tc_edge_entry *tc_edge; struct avl_node *edge_node; float new_etx; *************** *** 348,398 **** #endif ! edge_node = avl_walk_first(&vert->edge_tree); ! // loop through all edges of this vertex ! while (edge_node != NULL) ! { ! edge = edge_node->data; ! // total quality of the path through this vertex to the ! // destination of this edge ! new_etx = vert->path_etx + edge->etx; ! // if it's better than the current path quality of this ! // edge's destination, then we've found a better path to ! // this destination - if (new_etx < edge->dest->path_etx) - { /* if this node has been on the candidate tree delete it */ ! if (edge->dest->path_etx != INFINITE_ETX) { ! olsr_spf_del_cand_tree(cand_tree, edge->dest); } /* re-insert on candidate tree with the better metric */ ! edge->dest->path_etx = new_etx; ! olsr_spf_add_cand_tree(cand_tree, edge->dest); /* pull-up the next-hop and bump the hop count */ if (vert->next_hop) { ! edge->dest->next_hop = vert->next_hop; } ! edge->dest->hops = vert->hops + 1; #ifdef DEBUG OLSR_PRINTF(1, "SPF: better path to %s, cost %s -> %s, via %s, hops %u\n", ! olsr_ip_to_string(&(edge->dest->addr)), ! olsr_etx_to_string(edge->dest->path_etx), olsr_etx_to_string(new_etx), olsr_ip_to_string(vert->next_hop ? &vert->next_hop->neighbor_iface_addr : NULL), ! edge->dest->hops); #endif } - - edge_node = avl_walk_next(edge_node); } } --- 190,264 ---- #endif ! /* ! * loop through all edges of this vertex. ! */ ! for (edge_node = avl_walk_first(&vert->edge_tree); ! edge_node; ! edge_node = avl_walk_next(edge_node)) { ! tc_edge = edge_node->data; ! /* ! * We are not interested in dead-end or dying edges. ! */ ! if (!tc_edge->edge_inv || (tc_edge->flags & OLSR_TC_EDGE_DOWN)) { ! #ifdef DEBUG ! OLSR_PRINTF(1, "SPF: ignoring edge %s\n", ! olsr_ip_to_string(&tc_edge->T_dest_addr)); ! if (tc_edge->flags & OLSR_TC_EDGE_DOWN) { ! OLSR_PRINTF(1, "SPF: edge down\n"); ! } ! if (!tc_edge->edge_inv) { ! OLSR_PRINTF(1, "SPF: no inverse edge\n"); ! } ! #endif ! continue; ! } ! /* ! * total quality of the path through this vertex ! * to the destination of this edge ! */ ! new_etx = vert->path_etx + tc_edge->etx; ! #ifdef DEBUG ! OLSR_PRINTF(1, "SPF: exploring edge %s, cost %s\n", ! olsr_ip_to_string(&(tc_edge->T_dest_addr)), ! olsr_etx_to_string(new_vert->path_etx)); ! #endif ! /* ! * if it's better than the current path quality of this edge's ! * destination node, then we've found a better path to this node. ! */ ! new_vert = tc_edge->edge_inv->tc; ! if (new_etx < new_vert->path_etx) { /* if this node has been on the candidate tree delete it */ ! if (new_vert->path_etx != INFINITE_ETX) { ! olsr_spf_del_cand_tree(cand_tree, new_vert); } /* re-insert on candidate tree with the better metric */ ! new_vert->path_etx = new_etx; ! olsr_spf_add_cand_tree(cand_tree, new_vert); /* pull-up the next-hop and bump the hop count */ if (vert->next_hop) { ! new_vert->next_hop = vert->next_hop; } ! new_vert->hops = vert->hops + 1; #ifdef DEBUG OLSR_PRINTF(1, "SPF: better path to %s, cost %s -> %s, via %s, hops %u\n", ! olsr_ip_to_string(&new_vert->addr), ! olsr_etx_to_string(new_vert->path_etx), olsr_etx_to_string(new_etx), olsr_ip_to_string(vert->next_hop ? &vert->next_hop->neighbor_iface_addr : NULL), ! new_vert->->hops); #endif } } } *************** *** 414,418 **** int *path_count) { ! struct olsr_spf_vertex *vert; *path_count = 0; --- 280,284 ---- int *path_count) { ! struct tc_entry *vert; *path_count = 0; *************** *** 434,454 **** olsr_calculate_routing_table (void) { ! struct avl_tree vertex_tree, cand_tree; struct list_node path_list; int i, plen, max_host_plen, path_count = 0; ! struct tc_entry *tcsrc; ! struct topo_dst *tcdst; ! struct olsr_spf_vertex *vert, *myself; struct neighbor_entry *neigh; struct mid_address *mid_walker; - float etx; struct hna_entry *hna_gw; struct hna_net *hna; - struct neighbor_2_entry *neigh2; struct interface *inter; struct link_entry *link; #ifdef SPF_PROFILING ! struct timeval t1, t2, t3, t4, t5, t6, spf_init, spf_run, route, kernel, cleanup, total; gettimeofday(&t1, NULL); --- 300,318 ---- olsr_calculate_routing_table (void) { ! struct avl_tree cand_tree; struct list_node path_list; int i, plen, max_host_plen, path_count = 0; ! struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; ! struct tc_entry *vert; struct neighbor_entry *neigh; struct mid_address *mid_walker; struct hna_entry *hna_gw; struct hna_net *hna; struct interface *inter; struct link_entry *link; #ifdef SPF_PROFILING ! struct timeval t1, t2, t3, t4, t5, spf_init, spf_run, route, kernel, total; gettimeofday(&t1, NULL); *************** *** 457,513 **** max_host_plen = olsr_host_rt_maxplen(); ! // initialize the graph ! ! avl_init(&vertex_tree, avl_comp_default); avl_init(&cand_tree, avl_comp_etx); list_head_init(&path_list); - olsr_bump_routingtree_version(); - // add ourselves to the vertex and candidate tree - - myself = olsr_spf_add_vertex(&vertex_tree, &olsr_cnf->main_addr, ZERO_ETX); - olsr_spf_add_cand_tree(&cand_tree, myself); - /* ! * Add our neighbours. */ ! for (i = 0; i < HASHSIZE; i++) ! for (neigh = neighbortable[i].next; neigh != &neighbortable[i]; ! neigh = neigh->next) { ! ! if (neigh->status != SYM) ! continue; ! ! olsr_spf_add_vertex(&vertex_tree, &neigh->neighbor_main_addr, INFINITE_ETX); ! } ! ! // add our two-hop neighbours ! ! for (i = 0; i < HASHSIZE; i++) ! for (neigh2 = two_hop_neighbortable[i].next; ! neigh2 != &two_hop_neighbortable[i]; ! neigh2 = neigh2->next) { ! ! olsr_spf_add_vertex(&vertex_tree, &neigh2->neighbor_2_addr, INFINITE_ETX); ! } ! // add remaining vertices ! ! for (i = 0; i < HASHSIZE; i++) ! for (tcsrc = tc_table[i].next; tcsrc != &tc_table[i]; tcsrc = tcsrc->next) ! { ! // add source ! ! olsr_spf_add_vertex(&vertex_tree, &tcsrc->T_last_addr, INFINITE_ETX); ! ! // add destinations of this source ! ! for (tcdst = tcsrc->destinations.next; tcdst != &tcsrc->destinations; ! tcdst = tcdst->next) ! olsr_spf_add_vertex(&vertex_tree, &tcdst->T_dest_addr, INFINITE_ETX); ! } ! // add edges to and from our neighbours for (i = 0; i < HASHSIZE; i++) for (neigh = neighbortable[i].next; neigh != &neighbortable[i]; --- 321,349 ---- max_host_plen = olsr_host_rt_maxplen(); ! /* ! * Prepare the candidate tree and result list. ! */ avl_init(&cand_tree, avl_comp_etx); list_head_init(&path_list); olsr_bump_routingtree_version(); /* ! * Initialize vertices in the lsdb. */ ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! tc->next_hop = NULL; ! tc->path_etx = INFINITE_ETX; ! tc->hops = 0; ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); ! /* ! * zero ourselves and add us to the candidate tree. ! */ ! tc_myself->path_etx = ZERO_ETX; ! olsr_spf_add_cand_tree(&cand_tree, tc_myself); + /* + * add edges to and from our neighbours. + */ for (i = 0; i < HASHSIZE; i++) for (neigh = neighbortable[i].next; neigh != &neighbortable[i]; *************** *** 516,564 **** if (neigh->status == SYM) { link = get_best_link_to_neighbor(&neigh->neighbor_main_addr); if (!link) { continue; } ! if (olsr_cnf->lq_level < 2) { ! /* for non-lq the etx is always 1.0 */ ! vert = olsr_spf_add_edge(&vertex_tree, &neigh->neighbor_main_addr, ! &olsr_cnf->main_addr, 1.0 ); ! vert->next_hop = link; ! ! } else if (link->loss_link_quality2 >= MIN_LINK_QUALITY && ! link->neigh_link_quality2 >= MIN_LINK_QUALITY) { ! ! etx = 1.0 / (link->loss_link_quality2 * link->neigh_link_quality2); ! ! vert = olsr_spf_add_edge(&vertex_tree, &neigh->neighbor_main_addr, ! &olsr_cnf->main_addr, etx); ! vert->next_hop = link; } ! } ! } ! ! /* add remaining edges from TC messages */ ! ! for (i = 0; i < HASHSIZE; i++) ! for (tcsrc = tc_table[i].next; tcsrc != &tc_table[i]; tcsrc = tcsrc->next) ! for (tcdst = tcsrc->destinations.next; tcdst != &tcsrc->destinations; ! tcdst = tcdst->next) { ! ! if (olsr_cnf->lq_level < 2) { ! ! /* for non-lq the etx is always 1.0 */ ! olsr_spf_add_edge(&vertex_tree, &tcdst->T_dest_addr, ! &tcsrc->T_last_addr, 1.0); ! ! } else if (tcdst->link_quality >= MIN_LINK_QUALITY && ! tcdst->inverse_link_quality >= MIN_LINK_QUALITY) { ! ! etx = 1.0 / (tcdst->link_quality * tcdst->inverse_link_quality); ! ! olsr_spf_add_edge(&vertex_tree, &tcdst->T_dest_addr, ! &tcsrc->T_last_addr, etx); } } #ifdef SPF_PROFILING --- 352,387 ---- if (neigh->status == SYM) { + tc_edge = olsr_lookup_tc_edge(tc_myself, &neigh->neighbor_main_addr); link = get_best_link_to_neighbor(&neigh->neighbor_main_addr); if (!link) { + + /* + * If there is no best link to this neighbor + * and we had an edge before then flush the edge. + */ + if (tc_edge) { + olsr_delete_tc_edge_entry(tc_edge); + } continue; } ! /* ! * Set the next-hops of our neighbors. ! */ ! if (!tc_edge) { ! tc_edge = olsr_add_tc_edge_entry(tc_myself, &neigh->neighbor_main_addr, ! 0, link->last_htime, ! link->loss_link_quality2, ! link->neigh_link_quality2); ! } else { ! tc_edge->link_quality = link->loss_link_quality2; ! tc_edge->inverse_link_quality = link->neigh_link_quality2; ! olsr_calc_tc_edge_entry_etx(tc_edge); } ! if (tc_edge->edge_inv) { ! tc_edge->edge_inv->tc->next_hop = link; } } + } #ifdef SPF_PROFILING *************** *** 652,672 **** #endif - /* free the SPF graph */ - - olsr_free_everything(&vertex_tree); - #ifdef SPF_PROFILING - gettimeofday(&t6, NULL); - timersub(&t2, &t1, &spf_init); timersub(&t3, &t2, &spf_run); timersub(&t4, &t3, &route); timersub(&t5, &t4, &kernel); ! timersub(&t6, &t5, &cleanup); ! timersub(&t6, &t1, &total); ! olsr_printf(1, "\n--- SPF-stats for %d nodes, %d routes (total/init/run/route/kern/cleanup): %d, %d, %d, %d, %d, %d\n", path_count, routingtree.count, (int)total.tv_usec, (int)spf_init.tv_usec, (int)spf_run.tv_usec, ! (int)route.tv_usec, (int)kernel.tv_usec, (int)cleanup.tv_usec); #endif } --- 475,489 ---- #endif #ifdef SPF_PROFILING timersub(&t2, &t1, &spf_init); timersub(&t3, &t2, &spf_run); timersub(&t4, &t3, &route); timersub(&t5, &t4, &kernel); ! timersub(&t5, &t1, &total); ! olsr_printf(1, "\n--- SPF-stats for %d nodes, %d routes (total/init/run/route/kern): " ! "%d, %d, %d, %d, %d\n", path_count, routingtree.count, (int)total.tv_usec, (int)spf_init.tv_usec, (int)spf_run.tv_usec, ! (int)route.tv_usec, (int)kernel.tv_usec); #endif } From (spam-protected) Thu Sep 13 17:32:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:32:01 +0000 Subject: [Olsr-cvs] olsrd-current/lib/pgraph/src olsrd_pgraph.c,1.7,1.8 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/pgraph/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16823/lib/pgraph/src Modified Files: olsrd_pgraph.c Log Message: * patch by Hannes Gredler to consolidate the the link-state database and the spf-calculation Index: olsrd_pgraph.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_pgraph.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** olsrd_pgraph.c 30 Aug 2007 22:49:12 -0000 1.7 --- olsrd_pgraph.c 13 Sep 2007 15:31:59 -0000 1.8 *************** *** 146,150 **** static void ipc_print_neigh_link(struct neighbor_entry *neighbor); ! static void ipc_print_tc_link(struct tc_entry *entry, struct topo_dst *dst_entry); #if 0 --- 146,150 ---- static void ipc_print_neigh_link(struct neighbor_entry *neighbor); ! static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry); #if 0 *************** *** 322,327 **** olsr_u8_t index; struct neighbor_entry *neighbor_table_tmp; ! struct tc_entry *entry; ! struct topo_dst *dst_entry; res = 0; --- 322,327 ---- olsr_u8_t index; struct neighbor_entry *neighbor_table_tmp; ! struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; res = 0; *************** *** 347,366 **** /* Topology */ ! for(index=0;indexdestinations.next; ! while(dst_entry != &entry->destinations) ! { ! ipc_print_tc_link(entry, dst_entry); ! dst_entry = dst_entry->next; ! } ! entry = entry->next; ! } ! } ipc_send(" end ", strlen(" end ")); --- 347,355 ---- /* Topology */ ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! ipc_print_tc_link(tc, tc_edge); ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); ipc_send(" end ", strlen(" end ")); *************** *** 411,415 **** #endif ! static void ipc_print_tc_link(struct tc_entry *entry, struct topo_dst *dst_entry) { char buf[256]; --- 400,404 ---- #endif ! static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry) { char buf[256]; *************** *** 419,423 **** // double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality ); ! main_adr = olsr_ip_to_string(&entry->T_last_addr); adr = olsr_ip_to_string(&dst_entry->T_dest_addr); len = sprintf( buf, "add link %s %s\n", main_adr, adr ); --- 408,412 ---- // double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality ); ! main_adr = olsr_ip_to_string(&entry->addr); adr = olsr_ip_to_string(&dst_entry->T_dest_addr); len = sprintf( buf, "add link %s %s\n", main_adr, adr ); From (spam-protected) Thu Sep 13 17:41:14 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:41:14 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw version-script.txt,1.2,1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21213/lib/dyn_gw Modified Files: version-script.txt Log Message: * converted to plugin interface version 5 Index: version-script.txt =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/version-script.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** version-script.txt 29 May 2005 12:47:40 -0000 1.2 --- version-script.txt 13 Sep 2007 15:41:12 -0000 1.3 *************** *** 3,8 **** global: olsrd_plugin_interface_version; - olsrd_plugin_register_param; olsrd_plugin_init; local: --- 3,8 ---- global: olsrd_plugin_interface_version; olsrd_plugin_init; + olsrd_get_plugin_parameters; local: From (spam-protected) Thu Sep 13 17:41:14 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 15:41:14 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c, 1.21, 1.22 olsrd_dyn_gw.h, 1.12, 1.13 olsrd_plugin.c, 1.14, 1.15 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21213/lib/dyn_gw/src Modified Files: olsrd_dyn_gw.c olsrd_dyn_gw.h olsrd_plugin.c Log Message: * converted to plugin interface version 5 Index: olsrd_dyn_gw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** olsrd_dyn_gw.c 8 May 2007 23:49:00 -0000 1.21 --- olsrd_dyn_gw.c 13 Sep 2007 15:41:12 -0000 1.22 *************** *** 53,56 **** --- 53,57 ---- #include "olsr.h" #include "local_hna_set.h" + #include "defs.h" #include *************** *** 101,105 **** static struct ping_list * ! add_to_ping_list(char *, struct ping_list *); struct hna_list { --- 102,106 ---- static struct ping_list * ! add_to_ping_list(const char *, struct ping_list *); struct hna_list { *************** *** 134,189 **** /** * read config file parameters ! */ ! int ! olsrd_plugin_register_param(char *key, char *value) { ! /* foo_addr is only used for call to inet_aton */ ! struct in_addr foo_addr; ! int retval = -1; ! int i; ! union olsr_ip_addr temp_net; ! union olsr_ip_addr temp_netmask; ! char s_netaddr[16]; ! char s_mask[16]; ! ! //printf("%s():%s->%s\n",__func__,key,value); ! ! if (!strcmp(key, "Interval")) { ! if (sscanf(value, "%d", &check_interval) == 1) { ! retval = 1; } ! }else if (!strcmp(key, "Ping")) { ! /* if value contains a valid IPaddr, then add it to the list */ ! //if (inet_aton(strdup(value), &foo_addr)) { ! if (inet_aton(value, &foo_addr)) { ! /*if first ping without hna then assume inet gateway*/ ! if (the_hna_list==NULL){ ! temp_net.v4 = INET_NET; ! temp_netmask.v4 = INET_PREFIX; ! if ((the_hna_list = add_to_hna_list(the_hna_list,&temp_net,&temp_netmask))==NULL) ! return retval; ! } ! the_hna_list->ping_hosts=add_to_ping_list(value, the_hna_list->ping_hosts); ! retval = 1; } ! }else if (!strcmp(key, "HNA")) { ! //192.168.1.0 255.255.255.0 ! i=sscanf(value,"%15s %15s",s_netaddr,s_mask); ! //printf("%s():i:%i; net:%s; mask:%s\n",__func__,i,s_netaddr,s_mask); ! if (inet_aton(s_netaddr, &foo_addr)) { ! temp_net.v4=foo_addr.s_addr; ! //printf("GOT: %s(%08x)",inet_ntoa(foo_addr),foo_addr.s_addr); ! if (inet_aton(s_mask, &foo_addr)) { ! temp_netmask.v4=foo_addr.s_addr; ! //printf("/%s(%08x)\n",inet_ntoa(foo_addr),foo_addr.s_addr); ! //printf("%s():got->%s/%s\n",__func__,olsr_ip_to_string((union olsr_ip_addr *)&)); ! if ((the_hna_list = add_to_hna_list(the_hna_list,&temp_net,&temp_netmask))!=NULL) ! retval = 1; ! } ! } ! } ! return retval; } /** --- 135,226 ---- /** * read config file parameters ! */ ! static int set_plugin_double(const char *value, void *data, unsigned int addon __attribute__((unused))) { ! char *endptr; ! const double d = strtod(value, &endptr); ! if (*endptr != '\0' || endptr == value) { ! OLSR_PRINTF(0, "Illegal double \"%s\"", value); ! return 1; } ! if (data != NULL) { ! double *v = data; ! *v = d; ! OLSR_PRINTF(1, "%s double %lf\n", "Got", d); ! } else { ! OLSR_PRINTF(0, "%s double %lf\n", "Ignored", d); } ! return 0; } + static int set_plugin_ping(const char *value, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) + { + union olsr_ip_addr foo_addr; + + if (inet_pton(olsr_cnf->ip_version, value, &foo_addr) <= 0) { + OLSR_PRINTF(0, "Illegal IP address \"%s\"", value); + return 1; + } + /*if first ping without hna then assume inet gateway*/ + if (the_hna_list == NULL){ + union olsr_ip_addr temp_net; + union olsr_ip_addr temp_netmask; + temp_net.v4 = INET_NET; + temp_netmask.v4 = INET_PREFIX; + the_hna_list = add_to_hna_list(the_hna_list, &temp_net, &temp_netmask); + if (the_hna_list == NULL) { + return 1; + } + } + the_hna_list->ping_hosts = add_to_ping_list(value, the_hna_list->ping_hosts); + return 0; + } + + static int set_plugin_hna(const char *value, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) + { + union olsr_ip_addr temp_net; + union olsr_ip_addr temp_netmask; + char s_netaddr[128]; + char s_mask[128]; + + //192.168.1.0 255.255.255.0 + int i = sscanf(value,"%128s %128s", s_netaddr, s_mask); + if (i != 2) { + OLSR_PRINTF(0, "Cannot get IP address and netmask from \"%s\"", value); + return 1; + } + + //printf("%s():i:%i; net:%s; mask:%s\n",__func__,i,s_netaddr,s_mask); + if (inet_pton(olsr_cnf->ip_version, s_netaddr, &temp_net) <= 0) { + OLSR_PRINTF(0, "Illegal IP address \"%s\"", s_netaddr); + return 1; + } + + //printf("GOT: %s(%08x)",inet_ntoa(foo_addr),foo_addr.s_addr); + if (inet_pton(olsr_cnf->ip_version, s_netaddr, &temp_netmask) <= 0) { + OLSR_PRINTF(0, "Illegal netmask \"%s\"", s_netaddr); + return 1; + } + + //printf("/%s(%08x)\n",inet_ntoa(foo_addr),foo_addr.s_addr); + //printf("%s():got->%s/%s\n",__func__,olsr_ip_to_string((union olsr_ip_addr *)&)); + the_hna_list = add_to_hna_list(the_hna_list, &temp_net, &temp_netmask); + if (the_hna_list != NULL) { + return 1; + } + return 0; + } + + static const struct olsrd_plugin_parameters plugin_parameters[] = { + { .name = "interval", .set_plugin_parameter = &set_plugin_double, .data = &check_interval }, + { .name = "ping", .set_plugin_parameter = &set_plugin_ping, .data = NULL }, + { .name = "hna", .set_plugin_parameter = &set_plugin_hna, .data = NULL }, + }; + + void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size) + { + *params = plugin_parameters; + *size = sizeof(plugin_parameters)/sizeof(*plugin_parameters); + } /** *************** *** 376,380 **** /* add the valid IPs to the head of the list */ static struct ping_list * ! add_to_ping_list(char *ping_address, struct ping_list *the_ping_list) { struct ping_list *new = malloc(sizeof(struct ping_list)); --- 413,417 ---- /* add the valid IPs to the head of the list */ static struct ping_list * ! add_to_ping_list(const char *ping_address, struct ping_list *the_ping_list) { struct ping_list *new = malloc(sizeof(struct ping_list)); Index: olsrd_dyn_gw.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** olsrd_dyn_gw.h 20 Apr 2007 14:06:18 -0000 1.12 --- olsrd_dyn_gw.h 13 Sep 2007 15:41:12 -0000 1.13 *************** *** 51,62 **** #define PROCENTRY_ROUTE "/proc/net/route" ! int ! olsrd_plugin_init(void); ! int ! olsrd_plugin_interface_version(void); ! int ! olsrd_plugin_register_param(char *key, char *value); #endif --- 51,59 ---- #define PROCENTRY_ROUTE "/proc/net/route" ! int olsrd_plugin_init(void); ! int olsrd_plugin_interface_version(void); ! void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size); #endif Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_plugin.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** olsrd_plugin.c 20 Apr 2007 14:19:44 -0000 1.14 --- olsrd_plugin.c 13 Sep 2007 15:41:12 -0000 1.15 *************** *** 49,53 **** #define PLUGIN_AUTHOR "Various artists" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR ! #define PLUGIN_INTERFACE_VERSION 4 --- 49,53 ---- #define PLUGIN_AUTHOR "Various artists" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR ! #define PLUGIN_INTERFACE_VERSION 5 *************** *** 56,61 **** */ ! static void __attribute__ ((constructor)) ! my_init(void); --- 56,60 ---- */ ! static void my_init(void) __attribute__ ((constructor)); *************** *** 80,84 **** /* Print plugin info to stdout */ printf("%s\n", MOD_DESC); - - return; } --- 79,81 ---- From (spam-protected) Thu Sep 13 18:08:14 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 16:08:14 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.85,1.86 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv632 Modified Files: CHANGELOG Log Message: * added 104-olsrd-policy-routing.patch by Sven-Ola Tücke (with trivial changes) Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** CHANGELOG 13 Sep 2007 15:31:58 -0000 1.85 --- CHANGELOG 13 Sep 2007 16:08:12 -0000 1.86 *************** *** 89,93 **** ---- snip ---- ! PATCHES by Sven-Ola Tücke to be found on from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/ - 102-olsrd-rt-refactoring-fixes.patch --- 89,93 ---- ---- snip ---- ! PATCHES by Sven-Ola Tücke to be found on from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/ - 102-olsrd-rt-refactoring-fixes.patch *************** *** 122,125 **** --- 122,132 ---- - 106-olsrd-nameserviceparams.patch: This patch converts more plugins to the new interface version. + - 104-olsrd-policy-routing.patch + Reworked this one to discard GPL helper functions. Also checked IPv6 and + re-included the IPC hookup. The patch adds a "RtTable [number]" for + /etc/olsrd.conf which is simply the Linux + policy routing table to use. Defaults to 254 (== main). + This patch was modified/clenaed up by to use "#if" + instead of "#ifdef" as it's more robust against typos. PATCH by Arnd Hannemann *************** *** 128,131 **** --- 135,142 ---- in Makefile. + PATCHES by John Hay + - update to new FreeBSD WLAN API + - do not require /bin/bash, use /bin/sh + PATCHES and CLEANUPS by Bernd Petrovitsch - Made a function from the ME_TO_DOUBLE() macro (in src/mantissa.h). *************** *** 142,149 **** data. ! PATCHES by John Hay ! - update to new FreeBSD WLAN API ! - do not require /bin/bash, use /bin/sh ! - paving the way to activate -Wshadow, much more to do - const-ify parameters here and there --- 153,158 ---- data. ! - converted the dyn_gw plugin to plugin interface version 5 (which leaves ! the quagga plugion as the last with the old one). - paving the way to activate -Wshadow, much more to do - const-ify parameters here and there From (spam-protected) Thu Sep 13 18:08:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 16:08:15 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.75, 1.76 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv632/lib/httpinfo/src Modified Files: olsrd_httpinfo.c Log Message: * added 104-olsrd-policy-routing.patch by Sven-Ola Tücke (with trivial changes) Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** olsrd_httpinfo.c 13 Sep 2007 15:31:59 -0000 1.75 --- olsrd_httpinfo.c 13 Sep 2007 16:08:12 -0000 1.76 *************** *** 840,843 **** --- 840,845 ---- size += snprintf(&buf[size], bufsize-size, "TOS: 0x%04x\n", olsr_cnf->tos); + size += sprintf(&buf[size], "RtTable: 0x%04x\n", olsr_cnf->rttable); + size += snprintf(&buf[size], bufsize-size, "Willingness: %d %s\n", olsr_cnf->willingness, olsr_cnf->willingness_auto ? "(auto)" : ""); From (spam-protected) Thu Sep 13 18:08:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 16:08:15 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.25,1.26 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv632/src/linux Modified Files: kernel_routes.c Log Message: * added 104-olsrd-policy-routing.patch by Sven-Ola Tücke (with trivial changes) Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** kernel_routes.c 5 Sep 2007 16:17:36 -0000 1.25 --- kernel_routes.c 13 Sep 2007 16:08:13 -0000 1.26 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) + * Copyright (c) 2007, Sven-Ola for the policy routing stuff * All rights reserved. * *************** *** 50,53 **** --- 51,56 ---- #include + #if !LINUX_POLICY_ROUTING + /** *************** *** 328,331 **** --- 331,488 ---- } + #else /* LINUX_POLICY_ROUTING */ + + #include + #include + #include + + struct olsr_rtreq + { + struct nlmsghdr n; + struct rtmsg r; + char buf[512]; + }; + + static void olsr_netlink_addreq(struct olsr_rtreq *req, int type, void *data, int len) + { + struct rtattr *rta = (struct rtattr*)(((char*)req) + NLMSG_ALIGN(req->n.nlmsg_len)); + req->n.nlmsg_len = NLMSG_ALIGN(req->n.nlmsg_len) + RTA_LENGTH(len); + assert(req->n.nlmsg_len < sizeof(struct olsr_rtreq)); + rta->rta_type = type; + rta->rta_len = RTA_LENGTH(len); + memcpy(RTA_DATA(rta), data, len); + } + + static int olsr_netlink_route(struct rt_entry *rt, olsr_u8_t family, olsr_u8_t rttable, __u16 cmd) + { + int ret = 0; + struct olsr_rtreq req; + struct iovec iov; + struct sockaddr_nl nladdr; + struct msghdr msg = + { + (void*)&nladdr, + sizeof(nladdr), + &iov, + 1, + NULL, + 0, + 0 + }; + olsr_u32_t metric = 1; + struct rt_nexthop* nexthop = (RTM_NEWROUTE == cmd) ? + &rt->rt_best->rtp_nexthop : &rt->rt_nexthop; + + memset(&req, 0, sizeof(req)); + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); + req.n.nlmsg_flags = NLM_F_REQUEST|NLM_F_CREATE|NLM_F_EXCL|NLM_F_ACK; + req.n.nlmsg_type = cmd; + req.r.rtm_family = family; + req.r.rtm_table = rttable; + req.r.rtm_protocol = RTPROT_BOOT; + req.r.rtm_scope = RT_SCOPE_LINK; + req.r.rtm_type = RTN_UNICAST; + req.r.rtm_dst_len = rt->rt_dst.prefix_len; + + if (AF_INET == family) + { + if (rt->rt_dst.prefix.v4 != nexthop->gateway.v4) + { + olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v4, sizeof(nexthop->gateway.v4)); + req.r.rtm_scope = RT_SCOPE_UNIVERSE; + metric = RT_METRIC_DEFAULT; + } + olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v4, sizeof(rt->rt_dst.prefix.v4)); + } + else + { + if (0 != memcmp(&rt->rt_dst.prefix.v6, &nexthop->gateway.v6, sizeof(nexthop->gateway.v6))) + { + olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v6, sizeof(nexthop->gateway.v6)); + req.r.rtm_scope = RT_SCOPE_UNIVERSE; + metric = RT_METRIC_DEFAULT; + } + olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v6, sizeof(rt->rt_dst.prefix.v6)); + } + //!!!olsr_netlink_addreq(&req, RTA_PRIORITY, &rt->rt_best->rtp_metric.hops, sizeof(rt->rt_best->rtp_metric.hops)); + olsr_netlink_addreq(&req, RTA_PRIORITY, &metric, sizeof(metric)); + olsr_netlink_addreq(&req, RTA_OIF, &nexthop->iif_index, sizeof(nexthop->iif_index)); + iov.iov_base = (void*)&req.n; + iov.iov_len = req.n.nlmsg_len; + memset(&nladdr, 0, sizeof(nladdr)); + nladdr.nl_family = AF_NETLINK; + if (0 <= (ret = sendmsg(olsr_cnf->rtnl_s, &msg, 0))) + { + iov.iov_base = req.buf; + iov.iov_len = sizeof(req.buf); + if (0 < (ret = recvmsg(olsr_cnf->rtnl_s, &msg, 0))) + { + struct nlmsghdr* h = (struct nlmsghdr*)req.buf; + while (NLMSG_OK(h, (unsigned int)ret)) { + if (NLMSG_DONE == h->nlmsg_type) break; + if (NLMSG_ERROR == h->nlmsg_type) + { + if (NLMSG_LENGTH(sizeof(struct nlmsgerr) <= h->nlmsg_len)) + { + struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h); + errno = -l_err->error; + if (0 != errno) ret = -1; + } + break; + } + h = NLMSG_NEXT(h, ret); + } + } + if (0 <= ret && olsr_cnf->open_ipc) + { + ipc_route_send_rtentry( + &rt->rt_dst.prefix, + &nexthop->gateway, + metric, + RTM_NEWROUTE == cmd, + if_ifwithindex_name(nexthop->iif_index)); + } + } + return ret; + } + + int olsr_ioctl_add_route(struct rt_entry *rt) + { + if (0 == rt->rt_dst.prefix_len && 253 > olsr_cnf->rttable) + { + /* + * Users start whining about not having internet with policy + * routing activated and no static default route in table 254. + * We maintain a fallback defroute in the default=253 table. + */ + olsr_netlink_route(rt, AF_INET, 253, RTM_NEWROUTE); + } + return olsr_netlink_route(rt, AF_INET, olsr_cnf->rttable, RTM_NEWROUTE); + } + + int olsr_ioctl_del_route(struct rt_entry *rt) + { + if (0 == rt->rt_dst.prefix_len && 253 > olsr_cnf->rttable) + { + /* + * Also remove the fallback default route + */ + olsr_netlink_route(rt, AF_INET, 253, RTM_DELROUTE); + } + return olsr_netlink_route(rt, AF_INET, olsr_cnf->rttable, RTM_DELROUTE); + } + + int olsr_ioctl_add_route6(struct rt_entry *rt) + { + return olsr_netlink_route(rt, AF_INET6, olsr_cnf->rttable, RTM_NEWROUTE); + } + + int olsr_ioctl_del_route6(struct rt_entry *rt) + { + return olsr_netlink_route(rt, AF_INET6, olsr_cnf->rttable, RTM_DELROUTE); + } + + #endif /* LINUX_POLICY_ROUTING */ + /* * Local Variables: From (spam-protected) Thu Sep 13 18:08:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 16:08:15 +0000 Subject: [Olsr-cvs] olsrd-current/src main.c, 1.97, 1.98 olsr_cfg.h, 1.32, 1.33 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv632/src Modified Files: main.c olsr_cfg.h Log Message: * added 104-olsrd-policy-routing.patch by Sven-Ola Tücke (with trivial changes) Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** olsr_cfg.h 6 Sep 2007 12:08:28 -0000 1.32 --- olsr_cfg.h 13 Sep 2007 16:08:13 -0000 1.33 *************** *** 46,49 **** --- 46,55 ---- #include "olsr_types.h" + #if defined linux + # define LINUX_POLICY_ROUTING 1 + #else + # define LINUX_POLICY_ROUTING 0 + #endif + /* Default values not declared in olsr_protocol.h */ #define DEF_POLLRATE 0.05 *************** *** 201,204 **** --- 207,211 ---- olsr_bool allow_no_interfaces; olsr_u16_t tos; + olsr_u8_t rttable; olsr_bool willingness_auto; olsr_u8_t willingness; *************** *** 235,239 **** --- 242,250 ---- int ioctl_s; /* Socket used for ioctl calls */ + #if LINUX_POLICY_ROUTING + int rtnl_s; /* Socket used for rtnetlink messages */ + #else int rts; /* Socket used for route changes on BSDs */ + #endif }; Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** main.c 5 Sep 2007 16:11:10 -0000 1.97 --- main.c 13 Sep 2007 16:08:13 -0000 1.98 *************** *** 56,59 **** --- 56,65 ---- #include "build_msg.h" + #if LINUX_POLICY_ROUTING + #include + #include + #include + #endif + /* Global stuff externed in defs.h */ FILE *debug_handle; /* Where to send debug(defaults to stdout) */ *************** *** 266,269 **** --- 272,284 ---- } + #if LINUX_POLICY_ROUTING + if ((olsr_cnf->rtnl_s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) + { + olsr_syslog(OLSR_LOG_ERR, "rtnetlink socket: %m"); + olsr_exit(__func__, 0); + } + fcntl(olsr_cnf->rtnl_s, F_SETFL, O_NONBLOCK); + #endif + #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__ if ((olsr_cnf->rts = socket(PF_ROUTE, SOCK_RAW, 0)) < 0) *************** *** 488,491 **** --- 503,510 ---- close(olsr_cnf->ioctl_s); + #if LINUX_POLICY_ROUTING + close(olsr_cnf->rtnl_s); + #endif + #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__ /* routing socket */ From (spam-protected) Thu Sep 13 18:08:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 16:08:15 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c, 1.7, 1.8 olsrd_conf.c, 1.54, 1.55 oparse.y, 1.33, 1.34 oscan.lex, 1.24, 1.25 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv632/src/cfgparser Modified Files: cfgfile_gen.c olsrd_conf.c oparse.y oscan.lex Log Message: * added 104-olsrd-policy-routing.patch by Sven-Ola Tücke (with trivial changes) Index: cfgfile_gen.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/cfgfile_gen.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** cfgfile_gen.c 12 Sep 2007 14:06:19 -0000 1.7 --- cfgfile_gen.c 13 Sep 2007 16:08:13 -0000 1.8 *************** *** 124,127 **** --- 124,131 ---- fprintf(fd, "TosValue\t%d\n\n", cnf->tos); + /* RtTable */ + fprintf(fd, "# Policy Routing Table to use. Default is 254\n\n"); + fprintf(fd, "RtTable\t%d\n\n", cnf->rttable); + /* Willingness */ fprintf(fd, "# The fixed willingness to use(0-7)\n# If not set willingness will be calculated\n# dynammically based on battery/power status\n\n"); *************** *** 435,438 **** --- 439,446 ---- WRITE_TO_BUF("TosValue\t%d\n\n", cnf->tos) + /* RtTable */ + WRITE_TO_BUF("# Policy Routing Tableto use. Default is 254\n\n") + WRITE_TO_BUF("RtTable\t%d\n\n", cnf->rttable) + /* Willingness */ WRITE_TO_BUF("# The fixed willingness to use(0-7)\n# If not set willingness will be calculated\n# dynammically based on battery/power status\n\n") Index: oscan.lex =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oscan.lex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** oscan.lex 17 May 2007 20:35:16 -0000 1.24 --- oscan.lex 13 Sep 2007 16:08:13 -0000 1.25 *************** *** 300,303 **** --- 300,308 ---- } + "RtTable" { + yylval = NULL; + return TOK_RTTABLE; + } + "Willingness" { yylval = NULL; Index: olsrd_conf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.c,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** olsrd_conf.c 13 May 2007 22:23:55 -0000 1.54 --- olsrd_conf.c 13 Sep 2007 16:08:13 -0000 1.55 *************** *** 447,450 **** --- 447,451 ---- cnf->allow_no_interfaces = DEF_ALLOW_NO_INTS; cnf->tos = DEF_TOS; + cnf->rttable = 254; cnf->willingness_auto = DEF_WILL_AUTO; cnf->ipc_connections = DEF_IPC_CONNECTIONS; *************** *** 474,478 **** --- 475,483 ---- cnf->max_tc_vtime = 0.0; cnf->ioctl_s = 0; + #if LINUX_POLICY_ROUTING + cnf->rtnl_s = 0; + #else cnf->rts = 0; + #endif } *************** *** 550,553 **** --- 555,559 ---- printf("No interfaces : NOT ALLOWED\n"); printf("TOS : 0x%02x\n", cnf->tos); + printf("RtTable : 0x%02x\n", cnf->rttable); if(cnf->willingness_auto) printf("Willingness : AUTO\n"); Index: oparse.y =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** oparse.y 13 May 2007 21:49:59 -0000 1.33 --- oparse.y 13 Sep 2007 16:08:13 -0000 1.34 *************** *** 144,147 **** --- 144,148 ---- %token TOK_NOINT %token TOK_TOS + %token TOK_RTTABLE %token TOK_WILLINGNESS %token TOK_IPCCON *************** *** 198,201 **** --- 199,203 ---- | bnoint | atos + | arttable | awillingness | busehyst *************** *** 835,838 **** --- 837,850 ---- ; + arttable: TOK_RTTABLE TOK_INTEGER + { + if(PARSER_DEBUG) printf("RtTable: %d\n", $2->integer); + cnf->rttable = $2->integer; + + free($2); + + } + ; + awillingness: TOK_WILLINGNESS TOK_INTEGER { From (spam-protected) Fri Sep 14 00:43:17 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 22:43:17 +0000 Subject: [Olsr-cvs] olsrd-current/src tc_set.c, 1.28, 1.29 tc_set.h, 1.16, 1.17 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31011/src Modified Files: tc_set.c tc_set.h Log Message: * fix compilation on win32 Index: tc_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tc_set.h 13 Sep 2007 15:31:59 -0000 1.16 --- tc_set.h 13 Sep 2007 22:43:15 -0000 1.17 *************** *** 132,136 **** union olsr_ip_addr *); struct tc_edge_entry *olsr_add_tc_edge_entry(struct tc_entry *, ! union olsr_ip_addr *, u_int16_t, unsigned int, float, float); void olsr_delete_tc_edge_entry(struct tc_edge_entry *); --- 132,136 ---- union olsr_ip_addr *); struct tc_edge_entry *olsr_add_tc_edge_entry(struct tc_entry *, ! union olsr_ip_addr *, olsr_u16_t, unsigned int, float, float); void olsr_delete_tc_edge_entry(struct tc_edge_entry *); Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tc_set.c 13 Sep 2007 15:31:59 -0000 1.28 --- tc_set.c 13 Sep 2007 22:43:15 -0000 1.29 *************** *** 235,239 **** struct tc_edge_entry * olsr_add_tc_edge_entry(struct tc_entry *tc, union olsr_ip_addr *addr, ! u_int16_t ansn, unsigned int vtime, float link_quality, float neigh_link_quality) { --- 235,239 ---- struct tc_edge_entry * olsr_add_tc_edge_entry(struct tc_entry *tc, union olsr_ip_addr *addr, ! olsr_u16_t ansn, unsigned int vtime, float link_quality, float neigh_link_quality) { From (spam-protected) Fri Sep 14 00:50:31 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 22:50:31 +0000 Subject: [Olsr-cvs] olsrd-current Makefile,1.95,1.96 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1389 Modified Files: Makefile Log Message: * set version to 0.5.4rc1 Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** Makefile 29 Aug 2007 22:26:11 -0000 1.95 --- Makefile 13 Sep 2007 22:50:28 -0000 1.96 *************** *** 38,42 **** # $Id$ ! VERS = 0.5.4pre TOPDIR = . --- 38,42 ---- # $Id$ ! VERS = 0.5.4rc1 TOPDIR = . From (spam-protected) Fri Sep 14 00:52:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 13 Sep 2007 22:52:57 +0000 Subject: [Olsr-cvs] olsrd-current README,1.21,1.22 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2186 Modified Files: README Log Message: * set version to 0.5.4rc1 Index: README =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/README,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** README 2 Aug 2007 20:02:56 -0000 1.21 --- README 13 Sep 2007 22:52:55 -0000 1.22 *************** *** 1,5 **** +====================================================================+ ! | README - olsr.org OLSR daemon 0.5.3, 02.08.2007 | +====================================================================+ --- 1,5 ---- +====================================================================+ ! | README - olsr.org OLSR daemon 0.5.4rc1, 02.08.2007 | +====================================================================+ From (spam-protected) Sun Sep 16 23:14:27 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 21:14:27 +0000 Subject: [Olsr-cvs] olsrd-current/src process_routes.c, 1.36, 1.37 process_routes.h, 1.11, 1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10290/src Modified Files: process_routes.c process_routes.h Log Message: * const-ified functions Index: process_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** process_routes.c 5 Sep 2007 16:17:36 -0000 1.36 --- process_routes.c 16 Sep 2007 21:14:25 -0000 1.37 *************** *** 78,89 **** */ olsr_u8_t ! olsr_rt_flags(struct rt_entry *rt) { ! struct rt_nexthop *nh; olsr_u8_t flags; flags = (RTF_UP); ! if (rt->rt_dst.prefix_len == olsr_host_rt_maxplen()) { flags |= RTF_HOST; } --- 78,89 ---- */ olsr_u8_t ! olsr_rt_flags(const struct rt_entry *rt) { ! const struct rt_nexthop *nh; olsr_u8_t flags; flags = (RTF_UP); ! if (rt->rt_dst.prefix_len == olsr_cnf->maxplen) { flags |= RTF_HOST; } *************** *** 264,268 **** olsr_enqueue_rt(struct list_node *head_node, struct rt_entry *rt) { ! struct rt_nexthop *nh; /* if this node is already on some changelist we are done */ --- 264,268 ---- olsr_enqueue_rt(struct list_node *head_node, struct rt_entry *rt) { ! const struct rt_nexthop *nh; /* if this node is already on some changelist we are done */ Index: process_routes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** process_routes.h 5 Sep 2007 16:11:11 -0000 1.11 --- process_routes.h 16 Sep 2007 21:14:25 -0000 1.12 *************** *** 86,90 **** olsr_u8_t ! olsr_rt_flags(struct rt_entry *); #endif --- 86,90 ---- olsr_u8_t ! olsr_rt_flags(const struct rt_entry *); #endif From (spam-protected) Sun Sep 16 23:20:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 21:20:19 +0000 Subject: [Olsr-cvs] olsrd-current/src .cvsignore, 1.1, 1.2 defs.h, 1.62, 1.63 lq_route.c, 1.51, 1.52 main.c, 1.98, 1.99 net_olsr.c, 1.29, 1.30 net_olsr.h, 1.12, 1.13 olsr.c, 1.57, 1.58 olsr_cfg.h, 1.33, 1.34 routing_table.c, 1.30, 1.31 routing_table.h, 1.21, 1.22 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8566/src Modified Files: .cvsignore defs.h lq_route.c main.c net_olsr.c net_olsr.h olsr.c olsr_cfg.h routing_table.c routing_table.h Log Message: * creating builddata.c containing build time information as date+time, host and version and using it througout * activated links in the httpinfo plugin again if we have host links other minor HTML cleanups there * replaced the olsr_host_rt_maxplen() function with a field in "struct olsr_cfg" similar to "ipsize" Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** lq_route.c 13 Sep 2007 15:31:59 -0000 1.51 --- lq_route.c 16 Sep 2007 21:20:07 -0000 1.52 *************** *** 302,306 **** struct avl_tree cand_tree; struct list_node path_list; ! int i, plen, max_host_plen, path_count = 0; struct tc_entry *tc; struct tc_edge_entry *tc_edge; --- 302,306 ---- struct avl_tree cand_tree; struct list_node path_list; ! int i, plen, path_count = 0; struct tc_entry *tc; struct tc_edge_entry *tc_edge; *************** *** 319,324 **** #endif - max_host_plen = olsr_host_rt_maxplen(); - /* * Prepare the candidate tree and result list. --- 319,322 ---- *************** *** 427,431 **** /* add a route to the main address of the destination node */ ! olsr_insert_routing_table(&vert->addr, max_host_plen, &vert->addr, &link->neighbor_iface_addr, inter->if_index, vert->hops, vert->path_etx); --- 425,429 ---- /* add a route to the main address of the destination node */ ! olsr_insert_routing_table(&vert->addr, olsr_cnf->maxplen, &vert->addr, &link->neighbor_iface_addr, inter->if_index, vert->hops, vert->path_etx); *************** *** 436,440 **** mid_walker = mid_walker->next_alias) { ! olsr_insert_routing_table(&mid_walker->alias, max_host_plen, &vert->addr, &link->neighbor_iface_addr, inter->if_index, vert->hops, vert->path_etx); --- 434,438 ---- mid_walker = mid_walker->next_alias) { ! olsr_insert_routing_table(&mid_walker->alias, olsr_cnf->maxplen, &vert->addr, &link->neighbor_iface_addr, inter->if_index, vert->hops, vert->path_etx); Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 14 Dec 2006 11:28:32 -0000 1.1 --- .cvsignore 16 Sep 2007 21:20:07 -0000 1.2 *************** *** 1 **** --- 1,2 ---- *.d + builddata.c Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** net_olsr.h 12 Sep 2007 23:40:14 -0000 1.12 --- net_olsr.h 16 Sep 2007 21:20:16 -0000 1.13 *************** *** 92,98 **** olsr_netmask_to_prefix(const union olsr_ip_addr *); - int - olsr_host_rt_maxplen(void); - char * sockaddr_to_string(const struct sockaddr *); --- 92,95 ---- Index: defs.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/defs.h,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** defs.h 19 Aug 2007 23:00:22 -0000 1.62 --- defs.h 16 Sep 2007 21:20:07 -0000 1.63 *************** *** 60,65 **** #include "olsr_cfg.h" ! #define SOFTWARE_VERSION "olsr.org - " VERSION ! #define OLSRD_VERSION_DATE " *** " SOFTWARE_VERSION " (" __DATE__ ") ***\n" #ifndef OLSRD_GLOBAL_CONF_FILE --- 60,66 ---- #include "olsr_cfg.h" ! extern const char olsrd_version[]; ! extern const char build_date[]; ! extern const char build_host[]; #ifndef OLSRD_GLOBAL_CONF_FILE *************** *** 73,76 **** --- 74,78 ---- #define MIN_PACKET_SIZE(ver) ((int)(sizeof(olsr_u8_t) * (((ver) == AF_INET) ? 4 : 7))) + /* Debug helper macro */ #ifdef DEBUG Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** olsr_cfg.h 13 Sep 2007 16:08:13 -0000 1.33 --- olsr_cfg.h 16 Sep 2007 21:20:17 -0000 1.34 *************** *** 233,236 **** --- 233,237 ---- /* Stuff set by olsrd */ size_t ipsize; /* Size of address */ + olsr_8_t maxplen; /* maximum prefix len */ olsr_u16_t system_tick_divider; /* Tick resolution */ olsr_bool del_gws; /* Delete InternetGWs at startup */ Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** net_olsr.c 5 Sep 2007 16:11:11 -0000 1.29 --- net_olsr.c 16 Sep 2007 21:20:16 -0000 1.30 *************** *** 528,548 **** } - /** - * olsr_host_rt_maxplen - * - * @return the maxium prefix length based wether v4 or v6 is configured - */ - int - olsr_host_rt_maxplen(void) - { - if(olsr_cnf->ip_version == AF_INET) { - /* IPv4 */ - return 32; - } else { - /* IPv6 */ - return 128; - } - } - /** --- 528,531 ---- Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** routing_table.c 5 Sep 2007 16:17:36 -0000 1.30 --- routing_table.c 16 Sep 2007 21:20:17 -0000 1.31 *************** *** 169,173 **** */ struct rt_entry * ! olsr_lookup_routing_table(union olsr_ip_addr *dst) { struct avl_node *rt_tree_node; --- 169,173 ---- */ struct rt_entry * ! olsr_lookup_routing_table(const union olsr_ip_addr *dst) { struct avl_node *rt_tree_node; *************** *** 175,179 **** COPY_IP(&prefix, dst); ! prefix.prefix_len = olsr_host_rt_maxplen(); rt_tree_node = avl_find(&routingtree, &prefix); --- 175,179 ---- COPY_IP(&prefix, dst); ! prefix.prefix_len = olsr_cnf->maxplen; rt_tree_node = avl_find(&routingtree, &prefix); *************** *** 293,298 **** * field from the route entry or best route path shall be used. */ ! struct rt_nexthop * ! olsr_get_nh(struct rt_entry *rt) { --- 293,298 ---- * field from the route entry or best route path shall be used. */ ! const struct rt_nexthop * ! olsr_get_nh(const struct rt_entry *rt) { *************** *** 515,519 **** olsr_fill_routing_table_with_neighbors(void) { ! int index, max_host_plen; float etx; --- 515,519 ---- olsr_fill_routing_table_with_neighbors(void) { ! int index; float etx; *************** *** 522,527 **** #endif - max_host_plen = olsr_host_rt_maxplen(); - for (index=0;indexneighbor_iface_addr, max_host_plen, &link->neighbor->neighbor_main_addr, &link->neighbor_iface_addr, --- 562,566 ---- /* neighbor main IP address */ ! olsr_insert_routing_table(&link->neighbor_iface_addr, olsr_cnf->maxplen, &link->neighbor->neighbor_main_addr, &link->neighbor_iface_addr, *************** *** 570,574 **** /* this is the nexthop route that all routes will be tracking */ ! olsr_insert_routing_table(&addrs2->alias, max_host_plen, &link->neighbor->neighbor_main_addr, &link->neighbor_iface_addr, --- 568,572 ---- /* this is the nexthop route that all routes will be tracking */ ! olsr_insert_routing_table(&addrs2->alias, olsr_cnf->maxplen, &link->neighbor->neighbor_main_addr, &link->neighbor_iface_addr, Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** main.c 13 Sep 2007 16:08:13 -0000 1.98 --- main.c 16 Sep 2007 21:20:16 -0000 1.99 *************** *** 155,161 **** } ! printf("\n *** %s ***\n Build date: %s\n http://www.olsr.org\n\n", ! SOFTWARE_VERSION, ! __DATE__); /* Using PID as random seed */ --- 155,162 ---- } ! printf("\n *** %s ***\n Build date: %s on %s\n http://www.olsr.org\n\n", ! olsrd_version, ! build_date, ! build_host); /* Using PID as random seed */ *************** *** 334,344 **** if(olsr_cnf->ip_version == AF_INET6) { ! OLSR_PRINTF(1, "Using IP version 6\n"); olsr_cnf->ipsize = sizeof(struct in6_addr); } else { ! OLSR_PRINTF(1, "Using IP version 4\n"); ! olsr_cnf->ipsize = sizeof(olsr_u32_t); } --- 335,347 ---- if(olsr_cnf->ip_version == AF_INET6) { ! OLSR_PRINTF(1, "Using IP version %d\n", 6); olsr_cnf->ipsize = sizeof(struct in6_addr); + olsr_cnf->maxplen = 128; } else { ! OLSR_PRINTF(1, "Using IP version %d\n", 4); ! olsr_cnf->ipsize = sizeof(struct in_addr); ! olsr_cnf->maxplen = 32; } *************** *** 383,387 **** if((olsr_cnf->debug_level == 0) && (!olsr_cnf->no_fork)) { ! printf("%s detaching from the current process...\n", SOFTWARE_VERSION); if(daemon(0, 0) < 0) { --- 386,390 ---- if((olsr_cnf->debug_level == 0) && (!olsr_cnf->no_fork)) { ! printf("%s detaching from the current process...\n", olsrd_version); if(daemon(0, 0) < 0) { *************** *** 398,402 **** /* Start syslog entry */ ! olsr_syslog(OLSR_LOG_INFO, "%s successfully started", SOFTWARE_VERSION); /* --- 401,405 ---- /* Start syslog entry */ ! olsr_syslog(OLSR_LOG_INFO, "%s successfully started", olsrd_version); /* *************** *** 512,518 **** #endif ! olsr_syslog(OLSR_LOG_INFO, "%s stopped", SOFTWARE_VERSION); ! OLSR_PRINTF(1, "\n <<<< %s - terminating >>>>\n http://www.olsr.org\n", SOFTWARE_VERSION); exit(olsr_cnf->exit_value); --- 515,521 ---- #endif ! olsr_syslog(OLSR_LOG_INFO, "%s stopped", olsrd_version); ! OLSR_PRINTF(1, "\n <<<< %s - terminating >>>>\n http://www.olsr.org\n", olsrd_version); exit(olsr_cnf->exit_value); Index: olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** olsr.c 5 Sep 2007 16:11:11 -0000 1.57 --- olsr.c 16 Sep 2007 21:20:16 -0000 1.58 *************** *** 157,161 **** { clear_console(); ! printf("%s", OLSRD_VERSION_DATE); } --- 157,161 ---- { clear_console(); ! printf(" *** %s (%s on %s) ***\n", olsrd_version, build_date, build_host); } Index: routing_table.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** routing_table.h 12 Sep 2007 23:40:47 -0000 1.21 --- routing_table.h 16 Sep 2007 21:20:17 -0000 1.22 *************** *** 163,167 **** void olsr_print_routing_table(struct avl_tree *); ! struct rt_nexthop * olsr_get_nh(struct rt_entry *); struct rt_path * --- 163,167 ---- void olsr_print_routing_table(struct avl_tree *); ! const struct rt_nexthop * olsr_get_nh(const struct rt_entry *); struct rt_path * *************** *** 172,176 **** struct rt_entry * ! olsr_lookup_routing_table(union olsr_ip_addr *); --- 172,176 ---- struct rt_entry * ! olsr_lookup_routing_table(const union olsr_ip_addr *); From (spam-protected) Sun Sep 16 23:20:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 21:20:09 +0000 Subject: [Olsr-cvs] olsrd-current Makefile, 1.96, 1.97 Makefile.inc, 1.29, 1.30 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8566 Modified Files: Makefile Makefile.inc Log Message: * creating builddata.c containing build time information as date+time, host and version and using it througout * activated links in the httpinfo plugin again if we have host links other minor HTML cleanups there * replaced the olsr_host_rt_maxplen() function with a field in "struct olsr_cfg" similar to "ipsize" Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** Makefile 13 Sep 2007 22:50:28 -0000 1.96 --- Makefile 16 Sep 2007 21:20:06 -0000 1.97 *************** *** 43,48 **** include Makefile.inc - CPPFLAGS += -DVERSION=\"$(VERS)\" - # pass generated variables to save time MAKECMD = $(MAKE) OS="$(OS)" WARNINGS="$(WARNINGS)" --- 43,46 ---- *************** *** 62,66 **** default_target: cfgparser $(EXENAME) ! $(EXENAME): $(OBJS) $(CFGOBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(CFGOBJS) $(LIBS) --- 60,64 ---- default_target: cfgparser $(EXENAME) ! $(EXENAME): $(OBJS) $(CFGOBJS) src/builddata.o $(CC) $(LDFLAGS) -o $@ $(OBJS) $(CFGOBJS) $(LIBS) *************** *** 74,81 **** $(MAKECMD) -C $(CFGDIR) .PHONY: help libs clean_libs libs_clean clean uberclean install_libs libs_install install_bin install_olsrd install build_all install_all clean_all clean: ! -rm -f $(OBJS) $(SRCS:%.c=%.d) $(EXENAME) $(EXENAME).exe ifeq ($(OS), win32) -rm -f libolsrd.a --- 72,89 ---- $(MAKECMD) -C $(CFGDIR) + # generate it always + .PHONY: src/builddata.c + src/builddata.c: + @$(RM) "$@" + @echo "#include \"defs.h\"" >> "$@" + @echo "const char olsrd_version[] = \"olsr.org - $(VERS)\";" >> "$@" + @date +"const char build_date[] = \"%Y-%m-%d %H:%M:%S\";" >> "$@" + @echo "const char build_host[] = \"$(shell hostname)\";" >> "$@" + + .PHONY: help libs clean_libs libs_clean clean uberclean install_libs libs_install install_bin install_olsrd install build_all install_all clean_all clean: ! -rm -f $(OBJS) $(SRCS:%.c=%.d) $(EXENAME) $(EXENAME).exe src/builddata.c ifeq ($(OS), win32) -rm -f libolsrd.a Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Makefile.inc 7 Sep 2007 09:07:25 -0000 1.29 --- Makefile.inc 16 Sep 2007 21:20:06 -0000 1.30 *************** *** 45,49 **** WARNINGS += -Winline WARNINGS += -Wdisabled-optimization ! #WARNINGS += -Werror WARNINGS := $(shell CC="$(CC)" $(TOPDIR)/gcc-warnings $(WARNINGS)) endif --- 45,49 ---- WARNINGS += -Winline WARNINGS += -Wdisabled-optimization ! WARNINGS += -Werror WARNINGS := $(shell CC="$(CC)" $(TOPDIR)/gcc-warnings $(WARNINGS)) endif From (spam-protected) Sun Sep 16 23:20:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 21:20:09 +0000 Subject: [Olsr-cvs] olsrd-current/gui/linux-gtk/src common.h, 1.3, 1.4 interface.c, 1.5, 1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8566/gui/linux-gtk/src Modified Files: common.h interface.c Log Message: * creating builddata.c containing build time information as date+time, host and version and using it througout * activated links in the httpinfo plugin again if we have host links other minor HTML cleanups there * replaced the olsr_host_rt_maxplen() function with a field in "struct olsr_cfg" similar to "ipsize" Index: common.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/common.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** common.h 17 Nov 2004 20:01:57 -0000 1.3 --- common.h 16 Sep 2007 21:20:07 -0000 1.4 *************** *** 39,43 **** #include "olsr_protocol.h" ! #define SOFTWARE_VERSION "olsr.org GUI 0.2.7" #define IPC_INTERVAL 500 //interval for IPC read timeout #define MAXPACKS 20 --- 39,43 ---- #include "olsr_protocol.h" ! #define olsrd_version "olsr.org GUI 0.2.7" #define IPC_INTERVAL 500 //interval for IPC read timeout #define MAXPACKS 20 Index: interface.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/interface.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** interface.c 29 Mar 2005 19:07:59 -0000 1.5 --- interface.c 16 Sep 2007 21:20:07 -0000 1.6 *************** *** 107,111 **** main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_object_set_data (GTK_OBJECT (main_window), "main_window", main_window); ! gtk_window_set_title (GTK_WINDOW (main_window), (SOFTWARE_VERSION)); gtk_window_set_default_size(GTK_WINDOW (main_window), 600, 550); gtk_signal_connect(GTK_OBJECT(main_window), --- 107,111 ---- main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_object_set_data (GTK_OBJECT (main_window), "main_window", main_window); ! gtk_window_set_title (GTK_WINDOW (main_window), (olsrd_version)); gtk_window_set_default_size(GTK_WINDOW (main_window), 600, 550); gtk_signal_connect(GTK_OBJECT(main_window), *************** *** 1254,1258 **** gtk_label_set_text((GtkLabel *)net_label, "Connected"); ! strcat(title, SOFTWARE_VERSION); strcat(title, " - "); strcat(title, ip_to_string(&main_addr)); --- 1254,1258 ---- gtk_label_set_text((GtkLabel *)net_label, "Connected"); ! strcat(title, olsrd_version); strcat(title, " - "); strcat(title, ip_to_string(&main_addr)); From (spam-protected) Sun Sep 16 23:20:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 21:20:09 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src html.h, 1.7, 1.8 olsrd_httpinfo.c, 1.76, 1.77 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8566/lib/httpinfo/src Modified Files: html.h olsrd_httpinfo.c Log Message: * creating builddata.c containing build time information as date+time, host and version and using it througout * activated links in the httpinfo plugin again if we have host links other minor HTML cleanups there * replaced the olsr_host_rt_maxplen() function with a field in "struct olsr_cfg" similar to "ipsize" Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** olsrd_httpinfo.c 13 Sep 2007 16:08:12 -0000 1.76 --- olsrd_httpinfo.c 16 Sep 2007 21:20:07 -0000 1.77 *************** *** 88,92 **** #endif ! static char copyright_string[] = "olsr.org HTTPINFO plugin Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) All rights reserved."; #define MAX_CLIENTS 3 --- 88,92 ---- #endif ! static char copyright_string[] __attribute__((unused)) = "olsr.org HTTPINFO plugin Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) All rights reserved."; #define MAX_CLIENTS 3 *************** *** 96,100 **** #define DEFAULT_TCP_PORT 1978 ! #define HTML_BUFSIZE (1024 * 400) #define FRAMEWIDTH 800 --- 96,100 ---- #define DEFAULT_TCP_PORT 1978 ! #define HTML_BUFSIZE (1024 * 4000) #define FRAMEWIDTH 800 *************** *** 232,236 **** olsrd_plugin_init(void) { - (void)copyright_string; /* Get start time */ gettimeofday(&start_time, NULL); --- 232,235 ---- *************** *** 679,692 **** } ! static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, ! const union olsr_ip_addr * const ipaddr, const int prefix_len) { int size = 0; ! if (want_link && prefix_len == -1) { /* Print the link only if there is no prefix_len */ ! size += snprintf(&buf[size], ! bufsize-size, ! "", ! olsr_ip_to_string(ipaddr), ! http_port); } --- 678,701 ---- } ! static int fmt_href(char *buf, ! const olsr_u32_t bufsize, ! const union olsr_ip_addr * const ipaddr) ! { ! return snprintf(buf, bufsize, ! "", ! olsr_ip_to_string(ipaddr), ! http_port); ! ! } ! ! static int build_ip_txt(char *buf, ! const olsr_u32_t bufsize, ! const olsr_bool print_link, ! const union olsr_ip_addr * const ipaddr, ! const int prefix_len) { int size = 0; ! if (print_link) { /* Print the link only if there is no prefix_len */ ! size += fmt_href(&buf[size], bufsize-size, ipaddr); } *************** *** 699,703 **** } ! if (want_link && prefix_len == -1) { /* Print the link only if there is no prefix_len */ size += snprintf(&buf[size], bufsize-size, ""); } --- 708,712 ---- } ! if (print_link) { /* Print the link only if there is no prefix_len */ size += snprintf(&buf[size], bufsize-size, ""); } *************** *** 716,722 **** #endif NULL; size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ip_txt(&buf[size], bufsize-size, want_link, ipaddr, prefix_len); size += snprintf(&buf[size], bufsize-size, ""); --- 725,732 ---- #endif NULL; + const int print_link = want_link && (prefix_len == -1 || prefix_len == olsr_cnf->maxplen); size += snprintf(&buf[size], bufsize-size, ""); ! size += build_ip_txt(&buf[size], bufsize-size, print_link, ipaddr, prefix_len); size += snprintf(&buf[size], bufsize-size, ""); *************** *** 724,728 **** --- 734,744 ---- if (hp) { size += snprintf(&buf[size], bufsize-size, "("); + if (print_link) { + size += fmt_href(&buf[size], bufsize-size, ipaddr); + } size += snprintf(&buf[size], bufsize-size, "%s", hp->h_name); + if (print_link) { + size += snprintf(&buf[size], bufsize-size, ""); + } size += snprintf(&buf[size], bufsize-size, ")"); } else { *************** *** 782,819 **** static int build_config_body(char *buf, olsr_u32_t bufsize) { - char systime[100]; - time_t currtime; int size = 0; struct olsr_if *ifs; struct plugin_entry *pentry; struct plugin_param *pparam; - struct timeval now, uptime; - int hours, mins, days; ! gettimeofday(&now, NULL); ! timersub(&now, &start_time, &uptime); ! days = uptime.tv_sec/86400; ! uptime.tv_sec -= days*86400; ! hours = uptime.tv_sec/3600; ! uptime.tv_sec -= hours*3600; ! mins = uptime.tv_sec/60; ! uptime.tv_sec -= mins*60; ! ! time(&currtime); ! strftime(systime, 100, "System time: %a, %d %b %Y %H:%M:%S
", localtime(&currtime)); ! size += snprintf(&buf[size], bufsize-size, "OS: %s\n
", OS); ! size += snprintf(&buf[size], bufsize-size, "%s\n", systime); ! if(days) ! size += snprintf(&buf[size], bufsize-size, "Olsrd uptime: %d day(s) %02d hours %02d minutes %02d seconds
\n", days, hours, mins, (int)uptime.tv_sec); ! else ! size += snprintf(&buf[size], bufsize-size, "Olsrd uptime: %02d hours %02d minutes %02d seconds
\n", hours, mins, (int)uptime.tv_sec); ! size += snprintf(&buf[size], bufsize-size, "HTTP stats(ok/dyn/error/illegal): %d/%d/%d/%d
\n", stats.ok_hits, stats.dyn_hits, stats.err_hits, stats.ill_hits); ! size += snprintf(&buf[size], bufsize-size, "Click here to generate a configuration file for this node.\n"); size += snprintf(&buf[size], bufsize-size, "

Variables

\n"); --- 798,840 ---- static int build_config_body(char *buf, olsr_u32_t bufsize) { int size = 0; struct olsr_if *ifs; struct plugin_entry *pentry; struct plugin_param *pparam; ! size += snprintf(&buf[size], bufsize-size, "Version: %s (built on %s on %s)\n
", olsrd_version, build_date, build_host); ! size += snprintf(&buf[size], bufsize-size, "OS: %s\n
", OS); + { + time_t currtime = time(NULL); + int rc = strftime(&buf[size], bufsize-size, "System time: %a, %d %b %Y %H:%M:%S
", localtime(&currtime)); + if (rc > 0) { + size += rc; + } + } ! { ! struct timeval now, uptime; ! int hours, mins, days; ! gettimeofday(&now, NULL); ! timersub(&now, &start_time, &uptime); ! days = uptime.tv_sec/86400; ! uptime.tv_sec %= 86400; ! hours = uptime.tv_sec/3600; ! uptime.tv_sec %= 3600; ! mins = uptime.tv_sec/60; ! uptime.tv_sec %= 60; ! size += snprintf(&buf[size], bufsize-size, "Olsrd uptime: "); ! if (days) { ! size += snprintf(&buf[size], bufsize-size, "%d day(s) ", days); ! } ! size += snprintf(&buf[size], bufsize-size, "%02d hours %02d minutes %02d seconds
\n", hours, mins, (int)uptime.tv_sec); ! } ! size += snprintf(&buf[size], bufsize-size, "HTTP stats(ok/dyn/error/illegal): %d/%d/%d/%d
\n", stats.ok_hits, stats.dyn_hits, stats.err_hits, stats.ill_hits); ! size += snprintf(&buf[size], bufsize-size, "Click here to generate a configuration file for this node.\n"); size += snprintf(&buf[size], bufsize-size, "

Variables

\n"); *************** *** 910,916 **** if(olsr_cnf->allow_no_interfaces) ! size += snprintf(&buf[size], bufsize-size, "Olsrd is configured to run even if no interfaces are available
\n"); else ! size += snprintf(&buf[size], bufsize-size, "Olsrd is configured to halt if no interfaces are available
\n"); size += snprintf(&buf[size], bufsize-size, "

Plugins

\n"); --- 931,937 ---- if(olsr_cnf->allow_no_interfaces) ! size += snprintf(&buf[size], bufsize-size, "Olsrd is configured to run even if no interfaces are available
\n"); else ! size += snprintf(&buf[size], bufsize-size, "Olsrd is configured to halt if no interfaces are available
\n"); size += snprintf(&buf[size], bufsize-size, "

Plugins

\n"); *************** *** 1166,1176 **** static int build_about_body(char *buf, olsr_u32_t bufsize) { ! int size = 0, i = 0; ! ! while(about_frame[i]) { ! size += snprintf(&buf[size], bufsize-size, about_frame[i]); ! i++; ! } ! return size; } --- 1187,1191 ---- static int build_about_body(char *buf, olsr_u32_t bufsize) { ! return snprintf(buf, bufsize, about_frame, build_date, build_host); } Index: html.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/html.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** html.h 4 Feb 2007 22:37:36 -0000 1.7 --- html.h 16 Sep 2007 21:20:07 -0000 1.8 *************** *** 126,131 **** - - static const char *http_ok_tail[] = { --- 126,129 ---- *************** *** 133,137 **** "
\n\n", "

\n", ! "(C)2005 Andreas Tønnesen
\n", "http://www.olsr.org\n", "
\n", --- 131,135 ---- "
\n\n", "

\n", ! "(C)2005 Andreas Tønnesen
\n", "http://www.olsr.org\n", "
\n", *************** *** 144,199 **** { "\n\n", ! "This is a automatically generated configuration\n", ! "file based on the current olsrd configuration of this node.
\n", ! "
\n", "
\n",
      "",
!     "
\n
\n", NULL }; ! static const char *about_frame[] = { ! "" PLUGIN_NAME " version " PLUGIN_VERSION "
\n" ! "by Andreas Tønnesen (C)2005.
\n", #ifdef ADMIN_INTERFACE ! "Compiled with experimental admin interface " __DATE__ "
\n" ! #else ! "Compiled " __DATE__ "
\n" #endif ! "This plugin implements a HTTP server that supplies\n", ! "the client with various dynamic web pages representing\n", ! "the current olsrd status.
The different pages include:\n", ! "
    \n
  • Configuration - This page displays information\n", ! "about the current olsrd configuration. This includes various\n", ! "olsr settings such as IP version, MID/TC redundancy, hysteresis\n", ! "etc. Information about the current status of the interfaces on\n", ! "which olsrd is configured to run is also displayed. Loaded olsrd\n", ! "plugins are shown with their plugin parameters. Finally all local\n", ! "HNA entries are shown. These are the networks that the local host\n", ! "will anounce itself as a gateway to.
  • \n", ! "
  • Routes - This page displays all routes currently set in\n", ! "the kernel by olsrd. The type of route is also displayed(host\n", ! "or HNA).
  • \n", ! "
  • Links/Topology - This page displays all information about\n", ! "links, neighbors, topology, MID and HNA entries.
  • \n", ! "
  • All - Here all the previous pages are displayed as one.\n", ! "This is to make all information available as easy as possible(for example\n", ! "for a script) and using as few resources as possible.
  • \n", #ifdef ADMIN_INTERFACE ! "
  • Admin - This page is highly experimental(and unsecure)!\n", ! "As of now it is not working at all but it provides a impression of\n", ! "the future possibilities of httpinfo. This is to be a interface to\n", "changing olsrd settings in realtime. These settings include various\n" ! "\"basic\" settings and local HNA settings.\n", #endif ! "
  • About - this help page.
  • \n
", ! "
\n", ! "Send questions or comments to\n", ! "olsr-users at olsr.org or\n", ! "andreto-at-olsr.org
\n" ! "Official olsrd homepage: http://www.olsr.org
\n", ! NULL }; --- 142,196 ---- { "\n\n", ! "This is a automatically generated configuration\n", ! "file based on the current olsrd configuration of this node.
\n", ! "
\n", "
\n",
      "",
!     "
\n
\n", NULL }; ! static const char about_frame[] = { ! "" PLUGIN_NAME " version " PLUGIN_VERSION "
\n" ! "by Andreas Tønnesen (C)2005.
\n" ! "Compiled " #ifdef ADMIN_INTERFACE ! "with experimental admin interface " #endif ! "%s at %s
\n" ! "This plugin implements a HTTP server that supplies\n" ! "the client with various dynamic web pages representing\n" ! "the current olsrd status.
The different pages include:\n" ! "
    \n
  • Configuration - This page displays information\n" ! "about the current olsrd configuration. This includes various\n" ! "olsr settings such as IP version, MID/TC redundancy, hysteresis\n" ! "etc. Information about the current status of the interfaces on\n" ! "which olsrd is configured to run is also displayed. Loaded olsrd\n" ! "plugins are shown with their plugin parameters. Finally all local\n" ! "HNA entries are shown. These are the networks that the local host\n" ! "will anounce itself as a gateway to.
  • \n" ! "
  • Routes - This page displays all routes currently set in\n" ! "the kernel by olsrd. The type of route is also displayed(host\n" ! "or HNA).
  • \n" ! "
  • Links/Topology - This page displays all information about\n" ! "links, neighbors, topology, MID and HNA entries.
  • \n" ! "
  • All - Here all the previous pages are displayed as one.\n" ! "This is to make all information available as easy as possible(for example\n" ! "for a script) and using as few resources as possible.
  • \n" #ifdef ADMIN_INTERFACE ! "
  • Admin - This page is highly experimental(and unsecure)!\n" ! "As of now it is not working at all but it provides a impression of\n" ! "the future possibilities of httpinfo. This is to be a interface to\n" "changing olsrd settings in realtime. These settings include various\n" ! "\"basic\" settings and local HNA settings.
  • \n" #endif ! "
  • About - this help page.
  • \n
" ! "
\n" ! "Send questions or comments to\n" ! "olsr-users at olsr.org or\n" ! "andreto-at-olsr.org
\n" ! "Official olsrd homepage: http://www.olsr.org
\n" }; From (spam-protected) Sun Sep 16 23:45:27 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 21:45:27 +0000 Subject: [Olsr-cvs] olsrd-current/src link_set.c,1.71,1.72 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21093/src Modified Files: link_set.c Log Message: applied patch by Andreas Jacobs fixing the broken window size calculation. I'm taking this solution as it is the (IMHO) most consistent one. Index: link_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** link_set.c 11 Sep 2007 23:49:02 -0000 1.71 --- link_set.c 16 Sep 2007 21:45:25 -0000 1.72 *************** *** 1046,1050 **** (float)(entry->total_packets - entry->lost_packets) / (float)(entry->loss_window_size < (2 * 4) ? entry->loss_window_size: ! 4 * ((entry->loss_window_size / 4 - 1) * entry->total_packets + entry->loss_window_size) / entry->loss_window_size); // multiply the calculated link quality with the user-specified multiplier --- 1046,1050 ---- (float)(entry->total_packets - entry->lost_packets) / (float)(entry->loss_window_size < (2 * 4) ? entry->loss_window_size: ! 4 * (((float)entry->loss_window_size / 4 - 1) * entry->total_packets + entry->loss_window_size) / entry->loss_window_size); // multiply the calculated link quality with the user-specified multiplier From (spam-protected) Sun Sep 16 23:45:27 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 21:45:27 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.86,1.87 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21093 Modified Files: CHANGELOG Log Message: applied patch by Andreas Jacobs fixing the broken window size calculation. I'm taking this solution as it is the (IMHO) most consistent one. Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** CHANGELOG 13 Sep 2007 16:08:12 -0000 1.86 --- CHANGELOG 16 Sep 2007 21:45:25 -0000 1.87 *************** *** 139,142 **** --- 139,145 ---- - do not require /bin/bash, use /bin/sh + PATCH by Andreas Jacobs + - fix the loss link quality calculation for "windows size % 4 != 0" + PATCHES and CLEANUPS by Bernd Petrovitsch - Made a function from the ME_TO_DOUBLE() macro (in src/mantissa.h). From (spam-protected) Sun Sep 16 23:50:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 21:50:19 +0000 Subject: [Olsr-cvs] olsrd-current Makefile,1.97,1.98 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23520 Modified Files: Makefile Log Message: * include all .o files on the commandline Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** Makefile 16 Sep 2007 21:20:06 -0000 1.97 --- Makefile 16 Sep 2007 21:50:17 -0000 1.98 *************** *** 61,65 **** $(EXENAME): $(OBJS) $(CFGOBJS) src/builddata.o ! $(CC) $(LDFLAGS) -o $@ $(OBJS) $(CFGOBJS) $(LIBS) cfgparser: $(CFGDEPS) --- 61,65 ---- $(EXENAME): $(OBJS) $(CFGOBJS) src/builddata.o ! $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) cfgparser: $(CFGDEPS) From (spam-protected) Mon Sep 17 00:11:32 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 22:11:32 +0000 Subject: [Olsr-cvs] olsrd-current/src olsrd_plugin.h,1.4,1.5 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31909/src Modified Files: olsrd_plugin.h Log Message: * make the typedef a function (and not a pointer) so we can use it for function prototypes Index: olsrd_plugin.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsrd_plugin.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** olsrd_plugin.h 25 Aug 2007 19:48:42 -0000 1.4 --- olsrd_plugin.h 16 Sep 2007 22:11:30 -0000 1.5 *************** *** 79,87 **** /* Interface version 5 */ ! typedef int (*set_plugin_parameter)(const char *value, void *data, unsigned int addon); struct olsrd_plugin_parameters { const char *name; ! set_plugin_parameter set_plugin_parameter; void *data; unsigned int addon; --- 79,87 ---- /* Interface version 5 */ ! typedef int set_plugin_parameter(const char *value, void *data, unsigned int addon); struct olsrd_plugin_parameters { const char *name; ! set_plugin_parameter *set_plugin_parameter; void *data; unsigned int addon; From (spam-protected) Mon Sep 17 00:14:10 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 22:14:10 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_plugin.c, 1.18, 1.19 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv609/lib/httpinfo/src Modified Files: olsrd_plugin.c Log Message: * name set_boolean() similar to the other functions Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_plugin.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** olsrd_plugin.c 25 Aug 2007 19:48:42 -0000 1.18 --- olsrd_plugin.c 16 Sep 2007 22:14:08 -0000 1.19 *************** *** 107,111 **** { .name = "host", .set_plugin_parameter = &add_plugin_ipaddr, .data = &allowed_nets }, { .name = "net", .set_plugin_parameter = &add_plugin_ipnet, .data = &allowed_nets }, ! { .name = "resolve",.set_plugin_parameter = &set_boolean, .data = &resolve_ip_addresses }, }; --- 107,111 ---- { .name = "host", .set_plugin_parameter = &add_plugin_ipaddr, .data = &allowed_nets }, { .name = "net", .set_plugin_parameter = &add_plugin_ipnet, .data = &allowed_nets }, ! { .name = "resolve",.set_plugin_parameter = &set_plugin_boolean, .data = &resolve_ip_addresses }, }; From (spam-protected) Mon Sep 17 00:14:10 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 16 Sep 2007 22:14:10 +0000 Subject: [Olsr-cvs] olsrd-current/src plugin_util.h, 1.2, 1.3 plugin_util.c, 1.4, 1.5 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv609/src Modified Files: plugin_util.h plugin_util.c Log Message: * name set_boolean() similar to the other functions Index: plugin_util.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_util.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** plugin_util.c 2 Sep 2007 21:04:42 -0000 1.4 --- plugin_util.c 16 Sep 2007 22:14:08 -0000 1.5 *************** *** 87,96 **** ! int set_boolean(const char *value, void *data, unsigned int addon __attribute__((unused))) { int *v = data; ! if (strcasecmp (value, "yes") == 0) { *v = 1; ! } else if (strcasecmp (value, "no") == 0) { *v = 0; } else { --- 87,96 ---- ! int set_plugin_boolean(const char *value, void *data, unsigned int addon __attribute__((unused))) { int *v = data; ! if (strcasecmp (value, "yes") == 0 || strcasecmp (value, "true") == 0) { *v = 1; ! } else if (strcasecmp (value, "no") == 0 || strcasecmp (value, "false") == 0) { *v = 0; } else { Index: plugin_util.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_util.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** plugin_util.h 25 Aug 2007 19:48:42 -0000 1.2 --- plugin_util.h 16 Sep 2007 22:14:08 -0000 1.3 *************** *** 39,48 **** #define _OLSRD_PLUGIN_UTIL /* Common/utility functions for plugins */ ! int set_plugin_port(const char *value, void *data, unsigned int); ! int set_plugin_ipaddress(const char *value, void *data, unsigned int); ! int set_boolean(const char *value, void *data, unsigned int); ! int set_plugin_int(const char *value, void *data, unsigned int); ! int set_plugin_string(const char *value, void *data, unsigned int); --- 39,50 ---- #define _OLSRD_PLUGIN_UTIL + #include "olsrd_plugin.h" + /* Common/utility functions for plugins */ ! set_plugin_parameter set_plugin_port; ! set_plugin_parameter set_plugin_ipaddress; ! set_plugin_parameter set_plugin_boolean; ! set_plugin_parameter set_plugin_int; ! set_plugin_parameter set_plugin_string; From (spam-protected) Mon Sep 17 12:29:54 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 10:29:54 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.30,1.31 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29157 Modified Files: Makefile.inc Log Message: * ooops, accidently activated -Werror Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Makefile.inc 16 Sep 2007 21:20:06 -0000 1.30 --- Makefile.inc 17 Sep 2007 10:29:51 -0000 1.31 *************** *** 45,49 **** WARNINGS += -Winline WARNINGS += -Wdisabled-optimization ! WARNINGS += -Werror WARNINGS := $(shell CC="$(CC)" $(TOPDIR)/gcc-warnings $(WARNINGS)) endif --- 45,49 ---- WARNINGS += -Winline WARNINGS += -Wdisabled-optimization ! #WARNINGS += -Werror WARNINGS := $(shell CC="$(CC)" $(TOPDIR)/gcc-warnings $(WARNINGS)) endif From (spam-protected) Mon Sep 17 23:43:30 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:43:30 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.31,1.32 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5770 Modified Files: Makefile.inc Log Message: * added a comment to a commented out warning Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Makefile.inc 17 Sep 2007 10:29:51 -0000 1.31 --- Makefile.inc 17 Sep 2007 21:43:28 -0000 1.32 *************** *** 42,45 **** --- 42,46 ---- #WARNINGS += -Wredundant-decls WARNINGS += -Wnested-externs + # Alas, htons() triggers this so we can't seriously activate it. #WARNINGS += -Wunreachable-code WARNINGS += -Winline From (spam-protected) Mon Sep 17 23:44:17 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:44:17 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser Makefile,1.29,1.30 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5785/src/cfgparser Modified Files: Makefile Log Message: * removed -Wsign-compare for generated code * fixed the #line directives Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/Makefile,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Makefile 2 Aug 2007 19:59:15 -0000 1.29 --- Makefile 17 Sep 2007 21:44:15 -0000 1.30 *************** *** 96,106 **** -e '/^static/s/input[\(][\)]/input(void)/' \ -e '/^static *void *yy_fatal_error/s/^\(.*)\);$$/\1 __attribute__((noreturn));/' \ < oscan.c-tmp >oscan.c $(RM) oscan.c-tmp oparse.c: oparse.y olsrd_conf.h Makefile $(BISON) -d -o oparse.c oparse.y ! #oscan.o oparse.o:: CFLAGS := $(filter-out -Wunreachable-code, $(CFLAGS)) .PHONY: install clean uberclean --- 96,110 ---- -e '/^static/s/input[\(][\)]/input(void)/' \ -e '/^static *void *yy_fatal_error/s/^\(.*)\);$$/\1 __attribute__((noreturn));/' \ + -e '/^#line/s/$(subst .,\.,$@-tmp)/$@/' \ < oscan.c-tmp >oscan.c $(RM) oscan.c-tmp + oscan.o: CFLAGS := $(filter-out -Wunreachable-code -Wsign-compare, $(CFLAGS)) -Wno-sign-compare + oparse.c: oparse.y olsrd_conf.h Makefile $(BISON) -d -o oparse.c oparse.y ! oparse.o: CFLAGS := $(filter-out -Wunreachable-code, $(CFLAGS)) ! .PHONY: install clean uberclean From (spam-protected) Mon Sep 17 23:57:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:07 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.87,1.88 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901 Modified Files: CHANGELOG Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** CHANGELOG 16 Sep 2007 21:45:25 -0000 1.87 --- CHANGELOG 17 Sep 2007 21:57:05 -0000 1.88 *************** *** 129,132 **** --- 129,134 ---- This patch was modified/clenaed up by to use "#if" instead of "#ifdef" as it's more robust against typos. + - 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch + fixing the compilation warning on 64bit PATCH by Arnd Hannemann *************** *** 155,158 **** --- 157,162 ---- number of (free()s). And it also kills some code and copying around of data. + - Make it compile without warning with flex-2.5.33 (to be found on Fedora 7 + and Gentoo in Sep-2007) again. - converted the dyn_gw plugin to plugin interface version 5 (which leaves From (spam-protected) Mon Sep 17 23:57:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:07 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c,1.22,1.23 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/lib/dyn_gw/src Modified Files: olsrd_dyn_gw.c Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: olsrd_dyn_gw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** olsrd_dyn_gw.c 13 Sep 2007 15:41:12 -0000 1.22 --- olsrd_dyn_gw.c 17 Sep 2007 21:57:05 -0000 1.23 *************** *** 136,140 **** * read config file parameters */ ! static int set_plugin_double(const char *value, void *data, unsigned int addon __attribute__((unused))) { char *endptr; --- 136,140 ---- * read config file parameters */ ! static int set_plugin_double(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { char *endptr; *************** *** 154,158 **** } ! static int set_plugin_ping(const char *value, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { union olsr_ip_addr foo_addr; --- 154,158 ---- } ! static int set_plugin_ping(const char *value, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { union olsr_ip_addr foo_addr; *************** *** 177,181 **** } ! static int set_plugin_hna(const char *value, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { union olsr_ip_addr temp_net; --- 177,181 ---- } ! static int set_plugin_hna(const char *value, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { union olsr_ip_addr temp_net; From (spam-protected) Mon Sep 17 23:57:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:07 +0000 Subject: [Olsr-cvs] olsrd-current/lib/mini/src olsrd_plugin.c,1.4,1.5 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/mini/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/lib/mini/src Modified Files: olsrd_plugin.c Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/src/olsrd_plugin.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** olsrd_plugin.c 2 Sep 2007 21:37:49 -0000 1.4 --- olsrd_plugin.c 17 Sep 2007 21:57:05 -0000 1.5 *************** *** 63,67 **** ! static int set_plugin_test(const char *value, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { printf("\n*** MINI: parameter test: %s\n", value); --- 63,67 ---- ! static int set_plugin_test(const char *value, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { printf("\n*** MINI: parameter test: %s\n", value); From (spam-protected) Mon Sep 17 23:57:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:07 +0000 Subject: [Olsr-cvs] olsrd-current/lib/secure/src olsrd_plugin.c,1.14,1.15 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/secure/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/lib/secure/src Modified Files: olsrd_plugin.c Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/olsrd_plugin.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** olsrd_plugin.c 25 Aug 2007 19:48:42 -0000 1.14 --- olsrd_plugin.c 17 Sep 2007 21:57:05 -0000 1.15 *************** *** 91,98 **** } ! static int store_string(const char *value, void *data, unsigned int addon) { char *str = data; - if (addon) {} snprintf(str, FILENAME_MAX+1, "%s", value); return 0; --- 91,97 ---- } ! static int store_string(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { char *str = data; snprintf(str, FILENAME_MAX+1, "%s", value); return 0; From (spam-protected) Mon Sep 17 23:57:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:07 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_plugin.c, 1.19, 1.20 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/lib/httpinfo/src Modified Files: olsrd_plugin.c Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_plugin.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** olsrd_plugin.c 16 Sep 2007 22:14:08 -0000 1.19 --- olsrd_plugin.c 17 Sep 2007 21:57:05 -0000 1.20 *************** *** 65,70 **** static void my_fini(void) __attribute__ ((destructor)); ! static int add_plugin_ipnet(const char *value, void *data, unsigned int); ! static int add_plugin_ipaddr(const char *value, void *data, unsigned int); static int insert_plugin_ipnet(const char *sz_net, const char *sz_mask, struct allowed_net **allowed_nets); --- 65,70 ---- static void my_fini(void) __attribute__ ((destructor)); ! static int add_plugin_ipnet(const char *value, void *data, set_plugin_parameter_addon); ! static int add_plugin_ipaddr(const char *value, void *data, set_plugin_parameter_addon); static int insert_plugin_ipnet(const char *sz_net, const char *sz_mask, struct allowed_net **allowed_nets); *************** *** 141,148 **** } ! static int add_plugin_ipnet(const char *value, void *data, unsigned int addon) { char sz_net[100], sz_mask[100]; /* IPv6 in the future */ - if (addon) {} if(sscanf(value, "%99s %99s", sz_net, sz_mask) != 2) { --- 141,147 ---- } ! static int add_plugin_ipnet(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { char sz_net[100], sz_mask[100]; /* IPv6 in the future */ if(sscanf(value, "%99s %99s", sz_net, sz_mask) != 2) { *************** *** 153,159 **** } ! static int add_plugin_ipaddr(const char *value, void *data, unsigned int addon) { - if (addon) {} return insert_plugin_ipnet(value, "255.255.255.255", data); } --- 152,157 ---- } ! static int add_plugin_ipaddr(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { return insert_plugin_ipnet(value, "255.255.255.255", data); } From (spam-protected) Mon Sep 17 23:57:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:07 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Address.c, 1.7, 1.8 Address.h, 1.6, 1.7 NetworkInterfaces.c, 1.9, 1.10 NetworkInterfaces.h, 1.6, 1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/lib/bmf/src Modified Files: Address.c Address.h NetworkInterfaces.c NetworkInterfaces.h Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: Address.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Address.c 11 Sep 2007 23:22:38 -0000 1.7 --- Address.c 17 Sep 2007 21:57:05 -0000 1.8 *************** *** 69,73 **** * Data Used : none * ------------------------------------------------------------------------- */ ! int DoLocalBroadcast(const char* enable, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (strcmp(enable, "yes") == 0) --- 69,73 ---- * Data Used : none * ------------------------------------------------------------------------- */ ! int DoLocalBroadcast(const char* enable, void* data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { if (strcmp(enable, "yes") == 0) Index: Address.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Address.h 11 Sep 2007 23:22:38 -0000 1.6 --- Address.h 17 Sep 2007 21:57:05 -0000 1.7 *************** *** 42,45 **** --- 42,46 ---- #include "olsr_types.h" /* olsr_ip_addr */ + #include "olsrd_plugin.h" /* union set_plugin_parameter_addon */ #include "interfaces.h" /* struct interface */ *************** *** 48,52 **** extern int EnableLocalBroadcast; ! int DoLocalBroadcast(const char* enable, void* data, unsigned int addon); int IsMulticast(union olsr_ip_addr* ipAddress); int IsOlsrOrBmfPacket(unsigned char* ipPacket); --- 49,53 ---- extern int EnableLocalBroadcast; ! int DoLocalBroadcast(const char* enable, void* data, set_plugin_parameter_addon addon); int IsMulticast(union olsr_ip_addr* ipAddress); int IsOlsrOrBmfPacket(unsigned char* ipPacket); Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NetworkInterfaces.c 13 Sep 2007 15:31:58 -0000 1.9 --- NetworkInterfaces.c 17 Sep 2007 21:57:05 -0000 1.10 *************** *** 128,132 **** * Data Used : EtherTunTapIfName * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceName(const char* ifname, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { strncpy(EtherTunTapIfName, ifname, IFNAMSIZ - 1); --- 128,132 ---- * Data Used : EtherTunTapIfName * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceName(const char* ifname, void* data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { strncpy(EtherTunTapIfName, ifname, IFNAMSIZ - 1); *************** *** 147,151 **** * TunTapIpOverruled * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceIp(const char* ip, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { #define IPV4_MAX_ADDRLEN 16 --- 147,151 ---- * TunTapIpOverruled * ------------------------------------------------------------------------- */ ! int SetBmfInterfaceIp(const char* ip, void* data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { #define IPV4_MAX_ADDRLEN 16 *************** *** 217,221 **** * Data Used : none * ------------------------------------------------------------------------- */ ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (strcmp(enable, "yes") == 0) --- 217,221 ---- * Data Used : none * ------------------------------------------------------------------------- */ ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { if (strcmp(enable, "yes") == 0) *************** *** 245,249 **** * Data Used : none * ------------------------------------------------------------------------- */ ! int SetBmfMechanism(const char* mechanism, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (strcmp(mechanism, "Broadcast") == 0) --- 245,249 ---- * Data Used : none * ------------------------------------------------------------------------- */ ! int SetBmfMechanism(const char* mechanism, void* data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { if (strcmp(mechanism, "Broadcast") == 0) *************** *** 1770,1774 **** * Data Used : NonOlsrIfNames * ------------------------------------------------------------------------- */ ! int AddNonOlsrBmfIf(const char* ifName, void* data __attribute__((unused)), unsigned int addon __attribute__((unused))) { assert(ifName != NULL); --- 1770,1774 ---- * Data Used : NonOlsrIfNames * ------------------------------------------------------------------------- */ ! int AddNonOlsrBmfIf(const char* ifName, void* data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { assert(ifName != NULL); Index: NetworkInterfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NetworkInterfaces.h 11 Sep 2007 23:22:38 -0000 1.6 --- NetworkInterfaces.h 17 Sep 2007 21:57:05 -0000 1.7 *************** *** 46,49 **** --- 46,50 ---- /* OLSR includes */ #include "olsr_types.h" /* olsr_ip_addr */ + #include "olsrd_plugin.h" /* union set_plugin_parameter_addon */ /* Plugin includes */ *************** *** 121,128 **** extern enum TBmfMechanism BmfMechanism; ! int SetBmfInterfaceName(const char* ifname, void* data, unsigned int addon); ! int SetBmfInterfaceIp(const char* ip, void* data, unsigned int addon); ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data, unsigned int addon); ! int SetBmfMechanism(const char* mechanism, void* data, unsigned int addon); int DeactivateSpoofFilter(void); void RestoreSpoofFilter(void); --- 122,129 ---- extern enum TBmfMechanism BmfMechanism; ! int SetBmfInterfaceName(const char* ifname, void* data, set_plugin_parameter_addon addon); ! int SetBmfInterfaceIp(const char* ip, void* data, set_plugin_parameter_addon addon); ! int SetCapturePacketsOnOlsrInterfaces(const char* enable, void* data, set_plugin_parameter_addon addon); ! int SetBmfMechanism(const char* mechanism, void* data, set_plugin_parameter_addon addon); int DeactivateSpoofFilter(void); void RestoreSpoofFilter(void); *************** *** 144,148 **** void AddInterface(struct interface* newIntf); void CloseBmfNetworkInterfaces(void); ! int AddNonOlsrBmfIf(const char* ifName, void* data, unsigned int addon); int IsNonOlsrBmfIf(const char* ifName); void CheckAndUpdateLocalBroadcast(unsigned char* ipPacket, union olsr_ip_addr* broadAddr); --- 145,149 ---- void AddInterface(struct interface* newIntf); void CloseBmfNetworkInterfaces(void); ! int AddNonOlsrBmfIf(const char* ifName, void* data, set_plugin_parameter_addon addon); int IsNonOlsrBmfIf(const char* ifName); void CheckAndUpdateLocalBroadcast(unsigned char* ipPacket, union olsr_ip_addr* broadAddr); From (spam-protected) Mon Sep 17 23:57:08 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:08 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas test.c,1.3,1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/lib/tas Modified Files: test.c Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: test.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test.c 2 Sep 2007 22:17:00 -0000 1.3 --- test.c 17 Sep 2007 21:57:05 -0000 1.4 *************** *** 89,93 **** } ! if (httpSetAddress(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set address\n"); --- 89,93 ---- } ! if (httpSetAddress(av[i], NULL, (set_plugin_parameter_addon){0}) < 0) { fprintf(stderr, "cannot set address\n"); *************** *** 105,109 **** } ! if (httpSetPort(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set port\n"); --- 105,109 ---- } ! if (httpSetPort(av[i], NULL, (set_plugin_parameter_addon){0}) < 0) { fprintf(stderr, "cannot set port\n"); *************** *** 121,125 **** } ! if (httpSetWorkDir(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set work directory\n"); --- 121,125 ---- } ! if (httpSetWorkDir(av[i], NULL, (set_plugin_parameter_addon){0}) < 0) { fprintf(stderr, "cannot set work directory\n"); *************** *** 137,141 **** } ! if (httpSetRootDir(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set root directory\n"); --- 137,141 ---- } ! if (httpSetRootDir(av[i], NULL, (set_plugin_parameter_addon){0}) < 0) { fprintf(stderr, "cannot set root directory\n"); *************** *** 153,157 **** } ! httpSetIndexFile(av[i], NULL, 0); } --- 153,157 ---- } ! httpSetIndexFile(av[i], NULL, (set_plugin_parameter_addon){0}); } *************** *** 165,169 **** } ! httpSetUser(av[i], NULL, 0); } --- 165,169 ---- } ! httpSetUser(av[i], NULL, (set_plugin_parameter_addon){0}); } *************** *** 177,181 **** } ! httpSetPassword(av[i], NULL, 0); } --- 177,181 ---- } ! httpSetPassword(av[i], NULL, (set_plugin_parameter_addon){0}); } *************** *** 189,193 **** } ! if (httpSetSessTime(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set session timeout\n"); --- 189,193 ---- } ! if (httpSetSessTime(av[i], NULL, (set_plugin_parameter_addon){0}) < 0) { fprintf(stderr, "cannot set session timeout\n"); *************** *** 205,209 **** } ! httpSetPubDir(av[i], NULL, 0); } --- 205,209 ---- } ! httpSetPubDir(av[i], NULL, (set_plugin_parameter_addon){0}); } *************** *** 217,221 **** } ! if (httpSetQuantum(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set quantum\n"); --- 217,221 ---- } ! if (httpSetQuantum(av[i], NULL, (set_plugin_parameter_addon){0}) < 0) { fprintf(stderr, "cannot set quantum\n"); *************** *** 233,237 **** } ! if (httpSetMessTime(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set message timeout\n"); --- 233,237 ---- } ! if (httpSetMessTime(av[i], NULL, (set_plugin_parameter_addon){0}) < 0) { fprintf(stderr, "cannot set message timeout\n"); *************** *** 249,253 **** } ! if (httpSetMessLimit(av[i], NULL, 0) < 0) { fprintf(stderr, "cannot set message queue limit\n"); --- 249,253 ---- } ! if (httpSetMessLimit(av[i], NULL, (set_plugin_parameter_addon){0}) < 0) { fprintf(stderr, "cannot set message queue limit\n"); From (spam-protected) Mon Sep 17 23:57:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:07 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.29, 1.30 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/lib/nameservice/src Modified Files: nameservice.c Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** nameservice.c 13 Sep 2007 15:31:59 -0000 1.29 --- nameservice.c 17 Sep 2007 21:57:05 -0000 1.30 *************** *** 166,170 **** ! static int set_nameservice_server(const char *value, void *data, unsigned int addon) { union olsr_ip_addr ip; --- 166,170 ---- ! static int set_nameservice_server(const char *value, void *data, set_plugin_parameter_addon addon) { union olsr_ip_addr ip; *************** *** 172,176 **** if (0 == strlen(value)) { ! *v = add_name_to_list(*v, "", addon, NULL); OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value); return 0; --- 172,176 ---- if (0 == strlen(value)) { ! *v = add_name_to_list(*v, "", addon.ui, NULL); OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value); return 0; *************** *** 178,182 **** else if (0 < inet_pton(olsr_cnf->ip_version, value, &ip)) { ! *v = add_name_to_list(*v, "", addon, &ip); OLSR_PRINTF(1, "%s got %s\n", "Got", value); return 0; --- 178,182 ---- else if (0 < inet_pton(olsr_cnf->ip_version, value, &ip)) { ! *v = add_name_to_list(*v, "", addon.ui, &ip); OLSR_PRINTF(1, "%s got %s\n", "Got", value); return 0; *************** *** 189,198 **** } ! static int set_nameservice_name(const char *value, void *data, unsigned int addon) { struct name_entry **v = data; if (0 < strlen(value)) { ! *v = add_name_to_list(*v, (char*)value, addon, NULL); OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value); return 0; --- 189,198 ---- } ! static int set_nameservice_name(const char *value, void *data, set_plugin_parameter_addon addon) { struct name_entry **v = data; if (0 < strlen(value)) { ! *v = add_name_to_list(*v, (char*)value, addon.ui, NULL); OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value); return 0; *************** *** 205,230 **** } ! static int set_nameservice_host(const char *value, void *data, unsigned int addon) { union olsr_ip_addr ip; struct name_entry **v = data; ! if (0 < inet_pton(olsr_cnf->ip_version, (char*)addon, &ip)) { // the IP is validated later ! *v = add_name_to_list(*v, (char*)value, addon, &ip); ! OLSR_PRINTF(1, "%s: %s got %s\n", "Got", (char*) addon, value); return 0; } else { ! OLSR_PRINTF(0, "%s: Illegal IP address \"%s\"", (char*) addon, value); } return 1; } ! static int set_nameservice_float(const char *value, void *data, unsigned int addon) { const float thefloat = atof(value); - if (addon) {} if (data != NULL) { --- 205,229 ---- } ! static int set_nameservice_host(const char *value, void *data, set_plugin_parameter_addon addon) { union olsr_ip_addr ip; struct name_entry **v = data; ! if (0 < inet_pton(olsr_cnf->ip_version, addon.pc, &ip)) { // the IP is validated later ! *v = add_name_to_list(*v, (char*)value, NAME_HOST, &ip); ! OLSR_PRINTF(1, "%s: %s got %s\n", "Got", addon.pc, value); return 0; } else { ! OLSR_PRINTF(0, "%s: Illegal IP address \"%s\"", addon.pc, value); } return 1; } ! static int set_nameservice_float(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { const float thefloat = atof(value); if (data != NULL) { *************** *** 243,259 **** { .name = "interval", .set_plugin_parameter = &set_plugin_int, .data = &my_interval }, { .name = "timeout", .set_plugin_parameter = &set_nameservice_float, .data = &my_timeout }, ! { .name = "hosts-file", .set_plugin_parameter = &set_plugin_string, .data = &my_hosts_file, .addon = sizeof(my_hosts_file) }, ! { .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, .addon = NAME_HOST }, }; --- 242,258 ---- { .name = "interval", .set_plugin_parameter = &set_plugin_int, .data = &my_interval }, { .name = "timeout", .set_plugin_parameter = &set_nameservice_float, .data = &my_timeout }, ! { .name = "hosts-file", .set_plugin_parameter = &set_plugin_string, .data = &my_hosts_file, .addon = {sizeof(my_hosts_file)} }, ! { .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 }, }; *************** *** 1444,1448 **** struct tc_edge_entry *tc_edge; ! if (!latlon_table_changed) return; OLSR_PRINTF(2, "NAME PLUGIN: writing latlon file\n"); --- 1443,1449 ---- struct tc_edge_entry *tc_edge; ! if (!my_names || !latlon_table_changed) { ! return; ! } OLSR_PRINTF(2, "NAME PLUGIN: writing latlon file\n"); From (spam-protected) Mon Sep 17 23:57:08 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:08 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src http.c, 1.6, 1.7 http.h, 1.2, 1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/lib/tas/src Modified Files: http.c http.h Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: http.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** http.h 2 Sep 2007 22:17:00 -0000 1.2 --- http.h 17 Sep 2007 21:57:06 -0000 1.3 *************** *** 41,44 **** --- 41,46 ---- */ + #include "olsrd_plugin.h" /* union set_plugin_parameter_addon */ + #define CHUNK_SIZE 1024 *************** *** 118,133 **** extern void httpInit(void); ! extern int httpSetAddress(const char *addrStr, void *data, unsigned int addon); ! extern int httpSetPort(const char *portStr, void *data, unsigned int addon); ! extern int httpSetRootDir(const char *rootDir, void *data, unsigned int addon); ! extern int httpSetWorkDir(const char *workDir, void *data, unsigned int addon); ! extern int httpSetIndexFile(const char *indexFile, void *data, unsigned int addon); ! extern int httpSetUser(const char *user, void *data, unsigned int addon); ! extern int httpSetPassword(const char *password, void *data, unsigned int addon); ! extern int httpSetSessTime(const char *timeStr, void *data, unsigned int addon); ! extern int httpSetPubDir(const char *pref, void *data, unsigned int addon); ! extern int httpSetQuantum(const char *quantumStr, void *data, unsigned int addon); ! extern int httpSetMessTime(const char *timeStr, void *data, unsigned int addon); ! extern int httpSetMessLimit(const char *limitStr, void *data, unsigned int addon); extern int httpSetup(void); --- 120,135 ---- extern void httpInit(void); ! extern int httpSetAddress(const char *addrStr, void *data, set_plugin_parameter_addon addon); ! extern int httpSetPort(const char *portStr, void *data, set_plugin_parameter_addon addon); ! extern int httpSetRootDir(const char *rootDir, void *data, set_plugin_parameter_addon addon); ! extern int httpSetWorkDir(const char *workDir, void *data, set_plugin_parameter_addon addon); ! extern int httpSetIndexFile(const char *indexFile, void *data, set_plugin_parameter_addon addon); ! extern int httpSetUser(const char *user, void *data, set_plugin_parameter_addon addon); ! extern int httpSetPassword(const char *password, void *data, set_plugin_parameter_addon addon); ! extern int httpSetSessTime(const char *timeStr, void *data, set_plugin_parameter_addon addon); ! extern int httpSetPubDir(const char *pref, void *data, set_plugin_parameter_addon addon); ! extern int httpSetQuantum(const char *quantumStr, void *data, set_plugin_parameter_addon addon); ! extern int httpSetMessTime(const char *timeStr, void *data, set_plugin_parameter_addon addon); ! extern int httpSetMessLimit(const char *limitStr, void *data, set_plugin_parameter_addon addon); extern int httpSetup(void); Index: http.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** http.c 2 Sep 2007 22:17:00 -0000 1.6 --- http.c 17 Sep 2007 21:57:06 -0000 1.7 *************** *** 448,452 **** } ! int httpSetAddress(const char *addrStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (parseIpAddr(&confAddr, addrStr) < 0) --- 448,452 ---- } ! int httpSetAddress(const char *addrStr, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { if (parseIpAddr(&confAddr, addrStr) < 0) *************** *** 459,463 **** } ! int httpSetPort(const char *portStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int port; --- 459,463 ---- } ! int httpSetPort(const char *portStr, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { unsigned int port; *************** *** 480,484 **** } ! int httpSetRootDir(const char *rootDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (checkAbsPath(rootDir) < 0) --- 480,484 ---- } ! int httpSetRootDir(const char *rootDir, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { if (checkAbsPath(rootDir) < 0) *************** *** 492,496 **** } ! int httpSetWorkDir(const char *workDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { if (checkAbsPath(workDir) < 0) --- 492,496 ---- } ! int httpSetWorkDir(const char *workDir, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { if (checkAbsPath(workDir) < 0) *************** *** 504,508 **** } ! int httpSetIndexFile(const char *indexFile, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { confIndexFile = myStrdup(indexFile); --- 504,508 ---- } ! int httpSetIndexFile(const char *indexFile, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { confIndexFile = myStrdup(indexFile); *************** *** 510,514 **** } ! int httpSetUser(const char *user, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { confUser = myStrdup(user); --- 510,514 ---- } ! int httpSetUser(const char *user, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { confUser = myStrdup(user); *************** *** 516,520 **** } ! int httpSetPassword(const char *password, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { confPassword = myStrdup(password); --- 516,520 ---- } ! int httpSetPassword(const char *password, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { confPassword = myStrdup(password); *************** *** 522,526 **** } ! int httpSetSessTime(const char *timeStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int time; --- 522,526 ---- } ! int httpSetSessTime(const char *timeStr, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { unsigned int time; *************** *** 543,547 **** } ! int httpSetPubDir(const char *pubDir, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { confPubDir = myStrdup(pubDir); --- 543,547 ---- } ! int httpSetPubDir(const char *pubDir, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { confPubDir = myStrdup(pubDir); *************** *** 549,553 **** } ! int httpSetQuantum(const char *quantumStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int quantum; --- 549,553 ---- } ! int httpSetQuantum(const char *quantumStr, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { unsigned int quantum; *************** *** 570,574 **** } ! int httpSetMessTime(const char *timeStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int time; --- 570,574 ---- } ! int httpSetMessTime(const char *timeStr, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { unsigned int time; *************** *** 591,595 **** } ! int httpSetMessLimit(const char *limitStr, void *data __attribute__((unused)), unsigned int addon __attribute__((unused))) { unsigned int limit; --- 591,595 ---- } ! int httpSetMessLimit(const char *limitStr, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))) { unsigned int limit; From (spam-protected) Mon Sep 17 23:57:08 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 21:57:08 +0000 Subject: [Olsr-cvs] olsrd-current/src olsrd_plugin.h, 1.5, 1.6 plugin_loader.c, 1.31, 1.32 plugin_util.c, 1.5, 1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10901/src Modified Files: olsrd_plugin.h plugin_loader.c plugin_util.c Log Message: - applied 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke fixing the compilation warning on 64bit. Index: olsrd_plugin.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsrd_plugin.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** olsrd_plugin.h 16 Sep 2007 22:11:30 -0000 1.5 --- olsrd_plugin.h 17 Sep 2007 21:57:06 -0000 1.6 *************** *** 79,83 **** /* Interface version 5 */ ! typedef int set_plugin_parameter(const char *value, void *data, unsigned int addon); struct olsrd_plugin_parameters { --- 79,88 ---- /* Interface version 5 */ ! typedef union { ! unsigned int ui; ! char *pc; ! } set_plugin_parameter_addon; ! ! typedef int set_plugin_parameter(const char *value, void *data, set_plugin_parameter_addon addon); struct olsrd_plugin_parameters { *************** *** 85,89 **** set_plugin_parameter *set_plugin_parameter; void *data; ! unsigned int addon; }; --- 90,94 ---- set_plugin_parameter *set_plugin_parameter; void *data; ! set_plugin_parameter_addon addon; }; Index: plugin_util.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_util.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** plugin_util.c 16 Sep 2007 22:14:08 -0000 1.5 --- plugin_util.c 17 Sep 2007 21:57:06 -0000 1.6 *************** *** 45,49 **** #include "defs.h" ! int set_plugin_port(const char *value, void *data, unsigned int addon __attribute__((unused))) { char *endptr; --- 45,49 ---- #include "defs.h" ! int set_plugin_port(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { char *endptr; *************** *** 67,71 **** } ! int set_plugin_ipaddress(const char *value, void *data, unsigned int addon __attribute__((unused))) { char buf[INET6_ADDRSTRLEN]; --- 67,71 ---- } ! int set_plugin_ipaddress(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { char buf[INET6_ADDRSTRLEN]; *************** *** 87,91 **** ! int set_plugin_boolean(const char *value, void *data, unsigned int addon __attribute__((unused))) { int *v = data; --- 87,91 ---- ! int set_plugin_boolean(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { int *v = data; *************** *** 100,104 **** } ! int set_plugin_int(const char *value, void *data, unsigned int addon __attribute__((unused))) { char *endptr; --- 100,104 ---- } ! int set_plugin_int(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { char *endptr; *************** *** 118,126 **** } ! int set_plugin_string(const char *value, void *data, unsigned int addon) { if (data != NULL) { char *v = data; ! if (strlen(value) >= addon) { OLSR_PRINTF(0, "String too long \"%s\"", value); return 1; --- 118,126 ---- } ! int set_plugin_string(const char *value, void *data, set_plugin_parameter_addon addon) { if (data != NULL) { char *v = data; ! if (strlen(value) >= addon.ui) { OLSR_PRINTF(0, "String too long \"%s\"", value); return 1; Index: plugin_loader.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_loader.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** plugin_loader.c 30 Aug 2007 22:25:13 -0000 1.31 --- plugin_loader.c 17 Sep 2007 21:57:06 -0000 1.32 *************** *** 255,259 **** /* we have found it! */ rc = entry->plugin_parameters[i].set_plugin_parameter(params->value, entry->plugin_parameters[i].data, ! 0 == entry->plugin_parameters[i].name[0] ? (unsigned int)params->key : entry->plugin_parameters[i].addon); if (rc != 0) { fprintf(stderr, "\nFatal error in plugin parameter \"%s\"/\"%s\"\n", params->key, params->value); --- 255,259 ---- /* we have found it! */ rc = entry->plugin_parameters[i].set_plugin_parameter(params->value, entry->plugin_parameters[i].data, ! 0 == entry->plugin_parameters[i].name[0] ? (set_plugin_parameter_addon)params->key : entry->plugin_parameters[i].addon); if (rc != 0) { fprintf(stderr, "\nFatal error in plugin parameter \"%s\"/\"%s\"\n", params->key, params->value); From (spam-protected) Tue Sep 18 00:06:43 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:06:43 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.88,1.89 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14910 Modified Files: CHANGELOG Log Message: * forget to mention a patch Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** CHANGELOG 17 Sep 2007 21:57:05 -0000 1.88 --- CHANGELOG 17 Sep 2007 22:06:40 -0000 1.89 *************** *** 129,134 **** This patch was modified/clenaed up by to use "#if" instead of "#ifdef" as it's more robust against typos. ! - 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch ! fixing the compilation warning on 64bit PATCH by Arnd Hannemann --- 129,135 ---- This patch was modified/clenaed up by to use "#if" instead of "#ifdef" as it's more robust against typos. ! - 112-olsrd-nameservice-fixemptyname.patch, 115-olsrd-nameserviceparamfix.patch ! and 116-olsrd-fix-pluginparam-addons.patch fixing the compilation warning on ! 64bit. PATCH by Arnd Hannemann From (spam-protected) Tue Sep 18 00:08:03 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:08:03 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15340/lib/txtinfo/src Modified Files: olsrd_txtinfo.c Log Message: * applied 113-olsrd-txtinfo-fixhttpget.patch Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** olsrd_txtinfo.c 13 Sep 2007 15:31:59 -0000 1.10 --- olsrd_txtinfo.c 17 Sep 2007 22:08:01 -0000 1.11 *************** *** 238,242 **** FD_ZERO(&rfds); FD_SET((unsigned int)ipc_connection, &rfds); /* Win32 needs the cast here */ ! if(select(ipc_connection+1, &rfds, NULL, NULL, &tv)) { char requ[128]; ssize_t s = recv(ipc_connection, (void*)&requ, sizeof(requ), 0); /* Win32 needs the cast here */ --- 238,242 ---- FD_ZERO(&rfds); FD_SET((unsigned int)ipc_connection, &rfds); /* Win32 needs the cast here */ ! if(0 <= select(ipc_connection+1, &rfds, NULL, NULL, &tv)) { char requ[128]; ssize_t s = recv(ipc_connection, (void*)&requ, sizeof(requ), 0); /* Win32 needs the cast here */ From (spam-protected) Tue Sep 18 00:14:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:14:09 +0000 Subject: [Olsr-cvs] olsrd-current/src print_packet.c,1.11,1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18165/src Modified Files: print_packet.c Log Message: * applied 110-olsrd-fixpacketprint.patch Index: print_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/print_packet.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** print_packet.c 28 Aug 2007 20:45:17 -0000 1.11 --- print_packet.c 17 Sep 2007 22:14:07 -0000 1.12 *************** *** 340,344 **** data += 1; fprintf(handle, "RLQ: %d\n", *data); ! data += 2; remsize -= (olsr_cnf->ipsize + 4); } --- 340,344 ---- data += 1; fprintf(handle, "RLQ: %d\n", *data); ! data += 3; remsize -= (olsr_cnf->ipsize + 4); } From (spam-protected) Tue Sep 18 00:14:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:14:09 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.89,1.90 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18165 Modified Files: CHANGELOG Log Message: * applied 110-olsrd-fixpacketprint.patch Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** CHANGELOG 17 Sep 2007 22:06:40 -0000 1.89 --- CHANGELOG 17 Sep 2007 22:14:07 -0000 1.90 *************** *** 129,135 **** This patch was modified/clenaed up by to use "#if" instead of "#ifdef" as it's more robust against typos. ! - 112-olsrd-nameservice-fixemptyname.patch, 115-olsrd-nameserviceparamfix.patch ! and 116-olsrd-fix-pluginparam-addons.patch fixing the compilation warning on ! 64bit. PATCH by Arnd Hannemann --- 129,136 ---- This patch was modified/clenaed up by to use "#if" instead of "#ifdef" as it's more robust against typos. ! - 110-olsrd-fixpacketprint.patch, 112-olsrd-nameservice-fixemptyname.patch, ! 113-olsrd-txtinfo-fixhttpget.patch, 115-olsrd-nameserviceparamfix.patch ! and 116-olsrd-fix-pluginparam-addons.patch fixing the compilation warning ! on 64bit. PATCH by Arnd Hannemann From (spam-protected) Tue Sep 18 00:24:24 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:24:24 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.90,1.91 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22219 Modified Files: CHANGELOG Log Message: * applied 114-olsrd-timeoutlimit.patch Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** CHANGELOG 17 Sep 2007 22:14:07 -0000 1.90 --- CHANGELOG 17 Sep 2007 22:24:22 -0000 1.91 *************** *** 130,135 **** instead of "#ifdef" as it's more robust against typos. - 110-olsrd-fixpacketprint.patch, 112-olsrd-nameservice-fixemptyname.patch, ! 113-olsrd-txtinfo-fixhttpget.patch, 115-olsrd-nameserviceparamfix.patch ! and 116-olsrd-fix-pluginparam-addons.patch fixing the compilation warning on 64bit. --- 130,136 ---- instead of "#ifdef" as it's more robust against typos. - 110-olsrd-fixpacketprint.patch, 112-olsrd-nameservice-fixemptyname.patch, ! 113-olsrd-txtinfo-fixhttpget.patch, 114-olsrd-timeoutlimit.patch, ! 115-olsrd-nameserviceparamfix.patch and ! 116-olsrd-fix-pluginparam-addons.patch fixing the compilation warning on 64bit. From (spam-protected) Tue Sep 18 00:24:24 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:24:24 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src plugin.c,1.12,1.13 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22219/lib/tas/src Modified Files: plugin.c Log Message: * applied 114-olsrd-timeoutlimit.patch Index: plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/plugin.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** plugin.c 13 Sep 2007 15:31:59 -0000 1.12 --- plugin.c 17 Sep 2007 22:24:22 -0000 1.13 *************** *** 454,458 **** httpInit(); ! olsr_register_timeout_function(serviceFunc); olsr_parser_add_function(parserFunc, MESSAGE_TYPE, 1); --- 454,458 ---- httpInit(); ! olsr_register_timeout_function(serviceFunc, OLSR_FALSE); olsr_parser_add_function(parserFunc, MESSAGE_TYPE, 1); From (spam-protected) Tue Sep 18 00:24:24 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:24:24 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga/src olsrd_plugin.c,1.5,1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22219/lib/quagga/src Modified Files: olsrd_plugin.c Log Message: * applied 114-olsrd-timeoutlimit.patch Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/olsrd_plugin.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** olsrd_plugin.c 16 Aug 2007 19:07:28 -0000 1.5 --- olsrd_plugin.c 17 Sep 2007 22:24:22 -0000 1.6 *************** *** 98,102 **** } - // olsr_register_timeout_function(&olsr_timeout); olsr_register_scheduler_event(&zebra_check, NULL, 1, 0, NULL); return 0; --- 98,101 ---- From (spam-protected) Tue Sep 18 00:24:24 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:24:24 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.30, 1.31 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22219/lib/nameservice/src Modified Files: nameservice.c Log Message: * applied 114-olsrd-timeoutlimit.patch Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** nameservice.c 17 Sep 2007 21:57:05 -0000 1.30 --- nameservice.c 17 Sep 2007 22:24:22 -0000 1.31 *************** *** 380,384 **** /* register functions with olsrd */ olsr_parser_add_function(&olsr_parser, PARSER_TYPE, 1); ! olsr_register_timeout_function(&olsr_timeout); olsr_register_scheduler_event(&olsr_event, NULL, my_interval, 0, NULL); --- 380,384 ---- /* register functions with olsrd */ olsr_parser_add_function(&olsr_parser, PARSER_TYPE, 1); ! olsr_register_timeout_function(&olsr_timeout, OLSR_TRUE); olsr_register_scheduler_event(&olsr_event, NULL, my_interval, 0, NULL); *************** *** 482,497 **** * and write changes to file */ void olsr_timeout(void) { ! timeout_old_names(list, &name_table_changed); ! timeout_old_names(forwarder_list, &forwarder_table_changed); ! timeout_old_names(service_list, &service_table_changed); ! timeout_old_names(latlon_list, &latlon_table_changed); ! ! write_resolv_file(); ! write_hosts_file(); ! write_services_file(); ! write_latlon_file(); } --- 482,514 ---- * and write changes to file */ + + static int timeout_roundrobin = 0; + void olsr_timeout(void) { ! switch(timeout_roundrobin++) ! { ! case 0: ! timeout_old_names(list, &name_table_changed); ! timeout_old_names(forwarder_list, &forwarder_table_changed); ! timeout_old_names(service_list, &service_table_changed); ! timeout_old_names(latlon_list, &latlon_table_changed); ! break; ! case 1: ! write_resolv_file(); // if forwarder_table_changed ! break; ! case 2: ! write_hosts_file(); // if name_table_changed ! break; ! case 3: ! write_services_file(); // if service_table_changed ! break; ! case 4: ! write_latlon_file(); // latlon_table_changed ! break; ! default: ! timeout_roundrobin = 0; ! } // switch } From (spam-protected) Tue Sep 18 00:24:24 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:24:24 +0000 Subject: [Olsr-cvs] olsrd-current/src duplicate_set.c, 1.15, 1.16 hna_set.c, 1.21, 1.22 link_set.c, 1.72, 1.73 main.c, 1.99, 1.100 mid_set.c, 1.21, 1.22 mpr_selector_set.c, 1.17, 1.18 neighbor_table.c, 1.33, 1.34 scheduler.c, 1.42, 1.43 scheduler.h, 1.13, 1.14 tc_set.c, 1.29, 1.30 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22219/src Modified Files: duplicate_set.c hna_set.c link_set.c main.c mid_set.c mpr_selector_set.c neighbor_table.c scheduler.c scheduler.h tc_set.c Log Message: * applied 114-olsrd-timeoutlimit.patch Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tc_set.c 13 Sep 2007 22:43:15 -0000 1.29 --- tc_set.c 17 Sep 2007 22:24:22 -0000 1.30 *************** *** 61,65 **** OLSR_PRINTF(5, "TC: init topo\n"); ! olsr_register_timeout_function(&olsr_time_out_tc_set); avl_init(&tc_tree, avl_comp_default); --- 61,65 ---- OLSR_PRINTF(5, "TC: init topo\n"); ! olsr_register_timeout_function(&olsr_time_out_tc_set, OLSR_TRUE); avl_init(&tc_tree, avl_comp_default); Index: mid_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** mid_set.c 2 Aug 2007 21:50:22 -0000 1.21 --- mid_set.c 17 Sep 2007 22:24:22 -0000 1.22 *************** *** 70,74 **** * MID entries, the timeoutfunction is only ran once every second */ ! olsr_register_scheduler_event(&olsr_time_out_mid_set, NULL, 1, 0, NULL); for(idx=0;idxparam == par) && (entry->trigger == trigger) && ! (entry->interval == interval)) { if(entry == event_functions) --- 327,331 ---- (entry->param == par) && (entry->trigger == trigger) && ! (0.0 > interval || entry->interval == interval)) { if(entry == event_functions) *************** *** 348,357 **** } int ! olsr_register_timeout_function(void (*time_out_function)(void)) { struct timeout_entry *new_entry; /* check that this entry is not added already */ new_entry = timeout_functions; --- 348,393 ---- } + /* + * Sven-Ola, 2007: Since the original timing and flagging is changed (which + * saves lots of CPU time - see LinkQualityDijkstraLimit) the original timeout + * functions called every olsr_cnf->polltime uses too much CPU now. Because the + * changes_xxx handling is switched off with LQDL, it should be OK to call + * all timeout handlers at a much lower rate. To overcome UDP packet loss, + * a very low pollrate is used. + */ + + static float dijkstra_initial = 0.0; int ! olsr_register_scheduler_event_dijkstra(void (*event_function)(void *), ! void *par, ! float interval, ! float initial, ! olsr_u8_t *trigger) ! { ! if (1 < olsr_cnf->lq_level && 0.0 < olsr_cnf->lq_dinter) ! { ! dijkstra_initial += olsr_cnf->lq_dinter / 10.0; ! return olsr_register_scheduler_event(event_function, par, olsr_cnf->lq_dinter, dijkstra_initial, trigger); ! } ! return olsr_register_scheduler_event(event_function, par, interval, initial, trigger); ! } ! ! int ! olsr_register_timeout_function(void (*time_out_function)(void), olsr_bool dijkstra_limit_ok) { struct timeout_entry *new_entry; + if (dijkstra_limit_ok && 1 < olsr_cnf->lq_level && 0.0 < olsr_cnf->lq_dinter) + { + dijkstra_initial += olsr_cnf->lq_dinter / 10.0; + return olsr_register_scheduler_event( + (void *)time_out_function, + NULL, + olsr_cnf->lq_dinter, + dijkstra_initial, + NULL); + } + /* check that this entry is not added already */ new_entry = timeout_functions; *************** *** 380,387 **** int ! olsr_remove_timeout_function(void (*time_out_function)(void)) { struct timeout_entry *entry, *prev; /* check that this entry is not added already */ entry = timeout_functions; --- 416,433 ---- int ! olsr_remove_timeout_function(void (*time_out_function)(void), olsr_bool dijkstra_limit_ok) { struct timeout_entry *entry, *prev; + if (dijkstra_limit_ok && 1 < olsr_cnf->lq_level && 0.0 < olsr_cnf->lq_dinter) + { + return olsr_remove_scheduler_event( + (void *)time_out_function, + NULL, + -1.0, + -1.0, + NULL); + } + /* check that this entry is not added already */ entry = timeout_functions; Index: link_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** link_set.c 16 Sep 2007 21:45:25 -0000 1.72 --- link_set.c 17 Sep 2007 22:24:22 -0000 1.73 *************** *** 98,110 **** hold_time_neighbor = (NEIGHB_HOLD_TIME*1000) / olsr_cnf->system_tick_divider; ! olsr_register_timeout_function(&olsr_time_out_link_set); if(olsr_cnf->use_hysteresis) { ! olsr_register_timeout_function(&olsr_time_out_hysteresis); } if (olsr_cnf->lq_level > 0) { ! olsr_register_timeout_function(&olsr_time_out_packet_loss); } } --- 98,110 ---- hold_time_neighbor = (NEIGHB_HOLD_TIME*1000) / olsr_cnf->system_tick_divider; ! olsr_register_timeout_function(&olsr_time_out_link_set, OLSR_TRUE); if(olsr_cnf->use_hysteresis) { ! olsr_register_timeout_function(&olsr_time_out_hysteresis, OLSR_TRUE); } if (olsr_cnf->lq_level > 0) { ! olsr_register_timeout_function(&olsr_time_out_packet_loss, OLSR_TRUE); } } Index: scheduler.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/scheduler.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** scheduler.h 20 Apr 2007 13:46:04 -0000 1.13 --- scheduler.h 17 Sep 2007 22:24:22 -0000 1.14 *************** *** 73,80 **** int ! olsr_register_timeout_function(void (*)(void)); int ! olsr_remove_timeout_function(void (*)(void)); int --- 73,83 ---- int ! olsr_register_timeout_function(void (*)(void), olsr_bool); int ! olsr_remove_timeout_function(void (*)(void), olsr_bool); ! ! int ! olsr_register_scheduler_event_dijkstra(void (*)(void *), void *, float, float, olsr_u8_t *); int Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** main.c 16 Sep 2007 21:20:16 -0000 1.99 --- main.c 17 Sep 2007 22:24:22 -0000 1.100 *************** *** 420,424 **** /* Register socket poll event */ ! olsr_register_timeout_function(&poll_sockets); /* Starting scheduler */ --- 420,424 ---- /* Register socket poll event */ ! olsr_register_timeout_function(&poll_sockets, OLSR_FALSE); /* Starting scheduler */ Index: neighbor_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** neighbor_table.c 2 Aug 2007 21:57:06 -0000 1.33 --- neighbor_table.c 17 Sep 2007 22:24:22 -0000 1.34 *************** *** 61,65 **** int i; ! olsr_register_timeout_function(&olsr_time_out_neighborhood_tables); for(i = 0; i < HASHSIZE; i++) { --- 61,65 ---- int i; ! olsr_register_timeout_function(&olsr_time_out_neighborhood_tables, OLSR_TRUE); for(i = 0; i < HASHSIZE; i++) { From (spam-protected) Tue Sep 18 00:27:26 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:27:26 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.91,1.92 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23419 Modified Files: CHANGELOG Log Message: * more blurb Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** CHANGELOG 17 Sep 2007 22:24:22 -0000 1.91 --- CHANGELOG 17 Sep 2007 22:27:24 -0000 1.92 *************** *** 133,137 **** 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch fixing the compilation warning ! on 64bit. PATCH by Arnd Hannemann --- 133,137 ---- 115-olsrd-nameserviceparamfix.patch and 116-olsrd-fix-pluginparam-addons.patch fixing the compilation warning ! on 64bit and lots of other improvements. PATCH by Arnd Hannemann From (spam-protected) Tue Sep 18 00:55:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:55:42 +0000 Subject: [Olsr-cvs] olsrd-current/src kernel_routes.h,1.9,1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv933/src Modified Files: kernel_routes.h Log Message: * made delete_all_inet_gws() static since it is not used elsewhere * localized the netlink version restoring the former logging * killed a superflous close() No functional change, just moving code around. Index: kernel_routes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/kernel_routes.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** kernel_routes.h 5 Sep 2007 16:11:10 -0000 1.9 --- kernel_routes.h 17 Sep 2007 22:55:40 -0000 1.10 *************** *** 40,46 **** */ - - - #ifndef _OLSR_KERNEL_RT #define _OLSR_KERNEL_RT --- 40,43 ---- *************** *** 49,53 **** #include "routing_table.h" - int olsr_ioctl_add_route(struct rt_entry *); --- 46,49 ---- *************** *** 62,69 **** olsr_ioctl_del_route6(struct rt_entry *); - - int - delete_all_inet_gws(void); - - #endif --- 58,60 ---- From (spam-protected) Tue Sep 18 00:55:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:55:42 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.26,1.27 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv933/src/linux Modified Files: kernel_routes.c Log Message: * made delete_all_inet_gws() static since it is not used elsewhere * localized the netlink version restoring the former logging * killed a superflous close() No functional change, just moving code around. Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** kernel_routes.c 13 Sep 2007 16:08:13 -0000 1.26 --- kernel_routes.c 17 Sep 2007 22:55:40 -0000 1.27 *************** *** 41,56 **** */ - - #include "kernel_routes.h" - #include "link_set.h" - #include "olsr.h" - #include "log.h" - #include - #include - #include #if !LINUX_POLICY_ROUTING /** --- 41,166 ---- */ #include "kernel_routes.h" #if !LINUX_POLICY_ROUTING + #include "log.h" + + static int delete_all_inet_gws(void); + + #else /* !LINUX_POLICY_ROUTING */ + + #include + #include + + struct olsr_rtreq + { + struct nlmsghdr n; + struct rtmsg r; + char buf[512]; + }; + static void olsr_netlink_addreq(struct olsr_rtreq *req, int type, void *data, int len) + { + struct rtattr *rta = (struct rtattr*)(((char*)req) + NLMSG_ALIGN(req->n.nlmsg_len)); + req->n.nlmsg_len = NLMSG_ALIGN(req->n.nlmsg_len) + RTA_LENGTH(len); + assert(req->n.nlmsg_len < sizeof(struct olsr_rtreq)); + rta->rta_type = type; + rta->rta_len = RTA_LENGTH(len); + memcpy(RTA_DATA(rta), data, len); + } + + static int olsr_netlink_route(struct rt_entry *rt, olsr_u8_t family, olsr_u8_t rttable, __u16 cmd) + { + int ret = 0; + struct olsr_rtreq req; + struct iovec iov; + struct sockaddr_nl nladdr; + struct msghdr msg = + { + &nladdr, + sizeof(nladdr), + &iov, + 1, + NULL, + 0, + 0 + }; + olsr_u32_t metric = 1; + struct rt_nexthop* nexthop = (RTM_NEWROUTE == cmd) ? + &rt->rt_best->rtp_nexthop : &rt->rt_nexthop; + + memset(&req, 0, sizeof(req)); + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); + req.n.nlmsg_flags = NLM_F_REQUEST|NLM_F_CREATE|NLM_F_EXCL|NLM_F_ACK; + req.n.nlmsg_type = cmd; + req.r.rtm_family = family; + req.r.rtm_table = rttable; + req.r.rtm_protocol = RTPROT_BOOT; + req.r.rtm_scope = RT_SCOPE_LINK; + req.r.rtm_type = RTN_UNICAST; + req.r.rtm_dst_len = rt->rt_dst.prefix_len; + + if (AF_INET == family) + { + if (rt->rt_dst.prefix.v4 != nexthop->gateway.v4) + { + olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v4, sizeof(nexthop->gateway.v4)); + req.r.rtm_scope = RT_SCOPE_UNIVERSE; + metric = RT_METRIC_DEFAULT; + } + olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v4, sizeof(rt->rt_dst.prefix.v4)); + } + else + { + if (0 != memcmp(&rt->rt_dst.prefix.v6, &nexthop->gateway.v6, sizeof(nexthop->gateway.v6))) + { + olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v6, sizeof(nexthop->gateway.v6)); + req.r.rtm_scope = RT_SCOPE_UNIVERSE; + metric = RT_METRIC_DEFAULT; + } + olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v6, sizeof(rt->rt_dst.prefix.v6)); + } + //!!!olsr_netlink_addreq(&req, RTA_PRIORITY, &rt->rt_best->rtp_metric.hops, sizeof(rt->rt_best->rtp_metric.hops)); + olsr_netlink_addreq(&req, RTA_PRIORITY, &metric, sizeof(metric)); + olsr_netlink_addreq(&req, RTA_OIF, &nexthop->iif_index, sizeof(nexthop->iif_index)); + iov.iov_base = &req.n; + iov.iov_len = req.n.nlmsg_len; + memset(&nladdr, 0, sizeof(nladdr)); + nladdr.nl_family = AF_NETLINK; + if (0 <= (ret = sendmsg(olsr_cnf->rtnl_s, &msg, 0))) + { + iov.iov_base = req.buf; + iov.iov_len = sizeof(req.buf); + if (0 < (ret = recvmsg(olsr_cnf->rtnl_s, &msg, 0))) + { + struct nlmsghdr* h = (struct nlmsghdr*)req.buf; + while (NLMSG_OK(h, (unsigned int)ret)) { + if (NLMSG_DONE == h->nlmsg_type) break; + if (NLMSG_ERROR == h->nlmsg_type) + { + if (NLMSG_LENGTH(sizeof(struct nlmsgerr) <= h->nlmsg_len)) + { + struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h); + errno = -l_err->error; + if (0 != errno) ret = -1; + } + break; + } + h = NLMSG_NEXT(h, ret); + } + } + if (0 <= ret && olsr_cnf->open_ipc) + { + ipc_route_send_rtentry( + &rt->rt_dst.prefix, + &nexthop->gateway, + metric, + RTM_NEWROUTE == cmd, + if_ifwithindex_name(nexthop->iif_index)); + } + } + return ret; + } + #endif /* LINUX_POLICY_ROUTING */ /** *************** *** 64,73 **** --- 174,186 ---- olsr_ioctl_add_route(struct rt_entry *rt) { + #if !LINUX_POLICY_ROUTING struct rtentry kernel_route; union olsr_ip_addr mask; int rslt; + #endif /* LINUX_POLICY_ROUTING */ OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rtp_to_string(rt->rt_best)); + #if !LINUX_POLICY_ROUTING memset(&kernel_route, 0, sizeof(struct rtentry)); *************** *** 116,119 **** --- 229,244 ---- return rslt; + #else /* !LINUX_POLICY_ROUTING */ + if (0 == rt->rt_dst.prefix_len && 253 > olsr_cnf->rttable) + { + /* + * Users start whining about not having internet with policy + * routing activated and no static default route in table 254. + * We maintain a fallback defroute in the default=253 table. + */ + olsr_netlink_route(rt, AF_INET, 253, RTM_NEWROUTE); + } + return olsr_netlink_route(rt, AF_INET, olsr_cnf->rttable, RTM_NEWROUTE); + #endif /* LINUX_POLICY_ROUTING */ } *************** *** 129,133 **** olsr_ioctl_add_route6(struct rt_entry *rt) { ! struct in6_rtmsg kernel_route; int rslt; --- 254,258 ---- olsr_ioctl_add_route6(struct rt_entry *rt) { ! #if !LINUX_POLICY_ROUTING struct in6_rtmsg kernel_route; int rslt; *************** *** 163,166 **** --- 288,294 ---- return rslt; + #else /* !LINUX_POLICY_ROUTING */ + return olsr_netlink_route(rt, AF_INET6, olsr_cnf->rttable, RTM_NEWROUTE); + #endif /* LINUX_POLICY_ROUTING */ } *************** *** 176,185 **** --- 304,316 ---- olsr_ioctl_del_route(struct rt_entry *rt) { + #if !LINUX_POLICY_ROUTING struct rtentry kernel_route; union olsr_ip_addr mask; int rslt; + #endif /* LINUX_POLICY_ROUTING */ OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); + #if !LINUX_POLICY_ROUTING memset(&kernel_route,0,sizeof(struct rtentry)); *************** *** 219,222 **** --- 350,363 ---- return rslt; + #else /* !LINUX_POLICY_ROUTING */ + if (0 == rt->rt_dst.prefix_len && 253 > olsr_cnf->rttable) + { + /* + * Also remove the fallback default route + */ + olsr_netlink_route(rt, AF_INET, 253, RTM_DELROUTE); + } + return olsr_netlink_route(rt, AF_INET, olsr_cnf->rttable, RTM_DELROUTE); + #endif /* LINUX_POLICY_ROUTING */ } *************** *** 232,244 **** olsr_ioctl_del_route6(struct rt_entry *rt) { ! struct in6_rtmsg kernel_route; int rslt; OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); memset(&kernel_route,0,sizeof(struct in6_rtmsg)); - COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; --- 373,386 ---- olsr_ioctl_del_route6(struct rt_entry *rt) { ! #if !LINUX_POLICY_ROUTING struct in6_rtmsg kernel_route; int rslt; + #endif /* LINUX_POLICY_ROUTING */ OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); + #if !LINUX_POLICY_ROUTING memset(&kernel_route,0,sizeof(struct in6_rtmsg)); COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; *************** *** 258,267 **** return rslt; } ! ! ! int ! delete_all_inet_gws(void) { int s; --- 400,410 ---- return rslt; + #else /* !LINUX_POLICY_ROUTING */ + return olsr_netlink_route(rt, AF_INET6, olsr_cnf->rttable, RTM_DELROUTE); + #endif /* LINUX_POLICY_ROUTING */ } ! #if !LINUX_POLICY_ROUTING ! static int delete_all_inet_gws(void) { int s; *************** *** 276,280 **** { olsr_syslog(OLSR_LOG_ERR, "socket: %m"); - close(s); return -1; } --- 419,422 ---- *************** *** 327,486 **** } close(s); ! return 0; ! ! } ! ! #else /* LINUX_POLICY_ROUTING */ ! ! #include ! #include ! #include ! ! struct olsr_rtreq ! { ! struct nlmsghdr n; ! struct rtmsg r; ! char buf[512]; ! }; ! ! static void olsr_netlink_addreq(struct olsr_rtreq *req, int type, void *data, int len) ! { ! struct rtattr *rta = (struct rtattr*)(((char*)req) + NLMSG_ALIGN(req->n.nlmsg_len)); ! req->n.nlmsg_len = NLMSG_ALIGN(req->n.nlmsg_len) + RTA_LENGTH(len); ! assert(req->n.nlmsg_len < sizeof(struct olsr_rtreq)); ! rta->rta_type = type; ! rta->rta_len = RTA_LENGTH(len); ! memcpy(RTA_DATA(rta), data, len); ! } ! ! static int olsr_netlink_route(struct rt_entry *rt, olsr_u8_t family, olsr_u8_t rttable, __u16 cmd) ! { ! int ret = 0; ! struct olsr_rtreq req; ! struct iovec iov; ! struct sockaddr_nl nladdr; ! struct msghdr msg = ! { ! (void*)&nladdr, ! sizeof(nladdr), ! &iov, ! 1, ! NULL, ! 0, ! 0 ! }; ! olsr_u32_t metric = 1; ! struct rt_nexthop* nexthop = (RTM_NEWROUTE == cmd) ? ! &rt->rt_best->rtp_nexthop : &rt->rt_nexthop; ! ! memset(&req, 0, sizeof(req)); ! req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); ! req.n.nlmsg_flags = NLM_F_REQUEST|NLM_F_CREATE|NLM_F_EXCL|NLM_F_ACK; ! req.n.nlmsg_type = cmd; ! req.r.rtm_family = family; ! req.r.rtm_table = rttable; ! req.r.rtm_protocol = RTPROT_BOOT; ! req.r.rtm_scope = RT_SCOPE_LINK; ! req.r.rtm_type = RTN_UNICAST; ! req.r.rtm_dst_len = rt->rt_dst.prefix_len; ! ! if (AF_INET == family) ! { ! if (rt->rt_dst.prefix.v4 != nexthop->gateway.v4) ! { ! olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v4, sizeof(nexthop->gateway.v4)); ! req.r.rtm_scope = RT_SCOPE_UNIVERSE; ! metric = RT_METRIC_DEFAULT; ! } ! olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v4, sizeof(rt->rt_dst.prefix.v4)); ! } ! else ! { ! if (0 != memcmp(&rt->rt_dst.prefix.v6, &nexthop->gateway.v6, sizeof(nexthop->gateway.v6))) ! { ! olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v6, sizeof(nexthop->gateway.v6)); ! req.r.rtm_scope = RT_SCOPE_UNIVERSE; ! metric = RT_METRIC_DEFAULT; ! } ! olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v6, sizeof(rt->rt_dst.prefix.v6)); ! } ! //!!!olsr_netlink_addreq(&req, RTA_PRIORITY, &rt->rt_best->rtp_metric.hops, sizeof(rt->rt_best->rtp_metric.hops)); ! olsr_netlink_addreq(&req, RTA_PRIORITY, &metric, sizeof(metric)); ! olsr_netlink_addreq(&req, RTA_OIF, &nexthop->iif_index, sizeof(nexthop->iif_index)); ! iov.iov_base = (void*)&req.n; ! iov.iov_len = req.n.nlmsg_len; ! memset(&nladdr, 0, sizeof(nladdr)); ! nladdr.nl_family = AF_NETLINK; ! if (0 <= (ret = sendmsg(olsr_cnf->rtnl_s, &msg, 0))) ! { ! iov.iov_base = req.buf; ! iov.iov_len = sizeof(req.buf); ! if (0 < (ret = recvmsg(olsr_cnf->rtnl_s, &msg, 0))) ! { ! struct nlmsghdr* h = (struct nlmsghdr*)req.buf; ! while (NLMSG_OK(h, (unsigned int)ret)) { ! if (NLMSG_DONE == h->nlmsg_type) break; ! if (NLMSG_ERROR == h->nlmsg_type) ! { ! if (NLMSG_LENGTH(sizeof(struct nlmsgerr) <= h->nlmsg_len)) ! { ! struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h); ! errno = -l_err->error; ! if (0 != errno) ret = -1; ! } ! break; ! } ! h = NLMSG_NEXT(h, ret); ! } ! } ! if (0 <= ret && olsr_cnf->open_ipc) ! { ! ipc_route_send_rtentry( ! &rt->rt_dst.prefix, ! &nexthop->gateway, ! metric, ! RTM_NEWROUTE == cmd, ! if_ifwithindex_name(nexthop->iif_index)); ! } ! } ! return ret; ! } ! ! int olsr_ioctl_add_route(struct rt_entry *rt) ! { ! if (0 == rt->rt_dst.prefix_len && 253 > olsr_cnf->rttable) ! { ! /* ! * Users start whining about not having internet with policy ! * routing activated and no static default route in table 254. ! * We maintain a fallback defroute in the default=253 table. ! */ ! olsr_netlink_route(rt, AF_INET, 253, RTM_NEWROUTE); ! } ! return olsr_netlink_route(rt, AF_INET, olsr_cnf->rttable, RTM_NEWROUTE); ! } ! ! int olsr_ioctl_del_route(struct rt_entry *rt) ! { ! if (0 == rt->rt_dst.prefix_len && 253 > olsr_cnf->rttable) ! { ! /* ! * Also remove the fallback default route ! */ ! olsr_netlink_route(rt, AF_INET, 253, RTM_DELROUTE); ! } ! return olsr_netlink_route(rt, AF_INET, olsr_cnf->rttable, RTM_DELROUTE); ! } ! ! int olsr_ioctl_add_route6(struct rt_entry *rt) ! { ! return olsr_netlink_route(rt, AF_INET6, olsr_cnf->rttable, RTM_NEWROUTE); ! } ! ! int olsr_ioctl_del_route6(struct rt_entry *rt) ! { ! return olsr_netlink_route(rt, AF_INET6, olsr_cnf->rttable, RTM_DELROUTE); } - #endif /* LINUX_POLICY_ROUTING */ --- 469,474 ---- } close(s); ! return 0; } #endif /* LINUX_POLICY_ROUTING */ From (spam-protected) Tue Sep 18 00:57:43 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 17 Sep 2007 22:57:43 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.27,1.28 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2509/src/linux Modified Files: kernel_routes.c Log Message: * killed too many #include <>s Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** kernel_routes.c 17 Sep 2007 22:55:40 -0000 1.27 --- kernel_routes.c 17 Sep 2007 22:57:41 -0000 1.28 *************** *** 51,54 **** --- 51,55 ---- #include + #include #include From (spam-protected) Tue Sep 25 15:47:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 25 Sep 2007 13:47:38 +0000 Subject: [Olsr-cvs] olsrd-current/src lq_avl.h,1.10,1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3369/src Modified Files: lq_avl.h Log Message: * "balance" in struct avl_node is "signed char". Thanks to John Hay for reporting and to Thomas Lopatic for confirming this. * "leader" in struct avl_node is "unsigned char" as it is set to 0 and 1 only (in src/lq_av.c). * cleanup: added parentheres to arguments of a macro Index: lq_avl.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** lq_avl.h 5 Sep 2007 16:11:10 -0000 1.10 --- lq_avl.h 25 Sep 2007 13:47:36 -0000 1.11 *************** *** 53,58 **** void *key; void *data; ! char balance; ! char leader; }; --- 53,58 ---- void *key; void *data; ! signed char balance; ! unsigned char leader; }; *************** *** 84,89 **** #define inline_avl_comp_ipv4(ip1, ip2) \ ! (*(unsigned int *)ip1 == *(unsigned int *)ip2 ? 0 : \ ! *(unsigned int *)ip1 < *(unsigned int *)ip2 ? -1 : +1) #endif --- 84,89 ---- #define inline_avl_comp_ipv4(ip1, ip2) \ ! (*(unsigned int *)(ip1) == *(unsigned int *)(ip2) ? 0 : \ ! *(unsigned int *)(ip1) < *(unsigned int *)(ip2) ? -1 : +1) #endif