From (spam-protected) Sun Feb 4 21:46:51 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 20:46:51 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw_plain/src .cvsignore,NONE,1.1 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw_plain/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24941/lib/dyn_gw_plain/src Added Files: .cvsignore Log Message: * *.d are to be ignored --- NEW FILE: .cvsignore --- *.d From (spam-protected) Sun Feb 4 21:47:52 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 20:47:52 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw_plain/src olsrd_dyn_gw_plain.c, 1.1, 1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw_plain/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25340/lib/dyn_gw_plain/src Modified Files: olsrd_dyn_gw_plain.c Log Message: * removed an unnecessary #include to allow compilation on windows Index: olsrd_dyn_gw_plain.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** olsrd_dyn_gw_plain.c 31 Jan 2007 12:38:26 -0000 1.1 --- olsrd_dyn_gw_plain.c 4 Feb 2007 20:47:50 -0000 1.2 *************** *** 47,51 **** #include #include - #include #include #include --- 47,50 ---- From (spam-protected) Sun Feb 4 21:49:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 20:49:28 +0000 Subject: [Olsr-cvs] olsrd-current/lib/pgraph/src .cvsignore,NONE,1.1 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/pgraph/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26146/lib/pgraph/src Added Files: .cvsignore Log Message: * *.d are to be ignored --- NEW FILE: .cvsignore --- *.d From (spam-protected) Sun Feb 4 21:49:27 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 20:49:27 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src .cvsignore,NONE,1.1 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26146/lib/txtinfo/src Added Files: .cvsignore Log Message: * *.d are to be ignored --- NEW FILE: .cvsignore --- *.d From (spam-protected) Sun Feb 4 21:49:27 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 20:49:27 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga/src .cvsignore,NONE,1.1 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26146/lib/quagga/src Added Files: .cvsignore Log Message: * *.d are to be ignored --- NEW FILE: .cvsignore --- *.d From (spam-protected) Sun Feb 4 22:11:50 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:11:50 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.16, 1.17 nameservice.h, 1.9, 1.10 nameservice_msg.h, 1.6, 1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2671/lib/nameservice/src Modified Files: nameservice.c nameservice.h nameservice_msg.h Log Message: * merged it also and fixed lots of stuff by hand It seems to work on my node. Index: nameservice.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nameservice.h 2 Jun 2005 15:34:00 -0000 1.9 --- nameservice.h 4 Feb 2007 21:11:48 -0000 1.10 *************** *** 40,43 **** --- 40,44 ---- #include + #include #include "olsr_types.h" *************** *** 52,68 **** #define PLUGIN_AUTHOR "Bruno Randolf" #define MESSAGE_TYPE 130 #define PARSER_TYPE MESSAGE_TYPE #define EMISSION_INTERVAL 120 /* two minutes */ ! #define NAME_VALID_TIME 3600 /* one hour */ #define NAME_PROTOCOL_VERSION 1 ! #define MAX_NAME 255 #define MAX_FILE 255 ! #define MAX_SUFFIX 255 ! struct name_entry { --- 53,77 ---- #define PLUGIN_AUTHOR "Bruno Randolf" + // useful to set for the freifunkfirmware to remove all + // calls to olsr_printf by the empty statement ";" + //#define olsr_printf(...) ; #define MESSAGE_TYPE 130 #define PARSER_TYPE MESSAGE_TYPE #define EMISSION_INTERVAL 120 /* two minutes */ ! #define NAME_VALID_TIME 1800 /* half one hour */ #define NAME_PROTOCOL_VERSION 1 ! #define MAX_NAME 127 #define MAX_FILE 255 ! #define MAX_SUFFIX 63 + /** + * a linked list of name_entry + * if type is NAME_HOST, name is a hostname and ip its IP addr + * if type is NAME_FORWARDER, then ip is a dns-server (and name is irrelevant) + * if type is NAME_SERVICE, then name is a service-line (and the ip is irrelevant) + */ struct name_entry { *************** *** 74,78 **** }; ! /* database entry */ struct db_entry { --- 83,97 ---- }; ! /* * ! * linked list of db_entries for each originator with ! * originator being its main_addr ! * ! * names points to the name_entry with its hostname, dns-server or ! * service-line entry ! * ! * all the db_entries are hashed in nameservice.c to avoid a too long list ! * for many nodes in a net ! * ! * */ struct db_entry { *************** *** 99,104 **** encap_namemsg(struct namemsg *); void ! decap_namemsg(struct namemsg *, int, struct name_entry**); void --- 118,141 ---- encap_namemsg(struct namemsg *); + struct name_entry* + add_name_to_list(struct name_entry *my_list, char *value, int type, struct in_addr *ip); + + struct name_entry* + remove_nonvalid_names_from_list(struct name_entry *my_list, int type); + + void + free_all_list_entries(struct db_entry **this_db_list) ; + void ! timeout_old_names(struct db_entry **this_list, olsr_bool *this_table_changed); ! ! void ! decap_namemsg(struct name *from_packet, struct name_entry **to, olsr_bool *this_table_changed ); ! ! void ! insert_new_name_in_list(union olsr_ip_addr *originator, struct db_entry **this_list, struct name *from_packet, olsr_bool *this_table_changed, double vtime); ! ! olsr_bool ! allowed_hostname_or_ip_in_service(char *service_line, regmatch_t *hostname_or_ip); void *************** *** 109,112 **** --- 146,152 ---- void + write_services_file(void); + + void write_resolv_file(void); *************** *** 120,123 **** --- 160,175 ---- allowed_ip(union olsr_ip_addr *addr); + olsr_bool + allowed_service(char *service_line); + + olsr_bool + is_name_wellformed(char *service_line); + + olsr_bool + is_service_wellformed(char *service_line); + + char* + create_packet(struct name *to, struct name_entry *from); + void name_constructor(void); Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** nameservice.c 12 Dec 2006 10:54:52 -0000 1.16 --- nameservice.c 4 Feb 2007 21:11:48 -0000 1.17 *************** *** 1,3 **** --- 1,4 ---- /* + * Copyright (c) 2006, Jens Nachtigall * Copyright (c) 2005, Bruno Randolf * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) *************** *** 40,43 **** --- 41,47 ---- #include #include [...1263 lines suppressed...] + + /** + * check if the service matches the syntax + * of "protocol://host:port/path|tcp_or_udp|a short description", + * which is given in the regex regex_t_service + */ + olsr_bool + is_service_wellformed(char *service_line) + { + return regexec(®ex_t_service, service_line, pmatch_service, regmatch_t_service, 0) == 0; + } + + /* + * Local Variables: + * mode: c + * c-indent-tabs-mode: t + * c-basic-offset: 4 + * tab-width: 4 + * End: + */ Index: nameservice_msg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice_msg.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** nameservice_msg.h 17 Mar 2005 21:41:30 -0000 1.6 --- nameservice_msg.h 4 Feb 2007 21:11:48 -0000 1.7 *************** *** 39,57 **** #define _NAMESEVICE_MSG ! typedef enum { NAME_HOST = 0, NAME_FORWARDER = 1, ! NAME_SERVICE = 2 } NAME_TYPE; ! struct name { olsr_u16_t type; olsr_u16_t len; // length of the name union olsr_ip_addr ip; /* ! * name is written in plain text after this struct and padded to 4 byte */ }; --- 39,62 ---- #define _NAMESEVICE_MSG ! /* type of the packet of name_entry */ typedef enum { NAME_HOST = 0, NAME_FORWARDER = 1, ! NAME_SERVICE = 2, } NAME_TYPE; ! /** ! * the name, forwarder or service entry as found in a packet within a ! * message ! **/ struct name { olsr_u16_t type; olsr_u16_t len; // length of the name + // the ip of the hostname, or the ip of the dns-server + // ip is irrelevant for services union olsr_ip_addr ip; /* ! * name or service is written in plain text after this struct and padded to 4 byte */ }; *************** *** 60,65 **** struct namemsg { ! olsr_u16_t version; ! olsr_u16_t nr_names; // number of following name messages /* * at least one struct name following --- 65,70 ---- struct namemsg { ! olsr_u16_t version; // version number of the nameservice plugin ! olsr_u16_t nr_names; // number of following packets including names, forwarders or services /* * at least one struct name following From (spam-protected) Sun Feb 4 22:13:48 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:13:48 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 .cvsignore,NONE,1.1 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3633/src/win32 Added Files: .cvsignore Log Message: * *.d are to be ignored --- NEW FILE: .cvsignore --- *.d From (spam-protected) Sun Feb 4 22:21:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:21:19 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga Makefile,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6772/lib/quagga Modified Files: Makefile Log Message: * the quagga plugin makes prbably only sense on Linux Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 31 Jan 2007 12:38:26 -0000 1.1 --- Makefile 4 Feb 2007 21:21:16 -0000 1.2 *************** *** 53,56 **** --- 53,63 ---- include $(TOPDIR)/Makefile.inc + ifneq ($(OS),linux) + + default_target install clean: + @echo "*** TAS Plugin only supported on Linux, sorry!" + + else + default_target: $(PLUGIN_FULLNAME) *************** *** 64,65 **** --- 71,74 ---- clean: rm -f $(OBJS) $(SRCS:%.c=%.d) $(PLUGIN_FULLNAME) + + endif From (spam-protected) Sun Feb 4 22:35:59 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:35:59 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/lib/dot_draw Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Nov 2005 17:11:46 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:57 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- *.d olsrd_dot_draw.so.* + olsrd_dot_draw.dll From (spam-protected) Sun Feb 4 22:36:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:36:00 +0000 Subject: [Olsr-cvs] olsrd-current/lib/secure .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/secure In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/lib/secure Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Nov 2005 17:11:46 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:58 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- *.d olsrd_secure.so.* + olsrd_secure.dll From (spam-protected) Sun Feb 4 22:36:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:36:00 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw_plain .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw_plain In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/lib/dyn_gw_plain Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw_plain/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 31 Jan 2007 12:38:25 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:58 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- *.d olsrd_dyn_gw_plain.so.* + olsrd_dyn_gw_plain.dll From (spam-protected) Sun Feb 4 22:36:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:36:00 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/lib/httpinfo Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Nov 2005 17:11:46 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:58 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- *.d olsrd_httpinfo.so.* + olsrd_httpinfo.dll From (spam-protected) Sun Feb 4 22:36:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:36:00 +0000 Subject: [Olsr-cvs] olsrd-current/lib/pgraph .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/pgraph In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/lib/pgraph Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Nov 2005 17:11:47 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:58 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- *.d olsrd_pgraph.so.* + olsrd_pgraph.dll From (spam-protected) Sun Feb 4 22:36:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:36:00 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/lib/dyn_gw Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Nov 2005 17:11:46 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:57 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- *.d olsrd_dyn_gw.so.* + olsrd_dyn_gw.dll From (spam-protected) Sun Feb 4 22:36:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:36:00 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/lib/nameservice Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Nov 2005 17:11:47 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:58 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- *.d olsrd_nameservice.so.* + olsrd_nameservice.dll From (spam-protected) Sun Feb 4 22:36:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:36:01 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/src/cfgparser Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Nov 2005 17:11:47 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:58 -0000 1.2 *************** *** 3,4 **** --- 3,5 ---- oparse.[ch] oscan.c + olsrd_cfgparser.dll From (spam-protected) Sun Feb 4 22:36:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 21:36:00 +0000 Subject: [Olsr-cvs] olsrd-current/lib/mini .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/mini In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12400/lib/mini Modified Files: .cvsignore Log Message: * also ignore .dll files Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Nov 2005 17:11:47 -0000 1.1 --- .cvsignore 4 Feb 2007 21:35:58 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- *.d olsrd_mini.so.* + olsrd_mini.dll From (spam-protected) Sun Feb 4 23:37:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 22:37:38 +0000 Subject: [Olsr-cvs] olsrd-current/src/unix ifnet.c,1.41,1.42 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/unix In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10220/src/unix Modified Files: ifnet.c Log Message: * applied hunks from Erik Tromps patch at http://home.tiscali.nl/levab001/olsrd-0.4.10.diff Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ifnet.c 31 Jan 2007 12:36:50 -0000 1.41 --- ifnet.c 4 Feb 2007 22:37:35 -0000 1.42 *************** *** 884,888 **** /* Set interface metric */ - /* Set interface metric */ if(iface->cnf->weight.fixed) ifs.int_metric = iface->cnf->weight.value; --- 884,887 ---- From (spam-protected) Sun Feb 4 23:37:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 22:37:38 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c,1.4,1.5 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10220/src/cfgparser Modified Files: cfgfile_gen.c Log Message: * applied hunks from Erik Tromps patch at http://home.tiscali.nl/levab001/olsrd-0.4.10.diff Index: cfgfile_gen.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/cfgfile_gen.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cfgfile_gen.c 12 Dec 2006 11:22:15 -0000 1.4 --- cfgfile_gen.c 4 Feb 2007 22:37:36 -0000 1.5 *************** *** 317,321 **** } ! fprintf(fd, " # When multiple links exist between hosts\n # the weight of interface is used to determine\n # the link to use. Normally the weight is\n # automatically calculated by olsrd based\n # on the characteristics of the interface,\n # but here you can specify a fixed value.\n # Olsrd will choose links with the lowest value.\n"); if(in->cnf->weight.fixed) { --- 317,331 ---- } ! fprintf(fd, " # When multiple links exist between hosts\n"); ! fprintf(fd, " # the weight of interface is used to determine\n"); ! fprintf(fd, " # the link to use. Normally the weight is\n"); ! fprintf(fd, " # automatically calculated by olsrd based\n"); ! fprintf(fd, " # on the characteristics of the interface,\n"); ! fprintf(fd, " # but here you can specify a fixed value.\n"); ! fprintf(fd, " # Olsrd will choose links with the lowest value.\n"); ! fprintf(fd, " # Note:\n"); ! fprintf(fd, " # Interface weight is used only when LinkQualityLevel is 0.\n"); ! fprintf(fd, " # For any other value of LinkQualityLevel, the interface ETX\n"); ! fprintf(fd, " # value is used instead.\n\n"); if(in->cnf->weight.fixed) { *************** *** 622,628 **** if(first) ! WRITE_TO_BUF(" # When multiple links exist between hosts\n # the weight of interface is used to determine\n # the link to use. Normally the weight is\n") ! if(first) ! WRITE_TO_BUF(" # automatically calculated by olsrd based\n # on the characteristics of the interface,\n # but here you can specify a fixed value.\n # Olsrd will choose links with the lowest value.\n") if(in->cnf->weight.fixed) { --- 632,648 ---- if(first) ! { ! WRITE_TO_BUF(" # When multiple links exist between hosts\n"); ! WRITE_TO_BUF(" # the weight of interface is used to determine\n"); ! WRITE_TO_BUF(" # the link to use. Normally the weight is\n") ! WRITE_TO_BUF(" # automatically calculated by olsrd based\n"); ! WRITE_TO_BUF(" # on the characteristics of the interface,\n"); ! WRITE_TO_BUF(" # but here you can specify a fixed value.\n"); ! WRITE_TO_BUF(" # Olsrd will choose links with the lowest value.\n") ! WRITE_TO_BUF(" # Note:\n"); ! WRITE_TO_BUF(" # Interface weight is used only when LinkQualityLevel is 0.\n"); ! WRITE_TO_BUF(" # For any other value of LinkQualityLevel, the interface ETX\n"); ! WRITE_TO_BUF(" # value is used instead.\n\n"); ! } if(in->cnf->weight.fixed) { From (spam-protected) Sun Feb 4 23:37:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 22:37:38 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src html.h, 1.6, 1.7 olsrd_httpinfo.c, 1.60, 1.61 olsrd_plugin.c, 1.12, 1.13 olsrd_plugin.h, 1.20, 1.21 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10220/lib/httpinfo/src Modified Files: html.h olsrd_httpinfo.c olsrd_plugin.c olsrd_plugin.h Log Message: * applied hunks from Erik Tromps patch at http://home.tiscali.nl/levab001/olsrd-0.4.10.diff Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** olsrd_httpinfo.c 5 Nov 2006 23:03:56 -0000 1.60 --- olsrd_httpinfo.c 4 Feb 2007 22:37:36 -0000 1.61 *************** *** 716,720 **** size += sprintf(&buf[size], "

OLSR routes in kernel

\n"); ! size += sprintf(&buf[size], "\n"); /* Neighbors */ --- 716,723 ---- size += sprintf(&buf[size], "

OLSR routes in kernel

\n"); ! size += sprintf(&buf[size], "
DestinationGatewayMetricETXInterfaceType
"); ! if (olsr_cnf->lq_level > 0) ! size += sprintf(&buf[size], ""); ! size += sprintf(&buf[size], "\n"); /* Neighbors */ *************** *** 725,734 **** routes = routes->next) { ! size += sprintf(&buf[size], "\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); } } --- 728,748 ---- routes = routes->next) { ! size += sprintf(&buf[size], ! "" ! "" ! "", ! olsr_ip_to_string(&routes->rt_dst), ! http_port, ! olsr_ip_to_string(&routes->rt_dst), ! olsr_ip_to_string(&routes->rt_router), ! http_port, ! olsr_ip_to_string(&routes->rt_router), ! routes->rt_metric); ! if (olsr_cnf->lq_level > 0) ! size += sprintf(&buf[size], "", routes->rt_etx); ! size += sprintf(&buf[size], ! "" ! "\n", ! routes->rt_if->int_name); } } *************** *** 741,749 **** routes = routes->next) { ! size += sprintf(&buf[size], "\n", ! olsr_ip_to_string(&routes->rt_dst), ! olsr_ip_to_string(&routes->rt_router), ! routes->rt_metric, ! routes->rt_if->int_name); } } --- 755,773 ---- routes = routes->next) { ! size += sprintf(&buf[size], ! "" ! "" ! "", ! olsr_ip_to_string(&routes->rt_dst), ! olsr_ip_to_string(&routes->rt_router), ! http_port, ! olsr_ip_to_string(&routes->rt_router), ! routes->rt_metric); ! if (olsr_cnf->lq_level > 0) ! size += sprintf(&buf[size], "", routes->rt_etx); ! size += sprintf(&buf[size], ! "" ! "\n", ! routes->rt_if->int_name); } } *************** *** 819,833 **** size += sprintf(&buf[size], "\n\n"); ! size += sprintf(&buf[size], "\n", olsr_cnf->use_hysteresis ? "Enabled" : "Disabled"); ! ! size += sprintf(&buf[size], "\n", olsr_cnf->hysteresis_param.scaling); ! size += sprintf(&buf[size], "\n", olsr_cnf->hysteresis_param.thr_low, olsr_cnf->hysteresis_param.thr_high); size += sprintf(&buf[size], "\n\n"); ! size += sprintf(&buf[size], "\n", olsr_cnf->lq_level ? "Enabled" : "Disabled"); ! size += sprintf(&buf[size], "\n", olsr_cnf->lq_level); ! size += sprintf(&buf[size], "\n", olsr_cnf->lq_wsize); ! size += sprintf(&buf[size], "\n"); size += sprintf(&buf[size], "
DestinationGatewayMetricETXInterfaceType
%s%s%d%.2f%sHOST
%s%s%d%.2f%sHOST
%s%s%d%sHNA
%s%s%d%.2f%sHNA
Hysteresis: %sHyst scaling: %0.2fHyst lower/upper: %0.2f/%0.2f
LQ extention: %sLQ level: %dLQ winsize: %d
\n"); --- 843,864 ---- size += sprintf(&buf[size], "\n\n"); ! if (olsr_cnf->lq_level == 0) ! { ! size += sprintf(&buf[size], "Hysteresis: %s\n", olsr_cnf->use_hysteresis ? "Enabled" : "Disabled"); ! if (olsr_cnf->use_hysteresis) ! { ! size += sprintf(&buf[size], "Hyst scaling: %0.2f\n", olsr_cnf->hysteresis_param.scaling); ! size += sprintf(&buf[size], "Hyst lower/upper: %0.2f/%0.2f\n", olsr_cnf->hysteresis_param.thr_low, olsr_cnf->hysteresis_param.thr_high); ! } ! } size += sprintf(&buf[size], "\n\n"); ! size += sprintf(&buf[size], "LQ extension: %s\n", olsr_cnf->lq_level ? "Enabled" : "Disabled"); ! if (olsr_cnf->lq_level) ! { ! size += sprintf(&buf[size], "LQ level: %d\n", olsr_cnf->lq_level); ! size += sprintf(&buf[size], "LQ winsize: %d\n", olsr_cnf->lq_wsize); ! } size += sprintf(&buf[size], "\n"); *************** *** 871,875 **** size += sprintf(&buf[size], "STATUS: UP\n"); } - } --- 902,905 ---- *************** *** 953,957 **** size += sprintf(&buf[size], "

Links

\n"); ! size += sprintf(&buf[size], "\n"); /* Link set */ --- 983,990 ---- size += sprintf(&buf[size], "

Links

\n"); ! size += sprintf(&buf[size], "
Local IPremote IPHysteresisLinkQualitylosttotalNLQETX
\n"); ! if (olsr_cnf->lq_level > 0) ! size += sprintf(&buf[size], "\n"); ! size += sprintf(&buf[size], "\n"); /* Link set */ *************** *** 959,971 **** while(link) { ! size += sprintf(&buf[size], "\n", ! olsr_ip_to_string(&link->local_iface_addr), ! olsr_ip_to_string(&link->neighbor_iface_addr), ! link->L_link_quality, ! link->loss_link_quality, ! link->lost_packets, ! link->total_packets, ! link->neigh_link_quality, ! (link->loss_link_quality * link->neigh_link_quality) ? 1.0 / (link->loss_link_quality * link->neigh_link_quality) : 0.0); link = link->next; --- 992,1019 ---- while(link) { ! size += sprintf(&buf[size], ! "" ! "" ! "", ! olsr_ip_to_string(&link->local_iface_addr), ! olsr_ip_to_string(&link->neighbor_iface_addr), ! http_port, ! olsr_ip_to_string(&link->neighbor_iface_addr), ! link->L_link_quality); ! if (olsr_cnf->lq_level > 0) ! { ! size += sprintf(&buf[size], ! "" ! "" ! "" ! "" ! "\n", ! link->loss_link_quality, ! link->lost_packets, ! link->total_packets, ! link->neigh_link_quality, ! (link->loss_link_quality * link->neigh_link_quality) ? 1.0 / (link->loss_link_quality * link->neigh_link_quality) : 0.0); ! } ! size += sprintf(&buf[size], "\n"); link = link->next; *************** *** 984,988 **** { size += sprintf(&buf[size], ! "", olsr_ip_to_string(&neigh->neighbor_main_addr), (neigh->status == SYM) ? "YES" : "NO", --- 1032,1042 ---- { size += sprintf(&buf[size], ! "" ! "" ! "" ! "" ! "", ! olsr_ip_to_string(&neigh->neighbor_main_addr), ! http_port, olsr_ip_to_string(&neigh->neighbor_main_addr), (neigh->status == SYM) ? "YES" : "NO", *************** *** 1024,1028 **** ! size += sprintf(&buf[size], "

Topology entries

\n
Local IPremote IPHysteresisLinkQualitylosttotalNLQETX
%s%s%0.2f%0.2f%d%d%0.2f%0.2f
%s%s%0.2f%0.2f%d%d%0.2f%0.2f
%s%s%s%s%d
%s%s%s%s%d
\n"); --- 1078,1085 ---- ! size += sprintf(&buf[size], "

Topology entries

\n
Destination IPLast hop IPLQILQETX
"); ! if (olsr_cnf->lq_level > 0) ! size += sprintf(&buf[size], ""); ! size += sprintf(&buf[size], "\n"); *************** *** 1038,1047 **** while(dst_entry != &entry->destinations) { ! size += sprintf(&buf[size], "\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; --- 1095,1118 ---- while(dst_entry != &entry->destinations) { ! size += sprintf(&buf[size], ! "" ! "", ! olsr_ip_to_string(&dst_entry->T_dest_addr), ! http_port, ! olsr_ip_to_string(&dst_entry->T_dest_addr), ! olsr_ip_to_string(&entry->T_last_addr), ! http_port, ! olsr_ip_to_string(&entry->T_last_addr)); ! if (olsr_cnf->lq_level > 0) ! { ! size += sprintf(&buf[size], ! "" ! "" ! "\n", ! 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); ! } ! size += sprintf(&buf[size], "\n"); dst_entry = dst_entry->next; *************** *** 1086,1090 **** size += sprintf(&buf[size], "", olsr_netmask_to_string(&tmp_net->A_netmask)); ! size += sprintf(&buf[size], "\n", olsr_ip_to_string(&tmp_hna->A_gateway_addr)); tmp_net = tmp_net->next; --- 1157,1163 ---- size += sprintf(&buf[size], "", olsr_netmask_to_string(&tmp_net->A_netmask)); ! size += sprintf(&buf[size], "\n", ! olsr_ip_to_string(&tmp_hna->A_gateway_addr), ! http_port, olsr_ip_to_string(&tmp_hna->A_gateway_addr)); tmp_net = tmp_net->next; *************** *** 1104,1108 **** build_mid_body(char *buf, olsr_u32_t bufsize) { ! int size = 0; olsr_u8_t index; struct mid_entry *entry; --- 1177,1181 ---- build_mid_body(char *buf, olsr_u32_t bufsize) { ! int size = 0, mid_cnt; olsr_u8_t index; struct mid_entry *entry; *************** *** 1117,1132 **** while(entry != &mid_set[index]) { ! size += sprintf(&buf[size], "\n", olsr_ip_to_string(&entry->main_addr)); size += sprintf(&buf[size], "\n"); entry = entry->next; } --- 1190,1208 ---- while(entry != &mid_set[index]) { ! size += sprintf(&buf[size], "\n", ! olsr_ip_to_string(&entry->main_addr), ! http_port, ! olsr_ip_to_string(&entry->main_addr)); size += sprintf(&buf[size], "\n", mid_cnt); entry = entry->next; } Index: html.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/html.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** html.h 14 Mar 2005 21:28:15 -0000 1.6 --- html.h 4 Feb 2007 22:37:36 -0000 1.7 *************** *** 49,53 **** static const char *httpinfo_css[] = { ! "A {text-decoration: none}\n", "TH{text-align: left}\n", "H1, H3, TD, TH {font-family: Helvetica; font-size: 80%%}\n", --- 49,53 ---- static const char *httpinfo_css[] = { ! "#A {text-decoration: none}\n", "TH{text-align: left}\n", "H1, H3, TD, TH {font-family: Helvetica; font-size: 80%%}\n", Index: olsrd_plugin.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_plugin.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** olsrd_plugin.h 29 May 2005 12:47:41 -0000 1.20 --- olsrd_plugin.h 4 Feb 2007 22:37:36 -0000 1.21 *************** *** 72,76 **** #define PLUGIN_INTERFACE_VERSION 4 ! int http_port; /* Allowed hosts stuff */ --- 72,76 ---- #define PLUGIN_INTERFACE_VERSION 4 ! extern int http_port; /* Allowed hosts stuff */ Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_plugin.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** olsrd_plugin.c 29 May 2005 12:47:41 -0000 1.12 --- olsrd_plugin.c 4 Feb 2007 22:37:36 -0000 1.13 *************** *** 52,55 **** --- 52,57 ---- #include "olsrd_httpinfo.h" + int http_port = 0; + static void __attribute__ ((constructor)) my_init(void); From (spam-protected) Sun Feb 4 23:47:47 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 22:47:47 +0000 Subject: [Olsr-cvs] olsrd-current/src olsr.c,1.49,1.50 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14181/src Modified Files: olsr.c Log Message: * applied hunks from Erik Tromps patch at http://home.tiscali.nl/levab001/olsrd-0.4.10.diff Index: olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** olsr.c 31 Jan 2007 12:36:50 -0000 1.49 --- olsr.c 4 Feb 2007 22:47:45 -0000 1.50 *************** *** 214,218 **** if (olsr_cnf->debug_level > 3) { ! olsr_print_duplicate_table(); olsr_print_hna_set(); } --- 214,221 ---- if (olsr_cnf->debug_level > 3) { ! if (olsr_cnf->debug_level > 8) ! { ! olsr_print_duplicate_table(); ! } olsr_print_hna_set(); } *************** *** 221,224 **** --- 224,228 ---- olsr_print_link_set(); olsr_print_neighbor_table(); + olsr_print_two_hop_neighbor_table(); olsr_print_tc_table(); } From (spam-protected) Mon Feb 5 00:27:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 23:27:57 +0000 Subject: [Olsr-cvs] olsrd-current/src main.c,1.90,1.91 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30100/src Modified Files: main.c Log Message: * fixed a typo Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** main.c 31 Jan 2007 12:36:50 -0000 1.90 --- main.c 4 Feb 2007 23:27:55 -0000 1.91 *************** *** 506,510 **** { ! fprintf(stderr, "An error occured somwhere between your keyboard and your chair!\n"); fprintf(stderr, "usage: olsrd [-f ] [ -i interface1 interface2 ... ]\n"); fprintf(stderr, " [-d ] [-ipv6] [-multi ]\n"); --- 506,510 ---- { ! fprintf(stderr, "An error occured somewhere between your keyboard and your chair!\n"); fprintf(stderr, "usage: olsrd [-f ] [ -i interface1 interface2 ... ]\n"); fprintf(stderr, " [-d ] [-ipv6] [-multi ]\n"); From (spam-protected) Mon Feb 5 00:36:37 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 23:36:37 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd net.c,1.29,1.30 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1166/src/bsd Modified Files: net.c Log Message: * killed the MAX_IFS variable and another statically sized array Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/net.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** net.c 12 Dec 2006 11:20:53 -0000 1.29 --- net.c 4 Feb 2007 23:36:35 -0000 1.30 *************** *** 221,225 **** } ! int disable_redirects(char *if_name, int index, int version) { // this function gets called for each interface olsrd uses; however, --- 221,225 ---- } ! int disable_redirects(char *if_name, struct interface *iface, int version) { // this function gets called for each interface olsrd uses; however, *************** *** 230,234 **** } ! int deactivate_spoof(char *if_name, int index, int version) { return 1; --- 230,234 ---- } ! int deactivate_spoof(char *if_name, struct interface *iface, int version) { return 1; From (spam-protected) Mon Feb 5 00:36:37 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 23:36:37 +0000 Subject: [Olsr-cvs] olsrd-current/src interfaces.h, 1.36, 1.37 net_os.h, 1.12, 1.13 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1166/src Modified Files: interfaces.h net_os.h Log Message: * killed the MAX_IFS variable and another statically sized array Index: net_os.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_os.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** net_os.h 28 Aug 2005 19:30:29 -0000 1.12 --- net_os.h 4 Feb 2007 23:36:35 -0000 1.13 *************** *** 84,88 **** int ! disable_redirects(char *, int, int); int --- 84,88 ---- int ! disable_redirects(const char *, struct interface *, int); int *************** *** 90,94 **** int ! deactivate_spoof(char *, int, int); int --- 90,94 ---- int ! deactivate_spoof(const char *, struct interface *, int); int Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** interfaces.h 30 Jan 2007 16:52:41 -0000 1.36 --- interfaces.h 4 Feb 2007 23:36:35 -0000 1.37 *************** *** 160,163 **** --- 160,172 ---- int ttl_index; /* index in TTL array for fish-eye */ + #ifdef linux + /* Struct uesd to store original redirect/ingress setting */ + struct nic_state + { + char redirect; /* The original state of icmp redirect */ + char spoof; /* The original state of the IP spoof filter */ + } nic_state; + #endif + struct interface *int_next; }; From (spam-protected) Mon Feb 5 00:36:37 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 23:36:37 +0000 Subject: [Olsr-cvs] olsrd-current/src/unix ifnet.c,1.42,1.43 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/unix In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1166/src/unix Modified Files: ifnet.c Log Message: * killed the MAX_IFS variable and another statically sized array Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ifnet.c 4 Feb 2007 22:37:35 -0000 1.42 --- ifnet.c 4 Feb 2007 23:36:35 -0000 1.43 *************** *** 871,878 **** /* Deactivate IP spoof filter */ ! deactivate_spoof(if_basename(ifr.ifr_name), iface->index, olsr_cnf->ip_version); /* Disable ICMP redirects */ ! disable_redirects(if_basename(ifr.ifr_name), iface->index, olsr_cnf->ip_version); } --- 871,878 ---- /* Deactivate IP spoof filter */ ! deactivate_spoof(if_basename(ifr.ifr_name), &ifs, olsr_cnf->ip_version); /* Disable ICMP redirects */ ! disable_redirects(if_basename(ifr.ifr_name), &ifs, olsr_cnf->ip_version); } From (spam-protected) Mon Feb 5 00:36:37 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Feb 2007 23:36:37 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux net.c,1.31,1.32 net.h,1.7,1.8 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1166/src/linux Modified Files: net.c net.h Log Message: * killed the MAX_IFS variable and another statically sized array Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/net.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** net.c 5 Nov 2006 23:03:56 -0000 1.31 --- net.c 4 Feb 2007 23:36:35 -0000 1.32 *************** *** 58,61 **** --- 58,65 ---- #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ + /* The original state of the IP forwarding proc entry */ + static char orig_fwd_state; + static char orig_global_redirect_state; + /** *Bind a socket to a device *************** *** 79,84 **** - - /** *Enable IP forwarding. --- 83,86 ---- *************** *** 208,212 **** */ int ! disable_redirects(char *if_name, int index, int version) { FILE *proc_redirect; --- 210,214 ---- */ int ! disable_redirects(const char *if_name, struct interface *iface, int version) { FILE *proc_redirect; *************** *** 229,233 **** else { ! nic_states[index].redirect = fgetc(proc_redirect); fclose(proc_redirect); --- 231,235 ---- else { ! iface->nic_state.redirect = fgetc(proc_redirect); fclose(proc_redirect); *************** *** 258,262 **** */ int ! deactivate_spoof(char *if_name, int index, int version) { FILE *proc_spoof; --- 260,264 ---- */ int ! deactivate_spoof(const char *if_name, struct interface *iface, int version) { FILE *proc_spoof; *************** *** 280,284 **** else { ! nic_states[index].spoof = fgetc(proc_spoof); fclose(proc_spoof); --- 282,286 ---- else { ! iface->nic_state.spoof = fgetc(proc_spoof); fclose(proc_spoof); *************** *** 382,388 **** else { ! syslog(LOG_INFO, "Resetting %s to %c\n", procfile, nic_states[ifs->if_nr].redirect); ! fputc(nic_states[ifs->if_nr].redirect, proc_fd); fclose(proc_fd); } --- 384,390 ---- else { ! syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.redirect); ! fputc(ifs->nic_state.redirect, proc_fd); fclose(proc_fd); } *************** *** 400,406 **** else { ! syslog(LOG_INFO, "Resetting %s to %c\n", procfile, nic_states[ifs->if_nr].spoof); ! fputc(nic_states[ifs->if_nr].spoof, proc_fd); fclose(proc_fd); } --- 402,408 ---- else { ! syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.spoof); ! fputc(ifs->nic_state.spoof, proc_fd); fclose(proc_fd); } Index: net.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/net.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** net.h 28 Aug 2005 19:30:30 -0000 1.7 --- net.h 4 Feb 2007 23:36:35 -0000 1.8 *************** *** 57,62 **** #include "../olsr_protocol.h" - #define MAXIFS 8 /* Maximum number of network interfaces */ - /* Redirect proc entry */ #define REDIRECT_PROC "/proc/sys/net/ipv4/conf/%s/send_redirects" --- 57,60 ---- *************** *** 65,86 **** #define SPOOF_PROC "/proc/sys/net/ipv4/conf/%s/rp_filter" ! /* The original state of the IP forwarding proc entry */ ! char orig_fwd_state; ! char orig_global_redirect_state; ! ! /* Struct uesd to store original redirect/ingress setting */ ! struct nic_state ! { ! int index; /* The OLSR index of the interface */ ! char redirect; /* The original state of icmp redirect */ ! char spoof; /* The original state of the IP spoof filter */ ! struct nic_state *next; ! }; ! ! struct nic_state nic_states[MAXIFS]; ! ! ! extern int ! olsr_printf(int, char *, ...); #endif --- 63,67 ---- #define SPOOF_PROC "/proc/sys/net/ipv4/conf/%s/rp_filter" ! extern int olsr_printf(int, char *, ...); #endif From (spam-protected) Mon Feb 5 22:08:20 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Feb 2007 21:08:20 +0000 Subject: [Olsr-cvs] olsrd-current/redhat - New directory Message-ID: Update of /cvsroot/olsrd/olsrd-current/redhat In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32663/redhat Log Message: Directory /cvsroot/olsrd/olsrd-current/redhat added to the repository From (spam-protected) Mon Feb 5 22:10:00 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Feb 2007 21:10:00 +0000 Subject: [Olsr-cvs] olsrd-current/redhat olsrd.spec,NONE,1.1 Message-ID: Update of /cvsroot/olsrd/olsrd-current/redhat In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv598/redhat Added Files: olsrd.spec Log Message: * added updated .spec file from Roar =?ISO-8859-1?Q?Bj=F8rgum?= Rotvik --- NEW FILE: olsrd.spec --- Summary: OLSR Daemon Name: olsrd Version: current Release: 1 License: BSD Packager: roarbr at tihlde.org Group: System Environment/Daemons Source: http://www.olsr.org/releases/0.4/olsrd-%{version}.tar.bz2 URL: http://www.olsr.org/ BuildRoot: %{_tmppath}/%{name}-root Provides: olsrd %description olsrd is an implementation of the Ad Hoc routing protocol OLSR (RFC3626). OLSRD provides (multihop) routing in a dynamic, changing Ad Hoc network, wired or wireless. This version supports both IPv4 and IPv6. See http://www.olsr.org/ for more info. %prep %setup %{__cat} << 'EOF' > %{name}.init #!/bin/bash # # Startup script for the OLSR Daemon # # chkconfig: 235 16 84 # description: This script starts OLSRD (Ad Hoc routing protocol) # # processname: olsrd # config: %{_sysconfdir}/olsrd.conf # pidfile: %{_localstatedir}/run/olsrd.pid source %{_initrddir}/functions source %{_sysconfdir}/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -x %{_sbindir}/olsrd ] || exit 1 [ -r %{_sysconfdir}/olsrd.conf ] || exit 1 RETVAL=0 prog="olsrd" desc="Ad Hoc routing protocol" start() { echo -n $"Starting $desc ($prog): " daemon $prog -d 0 RETVAL=$? echo [ $RETVAL -eq 0 ] && touch %{_localstatedir}/lock/subsys/$prog return $RETVAL } stop() { echo -n $"Shutting down $desc ($prog): " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f %{_localstatedir}/lock/subsys/$prog return $RETVAL } reload() { echo -n $"Reloading $desc ($prog): " killproc $prog -HUP RETVAL=$? echo return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; condrestart) [ -e %{_localstatedir}/lock/subsys/$prog ] && restart RETVAL=$? ;; status) status olsrd ;; *) echo $"Usage $0 {start|stop|restart|reload|condrestart|status}" RETVAL=1 esac exit $RETVAL EOF %build make %{?_smp_mflags} make %{?_smp_mflags} libs #cd lib/dyn_gw && make %{?_smp_mflags} OS=linux #cd ../dot_draw && make %{?_smp_mflags} OS=linux #cd ../httpinfo && make %{?_smp_mflags} OS=linux #cd ../nameservice && make %{?_smp_mflags} OS=linux #cd ../powerinfo && make %{?_smp_mflags} OS=linux #cd ../secure && make %{?_smp_mflags} OS=linux #cd ../.. %install rm -rf %{buildroot} mkdir -p %{buildroot}/usr/sbin/ mkdir -p %{buildroot}/usr/lib/ mkdir -p %{buildroot}%{_initrddir} mkdir -p %{buildroot}/usr/share/man/man8 make DESTDIR=%{buildroot} install make DESTDIR=%{buildroot} install_libs %{__install} -m0755 olsrd.init %{buildroot}%{_initrddir}/olsrd %clean rm -rf %{buildroot} %preun /etc/init.d/olsrd stop /sbin/chkconfig --del olsrd %post #/sbin/chkconfig --add olsrd # Default to not start olsrd automatic /sbin/chkconfig olsrd off echo "Now please edit /etc/olsrd.conf and run 'service olsrd start' or '/etc/init.d/olsrd start' to start olsrd" echo "Run 'chkconfig olsrd on' to enable automatic starting of olsrd" %files %defattr(-, root, root, 0755) %doc README CHANGELOG %doc lib/dyn_gw/README_DYN_GW lib/dot_draw/README_DOT_DRAW lib/httpinfo/README_HTTPINFO %doc lib/secure/SOLSR-README lib/pgraph/README-OLSR # Do not overwrite original README, should rename these files #%doc lib/nameservice/README lib/mini/README %config(noreplace) %{_sysconfdir}/olsrd.conf %config %{_initrddir}/olsrd /usr/sbin/olsrd # Wildchar to cover all installed plugins /usr/lib/olsrd_*so* /usr/share/man/man8/olsrd.8.gz /usr/share/man/man5/olsrd.conf.5.gz %changelog * Mon Feb 5 2007 Bernd Petrovitsch - updated to CVS-HEAD: - s/INSTALL_PREFIX/DESTDIR/ - removed references to the powerinfo plugin since it is gone * Wed Jan 04 2006 Roar Bj�rgum Rotvik - Created spec-file for 0.4.10 - Removed OS=linux option to make - Updated plugin file list, added wildchar for plugins * Tue Apr 05 2005 Roar Bj�rgum Rotvik - Created spec-file for 0.4.9 * Tue Mar 29 2005 Roar Bj�rgum Rotvik - Increased version number for nameservice and secure plugin * Tue Dec 07 2004 Roar Bj�rgum Rotvik - Changed spec file for olsrd-0.4.8 - Removed frontend GUI inclusion - Removed references to Unik - Changed licence to BSD * Tue Jun 29 2004 Roar Bj�rgum Rotvik - Changed spec file for unik-olsrd-0.4.5 - Remover ROOT-prefix patch as INSTALL_PREFIX is added to Makefile in 0.4.5 - Added INSTALL_PREFIX patch for front-end/Makefile - Included plugins dot_draw and secure - Added documentation for the plugins dyn_gw, powerinfo, dot_draw and secure * Tue May 25 2004 Roar Bj�rgum Rotvik - Changed spec file for unik-olsrd-0.4.4 - Added man-page for olsrd - Removed documentation olsrd-plugin-howto.pdf as it is no longer part of source package * Tue Mar 02 2004 Roar Bj�rgum Rotvik - Changed spec file for unik-olsrd-0.4.3 - Added OLSRD plugins olsrd_dyn_gw and olsrd_power to package - Added documentation olsrd-plugin-howto.pdf * Tue Mar 02 2004 Roar Bj�rgum Rotvik - Renamed package from uolsrd to unik-olsrd to use the same name as the .deb-package - Start olsrd daemon with option "-d 0" to start without debugging and in daemon mode even if debugging is enabled in olsrd.conf. * Mon Mar 01 2004 Roar Bj�rgum Rotvik - Included init-script to start uolsrd daemon (installs as %{_initrddir}/uolsrd). * Wed Feb 25 2004 Roar Bj�rgum Rotvik - Changed Group from Applications/System to System Environment/Daemons. - Included olsrd-gui (forgotten in first release) - Renamed spec file from unik-olsrd-0.4.0.spec to uolsrd-0.4.0.spec * Wed Feb 25 2004 Roar Bj�rgum Rotvik - Created first version of this spec-file From (spam-protected) Mon Feb 5 22:17:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Feb 2007 21:17:28 +0000 Subject: [Olsr-cvs] olsrd-current list-excludes.sh, NONE, 1.1 .cvsignore, 1.1, 1.2 Makefile, 1.74, 1.75 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3093 Modified Files: .cvsignore Makefile Added Files: list-excludes.sh Log Message: * added a "rpm" target to produce a olsrd-current..rpm * added a quagga target similar to all the others * pass the DESTDIR variable down * fixed makefile output of the cfgfilename * do not change the local olsrd binary but inly the installed one Index: .cvsignore =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 21 Oct 2006 21:40:49 -0000 1.1 --- .cvsignore 5 Feb 2007 21:17:26 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- olsrd *.d + olsrd-current.tar.bz2 --- NEW FILE: list-excludes.sh --- (This appears to be a binary file; contents omitted.) Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** Makefile 31 Jan 2007 12:36:49 -0000 1.74 --- Makefile 5 Feb 2007 21:17:26 -0000 1.75 *************** *** 86,96 **** install_bin: - $(STRIP) $(EXENAME) mkdir -p $(SBINDIR) install -m 755 $(EXENAME) $(SBINDIR) install_olsrd: install_bin @echo ========= C O N F I G U R A T I O N - F I L E ============ ! @echo olsrd uses the configfile $(DESTDIR)/etc/olsr.conf @echo a default configfile. A sample RFC-compliance aimed @echo configfile can be installed. Note that a LQ-based configfile --- 86,96 ---- install_bin: mkdir -p $(SBINDIR) install -m 755 $(EXENAME) $(SBINDIR) + $(STRIP) $(SBINDIR)/$(EXENAME) install_olsrd: install_bin @echo ========= C O N F I G U R A T I O N - F I L E ============ ! @echo olsrd uses the configfile $(CFGFILE) @echo a default configfile. A sample RFC-compliance aimed @echo configfile can be installed. Note that a LQ-based configfile *************** *** 111,114 **** --- 111,120 ---- $(TAGCMD) -o $(TAGFILE) $(TAG_SRCS) + rpm: + @$(RM) olsrd-current.tar.bz2 + @echo "Creating olsrd-current.tar.bz2 ..." + @./list-excludes.sh | tar --exclude-from=- --exclude="olsrd-current.tar.bz2" -C .. -cjf olsrd-current.tar.bz2 olsrd-current + @echo "Building RPMs..." + @rpmbuild -ta olsrd-current.tar.bz2 # # PLUGINS *************** *** 127,168 **** $(MAKE) -C lib/httpinfo clean $(MAKE) -C lib/httpinfo ! $(MAKE) -C lib/httpinfo install tas: $(MAKE) -C lib/tas clean ! $(MAKE) -C lib/tas install dot_draw: $(MAKE) -C lib/dot_draw clean ! $(MAKE) -C lib/dot_draw install nameservice: $(MAKE) -C lib/nameservice clean ! $(MAKE) -C lib/nameservice install dyn_gw: $(MAKE) -C lib/dyn_gw clean $(MAKE) -C lib/dyn_gw ! $(MAKE) -C lib/dyn_gw install dyn_gw_plain: $(MAKE) -C lib/dyn_gw_plain clean $(MAKE) -C lib/dyn_gw_plain ! $(MAKE) -C lib/dyn_gw_plain install secure: $(MAKE) -C lib/secure clean $(MAKE) -C lib/secure ! $(MAKE) -C lib/secure install pgraph: $(MAKE) -C lib/pgraph clean $(MAKE) -C lib/pgraph ! $(MAKE) -C lib/pgraph install bmf: $(MAKE) -C lib/bmf clean $(MAKE) -C lib/bmf ! $(MAKE) -C lib/bmf install build_all: cfgparser olsrd libs --- 133,180 ---- $(MAKE) -C lib/httpinfo clean $(MAKE) -C lib/httpinfo ! $(MAKE) -C lib/httpinfo DESTDIR=$(DESTDIR) install tas: $(MAKE) -C lib/tas clean ! $(MAKE) -C lib/tas DESTDIR=$(DESTDIR) install dot_draw: $(MAKE) -C lib/dot_draw clean ! $(MAKE) -C lib/dot_draw DESTDIR=$(DESTDIR) install nameservice: $(MAKE) -C lib/nameservice clean ! $(MAKE) -C lib/nameservice DESTDIR=$(DESTDIR) install dyn_gw: $(MAKE) -C lib/dyn_gw clean $(MAKE) -C lib/dyn_gw ! $(MAKE) -C lib/dyn_gw DESTDIR=$(DESTDIR) install dyn_gw_plain: $(MAKE) -C lib/dyn_gw_plain clean $(MAKE) -C lib/dyn_gw_plain ! $(MAKE) -C lib/dyn_gw_plain DESTDIR=$(DESTDIR) install secure: $(MAKE) -C lib/secure clean $(MAKE) -C lib/secure ! $(MAKE) -C lib/secure DESTDIR=$(DESTDIR) install pgraph: $(MAKE) -C lib/pgraph clean $(MAKE) -C lib/pgraph ! $(MAKE) -C lib/pgraph DESTDIR=$(DESTDIR) install bmf: $(MAKE) -C lib/bmf clean $(MAKE) -C lib/bmf ! $(MAKE) -C lib/bmf DESTDIR=$(DESTDIR) install ! ! quagga: ! $(MAKE) -C lib/quagga clean ! $(MAKE) -C lib/quagga ! $(MAKE) -C lib/quagga DESTDIR=$(DESTDIR) install ! build_all: cfgparser olsrd libs From (spam-protected) Mon Feb 5 22:25:51 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Feb 2007 21:25:51 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.5,1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7109 Modified Files: Makefile.inc Log Message: * added support and automagic detection for ccache * cosmetic cleanup Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.inc 12 Nov 2006 21:54:52 -0000 1.5 --- Makefile.inc 5 Feb 2007 21:25:49 -0000 1.6 *************** *** 1,4 **** # programs ! CC ?= gcc STRIP ?= strip BISON ?= bison --- 1,5 ---- # programs ! CCACHE = $(shell sh -c "type -path ccache") ! CC ?= $(CCACHE) gcc STRIP ?= strip BISON ?= bison *************** *** 7,18 **** # target directories and names ! # DESTDIR = ! SBINDIR = $(DESTDIR)/usr/sbin ! ETCDIR = $(DESTDIR)/etc ! LIBDIR = $(DESTDIR)/usr/lib ! DOCDIR = $(DESTDIR)/usr/share/doc ! MANDIR = $(DESTDIR)/usr/share/man ! CFGFILE = $(ETCDIR)/olsrd.conf ! EXENAME = olsrd INCLUDES = -Isrc -I$(TOPDIR)/src --- 8,19 ---- # target directories and names ! DESTDIR ?= ! SBINDIR ?= $(DESTDIR)/usr/sbin ! ETCDIR ?= $(DESTDIR)/etc ! LIBDIR ?= $(DESTDIR)/usr/lib ! DOCDIR ?= $(DESTDIR)/usr/share/doc ! MANDIR ?= $(DESTDIR)/usr/share/man ! CFGFILE ?= $(ETCDIR)/olsrd.conf ! EXENAME ?= olsrd INCLUDES = -Isrc -I$(TOPDIR)/src From (spam-protected) Mon Feb 5 22:49:46 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Feb 2007 21:49:46 +0000 Subject: [Olsr-cvs] olsrd-current README,1.16,1.17 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16785 Modified Files: README Log Message: * fixed documentation Index: README =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/README,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** README 23 Nov 2005 05:51:07 -0000 1.16 --- README 5 Feb 2007 21:49:43 -0000 1.17 *************** *** 320,324 **** installed. This includes gcc, make, glibc, makedep etc. To install to a directory different from /(/etc, /usr/bin) use ! INSTALL_PREFIX=targetdir. To use other compilers set CC=yourcompiler. To build: --- 320,324 ---- installed. This includes gcc, make, glibc, makedep etc. To install to a directory different from /(/etc, /usr/bin) use ! DESTDIR=targetdir. To use other compilers set CC=yourcompiler. To build: From (spam-protected) Tue Feb 6 22:07:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 06 Feb 2007 21:07:13 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.h, 1.10, 1.11 nameservice.c, 1.17, 1.18 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21704/lib/nameservice/src Modified Files: nameservice.h nameservice.c Log Message: * killed in_addr Index: nameservice.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** nameservice.h 4 Feb 2007 21:11:48 -0000 1.10 --- nameservice.h 6 Feb 2007 21:07:11 -0000 1.11 *************** *** 119,123 **** struct name_entry* ! add_name_to_list(struct name_entry *my_list, char *value, int type, struct in_addr *ip); struct name_entry* --- 119,123 ---- struct name_entry* ! add_name_to_list(struct name_entry *my_list, char *value, int type, const union olsr_ip_addr *ip); struct name_entry* Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** nameservice.c 4 Feb 2007 21:11:48 -0000 1.17 --- nameservice.c 6 Feb 2007 21:07:11 -0000 1.18 *************** *** 184,192 **** } else if(!strcmp(key, "dns-server")) { ! struct in_addr ip; if (strlen(value) == 0) { my_forwarders = add_name_to_list(my_forwarders, "", NAME_FORWARDER, NULL); olsr_printf(1,"\nNAME PLUGIN: parameter dns-server: (main address)"); ! } else if (inet_aton(value, &ip)) { my_forwarders = add_name_to_list(my_forwarders, "", NAME_FORWARDER, &ip); olsr_printf(1,"\nNAME PLUGIN: parameter dns-server: (%s)", value); --- 184,192 ---- } else if(!strcmp(key, "dns-server")) { ! union olsr_ip_addr ip; if (strlen(value) == 0) { my_forwarders = add_name_to_list(my_forwarders, "", NAME_FORWARDER, NULL); olsr_printf(1,"\nNAME PLUGIN: parameter dns-server: (main address)"); ! } else if (inet_pton(olsr_cnf->ip_version, value, &ip)) { my_forwarders = add_name_to_list(my_forwarders, "", NAME_FORWARDER, &ip); olsr_printf(1,"\nNAME PLUGIN: parameter dns-server: (%s)", value); *************** *** 207,211 **** else { // assume this is an IP address and hostname ! struct in_addr ip; if (inet_pton(olsr_cnf->ip_version, key, &ip) == 1) { --- 207,211 ---- else { // assume this is an IP address and hostname ! union olsr_ip_addr ip; if (inet_pton(olsr_cnf->ip_version, key, &ip) == 1) { *************** *** 228,235 **** */ struct name_entry* ! add_name_to_list(struct name_entry *my_list, char *value, int type, struct in_addr *ip) { ! struct name_entry *tmp; ! tmp = olsr_malloc(sizeof(struct name_entry), "new name_entry add_name_to_list"); tmp->name = strndup( value, MAX_NAME ); tmp->len = strlen( tmp->name ); --- 228,234 ---- */ struct name_entry* ! add_name_to_list(struct name_entry *my_list, char *value, int type, const union olsr_ip_addr *ip) { ! struct name_entry *tmp = olsr_malloc(sizeof(struct name_entry), "new name_entry add_name_to_list"); tmp->name = strndup( value, MAX_NAME ); tmp->len = strlen( tmp->name ); *************** *** 239,243 **** memset(&tmp->ip, 0, sizeof(tmp->ip)); else ! tmp->ip.v4 = ip->s_addr; tmp->next = my_list; return tmp; --- 238,242 ---- memset(&tmp->ip, 0, sizeof(tmp->ip)); else ! tmp->ip = *ip; tmp->next = my_list; return tmp; *************** *** 548,552 **** */ void ! olsr_parser(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *in_addr) { struct namemsg *namemessage; --- 547,551 ---- */ void ! olsr_parser(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *ipaddr) { struct namemsg *namemessage; *************** *** 584,589 **** /* Check that the neighbor this message was received from is symmetric. If not - back off*/ ! if(check_neighbor_link(in_addr) != SYM_LINK) { ! olsr_printf(3, "NAME PLUGIN: Received msg from NON SYM neighbor %s\n", olsr_ip_to_string(in_addr)); return; } --- 583,588 ---- /* Check that the neighbor this message was received from is symmetric. If not - back off*/ ! if(check_neighbor_link(ipaddr) != SYM_LINK) { ! olsr_printf(3, "NAME PLUGIN: Received msg from NON SYM neighbor %s\n", olsr_ip_to_string(ipaddr)); return; } *************** *** 593,607 **** * processed if nessecary */ ! if(!olsr_check_dup_table_proc(&originator, seqno)) { ! /* If so - do not process */ ! goto forward; } - update_name_entry(&originator, namemessage, size, vtime); - - forward: /* Forward the message if nessecary * default_fwd does all the work for us! */ ! olsr_forward_message(m, &originator, seqno, in_if, in_addr); } --- 592,603 ---- * processed if nessecary */ ! if(olsr_check_dup_table_proc(&originator, seqno)) { ! /* If not so - process */ ! update_name_entry(&originator, namemessage, size, vtime); } /* Forward the message if nessecary * default_fwd does all the work for us! */ ! olsr_forward_message(m, &originator, seqno, in_if, ipaddr); } *************** *** 1267,1271 **** { char *hostname_or_ip; - struct in_addr ip; union olsr_ip_addr olsr_ip; struct name_entry *name; --- 1263,1266 ---- *************** *** 1286,1291 **** //ip in service-line is allowed ! if (inet_aton(hostname_or_ip, &ip)) { ! olsr_ip.v4 = ip.s_addr; if (allowed_ip(&olsr_ip)) { olsr_printf(2, "NAME PLUGIN: ip %s in service %s is OK\n", olsr_ip_to_string(&olsr_ip), service_line); --- 1281,1285 ---- //ip in service-line is allowed ! if (inet_pton(olsr_cnf->ip_version, hostname_or_ip, &olsr_ip)) { if (allowed_ip(&olsr_ip)) { olsr_printf(2, "NAME PLUGIN: ip %s in service %s is OK\n", olsr_ip_to_string(&olsr_ip), service_line); From (spam-protected) Thu Feb 8 11:31:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Feb 2007 10:31:45 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Packet.c,1.1,1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7390/lib/bmf/src Modified Files: Packet.c Log Message: * bug fixes from Sven-Ola Index: Packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Packet.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Packet.c 3 May 2006 08:59:04 -0000 1.1 --- Packet.c 8 Feb 2007 10:31:43 -0000 1.2 *************** *** 39,42 **** --- 39,43 ---- #include /* u_int32_t */ #include /* ntohs(), htons() */ + #include #include From (spam-protected) Thu Feb 8 11:31:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Feb 2007 10:31:45 +0000 Subject: [Olsr-cvs] olsrd-current/lib Makefile,1.7,1.8 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7390/lib Modified Files: Makefile Log Message: * bug fixes from Sven-Ola Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 31 Jan 2007 12:36:49 -0000 1.7 --- Makefile 8 Feb 2007 10:31:43 -0000 1.8 *************** *** 1,3 **** ! SUBDIRS := $(shell find -maxdepth 1 -type d -not -name ".*" -not -name "CVS" -printf "%f\n") .PHONY: $(SUBDIRS) --- 1,3 ---- ! SUBDIRS := $(shell find -maxdepth 2 -name Makefile -not -path ./Makefile -printf "%h\n") .PHONY: $(SUBDIRS) From (spam-protected) Sat Feb 10 18:05:58 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 17:05:58 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf Makefile, 1.1, 1.2 README_BMF.txt, 1.1, 1.2 Copyright-Disclaimer.txt, 1.1, NONE Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14934 Modified Files: Makefile README_BMF.txt Removed Files: Copyright-Disclaimer.txt Log Message: * replaced the bmf plugin with the most recent 1.3 from sf.net with the following changes: - We had a globally declared ioctl_s variable which is used exactly once in NetworkInterfaces.c. Sven-Ola proposed a global "extern" decalaretion but I inserted it there locally. Main reason: Where does this variable actually come from? I can only find one in the olsr_cnf struct. But since the compiler/linker finds one, there must be one somewhere. - I #if 0 ... #endif out the IsNullMacAddress() function since it is not used AFAICS (and the compiler actually). Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 3 May 2006 08:59:04 -0000 1.1 --- Makefile 10 Feb 2007 17:05:55 -0000 1.2 *************** *** 36,40 **** OLSRD_PLUGIN = true PLUGIN_NAME = olsrd_bmf ! PLUGIN_VER = 1.0.1 TOPDIR = ../.. --- 36,40 ---- OLSRD_PLUGIN = true PLUGIN_NAME = olsrd_bmf ! PLUGIN_VER = 1.3 TOPDIR = ../.. --- Copyright-Disclaimer.txt DELETED --- Index: README_BMF.txt =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/README_BMF.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README_BMF.txt 3 May 2006 08:59:04 -0000 1.1 --- README_BMF.txt 10 Feb 2007 17:05:55 -0000 1.2 *************** *** 1,75 **** BASIC MULTICAST FORWARDING PLUGIN FOR OLSRD ! by Erik Tromp (erik_tromp at hotmail.com) ! ! 27-04-2006: Version 1.0.1 - First release. ! 1. Introduction --------------- ! The Basic Multicast Flooding Plugin forwards IP-multicast and ! IP-local-broacast traffic over an OLSRD network. It uses the Multi-Point Relays (MPRs) as identified by the OLSR protocol to optimize the flooding of multicast and local broadcast packets ! to all the nodes in the network. To prevent broadcast storms, a history of packets is kept; only packets that have not been seen in the past 3-6 seconds are forwarded. - In the IP header there is room for only two IP-addresses: - * the destination IP address (in our case either a multicast - IP-address 224.0.0.0...239.255.255.255, or a local broadcast - address e.g. 192.168.1.255), and - * the source IP address (the originator). ! For optimized flooding, however, we need more information. Let's ! assume we are the BMF process on one node. We will need to know which ! node forwarded the IP packet to us. Since OLSR keeps track of which ! nodes select our node as MPR (see the olsr_lookup_mprs_set function), ! we can determine if the node that forwarded the packet, has selected us as ! MPR. If so, we must also forward the packet, replacing the 'forwarded-by' ! IP-address to that of us. ! Because we need more information than fits in a normal IP-header, the ! original packets are encapsulated into a new IP packet. Encapsulated ! packets are transported in UDP, port 50505. The source address of the ! encapsulation packet is set to the address of the forwarder instead of ! the originator. Of course, the payload of the encapsulation packet is ! the original IP packet. ! For local reception, each received encapsulated packets is unpacked ! and passed into a tuntap interface which is specially created for ! this purpose. ! Here is in short how the flooding works (see also the ! BmfEncapsulatedPacketReceived(...) function; details with respect to ! the forwarding towards non-OLSR enabled nodes are omitted): ! ! On all OLSR-enabled interfaces, setup reception of packets ! on UDP port 50505. ! Upon reception of such a packet: ! If the received packet was sent by ourselves, drop it. ! If the packet was recently seen, drop it. ! Unpack the encapsulated packet and send a copy to myself via the ! TunTap device. ! If I am an MPR for the node that forwarded the packet to me, ! forward the packet to all OLSR-enabled interfaces *including* ! the one on which it was received. ! As with all good things in life, it's so simple you could have ! thought of it yourself. ! ! 2. How to build and install ! --------------------------- ! Follow the instructions in the base directory README file under ! section II. - BUILDING AND RUNNING OLSRD. To be sure to install ! the BMF plugin, cd to the base directory and issue the follwing ! command at the shell prompt: make install_all ! Next, turn on the possibility to create a tuntap device (see also ! /usr/src/linux/Documentation/networking/tuntap.txt) mkdir /dev/net # if it doesn't exist already --- 1,40 ---- BASIC MULTICAST FORWARDING PLUGIN FOR OLSRD ! by Erik Tromp (erik.tromp at nl.thalesgroup.com, erik_tromp at hotmail.com) ! Version 1.3 1. Introduction --------------- ! The Basic Multicast Forwarding Plugin floods IP-multicast and ! IP-local-broadcast traffic over an OLSRD network. It uses the Multi-Point Relays (MPRs) as identified by the OLSR protocol to optimize the flooding of multicast and local broadcast packets ! to all the hosts in the network. To prevent broadcast storms, a history of packets is kept; only packets that have not been seen in the past 3-6 seconds are forwarded. ! 2. How to build and install ! --------------------------- ! Download the olsr-bmf-v1.3.tar.gz file and save it into your OLSRD ! base install directory. ! Change directory (cd) to your OLSRD base install directory. ! At the command prompt, type: ! tar -zxvf ./olsr-bmf-v1.3.tar.gz ! then type: ! make build_all ! ! followed by: make install_all ! Next, turn on the possibility to create a tuntap interface (see also ! /usr/src/linux/Documentation/networking/tuntap.txt): mkdir /dev/net # if it doesn't exist already *************** *** 77,85 **** Set permissions, e.g.: chmod 0700 /dev/net/tun - - Edit the file /etc/olsrd.conf to load the BMF plugin. For example: ! LoadPlugin "olsrd_bmf.so.1.0.1" { # No PlParam entries required for basic operation --- 42,52 ---- Set permissions, e.g.: + chmod 0700 /dev/net/tun ! To configure BMF in OLSR, you must edit the file /etc/olsrd.conf ! to load the BMF plugin. For example, add the following lines: ! ! LoadPlugin "olsrd_bmf.so.1.3" { # No PlParam entries required for basic operation *************** *** 91,95 **** After building and installing OLSRD with the BMF plugin, run the ! olsrd deamon by entering at the shell prompt: olsrd --- 58,63 ---- After building and installing OLSRD with the BMF plugin, run the ! olsrd daemon by entering at the shell prompt: ! olsrd *************** *** 97,111 **** ---------- Plugin loader ---------- ! Library: olsrd_bmf.so.1.0.1 ! OLSRD Basic Multicast Forwarding plugin 1.0.1 (Apr 29 2006 12:57:57) (C) Thales Communications Huizen, Netherlands ! Erik Tromp (erik_tromp at hotmail.com) Checking plugin interface version... 4 - OK Trying to fetch plugin init function... OK Trying to fetch param function... OK Sending parameters... ! "NonOlsrIf"/"eth2"... OK ! "Drop"/"00:0C:29:28:0E:CC"... OK Running plugin_init function... ---------- LIBRARY LOADED ---------- --- 65,79 ---- ---------- Plugin loader ---------- ! Library: olsrd_bmf.so.1.3 ! OLSRD Basic Multicast Forwarding plugin 1.3 (Dec 18 2006 11:23:51) (C) Thales Communications Huizen, Netherlands ! Erik Tromp (erik.tromp at nl.thalesgroup.com) Checking plugin interface version... 4 - OK Trying to fetch plugin init function... OK Trying to fetch param function... OK Sending parameters... ! "NonOlsrIf"/"eth0"... OK Running plugin_init function... + OLSRD Basic Multicast Forwarding (BMF) plugin: opened 6 sockets ---------- LIBRARY LOADED ---------- *************** *** 114,127 **** --------------------------- ! To check that BMF is working, enter the folliwing command on the ! command prompt: ! ping -I eth1 224.0.0.1 ! Replace eth1 with the name of any OLSR-enabled network interface. ! ! All OLSR-BMF nodes in the MANET should respond. For example: ! root at IsdbServer:~# ping -I eth1 224.0.0.1 PING 224.0.0.1 (224.0.0.1) from 192.168.151.50 eth1: 56(84) bytes of data. 64 bytes from 192.168.151.50: icmp_seq=1 ttl=64 time=0.511 ms --- 82,95 ---- --------------------------- ! Enter the following command on the command prompt: ! ping 224.0.0.1 ! All OLSR-BMF hosts in the OLSR network should respond. For example, ! assume we have three hosts, with IP addresses 192.168.151.50, ! 192.168.151.53 and 192.168.151.55. On host 192.168.151.50 we enter ! the following ping command: ! root at IsdbServer:~# ping 224.0.0.1 PING 224.0.0.1 (224.0.0.1) from 192.168.151.50 eth1: 56(84) bytes of data. 64 bytes from 192.168.151.50: icmp_seq=1 ttl=64 time=0.511 ms *************** *** 138,147 **** 64 bytes from 192.168.151.55: icmp_seq=4 ttl=63 time=1.16 ms (DUP!) ! 5. Adding non-OLSR interfaces to the multicast flooding ------------------------------------------------------- ! As a special feature, it is possible to have multicast and local-broadcast ! IP packets forwarded also on non-OLSR interfaces. If you have network interfaces on which OLSR is *not* running, but you *do* --- 106,307 ---- 64 bytes from 192.168.151.55: icmp_seq=4 ttl=63 time=1.16 ms (DUP!) + We can see the response from the originating host (192.168.151.50) + (it is normal behaviour for hosts sending multicast packets to + receive their own packets). We can also see the responses by the + other hosts (correctly seen as DUPlicates by ping). + ! 5. How does it work ! ------------------- ! ! In the IP header there is room for only two IP-addresses: ! * the destination IP address (in our case either a multicast ! IP-address 224.0.0.0...239.255.255.255, or a local broadcast ! address e.g. 192.168.1.255), and ! * the source IP address (the originator). ! ! For optimized flooding, however, we need more information. Let's ! assume we are the BMF process on one host. We will need to know which ! host forwarded the IP packet to us. Since OLSR keeps track of which ! hosts select our host as MPR (see the olsr_lookup_mprs_set(...) function), ! we can determine if the host that forwarded the packet, has selected us as ! MPR. If so, we must also forward the packet, changing the 'forwarded-by' ! IP-address to that of us. If not, we do not forward the packet. ! ! Because we need more information than fits in a normal IP-header, the ! original packets are encapsulated into a new IP packet. Encapsulated ! packets are transported in UDP, port 50698. The source address of the ! encapsulation packet is set to the address of the forwarder instead of ! the originator. Of course, the payload of the encapsulation packet is ! the original IP packet. ! ! For local reception, each received encapsulated packets is unpacked ! and passed into a tuntap interface which is specially created for ! this purpose. ! ! There are other flooding solutions available that do not use ! encapsulation. The problem with these solutions is that they cannot ! prevent duplicates of forwarded packets to enter the IP stack. For ! example, if a host is receiving flooded (unencapsulated, native IP) ! packets via two MPR hosts, there is no way to stop the reception of ! the packets coming in via the second MPR host. To prevent this, BMF ! uses a combination of encapsulated flooding and local reception via ! a tuntap interface. ! ! Here is in short how the flooding works (see also the ! BmfEncapsulatedPacketReceived(...) function; details with respect to ! the forwarding towards non-OLSR enabled hosts are omitted): ! ! On all OLSR-enabled interfaces, setup reception of packets ! on UDP port 50698. ! Upon reception of such a packet: ! If the received packet was sent by myself, drop it. ! If the packet was recently seen, drop it. ! Unpack the encapsulated packet and send a copy to myself via the ! TunTap interface. ! If I am an MPR for the host that forwarded the packet to me, ! forward the packet to all OLSR-enabled interfaces *including* ! the interface on which it was received. ! ! ! 6. Advanced configuration ! ------------------------- ! ! All configuration of BMF is done via the "LoadPlugin" section in ! the /etc/olsrd.conf file. ! ! The following gives an overview of all plugin parameters that can be ! configured: ! ! LoadPlugin "olsrd_bmf.so.1.3" ! { ! # Specify the name of the BMF network interface. ! # Defaults to "bmf0". ! PlParam "BmfInterface" "mybmf0" ! ! # Specify the type of the BMF network interface: either "tun" or ! # "tap". Defaults to "tun". ! PlParam "BmfInterfaceType" "tap" ! ! # Specify the IP address and mask for the BMF network interface. ! # By default, the IP address of the first OLSR interface is copied. ! # The default prefix length is 32. ! PlParam "BmfInterfaceIp" "10.10.10.234/24" ! ! # Enable or disable the flooding of local broadcast packets ! # (e.g. packets with IP destination 192.168.1.255). Either "yes" ! # or "no". Defaults to "yes". ! PlParam "DoLocalBroadcast" "no" ! ! # Enable or disable the capturing packets on the OLSR-enabled ! # interfaces (in promiscuous mode). Either "yes" or "no". Defaults ! # to "no". ! # The multicast (and, if configured, local broadcast) packets sent on ! # the non-OLSR network interfaces and on the BMF network interface will ! # always be flooded over the OLSR network. ! # If this parameter is "yes", also the packets sent on the OLSR-enabled ! # network interfaces will be flooded over the OLSR network. ! # NOTE: This parameter should be set consistently on all hosts throughout ! # the network. If not, hosts may receive multicast packets in duplicate. ! PlParam "CapturePacketsOnOlsrInterfaces" "yes" ! ! # List of non-OLSR interfaces to include ! PlParam "NonOlsrIf" "eth2" ! PlParam "NonOlsrIf" "eth3" ! } ! ! BmfInterfaceIp ! -------------- ! ! By default, the BMF network interface will get the IP address of the ! first OLSR interface, with a prefix length of 32. Having two network ! interfaces with the same IP address may seem strange, but it is not ! a problem, since the BMF network interface is not used in any point-to- ! point routing. ! ! The advantage of assigning a known OLSR IP address to the BMF network ! interface is that multicast packets, sent via the BMF network interface, ! get a known IP source address, to which the receivers of the packets ! can reply. That is useful when using, for example, the command ! "ping 224.0.0.1". ! ! An advantage of using a prefix length of 32 is that the Linux IP ! stack will not automatically enter a subnet routing entry (via the BMF ! network interface) into the kernel routing table. Such a routing entry ! would be useless, because the BMF network interface does not forward ! point-to-point traffic. ! ! If you configure a specific IP address and mask via the "BmfInterfaceIp" ! parameter, BMF will cause the specified IP host address to be advertised ! into the OLSR network via the HNA mechanism, so that the other hosts in ! the network know how to route back. ! ! CapturePacketsOnOlsrInterfaces ! ------------------------------ ! ! If "CapturePacketsOnOlsrInterfaces" is set to "yes", any multicast ! or local broadcast IP packet, sent by an application on *any* OLSR ! interface, will be flooded over the OLSR network. Each OLSR host ! will receive the packet on its BMF network interface, "bmf0". The ! OLSR-interfaces will be in promiscuous mode to capture the multicast ! or local broadcast packets. ! ! For example, if "eth1" is an OLSR interface, the following command ! will result in one response from each OLSR host in the network: ! ! ping -I eth1 224.0.0.1 ! ! A disadvantage of this configuration is that a host may, in rare ! cases, receive a multicast packet twice. This is best explained ! by looking at the following network diagram: ! ! eth0 eth0 ! A ----------- B ! eth1 | / eth1 ! | / ! eth0 | / ! C --------+ ! eth1 ! ! Suppose host A is running a ping session that is sending ping ! packets on "eth1". The BMF process on host A will see the outgoing ! packets on "eth1", encapsulates these packets and sends the ! encapsulated packets on "eth0". Let's assume we are using the link ! quality extensions of OLSR, and the 2-hop path A - B - C is better ! (in terms of ETX) than the 1-hop path A - C. In that case host B is ! an MPR for host A. Host B receives the encapsulated packets of host A ! on its "eth0" interface, and, since it is an MPR, it decides to ! forward them on "eth1". ! ! In most cases, host C will receive the original, unencapsulated ! ping packet on its "eth0" interface before the encapsulated ! ping packet from host B arrives on its "eth1" interface. When the ! encapsulated packet from B arrives, the BMF process will then see ! that it is a duplicate and discard it. ! ! However, in the IP world, there are no guarantees, so it may ! happen that host C receives the encapsulated packet from host B ! first. That packet is then unpacked and locally delivered to the ! BMF network interface "bmf0". When the original, unencapsulated ! packet then comes in on "eth0", there is no way to stop it from ! being received (for a second time) by the Linux IP stack. ! ! As said, this may be a rare case. Besides, most applications ! can deal with a duplicate reception of the same packet. But if ! you're a purist and want everything to work correct, you should ! leave "CapturePacketsOnOlsrInterfaces" to its default value "no". ! ! A disadvantage of leaving "CapturePacketsOnOlsrInterfaces" to its ! default value "no" is that all multicast traffic must go via the ! BMF network interface "bmf0". However, this should not be a problem, ! since a route to all multicast addresses via the BMF network ! interface "bmf0" is automatically added when BMF is started. ! ! ! 7. Adding non-OLSR interfaces to the multicast flooding ------------------------------------------------------- ! As a special feature, it is possible to also forward from and to ! non-OLSR interfaces. If you have network interfaces on which OLSR is *not* running, but you *do* *************** *** 150,154 **** of /etc/olsrd.conf. For example: ! LoadPlugin "olsrd_bmf.so.1.0.1" { # Non-OLSR interfaces to participate in the multicast flooding --- 310,314 ---- of /etc/olsrd.conf. For example: ! LoadPlugin "olsrd_bmf.so.1.3" { # Non-OLSR interfaces to participate in the multicast flooding *************** *** 157,205 **** } ! If an interface is listed both as NonOlsrIf for BMF, and in the Interfaces { ... } section of olsrd.conf, it will be seen by BMF ! as an OLSR-enabled interface. Duh.... ! ! 6. Testing in a lab environment ------------------------------- ! Setup IP-tables to drop packets from nodes which are not ! direct (1-hop) neigbors. For example, to drop all packets from ! a host with MAC address 00:0C:29:28:0E:CC, enter at the shell prompt: iptables -A INPUT -m mac --mac-source 00:0C:29:28:0E:CC -j DROP ! Edit the file /etc/olsrd.conf, and specify the MAC addresses of the nodes ! we do not want to see; even though packets from these nodes are dropped ! by iptables, they are still received on network interfaces which are in ! promiscuous mode. For example: ! LoadPlugin "olsrd_bmf.so.1.0.1" { # Drop all packets received from the following MAC sources ! PlParam "Drop" "00:0C:29:C6:E2:61" # RemoteClient1 ! PlParam "Drop" "00:0C:29:61:34:B7" # SimpleClient1 ! PlParam "Drop" "00:0C:29:28:0E:CC" # SimpleClient2 } ! 7. Common problems, FAQ ! ----------------------- Question: When starting OLSRD with the BMF plugin, I can see the following ! error messages: ! OLSRD Basic Multicast Forwarding plugin: open() error: No such file or directory ! OLSRD Basic Multicast Forwarding plugin: error creating local EtherTunTap ! OLSRD Basic Multicast Forwarding plugin: could not initialize network interfaces! Wat to do? Answer: ! ! Turn on the possibility to create a tuntap device; see section 2 of this file. --- 317,586 ---- } ! If an interface is listed both as "NonOlsrIf" for BMF, and in the Interfaces { ... } section of olsrd.conf, it will be seen by BMF ! as an OLSR-enabled interface. ! ! 8. Interworking with other multicast routers ! -------------------------------------------- ! ! In a typical interworking configuration there is a network of OLSR hosts ! in which one host acts as a gateway to a fixed infrastructure network. ! Usually that host will be advertising a default route via the HNA ! mechanism, e.g. by adding the following lines to its /etc/olsrd.conf ! file: ! ! Hna4 ! { ! # Internet gateway: ! 0.0.0.0 0.0.0.0 ! } ! ! Alternatively, the gateway is running OLSRDs dynamic internet gateway ! plugin; read the file ../../lib/dyn_gw/README_DYN_GW . ! ! The gateway host will usually have at least one OLSR-interface, and ! at least one non-OLSR interface, running a third-party routing protocol ! like OSPF. ! ! It is beyond the scope of this document to deal with the interworking ! between BMF and all possible multicast routing daemons. As an example, ! let's assume the gateway is running the mrouted multicast daemon (which ! implements the DVMRP protocol). Also, assume that all the IP addresses ! in the OLSR network are within the IP subnet 10.0.0.0/8 . Then mrouted ! on the gateway needs to be configured to accept IGMP requests from IP ! clients within the 10.0.0.0/8 subnet on the BMF network interface ! ("bmf0"). This is easily configured by adding a line to the ! /etc/mrouted.conf configuration file: ! ! phyint bmf0 altnet 10.0.0.0/8 ! ! Not strictly necessary, but clean, is to disable the DVMRP protocol ! on the OLSR interfaces, as no DVMRP routers are expected inside the ! OLSR network. Suppose the gateway is running OLSR on "eth1", then ! add the following line /etc/mrouted.conf : ! ! phyint eth1 disable ! ! Finally, mrouted does not accept interfaces with prefix length 32. ! Therefore, override the default IP address and prefix length of ! the BMF network interface, by editing the /etc/olsrd.conf file. ! For example: ! ! LoadPlugin "olsrd_bmf.so.1.3" ! { ! PlParam "BmfInterfaceIp" "10.10.10.4/24" ! } ! ! Note that it is not necessary, and even incorrect, to pass the ! non-OLSR interface to BMF as a "NonOlsrIf" parameter in the ! "LoadPlugin" section of the gateway host. When the mrouted ! multicast daemon is running, the forwarding of multicast traffic ! between the OLSR interface and the non-OLSR interface is done by ! the Linux kernel. ! ! The remaining text in this section has nothing to do with BMF or ! OLSR, but is added to give a number of helpful hints you might ! need when your multicast interworking, for some reason, is not working. ! ! When using the mrouted multicast daemon, there is a useful command, ! mrinfo, that gives information about what mrouted thinks of its ! neighbor hosts. For example: ! ! root at node-4:/# mrinfo ! 127.0.0.1 (localhost.localdomain) [DVMRPv3 compliant]: ! 10.1.2.4 -> 10.1.2.2 (10.1.2.2) [1/1/querier] ! 10.0.6.4 -> 0.0.0.0 (local) [1/1/disabled] ! 10.255.255.253 -> 0.0.0.0 (local) [1/1/querier/leaf] ! ! In this example, the line starting with "10.1.2.4" is for the ! non-OLSR interface "eth0", on which mrouted has found an ! mrouted-neighbor host "10.1.2.2". The next line is for the OLSR ! interface "eth1", which is disabled for mrouted. The last line ! is for the BMF interface "bmf0". It is clear that mrouted sees no ! mrouted-neighbors on that interface (leaf). ! ! To see what multicast traffic has flown through the gateway, view ! the files /proc/net/ip_mr_vif and /proc/net/ip_mr_cache: ! ! root at node-4:/# cat /proc/net/ip_mr_vif ! Interface BytesIn PktsIn BytesOut PktsOut Flags Local Remote ! 0 eth0 27832 98 14200 50 00000 0402010A 00000000 ! 2 bmf0 14484 51 13916 49 00000 FDFFFF0A 00000000 ! root at node-4:/# cat /proc/net/ip_mr_cache ! Group Origin Iif Pkts Bytes Wrong Oifs ! 4D4237EA C747010A 0 51 14484 0 2:1 ! 4D4237EA C702010A 0 51 14484 0 2:1 ! 4D4237EA C84C000A 2 53 15052 0 0:1 ! ! From the above we can deduce that traffic from input interface 0 ! (Iif 0, "eth0") is forwarded on output interface 2 (Oifs 2, = "bmf0"), ! and traffic from input interface 2 (Iif 2, "bmf0") is forwarded on ! output interface 0 (Oifs 0, "eth0"). The ":1" behind the Oifs numbers ! indicates the TTL thresholds, in this case packets with TTL value 1 ! or less will not be forwarded. ! ! When you are connecting an OLSR-BMF network to another multicast network ! (e.g. a DVMRP network), you might be surprised that, when you ping the ! all-routers multicast address 224.0.0.1 from within the OLSR network, ! only the OLSR hosts respond. This is, however, compliant behaviour: ! packets with their destination IP address in the range 224.0.0.0 - ! 224.0.0.255 are not routed by normal multicast protocols (i.e. their ! TTL is implicitly assumed to be 1). ! ! ! 9. Testing in a lab environment ------------------------------- ! When using equipment like switches or hubs, usually all the hosts see each ! other. In an OLSR lab environment, we sometimes want to simulate the ! situation that some hosts in the network cannot directly see other hosts ! (as 1-hop neighbors) but only indirectly (as 2- or more-hop neighbors). ! To simulate that situation, the iptables tool is often used. For BMF, ! however, that is nog enough. + For OLSR testing, setup iptables on each host to drop packets from + all other hosts which are not direct (1-hop) neigbors. For example, to + drop all packets from the hosts with MAC addresses 00:0C:29:51:32:88, + 00:0C:29:61:34:B7 and 00:0C:29:28:0E:CC, enter at the shell prompt: + + iptables -A INPUT -m mac --mac-source 00:0C:29:51:32:88 -j DROP + iptables -A INPUT -m mac --mac-source 00:0C:29:61:34:B7 -j DROP iptables -A INPUT -m mac --mac-source 00:0C:29:28:0E:CC -j DROP ! For BMF testing, edit the file /etc/olsrd.conf, and specify the MAC ! addresses of the hosts we do not want to see. (Even though packets from ! these hosts are dropped by iptables, they are still received on network ! interfaces if they are in promiscuous mode.) For example: ! LoadPlugin "olsrd_bmf.so.1.3" { # Drop all packets received from the following MAC sources ! PlParam "DropMac" "00:0C:29:51:32:88" # RemoteClient1 ! PlParam "DropMac" "00:0C:29:61:34:B7" # SimpleClient1 ! PlParam "DropMac" "00:0C:29:28:0E:CC" # SimpleClient2 } ! 10. Common problems, FAQ ! ------------------------ ! ! --------- ! Question: ! On which platforms does BMF currently compile? ! ! Answer: ! Only on Linux. No compilation on Windows (yet). The oldest Linux ! kernel on which the BMF plugin was tested was version 2.4.18. + + --------- Question: When starting OLSRD with the BMF plugin, I can see the following ! error message: ! OLSRD Basic Multicast Forwarding (BMF) plugin: error opening /dev/net/tun: No such file or directory Wat to do? Answer: ! Turn on the possibility to create a tuntap interface; see section 2 of this file. + --------- + Question: + When starting OLSRD with the BMF plugin, I can see the following + error message: + + OLSRD Basic Multicast Forwarding (BMF) plugin: error opening /dev/net/tun: No such device + + Wat to do? + + Answer: + First, turn on the possibility to create a tuntap interface; see section 2 of this + file. Check if the device is there: + + ~ # ls -l /dev/net/tun + crw------- 1 root root 10, 200 Sep 9 2006 /dev/net/tun + + If the device is there, but the error message remains to appear, the + tap/tun device is not compiled in your kernel. Try the command: + + modprobe tun + + If "modprobe tun" says something like "module tun not found", then either + it is not compiled at all or it is not compiled into the kernel. + + + --------- + Question: + I have enabled BMF, but my multicast application is not receiving any + multicast packets. + + Answer: + Many multicast applications must be configured to listen to a specific + network interface. Make sure that your multicast application is listening on + the BMF network interface, either by specifying the interface name itself + (e.g. "bmf0") or by specifying its IP address. + + + 11. Version history + ------------------- + + 18 Dec 2006: Version 1.3 + * Added the possibility to configure the BMF network interface: + name (e.g. "bmf0"), type (tun or tap), IP address and subnet + mask. + * Flooding of local broadcast packets (e.g. with destination + IP address 192.168.1.255) can now be turned off by configuration. + * When an application sends packets to the BMF network interface, BMF + also floods these packets over the OLSR network. + * Removed the TTL decrementing so that equipment connected to + a non-OLSR interface can still send their IGMP messages (TTL = 1) + to a fixed multicast router (running e.g. mrouted - DVMRP) + connected to a non-OLSR interface on another host in + the OLSR network. In this way, a whole OLSR network, including + its non-OLSR capable hosts, can be made multicast-routable + from a fixed multicast-enabled IP network. + For an example of such a configuration read section 8 above. + * Removed the check for 'IsNullMacAddress' when creating a network + interface object. The check was not necessary and prevented + BMF to work on non-ethernet interfaces such as ppp. + * Bug fix: in case there are multiple OLSR interfaces, when an + application sends packets to one OLSR interface, BMF did not + flood these packets via the other OLSR interfaces. This is + fixed. Also, packets sent to an OLSR interface are transmitted + on the non-OLSR interfaces. + + 23 Oct 2006: Version 1.2 + * Packets to a local broadcast destination have their destination + IP address adapted to the subnet on which they are forwarded. + This makes it possible to use broadcast-based services (such as + NetBIOS) across different IP subnets. + * The code to relate fragments with their main IP packet did not + work when the fragment arrived earlier than the main packet. + This would cause fragments of BMF-packets to be falsely forwarded. + For now, removed the forwarding of IP fragments. (Who's using + IP-fragments anyway?) + * Packets are forwarded from one non-OLSR interface to the other + non-OLSR interfaces. + * Various small optimizations and style improvements. + + 12 Jul 2006: Version 1.1 + * Major updates in code forwarding from and to non-OLSR enabled + network interfaces. + * Debug level 9 gives a better indication of what happens to each + handled multicast/broadcast packet. To run the olsr daemon with + debug level 9, run "olsrd -d 9". + * Can now deal with network interface removal ("ifdown eth1") and + addition ("ifup eth1"). + * CRC-calculation for duplicate detection is done over first 256 + bytes in packet instead of over full packet length. + * CRC calculated only on captured packets, and is subsequently + passed on in a special OLSR-BMF encapsulation header. + * Deals correctly with fragmented packets + + 27 Apr 2006: Version 1.0.1 + * First release. + From (spam-protected) Sat Feb 10 18:10:21 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 17:10:21 +0000 Subject: [Olsr-cvs] olsrd-current/lib/secure SOLSR-README,1.5,1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/secure In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18568/lib/secure Modified Files: SOLSR-README Log Message: * fixed documentation Index: SOLSR-README =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/SOLSR-README,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SOLSR-README 7 Apr 2005 19:00:06 -0000 1.5 --- SOLSR-README 10 Feb 2007 17:10:19 -0000 1.6 *************** *** 54,58 **** The key is 128-bits of size and is read from the specified file from the config file or by default from: ! /root/.olsr/olsrd_secure_key Copy the key to this file an all nodes. The plugin --- 54,58 ---- The key is 128-bits of size and is read from the specified file from the config file or by default from: ! /etc/olsrd.d/olsrd_secure_key Copy the key to this file an all nodes. The plugin From (spam-protected) Sat Feb 10 18:11:52 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 17:11:52 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux link_layer.c,1.11,1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18864/src/linux Modified Files: link_layer.c Log Message: * this file is actually completely #if 0 ... #endif out. But I was looking for a declaration of ioctl_s and this delivers false positives. Index: link_layer.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/link_layer.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** link_layer.c 27 Feb 2005 10:43:38 -0000 1.11 --- link_layer.c 10 Feb 2007 17:11:49 -0000 1.12 *************** *** 81,88 **** #define MAXICMPLEN 76 - extern size_t ipsize; - - extern int ioctl_s; - float poll_int = 0.2; --- 81,84 ---- *************** *** 132,136 **** strncpy(wrq.ifr_name, ifname, IFNAMSIZ); ! if(ioctl(ioctl_s, SIOCSIWSPY, &wrq) < 0) { OLSR_PRINTF(1, "Could not clear spylist %s\n", strerror(errno)) --- 128,132 ---- strncpy(wrq.ifr_name, ifname, IFNAMSIZ); ! if(ioctl(olsr_cnf->ioctl_s, SIOCSIWSPY, &wrq) < 0) { OLSR_PRINTF(1, "Could not clear spylist %s\n", strerror(errno)) *************** *** 163,167 **** strncpy(wrq.ifr_name, interface, IFNAMSIZ); ! if(ioctl(ioctl_s, SIOCGIWSPY, &wrq) < 0) { OLSR_PRINTF(1, "Could not get old spylist %s\n", strerror(errno)) --- 159,163 ---- strncpy(wrq.ifr_name, interface, IFNAMSIZ); ! if(ioctl(olsr_cnf->ioctl_s, SIOCGIWSPY, &wrq) < 0) { OLSR_PRINTF(1, "Could not get old spylist %s\n", strerror(errno)) *************** *** 196,200 **** strncpy(wrq.ifr_name, interface, IFNAMSIZ); ! if(ioctl(ioctl_s, SIOCSIWSPY, &wrq) < 0) { OLSR_PRINTF(1, "Could not clear spylist %s\n", strerror(errno)) --- 192,196 ---- strncpy(wrq.ifr_name, interface, IFNAMSIZ); ! if(ioctl(olsr_cnf->ioctl_s, SIOCSIWSPY, &wrq) < 0) { OLSR_PRINTF(1, "Could not clear spylist %s\n", strerror(errno)) *************** *** 223,227 **** tmp_sockaddr.sin_port = 0; ! memcpy(&tmp_sockaddr.sin_addr, ip, ipsize); /* Translate IP addresses to MAC addresses */ --- 219,223 ---- tmp_sockaddr.sin_port = 0; ! memcpy(&tmp_sockaddr.sin_addr, ip, olsr_cnf->ipsize); /* Translate IP addresses to MAC addresses */ *************** *** 232,236 **** strncpy(arp_query.arp_dev, interface, IFNAMSIZ); ! if((ioctl(ioctl_s, SIOCGARP, &arp_query) < 0) || !(arp_query.arp_flags & ATF_COM)) /* ATF_COM - hw addr valid */ { --- 228,232 ---- strncpy(arp_query.arp_dev, interface, IFNAMSIZ); ! if((ioctl(olsr_cnf->ioctl_s, SIOCGARP, &arp_query) < 0) || !(arp_query.arp_flags & ATF_COM)) /* ATF_COM - hw addr valid */ { *************** *** 273,277 **** dst_in->sin_family = AF_INET; ! memcpy(&dst_in->sin_addr, ip, ipsize); OLSR_PRINTF(1, "pinging %s\n\n", olsr_ip_to_string(ip)) --- 269,273 ---- dst_in->sin_family = AF_INET; ! memcpy(&dst_in->sin_addr, ip, olsr_cnf->ipsize); OLSR_PRINTF(1, "pinging %s\n\n", olsr_ip_to_string(ip)) *************** *** 340,344 **** /* Do the request */ ! if(ioctl(ioctl_s, SIOCGIWSPY, &wrq) < 0) { OLSR_PRINTF(1, "%-8.16s Interface doesn't support wireless statistic collection\n\n", iflist->int_name) --- 336,340 ---- /* Do the request */ ! if(ioctl(olsr_cnf->ioctl_s, SIOCGIWSPY, &wrq) < 0) { OLSR_PRINTF(1, "%-8.16s Interface doesn't support wireless statistic collection\n\n", iflist->int_name) *************** *** 414,418 **** strncpy(wrq.ifr_name, ifname, IFNAMSIZ); ! if(ioctl(ioctl_s, SIOCGIWRANGE, &wrq) < 0) { OLSR_PRINTF(1, "NO RANGE\n") --- 410,414 ---- strncpy(wrq.ifr_name, ifname, IFNAMSIZ); ! if(ioctl(olsr_cnf->ioctl_s, SIOCGIWRANGE, &wrq) < 0) { OLSR_PRINTF(1, "NO RANGE\n") From (spam-protected) Sat Feb 10 18:36:53 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 17:36:53 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga Makefile,1.2,1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28744/lib/quagga Modified Files: Makefile Log Message: applied fixes from Sven-Ola: - he corrected a copy-paste error made by me. Thanks. - he killed the parts disabled by DISABLE_SVEN_OLA Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 4 Feb 2007 21:21:16 -0000 1.2 --- Makefile 10 Feb 2007 17:36:51 -0000 1.3 *************** *** 56,60 **** default_target install clean: ! @echo "*** TAS Plugin only supported on Linux, sorry!" else --- 56,60 ---- default_target install clean: ! @echo "*** Quagga Plugin only supported on Linux, sorry!" else From (spam-protected) Sat Feb 10 18:36:53 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 17:36:53 +0000 Subject: [Olsr-cvs] olsrd-current/src lq_avl.c, 1.2, 1.3 lq_avl.h, 1.3, 1.4 lq_list.c, 1.4, 1.5 lq_list.h, 1.4, 1.5 lq_packet.c, 1.22, 1.23 lq_route.c, 1.43, 1.44 net_olsr.c, 1.17, 1.18 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28744/src Modified Files: lq_avl.c lq_avl.h lq_list.c lq_list.h lq_packet.c lq_route.c net_olsr.c Log Message: applied fixes from Sven-Ola: - he corrected a copy-paste error made by me. Thanks. - he killed the parts disabled by DISABLE_SVEN_OLA Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** lq_route.c 31 Jan 2007 12:36:50 -0000 1.43 --- lq_route.c 10 Feb 2007 17:36:51 -0000 1.44 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Thomas Lopatic (thomas at lopatic.de) + * IPv4 performance optimization (c) 2006, sven-ola(gmx.de) * All rights reserved. * *************** *** 78,94 **** } - #ifdef DISABLE_SVEN_OLA - static int avl_comp_ipv4(void *ip1, void *ip2) - { - if (*(unsigned int *)ip1 < *(unsigned int *)ip2) - return -1; - - if (*(unsigned int *)ip1 == *(unsigned int *)ip2) - return 0; - - return 1; - } - #endif - static int (*avl_comp)(void *, void *); --- 79,82 ---- *************** *** 207,213 **** // add the vertex to the list, if it's not us - #ifndef DISABLE_SVEN_OLA if (NULL == comp) { ! if (svenola_avl_comp_ipv4(&olsr_cnf->main_addr, node->key) != 0) { vert->node.data = vert; --- 195,200 ---- // add the vertex to the list, if it's not us if (NULL == comp) { ! if (inline_avl_comp_ipv4(&olsr_cnf->main_addr, node->key) != 0) { vert->node.data = vert; *************** *** 215,224 **** } } ! else ! #endif ! if ((*comp)(&olsr_cnf->main_addr, node->key) != 0) ! { ! vert->node.data = vert; ! list_add_tail(vertex_list, &vert->node); } --- 202,211 ---- } } ! else { ! if ((*comp)(&olsr_cnf->main_addr, node->key) != 0) ! { ! vert->node.data = vert; ! list_add_tail(vertex_list, &vert->node); ! } } *************** *** 278,283 **** // XXX - bad complexity ! #define SVEN_OPT ! #undef SVEN_OPT_DBG /* --- 265,269 ---- // XXX - bad complexity ! #define SVEN_OLA_OPTIMIZE /* *************** *** 288,300 **** * more sufficient to have them sorted/popped from a list rather than * searching the complete list by every call. Sven-Ola at gmx.de, 11/2006 */ ! #ifdef SVEN_OPT static struct dijk_vertex **etx_cache = 0; static int etx_cache_count; static int etx_cache_get; - #ifdef SVEN_OPT_DBG - static int etx_cache_saved = 0; - #endif static int etx_cache_compare(const void *a, const void *b) --- 274,287 ---- * more sufficient to have them sorted/popped from a list rather than * searching the complete list by every call. Sven-Ola at gmx.de, 11/2006 + * + * The SVEN_OLA_OPTIMIZE changes work in our berlin environment. However, + * they may introduce bugs, e.g. they are untested for IPv6. For this + * reason, the source still contains the ifdef SVEN_OLA_OPIMIZE. */ ! #ifdef SVEN_OLA_OPTIMIZE static struct dijk_vertex **etx_cache = 0; static int etx_cache_count; static int etx_cache_get; static int etx_cache_compare(const void *a, const void *b) *************** *** 315,351 **** static struct dijk_vertex *extract_best_route(struct list *vertex_list) { - #ifdef SVEN_OPT_DBG - float best_etx = INFINITE_ETX + 1.0; - #endif struct list_node *node; struct dijk_vertex *vert; struct dijk_vertex *res = NULL; - #ifdef SVEN_OPT_DBG - node = list_get_head(vertex_list); - - // loop through all vertices - - while (node != NULL) - { - vert = node->data; - - // see whether the current vertex is better than what we have - - if (!vert->done && vert->path_etx < best_etx) - { - best_etx = vert->path_etx; - res = vert; - } - else if (!vert->done && vert->path_etx == best_etx && vert < res) - { - // Otherwise order is undefined if etx==etx and debug will complain - best_etx = vert->path_etx; - res = vert; - } - - node = list_get_next(node); - } - #endif if (NULL == etx_cache) { --- 302,309 ---- *************** *** 361,367 **** { etx_cache = olsr_malloc(sizeof(etx_cache[0]) * count, "ETX Cache"); - #ifdef SVEN_OPT_DBG - printf("count=%d, Malloc(%d)=%p\n", count, sizeof(etx_cache[0]) * count, etx_cache); - #endif node = list_get_head(vertex_list); etx_cache_count = 0; --- 319,322 ---- *************** *** 377,422 **** node = list_get_next(node); } - #ifdef SVEN_OPT_DBG - printf("qsort(etx_cache_count=%d)\n", etx_cache_count); - #endif qsort(etx_cache, etx_cache_count, sizeof(etx_cache[0]), etx_cache_compare); - #ifdef SVEN_OPT_DBG - if (0 < etx_cache_count) - { - int i = 0; - while(i < etx_cache_count && i < 10) - { - printf("%d: %p=%f\n", i, etx_cache[i], etx_cache[i]->path_etx); - i++; - } - } - #endif } } - #ifdef SVEN_OPT_DBG - if (NULL != etx_cache) - { - struct dijk_vertex *rescache = NULL; - if (etx_cache_get < etx_cache_count) - { - rescache = etx_cache[etx_cache_get++]; - } - if (res != rescache) - { - printf("miss: etx_cache_get=%d, res=%p,%f != rescache=%p,%f\n", - etx_cache_get, res, (NULL != res ? res->path_etx : -1), rescache, (NULL != rescache ? rescache->path_etx : -1)); - } - else - { - etx_cache_saved++; - } - } - #else if (NULL != etx_cache && etx_cache_get < etx_cache_count) { res = etx_cache[etx_cache_get++]; } - #endif // if we've found a vertex, remove it from the set --- 332,343 ---- *************** *** 427,431 **** return res; } ! #endif // SVEN_OPT static struct dijk_vertex *extract_best(struct list *vertex_list) --- 348,352 ---- return res; } ! #endif // SVEN_OLA_OPTIMIZE static struct dijk_vertex *extract_best(struct list *vertex_list) *************** *** 533,541 **** if (olsr_cnf->ipsize == 4) - #ifndef DISABLE_SVEN_OLA avl_comp = 0; - #else - avl_comp = avl_comp_ipv4; - #endif else avl_comp = avl_comp_ipv6; --- 454,458 ---- *************** *** 779,787 **** // add HNA routes - the set of unprocessed network nodes contains // all reachable network nodes ! #ifdef SVEN_OPT ! #ifdef SVEN_OPT_DBG ! printf("free etx_cache, saved compares=%d, etx_cache=%p\n", etx_cache_saved, etx_cache); ! etx_cache_saved = 0; ! #endif if (NULL != etx_cache) { free(etx_cache); --- 696,700 ---- // add HNA routes - the set of unprocessed network nodes contains // all reachable network nodes ! #ifdef SVEN_OLA_OPTIMIZE if (NULL != etx_cache) { free(etx_cache); *************** *** 795,799 **** // from the set of unprocessed network nodes ! #ifdef SVEN_OPT vert = extract_best_route(&vertex_list); #else --- 708,712 ---- // from the set of unprocessed network nodes ! #ifdef SVEN_OLA_OPTIMIZE vert = extract_best_route(&vertex_list); #else Index: lq_list.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_list.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lq_list.h 31 Jan 2007 12:36:50 -0000 1.4 --- lq_list.h 10 Feb 2007 17:36:51 -0000 1.5 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Thomas Lopatic (thomas at lopatic.de) + * IPv4 performance optimization (c) 2006, sven-ola(gmx.de) * All rights reserved. * *************** *** 59,74 **** void list_init(struct list *list); ! #ifndef DISABLE_SVEN_OLA ! #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 ! #else ! struct list_node *list_get_head(struct list *list); ! struct list_node *list_get_tail(struct list *list); ! ! struct list_node *list_get_next(struct list_node *node); ! struct list_node *list_get_prev(struct list_node *node); ! #endif void list_add_head(struct list *list, struct list_node *node); --- 60,67 ---- 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); Index: lq_avl.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lq_avl.h 31 Jan 2007 12:36:50 -0000 1.3 --- lq_avl.h 10 Feb 2007 17:36:51 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Thomas Lopatic (thomas at lopatic.de) + * IPv4 performance optimization (c) 2006, sven-ola(gmx.de) * All rights reserved. * *************** *** 63,70 **** int avl_insert(struct avl_tree *, struct avl_node *); ! #ifndef DISABLE_SVEN_OLA ! #define svenola_avl_comp_ipv4(ip1, ip2) \ (*(unsigned int *)ip1 == *(unsigned int *)ip2 ? 0 : \ *(unsigned int *)ip1 < *(unsigned int *)ip2 ? -1 : +1) ! #endif #endif --- 64,70 ---- int avl_insert(struct avl_tree *, struct avl_node *); ! #define inline_avl_comp_ipv4(ip1, ip2) \ (*(unsigned int *)ip1 == *(unsigned int *)ip2 ? 0 : \ *(unsigned int *)ip1 < *(unsigned int *)ip2 ? -1 : +1) ! #endif Index: lq_list.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_list.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lq_list.c 31 Jan 2007 12:36:50 -0000 1.4 --- lq_list.c 10 Feb 2007 17:36:51 -0000 1.5 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Thomas Lopatic (thomas at lopatic.de) + * IPv4 performance optimization (c) 2006, sven-ola(gmx.de) * All rights reserved. * *************** *** 49,74 **** } - #ifdef DISABLE_SVEN_OLA - struct list_node *list_get_head(struct list *list) - { - return list->head; - } - - struct list_node *list_get_tail(struct list *list) - { - return list->tail; - } - - struct list_node *list_get_next(struct list_node *node) - { - return node->next; - } - - struct list_node *list_get_prev(struct list_node *node) - { - return node->prev; - } - #endif - void list_add_head(struct list *list, struct list_node *node) { --- 50,53 ---- Index: lq_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** lq_packet.c 31 Jan 2007 12:36:50 -0000 1.22 --- lq_packet.c 10 Feb 2007 17:36:51 -0000 1.23 *************** *** 3,6 **** --- 3,7 ---- * Copyright (c) 2003, Andreas T�nnesen (andreto at olsr.org) * 2004, Thomas Lopatic (thomas at lopatic.de) + * 2006, for some fixups, sven-ola(gmx.de) * All rights reserved. * *************** *** 168,172 **** if (olsr_cnf->lq_fish > 0) { ! // SVEN_OLA: Too lazy to find the different iface inits. This will do it too. if (outif->ttl_index >= (int)(sizeof(ttl_list) / sizeof(ttl_list[0]))) outif->ttl_index = 0; --- 169,173 ---- if (olsr_cnf->lq_fish > 0) { ! // Sven-Ola: Too lazy to find the different iface inits. This will do it too. if (outif->ttl_index >= (int)(sizeof(ttl_list) / sizeof(ttl_list[0]))) outif->ttl_index = 0; *************** *** 801,805 **** struct hello_neighbor *new_neigh; ! // SVEN_OLA: Check the message source addr if(!olsr_validate_address(&lq_hello->comm.orig)) { --- 802,806 ---- struct hello_neighbor *new_neigh; ! // Sven-Ola: Check the message source addr if(!olsr_validate_address(&lq_hello->comm.orig)) { *************** *** 827,831 **** for (neigh = lq_hello->neigh; neigh != NULL; neigh = neigh->next) { ! // SVEN_OLA: Also check the neighbours if(!olsr_validate_address(&neigh->addr)) continue; --- 828,832 ---- for (neigh = lq_hello->neigh; neigh != NULL; neigh = neigh->next) { ! // Sven-Ola: Also check the neighbours if(!olsr_validate_address(&neigh->addr)) continue; *************** *** 861,865 **** struct tc_mpr_addr *new_neigh; ! // SVEN_OLA: Check the message source addr if(!olsr_validate_address(&lq_tc->from)||!olsr_validate_address(&lq_tc->comm.orig)) { --- 862,866 ---- struct tc_mpr_addr *new_neigh; ! // Sven-Ola: Check the message source addr if(!olsr_validate_address(&lq_tc->from)||!olsr_validate_address(&lq_tc->comm.orig)) { *************** *** 887,891 **** for (neigh = lq_tc->neigh; neigh != NULL; neigh = neigh->next) { ! // SVEN_OLA: Also check the neighbours if(!olsr_validate_address(&neigh->main)) continue; --- 888,892 ---- for (neigh = lq_tc->neigh; neigh != NULL; neigh = neigh->next) { ! // Sven-Ola: Also check the neighbours if(!olsr_validate_address(&neigh->main)) continue; Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** net_olsr.c 15 Nov 2006 23:07:59 -0000 1.17 --- net_olsr.c 10 Feb 2007 17:36:51 -0000 1.18 *************** *** 90,94 **** { "0.0.0.0", - //SVEN_OLA: This address is not plausible too "127.0.0.1", NULL --- 90,93 ---- Index: lq_avl.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lq_avl.c 31 Jan 2007 12:36:50 -0000 1.2 --- lq_avl.c 10 Feb 2007 17:36:51 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2004, Thomas Lopatic (thomas at lopatic.de) + * IPv4 performance optimization (c) 2006, sven-ola(gmx.de) * All rights reserved. * *************** *** 41,47 **** #include - #ifndef DISABLE_SVEN_OLA #include - #endif #include "lq_avl.h" --- 42,46 ---- *************** *** 56,60 **** } - #ifndef DISABLE_SVEN_OLA static struct avl_node *avl_find_rec_ipv4(struct avl_node *node, void *key) { --- 55,58 ---- *************** *** 71,75 **** return node; } - #endif static struct avl_node *avl_find_rec(struct avl_node *node, void *key, --- 69,72 ---- *************** *** 78,86 **** int diff; - #ifndef DISABLE_SVEN_OLA if (0 == comp) { return avl_find_rec_ipv4(node, key); } ! #endif diff = (*comp)(key, node->key); --- 75,82 ---- int diff; if (0 == comp) { return avl_find_rec_ipv4(node, key); } ! diff = (*comp)(key, node->key); *************** *** 113,125 **** node = avl_find_rec(tree->root, key, tree->comp); - #ifndef DISABLE_SVEN_OLA if (0 == tree->comp) { ! if (0 != svenola_avl_comp_ipv4(node->key, key)) return NULL; } - else - #endif - if ((*tree->comp)(node->key, key) != 0) - return NULL; return node; --- 109,120 ---- node = avl_find_rec(tree->root, key, tree->comp); if (0 == tree->comp) { ! if (0 != inline_avl_comp_ipv4(node->key, key)) ! return NULL; ! } ! else { ! if ((*tree->comp)(node->key, key) != 0) return NULL; } return node; *************** *** 261,271 **** node = avl_find_rec(tree->root, new->key, tree->comp); - #ifndef DISABLE_SVEN_OLA if (0 == tree->comp) { ! diff = svenola_avl_comp_ipv4(new->key, node->key); } - else - #endif - diff = (*tree->comp)(new->key, node->key); if (diff == 0) --- 256,265 ---- node = avl_find_rec(tree->root, new->key, tree->comp); if (0 == tree->comp) { ! diff = inline_avl_comp_ipv4(new->key, node->key); ! } ! else { ! diff = (*tree->comp)(new->key, node->key); } if (diff == 0) From (spam-protected) Sat Feb 10 20:27:35 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 19:27:35 +0000 Subject: [Olsr-cvs] olsrd-current/src/unix ifnet.c,1.43,1.44 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/unix In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9104/src/unix Modified Files: ifnet.c Log Message: * added the rest if the olsrd-fixes-eric patch from Sven-Ola Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** ifnet.c 4 Feb 2007 23:36:35 -0000 1.43 --- ifnet.c 10 Feb 2007 19:27:33 -0000 1.44 *************** *** 328,334 **** OLSR_PRINTF(1, "\tOld:%s\n", sockaddr_to_string(&ifp->int_addr)) OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&ifr.ifr_addr)) ! if(memcmp(&olsr_cnf->main_addr, ! &((struct sockaddr_in *)&ifp->int_addr)->sin_addr.s_addr, olsr_cnf->ipsize) == 0) { --- 328,336 ---- OLSR_PRINTF(1, "\tOld:%s\n", sockaddr_to_string(&ifp->int_addr)) OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&ifr.ifr_addr)) ! ! ifp->int_addr = ifr.ifr_addr; ! if(memcmp(&olsr_cnf->main_addr, ! &ifp->ip_addr, olsr_cnf->ipsize) == 0) { *************** *** 340,344 **** } - ifp->int_addr = ifr.ifr_addr; memcpy(&ifp->ip_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, --- 342,345 ---- From (spam-protected) Sat Feb 10 20:27:34 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 19:27:34 +0000 Subject: [Olsr-cvs] olsrd-current/files olsrd.conf.default.lq, 1.2, 1.3 olsrd.conf.default.lq-fisheye, 1.3, 1.4 olsrd.conf.default.rfc, 1.3, 1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/files In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9104/files Modified Files: olsrd.conf.default.lq olsrd.conf.default.lq-fisheye olsrd.conf.default.rfc Log Message: * added the rest if the olsrd-fixes-eric patch from Sven-Ola Index: olsrd.conf.default.rfc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/files/olsrd.conf.default.rfc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** olsrd.conf.default.rfc 17 Apr 2006 18:31:08 -0000 1.3 --- olsrd.conf.default.rfc 10 Feb 2007 19:27:32 -0000 1.4 *************** *** 268,271 **** --- 268,272 ---- # HnaValidityTime 15.0 + # When multiple links exist between hosts # the weight of interface is used to determine *************** *** 275,282 **** # but here you can specify a fixed value. # Olsrd will choose links with the lowest value. ! # Weight 0 } --- 276,303 ---- # but here you can specify a fixed value. # Olsrd will choose links with the lowest value. ! # Note: ! # Interface weight is used only when LinkQualityLevel is set to 0. ! # For any other value of LinkQualityLevel, the interface ETX ! # value is used instead. # Weight 0 + # If a certain route should be preferred + # or ignored by the mesh, the Link Quality + # value of a node can be multiplied with a factor + # entered here. In the example the route + # using 192.168.0.1 would rather be ignored. + # A multiplier of 0.5 will result in a small + # (bad) LinkQuality value and a high (bad) + # ETX value. + # Note: + # Link quality multiplier is used only when + # LinkQualityLevel is > 0. + + # LinkQualityMult 192.168.0.1 0.5 + + # This multiplier applies to all other nodes + # LinkQualityMult default 0.8 + } Index: olsrd.conf.default.lq-fisheye =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/files/olsrd.conf.default.lq-fisheye,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** olsrd.conf.default.lq-fisheye 17 Apr 2006 18:31:08 -0000 1.3 --- olsrd.conf.default.lq-fisheye 10 Feb 2007 19:27:32 -0000 1.4 *************** *** 282,285 **** --- 282,286 ---- HnaValidityTime 100.0 + # When multiple links exist between hosts # the weight of interface is used to determine *************** *** 289,293 **** # but here you can specify a fixed value. # Olsrd will choose links with the lowest value. ! # Weight 0 --- 290,297 ---- # but here you can specify a fixed value. # Olsrd will choose links with the lowest value. ! # Note: ! # Interface weight is used only when LinkQualityLevel is set to 0. ! # For any other value of LinkQualityLevel, the interface ETX ! # value is used instead. # Weight 0 *************** *** 301,304 **** --- 305,311 ---- # (bad) LinkQuality value and a high (bad) # ETX value. + # Note: + # Link quality multiplier is used only when + # LinkQualityLevel is > 0. # LinkQualityMult 192.168.0.1 0.5 *************** *** 306,311 **** # This multiplier applies to all other nodes # LinkQualityMult default 0.8 - - } --- 313,316 ---- Index: olsrd.conf.default.lq =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/files/olsrd.conf.default.lq,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** olsrd.conf.default.lq 17 Apr 2006 18:31:08 -0000 1.2 --- olsrd.conf.default.lq 10 Feb 2007 19:27:32 -0000 1.3 *************** *** 273,276 **** --- 273,277 ---- HnaValidityTime 30.0 + # When multiple links exist between hosts # the weight of interface is used to determine *************** *** 280,287 **** # but here you can specify a fixed value. # Olsrd will choose links with the lowest value. ! # Weight 0 } --- 281,308 ---- # but here you can specify a fixed value. # Olsrd will choose links with the lowest value. ! # Note: ! # Interface weight is used only when LinkQualityLevel is 0. ! # For any other value of LinkQualityLevel, the interface ETX ! # value is used instead. # Weight 0 + # If a certain route should be preferred + # or ignored by the mesh, the Link Quality + # value of a node can be multiplied with a factor + # entered here. In the example the route + # using 192.168.0.1 would rather be ignored. + # A multiplier of 0.5 will result in a small + # (bad) LinkQuality value and a high (bad) + # ETX value. + # Note: + # Link quality multiplier is used only when + # LinkQualityLevel is > 0. + + # LinkQualityMult 192.168.0.1 0.5 + + # This multiplier applies to all other nodes + # LinkQualityMult default 0.8 + } From (spam-protected) Sat Feb 10 20:27:35 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 19:27:35 +0000 Subject: [Olsr-cvs] olsrd-current/src hysteresis.c, 1.17, 1.18 link_set.c, 1.65, 1.66 link_set.h, 1.30, 1.31 local_hna_set.c, 1.11, 1.12 local_hna_set.h, 1.9, 1.10 lq_mpr.c, 1.11, 1.12 mid_set.c, 1.16, 1.17 mid_set.h, 1.13, 1.14 process_package.c, 1.37, 1.38 routing_table.c, 1.24, 1.25 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9104/src Modified Files: hysteresis.c link_set.c link_set.h local_hna_set.c local_hna_set.h lq_mpr.c mid_set.c mid_set.h process_package.c routing_table.c Log Message: * added the rest if the olsrd-fixes-eric patch from Sven-Ola Index: mid_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mid_set.h 29 May 2005 12:47:45 -0000 1.13 --- mid_set.h 10 Feb 2007 19:27:32 -0000 1.14 *************** *** 74,77 **** --- 74,78 ---- extern struct mid_address reverse_mid_set[HASHSIZE]; + struct mid_alias; int *************** *** 96,99 **** --- 97,103 ---- olsr_time_out_mid_set(void *); + void + olsr_prune_aliases(union olsr_ip_addr *m_addr, struct mid_alias *declared_aliases); + int olsr_update_mid_table(union olsr_ip_addr *, float); Index: lq_mpr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_mpr.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** lq_mpr.c 7 Jan 2006 08:16:20 -0000 1.11 --- lq_mpr.c 10 Feb 2007 19:27:32 -0000 1.12 *************** *** 53,57 **** int i, k; struct neighbor_entry *neigh; ! double best; olsr_bool mpr_changes = OLSR_FALSE; struct link_entry *link; --- 53,57 ---- int i, k; struct neighbor_entry *neigh; ! double best, best_1hop; olsr_bool mpr_changes = OLSR_FALSE; struct link_entry *link; *************** *** 92,95 **** --- 92,97 ---- neigh2 = neigh2->next) { + best_1hop = -1.0; + // check whether this 2-hop neighbour is also a neighbour *************** *** 112,116 **** continue; ! best = link->loss_link_quality * link->neigh_link_quality; // see wether we find a better route via an MPR --- 114,118 ---- continue; ! best_1hop = link->loss_link_quality * link->neigh_link_quality; // see wether we find a better route via an MPR *************** *** 119,123 **** walker != &neigh2->neighbor_2_nblist; walker = walker->next) ! if (walker->path_link_quality > best) break; --- 121,125 ---- walker != &neigh2->neighbor_2_nblist; walker = walker->next) ! if (walker->path_link_quality > best_1hop) break; *************** *** 159,163 **** } ! if (neigh != NULL) { neigh->is_mpr = OLSR_TRUE; --- 161,168 ---- } ! // Found a 1-hop neighbor that we haven't previously selected. ! // Use it as MPR only when the 2-hop path through it is better than ! // any existing 1-hop path. ! if ((neigh != NULL) && (best > best_1hop)) { neigh->is_mpr = OLSR_TRUE; Index: mid_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** mid_set.c 14 Dec 2006 11:29:20 -0000 1.16 --- mid_set.c 10 Feb 2007 19:27:32 -0000 1.17 *************** *** 47,50 **** --- 47,51 ---- #include "neighbor_table.h" #include "link_set.h" + #include "packet.h" /* struct mid_alias */ *************** *** 101,104 **** --- 102,106 ---- struct mid_address *tmp_adr; olsr_u32_t hash, alias_hash; + union olsr_ip_addr *registered_m_addr; hash = olsr_hashing(m_addr); *************** *** 112,117 **** if(COMP_IP(&tmp->main_addr, m_addr)) break; } ! /*If the address was registered*/ if(tmp != &mid_set[hash]) --- 114,127 ---- if(COMP_IP(&tmp->main_addr, m_addr)) break; + } + + /* Check if alias is already registered with m_addr */ + registered_m_addr = mid_lookup_main_addr(&alias->alias); + if (registered_m_addr != NULL && COMP_IP(registered_m_addr, m_addr)) + { + /* Alias is already registered with main address. Nothing to do here. */ + return; } ! /*If the address was registered*/ if(tmp != &mid_set[hash]) *************** *** 350,354 **** if(COMP_IP(&tmp_list->main_addr, adr)) { ! //printf("Updating timer for node %s\n",ip_to_string(&tmp_list->main_addr)); tmp_list->ass_timer = GET_TIMESTAMP(vtime*1000); --- 360,364 ---- if(COMP_IP(&tmp_list->main_addr, adr)) { ! // printf("MID: Updating timer for node %s\n", olsr_ip_to_string(&tmp_list->main_addr)); tmp_list->ass_timer = GET_TIMESTAMP(vtime*1000); *************** *** 360,363 **** --- 370,458 ---- + /** + *Remove aliases from 'entry' which are not listed in 'declared_aliases'. + * + *@param entry the MID entry + *@param declared_aliases the list of declared aliases for the MID entry + * + *@return nada + */ + void + olsr_prune_aliases(union olsr_ip_addr *m_addr, struct mid_alias *declared_aliases) + { + struct mid_entry *entry; + olsr_u32_t hash; + struct mid_address *registered_aliases; + struct mid_address *previous_alias; + struct mid_alias *save_declared_aliases = declared_aliases; + + hash = olsr_hashing(m_addr); + + /* Check for registered entry */ + for(entry = mid_set[hash].next; + entry != &mid_set[hash]; + entry = entry->next) + { + if(COMP_IP(&entry->main_addr, m_addr)) + break; + } + if(entry == &mid_set[hash]) + { + /* MID entry not found, nothing to prune here */ + return; + } + + registered_aliases = entry->aliases; + previous_alias = NULL; + + while(registered_aliases != 0) + { + struct mid_address *current_alias = registered_aliases; + registered_aliases = registered_aliases->next_alias; + + declared_aliases = save_declared_aliases; + + /* Go through the list of declared aliases to find the matching current alias */ + while(declared_aliases != 0 && + ! COMP_IP(¤t_alias->alias, &declared_aliases->alias_addr)) + { + declared_aliases = declared_aliases->next; + } + + if (declared_aliases == 0) + { + /* Current alias not found in list of declared aliases: free current alias */ + OLSR_PRINTF(1, "MID remove: (%s, ", olsr_ip_to_string(&entry->main_addr)) + OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(¤t_alias->alias)) + + /* Update linked list as seen by 'entry' */ + if (previous_alias != NULL) + { + previous_alias->next_alias = current_alias->next_alias; + } + else + { + entry->aliases = current_alias->next_alias; + } + + /* Remove from hash table */ + DEQUEUE_ELEM(current_alias); + + free(current_alias); + + /* + *Recalculate topology + */ + changes_neighborhood = OLSR_TRUE; + changes_topology = OLSR_TRUE; + } + else + { + previous_alias = current_alias; + } + } + } + + /** Index: hysteresis.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hysteresis.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** hysteresis.c 14 Dec 2006 11:29:19 -0000 1.17 --- hysteresis.c 10 Feb 2007 19:27:32 -0000 1.18 *************** *** 167,171 **** struct link_entry *link; ! link = lookup_link_entry(remote, local); /* Calculate new quality */ --- 167,171 ---- struct link_entry *link; ! link = lookup_link_entry(remote, NULL, local); /* Calculate new quality */ Index: link_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** link_set.h 31 Jan 2007 12:36:50 -0000 1.30 --- link_set.h 10 Feb 2007 19:27:32 -0000 1.31 *************** *** 125,129 **** struct link_entry * ! lookup_link_entry(union olsr_ip_addr *, struct interface *); struct link_entry * --- 125,129 ---- struct link_entry * ! lookup_link_entry(union olsr_ip_addr *, union olsr_ip_addr *remote_main, struct interface *); struct link_entry * Index: local_hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/local_hna_set.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** local_hna_set.c 7 Jan 2006 08:16:20 -0000 1.11 --- local_hna_set.c 10 Feb 2007 19:27:32 -0000 1.12 *************** *** 130,133 **** --- 130,172 ---- } + struct hna4_entry * + find_local_hna4_entry(union olsr_ip_addr *net, olsr_u32_t mask) + { + struct hna4_entry *h4 = olsr_cnf->hna4_entries; + + while(h4) + { + if((net->v4 == h4->net.v4) && + (mask == h4->netmask.v4)) + { + return h4; + } + h4 = h4->next; + } + + return NULL; + } + + + + struct hna6_entry * + find_local_hna6_entry(union olsr_ip_addr *net, olsr_u16_t prefix_len) + { + struct hna6_entry *h6 = olsr_cnf->hna6_entries; + + while(h6) + { + if((memcmp(net, &h6->net, olsr_cnf->ipsize) == 0) && + (prefix_len == h6->prefix_len)) + { + return h6; + } + h6 = h6->next; + } + + return NULL; + } + + Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** routing_table.c 14 Dec 2006 11:29:20 -0000 1.24 --- routing_table.c 10 Feb 2007 19:27:32 -0000 1.25 *************** *** 66,73 **** static struct rt_entry * ! olsr_check_for_higher_hopcount(struct rt_entry *, struct hna_net *, olsr_u16_t); struct rt_entry * ! olsr_check_for_lower_hopcount(struct rt_entry *, struct hna_net *, olsr_u16_t); static olsr_bool --- 66,73 ---- static struct rt_entry * ! olsr_check_for_higher_quality(struct rt_entry *, struct hna_net *, float); struct rt_entry * ! olsr_check_for_lower_quality(struct rt_entry *, struct hna_net *, float); static olsr_bool *************** *** 213,217 **** new_route_entry->rt_metric = metric; ! new_route_entry->rt_etx = etx; if(COMP_IP(dst, router)) --- 213,222 ---- new_route_entry->rt_metric = metric; ! if (etx< 0.0) ! /* non-LQ case */ ! new_route_entry->rt_etx = (float)metric; ! else ! /* LQ case */ ! new_route_entry->rt_etx = etx; if(COMP_IP(dst, router)) *************** *** 291,295 **** iface, 1, ! 0); } } --- 296,300 ---- iface, 1, ! -1.0); } } *************** *** 407,411 **** iface, 2, ! 0); if(new_route_entry != NULL) --- 412,416 ---- iface, 2, ! -1.0); if(new_route_entry != NULL) *************** *** 504,508 **** list_destination_n->destination->rt_if, list_destination_n->destination->rt_metric+1, ! 0); if(destination_n_1->destination != NULL) { --- 509,513 ---- list_destination_n->destination->rt_if, list_destination_n->destination->rt_metric+1, ! -1.0); if(destination_n_1->destination != NULL) { *************** *** 552,566 **** /** ! *Check for a entry with a higher hopcount than *a given value in a routing table * *@param routes the routingtable to look in *@param net the network entry to look for ! *@param metric the metric to check for * ! *@return the localted entry if found. NULL if not */ static struct rt_entry * ! olsr_check_for_higher_hopcount(struct rt_entry *routes, struct hna_net *net, olsr_u16_t metric) { int index; --- 557,571 ---- /** ! *Check for an entry with a higher quality (lower etx) than *a given value in a routing table * *@param routes the routingtable to look in *@param net the network entry to look for ! *@param etx the metric to check for * ! *@return the located entry if found. NULL if not */ static struct rt_entry * ! olsr_check_for_higher_quality(struct rt_entry *routes, struct hna_net *net, float etx) { int index; *************** *** 577,582 **** (memcmp(&tmp_routes->rt_mask, &net->A_netmask, netmask_size) == 0)) { ! /* Found a entry */ ! if(tmp_routes->rt_metric > metric) return tmp_routes; else --- 582,587 ---- (memcmp(&tmp_routes->rt_mask, &net->A_netmask, netmask_size) == 0)) { ! /* Found an entry */ ! if(tmp_routes->rt_etx < etx) return tmp_routes; else *************** *** 592,606 **** /** ! *Check for a entry with a lower or equal hopcount than *a given value in a routing table * *@param routes the routingtable to look in *@param net the network entry to look for ! *@param metric the metric to check for * ! *@return the localted entry if found. NULL if not */ struct rt_entry * ! olsr_check_for_lower_hopcount(struct rt_entry *routes, struct hna_net *net, olsr_u16_t metric) { int index; --- 597,611 ---- /** ! *Check for an entry with a lower or equal quality (higher or equal etx) than *a given value in a routing table * *@param routes the routingtable to look in *@param net the network entry to look for ! *@param etx the metric to check for * ! *@return the located entry if found. NULL if not */ struct rt_entry * ! olsr_check_for_lower_quality(struct rt_entry *routes, struct hna_net *net, float etx) { int index; *************** *** 617,622 **** (memcmp(&tmp_routes->rt_mask, &net->A_netmask, netmask_size) == 0)) { ! /* Found a entry */ ! if(tmp_routes->rt_metric <= metric) return tmp_routes; else --- 622,627 ---- (memcmp(&tmp_routes->rt_mask, &net->A_netmask, netmask_size) == 0)) { ! /* Found an entry */ ! if(tmp_routes->rt_etx >= etx) return tmp_routes; else *************** *** 675,685 **** /* If there exists a better or equal entry - skip */ ! if(olsr_check_for_lower_hopcount(hna_routes, tmp_net, tmp_rt->rt_metric) != NULL) { continue; } ! /* If we find an entry with higher hopcount we just edit it */ ! if((new_rt = olsr_check_for_higher_hopcount(hna_routes, tmp_net, tmp_rt->rt_metric)) != NULL) { /* Fill struct */ --- 680,690 ---- /* If there exists a better or equal entry - skip */ ! if(olsr_check_for_higher_quality(hna_routes, tmp_net, tmp_rt->rt_etx) != NULL) { continue; } ! /* If we find an entry with lower quality we just edit it */ ! if((new_rt = olsr_check_for_lower_quality(hna_routes, tmp_net, tmp_rt->rt_etx)) != NULL) { /* Fill struct */ *************** *** 690,693 **** --- 695,699 ---- COPY_IP(&new_rt->rt_router, &tmp_rt->rt_router); /* Metric */ + new_rt->rt_etx = tmp_rt->rt_etx; new_rt->rt_metric = tmp_rt->rt_metric; /* Flags */ *************** *** 710,713 **** --- 716,720 ---- COPY_IP(&new_rt->rt_router, &tmp_rt->rt_router); /* Metric */ + new_rt->rt_etx = tmp_rt->rt_etx; new_rt->rt_metric = tmp_rt->rt_metric; /* Flags */ Index: link_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** link_set.c 31 Jan 2007 12:36:50 -0000 1.65 --- link_set.c 10 Feb 2007 19:27:32 -0000 1.66 *************** *** 203,207 **** //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr)); //printf("%s : ", olsr_ip_to_string(main_addr)); ! if((link = lookup_link_entry(main_addr, ifs)) != NULL) { //printf("%d\n", lookup_link_status(link)); --- 203,207 ---- //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr)); //printf("%s : ", olsr_ip_to_string(main_addr)); ! if((link = lookup_link_entry(main_addr, NULL, ifs)) != NULL) { //printf("%d\n", lookup_link_status(link)); *************** *** 216,220 **** //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr)); //printf("%s : ", olsr_ip_to_string(&aliases->address)); ! if((link = lookup_link_entry(&aliases->alias, ifs)) != NULL) { //printf("%d\n", lookup_link_status(link)); --- 216,220 ---- //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr)); //printf("%s : ", olsr_ip_to_string(&aliases->address)); ! if((link = lookup_link_entry(&aliases->alias, NULL, ifs)) != NULL) { //printf("%d\n", lookup_link_status(link)); *************** *** 264,268 **** continue; ! // handle the non-LQ case if (olsr_cnf->lq_level == 0) --- 264,268 ---- continue; ! // handle the non-LQ, RFC-compliant case if (olsr_cnf->lq_level == 0) *************** *** 299,303 **** } ! // handle the LQ case else --- 299,303 ---- } ! // handle the LQ, non-RFC compliant case else *************** *** 451,455 **** *@param local the local IP address *@param remote the remote IP address ! *@param remote_main teh remote nodes main address *@param vtime the validity time of the entry *@param htime the HELLO interval of the remote node --- 451,455 ---- *@param local the local IP address *@param remote the remote IP address ! *@param remote_main the remote nodes main address *@param vtime the validity time of the entry *@param htime the HELLO interval of the remote node *************** *** 463,467 **** struct neighbor_entry *neighbor; ! if((tmp_link_set = lookup_link_entry(remote, local_if))) return tmp_link_set; /* --- 463,467 ---- struct neighbor_entry *neighbor; ! if((tmp_link_set = lookup_link_entry(remote, remote_main, local_if))) return tmp_link_set; /* *************** *** 568,572 **** /* Copy the main address - make sure this is done every time * as neighbors might change main address */ ! COPY_IP(&neighbor->neighbor_main_addr, remote_main); neighbor->linkcount++; --- 568,577 ---- /* Copy the main address - make sure this is done every time * as neighbors might change main address */ ! /* Erik Tromp - OOPS! Don't do this! Neighbor entries are hashed through their ! * neighbor_main_addr field, and when that field is changed, their position ! * in the hash table is no longer correct, so that the function ! * olsr_lookup_neighbor_table() can no longer find the neighbor ! * entry. */ ! /*COPY_IP(&neighbor->neighbor_main_addr, remote_main);*/ neighbor->linkcount++; *************** *** 583,589 **** * enough in most cases. 10 seconds */ ! OLSR_PRINTF(1, "Adding MID alias main %s ", olsr_ip_to_string(remote_main)) ! OLSR_PRINTF(1, "-> %s based on HELLO\n\n", olsr_ip_to_string(remote)) ! insert_mid_alias(remote_main, remote, MID_ALIAS_HACK_VTIME); } --- 588,599 ---- * enough in most cases. 10 seconds */ ! /* Erik Tromp - commented out. It is not RFC-compliant. Also, MID aliases ! * that are not explicitly declared by a node will be removed as soon as ! * the olsr_prune_aliases(...) function is called. ! * ! * OLSR_PRINTF(1, "Adding MID alias main %s ", olsr_ip_to_string(remote_main)) ! * OLSR_PRINTF(1, "-> %s based on HELLO\n\n", olsr_ip_to_string(remote)) ! * insert_mid_alias(remote_main, remote, MID_ALIAS_HACK_VTIME); ! */ } *************** *** 621,624 **** --- 631,635 ---- * *@param remote the remote interface address + *@param remote_main the remote nodes main address *@param local the local interface address * *************** *** 626,630 **** */ struct link_entry * ! lookup_link_entry(union olsr_ip_addr *remote, struct interface *local) { struct link_entry *tmp_link_set; --- 637,641 ---- */ struct link_entry * ! lookup_link_entry(union olsr_ip_addr *remote, union olsr_ip_addr *remote_main, struct interface *local) { struct link_entry *tmp_link_set; *************** *** 635,642 **** { if(COMP_IP(remote, &tmp_link_set->neighbor_iface_addr) && ! (tmp_link_set->if_name ? ! !strcmp(tmp_link_set->if_name, local->int_name) : ! COMP_IP(&local->ip_addr, &tmp_link_set->local_iface_addr) ! )) return tmp_link_set; tmp_link_set = tmp_link_set->next; --- 646,656 ---- { if(COMP_IP(remote, &tmp_link_set->neighbor_iface_addr) && ! (tmp_link_set->if_name ! ? !strcmp(tmp_link_set->if_name, local->int_name) ! : COMP_IP(&local->ip_addr, &tmp_link_set->local_iface_addr) ! ) && ! /* check the remote-main address only if there is one given */ ! (remote_main == NULL || COMP_IP(remote_main, &tmp_link_set->neighbor->neighbor_main_addr)) ! ) return tmp_link_set; tmp_link_set = tmp_link_set->next; *************** *** 1073,1077 **** // called for every OLSR packet ! entry = lookup_link_entry(rem, loc); // it's the very first LQ HELLO message - we do not yet have a link --- 1087,1091 ---- // called for every OLSR packet ! entry = lookup_link_entry(rem, NULL, loc); // it's the very first LQ HELLO message - we do not yet have a link Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** process_package.c 7 Jan 2006 08:16:20 -0000 1.37 --- process_package.c 10 Feb 2007 19:27:32 -0000 1.38 *************** *** 54,57 **** --- 54,58 ---- #include "rebuild_packet.h" #include "scheduler.h" + #include "local_hna_set.h" *************** *** 67,71 **** olsr_parser_add_function(&olsr_process_received_tc, TC_MESSAGE, 1); } - else { --- 68,71 ---- *************** *** 408,411 **** --- 408,413 ---- } + olsr_prune_aliases(&message.mid_origaddr, message.mid_addr); + forward: olsr_forward_message(m, *************** *** 472,477 **** while(hna_tmp) { ! olsr_update_hna_entry(&message.originator, &hna_tmp->net, &hna_tmp->netmask, (float)message.vtime); ! hna_tmp = hna_tmp->next; } --- 474,484 ---- while(hna_tmp) { ! /* Don't add an HNA entry that we are advertising ourselves. */ ! if (!find_local_hna4_entry(&hna_tmp->net, hna_tmp->netmask.v4) && ! !find_local_hna6_entry(&hna_tmp->net, hna_tmp->netmask.v6)) ! { ! olsr_update_hna_entry(&message.originator, &hna_tmp->net, &hna_tmp->netmask, (float)message.vtime); ! } ! hna_tmp = hna_tmp->next; } *************** *** 496,500 **** /** *Processes an list of neighbors from an incoming HELLO message. ! *@param neighbor the neighbor who sendt the message. *@param message the HELLO message *@return nada --- 503,507 ---- /** *Processes an list of neighbors from an incoming HELLO message. ! *@param neighbor the neighbor who sent the message. *@param message the HELLO message *@return nada *************** *** 541,544 **** --- 548,576 ---- two_hop_neighbor_yet->neighbor_2_timer = GET_TIMESTAMP(message->vtime*1000); two_hop_neighbor = two_hop_neighbor_yet->neighbor_2; + + // For link quality OLSR, reset the path link quality here. + // The path link quality will be calculated in the second pass, below. + // Keep the saved_path_link_quality for reference. + + if (olsr_cnf->lq_level > 0) + { + // loop through the one-hop neighbors that see this + // 'two_hop_neighbor' + + struct neighbor_list_entry *walker; + + for (walker = two_hop_neighbor->neighbor_2_nblist.next; + walker != &two_hop_neighbor->neighbor_2_nblist; + walker = walker->next) + { + // have we found the one-hop neighbor that sent the + // HELLO message that we're current processing? + + if (walker->neighbor == neighbor) + { + walker->path_link_quality = 0.0; + } + } + } } else *************** *** 588,604 **** } } ! if (olsr_cnf->lq_level > 0) { ! struct neighbor_list_entry *walker; ! struct link_entry *link; ! link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr); ! if(!link) ! continue; // loop through the one-hop neighbors that see this ! // two hop neighbour for (walker = two_hop_neighbor->neighbor_2_nblist.next; --- 620,665 ---- } } + } + } ! // Separate, second and third pass for link quality OLSR ! ! if (olsr_cnf->lq_level > 0) ! { ! struct link_entry *link = ! get_best_link_to_neighbor(&neighbor->neighbor_main_addr); ! ! if(!link) ! return; ! ! // Second pass for link quality OLSR: calculate the best 2-hop ! // path costs to all the 2-hop neighbors indicated in the ! // HELLO message. Since the same 2-hop neighbor may be listed ! // more than once in the same HELLO message (each at a possibly ! // different quality) we want to select only the best one, not just ! // the last one listed in the HELLO message. ! ! for(message_neighbors = message->neighbors; ! message_neighbors != NULL; ! message_neighbors = message_neighbors->next) ! { ! if(if_ifwithaddr(&message_neighbors->address) != NULL) ! continue; ! ! if(((message_neighbors->status == SYM_NEIGH) || ! (message_neighbors->status == MPR_NEIGH))) { ! struct neighbor_list_entry *walker; ! struct neighbor_2_entry *two_hop_neighbor; ! struct neighbor_2_list_entry *two_hop_neighbor_yet = ! olsr_lookup_my_neighbors(neighbor, &message_neighbors->address); ! if(!two_hop_neighbor_yet) ! continue; ! two_hop_neighbor = two_hop_neighbor_yet->neighbor_2; // loop through the one-hop neighbors that see this ! // 'two_hop_neighbor' for (walker = two_hop_neighbor->neighbor_2_nblist.next; *************** *** 611,622 **** if (walker->neighbor == neighbor) { ! double saved_lq, rel_lq; ! ! // saved previous total link quality ! ! saved_lq = walker->saved_path_link_quality; ! ! if (saved_lq == 0.0) ! saved_lq = -1.0; // path link quality = link quality between us --- 672,676 ---- if (walker->neighbor == neighbor) { ! double new_second_hop_link_quality, new_path_link_quality; // path link quality = link quality between us *************** *** 635,639 **** // 2-hop neighbour ! walker->second_hop_link_quality = message_neighbors->link_quality * message_neighbors->neigh_link_quality; --- 689,693 ---- // 2-hop neighbour ! new_second_hop_link_quality = message_neighbors->link_quality * message_neighbors->neigh_link_quality; *************** *** 642,650 **** // "us --- 1-hop --- 2-hop" ! walker->path_link_quality = ! walker->second_hop_link_quality * link->loss_link_quality * link->neigh_link_quality; ! // if the link quality has changed by more than 10 // percent, signal --- 696,761 ---- // "us --- 1-hop --- 2-hop" ! new_path_link_quality = ! new_second_hop_link_quality * link->loss_link_quality * link->neigh_link_quality; ! // Only copy the link quality if it is better than what we have ! // for this 2-hop neighbor ! if (new_path_link_quality > walker->path_link_quality) ! { ! walker->second_hop_link_quality = new_second_hop_link_quality; ! walker->path_link_quality = new_path_link_quality; ! } ! } ! } ! } ! } ! ! // Third pass for link quality OLSR: check if the 2-hop path qualities have ! // actually changed. If so, signal this through the 'changes_neighborhood' ! // and 'changes_topology' booleans. Keep a 'saved_path_link_quality' for ! // later reference. ! for(message_neighbors = message->neighbors; ! message_neighbors != NULL; ! message_neighbors = message_neighbors->next) ! { ! if(if_ifwithaddr(&message_neighbors->address) != NULL) ! continue; ! ! if(((message_neighbors->status == SYM_NEIGH) || ! (message_neighbors->status == MPR_NEIGH))) ! { ! struct neighbor_list_entry *walker; ! struct neighbor_2_entry *two_hop_neighbor; ! struct neighbor_2_list_entry *two_hop_neighbor_yet = ! olsr_lookup_my_neighbors(neighbor, &message_neighbors->address); ! ! if(!two_hop_neighbor_yet) ! continue; ! ! two_hop_neighbor = two_hop_neighbor_yet->neighbor_2; ! ! // loop through the one-hop neighbors that see this ! // 'two_hop_neighbor' ! ! for (walker = two_hop_neighbor->neighbor_2_nblist.next; ! walker != &two_hop_neighbor->neighbor_2_nblist; ! walker = walker->next) ! { ! // have we found the one-hop neighbor that sent the ! // HELLO message that we're current processing? ! ! if (walker->neighbor == neighbor) ! { ! double saved_lq, rel_lq; ! ! // saved previous total link quality ! ! saved_lq = walker->saved_path_link_quality; ! ! if (saved_lq == 0.0) ! saved_lq = -1.0; ! ! // if the link cost has changed by more than 10 // percent, signal Index: local_hna_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/local_hna_set.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** local_hna_set.h 20 Feb 2005 18:52:18 -0000 1.9 --- local_hna_set.h 10 Feb 2007 19:27:32 -0000 1.10 *************** *** 59,62 **** --- 59,68 ---- remove_local_hna6_entry(union olsr_ip_addr *, olsr_u16_t); + struct hna4_entry * + find_local_hna4_entry(union olsr_ip_addr *net, olsr_u32_t mask); + + struct hna6_entry * + find_local_hna6_entry(union olsr_ip_addr *net, olsr_u16_t prefix_len); + int check_inet_gw(void); From (spam-protected) Sat Feb 10 20:59:53 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 19:59:53 +0000 Subject: [Olsr-cvs] olsrd-current/make Makefile.linux,1.9,1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/make In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21699/make Modified Files: Makefile.linux Log Message: * killed USE_LIBNET Index: Makefile.linux =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/make/Makefile.linux,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile.linux 30 Jan 2007 16:50:20 -0000 1.9 --- Makefile.linux 10 Feb 2007 19:59:51 -0000 1.10 *************** *** 29,37 **** endif - ifdef USE_LIBNET - LIBS += -lnet - CFLAGS += -DUSE_LIBNET - endif - OS_LIB_PTHREAD = -lpthread OS_LIB_DYNLOAD = -ldl --- 29,32 ---- From (spam-protected) Sat Feb 10 20:59:53 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 19:59:53 +0000 Subject: [Olsr-cvs] olsrd-current/src/unix ifnet.c,1.44,1.45 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/unix In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21699/src/unix Modified Files: ifnet.c Log Message: * killed USE_LIBNET Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ifnet.c 10 Feb 2007 19:27:33 -0000 1.44 --- ifnet.c 10 Feb 2007 19:59:51 -0000 1.45 *************** *** 69,76 **** #include - #ifdef USE_LIBNET - #include - #endif - int bufspace = 127*1024; /* max. input buffer size to request */ --- 69,72 ---- *************** *** 507,513 **** close(ifp->olsr_socket); remove_olsr_socket(ifp->olsr_socket, &olsr_input); - #ifdef USE_LIBNET - libnet_destroy(ifp->libnet_ctx); - #endif /* Free memory */ --- 503,506 ---- *************** *** 932,938 **** memcpy(ifp, &ifs, sizeof(struct interface)); - #ifdef USE_LIBNET - ifp->libnet_ctx = NULL; - #endif ifp->gen_properties = NULL; ifp->int_name = olsr_malloc(strlen(ifr.ifr_name) + 1, "Interface update 3"); --- 925,928 ---- *************** *** 990,1010 **** } - #ifdef USE_LIBNET - #if 1 - ifp->libnet_ctx = libnet_init((olsr_cnf->ip_version == AF_INET) ? - LIBNET_RAW4 : LIBNET_RAW6, - ifp->int_name, get_libnet_errbuf()); - #else - ifp->libnet_ctx = libnet_init(LIBNET_LINK, ifp->int_name, get_libnet_errbuf()); - #endif - - if(ifp->libnet_ctx == NULL) - { - fprintf(stderr, "Could not initialize libnet... exiting!\n\n"); - olsr_syslog(OLSR_LOG_ERR, "Could not initialize libnet... exiting!\n\n"); - olsr_cnf->exit_value = EXIT_FAILURE; - kill(getpid(), SIGINT); - } - #endif set_buffer_timer(ifp); --- 980,983 ---- From (spam-protected) Sat Feb 10 20:59:53 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 19:59:53 +0000 Subject: [Olsr-cvs] olsrd-current/src interfaces.h, 1.37, 1.38 net_olsr.c, 1.18, 1.19 net_olsr.h, 1.6, 1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21699/src Modified Files: interfaces.h net_olsr.c net_olsr.h Log Message: * killed USE_LIBNET Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** net_olsr.c 10 Feb 2007 17:36:51 -0000 1.18 --- net_olsr.c 10 Feb 2007 19:59:51 -0000 1.19 *************** *** 49,57 **** #include - #ifdef USE_LIBNET - #include - #endif - - extern olsr_bool lq_tc_pending; --- 49,52 ---- *************** *** 101,118 **** }; - #ifdef USE_LIBNET - int - olsr_in_cksum(olsr_u16_t *, int); - - static char errbuf[LIBNET_ERRBUF_SIZE]; - - char * - get_libnet_errbuf(void) - { - return errbuf; - } - #endif - - void net_set_disp_pack_out(olsr_bool val) --- 96,99 ---- *************** *** 379,414 **** } - #ifdef USE_LIBNET - /* - * Stolen from libnet - */ - - #define OLSR_CKSUM_CARRY(x) \ - (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff)) - - int - olsr_in_cksum(olsr_u16_t *buf, int len) - { - int sum; - u_int16_t last_byte; - - sum = 0; - last_byte = 0; - - while (len > 1) - { - sum += *buf++; - len -= 2; - } - if (len == 1) - { - *(u_int8_t*)&last_byte = *(u_int8_t*)buf; - sum += last_byte; - } - - return sum; - } - #endif - /** *Sends a packet on a given interface. --- 360,363 ---- *************** *** 421,588 **** net_output(struct interface *ifp) { - #ifdef USE_LIBNET - struct ptf *tmp_ptf_list; - union olsr_packet *outmsg; - int retval; - libnet_ptag_t udp_ptag = 0, ip_ptag = 0; - - if(!ifp->netbuf.pending) - return 0; - - assert(ifp->libnet_ctx != NULL); - - ifp->netbuf.pending += OLSR_HEADERSIZE; - - retval = ifp->netbuf.pending; - - outmsg = (union olsr_packet *)ifp->netbuf.buff; - /* Add the Packet seqno */ - outmsg->v4.olsr_seqno = htons(ifp->olsr_seqnum++); - /* Set the packetlength */ - outmsg->v4.olsr_packlen = htons(ifp->netbuf.pending); - - /* - *Call possible packet transform functions registered by plugins - */ - tmp_ptf_list = ptf_list; - while(tmp_ptf_list != NULL) - { - tmp_ptf_list->function(ifp->netbuf.buff, &ifp->netbuf.pending); - tmp_ptf_list = tmp_ptf_list->next; - } - - /* - *if the -dispout option was given - *we print the contetnt of the packets - */ - if(disp_pack_out) - print_olsr_serialized_packet(stdout, (union olsr_packet *)ifp->netbuf.buff, - ifp->netbuf.pending, &ifp->ip_addr); - - printf("LIBNET TX %d bytes on %s\n", - ifp->netbuf.pending, ifp->int_name); - - udp_ptag = libnet_build_udp(OLSRPORT, - OLSRPORT, - LIBNET_UDP_H + ifp->netbuf.pending, - 0, - (u_int8_t *)ifp->netbuf.buff, - ifp->netbuf.pending, - ifp->libnet_ctx, - 0); - - if(udp_ptag == -1) - { - OLSR_PRINTF (1, "libnet UDP header: %s\n", libnet_geterror (ifp->libnet_ctx)) - ifp->netbuf.pending = 0; - libnet_clear_packet(ifp->libnet_ctx); - return -1; - } - - if(olsr_cnf->ip_version == AF_INET) - { - /* IP version 4 */ - ip_ptag = libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_UDP_H + ifp->netbuf.pending, - olsr_cnf->tos, - ifp->olsr_seqnum, - 0x4000, /* Don't fragment */ - 255, - IPPROTO_UDP, - 0, - ifp->ip_addr.v4, - ((struct sockaddr_in *)&ifp->int_broadaddr)->sin_addr.s_addr, - NULL, - 0, - ifp->libnet_ctx, - 0); - if(ip_ptag == -1) - { - OLSR_PRINTF (1, "libnet IP header: %s\n", libnet_geterror (ifp->libnet_ctx)) - ifp->netbuf.pending = 0; - libnet_clear_packet(ifp->libnet_ctx); - return -1; - } - - } - else - { - /* IP version 6 */ - struct libnet_in6_addr src, dst; - //int sum; - - memcpy(&src, &ifp->ip_addr.v6, sizeof(src)); - memcpy(&dst, &((struct sockaddr_in6 *)&ifp->int6_multaddr)->sin6_addr, sizeof(dst)); - - - /* !!!ATTENTION!!! - * There is a bug in libnet (libnet_build_udp) 1.1.2 that causes - * a crash if requesting auto-generated UDP checksums when - * using IPv6. - * Since we want backwards compability(well... as of now it - * is actually current compability), we MUST manually generate - * a checksum when in IPv6 mode. - * Yepp - it sux - * - Andreas - */ - libnet_toggle_checksum(ifp->libnet_ctx, udp_ptag, LIBNET_OFF); - - /* TODO: generate and insert CHKSUM */ - - printf("Build IPv6 size: %d\n", - LIBNET_IPV6_H + LIBNET_UDP_H + ifp->netbuf.pending); - ip_ptag = libnet_build_ipv6(0, /* Traffic class */ - 0, /* Flow label */ - LIBNET_IPV6_H + LIBNET_UDP_H + ifp->netbuf.pending, - IPPROTO_UDP, /* Next Header */ - 64, /* Hop Limit */ - src, - dst, - NULL, /* Optional payload */ - 0, /* Optional payload length */ - ifp->libnet_ctx, - 0); - - if(ip_ptag == -1) - { - OLSR_PRINTF (1, "libnet IP header: %s\n", libnet_geterror (ifp->libnet_ctx)) - ifp->netbuf.pending = 0; - libnet_clear_packet(ifp->libnet_ctx); - return -1; - } - } - - #if 0 - { - libnet_ptag_t ether_tag = 0; - static const unsigned char enet_broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - /* We should add layer2 as well later */ - ether_tag = libnet_build_ethernet(enet_broadcast, - libnet_get_hwaddr(ifp->libnet_ctx), - ETHERTYPE_IP, - NULL, /* payload */ - 0, /* payload size */ - ifp->libnet_ctx, /* libnet handle */ - 0); /* pblock tag */ - if (ether_tag == -1) - { - OLSR_PRINTF (1, "libnet ethernet header: %s\n", libnet_geterror (ifp->libnet_ctx)) - ifp->netbuf.pending = 0; - libnet_clear_packet(ifp->libnet_ctx); - return -1; - } - } - #endif - - if((retval = libnet_write(ifp->libnet_ctx)) == -1) - { - OLSR_PRINTF (1, "libnet packet write: %s\n", libnet_geterror (ifp->libnet_ctx)) - } - printf("RETVAL: %d\n", retval); fflush(stdout); - - libnet_clear_packet(ifp->libnet_ctx); - - ifp->netbuf.pending = 0; - #else struct sockaddr_in *sin; struct sockaddr_in dst; --- 370,373 ---- *************** *** 685,689 **** ifp->netbuf.pending = 0; ! #endif // if we've just transmitted a TC message, let Dijkstra use the current // link qualities for the links to our neighbours --- 470,474 ---- ifp->netbuf.pending = 0; ! // if we've just transmitted a TC message, let Dijkstra use the current // link qualities for the links to our neighbours Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** net_olsr.h 31 Jan 2007 12:36:50 -0000 1.6 --- net_olsr.h 10 Feb 2007 19:59:51 -0000 1.7 *************** *** 52,60 **** typedef int (*packet_transform_function)(olsr_u8_t *, int *); - #ifdef USE_LIBNET - char * - get_libnet_errbuf(void); - #endif - void net_set_disp_pack_out(olsr_bool); --- 52,55 ---- Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** interfaces.h 4 Feb 2007 23:36:35 -0000 1.37 --- interfaces.h 10 Feb 2007 19:59:51 -0000 1.38 *************** *** 151,157 **** clock_t fwdtimer; /* Timeout for OLSR forwarding on this if */ - #ifdef USE_LIBNET - void *libnet_ctx; /* libnet context(void to avoid dependency */ - #endif struct olsr_netbuf netbuf; /* the buffer to construct the packet data */ --- 151,154 ---- From (spam-protected) Sun Feb 11 12:51:59 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Feb 2007 11:51:59 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src NetworkInterfaces.c,1.2,1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23165/lib/bmf/src Modified Files: NetworkInterfaces.c Log Message: * fixes fro fixes from Sven-Ola Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NetworkInterfaces.c 10 Feb 2007 17:05:56 -0000 1.2 --- NetworkInterfaces.c 11 Feb 2007 11:51:56 -0000 1.3 *************** *** 1142,1149 **** kernel_route.rt_dev = EtherTunTapIfName; ! /* Sven-Ola at gmx.de: not available in olsrd-0.5/src/defs.h */ ! extern int ioctl_s; ! ! if (ioctl(ioctl_s, SIOCDELRT, &kernel_route) < 0) { olsr_printf( --- 1142,1146 ---- kernel_route.rt_dev = EtherTunTapIfName; ! if (ioctl(olsr_cnf->ioctl_s, SIOCDELRT, &kernel_route) < 0) { olsr_printf( From (spam-protected) Sun Feb 11 12:51:59 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Feb 2007 11:51:59 +0000 Subject: [Olsr-cvs] olsrd-current/lib Makefile,1.8,1.9 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23165/lib Modified Files: Makefile Log Message: * fixes fro fixes from Sven-Ola Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile 8 Feb 2007 10:31:43 -0000 1.8 --- Makefile 11 Feb 2007 11:51:57 -0000 1.9 *************** *** 1,3 **** --- 1,8 ---- + # This is quite ougly but at least it works + ifneq ($(OS),linux) SUBDIRS := $(shell find -maxdepth 2 -name Makefile -not -path ./Makefile -printf "%h\n") + else + SUBDIRS := dot_draw dyn_gw dyn_gw_plain httpinfo mini nameservice pgraph secure txtinfo + endif .PHONY: $(SUBDIRS) From (spam-protected) Wed Feb 14 10:09:19 2007 From: (spam-protected) (Andreas Tønnesen) Date: Wed, 14 Feb 2007 09:09:19 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd kernel_routes.c,1.8,1.9 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6337/src/bsd Modified Files: kernel_routes.c Log Message: 2nd half of fix from John Hay Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/kernel_routes.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** kernel_routes.c 12 Dec 2006 11:20:53 -0000 1.8 --- kernel_routes.c 14 Feb 2007 09:09:16 -0000 1.9 *************** *** 254,258 **** rtm->rtm_msglen = (unsigned short)(walker - buff); ! len = write(rts, buff, rtm->rtm_msglen); if (len < rtm->rtm_msglen) --- 254,258 ---- rtm->rtm_msglen = (unsigned short)(walker - buff); ! len = write(olsr_cnf->rts, buff, rtm->rtm_msglen); if (len < rtm->rtm_msglen) From (spam-protected) Wed Feb 14 14:03:15 2007 From: (spam-protected) (Andreas Tønnesen) Date: Wed, 14 Feb 2007 13:03:15 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd net.c,1.30,1.31 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14255/src/bsd Modified Files: net.c Log Message: A couple of prototype missmatches for BSD Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/net.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** net.c 4 Feb 2007 23:36:35 -0000 1.30 --- net.c 14 Feb 2007 13:03:13 -0000 1.31 *************** *** 221,225 **** } ! int disable_redirects(char *if_name, struct interface *iface, int version) { // this function gets called for each interface olsrd uses; however, --- 221,225 ---- } ! int disable_redirects(const char *if_name, struct interface *iface, int version) { // this function gets called for each interface olsrd uses; however, *************** *** 230,234 **** } ! int deactivate_spoof(char *if_name, struct interface *iface, int version) { return 1; --- 230,234 ---- } ! int deactivate_spoof(const char *if_name, struct interface *iface, int version) { return 1; From (spam-protected) Wed Feb 14 22:47:08 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 14 Feb 2007 21:47:08 +0000 Subject: [Olsr-cvs] olsrd-current/lib Makefile,1.9,1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4433/lib Modified Files: Makefile Log Message: * fixed wrong if Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 11 Feb 2007 11:51:57 -0000 1.9 --- Makefile 14 Feb 2007 21:47:06 -0000 1.10 *************** *** 1,4 **** # This is quite ougly but at least it works ! ifneq ($(OS),linux) SUBDIRS := $(shell find -maxdepth 2 -name Makefile -not -path ./Makefile -printf "%h\n") else --- 1,4 ---- # This is quite ougly but at least it works ! ifeq ($(OS),linux) SUBDIRS := $(shell find -maxdepth 2 -name Makefile -not -path ./Makefile -printf "%h\n") else From (spam-protected) Sat Feb 10 18:05:58 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 10 Feb 2007 17:05:58 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Address.c, 1.1, 1.2 Address.h, 1.1, 1.2 Bmf.c, 1.1, 1.2 Bmf.h, 1.1, 1.2 DropList.c, 1.1, 1.2 DropList.h, 1.1, 1.2 NetworkInterfaces.c, 1.1, 1.2 NetworkInterfaces.h, 1.1, 1.2 Packet.c, 1.2, 1.3 Packet.h, 1.1, 1.2 PacketHistory.c, 1.1, 1.2 PacketHistory.h, 1.1, 1.2 olsrd_plugin.c, 1.1, 1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14934/src Modified Files: Address.c Address.h Bmf.c Bmf.h DropList.c DropList.h NetworkInterfaces.c NetworkInterfaces.h Packet.c Packet.h PacketHistory.c PacketHistory.h olsrd_plugin.c Log Message: * replaced the bmf plugin with the most recent 1.3 from sf.net with the following changes: - We had a globally declared ioctl_s variable which is used exactly once in NetworkInterfaces.c. Sven-Ola proposed a global "extern" decalaretion but I inserted it there locally. Main reason: Where does this variable actually come from? I can only find one in the olsr_cnf struct. But since the compiler/linker finds one, there must be one somewhere. - I #if 0 ... #endif out the IsNullMacAddress() function since it is not used AFAICS (and the compiler actually). Index: Packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Packet.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Packet.h 3 May 2006 08:59:04 -0000 1.1 --- Packet.h 10 Feb 2007 17:05:56 -0000 1.2 *************** *** 34,38 **** */ ! /* $Id$ */ /* System includes */ --- 34,44 ---- */ ! /* ------------------------------------------------------------------------- ! * File : Packet.h ! * Description: BMF and IP packet processing functions ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ /* System includes */ *************** *** 50,63 **** #define IPV4_TYPE 0x0800 struct TSaveTtl { u_int8_t ttl; u_int16_t check; ! }; int GetIpTtl(unsigned char* buffer); void SaveTtlAndChecksum(unsigned char* buffer, struct TSaveTtl* sttl); void RestoreTtlAndChecksum(unsigned char* buffer, struct TSaveTtl* sttl); ! void PacketDecreaseTtlAndUpdateHeaderChecksum(unsigned char* buffer); #endif /* _BMF_PACKET_H */ --- 56,85 ---- #define IPV4_TYPE 0x0800 + /* BMF-encapsulated packets are Ethernet-IP-UDP packets, which start + * with a 16-bytes BMF header (struct TEncapHeader), followed by the + * encapsulated Ethernet-IP packet itself */ + + struct TEncapHeader + { + u_int32_t crc32; + u_int32_t futureExpansion1; + u_int32_t futureExpansion2; + u_int32_t futureExpansion3; + } __attribute__((__packed__)); + + #define ENCAP_HDR_LEN (sizeof(struct TEncapHeader)) + struct TSaveTtl { u_int8_t ttl; u_int16_t check; ! } __attribute__((__packed__)); + int GetIpPacketLength(unsigned char* buffer); + int GetIpHeaderLength(unsigned char* buffer); int GetIpTtl(unsigned char* buffer); void SaveTtlAndChecksum(unsigned char* buffer, struct TSaveTtl* sttl); void RestoreTtlAndChecksum(unsigned char* buffer, struct TSaveTtl* sttl); ! void DecreaseTtlAndUpdateHeaderChecksum(unsigned char* buffer); #endif /* _BMF_PACKET_H */ Index: Address.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Address.h 3 May 2006 08:59:04 -0000 1.1 --- Address.h 10 Feb 2007 17:05:55 -0000 1.2 *************** *** 34,45 **** */ ! /* $Id$ */ #include "olsr_types.h" /* olsr_ip_addr */ #include "interfaces.h" /* struct interface */ int IsMulticast(union olsr_ip_addr* ipAddress); ! int IsLocalBroadcast(union olsr_ip_addr* destIp, struct interface* ifFrom); ! int IsOlsrOrBmfPacket(unsigned char* buffer, ssize_t len); #endif /* _BMF_ADDRESS_H */ --- 34,56 ---- */ ! /* ------------------------------------------------------------------------- ! * File : Address.h ! * Description: IP packet characterization functions ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ #include "olsr_types.h" /* olsr_ip_addr */ #include "interfaces.h" /* struct interface */ + struct TBmfInterface; + + extern int EnableLocalBroadcast; + + int DoLocalBroadcast(const char* enable); int IsMulticast(union olsr_ip_addr* ipAddress); ! int IsLocalBroadcast(union olsr_ip_addr* destIp, struct sockaddr* broadAddr); ! int IsOlsrOrBmfPacket(struct TBmfInterface* intf, unsigned char* ethPkt, size_t len); #endif /* _BMF_ADDRESS_H */ Index: DropList.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/DropList.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DropList.h 3 May 2006 08:59:04 -0000 1.1 --- DropList.h 10 Feb 2007 17:05:56 -0000 1.2 *************** *** 34,38 **** */ ! /* $Id$ */ struct TMacAddress --- 34,44 ---- */ ! /* ------------------------------------------------------------------------- ! * File : DropList.h ! * Description: List of MAC addresses of hosts from which all packets are dropped. ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ struct TMacAddress Index: Packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Packet.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Packet.c 8 Feb 2007 10:31:43 -0000 1.2 --- Packet.c 10 Feb 2007 17:05:56 -0000 1.3 *************** *** 31,35 **** */ ! /* $Id$ */ #include "Packet.h" --- 31,41 ---- */ ! /* ------------------------------------------------------------------------- ! * File : Packet.c ! * Description: BMF and IP packet processing functions ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ #include "Packet.h" *************** *** 39,47 **** #include /* u_int32_t */ #include /* ntohs(), htons() */ ! #include ! #include ! /* Retrieve the TTL (Time To Live) value from the IP header of the ! * passed ethernet packet */ int GetIpTtl(unsigned char* buffer) { --- 45,98 ---- #include /* u_int32_t */ #include /* ntohs(), htons() */ ! #include /* struct iphdr */ ! #include ! /* ------------------------------------------------------------------------- ! * Function : GetIpPacketLength ! * Description: Retrieve the IP packet length (in bytes) of the passed ! * ethernet-IP packet ! * Input : buffer - the ethernet-IP packet ! * Output : none ! * Return : IP packet length ! * Data Used : none ! * ------------------------------------------------------------------------- */ ! int GetIpPacketLength(unsigned char* buffer) ! { ! struct iphdr* iph; ! ! assert(buffer != NULL); ! ! iph = (struct iphdr*) (buffer + IP_HDR_OFFSET); ! return ntohs(iph->tot_len); ! } ! ! /* ------------------------------------------------------------------------- ! * Function : GetIpHeaderLength ! * Description: Retrieve the IP header length (in bytes) of the passed ! * ethernet-IP packet ! * Input : buffer - the ethernet-IP packet ! * Output : none ! * Return : IP header length ! * Data Used : none ! * ------------------------------------------------------------------------- */ ! int GetIpHeaderLength(unsigned char* buffer) ! { ! struct iphdr* iph; ! ! assert(buffer != NULL); ! ! iph = (struct iphdr*) (buffer + IP_HDR_OFFSET); ! return iph->ihl << 2; ! } ! ! /* ------------------------------------------------------------------------- ! * Function : GetIpTtl ! * Description: Retrieve the TTL (Time To Live) value from the IP header of ! * the passed ethernet-IP packet ! * Input : buffer - the ethernet-IP packet ! * Output : none ! * Return : TTL value ! * Data Used : none ! * ------------------------------------------------------------------------- */ int GetIpTtl(unsigned char* buffer) { *************** *** 54,57 **** --- 105,117 ---- } + /* ------------------------------------------------------------------------- + * Function : SaveTtlAndChecksum + * Description: Save the TTL (Time To Live) value and IP checksum as found in + * the IP header of the passed ethernet-IP packet + * Input : buffer - the ethernet-IP packet + * Output : sttl - the TTL and checksum values + * Return : none + * Data Used : none + * ------------------------------------------------------------------------- */ void SaveTtlAndChecksum(unsigned char* buffer, struct TSaveTtl* sttl) { *************** *** 65,68 **** --- 125,138 ---- } + /* ------------------------------------------------------------------------- + * Function : RestoreTtlAndChecksum + * Description: Restore the TTL (Time To Live) value and IP checksum in + * the IP header of the passed ethernet-IP packet + * Input : buffer - the ethernet-IP packet + * sttl - the TTL and checksum values + * Output : none + * Return : none + * Data Used : none + * ------------------------------------------------------------------------- */ void RestoreTtlAndChecksum(unsigned char* buffer, struct TSaveTtl* sttl) { *************** *** 76,82 **** } ! /* For an IP packet, decrement the TTL value and update the IP header ! * checksum accordingly. See also RFC1141. */ ! void PacketDecreaseTtlAndUpdateHeaderChecksum(unsigned char* buffer) { struct iphdr* iph; --- 146,160 ---- } ! /* ------------------------------------------------------------------------- ! * Function : DecreaseTtlAndUpdateHeaderChecksum ! * Description: For an IP packet, decrement the TTL value and update the IP header ! * checksum accordingly. ! * Input : buffer - the ethernet-IP packet ! * Output : none ! * Return : none ! * Data Used : none ! * Notes : See also RFC1141 ! * ------------------------------------------------------------------------- */ ! void DecreaseTtlAndUpdateHeaderChecksum(unsigned char* buffer) { struct iphdr* iph; Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/olsrd_plugin.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** olsrd_plugin.c 3 May 2006 08:59:04 -0000 1.1 --- olsrd_plugin.c 10 Feb 2007 17:05:56 -0000 1.2 *************** *** 31,39 **** */ ! /* $Id$ */ ! ! /* ! * Dynamic linked library for olsr.org olsrd ! */ /* System includes */ --- 31,41 ---- */ ! /* ------------------------------------------------------------------------- ! * File : olsrd_plugin.c ! * Description: Interface to the OLSRD plugin system ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ /* System includes */ *************** *** 43,49 **** --- 45,54 ---- /* OLSRD includes */ #include "olsrd_plugin.h" + #include "defs.h" /* olsr_u8_t, olsr_cnf */ + #include "scheduler.h" /* olsr_register_scheduler_event */ /* BMF includes */ #include "Bmf.h" /* InitBmf(), CloseBmf(), RegisterBmfParameter() */ + #include "PacketHistory.h" /* InitPacketHistory() */ static void __attribute__ ((constructor)) my_init(void); *************** *** 52,57 **** void olsr_plugin_exit(void); ! /* Plugin interface version ! * Used by main olsrd to check plugin interface version */ int olsrd_plugin_interface_version() { --- 57,70 ---- void olsr_plugin_exit(void); ! /* ------------------------------------------------------------------------- ! * Function : olsrd_plugin_interface_version ! * Description: Plugin interface version ! * Input : none ! * Output : none ! * Return : BMF plugin interface version number ! * Data Used : none ! * Notes : Called by main OLSRD (olsr_load_dl) to check plugin interface ! * version ! * ------------------------------------------------------------------------- */ int olsrd_plugin_interface_version() { *************** *** 59,68 **** } int olsrd_plugin_init() { ! return InitBmf(); } ! /* destructor - called at unload */ void olsr_plugin_exit() { --- 72,114 ---- } + /* ------------------------------------------------------------------------- + * Function : olsrd_plugin_init + * Description: Plugin initialisation + * Input : none + * Output : none + * Return : fail (0) or success (1) + * Data Used : olsr_cnf + * Notes : Called by main OLSRD (init_olsr_plugin) to initialize plugin + * ------------------------------------------------------------------------- */ int olsrd_plugin_init() { ! /* Check validity */ ! if (olsr_cnf->ip_version != AF_INET) ! { ! fprintf(stderr, PLUGIN_NAME ": This plugin only supports IPv4!\n"); ! return 0; ! } ! ! /* Clear the packet history */ ! InitPacketHistory(); ! ! /* Register ifchange function */ ! add_ifchgf(&InterfaceChange); ! ! /* Register the duplicate registration pruning process */ ! olsr_register_scheduler_event(&PrunePacketHistory, NULL, 3.0, 2.0, NULL); ! ! return InitBmf(NULL); } ! /* ------------------------------------------------------------------------- ! * Function : olsr_plugin_exit ! * Description: Plugin cleanup ! * Input : none ! * Output : none ! * Return : none ! * Data Used : none ! * Notes : Called by my_fini() at unload of shared object ! * ------------------------------------------------------------------------- */ void olsr_plugin_exit() { *************** *** 70,75 **** } ! /* Register parameters from config file ! * Called for all plugin parameters */ int olsrd_plugin_register_param(char* key, char* value) { --- 116,129 ---- } ! /* ------------------------------------------------------------------------- ! * 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) { *************** *** 79,82 **** --- 133,145 ---- } + /* ------------------------------------------------------------------------- + * Function : my_init + * Description: Plugin constructor + * Input : none + * Output : none + * Return : none + * Data Used : none + * Notes : Called at load of shared object + * ------------------------------------------------------------------------- */ static void my_init() { *************** *** 87,90 **** --- 150,162 ---- } + /* ------------------------------------------------------------------------- + * Function : my_fini + * Description: Plugin destructor + * Input : none + * Output : none + * Return : none + * Data Used : none + * Notes : Called at unload of shared object + * ------------------------------------------------------------------------- */ static void my_fini() { Index: DropList.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/DropList.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DropList.c 3 May 2006 08:59:04 -0000 1.1 --- DropList.c 10 Feb 2007 17:05:55 -0000 1.2 *************** *** 31,35 **** */ ! /* $Id$ */ --- 31,42 ---- */ ! /* ------------------------------------------------------------------------- ! * File : DropList.c ! * Description: List of MAC addresses of hosts from which received multicast ! * and local broadcast packets are dropped. ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ *************** *** 51,63 **** static struct TMacAddress* DroppedMacAddresses = NULL; ! /* Register a MAC address in the drop list. The registered MAC address will be matched ! * to the source MAC address of incoming multicast packets. If matched, the multicast ! * packet will be silently dropped. ! * The drop list is needed only in lab environments, where hidden nodes are simulated ! * by using iptables with the -m mac --mac-source option (as in: ! * "iptables -A INPUT -m mac --mac-source 00:0C:29:EE:C9:D0 -j DROP") ! * The drop list is needed because network interfaces in promiscuous mode will still ! * capture packets even if they are specified to be dropped by iptables. ! */ int DropMac(const char* macStr) { --- 58,79 ---- static struct TMacAddress* DroppedMacAddresses = NULL; ! /* ------------------------------------------------------------------------- ! * Function : DropMac ! * Description: Register a MAC address in the drop list ! * Input : macStr - MAC address as string ! * Output : none ! * Return : fail (0) or success (1) ! * Data Used : DroppedMacAddresses ! * Notes : The registered MAC address will be matched to the source MAC ! * address of incoming multicast packets. If matched, the multicast ! * packet will be dropped. ! * The drop list is needed only in lab environments, where hidden ! * nodes are simulated by using iptables with the ! * -m mac helper and --mac-source option (as in: ! * "iptables -A INPUT -m mac --mac-source 00:0C:29:EE:C9:D0 -j DROP") ! * The drop list is needed because network interfaces in promiscuous ! * mode will still capture packets even if they are specified to ! * be dropped by iptables. ! * ------------------------------------------------------------------------- */ int DropMac(const char* macStr) { *************** *** 87,91 **** } ! /* Return 1 if macAddress is in the drop list, else 0 */ int IsInDropList(const unsigned char* macAddress) { --- 103,114 ---- } ! /* ------------------------------------------------------------------------- ! * Function : IsInDropList ! * Description: Check if a MAC address is in the drop list ! * Input : macAddress ! * Output : none ! * Return : true (1) or false (0) ! * Data Used : DroppedMacAddresses ! * ------------------------------------------------------------------------- */ int IsInDropList(const unsigned char* macAddress) { Index: Address.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Address.c 3 May 2006 08:59:04 -0000 1.1 --- Address.c 10 Feb 2007 17:05:55 -0000 1.2 *************** *** 30,40 **** * OF THE POSSIBILITY OF SUCH DAMAGE. */ ! ! /* $Id$ */ ! #include "Address.h" /* System includes */ #include /* assert() */ /* OLSRD includes */ --- 30,48 ---- * OF THE POSSIBILITY OF SUCH DAMAGE. */ ! ! /* ------------------------------------------------------------------------- ! * File : Address.c ! * Description: IP packet characterization functions ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ ! #include "Address.h" /* System includes */ #include /* assert() */ + #include /* struct ip */ + #include /* struct udphdr */ /* OLSRD includes */ *************** *** 43,47 **** --- 51,95 ---- /* Plugin includes */ #include "Bmf.h" /* BMF_ENCAP_PORT */ + #include "NetworkInterfaces.h" /* TBmfInterface */ + + /* Whether or not to flood local broadcast packets (e.g. packets with IP + * destination 192.168.1.255). May be overruled by setting the plugin + * parameter "DoLocalBroadcast" to "no" */ + int EnableLocalBroadcast = 1; + + /* ------------------------------------------------------------------------- + * Function : DoLocalBroadcast + * Description: Overrule the default setting, enabling or disabling the + * 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; + } + /* ------------------------------------------------------------------------- + * Function : IsMulticast + * Description: Check if an IP address is a multicast address + * Input : ipAddress + * Output : none + * Return : true (1) or false (0) + * Data Used : none + * ------------------------------------------------------------------------- */ int IsMulticast(union olsr_ip_addr* ipAddress) { *************** *** 51,92 **** } ! int IsLocalBroadcast(union olsr_ip_addr* destIp, struct interface* ifFrom) { struct sockaddr_in* sin; ! assert(destIp != NULL); ! ! /* Protect ourselves against bogus input */ ! if (ifFrom == NULL) return 0; /* Cast down to correct sockaddr subtype */ ! sin = (struct sockaddr_in*)&(ifFrom->int_broadaddr); ! ! /* Just in case OLSR does not have int_broadaddr filled in for this ! * interface. */ ! if (sin == NULL) return 0; return COMP_IP(&(sin->sin_addr.s_addr), destIp); } ! int IsOlsrOrBmfPacket(unsigned char* buffer, ssize_t len) { ! u_int16_t port; ! assert(buffer != NULL); /* Consider OLSR and BMF packets not to be local broadcast * OLSR packets are UDP - port 698 ! * BMF packets are UDP - port 50505 */ ! memcpy(&port, buffer + 0x24, 2); ! port = ntohs(port); ! if (len > 0x25 && ! buffer[0x17] == 0x11 && /* UDP */ ! (port == OLSRPORT || port == BMF_ENCAP_PORT)) { return 1; } return 0; } --- 99,230 ---- } ! /* ------------------------------------------------------------------------- ! * Function : IsLocalBroadcast ! * Description: Check if an IP address is a local broadcast address for a ! * given network interface ! * Input : destIp, broadAddr ! * Output : none ! * Return : true (1) or false (0) ! * Data Used : none ! * ------------------------------------------------------------------------- */ ! int IsLocalBroadcast(union olsr_ip_addr* destIp, struct sockaddr* broadAddr) { struct sockaddr_in* sin; ! assert(destIp != NULL && broadAddr != NULL); /* Cast down to correct sockaddr subtype */ ! sin = (struct sockaddr_in*)broadAddr; return COMP_IP(&(sin->sin_addr.s_addr), destIp); } ! /* ------------------------------------------------------------------------- ! * Function : IsOlsrOrBmfPacket ! * Description: Check if an ethernet packet is an OLSR packet or a BMF packet ! * Input : intf, ethPkt, len ! * Output : none ! * Return : true (1) or false (0) ! * Data Used : none ! * Assumption : len >= IP_HDR_OFFSET + GetIpHeaderLength(ethPkt) ! * ------------------------------------------------------------------------- */ ! int IsOlsrOrBmfPacket(struct TBmfInterface* intf, unsigned char* ethPkt, size_t len) { ! struct ip* ipData; ! unsigned int ipHeaderLen; ! struct udphdr* udpData; ! u_int16_t destPort; ! assert(ethPkt != NULL); /* Consider OLSR and BMF packets not to be local broadcast * OLSR packets are UDP - port 698 ! * OLSR-BMF packets are UDP - port 50698 ! * OLSR-Autodetect probe packets are UDP - port 51698 ! * Fragments of the above packets are also not local broadcast */ ! ipData = (struct ip*) (ethPkt + IP_HDR_OFFSET); ! if (ipData->ip_p != SOL_UDP) ! { ! return 0; ! } ! /* Check if the packet is an IP-fragment */ ! if ((ntohs(ipData->ip_off) & IP_OFFMASK) != 0) { + #if 0 + int i; + for (i = 0; i < FRAGMENT_HISTORY_SIZE; i++) + { + /* Quick-access pointer */ + struct TFragmentHistory* entry = &intf->fragmentHistory[i]; + + /* Match */ + if (entry->ipId == ntohs(ipData->ip_id) && + entry->ipProto == ipData->ip_p && + entry->ipSrc.s_addr == ntohl(ipData->ip_src.s_addr) && + entry->ipDst.s_addr == ntohl(ipData->ip_dst.s_addr)) + { + /* Found matching history entry, so packet is assumed to be a fragment + * of an earlier OLSR/OLSR-BMF/OLSR-Autodetect packet */ + + /* More fragments? If not, invalidate entry */ + if (((ntohs(ipData->ip_off) & IP_MF) == 0)) + { + memset(entry, 0, sizeof(struct TFragmentHistory)); + } + + return 1; + } + } + + /* Matching history entry not found, so packet is not assumed to be a fragment + * of an earlier OLSR/OLSR-BMF/OLSR-Autodetect packet */ + #endif + /* OOPS! IP-fragments may come in earlier than their main packet. In that case, + * their relation with the main packet is not detected by the above code, resulting + * in stray fragments being forwarded all ove the network. Solution for now is to + * not forward any IP-fragments at all. */ + /*return 0;*/ return 1; } + + /* The packet is the first (or only) IP-fragment */ + + /* Check length first */ + ipHeaderLen = ipData->ip_hl << 2; + if (len < IP_HDR_OFFSET + ipHeaderLen + sizeof(struct udphdr)) + { + return 0; + } + + /* Go into the UDP header and check port number */ + udpData = (struct udphdr*) (ethPkt + IP_HDR_OFFSET + ipHeaderLen); + destPort = ntohs(udpData->dest); + + if (destPort == OLSRPORT || destPort == BMF_ENCAP_PORT || destPort == 51698) + /* TODO: #define for 51698 */ + { + #if 0 + /* If more fragments are expected, keep a record in the fragment history */ + if ((ntohs(ipData->ip_off) & IP_MF) != 0) + { + /* Quick-access pointer */ + struct TFragmentHistory* entry = &intf->fragmentHistory[intf->nextFragmentHistoryEntry]; + + /* Store in fragment history */ + entry->ipId = ntohs(ipData->ip_id); + entry->ipProto = ipData->ip_p; + entry->ipSrc.s_addr = ntohl(ipData->ip_src.s_addr); + entry->ipDst.s_addr = ntohl(ipData->ip_dst.s_addr); + + /* Advance to next entry */ + intf->nextFragmentHistoryEntry++; + intf->nextFragmentHistoryEntry %= FRAGMENT_HISTORY_SIZE; + } + #endif + return 1; + } + return 0; } Index: Bmf.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Bmf.h 3 May 2006 08:59:04 -0000 1.1 --- Bmf.h 10 Feb 2007 17:05:55 -0000 1.2 *************** *** 34,50 **** */ ! /* $Id$ */ /* BMF plugin data */ ! #define PLUGIN_NAME "OLSRD Basic Multicast Forwarding plugin" ! #define PLUGIN_VERSION "1.0.1 (" __DATE__ " " __TIME__ ")" #define PLUGIN_COPYRIGHT " (C) Thales Communications Huizen, Netherlands" ! #define PLUGIN_AUTHOR " Erik Tromp (erik_tromp at hotmail.com)" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION "\n" PLUGIN_COPYRIGHT "\n" PLUGIN_AUTHOR /* UDP-Port on which multicast packets are encapsulated */ ! #define BMF_ENCAP_PORT 50505 ! int InitBmf(void); void CloseBmf(void); int RegisterBmfParameter(char* key, char* value); --- 34,60 ---- */ ! /* ------------------------------------------------------------------------- ! * File : Bmf.h ! * Description: Multicast forwarding functions ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ /* BMF plugin data */ ! #define PLUGIN_NAME "OLSRD Basic Multicast Forwarding (BMF) plugin" ! #define PLUGIN_NAME_SHORT "OLSRD BMF" ! #define PLUGIN_VERSION "1.3 (" __DATE__ " " __TIME__ ")" #define PLUGIN_COPYRIGHT " (C) Thales Communications Huizen, Netherlands" ! #define PLUGIN_AUTHOR " Erik Tromp (erik.tromp at nl.thalesgroup.com)" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION "\n" PLUGIN_COPYRIGHT "\n" PLUGIN_AUTHOR /* UDP-Port on which multicast packets are encapsulated */ ! #define BMF_ENCAP_PORT 50698 ! struct interface; ! ! int InterfaceChange(struct interface* interf, int action); ! int InitBmf(struct interface* skipThisIntf); void CloseBmf(void); int RegisterBmfParameter(char* key, char* value); Index: PacketHistory.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/PacketHistory.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PacketHistory.c 3 May 2006 08:59:04 -0000 1.1 --- PacketHistory.c 10 Feb 2007 17:05:56 -0000 1.2 *************** *** 31,35 **** */ ! /* $Id$ */ #include "PacketHistory.h" --- 31,42 ---- */ ! /* ------------------------------------------------------------------------- ! * File : PacketHistory.c ! * Description: Functions for keeping and accessing the history of processed ! * multicast IP packets. ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ #include "PacketHistory.h" *************** *** 37,42 **** /* System includes */ #include /* assert() */ - #include /* u_int16_t, u_int32_t */ #include /* memset */ /* OLSRD includes */ --- 44,50 ---- /* System includes */ #include /* assert() */ #include /* memset */ + #include /* u_int16_t, u_int32_t */ + #include /* struct iphdr */ /* OLSRD includes */ *************** *** 48,53 **** static u_int32_t PacketHistory[HISTORY_TABLE_SIZE]; ! /* Calculate 16-bits CRC according to CRC-CCITT specification, modified ! * to leave out some parts of the packet. */ static u_int16_t CalcCrcCcitt(unsigned char* buffer, ssize_t len) { --- 56,71 ---- static u_int32_t PacketHistory[HISTORY_TABLE_SIZE]; ! #define CRC_UPTO_NBYTES 256 ! ! #if 0 ! /* ------------------------------------------------------------------------- ! * Function : CalcCrcCcitt ! * Description: Calculate 16-bits CRC according to CRC-CCITT specification ! * Input : buffer - the bytes to calculate the CRC value over ! * len - the number of bytes to calculate the CRC value over ! * Output : none ! * Return : CRC-16 value ! * Data Used : none ! * ------------------------------------------------------------------------- */ static u_int16_t CalcCrcCcitt(unsigned char* buffer, ssize_t len) { *************** *** 61,68 **** for (i = 0; i < len; i++) { - /* Skip IP header checksum; we want to avoid as much as possible - * calculating a checksum over data containing a checksum */ - if (i >= 12 && i < 14) continue; - crc = (unsigned char)(crc >> 8) | (crc << 8); crc ^= buffer[i]; --- 79,82 ---- *************** *** 72,118 **** } return crc; ! ! #if 0 ! /* Alternative, simpler and perhaps just as good: add source IP address, ! * destination IP address and IP identification, in 16-bit */ ! return ! ((buffer[0x0E] << 8) + buffer[0x0F]) + ((buffer[0x10] << 8) + buffer[0x11]) + ! ((buffer[0x12] << 8) + buffer[0x13]) + ((buffer[0x14] << 8) + buffer[0x15]) + ! ((buffer[0x06] << 8) + buffer[0x07]); #endif } void InitPacketHistory() { memset(PacketHistory, 0, sizeof(PacketHistory)); } ! /* Record the fact that this packet was seen recently */ ! void MarkRecentPacket(unsigned char* buffer, ssize_t len) { - u_int16_t crc; u_int32_t index; uint offset; ! assert(buffer != NULL); ! ! /* Start CRC calculation at ethertype; skip source and destination MAC ! * addresses */ ! crc = CalcCrcCcitt(buffer + ETH_TYPE_OFFSET, len - ETH_TYPE_OFFSET); ! ! index = crc / NPACKETS_PER_ENTRY; assert(index < HISTORY_TABLE_SIZE); ! offset = (crc % NPACKETS_PER_ENTRY) * NBITS_PER_PACKET; assert(offset <= NBITS_IN_UINT32 - NBITS_PER_PACKET); ! /* Mark "seen recently" */ PacketHistory[index] = PacketHistory[index] | (0x3u << offset); } ! /* Check if this packet was seen recently */ ! int CheckMarkRecentPacket(unsigned char* buffer, ssize_t len) { - u_int16_t crc; u_int32_t index; uint offset; --- 86,253 ---- } return crc; ! } #endif + + /* ------------------------------------------------------------------------- + * Function : GenerateCrc32Table + * Description: Generate the table of CRC remainders for all possible bytes, + * according to CRC-32-IEEE 802.3 + * Input : none + * Output : none + * Return : none + * Data Used : none + * ------------------------------------------------------------------------- */ + #define CRC32_POLYNOMIAL 0xedb88320UL /* bit-inverse of 0x04c11db7UL */ + + static unsigned long CrcTable[256]; + + static void GenerateCrc32Table(void) + { + int i, j; + u_int32_t crc; + for (i = 0; i < 256; i++) + { + crc = (u_int32_t) i; + for (j = 0; j < 8; j++) + { + if (crc & 1) + { + crc = (crc >> 1) ^ CRC32_POLYNOMIAL; + } + else + { + crc = (crc >> 1); + } + } + CrcTable[i] = crc; + } + } + + /* ------------------------------------------------------------------------- + * Function : CalcCrc32 + * Description: Calculate CRC-32 according to CRC-32-IEEE 802.3 + * Input : buffer - the bytes to calculate the CRC value over + * len - the number of bytes to calculate the CRC value over + * Output : none + * Return : CRC-32 value + * Data Used : none + * ------------------------------------------------------------------------- */ + static u_int32_t CalcCrc32(unsigned char* buffer, ssize_t len) + { + int i, j; + u_int32_t crc = 0xffffffffUL; + for (i = 0; i < len; i++) + { + j = ((int) (crc & 0xFF) ^ *buffer++); + crc = (crc >> 8) ^ CrcTable[j]; + } + return crc ^ 0xffffffffUL; } + /* ------------------------------------------------------------------------- + * Function : PacketCrc32 + * Description: Calculates the CRC-32 value for an Ethernet packet + * Input : ethPkt - the Ethernet packet + * len - the number of octets in the Ethernet packet + * Output : none + * Return : 32-bits hash value + * Data Used : none + * Notes : The source and destination MAC address are not taken into account + * in the CRC calculation. + * ------------------------------------------------------------------------- */ + u_int32_t PacketCrc32(unsigned char* ethPkt, ssize_t len) + { + ssize_t nCrcBytes; + struct TSaveTtl sttl; + struct iphdr* iph; + u_int32_t result; + + assert(ethPkt != NULL); + + /* Start CRC calculation at ethertype; skip source and destination MAC + * addresses, and ethertype. + * + * Also skip TTL: in a multi-homed OLSR-network, the same multicast packet + * may enter the network multiple times, each copy differing only in its + * TTL value. BMF must not calculate a different CRC for packets that + * differ only in TTL. Skip also the IP-header checksum, because it changes + * along with TTL. Besides, it is not a good idea to calculate a CRC over + * data that already contains a checksum. + * + * Clip number of bytes over which CRC is calculated to prevent + * long packets from possibly claiming too much CPU resources. */ + nCrcBytes = len - IP_HDR_OFFSET; + assert(nCrcBytes > 0); + if (nCrcBytes > CRC_UPTO_NBYTES) + { + nCrcBytes = CRC_UPTO_NBYTES; + } + + SaveTtlAndChecksum(ethPkt, &sttl); + + iph = (struct iphdr*) (ethPkt + IP_HDR_OFFSET); + iph->ttl = 0xFF; /* fixed value of TTL for CRC-32 calculation */ + iph->check = 0x5A5A; /* fixed value of IP header checksum for CRC-32 calculation */ + + result = CalcCrc32(ethPkt + IP_HDR_OFFSET, nCrcBytes); + + RestoreTtlAndChecksum(ethPkt, &sttl); + return result; + } + + /* Calculates a 16-bit hash value from a 32-bit hash value */ + u_int16_t Hash16(u_int32_t hash32) + { + return ((hash32 >> 16) + hash32) & 0xFFFFU; + } + + /* ------------------------------------------------------------------------- + * Function : InitPacketHistory + * Description: Initialize the packet history table and CRC-32 table + * Input : none + * Output : none + * Return : none + * Data Used : PacketHistory + * ------------------------------------------------------------------------- */ void InitPacketHistory() { memset(PacketHistory, 0, sizeof(PacketHistory)); + GenerateCrc32Table(); } ! /* ------------------------------------------------------------------------- ! * Function : MarkRecentPacket ! * Description: Record the fact that this packet was seen recently ! * Input : hash16 ! * Output : none ! * Return : none ! * Data Used : PacketHistory ! * ------------------------------------------------------------------------- */ ! void MarkRecentPacket(u_int16_t hash16) { u_int32_t index; uint offset; ! index = hash16 / NPACKETS_PER_ENTRY; assert(index < HISTORY_TABLE_SIZE); ! offset = (hash16 % NPACKETS_PER_ENTRY) * NBITS_PER_PACKET; assert(offset <= NBITS_IN_UINT32 - NBITS_PER_PACKET); ! /* Mark as "seen recently" */ PacketHistory[index] = PacketHistory[index] | (0x3u << offset); } ! /* ------------------------------------------------------------------------- ! * Function : CheckAndMarkRecentPacket ! * Description: Check if this packet was seen recently, then record the fact ! * that this packet was seen recently. ! * Input : hash16 ! * Output : none ! * Return : not recently seen (0), recently seen (1) ! * Data Used : PacketHistory ! * ------------------------------------------------------------------------- */ ! int CheckAndMarkRecentPacket(u_int16_t hash16) { u_int32_t index; uint offset; *************** *** 120,133 **** int result; ! assert(buffer != NULL); ! ! /* Start CRC calculation at ethertype; skip source and destination MAC ! * addresses */ ! crc = CalcCrcCcitt(buffer + ETH_TYPE_OFFSET, len - ETH_TYPE_OFFSET); ! ! index = crc / NPACKETS_PER_ENTRY; assert(index < HISTORY_TABLE_SIZE); ! offset = (crc % NPACKETS_PER_ENTRY) * NBITS_PER_PACKET; assert(offset <= NBITS_IN_UINT32 - NBITS_PER_PACKET); --- 255,262 ---- int result; ! index = hash16 / NPACKETS_PER_ENTRY; assert(index < HISTORY_TABLE_SIZE); ! offset = (hash16 % NPACKETS_PER_ENTRY) * NBITS_PER_PACKET; assert(offset <= NBITS_IN_UINT32 - NBITS_PER_PACKET); *************** *** 135,139 **** result = ((PacketHistory[index] & bitMask) == bitMask); ! /* Always mark "seen recently" */ PacketHistory[index] = PacketHistory[index] | (0x3u << offset); --- 264,268 ---- result = ((PacketHistory[index] & bitMask) == bitMask); ! /* Always mark as "seen recently" */ PacketHistory[index] = PacketHistory[index] | (0x3u << offset); *************** *** 141,144 **** --- 270,281 ---- } + /* ------------------------------------------------------------------------- + * Function : PrunePacketHistory + * Description: Prune the packet history table. + * Input : useless - not used + * Output : none + * Return : none + * Data Used : PacketHistory + * ------------------------------------------------------------------------- */ void PrunePacketHistory(void* useless) { Index: NetworkInterfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NetworkInterfaces.h 3 May 2006 08:59:04 -0000 1.1 --- NetworkInterfaces.h 10 Feb 2007 17:05:56 -0000 1.2 *************** *** 34,42 **** */ ! /* $Id$ */ /* Plugin includes */ #include "Packet.h" /* IFHWADDRLEN */ struct TBmfInterface { --- 34,54 ---- */ ! /* ------------------------------------------------------------------------- ! * File : NetworkInterfaces.h ! * Description: Functions to open and close sockets ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ ! ! /* System includes */ ! #include /* struct in_addr */ /* Plugin includes */ #include "Packet.h" /* IFHWADDRLEN */ + /* Size of buffer in which packets are received */ + #define BMF_BUFFER_SIZE 2048 + struct TBmfInterface { *************** *** 45,49 **** /* File descriptor of UDP (datagram) socket for encapsulated multicast packets. ! * Set to -1 if interface is not OLSR-enabled. */ int encapsulatingSkfd; --- 57,61 ---- /* File descriptor of UDP (datagram) socket for encapsulated multicast packets. ! * Only used for OLSR-enabled interfaces; set to -1 if interface is not OLSR-enabled. */ int encapsulatingSkfd; *************** *** 56,62 **** struct interface* olsrIntf; ! /* Kernels index of this network interface */ ! int ifIndex; ! /* Next element in list */ struct TBmfInterface* next; --- 68,88 ---- struct interface* olsrIntf; ! /* IP address of this network interface */ ! struct sockaddr intAddr; ! ! /* Broadcast address of this network interface */ ! struct sockaddr broadAddr; ! ! #define FRAGMENT_HISTORY_SIZE 10 ! struct TFragmentHistory ! { ! u_int16_t ipId; ! u_int8_t ipProto; ! struct in_addr ipSrc; ! struct in_addr ipDst; ! } fragmentHistory [FRAGMENT_HISTORY_SIZE]; ! ! int nextFragmentHistoryEntry; ! /* Next element in list */ struct TBmfInterface* next; *************** *** 65,79 **** extern struct TBmfInterface* BmfInterfaces; extern int EtherTunTapFd; ! extern const char* EtherTunTapIfName; enum TTunOrTap { TT_TUN = 0, TT_TAP }; extern enum TTunOrTap TunOrTap; ! int CreateBmfNetworkInterfaces(void); void CloseBmfNetworkInterfaces(void); int AddNonOlsrBmfIf(const char* ifName); int IsNonOlsrBmfIf(const char* ifName); #endif /* _BMF_NETWORKINTERFACES_H */ --- 91,120 ---- extern struct TBmfInterface* BmfInterfaces; + extern int HighestSkfd; + extern fd_set InputSet; + extern int EtherTunTapFd; ! extern char EtherTunTapIfName[]; ! ! extern u_int32_t EtherTunTapIp; ! extern u_int32_t EtherTunTapIpMask; ! extern u_int32_t EtherTunTapIpBroadcast; ! ! extern int CapturePacketsOnOlsrInterfaces; enum TTunOrTap { TT_TUN = 0, TT_TAP }; extern enum TTunOrTap TunOrTap; ! int SetBmfInterfaceName(const char* ifname); ! int SetBmfInterfaceType(const char* iftype); ! int SetBmfInterfaceIp(const char* ip); ! int SetCapturePacketsOnOlsrInterfaces(const char* enable); ! int CreateBmfNetworkInterfaces(struct interface* skipThisIntf); ! void AddInterface(struct interface* newIntf); void CloseBmfNetworkInterfaces(void); int AddNonOlsrBmfIf(const char* ifName); int IsNonOlsrBmfIf(const char* ifName); + void CheckAndUpdateLocalBroadcast(unsigned char* buffer, struct sockaddr* broadAddr); #endif /* _BMF_NETWORKINTERFACES_H */ Index: Bmf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Bmf.c 3 May 2006 08:59:04 -0000 1.1 --- Bmf.c 10 Feb 2007 17:05:55 -0000 1.2 *************** *** 31,35 **** */ ! /* $Id$ */ #define _MULTI_THREADED --- 31,41 ---- */ ! /* ------------------------------------------------------------------------- ! * File : Bmf.c [...1837 lines suppressed...] + else if (strcmp(key, "BmfInterface") == 0) + { + return SetBmfInterfaceName(value); + } + else if (strcmp(key, "BmfInterfaceType") == 0) + { + return SetBmfInterfaceType(value); + } + else if (strcmp(key, "BmfInterfaceIp") == 0) + { + return SetBmfInterfaceIp(value); + } + else if (strcmp(key, "CapturePacketsOnOlsrInterfaces") == 0) + { + return SetCapturePacketsOnOlsrInterfaces(value); + } + /* Key not recognized */ return 0; } Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NetworkInterfaces.c 3 May 2006 08:59:04 -0000 1.1 --- NetworkInterfaces.c 10 Feb 2007 17:05:56 -0000 1.2 *************** *** 31,35 **** */ ! /* $Id$ */ #include "NetworkInterfaces.h" --- 31,41 ---- */ ! /* ------------------------------------------------------------------------- ! * File : NetworkInterfaces.c [...1628 lines suppressed...] + /* Re-calculate UDP/IP checksum for new destination */ + + int ipHeaderLen = GetIpHeaderLength(buffer); + struct udphdr* udph = (struct udphdr*) (buffer + IP_HDR_OFFSET + ipHeaderLen); + + /* RFC 1624, Eq. 3: HC' = ~(~HC - m + m') */ + + check = ntohs(udph->check); + + check = ~ (~ check - ((origDaddr >> 16) & 0xFFFF) + ((newDaddr >> 16) & 0xFFFF)); + check = ~ (~ check - (origDaddr & 0xFFFF) + (newDaddr & 0xFFFF)); + + /* Add carry */ + check = check + (check >> 16); + + udph->check = htons(check); + } + } + } + Index: PacketHistory.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/PacketHistory.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PacketHistory.h 3 May 2006 08:59:04 -0000 1.1 --- PacketHistory.h 10 Feb 2007 17:05:56 -0000 1.2 *************** *** 34,42 **** */ ! /* $Id$ */ #include /* ssize_t */ ! /* 2 bits per seen packet fingerping: * 11 = "seen recently", * 01 = "timing out" --- 34,49 ---- */ ! /* ------------------------------------------------------------------------- ! * File : PacketHistory.h ! * Description: Functions for keeping and accessing the history of processed ! * multicast IP packets. ! * Created : 29 Jun 2006 ! * ! * $Id$ ! * ------------------------------------------------------------------------- */ #include /* ssize_t */ ! /* 2 bits per seen packet: * 11 = "seen recently", * 01 = "timing out" *************** *** 50,55 **** void InitPacketHistory(void); ! void MarkRecentPacket(unsigned char* buffer, ssize_t len); ! int CheckMarkRecentPacket(unsigned char* buffer, ssize_t len); void PrunePacketHistory(void*); --- 57,64 ---- void InitPacketHistory(void); ! u_int32_t PacketCrc32(unsigned char* ethPkt, ssize_t len); ! u_int16_t Hash16(u_int32_t hash32); ! void MarkRecentPacket(u_int16_t hash16); ! int CheckAndMarkRecentPacket(u_int16_t hash16); void PrunePacketHistory(void*); From (spam-protected) Sat Feb 24 12:54:26 2007 From: (spam-protected) (Andreas Tønnesen) Date: Sat, 24 Feb 2007 11:54:26 +0000 Subject: [Olsr-cvs] olsrd-current/src main.c,1.91,1.92 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1333/src Modified Files: main.c Log Message: Fix for compiler warning Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** main.c 4 Feb 2007 23:27:55 -0000 1.91 --- main.c 24 Feb 2007 11:54:24 -0000 1.92 *************** *** 106,109 **** --- 106,112 ---- struct tms tms_buf; + /* Stop the compiler from complaining */ + (void)copyright_string; + debug_handle = stdout; olsr_argv = argv; *************** *** 405,411 **** scheduler(); - /* Stop the compiler from complaining */ - strlen(copyright_string); - /* Like we're ever going to reach this ;-) */ return 1; --- 408,411 ----
Destination IPLast hop IPLQILQETX
%s%s%0.2f%0.2f%0.2f
%s%s%0.2f%0.2f%0.2f
%s%s
%s%s
%s\n"); ! ! size += sprintf(&buf[size], "
%s (%d)