From (spam-protected) Fri Nov 2 10:38:58 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 09:38:58 +0000 Subject: [Olsr-cvs] olsrd-current/src tc_set.h, 1.18, 1.19 tc_set.c, 1.32, 1.33 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11253/src Modified Files: tc_set.h tc_set.c Log Message: * bug fix by Hannes Gredler fixing not deleted tc entry Index: tc_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tc_set.h 16 Oct 2007 09:54:44 -0000 1.18 --- tc_set.h 2 Nov 2007 09:38:55 -0000 1.19 *************** *** 135,138 **** --- 135,139 ---- union olsr_ip_addr *, olsr_u16_t, unsigned int, float, float); + void olsr_delete_tc_entry(struct tc_entry *); void olsr_delete_tc_edge_entry(struct tc_edge_entry *); void olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *); Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tc_set.c 17 Oct 2007 07:30:34 -0000 1.32 --- tc_set.c 2 Nov 2007 09:38:55 -0000 1.33 *************** *** 91,99 **** /* ! * Flush all edges. This causes our own tc_entry to vanish. */ OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc_myself, tc_edge) { olsr_delete_tc_edge_entry(tc_edge); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc_myself, tc_edge); } --- 91,100 ---- /* ! * Flush all edges and our own tc_entry. */ OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc_myself, tc_edge) { olsr_delete_tc_edge_entry(tc_edge); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc_myself, tc_edge); + olsr_delete_tc_entry(tc_myself); } *************** *** 111,115 **** * */ ! static void olsr_delete_tc_entry(struct tc_entry *tc) { --- 112,116 ---- * */ ! void olsr_delete_tc_entry(struct tc_entry *tc) { From (spam-protected) Fri Nov 2 10:38:58 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 09:38:58 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.101,1.102 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11253 Modified Files: CHANGELOG Log Message: * bug fix by Hannes Gredler fixing not deleted tc entry Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** CHANGELOG 20 Oct 2007 11:55:23 -0000 1.101 --- CHANGELOG 2 Nov 2007 09:38:56 -0000 1.102 *************** *** 4,7 **** --- 4,9 ---- 0.5.5 --------------------------------------------------------------------- + BUGFIX by Hannes Gredler fixing not deleted tc entry. + 0.5.4 --------------------------------------------------------------------- From (spam-protected) Fri Nov 2 11:11:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 10:11:45 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG, 1.102, 1.103 Makefile, 1.101, 1.102 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24194 Modified Files: CHANGELOG Makefile Log Message: * as suggested by Jens Nachtigall : install the LQ version as default Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** Makefile 20 Oct 2007 11:55:23 -0000 1.101 --- Makefile 2 Nov 2007 10:11:43 -0000 1.102 *************** *** 1,4 **** # The olsr.org Optimized Link-State Routing daemon(olsrd) ! # Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) # All rights reserved. # --- 1,4 ---- # The olsr.org Optimized Link-State Routing daemon(olsrd) ! # Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) # All rights reserved. # *************** *** 109,117 **** @echo $(EXENAME) uses the configfile $(CFGFILE) @echo a default configfile. A sample RFC-compliance aimed ! @echo configfile can be installed. Note that a LQ-based configfile @echo can be found at files/olsrd.conf.default.lq @echo ========================================================== mkdir -p $(ETCDIR) ! -cp -i files/olsrd.conf.default.rfc $(CFGFILE) @echo ------------------------------------------- @echo Edit $(CFGFILE) before running olsrd!! --- 109,120 ---- @echo $(EXENAME) uses the configfile $(CFGFILE) @echo a default configfile. A sample RFC-compliance aimed ! @echo configfile can be found in olsrd.conf.default.rfc. ! @echo However none of the larger OLSRD using networks use that ! @echo so install a configfile with activated link quality exstensions ! @echo per default. @echo can be found at files/olsrd.conf.default.lq @echo ========================================================== mkdir -p $(ETCDIR) ! -cp -i files/olsrd.conf.default.lq $(CFGFILE) @echo ------------------------------------------- @echo Edit $(CFGFILE) before running olsrd!! Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** CHANGELOG 2 Nov 2007 09:38:56 -0000 1.102 --- CHANGELOG 2 Nov 2007 10:11:43 -0000 1.103 *************** *** 6,9 **** --- 6,16 ---- BUGFIX by Hannes Gredler fixing not deleted tc entry. + PATCHES and CLEANUPS by Bernd Petrovitsch + - Jens Nachtigall suggested (and reminded) to use + olsrd.conf.default.lq as the default installed one. + It makes much more sense as - to the best of my(bernd's) knowledge - all + larger networks uses the LQ extensions. And new customers should better + be pushed in that direction. + 0.5.4 --------------------------------------------------------------------- *************** *** 105,109 **** flaw in the routing system. Plase take a look at chk_if_changed(). This will free() any "struct interface" pointer without warning at any time. ! This is why it's possile to SEGV olsrd with a simple "ifdown xxx". The patch replaces the (maybe) invalid pointer with an index reference "iif_index". You can always ask the OS for a name. Please note, that I do --- 112,116 ---- flaw in the routing system. Plase take a look at chk_if_changed(). This will free() any "struct interface" pointer without warning at any time. ! This is why it's possile to SEGV olsrd with a simple "ifdown xxx". The patch replaces the (maybe) invalid pointer with an index reference "iif_index". You can always ask the OS for a name. Please note, that I do *************** *** 136,140 **** re-included the IPC hookup. The patch adds a "RtTable [number]" for /etc/olsrd.conf which is simply the Linux ! policy routing table to use. Defaults to 254 (== main). This patch was modified/clenaed up by to use "#if" instead of "#ifdef" as it's more robust against typos. --- 143,147 ---- re-included the IPC hookup. The patch adds a "RtTable [number]" for /etc/olsrd.conf which is simply the Linux ! policy routing table to use. Defaults to 254 (== main). This patch was modified/clenaed up by to use "#if" instead of "#ifdef" as it's more robust against typos. *************** *** 172,176 **** scan.coverty.com). ! BUG erported by Aaron Kaplan - BSD-xargs doesn't know "-r". --- 179,183 ---- scan.coverty.com). ! BUG reported by Aaron Kaplan - BSD-xargs doesn't know "-r". *************** *** 305,314 **** OLSR NETWORK SIMULATOR ! An application called olsr_switch(sorry for the nameclash with the win32 GUI) has been added. If olsrd is ran using the -hint option it can now connect to olsr_switch and be part of a virtual network. This means that multiple instances can be ran at the same host! The olsr_switch application allows the user to define link variables on all viritual ! links in the network, creating all possible topologies. Read more in the readme file. --- 312,321 ---- OLSR NETWORK SIMULATOR ! An application called olsr_switch(sorry for the nameclash with the win32 GUI) has been added. If olsrd is ran using the -hint option it can now connect to olsr_switch and be part of a virtual network. This means that multiple instances can be ran at the same host! The olsr_switch application allows the user to define link variables on all viritual ! links in the network, creating all possible topologies. Read more in the readme file. *************** *** 321,325 **** olsrd now also compiles on OpenBSD systems. Thanks a lot to Holger ! Mauermann for the patches! BUILDSYSTEM REWRITE --- 328,332 ---- olsrd now also compiles on OpenBSD systems. Thanks a lot to Holger ! Mauermann for the patches! BUILDSYSTEM REWRITE *************** *** 337,341 **** PLUGIN INTERFACE ! Updated interface version to 3 and added more noticeable warning for version missmatch. --- 344,348 ---- PLUGIN INTERFACE ! Updated interface version to 3 and added more noticeable warning for version missmatch. *************** *** 343,348 **** The dependency on the math lib came from the use of pow(3) in the ! mantissa/exponent calculation. The calls to pow in this long forgotten ! code, was very unnessecarry. The pow calls are replaced with bitwise shifts and -lm is no longer needed. --- 350,355 ---- The dependency on the math lib came from the use of pow(3) in the ! mantissa/exponent calculation. The calls to pow in this long forgotten ! code, was very unnessecarry. The pow calls are replaced with bitwise shifts and -lm is no longer needed. *************** *** 385,389 **** internals any more. Instead the macro OLSR_PRINTF is to be used. This macro does debug level testing _before_ doing any function ! calls(both printf itself and parameters to printf). This is a much more optimized way of doing debug output. In addition olsrd can be built without any debug output code if doing 'make NODEBUG=1'. --- 392,396 ---- internals any more. Instead the macro OLSR_PRINTF is to be used. This macro does debug level testing _before_ doing any function ! calls(both printf itself and parameters to printf). This is a much more optimized way of doing debug output. In addition olsrd can be built without any debug output code if doing 'make NODEBUG=1'. *************** *** 474,478 **** The httpinfo, dyn_gw and dot_draw plugins now all include olsrd headerfiles directly. A plugin should define OLSR_PLUGIN before ! including olsrd headers. Doing things this way removed the redundant datatype definitions that has so often caused trouble when things has been updated in olsrd. --- 481,485 ---- The httpinfo, dyn_gw and dot_draw plugins now all include olsrd headerfiles directly. A plugin should define OLSR_PLUGIN before ! including olsrd headers. Doing things this way removed the redundant datatype definitions that has so often caused trouble when things has been updated in olsrd. *************** *** 529,533 **** be better off using this license as it opens up for commercial players to use olsrd freely in their products. In the end this will lead to ! this kind of users doing serious testing and bug fixing of olsrd. ETX-LIKE LINK QUALITY DETECTION --- 536,540 ---- be better off using this license as it opens up for commercial players to use olsrd freely in their products. In the end this will lead to ! this kind of users doing serious testing and bug fixing of olsrd. ETX-LIKE LINK QUALITY DETECTION *************** *** 573,577 **** A whole new config file syntax and parser is introduced with this ! release. The parser is generated using flex and bison and it is designed to be very modular. The parser can be compiled as either a standalone binary, a shared library or as part of olsrd. This way --- 580,584 ---- A whole new config file syntax and parser is introduced with this ! release. The parser is generated using flex and bison and it is designed to be very modular. The parser can be compiled as either a standalone binary, a shared library or as part of olsrd. This way *************** *** 604,610 **** DEBUG OUTPUT ! Tables are now only printed if changes occur, so there are no longer ! any periodical output when using a debuglevel >0. A "heartbeat" is ! now printed to STDOUT(if it is a terminal) in the form of a rotating line to show that olsrd is actually operating. Adding "ClearScreen yes" to the configuration file clears the screen --- 611,617 ---- DEBUG OUTPUT ! Tables are now only printed if changes occur, so there are no longer ! any periodical output when using a debuglevel >0. A "heartbeat" is ! now printed to STDOUT(if it is a terminal) in the form of a rotating line to show that olsrd is actually operating. Adding "ClearScreen yes" to the configuration file clears the screen *************** *** 617,621 **** There are some changes in the plugin interface. It is now at ! version 2. Plugin specific parameters from the configfile using the PlParam option, will now be passed on to plugins. To receive such parameters a plugin must implement a function: --- 624,628 ---- There are some changes in the plugin interface. It is now at ! version 2. Plugin specific parameters from the configfile using the PlParam option, will now be passed on to plugins. To receive such parameters a plugin must implement a function: *************** *** 638,642 **** IPC OPTIONS ! Various options regarding IPC connections can now be set in the configfile. The options are max connections, allowed unicast hosts and allowed net-ranges. --- 645,649 ---- IPC OPTIONS ! Various options regarding IPC connections can now be set in the configfile. The options are max connections, allowed unicast hosts and allowed net-ranges. *************** *** 645,649 **** Much of the message generation and net output code is rewritten. ! Sending of partial messages should now work 100%. Also TC, MID and HNA messages are now cached for a random amount of time before transmitted - this often leads to the situation where these --- 652,656 ---- Much of the message generation and net output code is rewritten. ! Sending of partial messages should now work 100%. Also TC, MID and HNA messages are now cached for a random amount of time before transmitted - this often leads to the situation where these *************** *** 674,678 **** entries not to be deleted from the routing table in certain cases has also been fixed. These bugs could cause unstable routes. ! A bug that in many cases caused the wrong routes to be deleted when using IPv6 has been fixed. --- 681,685 ---- entries not to be deleted from the routing table in certain cases has also been fixed. These bugs could cause unstable routes. ! A bug that in many cases caused the wrong routes to be deleted when using IPv6 has been fixed. *************** *** 726,730 **** Network interfaces can now be updated and removed/added at ! runtime. Olsrd will check all interfaces specified in the config file or on the command-line, every 5 seconds. If updates occur, olsrd will register this and update the necessary data. --- 733,737 ---- Network interfaces can now be updated and removed/added at ! runtime. Olsrd will check all interfaces specified in the config file or on the command-line, every 5 seconds. If updates occur, olsrd will register this and update the necessary data. *************** *** 740,744 **** All 1 hop neighbor addresses that are not directly reachable trough ! a symmetric link in the link set will now be added with a GW in the routing table. this GW will be an interface address from a registered symmetric link to the neighbor. --- 747,751 ---- All 1 hop neighbor addresses that are not directly reachable trough ! a symmetric link in the link set will now be added with a GW in the routing table. this GW will be an interface address from a registered symmetric link to the neighbor. *************** *** 749,756 **** if available. This is not to pretty(since the vtime has to be a mere guess) but it gives faster initial route updates. ! If a HELLO is received(at initial registration) from an IP ! that is not the same as the one set as main address in the ! received HELLO header, then the IP from which the HELLO was ! received will be registered as an alias of the main address set in the HELLO header. The default vtime is set to 15 secs. --- 756,763 ---- if available. This is not to pretty(since the vtime has to be a mere guess) but it gives faster initial route updates. ! If a HELLO is received(at initial registration) from an IP ! that is not the same as the one set as main address in the ! received HELLO header, then the IP from which the HELLO was ! received will be registered as an alias of the main address set in the HELLO header. The default vtime is set to 15 secs. *************** *** 777,782 **** PLUGIN INTERFCAE ! A new set of functions that are called whenever a change in the ! interface configuration(update, addition, removal) is made is introduced. These functions are added and removed very much like the ptf --- 784,789 ---- PLUGIN INTERFCAE ! A new set of functions that are called whenever a change in the ! interface configuration(update, addition, removal) is made is introduced. These functions are added and removed very much like the ptf *************** *** 870,874 **** IPv6 ADDRESS SCOPE ! Option to set what IPv6 address type(scope) to use in the configfile added. It can be set to either global or site-local. --- 877,881 ---- IPv6 ADDRESS SCOPE ! Option to set what IPv6 address type(scope) to use in the configfile added. It can be set to either global or site-local. *************** *** 917,923 **** Olsrd now supports runtime-loadable plugins! A couple of example plugins ! are located in the lib/ directory. Read the README files in the various plugin directories for more info. A directive to load plugins have been ! added to the configfile as well. Documentation of the plugin interface can be fount at http://www.olsr.org. --- 924,930 ---- Olsrd now supports runtime-loadable plugins! A couple of example plugins ! are located in the lib/ directory. Read the README files in the various plugin directories for more info. A directive to load plugins have been ! added to the configfile as well. Documentation of the plugin interface can be fount at http://www.olsr.org. *************** *** 1057,1062 **** Some code restructuring which resulted in the new files: timer.h, ! mantissa.c, mantissa.h, hashing.c, hashing.h, linux/net.c ! linux/net.h, linux/kernel_routes.c, linux/kernel_routes.h and some renamed files --- 1064,1069 ---- Some code restructuring which resulted in the new files: timer.h, ! mantissa.c, mantissa.h, hashing.c, hashing.h, linux/net.c ! linux/net.h, linux/kernel_routes.c, linux/kernel_routes.h and some renamed files *************** *** 1157,1161 **** Forwarding jitter ! Forwarding jitter added. Messages are piggybacked if they arrive(and are to be forwarded) while there is data to be forwarded buffered. Added some bugfixes to support parsing of piggybacked messages as well. --- 1164,1168 ---- Forwarding jitter ! Forwarding jitter added. Messages are piggybacked if they arrive(and are to be forwarded) while there is data to be forwarded buffered. Added some bugfixes to support parsing of piggybacked messages as well. *************** *** 1164,1173 **** Fixed route calculation so that 2 hop neighbors are added. This smooths ! changes from 1 hop to 2 hop neighbor out. The old way one had to wait for a TC before the 2 hop neighbors were added. 2 hop neighbor set ! All neighbors received in HELLO messages are added to the two hop neighborhood. This helps smoothing out the 1-to-2 hop transition as well. --- 1171,1180 ---- Fixed route calculation so that 2 hop neighbors are added. This smooths ! changes from 1 hop to 2 hop neighbor out. The old way one had to wait for a TC before the 2 hop neighbors were added. 2 hop neighbor set ! All neighbors received in HELLO messages are added to the two hop neighborhood. This helps smoothing out the 1-to-2 hop transition as well. *************** *** 1265,1269 **** Fixed a nasty bug concerning the sequence numbering of TC packets. ! Fixed some bugs regarding MPR calculation - and probably introduced a whole new species when implementing the willingness-based calculation ;-) --- 1272,1276 ---- Fixed a nasty bug concerning the sequence numbering of TC packets. ! Fixed some bugs regarding MPR calculation - and probably introduced a whole new species when implementing the willingness-based calculation ;-) *************** *** 1284,1288 **** Link sensing and neighbor processing was done in the same operation in the old code. Link sensing is now a mechanism of its own which is 100% RFC ! compliant. Neighbor processing and HELLO generation has been partly rewritten to be RFC compliant. Neighbors are now registered as either SYN or NOT_SYM. The NOT_NEIGH, SYM_NEIGH and MPR_NEIGH values are only --- 1291,1295 ---- Link sensing and neighbor processing was done in the same operation in the old code. Link sensing is now a mechanism of its own which is 100% RFC ! compliant. Neighbor processing and HELLO generation has been partly rewritten to be RFC compliant. Neighbors are now registered as either SYN or NOT_SYM. The NOT_NEIGH, SYM_NEIGH and MPR_NEIGH values are only *************** *** 1321,1325 **** HNA ! Some serious HNA bugs fixed. These bugs caused a node to always choos the gateway with the larges hopcout :) More seriously - a bug caused looping of HNA messages in certain scenarios. --- 1328,1332 ---- HNA ! Some serious HNA bugs fixed. These bugs caused a node to always choos the gateway with the larges hopcout :) More seriously - a bug caused looping of HNA messages in certain scenarios. *************** *** 1327,1331 **** Package sequence numbers ! These were added. Not much use as of now - but they're there(as specified in the RFC). --- 1334,1338 ---- Package sequence numbers ! These were added. Not much use as of now - but they're there(as specified in the RFC). *************** *** 1341,1345 **** Htime and Vtime ! Htime and Vtime processing and handling added. Holding times used to be a static value for all nodes. Now every node can signal its vlidity time to others. --- 1348,1352 ---- Htime and Vtime ! Htime and Vtime processing and handling added. Holding times used to be a static value for all nodes. Now every node can signal its vlidity time to others. *************** *** 1359,1363 **** Seqno bugs ! Some bugs concerning sequence numbers in HELLO and MID message handling was fixed. Newly registered nodes in the neighbor and MID sets were initialized with a seqno of 0. When using a "wraparound" sequencenumber --- 1366,1370 ---- Seqno bugs ! Some bugs concerning sequence numbers in HELLO and MID message handling was fixed. Newly registered nodes in the neighbor and MID sets were initialized with a seqno of 0. When using a "wraparound" sequencenumber From (spam-protected) Fri Nov 2 11:16:41 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 10:16:41 +0000 Subject: [Olsr-cvs] olsrd-current/src olsr_types.h,1.10,1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26136/src Modified Files: olsr_types.h Log Message: With the help of Patrick McCarty , we got olsr to build on OpenBSD again: * OpenBSD'd `sed` is pretty conservative and doesn't understand 's|re|sub|'. So we fall back to the old 's/re/sub/' and quote all '/' and '.' correctly (which was the main reason to use '|'). * OpenBSD needs an explicit "#include " before "#include ". Index: olsr_types.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_types.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** olsr_types.h 24 Oct 2007 13:51:11 -0000 1.10 --- olsr_types.h 2 Nov 2007 10:16:39 -0000 1.11 *************** *** 70,73 **** --- 70,75 ---- #endif + /* OpenBSD wants this here */ + #include /* IPv6 address format in6_addr */ #include *************** *** 94,97 **** }; - #endif --- 96,98 ---- From (spam-protected) Fri Nov 2 11:16:41 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 10:16:41 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG, 1.103, 1.104 Makefile.inc, 1.37, 1.38 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26136 Modified Files: CHANGELOG Makefile.inc Log Message: With the help of Patrick McCarty , we got olsr to build on OpenBSD again: * OpenBSD'd `sed` is pretty conservative and doesn't understand 's|re|sub|'. So we fall back to the old 's/re/sub/' and quote all '/' and '.' correctly (which was the main reason to use '|'). * OpenBSD needs an explicit "#include " before "#include ". Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Makefile.inc 20 Oct 2007 20:23:12 -0000 1.37 --- Makefile.inc 2 Nov 2007 10:16:39 -0000 1.38 *************** *** 157,163 **** endif # fully automatic and working dependency generation %.d: %.c ! @$(CC) -M $(CPPFLAGS) "$<" | sed -e '1s|\($(*F)\)\.o[ :]*|$(*D)/\1.o $@: Makefile $(TOPDIR)$(if $(TOPDIR),/)Makefile.inc |g' >"$@" # we always need the includes and defines --- 157,165 ---- endif + quote = $(subst .,\.,$(subst /,\/,$1)) + # fully automatic and working dependency generation %.d: %.c ! $(filter-out $(CCACHE),$(CC)) -M $(strip $(CPPFLAGS)) "$<" | sed -e '1s/\($(call quote,$(*F))\.o\)[ :]*/$(call quote,$(*D)/\1 $@: Makefile $(TOPDIR)$(if $(TOPDIR),/)Makefile.inc) /g' >"$@" # we always need the includes and defines Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** CHANGELOG 2 Nov 2007 10:11:43 -0000 1.103 --- CHANGELOG 2 Nov 2007 10:16:39 -0000 1.104 *************** *** 12,15 **** --- 12,22 ---- larger networks uses the LQ extensions. And new customers should better be pushed in that direction. + - with the help of Patrick McCarty , we got olsr to build + on OpenBSD again: + * OpenBSD'd `sed` is pretty conservative and doesn't understand 's|re|sub|'. + So we fall back to the old 's/re/sub/' and quote all '/' and '.' correctly + (which was the main reason to use '|'). + * OpenBSD needs an explicit "#include " before + "#include ". 0.5.4 --------------------------------------------------------------------- From (spam-protected) Fri Nov 2 11:57:32 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 10:57:32 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.104,1.105 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10077 Modified Files: CHANGELOG Log Message: * completed changelog message Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** CHANGELOG 2 Nov 2007 10:16:39 -0000 1.104 --- CHANGELOG 2 Nov 2007 10:57:30 -0000 1.105 *************** *** 17,20 **** --- 17,22 ---- So we fall back to the old 's/re/sub/' and quote all '/' and '.' correctly (which was the main reason to use '|'). + And while I'm at it: Remove the useless $(CCACHE) from the $(CC) for + dependency generation and beautify (read: "$(strip)") $(CPPFLAGS). * OpenBSD needs an explicit "#include " before "#include ". From (spam-protected) Fri Nov 2 16:37:11 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 15:37:11 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.38,1.39 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23535 Modified Files: Makefile.inc Log Message: * ooops, hide the dependency generation calls again Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Makefile.inc 2 Nov 2007 10:16:39 -0000 1.38 --- Makefile.inc 2 Nov 2007 15:37:09 -0000 1.39 *************** *** 161,165 **** # fully automatic and working dependency generation %.d: %.c ! $(filter-out $(CCACHE),$(CC)) -M $(strip $(CPPFLAGS)) "$<" | sed -e '1s/\($(call quote,$(*F))\.o\)[ :]*/$(call quote,$(*D)/\1 $@: Makefile $(TOPDIR)$(if $(TOPDIR),/)Makefile.inc) /g' >"$@" # we always need the includes and defines --- 161,165 ---- # fully automatic and working dependency generation %.d: %.c ! @$(filter-out $(CCACHE),$(CC)) -M $(strip $(CPPFLAGS)) "$<" | sed -e '1s/\($(call quote,$(*F))\.o\)[ :]*/$(call quote,$(*D)/\1 $@: Makefile $(TOPDIR)$(if $(TOPDIR),/)Makefile.inc) /g' >"$@" # we always need the includes and defines From (spam-protected) Fri Nov 2 16:51:48 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 15:51:48 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.105,1.106 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28055 Modified Files: CHANGELOG Log Message: While working on something else, I stumbled over this. Obviously no one ever used the "secure" plugin on 64bit hardware: - fixed lib/secure/src/md5.h: This was broken as it had "typedef unsigned long int UINT4;". "unsigned long int" is 8 bytes on x86_64. We are using now the standardized types from . - fixed warnings and improved lib/secure/src/md5.c: * we are using memcpy() and memset() instead of the open-coded loops as suggested * const'ified * added function prototypes for static functions * moved static functions to the top so that their declaration is before their use to allow gcc to inline if only used once. It remains ugly - God knows why there are that so many useless type-casts. Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** CHANGELOG 2 Nov 2007 10:57:30 -0000 1.105 --- CHANGELOG 2 Nov 2007 15:51:46 -0000 1.106 *************** *** 21,24 **** --- 21,36 ---- * OpenBSD needs an explicit "#include " before "#include ". + - fixed lib/secure/src/md5.h: This was broken as it had + "typedef unsigned long int UINT4;". "unsigned long int" is 8 bytes on x86_64. + We are using now the standardized types from . + - fixed warnings and improved lib/secure/src/md5.c: + * we are using memcpy() and memset() instead of the open-coded loops as + suggested + * const'ified + * added function prototypes for static functions + * moved static functions to the top so that their declaration is before + their use to allow gcc to inline if only used once. + It remains ugly - God knows why there are that so many useless + type-casts. 0.5.4 --------------------------------------------------------------------- From (spam-protected) Fri Nov 2 16:51:48 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 15:51:48 +0000 Subject: [Olsr-cvs] olsrd-current/lib/secure/src md5.h, 1.2, 1.3 md5.c, 1.3, 1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/secure/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28055/lib/secure/src Modified Files: md5.h md5.c Log Message: While working on something else, I stumbled over this. Obviously no one ever used the "secure" plugin on 64bit hardware: - fixed lib/secure/src/md5.h: This was broken as it had "typedef unsigned long int UINT4;". "unsigned long int" is 8 bytes on x86_64. We are using now the standardized types from . - fixed warnings and improved lib/secure/src/md5.c: * we are using memcpy() and memset() instead of the open-coded loops as suggested * const'ified * added function prototypes for static functions * moved static functions to the top so that their declaration is before their use to allow gcc to inline if only used once. It remains ugly - God knows why there are that so many useless type-casts. Index: md5.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/md5.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** md5.c 30 Jan 2007 17:11:52 -0000 1.3 --- md5.c 2 Nov 2007 15:51:46 -0000 1.4 *************** *** 26,29 **** --- 26,31 ---- #include "md5.h" + #include + /* Constants for MD5Transform routine. */ *************** *** 45,55 **** #define S44 21 ! static void MD5Transform(UINT4 [4], const unsigned char [64]); ! static void Encode(unsigned char *, UINT4 *, unsigned int); ! static void Decode(UINT4 *, const unsigned char *, const unsigned int); ! static void MD5_memcpy(POINTER, POINTER, unsigned int); ! static void MD5_memset(POINTER, int, unsigned int); ! ! static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, --- 47,51 ---- #define S44 21 ! static const unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, *************** *** 92,175 **** } ! /* MD5 initialization. Begins an MD5 operation, writing a new context. */ ! void MD5Init (MD5_CTX *context) { ! context->count[0] = context->count[1] = 0; ! ! /* Load magic initialization constants. ! */ ! context->state[0] = 0x67452301; ! context->state[1] = 0xefcdab89; ! context->state[2] = 0x98badcfe; ! context->state[3] = 0x10325476; } ! /* MD5 block update operation. Continues an MD5 message-digest ! operation, processing another message block, and updating the ! context. */ ! void MD5Update (MD5_CTX *context, const unsigned char *input, const unsigned int inputLen) { ! unsigned int i, index, partLen; ! ! /* Compute number of bytes mod 64 */ ! index = (unsigned int)((context->count[0] >> 3) & 0x3F); ! ! /* Update number of bits */ ! if ((context->count[0] += ((UINT4)inputLen << 3)) ! < ((UINT4)inputLen << 3)) ! context->count[1]++; ! context->count[1] += ((UINT4)inputLen >> 29); ! ! partLen = 64 - index; ! ! /* Transform as many times as possible. ! */ ! if (inputLen >= partLen) { ! MD5_memcpy ! ((POINTER)&context->buffer[index], (POINTER)input, partLen); ! MD5Transform (context->state, context->buffer); ! ! for (i = partLen; i + 63 < inputLen; i += 64) ! MD5Transform (context->state, &input[i]); ! ! index = 0; ! } ! else ! i = 0; ! /* Buffer remaining input */ ! MD5_memcpy ! ((POINTER)&context->buffer[index], (POINTER)&input[i], ! inputLen-i); } ! /* MD5 finalization. Ends an MD5 message-digest operation, writing the ! the message digest and zeroizing the context. */ ! void MD5Final (unsigned char digest[16], MD5_CTX *context) { ! unsigned char bits[8]; ! unsigned int index, padLen; ! /* Save number of bits */ ! Encode (bits, context->count, 8); ! /* Pad out to 56 mod 64. ! */ ! index = (unsigned int)((context->count[0] >> 3) & 0x3f); ! padLen = (index < 56) ? (56 - index) : (120 - index); ! MD5Update (context, PADDING, padLen); ! ! /* Append length (before padding) */ ! MD5Update (context, bits, 8); ! /* Store state in digest */ ! Encode (digest, context->state, 16); ! ! /* Zeroize sensitive information. ! */ ! MD5_memset ((POINTER)context, 0, sizeof (*context)); } --- 88,142 ---- } ! #if 0 ! /* Note: Replace "for loop" with standard memcpy if possible. */ ! static void MD5_memcpy (POINTER output, POINTER input, unsigned int len) { ! unsigned int i; ! ! for (i = 0; i < len; i++) ! output[i] = input[i]; } ! /* Note: Replace "for loop" with standard memset if possible. */ ! static void MD5_memset (POINTER output, int value, unsigned int len) { ! unsigned int i; ! for (i = 0; i < len; i++) ! ((char *)output)[i] = (char)value; } + #else + #define MD5_memcpy(dst, src, len) memcpy((dst), (src), (len)) + #define MD5_memset(dst, val, len) memset((dst), (val), (len)) + #endif ! ! /* Encodes input (UINT4) into output (unsigned char). Assumes len is ! a multiple of 4. */ ! static void Encode (unsigned char *output, UINT4 *input, unsigned int len) { ! unsigned int i, j; ! for (i = 0, j = 0; j < len; i++, j += 4) { ! output[j] = (unsigned char)(input[i] & 0xff); ! output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); ! output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); ! output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); ! } ! } ! /* Decodes input (unsigned char) into output (UINT4). Assumes len is ! a multiple of 4. ! */ ! static void Decode (UINT4 *output, const unsigned char *input, unsigned int len) ! { ! unsigned int i, j; ! for (i = 0, j = 0; j < len; i++, j += 4) ! output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | ! (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } *************** *** 264,311 **** } ! /* Encodes input (UINT4) into output (unsigned char). Assumes len is ! a multiple of 4. */ ! static void Encode (unsigned char *output, UINT4 *input, unsigned int len) { ! unsigned int i, j; ! for (i = 0, j = 0; j < len; i++, j += 4) { ! output[j] = (unsigned char)(input[i] & 0xff); ! output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); ! output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); ! output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); ! } } ! /* Decodes input (unsigned char) into output (UINT4). Assumes len is ! a multiple of 4. */ ! static void Decode (UINT4 *output, const unsigned char *input, const unsigned int len) { ! unsigned int i, j; ! for (i = 0, j = 0; j < len; i++, j += 4) ! output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | ! (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); ! } ! /* Note: Replace "for loop" with standard memcpy if possible. ! */ ! static void MD5_memcpy (POINTER output, POINTER input, unsigned int len) ! { ! unsigned int i; ! for (i = 0; i < len; i++) ! output[i] = input[i]; } ! /* Note: Replace "for loop" with standard memset if possible. */ ! static void MD5_memset (POINTER output, int value, unsigned int len) { ! unsigned int i; ! for (i = 0; i < len; i++) ! ((char *)output)[i] = (char)value; } --- 231,314 ---- } ! ! /* MD5 initialization. Begins an MD5 operation, writing a new context. */ ! void MD5Init (MD5_CTX *context) { ! context->count[0] = context->count[1] = 0; ! /* Load magic initialization constants. ! */ ! context->state[0] = 0x67452301; ! context->state[1] = 0xefcdab89; ! context->state[2] = 0x98badcfe; ! context->state[3] = 0x10325476; } ! /* MD5 block update operation. Continues an MD5 message-digest ! operation, processing another message block, and updating the ! context. */ ! void MD5Update (MD5_CTX *context, const unsigned char *input, const unsigned int inputLen) { ! unsigned int i, index, partLen; ! /* Compute number of bytes mod 64 */ ! index = (unsigned int)((context->count[0] >> 3) & 0x3F); ! /* Update number of bits */ ! if ((context->count[0] += ((UINT4)inputLen << 3)) ! < ((UINT4)inputLen << 3)) ! context->count[1]++; ! context->count[1] += ((UINT4)inputLen >> 29); ! partLen = 64 - index; ! ! /* Transform as many times as possible. ! */ ! if (inputLen >= partLen) { ! MD5_memcpy ! ((POINTER)&context->buffer[index], (POINTER)input, partLen); ! MD5Transform (context->state, context->buffer); ! ! for (i = partLen; i + 63 < inputLen; i += 64) ! MD5Transform (context->state, &input[i]); ! ! index = 0; ! } ! else ! i = 0; ! ! /* Buffer remaining input */ ! MD5_memcpy ! ((POINTER)&context->buffer[index], (POINTER)&input[i], ! inputLen-i); } ! /* MD5 finalization. Ends an MD5 message-digest operation, writing the ! the message digest and zeroizing the context. */ ! void MD5Final (unsigned char digest[16], MD5_CTX *context) { ! unsigned char bits[8]; ! unsigned int index, padLen; ! ! /* Save number of bits */ ! Encode (bits, context->count, 8); ! ! /* Pad out to 56 mod 64. ! */ ! index = (unsigned int)((context->count[0] >> 3) & 0x3f); ! padLen = (index < 56) ? (56 - index) : (120 - index); ! MD5Update (context, PADDING, padLen); ! /* Append length (before padding) */ ! MD5Update (context, bits, 8); ! ! /* Store state in digest */ ! Encode (digest, context->state, 16); ! ! /* Zeroize sensitive information. ! */ ! MD5_memset ((POINTER)context, 0, sizeof (*context)); } Index: md5.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/md5.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** md5.h 30 Jan 2007 17:11:52 -0000 1.2 --- md5.h 2 Nov 2007 15:51:46 -0000 1.3 *************** *** 27,36 **** #define _MD5_H_ /* POINTER defines a generic pointer type */ ! typedef unsigned char *POINTER; /* UINT2 defines a two byte word */ ! typedef unsigned short int UINT2; /* UINT4 defines a four byte word */ ! typedef unsigned long int UINT4; /* MD5 context. */ --- 27,38 ---- #define _MD5_H_ + #include + /* POINTER defines a generic pointer type */ ! typedef uint8_t *POINTER; /* UINT2 defines a two byte word */ ! typedef uint16_t UINT2; /* UINT4 defines a four byte word */ ! typedef uint32_t UINT4; /* MD5 context. */ From (spam-protected) Fri Nov 2 21:58:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 20:58:09 +0000 Subject: [Olsr-cvs] olsrd-current/lib/pgraph/src olsrd_pgraph.c,1.8,1.9 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/pgraph/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21496/lib/pgraph/src Modified Files: olsrd_pgraph.c Log Message: Some minor and trivial cleanup: Added two functions to calculate the ETX value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. Index: olsrd_pgraph.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_pgraph.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** olsrd_pgraph.c 13 Sep 2007 15:31:59 -0000 1.8 --- olsrd_pgraph.c 2 Nov 2007 20:58:07 -0000 1.9 *************** *** 185,189 **** // link = olsr_neighbor_best_link(&neighbor->neighbor_main_addr); // if (link) { ! // etx = calc_etx( link->loss_link_quality, link->neigh_link_quality); // } // } --- 185,189 ---- // link = olsr_neighbor_best_link(&neighbor->neighbor_main_addr); // if (link) { ! // etx = olsr_calc_etx(link); // } // } *************** *** 406,410 **** const char* main_adr; const char* adr; ! // double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality ); main_adr = olsr_ip_to_string(&entry->addr); --- 406,410 ---- const char* main_adr; const char* adr; ! // double etx = olsr_calc_tc_etx(dst_entry); main_adr = olsr_ip_to_string(&entry->addr); From (spam-protected) Fri Nov 2 21:58:08 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 20:58:08 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.106,1.107 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21496 Modified Files: CHANGELOG Log Message: Some minor and trivial cleanup: Added two functions to calculate the ETX value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** CHANGELOG 2 Nov 2007 15:51:46 -0000 1.106 --- CHANGELOG 2 Nov 2007 20:58:06 -0000 1.107 *************** *** 33,36 **** --- 33,39 ---- It remains ugly - God knows why there are that so many useless type-casts. + - Some minor and trivial cleanup: Added two functions to calculate the ETX + value from a struct tc_edge_entry and a struct link_entry, respectively. + And use them everywhere. 0.5.4 --------------------------------------------------------------------- From (spam-protected) Fri Nov 2 21:58:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 20:58:09 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c, 1.12, 1.13 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21496/lib/txtinfo/src Modified Files: olsrd_txtinfo.c Log Message: Some minor and trivial cleanup: Added two functions to calculate the ETX value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** olsrd_txtinfo.c 14 Oct 2007 14:11:11 -0000 1.12 --- olsrd_txtinfo.c 2 Nov 2007 20:58:07 -0000 1.13 *************** *** 315,319 **** 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; } --- 315,319 ---- link->total_packets, link->neigh_link_quality, ! olsr_calc_link_etx(link)); link = link->next; } *************** *** 388,392 **** tc_edge->link_quality, tc_edge->inverse_link_quality, ! (tc_edge->link_quality * tc_edge->inverse_link_quality) ? 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality) : 0.0); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); --- 388,392 ---- tc_edge->link_quality, tc_edge->inverse_link_quality, ! olsr_calc_tc_etx(tc_edge)); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); From (spam-protected) Fri Nov 2 21:58:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 20:58:09 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src plugin.c,1.13,1.14 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21496/lib/tas/src Modified Files: plugin.c Log Message: Some minor and trivial cleanup: Added two functions to calculate the ETX value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. Index: plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/plugin.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** plugin.c 17 Sep 2007 22:24:22 -0000 1.13 --- plugin.c 2 Nov 2007 20:58:07 -0000 1.14 *************** *** 104,116 **** } - static double lqToEtx(double lq, double nlq) - { - if (lq < MIN_LINK_QUALITY || nlq < MIN_LINK_QUALITY) - return 0.0; - - else - return 1.0 / (lq * nlq); - } - int iterLinkTabNext(char *buff, int len) { --- 104,107 ---- *************** *** 120,125 **** return -1; ! etx = lqToEtx(iterLinkTab->loss_link_quality, ! iterLinkTab->neigh_link_quality); snprintf(buff, len, "local~%s~remote~%s~main~%s~hysteresis~%f~lq~%f~nlq~%f~etx~%f~", --- 111,115 ---- return -1; ! etx = olsr_calc_link_etx(iterLinkTab); snprintf(buff, len, "local~%s~remote~%s~main~%s~hysteresis~%f~lq~%f~nlq~%f~etx~%f~", *************** *** 276,280 **** res = snprintf(buff, len, "[~%d~address~%s~etx~%f~]~", i, rawIpAddrToString(&tc_edge->T_dest_addr, ipAddrLen), ! lqToEtx(tc_edge->link_quality, tc_edge->inverse_link_quality)); if (res < len) --- 266,270 ---- res = snprintf(buff, len, "[~%d~address~%s~etx~%f~]~", i, rawIpAddrToString(&tc_edge->T_dest_addr, ipAddrLen), ! olsr_calc_tc_etx(tc_edge)); if (res < len) From (spam-protected) Fri Nov 2 21:58:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 20:58:09 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.32, 1.33 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21496/lib/nameservice/src Modified Files: nameservice.c Log Message: Some minor and trivial cleanup: Added two functions to calculate the ETX value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** nameservice.c 5 Oct 2007 20:24:47 -0000 1.32 --- nameservice.c 2 Nov 2007 20:58:07 -0000 1.33 *************** *** 1540,1546 **** tc_edge->link_quality, tc_edge->inverse_link_quality, ! (tc_edge->link_quality * tc_edge->inverse_link_quality) ? ! 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality) : ! 0.0); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); --- 1540,1544 ---- tc_edge->link_quality, tc_edge->inverse_link_quality, ! olsr_calc_tc_etx(tc_edge)); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); From (spam-protected) Fri Nov 2 21:58:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 20:58:09 +0000 Subject: [Olsr-cvs] olsrd-current/src tc_set.h, 1.19, 1.20 tc_set.c, 1.33, 1.34 link_set.h, 1.32, 1.33 link_set.c, 1.75, 1.76 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21496/src Modified Files: tc_set.h tc_set.c link_set.h link_set.c Log Message: Some minor and trivial cleanup: Added two functions to calculate the ETX value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. Index: tc_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tc_set.h 2 Nov 2007 09:38:55 -0000 1.19 --- tc_set.h 2 Nov 2007 20:58:06 -0000 1.20 *************** *** 138,141 **** --- 138,142 ---- void olsr_delete_tc_edge_entry(struct tc_edge_entry *); void olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *); + float olsr_calc_tc_etx(const struct tc_edge_entry *); #endif Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tc_set.c 2 Nov 2007 09:38:55 -0000 1.33 --- tc_set.c 2 Nov 2007 20:58:06 -0000 1.34 *************** *** 253,262 **** olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *tc_edge) { ! if (tc_edge->link_quality >= MIN_LINK_QUALITY && ! tc_edge->inverse_link_quality >= MIN_LINK_QUALITY) { ! ! tc_edge->etx = 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality); ! } else { tc_edge->etx = INFINITE_ETX; } } --- 253,261 ---- olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *tc_edge) { ! if (tc_edge->link_quality < MIN_LINK_QUALITY && ! tc_edge->inverse_link_quality < MIN_LINK_QUALITY) { tc_edge->etx = INFINITE_ETX; + } else { + tc_edge->etx = 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality); } } *************** *** 617,621 **** struct tc_edge_entry *tc_edge; char *fstr; - float etx; OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------- TOPOLOGY\n\n", --- 616,619 ---- *************** *** 638,652 **** OLSR_FOR_ALL_TC_ENTRIES(tc) { OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { - - if (tc_edge->link_quality < MIN_LINK_QUALITY || - tc_edge->inverse_link_quality < MIN_LINK_QUALITY) { - etx = 0.0; - } else { - etx = 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality); - } - OLSR_PRINTF(1, fstr, olsr_ip_to_string(&tc->addr), olsr_ip_to_string(&tc_edge->T_dest_addr), ! tc_edge->link_quality, tc_edge->inverse_link_quality, etx); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); --- 636,644 ---- OLSR_FOR_ALL_TC_ENTRIES(tc) { OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { OLSR_PRINTF(1, fstr, olsr_ip_to_string(&tc->addr), olsr_ip_to_string(&tc_edge->T_dest_addr), ! tc_edge->link_quality, ! tc_edge->inverse_link_quality, ! olsr_calc_tc_etx(tc_edge)); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); *************** *** 656,659 **** --- 648,659 ---- } + float olsr_calc_tc_etx(const struct tc_edge_entry *tc_edge) + { + return tc_edge->link_quality < MIN_LINK_QUALITY || + tc_edge->inverse_link_quality < MIN_LINK_QUALITY + ? 0.0 + : 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality); + } + /* * Local Variables: Index: link_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** link_set.h 5 Oct 2007 20:10:24 -0000 1.32 --- link_set.h 2 Nov 2007 20:58:06 -0000 1.33 *************** *** 151,153 **** --- 151,155 ---- olsr_update_dijkstra_link_qualities(void); + float olsr_calc_link_etx(const struct link_entry *); + #endif Index: link_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** link_set.c 21 Oct 2007 20:09:09 -0000 1.75 --- link_set.c 2 Nov 2007 20:58:06 -0000 1.76 *************** *** 1185,1186 **** --- 1185,1193 ---- } + float olsr_calc_link_etx(const struct link_entry *link) + { + return link->loss_link_quality < MIN_LINK_QUALITY || + link->neigh_link_quality < MIN_LINK_QUALITY + ? 0.0 + : 1.0 / (link->loss_link_quality * link->neigh_link_quality); + } From (spam-protected) Fri Nov 2 21:58:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 20:58:09 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.27, 1.28 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21496/lib/dot_draw/src Modified Files: olsrd_dot_draw.c Log Message: Some minor and trivial cleanup: Added two functions to calculate the ETX value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** olsrd_dot_draw.c 13 Sep 2007 15:31:58 -0000 1.27 --- olsrd_dot_draw.c 2 Nov 2007 20:58:07 -0000 1.28 *************** *** 114,120 **** ipc_send_str(const char *); - static double - calc_etx(double, double); - /** --- 114,117 ---- *************** *** 173,177 **** link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr); if (link) { ! etx = calc_etx( link->loss_link_quality, link->neigh_link_quality); } } --- 170,174 ---- link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr); if (link) { ! etx = olsr_calc_link_etx(link); } } *************** *** 366,393 **** - #define MIN_LINK_QUALITY 0.01 - static double - calc_etx(double loss, double neigh_loss) - { - if (loss < MIN_LINK_QUALITY || neigh_loss < MIN_LINK_QUALITY) - return 0.0; - else - return 1.0 / (loss * neigh_loss); - } - - static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry) { char buf[256]; - const char* adr; - double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality ); ! adr = olsr_ip_to_string(&entry->addr); ! sprintf( buf, "\"%s\" -> ", adr ); ipc_send_str(buf); ! adr = olsr_ip_to_string(&dst_entry->T_dest_addr); ! sprintf( buf, "\"%s\"[label=\"%.2f\"];\n", adr, etx ); ipc_send_str(buf); } --- 363,375 ---- static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry) { char buf[256]; ! sprintf( buf, "\"%s\" -> ", olsr_ip_to_string(&entry->addr)); ipc_send_str(buf); ! sprintf( buf, "\"%s\"[label=\"%.2f\"];\n", olsr_ip_to_string(&dst_entry->T_dest_addr), olsr_calc_tc_etx(dst_entry)); ipc_send_str(buf); } From (spam-protected) Fri Nov 2 21:58:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 20:58:09 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.80, 1.81 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21496/lib/httpinfo/src Modified Files: olsrd_httpinfo.c Log Message: Some minor and trivial cleanup: Added two functions to calculate the ETX value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** olsrd_httpinfo.c 14 Oct 2007 22:46:03 -0000 1.80 --- olsrd_httpinfo.c 2 Nov 2007 20:58:07 -0000 1.81 *************** *** 981,994 **** if (olsr_cnf->lq_level > 0) { size += snprintf(&buf[size], bufsize-size, ! "%0.2f" ! "%d" ! "%d" ! "%0.2f" ! "%0.2f\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 += snprintf(&buf[size], bufsize-size, "\n"); --- 981,994 ---- if (olsr_cnf->lq_level > 0) { size += snprintf(&buf[size], bufsize-size, ! "%0.2f" ! "%d" ! "%d" ! "%0.2f" ! "%0.2f\n", ! link->loss_link_quality, ! link->lost_packets, ! link->total_packets, ! link->neigh_link_quality, ! olsr_calc_link_etx(link)); } size += snprintf(&buf[size], bufsize-size, "\n"); *************** *** 1062,1066 **** size += build_ipaddr_with_link(&buf[size], bufsize, &tc->addr, -1); if (olsr_cnf->lq_level > 0) { - const double d = tc_edge->link_quality * tc_edge->inverse_link_quality; size += snprintf(&buf[size], bufsize-size, "%0.2f" --- 1062,1065 ---- *************** *** 1069,1073 **** tc_edge->link_quality, tc_edge->inverse_link_quality, ! d ? 1.0 / d : 0.0); } size += snprintf(&buf[size], bufsize-size, "\n"); --- 1068,1072 ---- tc_edge->link_quality, tc_edge->inverse_link_quality, ! olsr_calc_tc_etx(tc_edge)); } size += snprintf(&buf[size], bufsize-size, "\n"); From (spam-protected) Fri Nov 2 23:00:29 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 02 Nov 2007 22:00:29 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.39,1.40 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14481 Modified Files: Makefile.inc Log Message: * added a comment Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Makefile.inc 2 Nov 2007 15:37:09 -0000 1.39 --- Makefile.inc 2 Nov 2007 22:00:26 -0000 1.40 *************** *** 157,160 **** --- 157,161 ---- endif + # a make function to quote "/" and "." quote = $(subst .,\.,$(subst /,\/,$1)) From (spam-protected) Sat Nov 3 23:54:05 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 22:54:05 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/misc - New directory Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/misc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5384/lib/httpinfo/misc Log Message: Directory /cvsroot/olsrd/olsrd-current/lib/httpinfo/misc added to the repository From (spam-protected) Sat Nov 3 23:56:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 22:56:09 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.107,1.108 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6252 Modified Files: CHANGELOG Log Message: added http://meshcube.org/nylon/utils/olsr-topology-view.pl into lib/httpinfo/misc as suggested by Jens Nachtigall Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** CHANGELOG 2 Nov 2007 20:58:06 -0000 1.107 --- CHANGELOG 3 Nov 2007 22:56:07 -0000 1.108 *************** *** 36,39 **** --- 36,41 ---- value from a struct tc_edge_entry and a struct link_entry, respectively. And use them everywhere. + - added http://meshcube.org/nylon/utils/olsr-topology-view.pl into + lib/httpinfo/misc as suggested by Jens Nachtigall 0.5.4 --------------------------------------------------------------------- From (spam-protected) Sat Nov 3 23:56:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 22:56:09 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/misc olsr-topology-view.pl, NONE, 1.1 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/misc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6252/lib/httpinfo/misc Added Files: olsr-topology-view.pl Log Message: added http://meshcube.org/nylon/utils/olsr-topology-view.pl into lib/httpinfo/misc as suggested by Jens Nachtigall --- NEW FILE: olsr-topology-view.pl --- #!/usr/bin/perl # a hack to display OLSR topology information # # copyleft 2004 Bruno Randolf # licensed under the GPL use IO::Socket; use Getopt::Long; $TOPPATH = "/tmp"; $NAME = "topology"; $FILENAME = "$TOPPATH/$NAME.dot"; $EXT = "png"; $SERVER = "localhost"; $PORT = "2004"; $FULLSCREEN = 0; $HELP = 0; $KEEP = 0; $BGCOLOR = "black"; $STYLE = 1; $SIZE = "8,8"; $ROOTWIN = 0; $ONCE = 0; $GRAPH = 1; $SHOW = 1; $FONTNAME = "Courier"; $FONTSIZE = 12; $LINEWIDTH = 0; $LINECOLOR = 0; $RESOLV = 0; GetOptions ("server=s" => \$SERVER, "port=s" => \$PORT, "fullscreen!" => \$FULLSCREEN, "help!" => \$HELP, "keep!" => \$KEEP, "bgcolor=s" => \$BGCOLOR, "fontname=s" => \$FONTNAME, "fontsize=s" => \$FONTSIZE, "style=i" => \$STYLE, "size=s" => \$SIZE, "rootwin!" => \$ROOTWIN, "once!" => \$ONCE, "graph!" => \$GRAPH, "show!" => \$SHOW, "linewidth!" => \$LINEWIDTH, "linecolor!" => \$LINECOLOR, "resolv" => \$RESOLV, ); if ($HELP) { print << "EOF"; usage: $0 [ --server SERVER ] [--port PORT] [--fullscreen] [--keep] a hack to display OLSR topology information options: --server SERVER connect to OLSR node (default: localhost) --port PORT connect to port (default: 2004) --bgcolor background color (default: black) --fontname font name (default: Courier) --fontsize font size (default: 12) --style drawing style 1, 2 or 3 (default:1) --size X,Y image size in inches for graphviz (default: 8,8) --[no]fullscreen display fullscreen (default: off) --[no]rootwin display in root window (default: off) --[no]graph genereate graphics (default: on) --[no]show display the graphics (default: on) --[no]once run only 1 time, then exit (default: run forever) --[no]linewith change line width according to metric (default: off) --[no]linecolor change line color according to metric (default: off) --[no]resolv resolv hostnames (default: off) --[no]keep keep the .dot files with timestamp in /tmp (default: off) requires the "graphviz" and "imagemagick" packages installed and the "olsrd_dot_draw" plugin configured on the olsr node EOF exit; } `touch $TOPPATH/$NAME.$EXT`; $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $SERVER, PeerPort => $PORT, ) or die "cannot connect to port $PORT at $SERVER!\nis the olsrd_dot_draw plugin loaded and configured to allow connections from this host?\n"; $f; $start = 1; $FULLOPT = "-backdrop -background black" if $FULLSCREEN; if ($STYLE == 1) { $DOT_CMD = "neato -Tpng -Gsize=${SIZE} -Gbgcolor=${BGCOLOR} -Gsplines=true -Nstyle=filled -Nfontname=${FONTNAME} -Nfontsize=${FONTSIZE} -Efontname=${FONTNAME} -Efontsize=${FONTSIZE} -Ncolor=white -Nfillcolor=white -Ecolor=grey -Elen=4 -Earrowsize=2 -Efontcolor=white $FILENAME -o $TOPPATH/$NAME.new"; } elsif ($STYLE == 2) { $BGCOLOR = "grey"; $DOT_CMD = "dot -Tpng -Gsize=${SIZE} -Elen=2 -Ncolor=grey -Nstyle=filled -Nfillcolor=white -Nfontname=${FONTNAME} -Nfontsize=${FONTSIZE} -Efontname=${FONTNAME} -Efontsize=${FONTSIZE} -Nfontcolor=red -Nwidth=1 -Gbgcolor=$BGCOLOR $FILENAME -o $TOPPATH/$NAME.new"; } elsif ($STYLE == 3) { $BGCOLOR = "\#ff6600"; $DOT_CMD = "neato -Tpng -Gsize=10,9 -Gbgcolor=${BGCOLOR} -Gsplines=true -Nstyle=filled -Nfontname=${FONTNAME} -Nfontsize=${FONTSIZE} -Efontname=${FONTNAME} -Efontsize=${FONTSIZE} -Nheight=1.3 -Nwidth=1.3 -Gsplines=true -Ncolor=darkslategrey -Nfillcolor=darkslategrey -Ecolor=black -Elen=4 -Earrowsize=3 $FILENAME -o $TOPPATH/$NAME.new"; } while ( <$remote> ) { $line = $_; if ($RESOLV) { $line = resolv( $line ); } if ($LINEWIDTH || $LINECOLOR) { $line = draw_thicker_metric_lines( $line ); } $f = $f . $line; # end of one graph if ( $line =~ /}/i ) { #print "* "; open DOTFILE, ">$FILENAME"; print DOTFILE $f; close DOTFILE; $f = ""; if ($GRAPH) { `$DOT_CMD`; `mv $TOPPATH/$NAME.new $TOPPATH/$NAME.$EXT`; } if ($KEEP) { `cp $TOPPATH/$NAME.dot $TOPPATH/$NAME-\$(date +'%Y-%m-%d-%H-%M-%S').dot`; } if ($SHOW) { if ($ROOTWIN) { system "display -window root -backdrop $TOPPATH/$NAME.$EXT &"; } elsif ($start) { system "display $FULLOPT -update 5 $TOPPATH/$NAME.$EXT &"; $start = 0; } } exit if $ONCE; } } print "connection closed\n"; sub resolv { my $l = shift; if ( $l =~ /\"(.*)\" -> "([^[]*)"(.*)/) { my $from = $1; my $to = $2; my $rest = $3; $from =~ s/\"//g; $to =~ s/\"//g; my $iaddrf = inet_aton($from); my $fromn = gethostbyaddr($iaddrf, AF_INET); my $iaddrt = inet_aton($to); my $ton = gethostbyaddr($iaddrt, AF_INET); $fromn = $from if ! $fromn; $ton = $to if ! $ton; $l = "\"$fromn\" -> \"$ton\"$rest\n"; } return $l; } sub draw_thicker_metric_lines { # sla 04.04.2005 # a hack to draws thicker lines for better metrics (the better the thicker). # colorize the metric lines. # my $l = shift; if ($l =~ /.*label="[0-9].*/){ # recognizion pattern @n=split (/"/,$l); # split the string to get the metric value if ($LINECOLOR) { if ( $n[5]>2 ) { # colorize metrics greater than 2 gray $c="888888"; } else { # colorize metrics less than 2 black $c="000000"; } $setcol = "color=\"#$c\","; } if ($LINEWIDTH) { if ($n[5]>0 && $n[5]<10) { # thicker lines if 10 > metric > 0 $lt=6/$n[5]; $at=$lt/2; } else { # at least draw a thin line $lt=1; $at=$lt; } $setwidth = "style=\"setlinewidth($lt)\", arrowsize=$at"; } $l =~ s/\]/, $setcol $setwidth]/g; # replace pattern } return $l; } __END__ From (spam-protected) Sun Nov 4 00:02:50 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 23:02:50 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/misc - New directory Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/misc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9284/lib/dot_draw/misc Log Message: Directory /cvsroot/olsrd/olsrd-current/lib/dot_draw/misc added to the repository From (spam-protected) Sun Nov 4 00:03:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 23:03:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/misc olsr-topology-view.pl, 1.1, NONE Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/misc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9699/lib/httpinfo/misc Removed Files: olsr-topology-view.pl Log Message: OK, I was too silly to throw it into the correct plugin. Should be fixed now. --- olsr-topology-view.pl DELETED --- From (spam-protected) Sun Nov 4 00:03:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 23:03:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/misc olsr-topology-view.pl, NONE, 1.1 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/misc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9699/lib/dot_draw/misc Added Files: olsr-topology-view.pl Log Message: OK, I was too silly to throw it into the correct plugin. Should be fixed now. --- NEW FILE: olsr-topology-view.pl --- #!/usr/bin/perl # a hack to display OLSR topology information # # copyleft 2004 Bruno Randolf # licensed under the GPL use IO::Socket; use Getopt::Long; $TOPPATH = "/tmp"; $NAME = "topology"; $FILENAME = "$TOPPATH/$NAME.dot"; $EXT = "png"; $SERVER = "localhost"; $PORT = "2004"; $FULLSCREEN = 0; $HELP = 0; $KEEP = 0; $BGCOLOR = "black"; $STYLE = 1; $SIZE = "8,8"; $ROOTWIN = 0; $ONCE = 0; $GRAPH = 1; $SHOW = 1; $FONTNAME = "Courier"; $FONTSIZE = 12; $LINEWIDTH = 0; $LINECOLOR = 0; $RESOLV = 0; GetOptions ("server=s" => \$SERVER, "port=s" => \$PORT, "fullscreen!" => \$FULLSCREEN, "help!" => \$HELP, "keep!" => \$KEEP, "bgcolor=s" => \$BGCOLOR, "fontname=s" => \$FONTNAME, "fontsize=s" => \$FONTSIZE, "style=i" => \$STYLE, "size=s" => \$SIZE, "rootwin!" => \$ROOTWIN, "once!" => \$ONCE, "graph!" => \$GRAPH, "show!" => \$SHOW, "linewidth!" => \$LINEWIDTH, "linecolor!" => \$LINECOLOR, "resolv" => \$RESOLV, ); if ($HELP) { print << "EOF"; usage: $0 [ --server SERVER ] [--port PORT] [--fullscreen] [--keep] a hack to display OLSR topology information options: --server SERVER connect to OLSR node (default: localhost) --port PORT connect to port (default: 2004) --bgcolor background color (default: black) --fontname font name (default: Courier) --fontsize font size (default: 12) --style drawing style 1, 2 or 3 (default:1) --size X,Y image size in inches for graphviz (default: 8,8) --[no]fullscreen display fullscreen (default: off) --[no]rootwin display in root window (default: off) --[no]graph genereate graphics (default: on) --[no]show display the graphics (default: on) --[no]once run only 1 time, then exit (default: run forever) --[no]linewith change line width according to metric (default: off) --[no]linecolor change line color according to metric (default: off) --[no]resolv resolv hostnames (default: off) --[no]keep keep the .dot files with timestamp in /tmp (default: off) requires the "graphviz" and "imagemagick" packages installed and the "olsrd_dot_draw" plugin configured on the olsr node EOF exit; } `touch $TOPPATH/$NAME.$EXT`; $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $SERVER, PeerPort => $PORT, ) or die "cannot connect to port $PORT at $SERVER!\nis the olsrd_dot_draw plugin loaded and configured to allow connections from this host?\n"; $f; $start = 1; $FULLOPT = "-backdrop -background black" if $FULLSCREEN; if ($STYLE == 1) { $DOT_CMD = "neato -Tpng -Gsize=${SIZE} -Gbgcolor=${BGCOLOR} -Gsplines=true -Nstyle=filled -Nfontname=${FONTNAME} -Nfontsize=${FONTSIZE} -Efontname=${FONTNAME} -Efontsize=${FONTSIZE} -Ncolor=white -Nfillcolor=white -Ecolor=grey -Elen=4 -Earrowsize=2 -Efontcolor=white $FILENAME -o $TOPPATH/$NAME.new"; } elsif ($STYLE == 2) { $BGCOLOR = "grey"; $DOT_CMD = "dot -Tpng -Gsize=${SIZE} -Elen=2 -Ncolor=grey -Nstyle=filled -Nfillcolor=white -Nfontname=${FONTNAME} -Nfontsize=${FONTSIZE} -Efontname=${FONTNAME} -Efontsize=${FONTSIZE} -Nfontcolor=red -Nwidth=1 -Gbgcolor=$BGCOLOR $FILENAME -o $TOPPATH/$NAME.new"; } elsif ($STYLE == 3) { $BGCOLOR = "\#ff6600"; $DOT_CMD = "neato -Tpng -Gsize=10,9 -Gbgcolor=${BGCOLOR} -Gsplines=true -Nstyle=filled -Nfontname=${FONTNAME} -Nfontsize=${FONTSIZE} -Efontname=${FONTNAME} -Efontsize=${FONTSIZE} -Nheight=1.3 -Nwidth=1.3 -Gsplines=true -Ncolor=darkslategrey -Nfillcolor=darkslategrey -Ecolor=black -Elen=4 -Earrowsize=3 $FILENAME -o $TOPPATH/$NAME.new"; } while ( <$remote> ) { $line = $_; if ($RESOLV) { $line = resolv( $line ); } if ($LINEWIDTH || $LINECOLOR) { $line = draw_thicker_metric_lines( $line ); } $f = $f . $line; # end of one graph if ( $line =~ /}/i ) { #print "* "; open DOTFILE, ">$FILENAME"; print DOTFILE $f; close DOTFILE; $f = ""; if ($GRAPH) { `$DOT_CMD`; `mv $TOPPATH/$NAME.new $TOPPATH/$NAME.$EXT`; } if ($KEEP) { `cp $TOPPATH/$NAME.dot $TOPPATH/$NAME-\$(date +'%Y-%m-%d-%H-%M-%S').dot`; } if ($SHOW) { if ($ROOTWIN) { system "display -window root -backdrop $TOPPATH/$NAME.$EXT &"; } elsif ($start) { system "display $FULLOPT -update 5 $TOPPATH/$NAME.$EXT &"; $start = 0; } } exit if $ONCE; } } print "connection closed\n"; sub resolv { my $l = shift; if ( $l =~ /\"(.*)\" -> "([^[]*)"(.*)/) { my $from = $1; my $to = $2; my $rest = $3; $from =~ s/\"//g; $to =~ s/\"//g; my $iaddrf = inet_aton($from); my $fromn = gethostbyaddr($iaddrf, AF_INET); my $iaddrt = inet_aton($to); my $ton = gethostbyaddr($iaddrt, AF_INET); $fromn = $from if ! $fromn; $ton = $to if ! $ton; $l = "\"$fromn\" -> \"$ton\"$rest\n"; } return $l; } sub draw_thicker_metric_lines { # sla 04.04.2005 # a hack to draws thicker lines for better metrics (the better the thicker). # colorize the metric lines. # my $l = shift; if ($l =~ /.*label="[0-9].*/){ # recognizion pattern @n=split (/"/,$l); # split the string to get the metric value if ($LINECOLOR) { if ( $n[5]>2 ) { # colorize metrics greater than 2 gray $c="888888"; } else { # colorize metrics less than 2 black $c="000000"; } $setcol = "color=\"#$c\","; } if ($LINEWIDTH) { if ($n[5]>0 && $n[5]<10) { # thicker lines if 10 > metric > 0 $lt=6/$n[5]; $at=$lt/2; } else { # at least draw a thin line $lt=1; $at=$lt; } $setwidth = "style=\"setlinewidth($lt)\", arrowsize=$at"; } $l =~ s/\]/, $setcol $setwidth]/g; # replace pattern } return $l; } __END__ From (spam-protected) Sun Nov 4 00:11:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 23:11:42 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.108,1.109 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13246 Modified Files: CHANGELOG Log Message: PATCH by John Hay : - also printout our own HNAs in the dotdraw plugin. Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** CHANGELOG 3 Nov 2007 22:56:07 -0000 1.108 --- CHANGELOG 3 Nov 2007 23:11:40 -0000 1.109 *************** *** 6,9 **** --- 6,12 ---- BUGFIX by Hannes Gredler fixing not deleted tc entry. + PATCH by John Hay : + - also printout our own HNAs in the dotdraw plugin. + PATCHES and CLEANUPS by Bernd Petrovitsch - Jens Nachtigall suggested (and reminded) to use From (spam-protected) Sun Nov 4 00:11:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 23:11:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.28, 1.29 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13246/lib/dot_draw/src Modified Files: olsrd_dot_draw.c Log Message: PATCH by John Hay : - also printout our own HNAs in the dotdraw plugin. Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** olsrd_dot_draw.c 2 Nov 2007 20:58:07 -0000 1.28 --- olsrd_dot_draw.c 3 Nov 2007 23:11:40 -0000 1.29 *************** *** 299,302 **** --- 299,305 ---- struct hna_entry *tmp_hna; struct hna_net *tmp_net; + struct hna4_entry *hna4; + struct hna6_entry *hna6; + union hna_netmask hna_msk; res = 0; *************** *** 349,352 **** --- 352,380 ---- } + /* Local HNA entries */ + if (olsr_cnf->ip_version == AF_INET) + { + hna4 = olsr_cnf->hna4_entries; + while(hna4) + { + hna_msk.v4 = hna4->netmask.v4; + ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, + &hna4->net, + &hna_msk); + hna4 = hna4->next; + } + } + else + { + hna6 = olsr_cnf->hna6_entries; + while(hna6) + { + hna_msk.v6 = hna6->prefix_len; + ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, + &hna6->net, + &hna_msk); + hna6 = hna6->next; + } + } ipc_send_str("}\n\n"); *************** *** 362,366 **** } - static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry) --- 390,393 ---- From (spam-protected) Sun Nov 4 00:21:30 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 23:21:30 +0000 Subject: [Olsr-cvs] olsrd-current/src olsr_cfg.h, 1.35, 1.36 main.c, 1.100, 1.101 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17552/src Modified Files: olsr_cfg.h main.c Log Message: Killed "struct olsrd_config *cnf" in src/cfgparser/olsrd_conf.h and replaced it's usage with "olsr_cnf" from src/defs.h. Serious cleanup: olsrd_get_default_cnf() does no longer initialize the global "cnf" variable" but uses a local one which is returned as before. And olsrd_parse_cnf() does no longer return the global variable it is working on. Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** olsr_cfg.h 22 Oct 2007 21:02:49 -0000 1.35 --- olsr_cfg.h 3 Nov 2007 23:21:27 -0000 1.36 *************** *** 258,262 **** */ ! struct olsrd_config * olsrd_parse_cnf(const char *); --- 258,262 ---- */ ! int olsrd_parse_cnf(const char *); Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** main.c 17 Sep 2007 22:24:22 -0000 1.100 --- main.c 3 Nov 2007 23:21:27 -0000 1.101 *************** *** 210,214 **** * set up configuration prior to processing commandline options */ ! if((olsr_cnf = olsrd_parse_cnf(conf_file_name)) == NULL) { printf("Using default config values(no configfile)\n"); --- 210,214 ---- * set up configuration prior to processing commandline options */ ! if(olsrd_parse_cnf(conf_file_name)) { printf("Using default config values(no configfile)\n"); From (spam-protected) Sun Nov 4 00:21:30 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 23:21:30 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.109,1.110 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17552 Modified Files: CHANGELOG Log Message: Killed "struct olsrd_config *cnf" in src/cfgparser/olsrd_conf.h and replaced it's usage with "olsr_cnf" from src/defs.h. Serious cleanup: olsrd_get_default_cnf() does no longer initialize the global "cnf" variable" but uses a local one which is returned as before. And olsrd_parse_cnf() does no longer return the global variable it is working on. Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** CHANGELOG 3 Nov 2007 23:11:40 -0000 1.109 --- CHANGELOG 3 Nov 2007 23:21:28 -0000 1.110 *************** *** 41,44 **** --- 41,49 ---- - added http://meshcube.org/nylon/utils/olsr-topology-view.pl into lib/httpinfo/misc as suggested by Jens Nachtigall + - Killed "struct olsrd_config *cnf" in src/cfgparser/olsrd_conf.h and replaced + it's usage with "olsr_cnf" from src/defs.h. + Serious cleanup: olsrd_get_default_cnf() does no longer initialize the global + "cnf" variable" but uses a local one which is returned as before. And + olsrd_parse_cnf() does no longer return the global variable it is working on. 0.5.4 --------------------------------------------------------------------- From (spam-protected) Sun Nov 4 00:21:29 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 03 Nov 2007 23:21:29 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser oparse.y, 1.34, 1.35 olsrd_conf.h, 1.14, 1.15 olsrd_conf.c, 1.58, 1.59 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17552/src/cfgparser Modified Files: oparse.y olsrd_conf.h olsrd_conf.c Log Message: Killed "struct olsrd_config *cnf" in src/cfgparser/olsrd_conf.h and replaced it's usage with "olsr_cnf" from src/defs.h. Serious cleanup: olsrd_get_default_cnf() does no longer initialize the global "cnf" variable" but uses a local one which is returned as before. And olsrd_parse_cnf() does no longer return the global variable it is working on. Index: olsrd_conf.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** olsrd_conf.h 30 Oct 2007 09:19:22 -0000 1.14 --- olsrd_conf.h 3 Nov 2007 23:21:27 -0000 1.15 *************** *** 52,57 **** extern int current_line; - extern struct olsrd_config *cnf; - struct conf_token { --- 52,55 ---- Index: olsrd_conf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** olsrd_conf.c 30 Oct 2007 09:19:22 -0000 1.58 --- olsrd_conf.c 3 Nov 2007 23:21:27 -0000 1.59 *************** *** 52,55 **** --- 52,56 ---- #include "olsrd_conf.h" #include "olsr_cfg.h" + #include "defs.h" *************** *** 60,64 **** int current_line; - struct olsrd_config *cnf; #ifdef MAKEBIN --- 61,64 ---- *************** *** 102,106 **** #endif ! struct olsrd_config * olsrd_parse_cnf(const char *filename) { --- 102,106 ---- #endif ! int olsrd_parse_cnf(const char *filename) { *************** *** 109,119 **** /* Initialize the global varibles - oparse.y needs it there */ ! cnf = malloc(sizeof(struct olsrd_config)); ! if (cnf == NULL) { fprintf(stderr, "Out of memory %s\n", __func__); ! return NULL; } ! set_default_cnf(cnf); printf("Parsing file: \"%s\"\n", filename); --- 109,119 ---- /* Initialize the global varibles - oparse.y needs it there */ ! olsr_cnf = malloc(sizeof(*olsr_cnf)); ! if (olsr_cnf == NULL) { fprintf(stderr, "Out of memory %s\n", __func__); ! return 1; } ! set_default_cnf(olsr_cnf); printf("Parsing file: \"%s\"\n", filename); *************** *** 123,128 **** fprintf(stderr, "Cannot open configuration file '%s': %s.\n", filename, strerror(errno)); ! free(cnf); ! return NULL; } --- 123,129 ---- fprintf(stderr, "Cannot open configuration file '%s': %s.\n", filename, strerror(errno)); ! olsrd_free_cnf(olsr_cnf); ! olsr_cnf = NULL; ! return 1; } *************** *** 131,140 **** fclose(yyin); if (rc != 0) { ! olsrd_free_cnf(cnf); ! return NULL; } /* Reverse the queue (added by user request) */ ! in = cnf->interfaces; new_ifqueue = NULL; --- 132,142 ---- fclose(yyin); if (rc != 0) { ! olsrd_free_cnf(olsr_cnf); ! olsr_cnf = NULL; ! return 1; } /* Reverse the queue (added by user request) */ ! in = olsr_cnf->interfaces; new_ifqueue = NULL; *************** *** 147,153 **** } ! cnf->interfaces = new_ifqueue; ! for (in = cnf->interfaces; in != NULL; in = in->next) { /* set various stuff */ in->configured = OLSR_FALSE; --- 149,155 ---- } ! olsr_cnf->interfaces = new_ifqueue; ! for (in = olsr_cnf->interfaces; in != NULL; in = in->next) { /* set various stuff */ in->configured = OLSR_FALSE; *************** *** 155,159 **** in->host_emul = OLSR_FALSE; } ! return cnf; } --- 157,161 ---- in->host_emul = OLSR_FALSE; } ! return 0; } *************** *** 411,424 **** olsrd_get_default_cnf(void) { ! cnf = malloc(sizeof(struct olsrd_config)); ! if (cnf == NULL) ! { ! fprintf(stderr, "Out of memory %s\n", __func__); ! return NULL; ! } ! ! set_default_cnf(cnf); ! return cnf; } --- 413,424 ---- olsrd_get_default_cnf(void) { ! struct olsrd_config *c = malloc(sizeof(struct olsrd_config)); ! if (c == NULL) { ! fprintf(stderr, "Out of memory %s\n", __func__); ! return NULL; ! } ! set_default_cnf(c); ! return c; } *************** *** 429,433 **** set_default_cnf(struct olsrd_config *cnf) { ! memset(cnf, 0, sizeof(struct olsrd_config)); cnf->debug_level = DEF_DEBUGLVL; --- 429,433 ---- set_default_cnf(struct olsrd_config *cnf) { ! memset(cnf, 0, sizeof(*cnf)); cnf->debug_level = DEF_DEBUGLVL; *************** *** 478,499 **** get_default_if_config(void) { - struct if_config_options *io = malloc(sizeof(struct if_config_options)); struct in6_addr in6; ! if(io == NULL) ! { ! fprintf(stderr, "Out of memory %s\n", __func__); ! return NULL; ! } ! memset(io, 0, sizeof(struct if_config_options)); io->ipv6_addrtype = 1; /* XXX - FixMe */ inet_pton(AF_INET6, OLSR_IPV6_MCAST_SITE_LOCAL, &in6); ! memcpy(&io->ipv6_multi_site.v6, &in6, sizeof(struct in6_addr)); inet_pton(AF_INET6, OLSR_IPV6_MCAST_GLOBAL, &in6); ! memcpy(&io->ipv6_multi_glbl.v6, &in6, sizeof(struct in6_addr)); io->lq_mult = NULL; --- 478,498 ---- get_default_if_config(void) { struct in6_addr in6; + struct if_config_options *io = malloc(sizeof(*io)); ! if(io == NULL) { ! fprintf(stderr, "Out of memory %s\n", __func__); ! return NULL; ! } ! memset(io, 0, sizeof(*io)); io->ipv6_addrtype = 1; /* XXX - FixMe */ inet_pton(AF_INET6, OLSR_IPV6_MCAST_SITE_LOCAL, &in6); ! io->ipv6_multi_site.v6 = in6; inet_pton(AF_INET6, OLSR_IPV6_MCAST_GLOBAL, &in6); ! io->ipv6_multi_glbl.v6 = in6; io->lq_mult = NULL; Index: oparse.y =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** oparse.y 13 Sep 2007 16:08:13 -0000 1.34 --- oparse.y 3 Nov 2007 23:21:27 -0000 1.35 *************** *** 53,56 **** --- 53,57 ---- #include "olsrd_conf.h" + #include "../defs.h" #define PARSER_DEBUG 0 *************** *** 76,80 **** int i; struct olsr_if *walker; - struct olsr_lq_mult *mult; #if PARSER_DEBUG > 0 --- 77,80 ---- *************** *** 84,109 **** #endif ! memset(&addr, 0, sizeof (union olsr_ip_addr)); if(ip_addr_arg != NULL && ! inet_pton(cnf->ip_version, ip_addr_arg->string, &addr) < 0) ! { fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string); return -1; } ! walker = cnf->interfaces; ! ! for (i = 0; i < ifs_in_curr_cfg; i++) ! { ! mult = malloc(sizeof (struct olsr_lq_mult)); ! if (mult == NULL) ! { fprintf(stderr, "Out of memory (LQ multiplier).\n"); return -1; } ! memcpy(&mult->addr, &addr, sizeof (union olsr_ip_addr)); mult->val = mult_arg->floating; --- 84,105 ---- #endif ! memset(&addr, 0, sizeof(addr)); if(ip_addr_arg != NULL && ! inet_pton(olsr_cnf->ip_version, ip_addr_arg->string, &addr) < 0) { fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string); return -1; } ! walker = olsr_cnf->interfaces; ! for (i = 0; i < ifs_in_curr_cfg; i++) { ! struct olsr_lq_mult *mult = malloc(sizeof(*mult)); ! if (mult == NULL) { fprintf(stderr, "Out of memory (LQ multiplier).\n"); return -1; } ! mult->addr = addr; mult->val = mult_arg->floating; *************** *** 114,119 **** } ! if (ip_addr_arg != NULL) ! { free(ip_addr_arg->string); free(ip_addr_arg); --- 110,114 ---- } ! if (ip_addr_arg != NULL) { free(ip_addr_arg->string); free(ip_addr_arg); *************** *** 296,306 **** ; - imaxipc: TOK_MAXIPC TOK_INTEGER { ! cnf->ipc_connections = $2->integer; ! ! cnf->open_ipc = cnf->ipc_connections ? OLSR_TRUE : OLSR_FALSE; ! free($2); } --- 291,298 ---- ; imaxipc: TOK_MAXIPC TOK_INTEGER { ! olsr_cnf->ipc_connections = $2->integer; ! olsr_cnf->open_ipc = olsr_cnf->ipc_connections ? OLSR_TRUE : OLSR_FALSE; free($2); } *************** *** 320,328 **** } ! ipch = malloc(sizeof(struct ipc_host)); ipch->host.v4 = in.s_addr; ! ipch->next = cnf->ipc_hosts; ! cnf->ipc_hosts = ipch; free($2->string); --- 312,320 ---- } ! ipch = malloc(sizeof(*ipch)); ipch->host.v4 = in.s_addr; ! ipch->next = olsr_cnf->ipc_hosts; ! olsr_cnf->ipc_hosts = ipch; free($2->string); *************** *** 351,360 **** } ! ipcn = malloc(sizeof(struct ipc_net)); ipcn->net.v4 = in1.s_addr; ipcn->mask.v4 = in2.s_addr; ! ipcn->next = cnf->ipc_nets; ! cnf->ipc_nets = ipcn; free($2->string); --- 343,352 ---- } ! ipcn = malloc(sizeof(*ipcn)); ipcn->net.v4 = in1.s_addr; ipcn->mask.v4 = in2.s_addr; ! ipcn->next = olsr_cnf->ipc_nets; ! olsr_cnf->ipc_nets = ipcn; free($2->string); *************** *** 369,373 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("Fixed willingness: %d\n", $2->integer); --- 361,365 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("Fixed willingness: %d\n", $2->integer); *************** *** 390,394 **** struct in_addr in; int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tIPv4 broadcast: %s\n", $2->string); --- 382,386 ---- struct in_addr in; int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tIPv4 broadcast: %s\n", $2->string); *************** *** 416,420 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; if($2->boolean) --- 408,412 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; if($2->boolean) *************** *** 447,451 **** struct in6_addr in6; int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tIPv6 site-local multicast: %s\n", $2->string); --- 439,443 ---- struct in6_addr in6; int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tIPv6 site-local multicast: %s\n", $2->string); *************** *** 459,463 **** while(ifcnt) { ! memcpy(&ifs->cnf->ipv6_multi_site.v6, &in6, sizeof(struct in6_addr)); ifs = ifs->next; --- 451,455 ---- while(ifcnt) { ! ifs->cnf->ipv6_multi_site.v6 = in6; ifs = ifs->next; *************** *** 476,480 **** struct in6_addr in6; int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tIPv6 global multicast: %s\n", $2->string); --- 468,472 ---- struct in6_addr in6; int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tIPv6 global multicast: %s\n", $2->string); *************** *** 502,506 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n", $2->floating); --- 494,498 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n", $2->floating); *************** *** 520,524 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating); --- 512,516 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating); *************** *** 538,542 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating); --- 530,534 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating); *************** *** 555,559 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating); --- 547,551 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating); *************** *** 572,576 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; --- 564,568 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; *************** *** 590,594 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating); --- 582,586 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating); *************** *** 607,611 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating); --- 599,603 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating); *************** *** 624,628 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating); --- 616,620 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating); *************** *** 641,645 **** { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = cnf->interfaces; PARSER_DEBUG_PRINTF("\tAutodetect changes: %s\n", $2->boolean ? "YES" : "NO"); --- 633,637 ---- { int ifcnt = ifs_in_curr_cfg; ! struct olsr_if *ifs = olsr_cnf->interfaces; PARSER_DEBUG_PRINTF("\tAutodetect changes: %s\n", $2->boolean ? "YES" : "NO"); *************** *** 679,684 **** { ! cnf->debug_level = $2->integer; ! PARSER_DEBUG_PRINTF("Debug level: %d\n", cnf->debug_level); free($2); } --- 671,676 ---- { ! olsr_cnf->debug_level = $2->integer; ! PARSER_DEBUG_PRINTF("Debug level: %d\n", olsr_cnf->debug_level); free($2); } *************** *** 689,695 **** { if($2->integer == 4) ! cnf->ip_version = AF_INET; else if($2->integer == 6) ! cnf->ip_version = AF_INET6; else { --- 681,687 ---- { if($2->integer == 4) ! olsr_cnf->ip_version = AF_INET; else if($2->integer == 6) ! olsr_cnf->ip_version = AF_INET6; else { *************** *** 706,710 **** ihna4entry: TOK_IP4_ADDR TOK_IP4_ADDR { ! struct hna4_entry *h = malloc(sizeof(struct hna4_entry)); struct in_addr in; --- 698,702 ---- ihna4entry: TOK_IP4_ADDR TOK_IP4_ADDR { ! struct hna4_entry *h = malloc(sizeof(*h)); struct in_addr in; *************** *** 731,736 **** h->net.v4 &= h->netmask.v4; /* Queue */ ! h->next = cnf->hna4_entries; ! cnf->hna4_entries = h; free($1->string); --- 723,728 ---- h->net.v4 &= h->netmask.v4; /* Queue */ ! h->next = olsr_cnf->hna4_entries; ! olsr_cnf->hna4_entries = h; free($1->string); *************** *** 744,748 **** ihna6entry: TOK_IP6_ADDR TOK_INTEGER { ! struct hna6_entry *h = malloc(sizeof(struct hna6_entry)); struct in6_addr in6; --- 736,740 ---- ihna6entry: TOK_IP6_ADDR TOK_INTEGER { ! struct hna6_entry *h = malloc(sizeof(*h)); struct in6_addr in6; *************** *** 760,764 **** return -1; } ! memcpy(&h->net, &in6, sizeof(struct in6_addr)); if($2->integer > 128) --- 752,756 ---- return -1; } ! h->net.v6 = in6; if($2->integer > 128) *************** *** 770,775 **** h->prefix_len = $2->integer; /* Queue */ ! h->next = cnf->hna6_entries; ! cnf->hna6_entries = h; free($1->string); --- 762,767 ---- h->prefix_len = $2->integer; /* Queue */ ! h->next = olsr_cnf->hna6_entries; ! olsr_cnf->hna6_entries = h; free($1->string); *************** *** 789,793 **** ifnick: TOK_STRING { ! struct olsr_if *in = malloc(sizeof(struct olsr_if)); if(in == NULL) --- 781,785 ---- ifnick: TOK_STRING { ! struct olsr_if *in = malloc(sizeof(*in)); if(in == NULL) *************** *** 808,813 **** /* Queue */ ! in->next = cnf->interfaces; ! cnf->interfaces = in; ifs_in_curr_cfg++; --- 800,805 ---- /* Queue */ ! in->next = olsr_cnf->interfaces; ! olsr_cnf->interfaces = in; ifs_in_curr_cfg++; *************** *** 821,825 **** PARSER_DEBUG_PRINTF("Noint set to %d\n", $2->boolean); ! cnf->allow_no_interfaces = $2->boolean; free($2); --- 813,817 ---- PARSER_DEBUG_PRINTF("Noint set to %d\n", $2->boolean); ! olsr_cnf->allow_no_interfaces = $2->boolean; free($2); *************** *** 830,834 **** { PARSER_DEBUG_PRINTF("TOS: %d\n", $2->integer); ! cnf->tos = $2->integer; free($2); --- 822,826 ---- { PARSER_DEBUG_PRINTF("TOS: %d\n", $2->integer); ! olsr_cnf->tos = $2->integer; free($2); *************** *** 840,844 **** { if(PARSER_DEBUG) printf("RtTable: %d\n", $2->integer); ! cnf->rttable = $2->integer; free($2); --- 832,836 ---- { if(PARSER_DEBUG) printf("RtTable: %d\n", $2->integer); ! olsr_cnf->rttable = $2->integer; free($2); *************** *** 849,856 **** awillingness: TOK_WILLINGNESS TOK_INTEGER { ! cnf->willingness_auto = OLSR_FALSE; PARSER_DEBUG_PRINTF("Willingness: %d\n", $2->integer); ! cnf->willingness = $2->integer; free($2); --- 841,848 ---- awillingness: TOK_WILLINGNESS TOK_INTEGER { ! olsr_cnf->willingness_auto = OLSR_FALSE; PARSER_DEBUG_PRINTF("Willingness: %d\n", $2->integer); ! olsr_cnf->willingness = $2->integer; free($2); *************** *** 863,868 **** busehyst: TOK_USEHYST TOK_BOOLEAN { ! cnf->use_hysteresis = $2->boolean; ! if(cnf->use_hysteresis) { PARSER_DEBUG_PRINTF("Hysteresis enabled\n"); --- 855,860 ---- busehyst: TOK_USEHYST TOK_BOOLEAN { ! olsr_cnf->use_hysteresis = $2->boolean; ! if(olsr_cnf->use_hysteresis) { PARSER_DEBUG_PRINTF("Hysteresis enabled\n"); *************** *** 880,884 **** fhystscale: TOK_HYSTSCALE TOK_FLOAT { ! cnf->hysteresis_param.scaling = $2->floating; PARSER_DEBUG_PRINTF("Hysteresis Scaling: %0.2f\n", $2->floating); free($2); --- 872,876 ---- fhystscale: TOK_HYSTSCALE TOK_FLOAT { ! olsr_cnf->hysteresis_param.scaling = $2->floating; PARSER_DEBUG_PRINTF("Hysteresis Scaling: %0.2f\n", $2->floating); free($2); *************** *** 889,893 **** fhystupper: TOK_HYSTUPPER TOK_FLOAT { ! cnf->hysteresis_param.thr_high = $2->floating; PARSER_DEBUG_PRINTF("Hysteresis UpperThr: %0.2f\n", $2->floating); free($2); --- 881,885 ---- fhystupper: TOK_HYSTUPPER TOK_FLOAT { ! olsr_cnf->hysteresis_param.thr_high = $2->floating; PARSER_DEBUG_PRINTF("Hysteresis UpperThr: %0.2f\n", $2->floating); free($2); *************** *** 898,902 **** fhystlower: TOK_HYSTLOWER TOK_FLOAT { ! cnf->hysteresis_param.thr_low = $2->floating; PARSER_DEBUG_PRINTF("Hysteresis LowerThr: %0.2f\n", $2->floating); free($2); --- 890,894 ---- fhystlower: TOK_HYSTLOWER TOK_FLOAT { ! olsr_cnf->hysteresis_param.thr_low = $2->floating; PARSER_DEBUG_PRINTF("Hysteresis LowerThr: %0.2f\n", $2->floating); free($2); *************** *** 907,911 **** { PARSER_DEBUG_PRINTF("Pollrate %0.2f\n", $2->floating); ! cnf->pollrate = $2->floating; free($2); --- 899,903 ---- { PARSER_DEBUG_PRINTF("Pollrate %0.2f\n", $2->floating); ! olsr_cnf->pollrate = $2->floating; free($2); *************** *** 916,920 **** { PARSER_DEBUG_PRINTF("NIC Changes Pollrate %0.2f\n", $2->floating); ! cnf->nic_chgs_pollrate = $2->floating; free($2); --- 908,912 ---- { PARSER_DEBUG_PRINTF("NIC Changes Pollrate %0.2f\n", $2->floating); ! olsr_cnf->nic_chgs_pollrate = $2->floating; free($2); *************** *** 925,929 **** { PARSER_DEBUG_PRINTF("TC redundancy %d\n", $2->integer); ! cnf->tc_redundancy = $2->integer; free($2); } --- 917,921 ---- { PARSER_DEBUG_PRINTF("TC redundancy %d\n", $2->integer); ! olsr_cnf->tc_redundancy = $2->integer; free($2); } *************** *** 933,937 **** { PARSER_DEBUG_PRINTF("MPR coverage %d\n", $2->integer); ! cnf->mpr_coverage = $2->integer; free($2); } --- 925,929 ---- { PARSER_DEBUG_PRINTF("MPR coverage %d\n", $2->integer); ! olsr_cnf->mpr_coverage = $2->integer; free($2); } *************** *** 941,945 **** { PARSER_DEBUG_PRINTF("Link quality level %d\n", $2->integer); ! cnf->lq_level = $2->integer; free($2); } --- 933,937 ---- { PARSER_DEBUG_PRINTF("Link quality level %d\n", $2->integer); ! olsr_cnf->lq_level = $2->integer; free($2); } *************** *** 949,953 **** { PARSER_DEBUG_PRINTF("Link quality fish eye %d\n", $2->integer); ! cnf->lq_fish = $2->integer; free($2); } --- 941,945 ---- { PARSER_DEBUG_PRINTF("Link quality fish eye %d\n", $2->integer); ! olsr_cnf->lq_fish = $2->integer; free($2); } *************** *** 957,962 **** { PARSER_DEBUG_PRINTF("Link quality dijkstra limit %d, %0.2f\n", $2->integer, $3->floating); ! cnf->lq_dlimit = $2->integer; ! cnf->lq_dinter = $3->floating; free($2); } --- 949,954 ---- { PARSER_DEBUG_PRINTF("Link quality dijkstra limit %d, %0.2f\n", $2->integer, $3->floating); ! olsr_cnf->lq_dlimit = $2->integer; ! olsr_cnf->lq_dinter = $3->floating; free($2); } *************** *** 966,970 **** { PARSER_DEBUG_PRINTF("Link quality window size %d\n", $2->integer); ! cnf->lq_wsize = $2->integer; free($2); } --- 958,962 ---- { PARSER_DEBUG_PRINTF("Link quality window size %d\n", $2->integer); ! olsr_cnf->lq_wsize = $2->integer; free($2); } *************** *** 973,979 **** bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN { ! cnf->clear_screen = $2->boolean; ! PARSER_DEBUG_PRINTF("Clear screen %s\n", cnf->clear_screen ? "enabled" : "disabled"); free($2); --- 965,971 ---- bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN { ! olsr_cnf->clear_screen = $2->boolean; ! PARSER_DEBUG_PRINTF("Clear screen %s\n", olsr_cnf->clear_screen ? "enabled" : "disabled"); free($2); *************** *** 983,987 **** plblock: TOK_PLUGIN TOK_STRING { ! struct plugin_entry *pe = malloc(sizeof(struct plugin_entry)); if(pe == NULL) --- 975,979 ---- plblock: TOK_PLUGIN TOK_STRING { ! struct plugin_entry *pe = malloc(sizeof(*pe)); if(pe == NULL) *************** *** 998,1003 **** /* Queue */ ! pe->next = cnf->plugins; ! cnf->plugins = pe; free($2); --- 990,995 ---- /* Queue */ ! pe->next = olsr_cnf->plugins; ! olsr_cnf->plugins = pe; free($2); *************** *** 1007,1011 **** plparam: TOK_PLPARAM TOK_STRING TOK_STRING { ! struct plugin_param *pp = malloc(sizeof(struct plugin_param)); if(pp == NULL) --- 999,1003 ---- plparam: TOK_PLPARAM TOK_STRING TOK_STRING { ! struct plugin_param *pp = malloc(sizeof(*pp)); if(pp == NULL) *************** *** 1021,1026 **** /* Queue */ ! pp->next = cnf->plugins->params; ! cnf->plugins->params = pp; free($2); --- 1013,1018 ---- /* Queue */ ! pp->next = olsr_cnf->plugins->params; ! olsr_cnf->plugins->params = pp; free($2); From (spam-protected) Sun Nov 4 16:27:52 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Nov 2007 15:27:52 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.40,1.41 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11076 Modified Files: Makefile.inc Log Message: * do not generate a dependency file for the generated .c file since it makes no sense Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Makefile.inc 2 Nov 2007 22:00:26 -0000 1.40 --- Makefile.inc 4 Nov 2007 15:27:50 -0000 1.41 *************** *** 201,206 **** ifeq ($(filter clean% %clean, $(MAKECMDGOALS)),) ! # include dependencies ! -include $(SRCS:%.c=%.d) endif --- 201,206 ---- ifeq ($(filter clean% %clean, $(MAKECMDGOALS)),) ! # include dependencies - we don't need any dependency for a everytime generated files ! -include $(filter-out src/builddata.%,$(SRCS:%.c=%.d)) endif From (spam-protected) Sun Nov 4 18:52:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Nov 2007 17:52:15 +0000 Subject: [Olsr-cvs] olsrd-current/src tc_set.c, 1.34, 1.35 tc_set.h, 1.20, 1.21 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1586/src Modified Files: tc_set.c tc_set.h Log Message: * cleanup: - #ifdef more away if NODEBUG is enabled. - reduce the size of the data and code Index: tc_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tc_set.h 2 Nov 2007 20:58:06 -0000 1.20 --- tc_set.h 4 Nov 2007 17:52:13 -0000 1.21 *************** *** 68,77 **** }; ! #define OLSR_TC_EDGE_DOWN (1 << 0) /* this edge is down */ /* * Garbage collection time for downed edges */ ! #define OLSR_TC_EDGE_GC_TIME 15*1000 /* milliseconds */ struct tc_entry --- 68,77 ---- }; ! #define OLSR_TC_EDGE_DOWN (1 << 0) /* this edge is down */ /* * Garbage collection time for downed edges */ ! #define OLSR_TC_EDGE_GC_TIME (15*1000) /* milliseconds */ struct tc_entry *************** *** 120,124 **** int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *); int olsr_tc_update_mprs(struct tc_entry *, struct tc_message *); ! int olsr_print_tc_table(void); void olsr_time_out_tc_set(void); --- 120,124 ---- int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *); int olsr_tc_update_mprs(struct tc_entry *, struct tc_message *); ! void olsr_print_tc_table(void); void olsr_time_out_tc_set(void); Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tc_set.c 2 Nov 2007 20:58:06 -0000 1.34 --- tc_set.c 4 Nov 2007 17:52:13 -0000 1.35 *************** *** 610,649 **** * Print the topology table to stdout */ ! int olsr_print_tc_table(void) { struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; ! char *fstr; ! ! OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------- TOPOLOGY\n\n", ! nowtm->tm_hour, ! nowtm->tm_min, ! nowtm->tm_sec, ! (int)now.tv_usec / 10000); ! if (olsr_cnf->ip_version == AF_INET) ! { ! OLSR_PRINTF(1, "Source IP addr Dest IP addr LQ ILQ ETX\n"); ! fstr = "%-15s %-15s %5.3f %5.3f %.2f\n"; ! } ! else ! { ! OLSR_PRINTF(1, "Source IP addr Dest IP addr LQ ILQ ETX\n"); ! fstr = "%-30s%-30s %5.3f %5.3f %.2f\n"; ! } OLSR_FOR_ALL_TC_ENTRIES(tc) { OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! OLSR_PRINTF(1, fstr, olsr_ip_to_string(&tc->addr), ! olsr_ip_to_string(&tc_edge->T_dest_addr), tc_edge->link_quality, tc_edge->inverse_link_quality, olsr_calc_tc_etx(tc_edge)); - } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); } OLSR_FOR_ALL_TC_ENTRIES_END(tc); ! ! return 1; } --- 610,639 ---- * Print the topology table to stdout */ ! void olsr_print_tc_table(void) { + #ifndef NODEBUG + /* The whole function makes no sense without it. */ struct tc_entry *tc; ! const int ipwidth = olsr_cnf->ip_version == AF_INET ? 15 : 30; ! OLSR_PRINTF(1, ! "\n--- %02d:%02d:%02d.%02d ------------------------------------------------- TOPOLOGY\n\n" ! "%-*s %-*s %-5s %-5s %s\n", ! nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec, (int)now.tv_usec / 10000, ! ipwidth, "Source IP addr", ipwidth, "Dest IP addr", "LQ", "ILQ", "ETX"); OLSR_FOR_ALL_TC_ENTRIES(tc) { + struct tc_edge_entry *tc_edge; OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! OLSR_PRINTF(1, "%-*s %-*s %5.3f %5.3f %.2f\n", ! ipwidth, olsr_ip_to_string(&tc->addr), ! ipwidth, olsr_ip_to_string(&tc_edge->T_dest_addr), tc_edge->link_quality, tc_edge->inverse_link_quality, olsr_calc_tc_etx(tc_edge)); } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); } OLSR_FOR_ALL_TC_ENTRIES_END(tc); ! #endif } From (spam-protected) Sun Nov 4 19:45:32 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Nov 2007 18:45:32 +0000 Subject: [Olsr-cvs] olsrd-current gcc-warnings,1.4,1.5 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23270 Modified Files: gcc-warnings Log Message: * also check -m Index: gcc-warnings =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gcc-warnings,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gcc-warnings 13 Oct 2007 14:51:32 -0000 1.4 --- gcc-warnings 4 Nov 2007 18:45:30 -0000 1.5 *************** *** 12,17 **** for param; do case "$param" in ! -[fW]?*) OPTS="$OPTS $param";; ! *) echo "Ignoring $param" >&2 esac done --- 12,17 ---- for param; do case "$param" in ! -[fWm]?*) OPTS="$OPTS $param";; ! *) echo "Ignoring $param" >&2 esac done From (spam-protected) Sun Nov 4 20:07:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Nov 2007 19:07:45 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser local.mk, NONE, 1.1 Makefile, 1.30, 1.31 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30743/src/cfgparser Modified Files: Makefile Added Files: local.mk Log Message: * added a TMPFILES variable. Place all files there which should be removed on a "clean" (which are usually temporary files - thus the name). * Killed the recursive make of the src/cfgparser directory - extracted the directory-local dependencies etc. into src/cfgparser/local.mk src/cfgparser/Makefile retains all of the rest to build in the local directory. Does actually anyone need that? - include'ing that in Makefile - removed all special handling/casing of cfgparser parts in Makefile * cleanup: plugin rules are now all more similar Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/Makefile,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Makefile 17 Sep 2007 21:44:15 -0000 1.30 --- Makefile 4 Nov 2007 19:07:43 -0000 1.31 *************** *** 42,47 **** include $(TOPDIR)/Makefile.inc ! SRCS = olsrd_conf.c oparse.c oscan.c cfgfile_gen.c ! HDRS = olsrd_conf.h oparse.h ifeq ($(OS), win32) --- 42,50 ---- include $(TOPDIR)/Makefile.inc ! # delete the variables from above ! SRCS = ! HDRS = ! ! include local.mk ifeq ($(OS), win32) *************** *** 83,87 **** --- 86,92 ---- endif + .PHONY: install clean uberclean + # Targets default_target: $(NAME) *************** *** 89,113 **** $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS) - oscan.c: oscan.lex Makefile - $(FLEX) -Cem -ooscan.c-tmp oscan.lex - sed -e '/^static/s/yy_get_next_buffer[\(][\)]/yy_get_next_buffer(void)/' \ - -e '/^static/s/yy_get_previous_state[\(][\)]/yy_get_previous_state(void)/' \ - -e '/^static/s/yygrowstack[\(][\)]/yygrowstack(void)/' \ - -e '/^static/s/input[\(][\)]/input(void)/' \ - -e '/^static *void *yy_fatal_error/s/^\(.*)\);$$/\1 __attribute__((noreturn));/' \ - -e '/^#line/s/$(subst .,\.,$@-tmp)/$@/' \ - < oscan.c-tmp >oscan.c - $(RM) oscan.c-tmp - - oscan.o: CFLAGS := $(filter-out -Wunreachable-code -Wsign-compare, $(CFLAGS)) -Wno-sign-compare - - oparse.c: oparse.y olsrd_conf.h Makefile - $(BISON) -d -o oparse.c oparse.y - - oparse.o: CFLAGS := $(filter-out -Wunreachable-code, $(CFLAGS)) - - - .PHONY: install clean uberclean - install: install -D -m 755 $(NAME) $(LIBDIR)/$(NAME) --- 94,97 ---- *************** *** 115,123 **** clean: ! rm -f *.[od~] oscan.c oparse.[ch] ! rm -f $(LIBNAME) ! rm -f $(BINNAME) ! $(RM) oparse.c-tmp uberclean: clean - rm -f oparse.c oparse.h oscan.c --- 99,103 ---- clean: ! rm -f *.[od~] $(LIBNAME) $(BINNAME) $(TMPFILES) uberclean: clean --- NEW FILE: local.mk --- (This appears to be a binary file; contents omitted.) From (spam-protected) Sun Nov 4 20:07:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Nov 2007 19:07:45 +0000 Subject: [Olsr-cvs] olsrd-current Makefile,1.102,1.103 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30743 Modified Files: Makefile Log Message: * added a TMPFILES variable. Place all files there which should be removed on a "clean" (which are usually temporary files - thus the name). * Killed the recursive make of the src/cfgparser directory - extracted the directory-local dependencies etc. into src/cfgparser/local.mk src/cfgparser/Makefile retains all of the rest to build in the local directory. Does actually anyone need that? - include'ing that in Makefile - removed all special handling/casing of cfgparser parts in Makefile * cleanup: plugin rules are now all more similar Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** Makefile 2 Nov 2007 10:11:43 -0000 1.102 --- Makefile 4 Nov 2007 19:07:43 -0000 1.103 *************** *** 54,74 **** SWITCHDIR = src/olsr_switch CFGDIR = src/cfgparser ! CFGOBJS = $(CFGDIR)/oscan.o $(CFGDIR)/oparse.o $(CFGDIR)/olsrd_conf.o ! CFGDEPS = $(wildcard $(CFGDIR)/*.[ch]) $(CFGDIR)/oparse.y $(CFGDIR)/oscan.lex TAG_SRCS = $(SRCS) $(HDRS) $(wildcard $(CFGDIR)/*.[ch] $(SWITCHDIR)/*.[ch]) default_target: cfgparser $(EXENAME) ! $(EXENAME): $(OBJS) $(CFGOBJS) src/builddata.o $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - cfgparser: $(CFGDEPS) - $(MAKECMD) -C $(CFGDIR) - switch: ! $(MAKECMD) -C $(SWITCHDIR) ! ! $(CFGOBJS): ! $(MAKECMD) -C $(CFGDIR) # generate it always --- 54,68 ---- SWITCHDIR = src/olsr_switch CFGDIR = src/cfgparser ! include $(CFGDIR)/local.mk TAG_SRCS = $(SRCS) $(HDRS) $(wildcard $(CFGDIR)/*.[ch] $(SWITCHDIR)/*.[ch]) + .PHONY: default_target cfgparser switch default_target: cfgparser $(EXENAME) ! $(EXENAME): $(OBJS) src/builddata.o $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) switch: ! $(MAKECMD) -C $(SWITCHDIR) # generate it always *************** *** 85,100 **** clean: ! -rm -f $(OBJS) $(SRCS:%.c=%.d) $(EXENAME) $(EXENAME).exe src/builddata.c ifeq ($(OS), win32) ! -rm -f libolsrd.a endif - $(MAKECMD) -C $(CFGDIR) clean uberclean: clean clean_libs ! -rm -f $(TAGFILE) ! # BSD-xargs has no "--no-run-if-empty" aka "-r" ! find . \( -name '*.[od]' -o -name '*~' \) -print0 | xargs -0 rm -f ! $(MAKECMD) -C $(CFGDIR) uberclean ! $(MAKECMD) -C $(SWITCHDIR) clean install: install_olsrd --- 79,92 ---- clean: ! -rm -f $(OBJS) $(SRCS:%.c=%.d) $(EXENAME) $(EXENAME).exe src/builddata.c $(TMPFILES) ifeq ($(OS), win32) ! -rm -f libolsrd.a endif uberclean: clean clean_libs ! -rm -f $(TAGFILE) ! # BSD-xargs has no "--no-run-if-empty" aka "-r" ! find . \( -name '*.[od]' -o -name '*~' \) -print0 | xargs -0 rm -f ! $(MAKECMD) -C $(SWITCHDIR) clean install: install_olsrd *************** *** 155,166 **** --- 147,161 ---- tas: $(MAKECMD) -C lib/tas clean + $(MAKECMD) -C lib/tas $(MAKECMD) -C lib/tas DESTDIR=$(DESTDIR) install dot_draw: $(MAKECMD) -C lib/dot_draw clean + $(MAKECMD) -C lib/dot_draw $(MAKECMD) -C lib/dot_draw DESTDIR=$(DESTDIR) install nameservice: $(MAKECMD) -C lib/nameservice clean + $(MAKECMD) -C lib/nameservice $(MAKECMD) -C lib/nameservice DESTDIR=$(DESTDIR) install *************** *** 196,200 **** ! build_all: all cfgparser $(EXENAME) switch libs install_all: install install_libs clean_all: uberclean clean_libs --- 191,195 ---- ! build_all: all $(EXENAME) switch libs install_all: install install_libs clean_all: uberclean clean_libs From (spam-protected) Mon Nov 5 00:34:59 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 04 Nov 2007 23:34:59 +0000 Subject: [Olsr-cvs] olsrd-current Makefile,1.103,1.104 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6896 Modified Files: Makefile Log Message: * removed left-over target Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** Makefile 4 Nov 2007 19:07:43 -0000 1.103 --- Makefile 4 Nov 2007 23:34:57 -0000 1.104 *************** *** 57,62 **** TAG_SRCS = $(SRCS) $(HDRS) $(wildcard $(CFGDIR)/*.[ch] $(SWITCHDIR)/*.[ch]) ! .PHONY: default_target cfgparser switch ! default_target: cfgparser $(EXENAME) $(EXENAME): $(OBJS) src/builddata.o --- 57,62 ---- TAG_SRCS = $(SRCS) $(HDRS) $(wildcard $(CFGDIR)/*.[ch] $(SWITCHDIR)/*.[ch]) ! .PHONY: default_target switch ! default_target: $(EXENAME) $(EXENAME): $(OBJS) src/builddata.o From (spam-protected) Mon Nov 5 16:32:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Nov 2007 15:32:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c, 1.13, 1.14 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7211/lib/txtinfo/src Modified Files: olsrd_txtinfo.c Log Message: Cleanup: * Merged "struct hna4_entry" and "struct hna6_entry" into "struct local_hna_entry" (as "struct hna_entry" is a different thing) Both have almost the same data (IP address + netmask/prefix) so we use the quite new "struct olsr_ip_prefix" to store it. Also merged the "hna4" and "hna6" pointer in "struct olsr_config" - look at the global "olsr_cnf->ip_version". * const'ified here and there * added a olsr_ip_prefix_to_string() function Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** olsrd_txtinfo.c 2 Nov 2007 20:58:07 -0000 1.13 --- olsrd_txtinfo.c 5 Nov 2007 15:32:55 -0000 1.14 *************** *** 402,407 **** struct hna_entry *tmp_hna; struct hna_net *tmp_net; ! struct hna4_entry *hna4; ! struct hna6_entry *hna6; size = 0; --- 402,406 ---- struct hna_entry *tmp_hna; struct hna_net *tmp_net; ! struct local_hna_entry *hna; size = 0; *************** *** 410,424 **** /* Announced HNA entries */ ! for(hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next) { ! ipc_sendf("%s\t%s\t%s\n", ! olsr_ip_to_string(&hna4->net), ! olsr_ip_to_string(&hna4->netmask), ! olsr_ip_to_string(&olsr_cnf->main_addr)); ! } ! for(hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next) { ! ipc_sendf("%s\t%d\t%s\n", ! olsr_ip_to_string(&hna6->net), ! hna6->prefix_len, ! olsr_ip_to_string(&olsr_cnf->main_addr)); } --- 409,428 ---- /* Announced HNA entries */ ! if (olsr_cnf->ip_version == AF_INET) { ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ! union olsr_ip_addr netmask; ! olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! ipc_sendf("%s\t%s\t%s\n", ! olsr_ip_to_string(&hna->net.prefix), ! olsr_ip_to_string(&netmask), ! olsr_ip_to_string(&olsr_cnf->main_addr)); ! } ! } else { ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ! ipc_sendf("%s\t%d\t%s\n", ! olsr_ip_to_string(&hna->net.prefix), ! hna->net.prefix_len, ! olsr_ip_to_string(&olsr_cnf->main_addr)); ! } } From (spam-protected) Mon Nov 5 16:32:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Nov 2007 15:32:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.81, 1.82 admin_interface.c, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7211/lib/httpinfo/src Modified Files: olsrd_httpinfo.c admin_interface.c Log Message: Cleanup: * Merged "struct hna4_entry" and "struct hna6_entry" into "struct local_hna_entry" (as "struct hna_entry" is a different thing) Both have almost the same data (IP address + netmask/prefix) so we use the quite new "struct olsr_ip_prefix" to store it. Also merged the "hna4" and "hna6" pointer in "struct olsr_config" - look at the global "olsr_cnf->ip_version". * const'ified here and there * added a olsr_ip_prefix_to_string() function Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** olsrd_httpinfo.c 2 Nov 2007 20:58:07 -0000 1.81 --- olsrd_httpinfo.c 5 Nov 2007 15:32:55 -0000 1.82 *************** *** 844,856 **** size += snprintf(&buf[size], bufsize-size, "LQ winsize: %d\n", olsr_cnf->lq_wsize); } - size += snprintf(&buf[size], bufsize-size, "\n"); size += snprintf(&buf[size], bufsize-size, "

Interfaces

\n"); - - size += snprintf(&buf[size], bufsize-size, "\n"); - - for(ifs = olsr_cnf->interfaces; ifs; ifs = ifs->next) { --- 844,851 ---- *************** *** 866,878 **** if(olsr_cnf->ip_version == AF_INET) { ! size += snprintf(&buf[size], bufsize-size, "\n", ! sockaddr_to_string(&rifs->int_addr)); ! size += snprintf(&buf[size], bufsize-size, "\n", ! sockaddr_to_string(&rifs->int_netmask)); ! size += snprintf(&buf[size], bufsize-size, "\n", ! sockaddr_to_string(&rifs->int_broadaddr)); ! size += snprintf(&buf[size], bufsize-size, "\n", rifs->int_mtu); ! size += snprintf(&buf[size], bufsize-size, "\n", rifs->is_wireless ? "Yes" : "No"); ! size += snprintf(&buf[size], bufsize-size, "\n"); } else --- 861,867 ---- if(olsr_cnf->ip_version == AF_INET) { ! size += snprintf(&buf[size], bufsize-size, "\n", sockaddr_to_string(&rifs->int_addr)); ! size += snprintf(&buf[size], bufsize-size, "\n", sockaddr_to_string(&rifs->int_netmask)); ! size += snprintf(&buf[size], bufsize-size, "\n", sockaddr_to_string(&rifs->int_broadaddr)); } else *************** *** 881,953 **** size += snprintf(&buf[size], bufsize-size, "\n", olsr_ip_to_string((union olsr_ip_addr *)&rifs->int6_multaddr.sin6_addr)); size += snprintf(&buf[size], bufsize-size, "\n"); - size += snprintf(&buf[size], bufsize-size, "\n", rifs->int_mtu); - size += snprintf(&buf[size], bufsize-size, "\n", rifs->is_wireless ? "Yes" : "No"); - size += snprintf(&buf[size], bufsize-size, "\n"); } } - size += snprintf(&buf[size], bufsize-size, "
IP: %sMASK: %sBCAST: %s
MTU: %dWLAN: %sSTATUS: UP
IP: %sMASK: %sBCAST: %s
MCAST: %s
MTU: %dWLAN: %sSTATUS: UP
\n"); ! if(olsr_cnf->allow_no_interfaces) ! size += snprintf(&buf[size], bufsize-size, "Olsrd is configured to run even if no interfaces are available
\n"); ! else ! size += snprintf(&buf[size], bufsize-size, "Olsrd is configured to halt if no interfaces are available
\n"); size += snprintf(&buf[size], bufsize-size, "

Plugins

\n"); - size += snprintf(&buf[size], bufsize-size, "\n"); - for(pentry = olsr_cnf->plugins; pentry; pentry = pentry->next) { ! size += snprintf(&buf[size], bufsize-size, "\n", pentry->name); ! ! size += snprintf(&buf[size], bufsize-size, "\n"); } - size += snprintf(&buf[size], bufsize-size, "
NameParameters
%s
\n"); size += section_title(&buf[size], bufsize-size, "Announced HNA entries"); ! ! if((olsr_cnf->ip_version == AF_INET) && (olsr_cnf->hna4_entries)) ! { ! struct hna4_entry *hna4; ! ! size += snprintf(&buf[size], bufsize-size, ! "NetworkNetmask\n"); ! ! for(hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next) ! { ! size += snprintf(&buf[size], bufsize-size, "%s%s\n", ! olsr_ip_to_string(&hna4->net), ! olsr_ip_to_string(&hna4->netmask)); ! } ! } ! else if((olsr_cnf->ip_version == AF_INET6) && (olsr_cnf->hna6_entries)) ! { ! struct hna6_entry *hna6; ! ! size += snprintf(&buf[size], bufsize-size, ! "NetworkPrefix length\n"); ! ! for(hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next) ! { ! size += snprintf(&buf[size], bufsize-size, "%s%d\n", ! olsr_ip_to_string(&hna6->net), ! hna6->prefix_len); ! } ! } size += snprintf(&buf[size], bufsize-size, "\n"); - return size; } --- 870,927 ---- size += snprintf(&buf[size], bufsize-size, "MCAST: %s\n", olsr_ip_to_string((union olsr_ip_addr *)&rifs->int6_multaddr.sin6_addr)); size += snprintf(&buf[size], bufsize-size, "\n"); } + size += snprintf(&buf[size], bufsize-size, "MTU: %d\n", rifs->int_mtu); + size += snprintf(&buf[size], bufsize-size, "WLAN: %s\n", rifs->is_wireless ? "Yes" : "No"); + size += snprintf(&buf[size], bufsize-size, "STATUS: UP\n"); } size += snprintf(&buf[size], bufsize-size, "\n"); ! size += snprintf(&buf[size], bufsize-size, ! "Olsrd is configured to %s if no interfaces are available
\n", ! olsr_cnf->allow_no_interfaces ? "run even" : "halt"); size += snprintf(&buf[size], bufsize-size, "

Plugins

\n"); size += snprintf(&buf[size], bufsize-size, "\n"); for(pentry = olsr_cnf->plugins; pentry; pentry = pentry->next) { ! size += snprintf(&buf[size], bufsize-size, ! "\n" ! "\n"); } size += snprintf(&buf[size], bufsize-size, "
NameParameters
%s
\n"); size += section_title(&buf[size], bufsize-size, "Announced HNA entries"); ! if(olsr_cnf->hna_entries) { ! struct local_hna_entry *hna; ! if(olsr_cnf->ip_version == AF_INET) { ! size += snprintf(&buf[size], bufsize-size, "NetworkNetmask\n"); ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ! union olsr_ip_addr netmask; ! olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! size += snprintf(&buf[size], bufsize-size, ! "%s%s\n", ! olsr_ip_to_string(&hna->net.prefix), ! olsr_ip_to_string(&netmask)); ! } ! } else { ! size += snprintf(&buf[size], bufsize-size, "NetworkPrefix length\n"); ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ! size += snprintf(&buf[size], bufsize-size, ! "%s%d\n", ! olsr_ip_to_string(&hna->net.prefix), ! hna->net.prefix_len); ! } } + } size += snprintf(&buf[size], bufsize-size, "\n"); return size; } Index: admin_interface.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/admin_interface.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** admin_interface.c 20 Oct 2007 20:41:04 -0000 1.10 --- admin_interface.c 5 Nov 2007 15:32:55 -0000 1.11 *************** *** 78,83 **** "TOS:", "tos", 6, "TBD"); ! size += snprintf(&buf[size], bufsize-size, "\n"); ! size += snprintf(&buf[size], bufsize-size, "\n"); size += snprintf(&buf[size], bufsize-size, admin_basic_setting_int, --- 78,83 ---- "TOS:", "tos", 6, "TBD"); ! size += snprintf(&buf[size], bufsize-size, "\n" ! "\n"); size += snprintf(&buf[size], bufsize-size, admin_basic_setting_int, *************** *** 121,146 **** size += snprintf(&buf[size], bufsize-size, admin_frame_mid); ! if(olsr_cnf->ip_version == AF_INET) { ! struct hna4_entry *hna4; ! for(hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next) { ! const char * const net = olsr_ip_to_string((union olsr_ip_addr *)&hna4->net); ! const char * const mask = olsr_ip_to_string((union olsr_ip_addr *)&hna4->netmask); ! size += snprintf(&buf[size], bufsize-size, ! "%s%s\n", ! net, ! mask, ! net, ! mask); ! } ! } else { ! struct hna6_entry *hna6; ! for(hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next) { ! const char * const net = olsr_ip_to_string((union olsr_ip_addr *)&hna6->net); ! size += snprintf(&buf[size], bufsize-size, ! "%s%d\n", ! net, ! hna6->prefix_len, ! net, ! hna6->prefix_len); } } --- 121,144 ---- size += snprintf(&buf[size], bufsize-size, admin_frame_mid); ! if(olsr_cnf->hna_entries) { ! if(olsr_cnf->ip_version == AF_INET) { ! struct local_hna_entry *hna; ! ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ! union olsr_ip_addr netmask; ! olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! size += snprintf(&buf[size], bufsize-size, ! "%1$s%2$s\n", ! olsr_ip_to_string(&hna->net.prefix), ! olsr_ip_to_string(&netmask)); ! } ! } else { ! struct local_hna_entry *hna; ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ! size += snprintf(&buf[size], bufsize-size, ! "%1$s%2$d\n", ! olsr_ip_to_string(&hna->net.prefix), ! hna->net.prefix_len); ! } } } From (spam-protected) Mon Nov 5 16:32:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Nov 2007 15:32:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.h, 1.14, 1.15 nameservice.c, 1.33, 1.34 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7211/lib/nameservice/src Modified Files: nameservice.h nameservice.c Log Message: Cleanup: * Merged "struct hna4_entry" and "struct hna6_entry" into "struct local_hna_entry" (as "struct hna_entry" is a different thing) Both have almost the same data (IP address + netmask/prefix) so we use the quite new "struct olsr_ip_prefix" to store it. Also merged the "hna4" and "hna6" pointer in "struct olsr_config" - look at the global "olsr_cnf->ip_version". * const'ified here and there * added a olsr_ip_prefix_to_string() function Index: nameservice.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** nameservice.h 5 Oct 2007 20:24:47 -0000 1.14 --- nameservice.h 5 Nov 2007 15:32:55 -0000 1.15 *************** *** 139,143 **** olsr_bool ! allowed_hostname_or_ip_in_service(char *service_line, regmatch_t *hostname_or_ip); void --- 139,143 ---- olsr_bool ! allowed_hostname_or_ip_in_service(const char *service_line, const regmatch_t *hostname_or_ip); void *************** *** 160,179 **** olsr_bool ! 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); olsr_bool ! is_service_wellformed(char *service_line); olsr_bool ! is_latlon_wellformed(char *latlon_line); olsr_bool --- 160,179 ---- olsr_bool ! allowed_ip(const union olsr_ip_addr *addr); olsr_bool ! allowed_service(const char *service_line); olsr_bool ! is_name_wellformed(const char *service_line); olsr_bool ! is_service_wellformed(const char *service_line); olsr_bool ! is_service_wellformed(const char *service_line); olsr_bool ! is_latlon_wellformed(const char *latlon_line); olsr_bool Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** nameservice.c 2 Nov 2007 20:58:07 -0000 1.33 --- nameservice.c 5 Nov 2007 15:32:55 -0000 1.34 *************** *** 1239,1246 **** */ olsr_bool ! allowed_ip(union olsr_ip_addr *addr) { ! struct hna4_entry *hna4; ! struct hna6_entry *hna6; struct interface *iface; union olsr_ip_addr tmp_ip, tmp_msk; --- 1239,1245 ---- */ olsr_bool ! allowed_ip(const union olsr_ip_addr *addr) { ! struct local_hna_entry *hna; struct interface *iface; union olsr_ip_addr tmp_ip, tmp_msk; *************** *** 1258,1269 **** if (olsr_cnf->ip_version == AF_INET) { ! for (hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next) { ! OLSR_PRINTF(6, "HNA %s/%s\n", ! olsr_ip_to_string(&hna4->net), ! olsr_ip_to_string(&hna4->netmask)); ! ! if ( hna4->netmask.v4 != 0 && ! (addr->v4 & hna4->netmask.v4) == hna4->net.v4 ) { OLSR_PRINTF(6, "MATCHED\n"); return OLSR_TRUE; --- 1257,1271 ---- if (olsr_cnf->ip_version == AF_INET) { ! for (hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ! union olsr_ip_addr netmask; ! OLSR_PRINTF(6, "HNA %s/%d\n", ! olsr_ip_to_string(&hna->net.prefix), ! hna->net.prefix_len); ! if ( hna->net.prefix_len == 0 ) ! continue; ! ! olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! if ((addr->v4 & netmask.v4) == hna->net.prefix.v4) { OLSR_PRINTF(6, "MATCHED\n"); return OLSR_TRUE; *************** *** 1271,1289 **** } } else { ! int i; ! ! for (hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next) { OLSR_PRINTF(6, "HNA %s/%d\n", ! olsr_ip_to_string(&hna6->net), ! hna6->prefix_len); ! if ( hna6->prefix_len == 0 ) continue; ! olsr_prefix_to_netmask(&tmp_msk, hna6->prefix_len); for (i = 0; i < 16; i++) { ! tmp_ip.v6.s6_addr[i] = addr->v6.s6_addr[i] & ! tmp_msk.v6.s6_addr[i]; } ! if (COMP_IP(&tmp_ip, &hna6->net)) { OLSR_PRINTF(6, "MATCHED\n"); return OLSR_TRUE; --- 1273,1289 ---- } } else { ! for (hna = olsr_cnf->hna_entries; hna; hna = hna->next) { + int i; OLSR_PRINTF(6, "HNA %s/%d\n", ! olsr_ip_to_string(&hna->net.prefix), ! hna->net.prefix_len); ! if ( hna->net.prefix_len == 0 ) continue; ! olsr_prefix_to_netmask(&tmp_msk, hna->net.prefix_len); for (i = 0; i < 16; i++) { ! tmp_ip.v6.s6_addr[i] = addr->v6.s6_addr[i] & tmp_msk.v6.s6_addr[i]; } ! if (COMP_IP(&tmp_ip, &hna->net)) { OLSR_PRINTF(6, "MATCHED\n"); return OLSR_TRUE; *************** *** 1299,1303 **** */ olsr_bool ! is_name_wellformed(char *name) { return regexec(®ex_t_name, name, 1, ®match_t_name, 0) == 0 ; } --- 1299,1303 ---- */ olsr_bool ! is_name_wellformed(const char *name) { return regexec(®ex_t_name, name, 1, ®match_t_name, 0) == 0 ; } *************** *** 1309,1313 **** */ olsr_bool ! allowed_service(char *service_line) { /* the call of is_service_wellformed generates the submatches stored in regmatch_t_service --- 1309,1313 ---- */ olsr_bool ! allowed_service(const char *service_line) { /* the call of is_service_wellformed generates the submatches stored in regmatch_t_service *************** *** 1324,1328 **** olsr_bool ! allowed_hostname_or_ip_in_service(char *service_line, regmatch_t *hostname_or_ip_match) { char *hostname_or_ip; --- 1324,1328 ---- olsr_bool ! allowed_hostname_or_ip_in_service(const char *service_line, const regmatch_t *hostname_or_ip_match) { char *hostname_or_ip; *************** *** 1367,1371 **** */ olsr_bool ! is_service_wellformed(char *service_line) { return regexec(®ex_t_service, service_line, pmatch_service, regmatch_t_service, 0) == 0; --- 1367,1371 ---- */ olsr_bool ! is_service_wellformed(const char *service_line) { return regexec(®ex_t_service, service_line, pmatch_service, regmatch_t_service, 0) == 0; *************** *** 1376,1380 **** */ olsr_bool ! is_latlon_wellformed(char *latlon_line) { int hna = -1; --- 1376,1380 ---- */ olsr_bool ! is_latlon_wellformed(const char *latlon_line) { int hna = -1; *************** *** 1389,1410 **** olsr_bool get_isdefhna_latlon(void) { ! olsr_bool ret = OLSR_FALSE; ! if (AF_INET == olsr_cnf->ip_version) ! { ! struct hna4_entry *hna4; ! for(hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next) ! { ! if (0 == hna4->netmask.v4) ret = OLSR_TRUE; ! } ! } ! else { ! struct hna6_entry *hna6; ! for(hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next) ! { ! if (0 == hna6->prefix_len) ret = OLSR_TRUE; ! } } ! return ret; } --- 1389,1400 ---- olsr_bool get_isdefhna_latlon(void) { ! struct local_hna_entry *hna; ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ! if (0 == hna->net.prefix_len) { ! return OLSR_TRUE; ! } } ! return OLSR_FALSE; } From (spam-protected) Mon Nov 5 16:32:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Nov 2007 15:32:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.29, 1.30 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7211/lib/dot_draw/src Modified Files: olsrd_dot_draw.c Log Message: Cleanup: * Merged "struct hna4_entry" and "struct hna6_entry" into "struct local_hna_entry" (as "struct hna_entry" is a different thing) Both have almost the same data (IP address + netmask/prefix) so we use the quite new "struct olsr_ip_prefix" to store it. Also merged the "hna4" and "hna6" pointer in "struct olsr_config" - look at the global "olsr_cnf->ip_version". * const'ified here and there * added a olsr_ip_prefix_to_string() function Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** olsrd_dot_draw.c 3 Nov 2007 23:11:40 -0000 1.29 --- olsrd_dot_draw.c 5 Nov 2007 15:32:55 -0000 1.30 *************** *** 90,94 **** static char* ! olsr_netmask_to_string(union hna_netmask *mask); /* Event function to register with the sceduler */ --- 90,94 ---- static char* ! olsr_netmask_to_string(const union hna_netmask *mask); /* Event function to register with the sceduler */ *************** *** 100,110 **** static void ! ipc_print_neigh_link(struct neighbor_entry *neighbor); static void ! ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry); static void ! ipc_print_net(union olsr_ip_addr *, union olsr_ip_addr *, union hna_netmask *); static int --- 100,110 ---- static void ! ipc_print_neigh_link(const struct neighbor_entry *neighbor); static void ! ipc_print_tc_link(const struct tc_entry *entry, const struct tc_edge_entry *dst_entry); static void ! ipc_print_net(const union olsr_ip_addr *, const union olsr_ip_addr *, const union hna_netmask *); static int *************** *** 151,155 **** static void ! ipc_print_neigh_link(struct neighbor_entry *neighbor) { char buf[256]; --- 151,155 ---- static void ! ipc_print_neigh_link(const struct neighbor_entry *neighbor) { char buf[256]; *************** *** 297,305 **** struct tc_entry *tc; struct tc_edge_entry *tc_edge; - struct hna_entry *tmp_hna; - struct hna_net *tmp_net; - struct hna4_entry *hna4; - struct hna6_entry *hna6; - union hna_netmask hna_msk; res = 0; --- 297,300 ---- *************** *** 331,379 **** /* HNA entries */ ! for(index=0;indexnetworks.next; ! ! while(tmp_net != &tmp_hna->networks) ! { ipc_print_net(&tmp_hna->A_gateway_addr, &tmp_net->A_network_addr, &tmp_net->A_netmask); ! tmp_net = tmp_net->next; ! } ! ! tmp_hna = tmp_hna->next; ! } ! } /* Local HNA entries */ ! if (olsr_cnf->ip_version == AF_INET) ! { ! hna4 = olsr_cnf->hna4_entries; ! while(hna4) ! { ! hna_msk.v4 = hna4->netmask.v4; ! ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, ! &hna4->net, ! &hna_msk); ! hna4 = hna4->next; ! } ! } ! else ! { ! hna6 = olsr_cnf->hna6_entries; ! while(hna6) ! { ! hna_msk.v6 = hna6->prefix_len; ! ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, ! &hna6->net, ! &hna_msk); ! hna6 = hna6->next; ! } } --- 326,366 ---- /* HNA entries */ ! for(index=0;indexnext) { /* Check all networks */ ! struct hna_net *tmp_net; ! for (tmp_net = tmp_hna->networks.next; tmp_net != &tmp_hna->networks; tmp_net = tmp_net->next) { ipc_print_net(&tmp_hna->A_gateway_addr, &tmp_net->A_network_addr, &tmp_net->A_netmask); ! } ! } ! } /* Local HNA entries */ ! if (olsr_cnf->ip_version == AF_INET) { ! struct local_hna_entry *hna; ! for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { ! union olsr_ip_addr netmask; ! union hna_netmask hna_msk; ! //hna_msk.v4 = hna4->netmask.v4; ! olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! hna_msk.v4 = netmask.v4; ! ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, ! &hna->net.prefix, ! &hna_msk); ! ! } ! } else { ! struct local_hna_entry *hna; ! for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { ! union hna_netmask hna_msk; ! hna_msk.v6 = hna->net.prefix_len; ! ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, ! &hna->net.prefix, ! &hna_msk); ! } } *************** *** 391,395 **** static void ! ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry) { char buf[256]; --- 378,382 ---- static void ! ipc_print_tc_link(const struct tc_entry *entry, const struct tc_edge_entry *dst_entry) { char buf[256]; *************** *** 404,408 **** static void ! ipc_print_net(union olsr_ip_addr *gw, union olsr_ip_addr *net, union hna_netmask *mask) { const char *adr; --- 391,395 ---- static void ! ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, const union hna_netmask *mask) { const char *adr; *************** *** 460,481 **** static char* ! olsr_netmask_to_string(union hna_netmask *mask) { char *ret; struct in_addr in; ! if(olsr_cnf->ip_version == AF_INET) ! { in.s_addr = mask->v4; ret = inet_ntoa(in); ! } ! else ! { /* IPv6 */ static char netmask[5]; sprintf(netmask, "%d", mask->v6); ret = netmask; ! } ! return ret; } --- 447,464 ---- static char* ! olsr_netmask_to_string(const union hna_netmask *mask) { char *ret; struct in_addr in; ! if(olsr_cnf->ip_version == AF_INET) { in.s_addr = mask->v4; ret = inet_ntoa(in); ! } else { /* IPv6 */ static char netmask[5]; sprintf(netmask, "%d", mask->v6); ret = netmask; ! } return ret; } From (spam-protected) Mon Nov 5 16:32:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Nov 2007 15:32:57 +0000 Subject: [Olsr-cvs] olsrd-current/src olsr_cfg.h, 1.36, 1.37 net_olsr.h, 1.13, 1.14 net_olsr.c, 1.30, 1.31 lq_route.c, 1.55, 1.56 local_hna_set.h, 1.11, 1.12 local_hna_set.c, 1.14, 1.15 ipc_frontend.c, 1.36, 1.37 build_msg.c, 1.36, 1.37 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7211/src Modified Files: olsr_cfg.h net_olsr.h net_olsr.c lq_route.c local_hna_set.h local_hna_set.c ipc_frontend.c build_msg.c Log Message: Cleanup: * Merged "struct hna4_entry" and "struct hna6_entry" into "struct local_hna_entry" (as "struct hna_entry" is a different thing) Both have almost the same data (IP address + netmask/prefix) so we use the quite new "struct olsr_ip_prefix" to store it. Also merged the "hna4" and "hna6" pointer in "struct olsr_config" - look at the global "olsr_cnf->ip_version". * const'ified here and there * added a olsr_ip_prefix_to_string() function Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** lq_route.c 20 Oct 2007 15:16:32 -0000 1.55 --- lq_route.c 5 Nov 2007 15:32:55 -0000 1.56 *************** *** 134,138 **** olsr_ip_to_string(&(vert->addr)), vert->path_etx, ! olsr_ip_to_string(vert->next_hop ? &vert->next_hop->neighbor_iface_addr : NULL)); #endif --- 134,138 ---- olsr_ip_to_string(&(vert->addr)), vert->path_etx, ! vert->next_hop ? olsr_ip_to_string(&vert->next_hop->neighbor_iface_addr) : "-"); #endif *************** *** 149,155 **** olsr_spf_extract_best (struct avl_tree *tree) { ! struct avl_node *node; ! ! node = avl_walk_first(tree); return (node ? node->data : NULL); --- 149,153 ---- olsr_spf_extract_best (struct avl_tree *tree) { ! struct avl_node *node = avl_walk_first(tree); return (node ? node->data : NULL); *************** *** 164,168 **** return "INF"; ! snprintf(buff, 20, "%.6f", etx); return buff; } --- 162,166 ---- return "INF"; ! snprintf(buff, sizeof(buff), "%.6f", etx); return buff; } Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** net_olsr.h 16 Sep 2007 21:20:16 -0000 1.13 --- net_olsr.h 5 Nov 2007 15:32:55 -0000 1.14 *************** *** 104,107 **** --- 104,110 ---- olsr_ip_to_string(const union olsr_ip_addr *); + const char * + olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix); + int add_ptf(packet_transform_function); Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** olsr_cfg.h 3 Nov 2007 23:21:27 -0000 1.36 --- olsr_cfg.h 5 Nov 2007 15:32:55 -0000 1.37 *************** *** 147,162 **** }; ! struct hna4_entry ! { ! union olsr_ip_addr net; ! union olsr_ip_addr netmask; ! struct hna4_entry *next; ! }; ! ! struct hna6_entry { ! union olsr_ip_addr net; ! olsr_u16_t prefix_len; ! struct hna6_entry *next; }; --- 147,154 ---- }; ! struct local_hna_entry { ! struct olsr_ip_prefix net; ! struct local_hna_entry *next; }; *************** *** 225,230 **** float lq_dinter; struct plugin_entry *plugins; ! struct hna4_entry *hna4_entries; ! struct hna6_entry *hna6_entries; struct ipc_host *ipc_hosts; struct ipc_net *ipc_nets; --- 217,221 ---- float lq_dinter; struct plugin_entry *plugins; ! struct local_hna_entry *hna_entries; struct ipc_host *ipc_hosts; struct ipc_net *ipc_nets; Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** net_olsr.c 16 Sep 2007 21:20:16 -0000 1.30 --- net_olsr.c 5 Nov 2007 15:32:55 -0000 1.31 *************** *** 463,483 **** */ int ! olsr_prefix_to_netmask(union olsr_ip_addr *adr, olsr_u16_t prefix) { ! int p, i; ! if(adr == NULL) return 0; ! p = prefix; ! i = 0; ! ! memset(adr, 0, olsr_cnf->ipsize); ! ! for(;p > 0; p -= 8) ! { ! adr->v6.s6_addr[i] = (p < 8) ? 0xff ^ (0xff >> p) : 0xff; ! i++; ! } #ifdef DEBUG --- 463,483 ---- */ int ! olsr_prefix_to_netmask(union olsr_ip_addr *adr, const olsr_u16_t prefix) { ! int p; ! olsr_u8_t *a; ! if(adr == NULL) { return 0; + } ! a = adr->v6.s6_addr; ! for (p = prefix; p > 8; p -= 8) { ! *a++ = 0xff; ! } ! *a++ = 0xff << p; ! while (a < adr->v6.s6_addr+olsr_cnf->ipsize) { ! *a++ = 0; ! } #ifdef DEBUG *************** *** 502,523 **** olsr_u16_t prefix = 0; unsigned int i; ! prefix = 0; ! ! for(i = 0; i < olsr_cnf->ipsize; i++) ! { ! if(adr->v6.s6_addr[i] == 0xff) ! { ! prefix += 8; ! } ! else ! { ! int tmp; ! for(tmp = adr->v6.s6_addr[i]; ! tmp > 0; ! tmp = (tmp << 1) & 0xff) ! prefix++; ! } ! } #ifdef DEBUG --- 502,513 ---- olsr_u16_t prefix = 0; unsigned int i; + olsr_u8_t tmp; ! for (i = 0; i < olsr_cnf->ipsize && adr->v6.s6_addr[i] == 0xff; i++) { ! prefix += 8; ! } ! for (tmp = adr->v6.s6_addr[i]; tmp > 0; tmp <<= 1) { ! prefix++; ! } #ifdef DEBUG *************** *** 562,566 **** struct in_addr in; in.s_addr=*address; ! return(inet_ntoa(in)); } --- 552,556 ---- struct in_addr in; in.s_addr=*address; ! return inet_ntoa(in); } *************** *** 583,592 **** } - const char * olsr_ip_to_string(const union olsr_ip_addr *addr) { static int idx = 0; ! static char buff[4][INET6_ADDRSTRLEN > INET_ADDRSTRLEN ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN]; const char *ret; --- 573,581 ---- } const char * olsr_ip_to_string(const union olsr_ip_addr *addr) { static int idx = 0; ! static char buff[4][MAX(INET6_ADDRSTRLEN,INET_ADDRSTRLEN)]; const char *ret; *************** *** 595,613 **** } ! if(olsr_cnf->ip_version == AF_INET) ! { ! #if 0 ! struct in_addr in; ! in.s_addr = addr->v4; ! ret = inet_ntop(AF_INET, &in, buff[idx], sizeof(buff[idx])); ! #else ! ret = inet_ntop(AF_INET, &addr->v4, buff[idx], sizeof(buff[idx])); ! #endif ! } ! else ! { ! /* IPv6 */ ! ret = inet_ntop(AF_INET6, &addr->v6, buff[idx], sizeof(buff[idx])); ! } idx = (idx + 1) & 3; --- 584,593 ---- } ! if(olsr_cnf->ip_version == AF_INET) { ! ret = inet_ntop(AF_INET, &addr->v4, buff[idx], sizeof(buff[idx])); ! } else { ! /* IPv6 */ ! ret = inet_ntop(AF_INET6, &addr->v6, buff[idx], sizeof(buff[idx])); ! } idx = (idx + 1) & 3; *************** *** 615,618 **** --- 595,628 ---- } + const char * + olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix) + { + /* We need for IPv6 an IP address + '/' + prefix and for IPv4 an IP address + '/' + a netmask */ + static char buf[MAX(INET6_ADDRSTRLEN + 1 + 3, INET_ADDRSTRLEN + 1 + INET_ADDRSTRLEN)]; + const char *rv; + + if (prefix == NULL) { + return "null"; + } + + if(olsr_cnf->ip_version == AF_INET) { + int len; + union olsr_ip_addr netmask; + rv = inet_ntop(AF_INET, &prefix->prefix.v4, buf, sizeof(buf)); + len = strlen(buf); + buf[len++] = '/'; + olsr_prefix_to_netmask(&netmask, prefix->prefix_len); + inet_ntop(AF_INET, &netmask.v4, buf+len, sizeof(buf)-len); + } else { + int len; + /* IPv6 */ + rv = inet_ntop(AF_INET6, &prefix->prefix.v6, buf, sizeof(buf)); + len = strlen(buf); + buf[len++] = '/'; + snprintf(buf+len, sizeof(buf)-len, "/%d", prefix->prefix_len); + } + return rv; + } + void *************** *** 646,661 **** const struct deny_address_entry *deny_entry = deny_entries; ! while(deny_entry) ! { ! if(COMP_IP(adr, &deny_entry->addr)) ! { ! OLSR_PRINTF(1, "Validation of address %s failed!\n", ! olsr_ip_to_string(adr)); ! return OLSR_FALSE; ! } ! ! deny_entry = deny_entry->next; } return OLSR_TRUE; } --- 656,669 ---- const struct deny_address_entry *deny_entry = deny_entries; ! while (deny_entry) { ! if (COMP_IP(adr, &deny_entry->addr)) { ! OLSR_PRINTF(1, "Validation of address %s failed!\n", ! olsr_ip_to_string(adr)); ! return OLSR_FALSE; } + deny_entry = deny_entry->next; + } + return OLSR_TRUE; } Index: local_hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/local_hna_set.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** local_hna_set.c 15 Oct 2007 20:58:33 -0000 1.14 --- local_hna_set.c 5 Nov 2007 15:32:55 -0000 1.15 *************** *** 47,60 **** add_local_hna4_entry(const union olsr_ip_addr *net, const union olsr_ip_addr *mask) { ! struct hna4_entry *new_entry; ! ! new_entry = olsr_malloc(sizeof(struct hna4_entry), "Add local HNA entry 4"); ! new_entry->net.v4 = net->v4; ! new_entry->netmask.v4 = mask->v4; /* Queue */ ! new_entry->next = olsr_cnf->hna4_entries; ! olsr_cnf->hna4_entries = new_entry; } --- 47,58 ---- add_local_hna4_entry(const union olsr_ip_addr *net, const union olsr_ip_addr *mask) { ! struct local_hna_entry *new_entry = olsr_malloc(sizeof(struct local_hna_entry), "Add local HNA entry 4"); ! new_entry->net.prefix.v4 = net->v4; ! new_entry->net.prefix_len = olsr_netmask_to_prefix(mask); /* Queue */ ! new_entry->next = olsr_cnf->hna_entries; ! olsr_cnf->hna_entries = new_entry; } *************** *** 63,76 **** add_local_hna6_entry(const union olsr_ip_addr *net, const olsr_u16_t prefix_len) { ! struct hna6_entry *new_entry; ! ! new_entry = olsr_malloc(sizeof(struct hna6_entry), "Add local HNA entry 6"); memcpy(&new_entry->net, net, sizeof(struct in6_addr)); ! new_entry->prefix_len = prefix_len; /* Queue */ ! new_entry->next = olsr_cnf->hna6_entries; ! olsr_cnf->hna6_entries = new_entry; } --- 61,72 ---- add_local_hna6_entry(const union olsr_ip_addr *net, const olsr_u16_t prefix_len) { ! struct local_hna_entry *new_entry = olsr_malloc(sizeof(struct local_hna_entry), "Add local HNA entry 6"); memcpy(&new_entry->net, net, sizeof(struct in6_addr)); ! new_entry->net.prefix_len = prefix_len; /* Queue */ ! new_entry->next = olsr_cnf->hna_entries; ! olsr_cnf->hna_entries = new_entry; } *************** *** 79,100 **** remove_local_hna4_entry(const union olsr_ip_addr *net, const union olsr_ip_addr *mask) { ! struct hna4_entry *h4 = olsr_cnf->hna4_entries, *h4prev = NULL; ! while(h4) { ! if((net->v4 == h4->net.v4) && ! (mask->v4 == h4->netmask.v4)) { /* Dequeue */ ! if(h4prev == NULL) ! olsr_cnf->hna4_entries = h4->next; else ! h4prev->next = h4->next; ! free(h4); return 1; } ! h4prev = h4; ! h4 = h4->next; } --- 75,97 ---- remove_local_hna4_entry(const union olsr_ip_addr *net, const union olsr_ip_addr *mask) { ! struct local_hna_entry *h = olsr_cnf->hna_entries, *prev = NULL; ! const olsr_u16_t prefix_len = olsr_netmask_to_prefix(mask); ! while(h) { ! if((net->v4 == h->net.prefix.v4) && ! (mask->v4 == prefix_len)) { /* Dequeue */ ! if(prev == NULL) ! olsr_cnf->hna_entries = h->next; else ! prev->next = h->next; ! free(h); return 1; } ! prev = h; ! h = h->next; } *************** *** 107,144 **** remove_local_hna6_entry(const union olsr_ip_addr *net, const olsr_u16_t prefix_len) { ! struct hna6_entry *h6, *h6prev = NULL; ! for(h6 = olsr_cnf->hna6_entries; h6; h6 = h6->next) { ! if((memcmp(net, &h6->net, olsr_cnf->ipsize) == 0) && ! (prefix_len == h6->prefix_len)) { /* Dequeue */ ! if(h6prev == NULL) ! olsr_cnf->hna6_entries = h6->next; else ! h6prev->next = h6->next; ! ! free(h6); return 1; } ! h6prev = h6; } return 0; } ! struct hna4_entry * find_local_hna4_entry(const union olsr_ip_addr *net, const 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; } --- 104,142 ---- remove_local_hna6_entry(const union olsr_ip_addr *net, const olsr_u16_t prefix_len) { ! struct local_hna_entry *h = olsr_cnf->hna_entries, *prev = NULL; ! while (h) { ! if((memcmp(net, &h->net.prefix, olsr_cnf->ipsize) == 0) && ! (prefix_len == h->net.prefix_len)) { /* Dequeue */ ! if (prev == NULL) ! olsr_cnf->hna_entries = h->next; else ! prev->next = h->next; ! free(h); return 1; } ! prev = h; ! h = h->next; } return 0; } ! struct local_hna_entry * find_local_hna4_entry(const union olsr_ip_addr *net, const olsr_u32_t mask) { ! struct local_hna_entry *h = olsr_cnf->hna_entries; ! const union olsr_ip_addr ip_addr = { .v4 = mask }; ! const olsr_u16_t prefix_len = olsr_netmask_to_prefix(&ip_addr); ! while(h) { ! if((net->v4 == h->net.prefix.v4) && ! (prefix_len == h->net.prefix_len)) { ! return h; } ! h = h->next; } *************** *** 148,164 **** ! struct hna6_entry * find_local_hna6_entry(const union olsr_ip_addr *net, const 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; } --- 146,161 ---- ! struct local_hna_entry * find_local_hna6_entry(const union olsr_ip_addr *net, const olsr_u16_t prefix_len) { ! struct local_hna_entry *h = olsr_cnf->hna_entries; ! while(h) { ! if((memcmp(net, &h->net.prefix, olsr_cnf->ipsize) == 0) && ! (prefix_len == h->net.prefix_len)) { ! return h; } ! h = h->next; } *************** *** 174,181 **** if(olsr_cnf->ip_version == AF_INET) { ! struct hna4_entry *h4; ! for(h4 = olsr_cnf->hna4_entries; h4; h4 = h4->next) { ! if(h4->netmask.v4 == 0 && h4->net.v4 == 0) return 1; } --- 171,178 ---- if(olsr_cnf->ip_version == AF_INET) { ! struct local_hna_entry *h; ! for(h = olsr_cnf->hna_entries; h != NULL; h = h->next) { ! if(h->net.prefix_len == 0 && h->net.prefix.v4 == 0) return 1; } Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ipc_frontend.c 13 Oct 2007 12:31:04 -0000 1.36 --- ipc_frontend.c 5 Nov 2007 15:32:55 -0000 1.37 *************** *** 409,427 **** /* HNAs */ ! if(olsr_cnf->ip_version == AF_INET6) ! { ! if(olsr_cnf->hna6_entries == NULL) ! net_msg->hnas = 0; ! else ! net_msg->hnas = 1; ! } ! ! if(olsr_cnf->ip_version == AF_INET) ! { ! if(olsr_cnf->hna4_entries == NULL) ! net_msg->hnas = 0; ! else ! net_msg->hnas = 1; ! } /* Different values */ --- 409,413 ---- /* HNAs */ ! net_msg->hnas = olsr_cnf->hna_entries == NULL ? 0 : 1; /* Different values */ *************** *** 434,441 **** net_msg->topology_hold = 0;//htons((olsr_u16_t)topology_hold_time); ! if(olsr_cnf->ip_version == AF_INET) ! net_msg->ipv6 = 0; ! else ! net_msg->ipv6 = 1; /* Main addr */ --- 420,424 ---- net_msg->topology_hold = 0;//htons((olsr_u16_t)topology_hold_time); ! net_msg->ipv6 = olsr_cnf->ip_version == AF_INET ? 0 : 1; /* Main addr */ Index: build_msg.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** build_msg.c 25 Apr 2007 22:08:07 -0000 1.36 --- build_msg.c 5 Nov 2007 15:32:55 -0000 1.37 *************** *** 1041,1045 **** union olsr_message *m; struct hnapair *pair; ! struct hna4_entry *h = olsr_cnf->hna4_entries; /* No hna nets */ --- 1041,1045 ---- union olsr_message *m; struct hnapair *pair; ! struct local_hna_entry *h = olsr_cnf->hna_entries; /* No hna nets */ *************** *** 1074,1077 **** --- 1074,1078 ---- while(h) { + union olsr_ip_addr ip_addr; if((curr_size + (2 * olsr_cnf->ipsize)) > remainsize) { *************** *** 1093,1102 **** } #ifdef DEBUG ! OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s/%s\n", ! olsr_ip_to_string(&h->net), ! olsr_ip_to_string(&h->netmask)); #endif ! COPY_IP(&pair->addr, &h->net); ! COPY_IP(&pair->netmask, &h->netmask); pair++; curr_size += (2 * olsr_cnf->ipsize); --- 1094,1102 ---- } #ifdef DEBUG ! OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net)); #endif ! COPY_IP(&pair->addr, &h->net.prefix); ! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! pair->addr = ip_addr.v4; pair++; curr_size += (2 * olsr_cnf->ipsize); *************** *** 1131,1135 **** struct hnapair6 *pair6; union olsr_ip_addr tmp_netmask; ! struct hna6_entry *h = olsr_cnf->hna6_entries; /* No hna nets */ --- 1131,1135 ---- struct hnapair6 *pair6; union olsr_ip_addr tmp_netmask; ! struct local_hna_entry *h = olsr_cnf->hna_entries; /* No hna nets */ *************** *** 1183,1192 **** } #ifdef DEBUG ! OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s/%d\n", ! olsr_ip_to_string(&h->net), ! h->prefix_len); #endif ! COPY_IP(&pair6->addr, &h->net); ! olsr_prefix_to_netmask(&tmp_netmask, h->prefix_len); COPY_IP(&pair6->netmask, &tmp_netmask); pair6++; --- 1183,1190 ---- } #ifdef DEBUG ! OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net)); #endif ! COPY_IP(&pair6->addr, &h->net.prefix); ! olsr_prefix_to_netmask(&tmp_netmask, h->net.prefix_len); COPY_IP(&pair6->netmask, &tmp_netmask); pair6++; Index: local_hna_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/local_hna_set.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** local_hna_set.h 15 Oct 2007 20:58:33 -0000 1.11 --- local_hna_set.h 5 Nov 2007 15:32:55 -0000 1.12 *************** *** 59,66 **** remove_local_hna6_entry(const union olsr_ip_addr *, const olsr_u16_t); ! struct hna4_entry * find_local_hna4_entry(const union olsr_ip_addr *net, const olsr_u32_t mask); ! struct hna6_entry * find_local_hna6_entry(const union olsr_ip_addr *net, const olsr_u16_t prefix_len); --- 59,66 ---- remove_local_hna6_entry(const union olsr_ip_addr *, const olsr_u16_t); ! struct local_hna_entry * find_local_hna4_entry(const union olsr_ip_addr *net, const olsr_u32_t mask); ! struct local_hna_entry * find_local_hna6_entry(const union olsr_ip_addr *net, const olsr_u16_t prefix_len); From (spam-protected) Mon Nov 5 16:32:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Nov 2007 15:32:57 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser oparse.y, 1.35, 1.36 olsrd_conf.c, 1.59, 1.60 cfgfile_gen.c, 1.9, 1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7211/src/cfgparser Modified Files: oparse.y olsrd_conf.c cfgfile_gen.c Log Message: Cleanup: * Merged "struct hna4_entry" and "struct hna6_entry" into "struct local_hna_entry" (as "struct hna_entry" is a different thing) Both have almost the same data (IP address + netmask/prefix) so we use the quite new "struct olsr_ip_prefix" to store it. Also merged the "hna4" and "hna6" pointer in "struct olsr_config" - look at the global "olsr_cnf->ip_version". * const'ified here and there * added a olsr_ip_prefix_to_string() function Index: oparse.y =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** oparse.y 3 Nov 2007 23:21:27 -0000 1.35 --- oparse.y 5 Nov 2007 15:32:54 -0000 1.36 *************** *** 12,16 **** * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. ! * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the --- 12,16 ---- * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. ! * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the *************** *** 24,28 **** * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ! * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; --- 24,28 ---- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ! * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *************** *** 698,703 **** ihna4entry: TOK_IP4_ADDR TOK_IP4_ADDR { ! struct hna4_entry *h = malloc(sizeof(*h)); struct in_addr in; PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string); --- 698,704 ---- ihna4entry: TOK_IP4_ADDR TOK_IP4_ADDR { ! struct local_hna_entry *h = malloc(sizeof(*h)); struct in_addr in; + union olsr_ip_addr ip_addr; PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string); *************** *** 714,728 **** return -1; } ! h->net.v4 = in.s_addr; if(inet_aton($2->string, &in) == 0) { ! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); return -1; } ! h->netmask.v4 = in.s_addr; ! h->net.v4 &= h->netmask.v4; /* Queue */ ! h->next = olsr_cnf->hna4_entries; ! olsr_cnf->hna4_entries = h; free($1->string); --- 715,732 ---- return -1; } ! h->net.prefix.v4 = in.s_addr; if(inet_aton($2->string, &in) == 0) { ! fprintf(stderr, "ihna4entry: Failed converting IP netmask %s\n", $2->string); return -1; } ! ip_addr.v4 = in.s_addr; ! h->net.prefix_len = olsr_netmask_to_prefix(&ip_addr); ! /* Do we really want to following? */ ! h->net.prefix.v4 &= in.s_addr; ! /* Queue */ ! h->next = olsr_cnf->hna_entries; ! olsr_cnf->hna_entries = h; free($1->string); *************** *** 736,741 **** ihna6entry: TOK_IP6_ADDR TOK_INTEGER { ! struct hna6_entry *h = malloc(sizeof(*h)); ! struct in6_addr in6; PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", $1->string, $2->integer); --- 740,744 ---- ihna6entry: TOK_IP6_ADDR TOK_INTEGER { ! struct local_hna_entry *h = malloc(sizeof(*h)); PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", $1->string, $2->integer); *************** *** 747,756 **** } ! if(inet_pton(AF_INET6, $1->string, &in6) < 0) { fprintf(stderr, "ihna6entry: Failed converting IP address %s\n", $1->string); return -1; } - h->net.v6 = in6; if($2->integer > 128) --- 750,758 ---- } ! if(inet_pton(AF_INET6, $1->string, &h->net.prefix.v6) < 0) { fprintf(stderr, "ihna6entry: Failed converting IP address %s\n", $1->string); return -1; } if($2->integer > 128) *************** *** 760,767 **** } ! h->prefix_len = $2->integer; /* Queue */ ! h->next = olsr_cnf->hna6_entries; ! olsr_cnf->hna6_entries = h; free($1->string); --- 762,770 ---- } ! h->net.prefix_len = $2->integer; ! /* Queue */ ! h->next = olsr_cnf->hna_entries; ! olsr_cnf->hna_entries = h; free($1->string); Index: olsrd_conf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** olsrd_conf.c 3 Nov 2007 23:21:27 -0000 1.59 --- olsrd_conf.c 5 Nov 2007 15:32:54 -0000 1.60 *************** *** 361,382 **** olsrd_free_cnf(struct olsrd_config *cnf) { ! struct hna4_entry *h4d, *h4 = cnf->hna4_entries; ! struct hna6_entry *h6d, *h6 = cnf->hna6_entries; struct olsr_if *ind, *in = cnf->interfaces; struct plugin_entry *ped, *pe = cnf->plugins; struct olsr_lq_mult *mult, *next_mult; ! while(h4) ! { ! h4d = h4; ! h4 = h4->next; ! free(h4d); ! } ! ! while(h6) { ! h6d = h6; ! h6 = h6->next; ! free(h6d); } --- 361,374 ---- olsrd_free_cnf(struct olsrd_config *cnf) { ! struct local_hna_entry *hd, *h = cnf->hna_entries; struct olsr_if *ind, *in = cnf->interfaces; struct plugin_entry *ped, *pe = cnf->plugins; struct olsr_lq_mult *mult, *next_mult; ! while(h) { ! hd = h; ! h = h->next; ! free(hd); } *************** *** 522,527 **** olsrd_print_cnf(struct olsrd_config *cnf) { ! struct hna4_entry *h4 = cnf->hna4_entries; ! struct hna6_entry *h6 = cnf->hna6_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; --- 514,518 ---- olsrd_print_cnf(struct olsrd_config *cnf) { ! struct local_hna_entry *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; *************** *** 648,686 **** /* Hysteresis */ ! if(cnf->use_hysteresis) ! { ! printf("Using hysteresis:\n"); ! printf("\tScaling : %0.2f\n", cnf->hysteresis_param.scaling); ! printf("\tThr high/low : %0.2f/%0.2f\n", cnf->hysteresis_param.thr_high, cnf->hysteresis_param.thr_low); ! } ! else printf("Not using hysteresis\n"); ! /* HNA IPv4 */ ! if(h4) ! { ! ! printf("HNA4 entries:\n"); ! while(h4) ! { ! in4.s_addr = h4->net.v4; ! printf("\t%s/", inet_ntoa(in4)); ! in4.s_addr = h4->netmask.v4; ! printf("%s\n", inet_ntoa(in4)); ! ! h4 = h4->next; ! } ! } ! ! /* HNA IPv6 */ ! if(h6) ! { ! printf("HNA6 entries:\n"); ! while(h6) ! { ! printf("\t%s/%d\n", (char *)inet_ntop(AF_INET6, &h6->net.v6, ipv6_buf, sizeof(ipv6_buf)), h6->prefix_len); ! h6 = h6->next; ! } } } --- 639,665 ---- /* Hysteresis */ ! if(cnf->use_hysteresis) { ! printf("Using hysteresis:\n"); ! printf("\tScaling : %0.2f\n", cnf->hysteresis_param.scaling); ! printf("\tThr high/low : %0.2f/%0.2f\n", cnf->hysteresis_param.thr_high, cnf->hysteresis_param.thr_low); ! } else { printf("Not using hysteresis\n"); + } ! /* HNA IPv4 and IPv6 */ ! if(h) { ! printf("HNA%d entries:\n", cnf->ip_version == AF_INET ? 4 : 6); ! while(h) { ! printf("\t%s/", olsr_ip_to_string(&h->net.prefix)); ! if (cnf->ip_version == AF_INET) { ! union olsr_ip_addr ip; ! olsr_prefix_to_netmask(&ip, h->net.prefix_len); ! printf("%s\n", olsr_ip_to_string(&ip)); ! } else { ! printf("%d\n", h->net.prefix_len); ! } ! h = h->next; } + } } Index: cfgfile_gen.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/cfgfile_gen.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** cfgfile_gen.c 15 Oct 2007 21:01:17 -0000 1.9 --- cfgfile_gen.c 5 Nov 2007 15:32:54 -0000 1.10 *************** *** 49,52 **** --- 49,53 ---- #include "olsrd_conf.h" + #include "net_olsr.h" *************** *** 54,59 **** olsrd_write_cnf(struct olsrd_config *cnf, const char *fname) { ! struct hna4_entry *h4 = cnf->hna4_entries; ! struct hna6_entry *h6 = cnf->hna6_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; --- 55,59 ---- olsrd_write_cnf(struct olsrd_config *cnf, const char *fname) { ! struct local_hna_entry *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; *************** *** 84,114 **** /* IP version */ ! if(cnf->ip_version == AF_INET6) ! fprintf(fd, "# IP version to use (4 or 6)\n\nIpVersion\t6\n\n"); ! else ! fprintf(fd, "# IP version to use (4 or 6)\n\nIpVersion\t4\n\n"); ! /* HNA IPv4 */ ! fprintf(fd, "# HNA IPv4 routes\n# syntax: netaddr netmask\n\nHna4\n{\n"); ! while(h4) ! { ! in4.s_addr = h4->net.v4; ! fprintf(fd, " %s ", inet_ntoa(in4)); ! in4.s_addr = h4->netmask.v4; ! fprintf(fd, "%s\n", inet_ntoa(in4)); ! h4 = h4->next; ! } ! fprintf(fd, "}\n\n"); ! ! ! /* HNA IPv6 */ ! fprintf(fd, "# HNA IPv6 routes\n# syntax: netaddr prefix\n\nHna6\n{\n"); ! while(h6) { ! fprintf(fd, " %s/%d\n", (char *)inet_ntop(AF_INET6, &h6->net.v6, ipv6_buf, sizeof(ipv6_buf)), h6->prefix_len); ! h6 = h6->next; } - fprintf(fd, "}\n\n"); --- 84,103 ---- /* IP version */ ! fprintf(fd, "# IP version to use (4 or 6)\n\nIpVersion\t%d\n\n", cnf->ip_version == AF_INET ? 4 : 6); /* HNA IPv4 */ ! fprintf(fd, "# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6); ! while(h) { ! fprintf(fd, " %s ", olsr_ip_to_string(&h->net.prefix)); ! if (cnf->ip_version == AF_INET) { ! union olsr_ip_addr ip_addr; ! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! fprintf(fd, "%s\n", olsr_ip_to_string(&ip_addr)); ! } else { ! fprintf(fd, "%d\n", h->net.prefix_len); ! } ! h = h->next; } fprintf(fd, "}\n\n"); *************** *** 373,378 **** olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize) { ! struct hna4_entry *h4 = cnf->hna4_entries; ! struct hna6_entry *h6 = cnf->hna6_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; --- 362,366 ---- olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize) { ! struct local_hna_entry *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; *************** *** 401,430 **** /* IP version */ ! if(cnf->ip_version == AF_INET6) ! WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t6\n\n"); ! else ! WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t4\n\n"); /* HNA IPv4 */ ! WRITE_TO_BUF("# HNA IPv4 routes\n# syntax: netaddr netmask\n\nHna4\n{\n"); ! while(h4) ! { ! in4.s_addr = h4->net.v4; ! WRITE_TO_BUF(" %s ", inet_ntoa(in4)); ! in4.s_addr = h4->netmask.v4; ! WRITE_TO_BUF("%s\n", inet_ntoa(in4)); ! h4 = h4->next; ! } ! WRITE_TO_BUF("}\n\n"); ! ! ! /* HNA IPv6 */ ! WRITE_TO_BUF("# HNA IPv6 routes\n# syntax: netaddr prefix\n\nHna6\n{\n"); ! while(h6) { ! WRITE_TO_BUF(" %s/%d\n", (char *)inet_ntop(AF_INET6, &h6->net.v6, ipv6_buf, sizeof(ipv6_buf)), h6->prefix_len); ! h6 = h6->next; } - WRITE_TO_BUF("}\n\n"); --- 389,408 ---- /* IP version */ ! WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t%d\n\n", cnf->ip_version == AF_INET ? 4 : 6); /* HNA IPv4 */ ! WRITE_TO_BUF("# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna%1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6); ! while(h) { ! WRITE_TO_BUF(" %s ", olsr_ip_to_string(&h->net.prefix)); ! if (cnf->ip_version == AF_INET) { ! union olsr_ip_addr ip_addr; ! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! WRITE_TO_BUF("%s\n", olsr_ip_to_string(&ip_addr)); ! } else { ! WRITE_TO_BUF("%d\n", h->net.prefix_len); ! } ! h = h->next; } WRITE_TO_BUF("}\n\n"); From (spam-protected) Mon Nov 5 16:34:39 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 05 Nov 2007 15:34:39 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.110,1.111 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10899 Modified Files: CHANGELOG Log Message: and an entry here Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** CHANGELOG 3 Nov 2007 23:21:28 -0000 1.110 --- CHANGELOG 5 Nov 2007 15:34:37 -0000 1.111 *************** *** 46,49 **** --- 46,56 ---- "cnf" variable" but uses a local one which is returned as before. And olsrd_parse_cnf() does no longer return the global variable it is working on. + - Merged "struct hna4_entry" and "struct hna6_entry" into + "struct local_hna_entry" (as "struct hna_entry" is a different thing) + Both have almost the same data (IP address + netmask/prefix) so we use + the quite new "struct olsr_ip_prefix" to store it. + Also merged the "hna4" and "hna6" pointer in "struct olsr_config" - + look at the global "olsr_cnf->ip_version". + - added a olsr_ip_prefix_to_string() function 0.5.4 --------------------------------------------------------------------- From (spam-protected) Thu Nov 8 16:28:50 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 15:28:50 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf Makefile,1.5,1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10581/lib/bmf Modified Files: Makefile Log Message: * s/-lpthread/$(OS_LIB_PTHREAD)/ Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 15 Jul 2007 21:50:45 -0000 1.5 --- Makefile 8 Nov 2007 15:28:48 -0000 1.6 *************** *** 40,44 **** include $(TOPDIR)/Makefile.inc ! LIBS += -lpthread ifneq ($(OS),linux) --- 40,44 ---- include $(TOPDIR)/Makefile.inc ! LIBS += $(OS_LIB_PTHREAD) ifneq ($(OS),linux) From (spam-protected) Thu Nov 8 16:34:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 15:34:13 +0000 Subject: [Olsr-cvs] olsrd-current/src duplicate_set.c,1.17,1.18 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13015/src Modified Files: duplicate_set.c Log Message: * killed a superflous variable Index: duplicate_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/duplicate_set.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** duplicate_set.c 21 Oct 2007 20:15:51 -0000 1.17 --- duplicate_set.c 8 Nov 2007 15:34:11 -0000 1.18 *************** *** 50,55 **** static struct dup_entry dup_set[HASHSIZE]; - static float dup_hold_time = DUP_HOLD_TIME; - /** *Initialize the duplicate table entrys --- 50,53 ---- *************** *** 103,107 **** new_dup_entry->seqno = seqno; /* Set timer */ ! new_dup_entry->timer = GET_TIMESTAMP(dup_hold_time*1000); /* Interfaces */ new_dup_entry->ifaces = NULL; --- 101,105 ---- new_dup_entry->seqno = seqno; /* Set timer */ ! new_dup_entry->timer = GET_TIMESTAMP(DUP_HOLD_TIME*1000); /* Interfaces */ new_dup_entry->ifaces = NULL; *************** *** 293,297 **** /* Set timer */ ! tmp_dup_table->timer = GET_TIMESTAMP(dup_hold_time*1000); return 1; --- 291,295 ---- /* Set timer */ ! tmp_dup_table->timer = GET_TIMESTAMP(DUP_HOLD_TIME*1000); return 1; *************** *** 332,336 **** /* Set timer */ ! tmp_dup_table->timer = GET_TIMESTAMP(dup_hold_time*1000); return 1; --- 330,334 ---- /* Set timer */ ! tmp_dup_table->timer = GET_TIMESTAMP(DUP_HOLD_TIME*1000); return 1; From (spam-protected) Thu Nov 8 23:17:11 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:17:11 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser Makefile,1.31,1.32 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18313/src/cfgparser Modified Files: Makefile Log Message: * use automatic variables Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/Makefile,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Makefile 4 Nov 2007 19:07:43 -0000 1.31 --- Makefile 8 Nov 2007 22:17:08 -0000 1.32 *************** *** 92,96 **** $(NAME): $(OBJS) ! $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS) install: --- 92,96 ---- $(NAME): $(OBJS) ! $(CC) $(LDFLAGS) -o "$@" $^ $(LIBS) install: From (spam-protected) Thu Nov 8 23:47:43 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:43 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_plugin.c, 1.3, 1.4 olsrd_txtinfo.c, 1.14, 1.15 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/txtinfo/src Modified Files: olsrd_plugin.c olsrd_txtinfo.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** olsrd_txtinfo.c 5 Nov 2007 15:32:55 -0000 1.14 --- olsrd_txtinfo.c 8 Nov 2007 22:47:41 -0000 1.15 *************** *** 76,79 **** --- 76,80 ---- #include "link_set.h" #include "socket_parser.h" + #include "net_olsr.h" #include "olsrd_txtinfo.h" *************** *** 250,254 **** INET6_ADDRSTRLEN) == NULL) addr[0] = '\0'; ! if (!COMP_IP(&sin4->sin_addr, &ipc_accept_ip.v4)) { olsr_printf(1, "(TXTINFO) From host(%s) not allowed!\n", addr); close(ipc_connection); --- 251,255 ---- INET6_ADDRSTRLEN) == NULL) addr[0] = '\0'; ! if (!ip4equal(&sin4->sin_addr, &ipc_accept_ip.v4)) { olsr_printf(1, "(TXTINFO) From host(%s) not allowed!\n", addr); close(ipc_connection); *************** *** 261,266 **** addr[0] = '\0'; /* Use in6addr_any (::) in olsr.conf to allow anybody. */ ! if (!COMP_IP(&in6addr_any, &ipc_accept_ip.v6) && ! !COMP_IP(&sin6->sin6_addr, &ipc_accept_ip.v6)) { olsr_printf(1, "(TXTINFO) From host(%s) not allowed!\n", addr); close(ipc_connection); --- 262,267 ---- addr[0] = '\0'; /* Use in6addr_any (::) in olsr.conf to allow anybody. */ ! if (!ip6equal(&in6addr_any, &ipc_accept_ip.v6) && ! !ip6equal(&sin6->sin6_addr, &ipc_accept_ip.v6)) { olsr_printf(1, "(TXTINFO) From host(%s) not allowed!\n", addr); close(ipc_connection); *************** *** 297,300 **** --- 298,302 ---- static void ipc_print_neigh_link(void) { + struct ipaddr_str buf; struct neighbor_entry *neigh; struct neighbor_2_list_entry *list_2; *************** *** 308,313 **** while(link) { ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%d\t%d\t%0.2f\t%0.2f\t\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, --- 310,315 ---- while(link) { ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%d\t%d\t%0.2f\t%0.2f\t\n", ! olsr_ip_to_string(&buf, &link->local_iface_addr), ! olsr_ip_to_string(&buf, &link->neighbor_iface_addr), link->L_link_quality, link->loss_link_quality, *************** *** 326,330 **** neigh = neigh->next) { ipc_sendf("%s\t%s\t%s\t%s\t%d\t", ! olsr_ip_to_string(&neigh->neighbor_main_addr), (neigh->status == SYM) ? "YES" : "NO", neigh->is_mpr ? "YES" : "NO", --- 328,332 ---- neigh = neigh->next) { ipc_sendf("%s\t%s\t%s\t%s\t%d\t", ! olsr_ip_to_string(&buf, &neigh->neighbor_main_addr), (neigh->status == SYM) ? "YES" : "NO", neigh->is_mpr ? "YES" : "NO", *************** *** 337,341 **** list_2 = list_2->next) { ! //size += sprintf(&buf[size], "\n", olsr_ip_to_string(&list_2->neighbor_2->neighbor_2_addr)); thop_cnt ++; } --- 339,343 ---- list_2 = list_2->next) { ! //size += sprintf(&buf[size], "\n", olsr_ip_to_string(&buf, &list_2->neighbor_2->neighbor_2_addr)); thop_cnt ++; } *************** *** 348,351 **** --- 350,354 ---- static void ipc_print_routes(void) { + struct ipaddr_str buf; struct rt_entry *rt; struct avl_node *rt_tree_node; *************** *** 361,371 **** ipc_sendf( "%s/%d\t%s\t%d\t%.3f\t%s\t\n", ! olsr_ip_to_string(&rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&rt->rt_best->rtp_nexthop.gateway), rt->rt_best->rtp_metric.hops, rt->rt_best->rtp_metric.etx, if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index)); - } ipc_sendf("\n"); --- 364,373 ---- ipc_sendf( "%s/%d\t%s\t%d\t%.3f\t%s\t\n", ! olsr_ip_to_string(&buf, &rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&buf, &rt->rt_best->rtp_nexthop.gateway), rt->rt_best->rtp_metric.hops, rt->rt_best->rtp_metric.etx, if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index)); } ipc_sendf("\n"); *************** *** 376,389 **** { struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; ! ipc_sendf("Table: Topology\nDestination IP\tLast hop IP\tLQ\tILQ\tETX\n"); /* Topology */ OLSR_FOR_ALL_TC_ENTRIES(tc) { OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%0.2f\n", ! olsr_ip_to_string(&tc_edge->T_dest_addr), ! olsr_ip_to_string(&tc->addr), tc_edge->link_quality, tc_edge->inverse_link_quality, --- 378,392 ---- { struct tc_entry *tc; ! ipc_sendf("Table: Topology\nDestination IP\tLast hop IP\tLQ\tILQ\tETX\n"); /* Topology */ OLSR_FOR_ALL_TC_ENTRIES(tc) { + struct tc_edge_entry *tc_edge; OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { + struct ipaddr_str dstbuf, addrbuf; ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%0.2f\n", ! olsr_ip_to_string(&dstbuf, &tc_edge->T_dest_addr), ! olsr_ip_to_string(&addrbuf, &tc->addr), tc_edge->link_quality, tc_edge->inverse_link_quality, *************** *** 399,405 **** { int size; ! olsr_u8_t index; ! struct hna_entry *tmp_hna; ! struct hna_net *tmp_net; struct local_hna_entry *hna; --- 402,406 ---- { int size; ! int index; struct local_hna_entry *hna; *************** *** 410,427 **** /* Announced HNA entries */ if (olsr_cnf->ip_version == AF_INET) { ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { union olsr_ip_addr netmask; olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ipc_sendf("%s\t%s\t%s\n", ! olsr_ip_to_string(&hna->net.prefix), ! olsr_ip_to_string(&netmask), ! olsr_ip_to_string(&olsr_cnf->main_addr)); } } else { ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { ipc_sendf("%s\t%d\t%s\n", ! olsr_ip_to_string(&hna->net.prefix), hna->net.prefix_len, ! olsr_ip_to_string(&olsr_cnf->main_addr)); } } --- 411,430 ---- /* Announced HNA entries */ if (olsr_cnf->ip_version == AF_INET) { ! for(hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { ! struct ipaddr_str addrbuf, maskbuf, mainaddrbuf; union olsr_ip_addr netmask; olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ipc_sendf("%s\t%s\t%s\n", ! olsr_ip_to_string(&addrbuf, &hna->net.prefix), ! olsr_ip_to_string(&maskbuf, &netmask), ! olsr_ip_to_string(&mainaddrbuf, &olsr_cnf->main_addr)); } } else { ! for(hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { ! struct ipaddr_str addrbuf, mainaddrbuf; ipc_sendf("%s\t%d\t%s\n", ! olsr_ip_to_string(&addrbuf, &hna->net.prefix), hna->net.prefix_len, ! olsr_ip_to_string(&mainaddrbuf, &olsr_cnf->main_addr)); } } *************** *** 429,458 **** /* HNA entries */ for(index = 0; index < HASHSIZE; index++) { ! tmp_hna = hna_set[index].next; /* Check all entrys */ ! while(tmp_hna != &hna_set[index]) { /* Check all networks */ ! tmp_net = tmp_hna->networks.next; ! ! while(tmp_net != &tmp_hna->networks) { ! if (AF_INET == olsr_cnf->ip_version) { ipc_sendf("%s\t%s\t%s\n", ! olsr_ip_to_string(&tmp_net->A_network_addr), ! olsr_ip_to_string((union olsr_ip_addr *)&tmp_net->A_netmask.v4), ! olsr_ip_to_string(&tmp_hna->A_gateway_addr)); } else { ipc_sendf("%s\t%d\t%s\n", ! olsr_ip_to_string(&tmp_net->A_network_addr), tmp_net->A_netmask.v6, ! olsr_ip_to_string(&tmp_hna->A_gateway_addr)); } ! tmp_net = tmp_net->next; ! } ! ! tmp_hna = tmp_hna->next; } } ipc_sendf("\n"); - } --- 432,459 ---- /* HNA entries */ for(index = 0; index < HASHSIZE; index++) { ! struct hna_entry *tmp_hna; /* Check all entrys */ ! for (tmp_hna = hna_set[index].next; tmp_hna != &hna_set[index]; tmp_hna = tmp_hna->next) { /* Check all networks */ ! struct hna_net *tmp_net; ! for (tmp_net = tmp_hna->networks.next; tmp_net != &tmp_hna->networks; tmp_net = tmp_net->next) { ! if (olsr_cnf->ip_version == AF_INET) { ! struct ipaddr_str addrbuf, maskbuf, mainaddrbuf; ! const union olsr_ip_addr netmask = { .v4 = { .s_addr = tmp_net->A_netmask.v4 } }; ipc_sendf("%s\t%s\t%s\n", ! olsr_ip_to_string(&addrbuf, &tmp_net->A_network_addr), ! olsr_ip_to_string(&maskbuf, &netmask), ! olsr_ip_to_string(&mainaddrbuf, &tmp_hna->A_gateway_addr)); } else { + struct ipaddr_str addrbuf, mainaddrbuf; ipc_sendf("%s\t%d\t%s\n", ! olsr_ip_to_string(&addrbuf, &tmp_net->A_network_addr), tmp_net->A_netmask.v6, ! olsr_ip_to_string(&mainaddrbuf, &tmp_hna->A_gateway_addr)); } ! } } } ipc_sendf("\n"); } *************** *** 471,475 **** while( entry != &mid_set[index] ) { ! ipc_sendf( olsr_ip_to_string( &entry->main_addr ) ); alias = entry->aliases; is_first = 1; --- 472,477 ---- while( entry != &mid_set[index] ) { ! struct ipaddr_str buf; ! ipc_sendf( olsr_ip_to_string(&buf, &entry->main_addr ) ); alias = entry->aliases; is_first = 1; *************** *** 478,482 **** ipc_sendf( "%s%s", ( is_first ? "\t" : ";" ), ! olsr_ip_to_string( &alias->alias ) ); --- 480,484 ---- ipc_sendf( "%s%s", ( is_first ? "\t" : ";" ), ! olsr_ip_to_string(&buf, &alias->alias ) ); Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_plugin.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** olsrd_plugin.c 15 Jul 2007 17:41:33 -0000 1.3 --- olsrd_plugin.c 8 Nov 2007 22:47:41 -0000 1.4 *************** *** 82,86 **** ipc_port = 2006; if (olsr_cnf->ip_version == AF_INET) { ! ipc_accept_ip.v4 = htonl(INADDR_LOOPBACK); } else { ipc_accept_ip.v6 = in6addr_loopback; --- 82,86 ---- ipc_port = 2006; if (olsr_cnf->ip_version == AF_INET) { ! ipc_accept_ip.v4.s_addr = htonl(INADDR_LOOPBACK); } else { ipc_accept_ip.v6 = in6addr_loopback; From (spam-protected) Thu Nov 8 23:47:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:44 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch main.c, 1.28, 1.29 olsr_host_switch.h, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/src/olsr_switch Modified Files: main.c olsr_host_switch.h Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: olsr_host_switch.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/olsr_host_switch.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** olsr_host_switch.h 2 Aug 2007 10:20:25 -0000 1.10 --- olsr_host_switch.h 8 Nov 2007 22:47:42 -0000 1.11 *************** *** 106,110 **** struct ohs_connection * ! get_client_by_addr(union olsr_ip_addr *); int --- 106,110 ---- struct ohs_connection * ! get_client_by_addr(const union olsr_ip_addr *); int Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/main.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** main.c 2 Aug 2007 10:20:25 -0000 1.28 --- main.c 8 Nov 2007 22:47:42 -0000 1.29 *************** *** 77,81 **** static int ip_version; int ipsize; - static char ipv6_buf[100]; /* for address coversion */ olsr_u32_t logbits; --- 77,80 ---- *************** *** 100,125 **** olsr_ip_to_string(const union olsr_ip_addr *addr) { - static int index = 0; static char buff[4][100]; ! const char *ret; ! struct in_addr in; ! ! if(ip_version == AF_INET) ! { ! in.s_addr=addr->v4; ! ret = inet_ntoa(in); ! } ! else ! { ! /* IPv6 */ ! ret = inet_ntop(AF_INET6, &addr->v6, ipv6_buf, sizeof(ipv6_buf)); ! } ! ! strncpy(buff[index], ret, 100); ! ! ret = buff[index]; ! index = (index + 1) & 3; - return ret; } --- 99,109 ---- olsr_ip_to_string(const union olsr_ip_addr *addr) { static char buff[4][100]; ! static int index = 0; ! const char *ret = inet_ntop(ip_version, ! ip_version == AF_INET ? (const void *)&addr->v4 : (const void *)&addr->v6, ! buff[index], ! sizeof(buff[index])); index = (index + 1) & 3; return ret; } *************** *** 142,146 **** struct ohs_connection * ! get_client_by_addr(union olsr_ip_addr *adr) { struct ohs_connection *oc = ohs_conns; --- 126,130 ---- struct ohs_connection * ! get_client_by_addr(const union olsr_ip_addr *adr) { struct ohs_connection *oc = ohs_conns; *************** *** 160,164 **** { struct ohs_connection *oc; ! olsr_u8_t new_addr[4]; int i; --- 144,148 ---- { struct ohs_connection *oc; ! olsr_u32_t new_addr; int i; *************** *** 187,191 **** for (i = 0; i < 20; i++) { ! if (recv(oc->socket, new_addr, 4, 0) == 4) break; --- 171,175 ---- for (i = 0; i < 20; i++) { ! if (recv(oc->socket, &new_addr, sizeof(new_addr), 0) == 4) break; *************** *** 201,206 **** } ! memcpy(&oc->ip_addr, new_addr, 4); ! oc->ip_addr.v4 = ntohl(oc->ip_addr.v4); if(logbits & LOG_CONNECT) printf("IP: %s\n", olsr_ip_to_string(&oc->ip_addr)); --- 185,189 ---- } ! oc->ip_addr.v4.s_addr = ntohl(new_addr); if(logbits & LOG_CONNECT) printf("IP: %s\n", olsr_ip_to_string(&oc->ip_addr)); *************** *** 277,281 **** if(logbits & LOG_FORWARD) ! printf("Received %d bytes from %s\n", (int)len, olsr_ip_to_string(&oc->ip_addr)); /* Loop trough clients */ --- 260,264 ---- if(logbits & LOG_FORWARD) ! printf("Received %ld bytes from %s\n", (long)len, olsr_ip_to_string(&oc->ip_addr)); /* Loop trough clients */ From (spam-protected) Thu Nov 8 23:47:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:45 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 ifnet.c,1.38,1.39 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/src/win32 Modified Files: ifnet.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/ifnet.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** ifnet.c 13 May 2007 22:23:55 -0000 1.38 --- ifnet.c 8 Nov 2007 22:47:43 -0000 1.39 *************** *** 535,539 **** } ! if(COMP_IP(&olsr_cnf->main_addr, &Int->ip_addr)) { if(ifnet == NULL) --- 535,539 ---- } ! if(ipequal(&olsr_cnf->main_addr, &Int->ip_addr)) { if(ifnet == NULL) *************** *** 631,635 **** memset(&null_addr, 0, olsr_cnf->ipsize); ! if(COMP_IP(&null_addr, &olsr_cnf->main_addr)) { COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip); --- 631,635 ---- memset(&null_addr, 0, olsr_cnf->ipsize); ! if(ipequal(&null_addr, &olsr_cnf->main_addr)) { COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip); *************** *** 1035,1039 **** memset(&NullAddr, 0, olsr_cnf->ipsize); ! if(COMP_IP(&NullAddr, &olsr_cnf->main_addr)) { COPY_IP(&olsr_cnf->main_addr, &New->ip_addr); --- 1035,1039 ---- memset(&NullAddr, 0, olsr_cnf->ipsize); ! if(ipequal(&NullAddr, &olsr_cnf->main_addr)) { COPY_IP(&olsr_cnf->main_addr, &New->ip_addr); From (spam-protected) Thu Nov 8 23:47:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:44 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c, 1.10, 1.11 olsrd_conf.c, 1.60, 1.61 oparse.y, 1.36, 1.37 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/src/cfgparser Modified Files: cfgfile_gen.c olsrd_conf.c oparse.y Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: cfgfile_gen.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/cfgfile_gen.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** cfgfile_gen.c 5 Nov 2007 15:32:54 -0000 1.10 --- cfgfile_gen.c 8 Nov 2007 22:47:42 -0000 1.11 *************** *** 64,68 **** char ipv6_buf[100]; /* buffer for IPv6 inet_htop */ - struct in_addr in4; FILE *fd; --- 64,67 ---- *************** *** 88,103 **** /* HNA IPv4 */ fprintf(fd, "# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6); ! while(h) ! { ! fprintf(fd, " %s ", olsr_ip_to_string(&h->net.prefix)); ! if (cnf->ip_version == AF_INET) { ! union olsr_ip_addr ip_addr; ! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! fprintf(fd, "%s\n", olsr_ip_to_string(&ip_addr)); ! } else { ! fprintf(fd, "%d\n", h->net.prefix_len); ! } ! h = h->next; } fprintf(fd, "}\n\n"); --- 87,102 ---- /* HNA IPv4 */ fprintf(fd, "# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6); ! while(h) { ! struct ipaddr_str buf; ! fprintf(fd, " %s ", olsr_ip_to_string(&buf, &h->net.prefix)); ! if (cnf->ip_version == AF_INET) { ! union olsr_ip_addr ip_addr; ! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! fprintf(fd, "%s\n", olsr_ip_to_string(&buf, &ip_addr)); ! } else { ! fprintf(fd, "%d\n", h->net.prefix_len); } + h = h->next; + } fprintf(fd, "}\n\n"); *************** *** 131,144 **** while(ih) { ! in4.s_addr = ih->host.v4; ! fprintf(fd, " Host %s\n", inet_ntoa(in4)); ih = ih->next; } while(ie) { ! in4.s_addr = ie->net.v4; ! fprintf(fd, " Net %s ", inet_ntoa(in4)); ! in4.s_addr = ie->mask.v4; ! fprintf(fd, "%s\n", inet_ntoa(in4)); ie = ie->next; } --- 130,140 ---- while(ih) { ! fprintf(fd, " Host %s\n", inet_ntoa(ih->host.v4)); ih = ih->next; } while(ie) { ! fprintf(fd, " Net %s ", inet_ntoa(ie->net.v4)); ! fprintf(fd, "%s\n", inet_ntoa(ie->mask.v4)); ie = ie->next; } *************** *** 232,239 **** ! if(in->cnf->ipv4_broadcast.v4) { ! in4.s_addr = in->cnf->ipv4_broadcast.v4; ! fprintf(fd, " Ip4Broadcast\t %s\n\n", inet_ntoa(in4)); } else --- 228,234 ---- ! if(in->cnf->ipv4_broadcast.v4.s_addr) { ! fprintf(fd, " Ip4Broadcast\t %s\n\n", inet_ntoa(in->cnf->ipv4_broadcast.v4)); } else *************** *** 373,385 **** char ipv6_buf[100]; /* buffer for IPv6 inet_htop */ - struct in_addr in4; #if 0 printf("\n\n\n\nolsrd_write_cnf_buf bufsize %d\n\n\n\n\n", bufsize); #endif ! if(buf == NULL || bufsize < MAX_LINESIZE) ! { return -1; ! } WRITE_TO_BUF("#\n# Configuration file for olsr.org olsrd\n# automatically generated by olsrd-cnf %s\n#\n\n\n", PARSER_VERSION); --- 368,378 ---- char ipv6_buf[100]; /* buffer for IPv6 inet_htop */ #if 0 printf("\n\n\n\nolsrd_write_cnf_buf bufsize %d\n\n\n\n\n", bufsize); #endif ! if (buf == NULL || bufsize < MAX_LINESIZE) { return -1; ! } WRITE_TO_BUF("#\n# Configuration file for olsr.org olsrd\n# automatically generated by olsrd-cnf %s\n#\n\n\n", PARSER_VERSION); *************** *** 391,408 **** WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t%d\n\n", cnf->ip_version == AF_INET ? 4 : 6); ! /* HNA IPv4 */ WRITE_TO_BUF("# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna%1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6); ! while(h) ! { ! WRITE_TO_BUF(" %s ", olsr_ip_to_string(&h->net.prefix)); ! if (cnf->ip_version == AF_INET) { ! union olsr_ip_addr ip_addr; ! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! WRITE_TO_BUF("%s\n", olsr_ip_to_string(&ip_addr)); ! } else { ! WRITE_TO_BUF("%d\n", h->net.prefix_len); ! } ! h = h->next; } WRITE_TO_BUF("}\n\n"); --- 384,401 ---- WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t%d\n\n", cnf->ip_version == AF_INET ? 4 : 6); ! /* HNA IPv4 and IPv6 */ WRITE_TO_BUF("# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna%1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6); ! while(h) { ! struct ipaddr_str strbuf; ! WRITE_TO_BUF(" %s ", olsr_ip_to_string(&strbuf, &h->net.prefix)); ! if (cnf->ip_version == AF_INET) { ! union olsr_ip_addr ip_addr; ! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! WRITE_TO_BUF("%s\n", olsr_ip_to_string(&strbuf, &ip_addr)); ! } else { ! WRITE_TO_BUF("%d\n", h->net.prefix_len); } + h = h->next; + } WRITE_TO_BUF("}\n\n"); *************** *** 436,449 **** while(ih) { ! in4.s_addr = ih->host.v4; ! WRITE_TO_BUF(" Host %s\n", inet_ntoa(in4)); ih = ih->next; } while(ie) { ! in4.s_addr = ie->net.v4; ! WRITE_TO_BUF(" Net %s ", inet_ntoa(in4)); ! in4.s_addr = ie->mask.v4; ! WRITE_TO_BUF("%s\n", inet_ntoa(in4)); ie = ie->next; } --- 429,439 ---- while(ih) { ! WRITE_TO_BUF(" Host %s\n", inet_ntoa(ih->host.v4)); ih = ih->next; } while(ie) { ! WRITE_TO_BUF(" Net %s ", inet_ntoa(ie->net.v4)); ! WRITE_TO_BUF("%s\n", inet_ntoa(ie->mask.v4)); ie = ie->next; } *************** *** 533,540 **** ! if(in->cnf->ipv4_broadcast.v4) { ! in4.s_addr = in->cnf->ipv4_broadcast.v4; ! WRITE_TO_BUF(" Ip4Broadcast\t %s\n", inet_ntoa(in4)); } else --- 523,529 ---- ! if(in->cnf->ipv4_broadcast.v4.s_addr) { ! WRITE_TO_BUF(" Ip4Broadcast\t %s\n", inet_ntoa(in->cnf->ipv4_broadcast.v4)); } else Index: olsrd_conf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** olsrd_conf.c 5 Nov 2007 15:32:54 -0000 1.60 --- olsrd_conf.c 8 Nov 2007 22:47:42 -0000 1.61 *************** *** 53,56 **** --- 53,57 ---- #include "olsr_cfg.h" #include "defs.h" + #include "net_olsr.h" *************** *** 521,525 **** struct olsr_lq_mult *mult; char ipv6_buf[100]; /* buffer for IPv6 inet_htop */ - struct in_addr in4; printf(" *** olsrd configuration ***\n"); --- 522,525 ---- *************** *** 545,550 **** while(ih) { ! in4.s_addr = ih->host.v4; ! printf("\tHost %s\n", inet_ntoa(in4)); ih = ih->next; } --- 545,549 ---- while(ih) { ! printf("\tHost %s\n", inet_ntoa(ih->host.v4)); ih = ih->next; } *************** *** 552,559 **** while(ie) { ! in4.s_addr = ie->net.v4; ! printf("\tNet %s/", inet_ntoa(in4)); ! in4.s_addr = ie->mask.v4; ! printf("%s\n", inet_ntoa(in4)); ie = ie->next; } --- 551,556 ---- while(ie) { ! printf("\tNet %s/", inet_ntoa(ie->net.v4)); ! printf("%s\n", inet_ntoa(ie->mask.v4)); ie = ie->next; } *************** *** 586,593 **** printf(" dev: \"%s\"\n", in->name); ! if(in->cnf->ipv4_broadcast.v4) { ! in4.s_addr = in->cnf->ipv4_broadcast.v4; ! printf("\tIPv4 broadcast : %s\n", inet_ntoa(in4)); } else --- 583,589 ---- printf(" dev: \"%s\"\n", in->name); ! if(in->cnf->ipv4_broadcast.v4.s_addr) { ! printf("\tIPv4 broadcast : %s\n", inet_ntoa(in->cnf->ipv4_broadcast.v4)); } else *************** *** 600,605 **** //union olsr_ip_addr ipv6_multi_site; //union olsr_ip_addr ipv6_multi_glbl; ! printf("\tIPv6 multicast site/glbl : %s", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf))); ! printf("/%s\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf))); printf("\tHELLO emission/validity : %0.2f/%0.2f\n", in->cnf->hello_params.emission_interval, in->cnf->hello_params.validity_time); --- 596,601 ---- //union olsr_ip_addr ipv6_multi_site; //union olsr_ip_addr ipv6_multi_glbl; ! printf("\tIPv6 multicast site/glbl : %s", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf))); ! printf("/%s\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf))); printf("\tHELLO emission/validity : %0.2f/%0.2f\n", in->cnf->hello_params.emission_interval, in->cnf->hello_params.validity_time); *************** *** 610,618 **** for (mult = in->cnf->lq_mult; mult != NULL; mult = mult->next) { ! inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf, ! sizeof (ipv6_buf)); ! ! printf("\tLinkQualityMult : %s %0.2f\n", ! ipv6_buf, mult->val); } --- 606,610 ---- for (mult = in->cnf->lq_mult; mult != NULL; mult = mult->next) { ! printf("\tLinkQualityMult : %s %0.2f\n", inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf, sizeof (ipv6_buf)), mult->val); } *************** *** 647,663 **** } /* HNA IPv4 and IPv6 */ if(h) { printf("HNA%d entries:\n", cnf->ip_version == AF_INET ? 4 : 6); while(h) { ! printf("\t%s/", olsr_ip_to_string(&h->net.prefix)); if (cnf->ip_version == AF_INET) { union olsr_ip_addr ip; olsr_prefix_to_netmask(&ip, h->net.prefix_len); ! printf("%s\n", olsr_ip_to_string(&ip)); } else { printf("%d\n", h->net.prefix_len); } h = h->next; } } --- 639,681 ---- } + #if 0 + /* HNA IPv4 */ + if(h4) + { + + printf("HNA4 entries:\n"); + while(h4) + { + printf("\t%s/", inet_ntoa(h4->net.v4)); + printf("%s\n", inet_ntoa(h4->netmask.v4)); + h4 = h4->next; + } + } + + /* HNA IPv6 */ + if(h6) + { + printf("HNA6 entries:\n"); + while(h6) + { + printf("\t%s/%d\n", inet_ntop(AF_INET6, &h6->net.v6, ipv6_buf, sizeof(ipv6_buf)), h6->prefix_len); + h6 = h6->next; + } + #else /* HNA IPv4 and IPv6 */ if(h) { printf("HNA%d entries:\n", cnf->ip_version == AF_INET ? 4 : 6); while(h) { ! struct ipaddr_str buf; ! printf("\t%s/", olsr_ip_to_string(&buf, &h->net.prefix)); if (cnf->ip_version == AF_INET) { union olsr_ip_addr ip; olsr_prefix_to_netmask(&ip, h->net.prefix_len); ! printf("%s\n", olsr_ip_to_string(&buf, &ip)); } else { printf("%d\n", h->net.prefix_len); } h = h->next; + #endif } } Index: oparse.y =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** oparse.y 5 Nov 2007 15:32:54 -0000 1.36 --- oparse.y 8 Nov 2007 22:47:42 -0000 1.37 *************** *** 54,57 **** --- 54,58 ---- #include "olsrd_conf.h" #include "../defs.h" + #include "../net_olsr.h" #define PARSER_DEBUG 0 *************** *** 86,90 **** memset(&addr, 0, sizeof(addr)); ! if(ip_addr_arg != NULL && inet_pton(olsr_cnf->ip_version, ip_addr_arg->string, &addr) < 0) { fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string); --- 87,91 ---- memset(&addr, 0, sizeof(addr)); ! if (ip_addr_arg != NULL && inet_pton(olsr_cnf->ip_version, ip_addr_arg->string, &addr) < 0) { fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string); *************** *** 301,317 **** ipchost: TOK_HOSTLABEL TOK_IP4_ADDR { ! struct in_addr in; ! struct ipc_host *ipch; PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string); ! if(inet_aton($2->string, &in) == 0) ! { ! fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string); ! return -1; ! } ! ! ipch = malloc(sizeof(*ipch)); ! ipch->host.v4 = in.s_addr; ipch->next = olsr_cnf->ipc_hosts; --- 302,314 ---- ipchost: TOK_HOSTLABEL TOK_IP4_ADDR { ! struct ipc_host *ipch = malloc(sizeof(struct ipc_host)); PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string); ! if (inet_aton($2->string, &ipch->host.v4) == 0) { ! fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string); ! free(ipch); ! return -1; ! } ipch->next = olsr_cnf->ipc_hosts; *************** *** 326,349 **** ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR { ! struct in_addr in1, in2; ! struct ipc_net *ipcn; ! PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string); ! if(inet_aton($2->string, &in1) == 0) ! { ! fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string); ! return -1; ! } ! ! if(inet_aton($3->string, &in2) == 0) ! { ! fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string); ! return -1; ! } ! ipcn = malloc(sizeof(*ipcn)); ! ipcn->net.v4 = in1.s_addr; ! ipcn->mask.v4 = in2.s_addr; ipcn->next = olsr_cnf->ipc_nets; --- 323,340 ---- ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR { ! struct ipc_net *ipcn = malloc(sizeof(struct ipc_net)); PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string); ! if (inet_aton($2->string, &ipcn->net.v4) == 0) { ! fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string); ! free(ipcn); ! return -1; ! } ! if (inet_aton($3->string, &ipcn->mask.v4) == 0) { ! fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string); ! free(ipcn); ! return -1; ! } ipcn->next = olsr_cnf->ipc_nets; *************** *** 365,376 **** PARSER_DEBUG_PRINTF("Fixed willingness: %d\n", $2->integer); ! while(ifcnt) ! { ! ifs->cnf->weight.value = $2->integer; ! ifs->cnf->weight.fixed = OLSR_TRUE; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 356,366 ---- PARSER_DEBUG_PRINTF("Fixed willingness: %d\n", $2->integer); ! while (ifcnt) { ! ifs->cnf->weight.value = $2->integer; ! ifs->cnf->weight.fixed = OLSR_TRUE; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 386,402 **** PARSER_DEBUG_PRINTF("\tIPv4 broadcast: %s\n", $2->string); ! if(inet_aton($2->string, &in) == 0) ! { ! fprintf(stderr, "isetip4br: Failed converting IP address %s\n", $2->string); ! return -1; ! } ! while(ifcnt) ! { ! ifs->cnf->ipv4_broadcast.v4 = in.s_addr; ! ifs = ifs->next; ! ifcnt--; ! } free($2->string); --- 376,390 ---- PARSER_DEBUG_PRINTF("\tIPv4 broadcast: %s\n", $2->string); ! if (inet_aton($2->string, &in) == 0) { ! fprintf(stderr, "isetip4br: Failed converting IP address %s\n", $2->string); ! return -1; ! } ! while (ifcnt) { ! ifs->cnf->ipv4_broadcast.v4 = in; ! ifs = ifs->next; ! ifcnt--; ! } free($2->string); *************** *** 410,433 **** struct olsr_if *ifs = olsr_cnf->interfaces; ! if($2->boolean) ! { ! while(ifcnt) ! { ! ifs->cnf->ipv6_addrtype = IPV6_ADDR_SITELOCAL; ! ifs = ifs->next; ! ifcnt--; ! } } ! else ! { ! while(ifcnt) ! { ! ifs->cnf->ipv6_addrtype = 0; ! ifs = ifs->next; ! ifcnt--; ! } } free($2); --- 398,416 ---- struct olsr_if *ifs = olsr_cnf->interfaces; ! if ($2->boolean) { ! while (ifcnt) { ! ifs->cnf->ipv6_addrtype = IPV6_ADDR_SITELOCAL; ! ifs = ifs->next; ! ifcnt--; } ! } else { ! while (ifcnt) { ! ifs->cnf->ipv6_addrtype = 0; ! ifs = ifs->next; ! ifcnt--; } + } free($2); *************** *** 443,460 **** PARSER_DEBUG_PRINTF("\tIPv6 site-local multicast: %s\n", $2->string); ! if(inet_pton(AF_INET6, $2->string, &in6) < 0) ! { ! fprintf(stderr, "isetip6mults: Failed converting IP address %s\n", $2->string); ! return -1; ! } ! while(ifcnt) ! { ! ifs->cnf->ipv6_multi_site.v6 = in6; ! ifs = ifs->next; ! ifcnt--; ! } ! free($2->string); --- 426,440 ---- PARSER_DEBUG_PRINTF("\tIPv6 site-local multicast: %s\n", $2->string); ! if (inet_pton(AF_INET6, $2->string, &in6) < 0) { ! fprintf(stderr, "isetip6mults: Failed converting IP address %s\n", $2->string); ! return -1; ! } ! while (ifcnt) { ! ifs->cnf->ipv6_multi_site.v6 = in6; ! ifs = ifs->next; ! ifcnt--; ! } free($2->string); *************** *** 472,489 **** PARSER_DEBUG_PRINTF("\tIPv6 global multicast: %s\n", $2->string); ! if(inet_pton(AF_INET6, $2->string, &in6) < 0) ! { ! fprintf(stderr, "isetip6multg: Failed converting IP address %s\n", $2->string); ! return -1; ! } ! while(ifcnt) ! { ! memcpy(&ifs->cnf->ipv6_multi_glbl.v6, &in6, sizeof(struct in6_addr)); ! ifs = ifs->next; ! ifcnt--; ! } ! free($2->string); --- 452,467 ---- PARSER_DEBUG_PRINTF("\tIPv6 global multicast: %s\n", $2->string); ! if (inet_pton(AF_INET6, $2->string, &in6) < 0) { ! fprintf(stderr, "isetip6multg: Failed converting IP address %s\n", $2->string); ! return -1; ! } ! while (ifcnt) { ! //memcpy(&ifs->cnf->ipv6_multi_glbl.v6, &in6, sizeof(struct in6_addr)); ! ifs->cnf->ipv6_multi_glbl.v6 = in6; ! ifs = ifs->next; ! ifcnt--; ! } free($2->string); *************** *** 498,508 **** PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n", $2->floating); ! while(ifcnt) ! { ! ifs->cnf->hello_params.emission_interval = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 476,485 ---- PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n", $2->floating); ! while (ifcnt) { ! ifs->cnf->hello_params.emission_interval = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 516,526 **** PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating); ! while(ifcnt) ! { ! ifs->cnf->hello_params.validity_time = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 493,502 ---- PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating); ! while (ifcnt) { ! ifs->cnf->hello_params.validity_time = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 534,544 **** PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating); ! while(ifcnt) ! { ! ifs->cnf->tc_params.emission_interval = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); } --- 510,519 ---- PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating); ! while (ifcnt) { ! ifs->cnf->tc_params.emission_interval = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); } *************** *** 550,560 **** PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating); ! while(ifcnt) ! { ! ifs->cnf->tc_params.validity_time = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 525,534 ---- PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating); ! while (ifcnt) { ! ifs->cnf->tc_params.validity_time = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 568,578 **** PARSER_DEBUG_PRINTF("\tMID interval: %0.2f\n", $2->floating); ! while(ifcnt) ! { ! ifs->cnf->mid_params.emission_interval = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 542,551 ---- PARSER_DEBUG_PRINTF("\tMID interval: %0.2f\n", $2->floating); ! while (ifcnt) { ! ifs->cnf->mid_params.emission_interval = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 585,595 **** PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating); ! while(ifcnt) ! { ! ifs->cnf->mid_params.validity_time = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 558,567 ---- PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating); ! while (ifcnt) { ! ifs->cnf->mid_params.validity_time = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 602,612 **** PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating); ! while(ifcnt) ! { ! ifs->cnf->hna_params.emission_interval = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 574,583 ---- PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating); ! while (ifcnt) { ! ifs->cnf->hna_params.emission_interval = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 619,629 **** PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating); ! while(ifcnt) ! { ! ifs->cnf->hna_params.validity_time = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 590,599 ---- PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating); ! while (ifcnt) { ! ifs->cnf->hna_params.validity_time = $2->floating; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 636,646 **** PARSER_DEBUG_PRINTF("\tAutodetect changes: %s\n", $2->boolean ? "YES" : "NO"); ! while(ifcnt) ! { ! ifs->cnf->autodetect_chg = $2->boolean; ! ifs = ifs->next; ! ifcnt--; ! } free($2); --- 606,615 ---- PARSER_DEBUG_PRINTF("\tAutodetect changes: %s\n", $2->boolean ? "YES" : "NO"); ! while (ifcnt) { ! ifs->cnf->autodetect_chg = $2->boolean; ! ifs = ifs->next; ! ifcnt--; ! } free($2); *************** *** 650,674 **** isetlqmult: TOK_LQ_MULT TOK_DEFAULT TOK_FLOAT { ! if (lq_mult_helper($2, $3) < 0) YYABORT; } | TOK_LQ_MULT TOK_IP4_ADDR TOK_FLOAT { ! if (lq_mult_helper($2, $3) < 0) YYABORT; } | TOK_LQ_MULT TOK_IP6_ADDR TOK_FLOAT { ! if (lq_mult_helper($2, $3) < 0) YYABORT; } ! ! ; idebug: TOK_DEBUGLEVEL TOK_INTEGER { - olsr_cnf->debug_level = $2->integer; PARSER_DEBUG_PRINTF("Debug level: %d\n", olsr_cnf->debug_level); --- 619,644 ---- isetlqmult: TOK_LQ_MULT TOK_DEFAULT TOK_FLOAT { ! if (lq_mult_helper($2, $3) < 0) { YYABORT; + } } | TOK_LQ_MULT TOK_IP4_ADDR TOK_FLOAT { ! if (lq_mult_helper($2, $3) < 0) { YYABORT; + } } | TOK_LQ_MULT TOK_IP6_ADDR TOK_FLOAT { ! if (lq_mult_helper($2, $3) < 0) { YYABORT; + } } ! ; idebug: TOK_DEBUGLEVEL TOK_INTEGER { olsr_cnf->debug_level = $2->integer; PARSER_DEBUG_PRINTF("Debug level: %d\n", olsr_cnf->debug_level); *************** *** 680,692 **** iipversion: TOK_IPVERSION TOK_INTEGER { ! if($2->integer == 4) olsr_cnf->ip_version = AF_INET; ! else if($2->integer == 6) olsr_cnf->ip_version = AF_INET6; ! else ! { ! fprintf(stderr, "IPversion must be 4 or 6!\n"); ! YYABORT; ! } PARSER_DEBUG_PRINTF("IpVersion: %d\n", $2->integer); --- 650,661 ---- iipversion: TOK_IPVERSION TOK_INTEGER { ! if ($2->integer == 4) { olsr_cnf->ip_version = AF_INET; ! } else if ($2->integer == 6) { olsr_cnf->ip_version = AF_INET6; ! } else { ! fprintf(stderr, "IPversion must be 4 or 6!\n"); ! YYABORT; ! } PARSER_DEBUG_PRINTF("IpVersion: %d\n", $2->integer); *************** *** 699,728 **** { struct local_hna_entry *h = malloc(sizeof(*h)); ! struct in_addr in; ! union olsr_ip_addr ip_addr; PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string); ! if(h == NULL) ! { ! fprintf(stderr, "Out of memory(HNA4)\n"); ! YYABORT; ! } ! if(inet_aton($1->string, &in) == 0) ! { ! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); ! return -1; ! } ! h->net.prefix.v4 = in.s_addr; ! if(inet_aton($2->string, &in) == 0) ! { ! fprintf(stderr, "ihna4entry: Failed converting IP netmask %s\n", $2->string); ! return -1; ! } ! ip_addr.v4 = in.s_addr; ! h->net.prefix_len = olsr_netmask_to_prefix(&ip_addr); ! /* Do we really want to following? */ ! h->net.prefix.v4 &= in.s_addr; /* Queue */ --- 668,692 ---- { struct local_hna_entry *h = malloc(sizeof(*h)); ! union olsr_ip_addr netmask; PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string); ! if (h == NULL) { ! fprintf(stderr, "Out of memory(HNA4)\n"); ! YYABORT; ! } ! if (inet_aton($1->string, &h->net.prefix.v4) == 0) { ! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); ! free(h); ! return -1; ! } ! if (inet_aton($2->string, &netmask.v4) == 0) { ! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); ! free(h); ! return -1; ! } ! h->net.prefix_len = olsr_netmask_to_prefix(&netmask); ! h->net.prefix.v4.s_addr &= netmask.v4.s_addr; /* Queue */ *************** *** 744,752 **** PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", $1->string, $2->integer); ! if(h == NULL) ! { ! fprintf(stderr, "Out of memory(HNA6)\n"); ! YYABORT; ! } if(inet_pton(AF_INET6, $1->string, &h->net.prefix.v6) < 0) --- 708,715 ---- PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", $1->string, $2->integer); ! if (h == NULL) { ! fprintf(stderr, "Out of memory(HNA6)\n"); ! YYABORT; ! } if(inet_pton(AF_INET6, $1->string, &h->net.prefix.v6) < 0) *************** *** 756,764 **** } ! if($2->integer > 128) ! { ! fprintf(stderr, "ihna6entry: Illegal IPv6 prefix length %d\n", $2->integer); ! return -1; ! } h->net.prefix_len = $2->integer; --- 719,727 ---- } ! if ($2->integer > 128) { ! fprintf(stderr, "ihna6entry: Illegal IPv6 prefix length %d\n", $2->integer); ! free(h); ! return -1; ! } h->net.prefix_len = $2->integer; *************** *** 786,802 **** struct olsr_if *in = malloc(sizeof(*in)); ! if(in == NULL) ! { ! fprintf(stderr, "Out of memory(ADD IF)\n"); ! YYABORT; ! } in->cnf = get_default_if_config(); ! if(in->cnf == NULL) ! { ! fprintf(stderr, "Out of memory(ADD IFRULE)\n"); ! YYABORT; ! } in->name = $1->string; --- 749,763 ---- struct olsr_if *in = malloc(sizeof(*in)); ! if (in == NULL) { ! fprintf(stderr, "Out of memory(ADD IF)\n"); ! YYABORT; ! } in->cnf = get_default_if_config(); ! if (in->cnf == NULL) { ! fprintf(stderr, "Out of memory(ADD IFRULE)\n"); ! YYABORT; ! } in->name = $1->string; *************** *** 805,811 **** in->next = olsr_cnf->interfaces; olsr_cnf->interfaces = in; - ifs_in_curr_cfg++; - free($1); } --- 766,770 ---- *************** *** 815,821 **** { PARSER_DEBUG_PRINTF("Noint set to %d\n", $2->boolean); - olsr_cnf->allow_no_interfaces = $2->boolean; - free($2); } --- 774,778 ---- *************** *** 826,830 **** PARSER_DEBUG_PRINTF("TOS: %d\n", $2->integer); olsr_cnf->tos = $2->integer; - free($2); --- 783,786 ---- *************** *** 834,842 **** arttable: TOK_RTTABLE TOK_INTEGER { ! if(PARSER_DEBUG) printf("RtTable: %d\n", $2->integer); olsr_cnf->rttable = $2->integer; - free($2); - } ; --- 790,796 ---- arttable: TOK_RTTABLE TOK_INTEGER { ! PARSER_DEBUG_PRINTF("RtTable: %d\n", $2->integer); olsr_cnf->rttable = $2->integer; free($2); } ; *************** *** 844,876 **** awillingness: TOK_WILLINGNESS TOK_INTEGER { - olsr_cnf->willingness_auto = OLSR_FALSE; - PARSER_DEBUG_PRINTF("Willingness: %d\n", $2->integer); olsr_cnf->willingness = $2->integer; - free($2); - } ; - - busehyst: TOK_USEHYST TOK_BOOLEAN { olsr_cnf->use_hysteresis = $2->boolean; ! if(olsr_cnf->use_hysteresis) ! { ! PARSER_DEBUG_PRINTF("Hysteresis enabled\n"); ! } ! else ! { ! PARSER_DEBUG_PRINTF("Hysteresis disabled\n"); ! } free($2); - } ; - fhystscale: TOK_HYSTSCALE TOK_FLOAT { --- 798,816 ---- awillingness: TOK_WILLINGNESS TOK_INTEGER { PARSER_DEBUG_PRINTF("Willingness: %d\n", $2->integer); + olsr_cnf->willingness_auto = OLSR_FALSE; olsr_cnf->willingness = $2->integer; free($2); } ; busehyst: TOK_USEHYST TOK_BOOLEAN { olsr_cnf->use_hysteresis = $2->boolean; ! PARSER_DEBUG_PRINTF("Hysteresis %s\n", olsr_cnf->use_hysteresis ? "enabled" : "disabled"); free($2); } ; fhystscale: TOK_HYSTSCALE TOK_FLOAT { *************** *** 881,885 **** ; - fhystupper: TOK_HYSTUPPER TOK_FLOAT { --- 821,824 ---- *************** *** 890,894 **** ; - fhystlower: TOK_HYSTLOWER TOK_FLOAT { --- 829,832 ---- *************** *** 903,907 **** PARSER_DEBUG_PRINTF("Pollrate %0.2f\n", $2->floating); olsr_cnf->pollrate = $2->floating; - free($2); } --- 841,844 ---- *************** *** 912,916 **** PARSER_DEBUG_PRINTF("NIC Changes Pollrate %0.2f\n", $2->floating); olsr_cnf->nic_chgs_pollrate = $2->floating; - free($2); } --- 849,852 ---- *************** *** 968,975 **** bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN { - olsr_cnf->clear_screen = $2->boolean; - PARSER_DEBUG_PRINTF("Clear screen %s\n", olsr_cnf->clear_screen ? "enabled" : "disabled"); ! free($2); } --- 904,909 ---- bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN { PARSER_DEBUG_PRINTF("Clear screen %s\n", olsr_cnf->clear_screen ? "enabled" : "disabled"); ! olsr_cnf->clear_screen = $2->boolean; free($2); } *************** *** 980,991 **** struct plugin_entry *pe = malloc(sizeof(*pe)); ! if(pe == NULL) ! { ! fprintf(stderr, "Out of memory(ADD PL)\n"); ! YYABORT; ! } pe->name = $2->string; - pe->params = NULL; --- 914,923 ---- struct plugin_entry *pe = malloc(sizeof(*pe)); ! if (pe == NULL) { ! fprintf(stderr, "Out of memory(ADD PL)\n"); ! YYABORT; ! } pe->name = $2->string; pe->params = NULL; *************** *** 1004,1012 **** struct plugin_param *pp = malloc(sizeof(*pp)); ! if(pp == NULL) ! { ! fprintf(stderr, "Out of memory(ADD PP)\n"); ! YYABORT; ! } PARSER_DEBUG_PRINTF("Plugin param key:\"%s\" val: \"%s\"\n", $2->string, $3->string); --- 936,943 ---- struct plugin_param *pp = malloc(sizeof(*pp)); ! if (pp == NULL) { ! fprintf(stderr, "Out of memory(ADD PP)\n"); ! YYABORT; ! } PARSER_DEBUG_PRINTF("Plugin param key:\"%s\" val: \"%s\"\n", $2->string, $3->string); From (spam-protected) Thu Nov 8 23:47:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:45 +0000 Subject: [Olsr-cvs] olsrd-current/src/unix ifnet.c,1.52,1.53 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/unix In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/src/unix Modified Files: ifnet.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** ifnet.c 20 Oct 2007 12:59:08 -0000 1.52 --- ifnet.c 8 Nov 2007 22:47:42 -0000 1.53 *************** *** 210,214 **** /* Check broadcast */ if ((olsr_cnf->ip_version == AF_INET) && ! !iface->cnf->ipv4_broadcast.v4 && /* Skip if fixed bcast */ (!(ifp->int_flags & IFF_BROADCAST))) { --- 210,214 ---- /* Check broadcast */ if ((olsr_cnf->ip_version == AF_INET) && ! !iface->cnf->ipv4_broadcast.v4.s_addr && /* Skip if fixed bcast */ (!(ifp->int_flags & IFF_BROADCAST))) { *************** *** 261,264 **** --- 261,267 ---- if(olsr_cnf->ip_version == AF_INET6) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif /* Get interface address */ *************** *** 275,286 **** #ifdef DEBUG ! OLSR_PRINTF(3, "\tAddress: %s\n", ip6_to_string(&tmp_saddr6.sin6_addr)); #endif if(memcmp(&tmp_saddr6.sin6_addr, &ifp->int6_addr.sin6_addr, olsr_cnf->ipsize) != 0) { OLSR_PRINTF(1, "New IP address for %s:\n", ifr.ifr_name); ! OLSR_PRINTF(1, "\tOld: %s\n", ip6_to_string(&ifp->int6_addr.sin6_addr)); ! OLSR_PRINTF(1, "\tNew: %s\n", ip6_to_string(&tmp_saddr6.sin6_addr)); /* Check main addr */ --- 278,292 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "\tAddress: %s\n", ip6_to_string(&buf, &tmp_saddr6.sin6_addr)); #endif if(memcmp(&tmp_saddr6.sin6_addr, &ifp->int6_addr.sin6_addr, olsr_cnf->ipsize) != 0) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF(1, "New IP address for %s:\n", ifr.ifr_name); ! OLSR_PRINTF(1, "\tOld: %s\n", ip6_to_string(&buf, &ifp->int6_addr.sin6_addr)); ! OLSR_PRINTF(1, "\tNew: %s\n", ip6_to_string(&buf, &tmp_saddr6.sin6_addr)); /* Check main addr */ *************** *** 305,308 **** --- 311,315 ---- /* IP version 4 */ { + struct ipaddr_str buf; /* Check interface address (IPv4)*/ if(ioctl(olsr_cnf->ioctl_s, SIOCGIFADDR, &ifr) < 0) *************** *** 313,317 **** #ifdef DEBUG ! OLSR_PRINTF(3, "\tAddress:%s\n", sockaddr_to_string(&ifr.ifr_addr)); #endif --- 320,324 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "\tAddress:%s\n", sockaddr_to_string(&buf, &ifr.ifr_addr)); #endif *************** *** 322,329 **** /* New address */ OLSR_PRINTF(1, "IPv4 address changed for %s\n", ifr.ifr_name); ! 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, --- 329,336 ---- /* New address */ OLSR_PRINTF(1, "IPv4 address changed for %s\n", ifr.ifr_name); ! OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_addr.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&buf, &ifr.ifr_addr)); ! ifp->int_addr = *(struct sockaddr_in *)&ifr.ifr_addr; if(memcmp(&olsr_cnf->main_addr, *************** *** 331,336 **** olsr_cnf->ipsize) == 0) { ! OLSR_PRINTF(1, "New main address: %s\n", sockaddr_to_string(&ifr.ifr_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", sockaddr_to_string(&ifr.ifr_addr)); memcpy(&olsr_cnf->main_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, --- 338,343 ---- olsr_cnf->ipsize) == 0) { ! OLSR_PRINTF(1, "New main address: %s\n", sockaddr_to_string(&buf, &ifr.ifr_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", sockaddr_to_string(&buf, &ifr.ifr_addr)); memcpy(&olsr_cnf->main_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, *************** *** 353,357 **** #ifdef DEBUG ! OLSR_PRINTF(3, "\tNetmask:%s\n", sockaddr_to_string(&ifr.ifr_netmask)); #endif --- 360,364 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "\tNetmask:%s\n", sockaddr_to_string(&buf, &ifr.ifr_netmask)); #endif *************** *** 360,374 **** olsr_cnf->ipsize) != 0) { /* New address */ OLSR_PRINTF(1, "IPv4 netmask changed for %s\n", ifr.ifr_name); ! OLSR_PRINTF(1, "\tOld:%s\n", sockaddr_to_string(&ifp->int_netmask)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&ifr.ifr_netmask)); ! ifp->int_netmask = ifr.ifr_netmask; if_changes = 1; } ! if(!iface->cnf->ipv4_broadcast.v4) { /* Check broadcast address */ --- 367,384 ---- olsr_cnf->ipsize) != 0) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif /* New address */ OLSR_PRINTF(1, "IPv4 netmask changed for %s\n", ifr.ifr_name); ! OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_netmask.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&buf, &ifr.ifr_netmask)); ! ifp->int_netmask = *(struct sockaddr_in *)&ifr.ifr_netmask; if_changes = 1; } ! if(!iface->cnf->ipv4_broadcast.v4.s_addr) { /* Check broadcast address */ *************** *** 380,397 **** #ifdef DEBUG ! OLSR_PRINTF(3, "\tBroadcast address:%s\n", sockaddr_to_string(&ifr.ifr_broadaddr)); #endif ! if(memcmp(&((struct sockaddr_in *)&ifp->int_broadaddr)->sin_addr.s_addr, ! &((struct sockaddr_in *)&ifr.ifr_broadaddr)->sin_addr.s_addr, ! olsr_cnf->ipsize) != 0) { ! /* New address */ OLSR_PRINTF(1, "IPv4 broadcast changed for %s\n", ifr.ifr_name); ! OLSR_PRINTF(1, "\tOld:%s\n", sockaddr_to_string(&ifp->int_broadaddr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&ifr.ifr_broadaddr)); ! ifp->int_broadaddr = ifr.ifr_broadaddr; if_changes = 1; } --- 390,407 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "\tBroadcast address:%s\n", sockaddr_to_string(&buf, &ifr.ifr_broadaddr)); #endif ! if(ifp->int_broadaddr.sin_addr.s_addr != ((struct sockaddr_in *)&ifr.ifr_broadaddr)->sin_addr.s_addr) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif /* New address */ OLSR_PRINTF(1, "IPv4 broadcast changed for %s\n", ifr.ifr_name); ! OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_broadaddr.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&buf, &ifr.ifr_broadaddr)); ! ifp->int_broadaddr = *(struct sockaddr_in *)&ifr.ifr_broadaddr; if_changes = 1; } *************** *** 436,440 **** /* Check main addr */ ! if(COMP_IP(&olsr_cnf->main_addr, &ifp->ip_addr)) { if(ifnet == NULL) --- 446,450 ---- /* Check main addr */ ! if(ipequal(&olsr_cnf->main_addr, &ifp->ip_addr)) { if(ifnet == NULL) *************** *** 446,452 **** else { ! COPY_IP(&olsr_cnf->main_addr, &ifnet->ip_addr); ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); } } --- 456,464 ---- else { ! struct ipaddr_str buf; ! //COPY_IP(&olsr_cnf->main_addr, &ifnet->ip_addr); ! olsr_cnf->main_addr = ifnet->ip_addr; ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); } } *************** *** 530,533 **** --- 542,546 ---- union olsr_ip_addr null_addr; olsr_u32_t addr[4]; + struct ipaddr_str buf; if(!iface->host_emul) *************** *** 549,553 **** OLSR_PRINTF(1, "Adding %s(host emulation):\n", ifp->int_name); ! OLSR_PRINTF(1, " Address:%s\n", olsr_ip_to_string(&iface->hemu_ip)); OLSR_PRINTF(1, " NB! This is a emulated interface\n that does not exist in the kernel!\n"); --- 562,566 ---- OLSR_PRINTF(1, "Adding %s(host emulation):\n", ifp->int_name); ! OLSR_PRINTF(1, " Address:%s\n", olsr_ip_to_string(&buf, &iface->hemu_ip)); OLSR_PRINTF(1, " NB! This is a emulated interface\n that does not exist in the kernel!\n"); *************** *** 557,565 **** memset(&null_addr, 0, olsr_cnf->ipsize); ! if(COMP_IP(&null_addr, &olsr_cnf->main_addr)) { ! COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip); ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); } --- 570,579 ---- memset(&null_addr, 0, olsr_cnf->ipsize); ! if(ipequal(&null_addr, &olsr_cnf->main_addr)) { ! //COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip); ! olsr_cnf->main_addr = iface->hemu_ip; ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); } *************** *** 727,731 **** */ int ! chk_if_up(struct olsr_if *iface, int debuglvl) { struct interface ifs, *ifp; --- 741,745 ---- */ int ! chk_if_up(struct olsr_if *iface, int debuglvl __attribute__((unused))) { struct interface ifs, *ifp; *************** *** 764,768 **** /* Check broadcast */ if ((olsr_cnf->ip_version == AF_INET) && ! !iface->cnf->ipv4_broadcast.v4 && /* Skip if fixed bcast */ (!(ifs.int_flags & IFF_BROADCAST))) { --- 778,782 ---- /* Check broadcast */ if ((olsr_cnf->ip_version == AF_INET) && ! !iface->cnf->ipv4_broadcast.v4.s_addr && /* Skip if fixed bcast */ (!(ifs.int_flags & IFF_BROADCAST))) { *************** *** 793,797 **** { /* Get interface address */ ! if(get_ipv6_address(ifr.ifr_name, &ifs.int6_addr, iface->cnf->ipv6_addrtype) <= 0) { --- 807,813 ---- { /* Get interface address */ ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif if(get_ipv6_address(ifr.ifr_name, &ifs.int6_addr, iface->cnf->ipv6_addrtype) <= 0) { *************** *** 804,808 **** } ! OLSR_PRINTF(debuglvl, "\tAddress: %s\n", ip6_to_string(&ifs.int6_addr.sin6_addr)); /* Multicast */ --- 820,824 ---- } ! OLSR_PRINTF(debuglvl, "\tAddress: %s\n", ip6_to_string(&buf, &ifs.int6_addr.sin6_addr)); /* Multicast */ *************** *** 819,823 **** #endif ! OLSR_PRINTF(debuglvl, "\tMulticast: %s\n", ip6_to_string(&ifs.int6_multaddr.sin6_addr)); } --- 835,839 ---- #endif ! OLSR_PRINTF(debuglvl, "\tMulticast: %s\n", ip6_to_string(&buf, &ifs.int6_multaddr.sin6_addr)); } *************** *** 832,836 **** } ! ifs.int_addr = ifr.ifr_addr; /* Find netmask */ --- 848,852 ---- } ! ifs.int_addr = *(struct sockaddr_in *)&ifr.ifr_addr; /* Find netmask */ *************** *** 842,849 **** } ! ifs.int_netmask = ifr.ifr_netmask; /* Find broadcast address */ ! if(iface->cnf->ipv4_broadcast.v4) { /* Specified broadcast */ --- 858,865 ---- } ! ifs.int_netmask = *(struct sockaddr_in *)&ifr.ifr_netmask; /* Find broadcast address */ ! if(iface->cnf->ipv4_broadcast.v4.s_addr) { /* Specified broadcast */ *************** *** 862,866 **** } ! ifs.int_broadaddr = ifr.ifr_broadaddr; } --- 878,882 ---- } ! ifs.int_broadaddr = *(struct sockaddr_in *)&ifr.ifr_broadaddr; } *************** *** 905,916 **** if(olsr_cnf->ip_version == AF_INET) { ! OLSR_PRINTF(1, "\tAddress:%s\n", sockaddr_to_string(&ifs.int_addr)); ! OLSR_PRINTF(1, "\tNetmask:%s\n", sockaddr_to_string(&ifs.int_netmask)); ! OLSR_PRINTF(1, "\tBroadcast address:%s\n", sockaddr_to_string(&ifs.int_broadaddr)); } else { ! OLSR_PRINTF(1, "\tAddress: %s\n", ip6_to_string(&ifs.int6_addr.sin6_addr)); ! OLSR_PRINTF(1, "\tMulticast: %s\n", ip6_to_string(&ifs.int6_multaddr.sin6_addr)); } --- 921,938 ---- if(olsr_cnf->ip_version == AF_INET) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "\tAddress:%s\n", ip4_to_string(&buf, ifs.int_addr.sin_addr)); ! OLSR_PRINTF(1, "\tNetmask:%s\n", ip4_to_string(&buf, ifs.int_netmask.sin_addr)); ! OLSR_PRINTF(1, "\tBroadcast address:%s\n", ip4_to_string(&buf, ifs.int_broadaddr.sin_addr)); } else { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "\tAddress: %s\n", ip6_to_string(&buf, &ifs.int6_addr.sin6_addr)); ! OLSR_PRINTF(1, "\tMulticast: %s\n", ip6_to_string(&buf, &ifs.int6_multaddr.sin6_addr)); } *************** *** 933,937 **** { /* IP version 4 */ ! ifp->ip_addr.v4 = ((struct sockaddr_in *)&ifp->int_addr)->sin_addr.s_addr; /* *We create one socket for each interface and bind --- 955,959 ---- { /* IP version 4 */ ! ifp->ip_addr.v4 = ifp->int_addr.sin_addr; /* *We create one socket for each interface and bind *************** *** 954,959 **** { /* IP version 6 */ ! memcpy(&ifp->ip_addr, &ifp->int6_addr.sin6_addr, olsr_cnf->ipsize); ! /* --- 976,980 ---- { /* IP version 6 */ ! ifp->ip_addr.v6 = ifp->int6_addr.sin6_addr; /* *************** *** 1006,1014 **** */ memset(&null_addr, 0, olsr_cnf->ipsize); ! if(COMP_IP(&null_addr, &olsr_cnf->main_addr)) { ! COPY_IP(&olsr_cnf->main_addr, &ifp->ip_addr); ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); } --- 1027,1037 ---- */ memset(&null_addr, 0, olsr_cnf->ipsize); ! if(ipequal(&null_addr, &olsr_cnf->main_addr)) { ! struct ipaddr_str buf; ! //COPY_IP(&olsr_cnf->main_addr, &ifp->ip_addr); ! olsr_cnf->main_addr = ifp->ip_addr; ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); } *************** *** 1017,1048 **** */ ! if (olsr_cnf->lq_level == 0) ! { ! olsr_register_scheduler_event(&generate_hello, ! ifp, ! iface->cnf->hello_params.emission_interval, ! 0, ! NULL); ! olsr_register_scheduler_event(&generate_tc, ! ifp, ! iface->cnf->tc_params.emission_interval, ! 0, ! NULL); ! } ! ! else ! { ! olsr_register_scheduler_event(&olsr_output_lq_hello, ! ifp, ! iface->cnf->hello_params.emission_interval, ! 0, ! NULL); ! olsr_register_scheduler_event(&olsr_output_lq_tc, ! ifp, ! iface->cnf->tc_params.emission_interval, ! 0, ! NULL); ! } ! olsr_register_scheduler_event(&generate_mid, ifp, --- 1040,1053 ---- */ ! olsr_register_scheduler_event(olsr_cnf->lq_level == 0 ? &generate_hello : &olsr_output_lq_hello, ! ifp, ! iface->cnf->hello_params.emission_interval, ! 0, ! NULL); ! olsr_register_scheduler_event(olsr_cnf->lq_level == 0 ? &generate_tc : &olsr_output_lq_tc, ! ifp, ! iface->cnf->tc_params.emission_interval, ! 0, ! NULL); olsr_register_scheduler_event(&generate_mid, ifp, *************** *** 1059,1069 **** if((olsr_cnf->max_jitter == 0) || ! ((iface->cnf->hello_params.emission_interval / 4) < olsr_cnf->max_jitter)) olsr_cnf->max_jitter = iface->cnf->hello_params.emission_interval / 4; /* Recalculate max topology hold time */ ! if(olsr_cnf->max_tc_vtime < iface->cnf->tc_params.emission_interval) olsr_cnf->max_tc_vtime = iface->cnf->tc_params.emission_interval; ! ifp->hello_etime = iface->cnf->hello_params.emission_interval; ifp->valtimes.hello = double_to_me(iface->cnf->hello_params.validity_time); --- 1064,1075 ---- if((olsr_cnf->max_jitter == 0) || ! ((iface->cnf->hello_params.emission_interval / 4) < olsr_cnf->max_jitter)) { olsr_cnf->max_jitter = iface->cnf->hello_params.emission_interval / 4; + } /* Recalculate max topology hold time */ ! if(olsr_cnf->max_tc_vtime < iface->cnf->tc_params.emission_interval) { olsr_cnf->max_tc_vtime = iface->cnf->tc_params.emission_interval; ! } ifp->hello_etime = iface->cnf->hello_params.emission_interval; ifp->valtimes.hello = double_to_me(iface->cnf->hello_params.validity_time); From (spam-protected) Thu Nov 8 23:47:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:44 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux apm.c, 1.19, 1.20 kernel_routes.c, 1.29, 1.30 net.c, 1.34, 1.35 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/src/linux Modified Files: apm.c kernel_routes.c net.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: apm.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/apm.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** apm.c 24 Oct 2007 13:44:26 -0000 1.19 --- apm.c 8 Nov 2007 22:47:42 -0000 1.20 *************** *** 141,145 **** void ! apm_printinfo(struct olsr_apm_info *ainfo) { OLSR_PRINTF(5, "APM info:\n\tAC status %d\n\tBattery percentage %d%%\n\tBattery time left %d mins\n\n", --- 141,145 ---- void ! apm_printinfo(struct olsr_apm_info *ainfo __attribute__((unused))) { OLSR_PRINTF(5, "APM info:\n\tAC status %d\n\tBattery percentage %d%%\n\tBattery time left %d mins\n\n", *************** *** 153,165 **** apm_read(struct olsr_apm_info *ainfo) { ! switch(method) ! { ! case(USE_APM): ! return apm_read_apm(ainfo); ! case(USE_ACPI): ! return apm_read_acpi(ainfo); ! default: ! break; ! } return 0; } --- 153,161 ---- apm_read(struct olsr_apm_info *ainfo) { ! switch(method) { ! case USE_APM: return apm_read_apm(ainfo); ! case USE_ACPI: return apm_read_acpi(ainfo); ! default: break; ! } return 0; } Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/net.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** net.c 25 Apr 2007 22:08:18 -0000 1.34 --- net.c 8 Nov 2007 22:47:42 -0000 1.35 *************** *** 49,52 **** --- 49,53 ---- #include "../net_os.h" #include "../parser.h" + #include "../net_olsr.h" *************** *** 559,570 **** { /* See linux/in6.h */ ! struct ipv6_mreq mcastreq; ! COPY_IP(&mcastreq.ipv6mr_multiaddr, &ifs->int6_multaddr.sin6_addr); mcastreq.ipv6mr_interface = ifs->if_index; #if !defined __FreeBSD__ && !defined __MacOSX__ && !defined __NetBSD__ ! OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string((union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr)); /* Send multicast */ if(setsockopt(sock, --- 560,573 ---- { /* See linux/in6.h */ ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif struct ipv6_mreq mcastreq; ! mcastreq.ipv6mr_multiaddr = ifs->int6_multaddr.sin6_addr; mcastreq.ipv6mr_interface = ifs->if_index; #if !defined __FreeBSD__ && !defined __MacOSX__ && !defined __NetBSD__ ! OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, ip6_to_string(&buf, &ifs->int6_multaddr.sin6_addr)); /* Send multicast */ if(setsockopt(sock, Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** kernel_routes.c 13 Oct 2007 12:31:04 -0000 1.29 --- kernel_routes.c 8 Nov 2007 22:47:42 -0000 1.30 *************** *** 105,109 **** if (AF_INET == family) { ! if (rt->rt_dst.prefix.v4 != nexthop->gateway.v4) { olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v4, sizeof(nexthop->gateway.v4)); --- 105,109 ---- if (AF_INET == family) { ! if (rt->rt_dst.prefix.v4.s_addr != nexthop->gateway.v4.s_addr) { olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v4, sizeof(nexthop->gateway.v4)); *************** *** 191,204 **** ((struct sockaddr_in*)&kernel_route.rt_genmask)->sin_family = AF_INET; ! ((struct sockaddr_in *)&kernel_route.rt_dst)->sin_addr.s_addr = ! rt->rt_dst.prefix.v4; if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { return -1; } ! ((struct sockaddr_in *)&kernel_route.rt_genmask)->sin_addr.s_addr = mask.v4; ! if (rt->rt_dst.prefix.v4 != rt->rt_best->rtp_nexthop.gateway.v4) { ! ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_addr.s_addr = rt->rt_best->rtp_nexthop.gateway.v4; } --- 191,203 ---- ((struct sockaddr_in*)&kernel_route.rt_genmask)->sin_family = AF_INET; ! ((struct sockaddr_in *)&kernel_route.rt_dst)->sin_addr = rt->rt_dst.prefix.v4; if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { return -1; } ! ((struct sockaddr_in *)&kernel_route.rt_genmask)->sin_addr = mask.v4; ! if (rt->rt_dst.prefix.v4.s_addr != rt->rt_best->rtp_nexthop.gateway.v4.s_addr) { ! ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_addr = rt->rt_best->rtp_nexthop.gateway.v4; } *************** *** 214,218 **** /* delete existing default route before ? */ if((olsr_cnf->del_gws) && ! (rt->rt_dst.prefix.v4 == INADDR_ANY) && (rt->rt_dst.prefix_len == INADDR_ANY)) { delete_all_inet_gws(); --- 213,217 ---- /* delete existing default route before ? */ if((olsr_cnf->del_gws) && ! (rt->rt_dst.prefix.v4.s_addr == INADDR_ANY) && (rt->rt_dst.prefix_len == INADDR_ANY)) { delete_all_inet_gws(); *************** *** 264,271 **** memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); ! COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; ! COPY_IP(&kernel_route.rtmsg_gateway, &rt->rt_best->rtp_nexthop.gateway); kernel_route.rtmsg_flags = olsr_rt_flags(rt); --- 263,272 ---- memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); ! //COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); ! kernel_route.rtmsg_dst = rt->rt_dst.prefix.v6; kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; ! //COPY_IP(&kernel_route.rtmsg_gateway, &rt->rt_best->rtp_nexthop.gateway); ! kernel_route.rtmsg_gateway = rt->rt_best->rtp_nexthop.gateway.v6; kernel_route.rtmsg_flags = olsr_rt_flags(rt); *************** *** 321,330 **** ((struct sockaddr_in*)&kernel_route.rt_genmask)->sin_family = AF_INET; ! ((struct sockaddr_in *)&kernel_route.rt_dst)->sin_addr.s_addr = ! rt->rt_dst.prefix.v4; ! if (rt->rt_dst.prefix.v4 != rt->rt_nexthop.gateway.v4) { ! ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_addr.s_addr = ! rt->rt_nexthop.gateway.v4; } --- 322,329 ---- ((struct sockaddr_in*)&kernel_route.rt_genmask)->sin_family = AF_INET; ! ((struct sockaddr_in *)&kernel_route.rt_dst)->sin_addr = rt->rt_dst.prefix.v4; ! if (rt->rt_dst.prefix.v4.s_addr != rt->rt_nexthop.gateway.v4.s_addr) { ! ((struct sockaddr_in *)&kernel_route.rt_gateway)->sin_addr = rt->rt_nexthop.gateway.v4; } *************** *** 332,336 **** return -1; } else { ! ((struct sockaddr_in *)&kernel_route.rt_genmask)->sin_addr.s_addr = mask.v4; } --- 331,335 ---- return -1; } else { ! ((struct sockaddr_in *)&kernel_route.rt_genmask)->sin_addr = mask.v4; } *************** *** 385,392 **** memset(&kernel_route,0,sizeof(struct in6_rtmsg)); ! COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; ! COPY_IP(&kernel_route.rtmsg_gateway, &rt->rt_best->rtp_nexthop.gateway); kernel_route.rtmsg_flags = olsr_rt_flags(rt); --- 384,394 ---- memset(&kernel_route,0,sizeof(struct in6_rtmsg)); ! ! //COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); ! kernel_route.rtmsg_dst = rt->rt_dst.prefix.v6; kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; ! //COPY_IP(&kernel_route.rtmsg_gateway, &rt->rt_best->rtp_nexthop.gateway); ! kernel_route.rtmsg_gateway = rt->rt_best->rtp_nexthop.gateway.v6; kernel_route.rtmsg_flags = olsr_rt_flags(rt); From (spam-protected) Thu Nov 8 23:47:41 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:41 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.111,1.112 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726 Modified Files: CHANGELOG Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** CHANGELOG 5 Nov 2007 15:34:37 -0000 1.111 --- CHANGELOG 8 Nov 2007 22:47:39 -0000 1.112 *************** *** 53,56 **** --- 53,98 ---- look at the global "olsr_cnf->ip_version". - added a olsr_ip_prefix_to_string() function + - .h file cleanup: def.h does not longer include net_olsr.h because it + doesn't needs it. + - more type safety: the macros COPY_IP() and COMP_IP are gone and replaced + with "=" or similar "normal" C operations. There are also now the inline + functions ip4cmp() and ip4equal() to work on "struct in_addr", ip6cmp() + and ip6equal() to work on "struct in6_addr" and ipcmp() and ip6equal() + to work on "union olsr_ip_addr". + Most (or even more precise: almost all) uses of COPY_IP() and COMP_IP() + are in "if (olsr_cnf->ip_version) { ... } else { ... }" anyway to + there is no reson to copy an IPv4 address effectively with + "memcpy(&dst, &src, 4)" or compare with memcmp(&a, &b, 4)" wher the + always "4" is stored in a variable inhibiting compiler optimization. + There is also the deprecated function genipcopy() mimicking the old + typeless COPY_IP() macro for the last few places where a cleanup is + needed anyways. + There also lots of old macros left over (commented out of course) until + we are confident that everything works. And then I will kill them too. + - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom + "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of + temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... + - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() + to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" + into a string buffer. + - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must + get a target buffer. To ease that, there is the "struct ipaddr_str" + which is large enough for all of them (read: for an IPv6 address). This + also removes the cyclic buffer there. + All of these function return a "const char *" which can be directly used + for printf(3) and friends. + - const'ified more functions + - converted the source to UTF-8. + - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") + - force the few inline function to always be inlined. + - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() + if nothing is done + - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" + as "struct sockaddr_in" since it is that what we actually want there (and + it is similar to the IPv6 code). + - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" + - clean up the routes on more signals. Basically we want to do this on all + signals which terminate the program. + - killed a superflous global buffer in src/main.c 0.5.4 --------------------------------------------------------------------- From (spam-protected) Thu Nov 8 23:47:41 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:41 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.30, 1.31 olsrd_plugin.c, 1.17, 1.18 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/dot_draw/src Modified Files: olsrd_dot_draw.c olsrd_plugin.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** olsrd_dot_draw.c 5 Nov 2007 15:32:55 -0000 1.30 --- olsrd_dot_draw.c 8 Nov 2007 22:47:39 -0000 1.31 *************** *** 68,71 **** --- 68,72 ---- #include "link_set.h" #include "socket_parser.h" + #include "net_olsr.h" #include "olsrd_dot_draw.h" *************** *** 154,167 **** { char buf[256]; ! const char* adr; double etx = 0.0; char* style = "solid"; struct link_entry* link; ! adr = olsr_ip_to_string(&olsr_cnf->main_addr); ! sprintf( buf, "\"%s\" -> ", adr ); ipc_send_str(buf); - adr = olsr_ip_to_string(&neighbor->neighbor_main_addr); - if (neighbor->status == 0) { // non SYM style = "dashed"; --- 155,166 ---- { char buf[256]; ! struct ipaddr_str strbuf; double etx = 0.0; char* style = "solid"; struct link_entry* link; ! ! sprintf( buf, "\"%s\" -> ", olsr_ip_to_string(&strbuf, &olsr_cnf->main_addr)); ipc_send_str(buf); if (neighbor->status == 0) { // non SYM style = "dashed"; *************** *** 174,182 **** } ! sprintf( buf, "\"%s\"[label=\"%.2f\", style=%s];\n", adr, etx, style ); ipc_send_str(buf); ! if (neighbor->is_mpr) { ! sprintf( buf, "\"%s\"[shape=box];\n", adr ); ipc_send_str(buf); } --- 173,181 ---- } ! sprintf( buf, "\"%s\"[label=\"%.2f\", style=%s];\n", olsr_ip_to_string(&strbuf, &neighbor->neighbor_main_addr), etx, style ); ipc_send_str(buf); ! if (neighbor->is_mpr) { ! sprintf( buf, "\"%s\"[shape=box];\n", buf); ipc_send_str(buf); } *************** *** 268,272 **** else { ! if(ntohl(pin.sin_addr.s_addr) != ntohl(ipc_accept_ip.v4)) { olsr_printf(0, "Front end-connection from foreign host (%s) not allowed!\n", inet_ntoa(pin.sin_addr)); --- 267,271 ---- else { ! if(!ip4equal(&pin.sin_addr, &ipc_accept_ip.v4)) { olsr_printf(0, "Front end-connection from foreign host (%s) not allowed!\n", inet_ntoa(pin.sin_addr)); *************** *** 293,297 **** { int res; ! olsr_u8_t index; struct neighbor_entry *neighbor_table_tmp; struct tc_entry *tc; --- 292,296 ---- { int res; ! int index; struct neighbor_entry *neighbor_table_tmp; struct tc_entry *tc; *************** *** 308,313 **** /* Neighbors */ for(index=0;indexnetmask.v4; olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! hna_msk.v4 = netmask.v4; ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, &hna->net.prefix, --- 346,350 ---- //hna_msk.v4 = hna4->netmask.v4; olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! hna_msk.v4 = netmask.v4.s_addr; ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, &hna->net.prefix, *************** *** 371,377 **** ! if(!ipc_socket_up) plugin_ipc_init(); ! return res; } --- 369,375 ---- ! if (!ipc_socket_up) { plugin_ipc_init(); ! } return res; } *************** *** 380,389 **** ipc_print_tc_link(const struct tc_entry *entry, const struct tc_edge_entry *dst_entry) { ! char buf[256]; ! sprintf( buf, "\"%s\" -> ", olsr_ip_to_string(&entry->addr)); ! ipc_send_str(buf); ! ! sprintf( buf, "\"%s\"[label=\"%.2f\"];\n", olsr_ip_to_string(&dst_entry->T_dest_addr), olsr_calc_tc_etx(dst_entry)); ipc_send_str(buf); } --- 378,388 ---- ipc_print_tc_link(const struct tc_entry *entry, const struct tc_edge_entry *dst_entry) { ! char buf[512]; ! struct ipaddr_str strbuf1, strbuf2; ! sprintf( buf, "\"%s\" -> \"%s\"[label=\"%.2f\"];\n", ! olsr_ip_to_string(&strbuf1, &entry->addr), ! olsr_ip_to_string(&strbuf2, &dst_entry->T_dest_addr), ! olsr_calc_tc_etx(dst_entry)); ipc_send_str(buf); } *************** *** 393,416 **** ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, const union hna_netmask *mask) { ! const char *adr; ! adr = olsr_ip_to_string(gw); ! ipc_send_str("\""); ! ipc_send_str(adr); ! ipc_send_str("\" -> \""); ! adr = olsr_ip_to_string(net); ! ipc_send_str(adr); ! ipc_send_str("/"); ! adr = olsr_netmask_to_string(mask); ! ipc_send_str(adr); ! ipc_send_str("\"[label=\"HNA\"];\n"); ! ipc_send_str("\""); ! adr = olsr_ip_to_string(net); ! ipc_send_str(adr); ! ipc_send_str("/"); ! adr = olsr_netmask_to_string(mask); ! ipc_send_str(adr); ! ipc_send_str("\""); ! ipc_send_str("[shape=diamond];\n"); } --- 392,408 ---- ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, const union hna_netmask *mask) { ! char buf[512]; ! struct ipaddr_str gwbuf, netbuf; ! sprintf( buf, "\"%s\" -> \"%s/%s\"[label=\"HNA\"];\n", ! olsr_ip_to_string(&gwbuf, gw), ! olsr_ip_to_string(&netbuf, net), ! olsr_netmask_to_string(mask)); ! ipc_send_str(buf); ! ! sprintf( buf,"\"%s/%s\"[shape=diamond];\n", ! olsr_ip_to_string(&netbuf, net), ! olsr_netmask_to_string(mask)); ! ipc_send_str(buf); } Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_plugin.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** olsrd_plugin.c 23 Jul 2007 12:58:38 -0000 1.17 --- olsrd_plugin.c 8 Nov 2007 22:47:39 -0000 1.18 *************** *** 78,82 **** /* defaults for parameters */ ipc_port = 2004; ! ipc_accept_ip.v4 = htonl(INADDR_LOOPBACK); } --- 78,82 ---- /* defaults for parameters */ ipc_port = 2004; ! ipc_accept_ip.v4.s_addr = htonl(INADDR_LOOPBACK); } From (spam-protected) Thu Nov 8 23:47:41 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:41 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Address.c, 1.8, 1.9 Bmf.c, 1.8, 1.9 NetworkInterfaces.c, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/bmf/src Modified Files: Address.c Bmf.c NetworkInterfaces.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: Address.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Address.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Address.c 17 Sep 2007 21:57:05 -0000 1.8 --- Address.c 8 Nov 2007 22:47:39 -0000 1.9 *************** *** 47,51 **** /* OLSRD includes */ ! #include "defs.h" /* COMP_IP */ /* Plugin includes */ --- 47,51 ---- /* OLSRD includes */ ! #include "defs.h" /* ipequal */ /* Plugin includes */ *************** *** 98,102 **** assert(ipAddress != NULL); ! return (ntohl(ipAddress->v4) & 0xF0000000) == 0xE0000000; } --- 98,102 ---- assert(ipAddress != NULL); ! return (ntohl(ipAddress->v4.s_addr) & 0xF0000000) == 0xE0000000; } Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NetworkInterfaces.c 17 Sep 2007 21:57:05 -0000 1.10 --- NetworkInterfaces.c 8 Nov 2007 22:47:39 -0000 1.11 *************** *** 64,67 **** --- 64,68 ---- #include "lq_route.h" /* MIN_LINK_QUALITY */ #include "tc_set.h" /* olsr_lookup_tc_entry(), olsr_tc_lookup_dst() */ + #include "net_olsr.h" /* ipequal */ /* Plugin includes */ *************** *** 438,445 **** for (walker = get_link_set(); walker != NULL; walker = walker->next) { union olsr_ip_addr* neighborMainIp; /* Consider only links from the specified interface */ ! if (! COMP_IP(&intf->intAddr, &walker->local_iface_addr)) { continue; /* for */ --- 439,449 ---- for (walker = get_link_set(); walker != NULL; walker = walker->next) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif union olsr_ip_addr* neighborMainIp; /* Consider only links from the specified interface */ ! if (! ipequal(&intf->intAddr, &walker->local_iface_addr)) { continue; /* for */ *************** *** 451,455 **** PLUGIN_NAME_SHORT, intf->ifName, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); neighborMainIp = MainAddressOf(&walker->neighbor_iface_addr); --- 455,459 ---- PLUGIN_NAME_SHORT, intf->ifName, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); neighborMainIp = MainAddressOf(&walker->neighbor_iface_addr); *************** *** 457,467 **** /* Consider only neighbors with an IP address that differs from the * passed IP addresses (if passed). Rely on short-circuit boolean evaluation. */ ! if (source != NULL && COMP_IP(neighborMainIp, MainAddressOf(source))) { OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: is source of pkt\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); continue; /* for */ --- 461,474 ---- /* Consider only neighbors with an IP address that differs from the * passed IP addresses (if passed). Rely on short-circuit boolean evaluation. */ ! if (source != NULL && ipequal(neighborMainIp, MainAddressOf(source))) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: is source of pkt\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); continue; /* for */ *************** *** 469,479 **** /* Rely on short-circuit boolean evaluation */ ! if (forwardedBy != NULL && COMP_IP(neighborMainIp, MainAddressOf(forwardedBy))) { OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: is the node that forwarded the pkt\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); continue; /* for */ --- 476,489 ---- /* Rely on short-circuit boolean evaluation */ ! if (forwardedBy != NULL && ipequal(neighborMainIp, MainAddressOf(forwardedBy))) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: is the node that forwarded the pkt\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); continue; /* for */ *************** *** 481,491 **** /* Rely on short-circuit boolean evaluation */ ! if (forwardedTo != NULL && COMP_IP(neighborMainIp, MainAddressOf(forwardedTo))) { OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: is the node to which the pkt was forwarded\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); continue; /* for */ --- 491,504 ---- /* Rely on short-circuit boolean evaluation */ ! if (forwardedTo != NULL && ipequal(neighborMainIp, MainAddressOf(forwardedTo))) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: is the node to which the pkt was forwarded\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); continue; /* for */ *************** *** 538,542 **** /* Consider only links from the specified interface */ ! if (! COMP_IP(&intf->intAddr, &walker->local_iface_addr)) { continue; /* for */ --- 551,555 ---- /* Consider only links from the specified interface */ ! if (! ipequal(&intf->intAddr, &walker->local_iface_addr)) { continue; /* for */ *************** *** 554,558 **** /* Consider only neighbors with an IP address that differs from the * passed IP addresses (if passed). Rely on short-circuit boolean evaluation. */ ! if (source != NULL && COMP_IP(neighborMainIp, MainAddressOf(source))) { OLSR_PRINTF( --- 567,571 ---- /* Consider only neighbors with an IP address that differs from the * passed IP addresses (if passed). Rely on short-circuit boolean evaluation. */ ! if (source != NULL && ipequal(neighborMainIp, MainAddressOf(source))) { OLSR_PRINTF( *************** *** 566,570 **** /* Rely on short-circuit boolean evaluation */ ! if (forwardedBy != NULL && COMP_IP(neighborMainIp, MainAddressOf(forwardedBy))) { OLSR_PRINTF( --- 579,583 ---- /* Rely on short-circuit boolean evaluation */ ! if (forwardedBy != NULL && ipequal(neighborMainIp, MainAddressOf(forwardedBy))) { OLSR_PRINTF( *************** *** 578,582 **** /* Rely on short-circuit boolean evaluation */ ! if (forwardedTo != NULL && COMP_IP(neighborMainIp, MainAddressOf(forwardedTo))) { OLSR_PRINTF( --- 591,595 ---- /* Rely on short-circuit boolean evaluation */ ! if (forwardedTo != NULL && ipequal(neighborMainIp, MainAddressOf(forwardedTo))) { OLSR_PRINTF( *************** *** 725,728 **** --- 738,744 ---- for (walker = get_link_set(); walker != NULL; walker = walker->next) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif union olsr_ip_addr* neighborMainIp; struct link_entry* bestLinkToNeighbor; *************** *** 731,735 **** /* Consider only links from the specified interface */ ! if (! COMP_IP(&intf->intAddr, &walker->local_iface_addr)) { continue; /* for */ --- 747,751 ---- /* Consider only links from the specified interface */ ! if (! ipequal(&intf->intAddr, &walker->local_iface_addr)) { continue; /* for */ *************** *** 741,745 **** PLUGIN_NAME_SHORT, intf->ifName, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); neighborMainIp = MainAddressOf(&walker->neighbor_iface_addr); --- 757,761 ---- PLUGIN_NAME_SHORT, intf->ifName, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); neighborMainIp = MainAddressOf(&walker->neighbor_iface_addr); *************** *** 747,751 **** /* Consider only neighbors with an IP address that differs from the * passed IP addresses (if passed). Rely on short-circuit boolean evaluation. */ ! if (source != NULL && COMP_IP(neighborMainIp, MainAddressOf(source))) { OLSR_PRINTF( --- 763,767 ---- /* Consider only neighbors with an IP address that differs from the * passed IP addresses (if passed). Rely on short-circuit boolean evaluation. */ ! if (source != NULL && ipequal(neighborMainIp, MainAddressOf(source))) { OLSR_PRINTF( *************** *** 753,757 **** "%s: ----> Not forwarding to %s: is source of pkt\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); continue; /* for */ --- 769,773 ---- "%s: ----> Not forwarding to %s: is source of pkt\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); continue; /* for */ *************** *** 759,763 **** /* Rely on short-circuit boolean evaluation */ ! if (forwardedBy != NULL && COMP_IP(neighborMainIp, MainAddressOf(forwardedBy))) { OLSR_PRINTF( --- 775,779 ---- /* Rely on short-circuit boolean evaluation */ ! if (forwardedBy != NULL && ipequal(neighborMainIp, MainAddressOf(forwardedBy))) { OLSR_PRINTF( *************** *** 765,769 **** "%s: ----> Not forwarding to %s: is the node that forwarded the pkt\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); continue; /* for */ --- 781,785 ---- "%s: ----> Not forwarding to %s: is the node that forwarded the pkt\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); continue; /* for */ *************** *** 771,775 **** /* Rely on short-circuit boolean evaluation */ ! if (forwardedTo != NULL && COMP_IP(neighborMainIp, MainAddressOf(forwardedTo))) { OLSR_PRINTF( --- 787,791 ---- /* Rely on short-circuit boolean evaluation */ ! if (forwardedTo != NULL && ipequal(neighborMainIp, MainAddressOf(forwardedTo))) { OLSR_PRINTF( *************** *** 777,781 **** "%s: ----> Not forwarding to %s: is the node to which the pkt was forwarded\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); continue; /* for */ --- 793,797 ---- "%s: ----> Not forwarding to %s: is the node to which the pkt was forwarded\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); continue; /* for */ *************** *** 795,799 **** "%s: ----> Not forwarding to %s: link is timing out\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); continue; /* for */ --- 811,815 ---- "%s: ----> Not forwarding to %s: link is timing out\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); continue; /* for */ *************** *** 805,809 **** "%s: ----> Forwarding pkt to %s will cost ETX %5.2f\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr), currEtx); --- 821,825 ---- "%s: ----> Forwarding pkt to %s will cost ETX %5.2f\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr), currEtx); *************** *** 818,836 **** if (bestLinkToNeighbor == NULL) { OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: no link found\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr)); } else { struct interface* bestIntf = if_ifwithaddr(&bestLinkToNeighbor->local_iface_addr); ! OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: \"%s\" gives a better link to this neighbor, costing %5.2f\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr), bestIntf->int_name, CalcEtx( --- 834,857 ---- if (bestLinkToNeighbor == NULL) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: no link found\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr)); } else { + #ifndef NODEBUG struct interface* bestIntf = if_ifwithaddr(&bestLinkToNeighbor->local_iface_addr); ! struct ipaddr_str buf; ! #endif OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: \"%s\" gives a better link to this neighbor, costing %5.2f\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&buf, &walker->neighbor_iface_addr), bestIntf->int_name, CalcEtx( *************** *** 838,842 **** bestLinkToNeighbor->neigh_link_quality)); } ! continue; /* for */ } --- 859,863 ---- bestLinkToNeighbor->neigh_link_quality)); } ! continue; /* for */ } *************** *** 844,853 **** if (forwardedBy != NULL) { OLSR_PRINTF( 9, "%s: ----> 2-hop path from %s via me to %s will cost ETX %5.2f\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(forwardedBy), ! olsr_ip_to_string(&walker->neighbor_iface_addr), previousLinkEtx + currEtx); } --- 865,877 ---- if (forwardedBy != NULL) { + #ifndef NODEBUG + struct ipaddr_str forwardedByBuf, niaBuf; + #endif OLSR_PRINTF( 9, "%s: ----> 2-hop path from %s via me to %s will cost ETX %5.2f\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&forwardedByBuf, forwardedBy), ! olsr_ip_to_string(&niaBuf, &walker->neighbor_iface_addr), previousLinkEtx + currEtx); } *************** *** 876,886 **** if (previousLinkEtx + currEtx > tcEtx) { OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: I am not an MPR between %s and %s, direct link costs %5.2f\n", PLUGIN_NAME_SHORT, ! olsr_ip_to_string(&walker->neighbor_iface_addr), ! olsr_ip_to_string(forwardedBy), ! olsr_ip_to_string(&walker->neighbor_iface_addr), tcEtx); --- 900,914 ---- if (previousLinkEtx + currEtx > tcEtx) { + #ifndef NODEBUG + struct ipaddr_str neighbor_iface_buf, forw_buf; + olsr_ip_to_string(&neighbor_iface_buf, &walker->neighbor_iface_addr); + #endif OLSR_PRINTF( 9, "%s: ----> Not forwarding to %s: I am not an MPR between %s and %s, direct link costs %5.2f\n", PLUGIN_NAME_SHORT, ! neighbor_iface_buf.buf, ! olsr_ip_to_string(&forw_buf, forwardedBy), ! neighbor_iface_buf.buf, tcEtx); *************** *** 922,925 **** --- 950,956 ---- else { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF( 9, *************** *** 932,936 **** 9, "%s", ! olsr_ip_to_string(&result->links[0]->neighbor_iface_addr)); if (result->links[1] != NULL) --- 963,967 ---- 9, "%s", ! olsr_ip_to_string(&buf, &result->links[0]->neighbor_iface_addr)); if (result->links[1] != NULL) *************** *** 939,943 **** 9, ", %s", ! olsr_ip_to_string(&result->links[1]->neighbor_iface_addr)); } /* if */ --- 970,974 ---- 9, ", %s", ! olsr_ip_to_string(&buf, &result->links[1]->neighbor_iface_addr)); } /* if */ *************** *** 1238,1242 **** if (bmfIf->olsrIntf != NULL) { ! EtherTunTapIp = ntohl(bmfIf->intAddr.v4); EtherTunTapIpBroadcast = EtherTunTapIp; } --- 1269,1273 ---- if (bmfIf->olsrIntf != NULL) { ! EtherTunTapIp = ntohl(bmfIf->intAddr.v4.s_addr); EtherTunTapIpBroadcast = EtherTunTapIp; } *************** *** 1327,1332 **** union olsr_ip_addr temp_netmask; ! temp_net.v4 = htonl(EtherTunTapIp); ! temp_netmask.v4 = htonl(0xFFFFFFFF); add_local_hna4_entry(&temp_net, &temp_netmask); } --- 1358,1363 ---- union olsr_ip_addr temp_netmask; ! temp_net.v4.s_addr = htonl(EtherTunTapIp); ! temp_netmask.v4.s_addr = htonl(0xFFFFFFFF); add_local_hna4_entry(&temp_net, &temp_netmask); } *************** *** 1440,1445 **** * address from the OLSR interface object. Downcast to correct sockaddr * subtype. */ ! COPY_IP(&newIf->intAddr, &((struct sockaddr_in *)&olsrIntf->int_addr)->sin_addr.s_addr); ! COPY_IP(&newIf->broadAddr, &((struct sockaddr_in *)&olsrIntf->int_broadaddr)->sin_addr.s_addr); } else --- 1471,1478 ---- * address from the OLSR interface object. Downcast to correct sockaddr * subtype. */ ! //COPY_IP(&newIf->intAddr, &((struct sockaddr_in *)&olsrIntf->int_addr)->sin_addr.s_addr); ! newIf->intAddr.v4 = ((struct sockaddr_in *)&olsrIntf->int_addr)->sin_addr; ! //COPY_IP(&newIf->broadAddr, &((struct sockaddr_in *)&olsrIntf->int_broadaddr)->sin_addr.s_addr); ! newIf->broadAddr.v4 = ((struct sockaddr_in *)&olsrIntf->int_broadaddr)->sin_addr; } else *************** *** 1453,1462 **** BmfPError("ioctl(SIOCGIFADDR) error for interface \"%s\"", ifName); ! newIf->intAddr.v4 = inet_addr("0.0.0.0"); } else { /* Downcast to correct sockaddr subtype */ ! COPY_IP(&newIf->intAddr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr); } --- 1486,1496 ---- BmfPError("ioctl(SIOCGIFADDR) error for interface \"%s\"", ifName); ! newIf->intAddr.v4.s_addr = inet_addr("0.0.0.0"); } else { /* Downcast to correct sockaddr subtype */ ! //COPY_IP(&newIf->intAddr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr); ! newIf->intAddr.v4 = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; } *************** *** 1469,1478 **** BmfPError("ioctl(SIOCGIFBRDADDR) error for interface \"%s\"", ifName); ! newIf->broadAddr.v4 = inet_addr("0.0.0.0"); } else { /* Downcast to correct sockaddr subtype */ ! COPY_IP(&newIf->broadAddr, &((struct sockaddr_in *)&ifr.ifr_broadaddr)->sin_addr.s_addr); } } --- 1503,1513 ---- BmfPError("ioctl(SIOCGIFBRDADDR) error for interface \"%s\"", ifName); ! newIf->broadAddr.v4.s_addr = inet_addr("0.0.0.0"); } else { /* Downcast to correct sockaddr subtype */ ! //COPY_IP(&newIf->broadAddr, &((struct sockaddr_in *)&ifr.ifr_broadaddr)->sin_addr.s_addr); ! newIf->broadAddr.v4 = ((struct sockaddr_in *)&ifr.ifr_broadaddr)->sin_addr; } } *************** *** 1590,1594 **** /* ...find the OLSR interface structure, if any */ ! COPY_IP(&ipAddr, &((struct sockaddr_in*)&ifr->ifr_addr)->sin_addr.s_addr); olsrIntf = if_ifwithaddr(&ipAddr); --- 1625,1630 ---- /* ...find the OLSR interface structure, if any */ ! //COPY_IP(&ipAddr, &((struct sockaddr_in*)&ifr->ifr_addr)->sin_addr.s_addr); ! ipAddr.v4 = ((struct sockaddr_in*)&ifr->ifr_addr)->sin_addr; olsrIntf = if_ifwithaddr(&ipAddr); *************** *** 1832,1836 **** iph = (struct iphdr*) ipPacket; ! COPY_IP(&destIp, &iph->daddr); if (! IsMulticast(&destIp)) { --- 1868,1873 ---- iph = (struct iphdr*) ipPacket; ! //COPY_IP(&destIp, &iph->daddr); ! destIp.v4.s_addr = iph->daddr; if (! IsMulticast(&destIp)) { *************** *** 1840,1844 **** origDaddr = ntohl(iph->daddr); ! COPY_IP(&iph->daddr, broadAddr); newDaddr = ntohl(iph->daddr); --- 1877,1882 ---- origDaddr = ntohl(iph->daddr); ! //COPY_IP(&iph->daddr, broadAddr); ! iph->daddr = broadAddr->v4.s_addr; newDaddr = ntohl(iph->daddr); Index: Bmf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Bmf.c 11 Sep 2007 23:08:20 -0000 1.8 --- Bmf.c 8 Nov 2007 22:47:39 -0000 1.9 *************** *** 63,66 **** --- 63,67 ---- #include "mpr_selector_set.h" /* olsr_lookup_mprs_set() */ #include "link_set.h" /* get_best_link_to_neighbor() */ + #include "net_olsr.h" /* ipequal */ /* BMF includes */ *************** *** 178,182 **** /* Start by filling in the local broadcast address */ ! COPY_IP(&forwardTo.sin_addr.s_addr, &intf->broadAddr); /* - If the BMF mechanism is BM_UNICAST_PROMISCUOUS, always send just one --- 179,184 ---- /* Start by filling in the local broadcast address */ ! //COPY_IP(&forwardTo.sin_addr.s_addr, &intf->broadAddr); ! forwardTo.sin_addr = intf->broadAddr.v4; /* - If the BMF mechanism is BM_UNICAST_PROMISCUOUS, always send just one *************** *** 200,204 **** if (BmfMechanism == BM_UNICAST_PROMISCUOUS || nPossibleNeighbors <= 2) { ! COPY_IP(&forwardTo.sin_addr.s_addr, &bestNeighborLinks.links[i]->neighbor_iface_addr); } --- 202,207 ---- if (BmfMechanism == BM_UNICAST_PROMISCUOUS || nPossibleNeighbors <= 2) { ! //COPY_IP(&forwardTo.sin_addr.s_addr, &bestNeighborLinks.links[i]->neighbor_iface_addr); ! forwardTo.sin_addr = bestNeighborLinks.links[i]->neighbor_iface_addr.v4; } *************** *** 263,274 **** u_int32_t crc32; struct TEncapHeader* encapHdr; ! ipHeader = GetIpHeader(encapsulationUdpData); ! COPY_IP(&dst, &ipHeader->ip_dst); /* Only forward multicast packets. If configured, also forward local broadcast packets */ if (IsMulticast(&dst) || ! (EnableLocalBroadcast != 0 && COMP_IP(&dst, &intf->broadAddr))) { /* continue */ --- 266,280 ---- u_int32_t crc32; struct TEncapHeader* encapHdr; ! #ifndef NODEBUG ! struct ipaddr_str srcBuf, dstBuf; ! #endif ipHeader = GetIpHeader(encapsulationUdpData); ! //COPY_IP(&dst, &ipHeader->ip_dst); ! dst.v4 = ipHeader->ip_dst; /* Only forward multicast packets. If configured, also forward local broadcast packets */ if (IsMulticast(&dst) || ! (EnableLocalBroadcast != 0 && ipequal(&dst, &intf->broadAddr))) { /* continue */ *************** *** 297,301 **** ipPacketLen = GetIpTotalLength(ipPacket); ! COPY_IP(&src, &ipHeader->ip_src); OLSR_PRINTF( 8, --- 303,309 ---- ipPacketLen = GetIpTotalLength(ipPacket); ! //COPY_IP(&src, &ipHeader->ip_src); ! src.v4 = ipHeader->ip_src; ! OLSR_PRINTF( 8, *************** *** 306,311 **** isFromOlsrIntf ? "OLSR" : "non-OLSR", intf->ifName, ! olsr_ip_to_string(&src), ! olsr_ip_to_string(&dst)); /* Lookup main address of source in the MID table of OLSR */ --- 314,319 ---- isFromOlsrIntf ? "OLSR" : "non-OLSR", intf->ifName, ! olsr_ip_to_string(&srcBuf, &src), ! olsr_ip_to_string(&dstBuf, &dst)); /* Lookup main address of source in the MID table of OLSR */ *************** *** 404,407 **** --- 412,418 ---- /* Case 1.1 */ { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF( 8, *************** *** 409,413 **** PLUGIN_NAME_SHORT, walker->ifName, ! olsr_ip_to_string(&src)); } } --- 420,424 ---- PLUGIN_NAME_SHORT, walker->ifName, ! olsr_ip_to_string(&buf, &src)); } } *************** *** 578,582 **** u_int16_t encapsulationUdpDataLen; struct TBmfInterface* walker; ! /* Are we talking to ourselves? */ if (if_ifwithaddr(forwardedBy) != NULL) --- 589,595 ---- u_int16_t encapsulationUdpDataLen; struct TBmfInterface* walker; ! #ifndef NODEBUG ! struct ipaddr_str mcSrcBuf, mcDstBuf, forwardedByBuf, forwardedToBuf; ! #endif /* Are we talking to ourselves? */ if (if_ifwithaddr(forwardedBy) != NULL) *************** *** 596,601 **** ipHeader = GetIpHeader(encapsulationUdpData); ! COPY_IP(&mcSrc, &ipHeader->ip_src); ! COPY_IP(&mcDst, &ipHeader->ip_dst); /* Increase counter */ --- 609,616 ---- ipHeader = GetIpHeader(encapsulationUdpData); ! //COPY_IP(&mcSrc, &ipHeader->ip_src); ! mcSrc.v4 = ipHeader->ip_src; ! //COPY_IP(&mcDst, &ipHeader->ip_dst); ! mcDst.v4 = ipHeader->ip_dst; /* Increase counter */ *************** *** 609,616 **** (long)ipPacketLen, intf->ifName, ! olsr_ip_to_string(&mcSrc), ! olsr_ip_to_string(&mcDst), ! olsr_ip_to_string(forwardedBy), ! forwardedTo != NULL ? olsr_ip_to_string(forwardedTo) : "me"); /* Get encapsulation header */ --- 624,631 ---- (long)ipPacketLen, intf->ifName, ! olsr_ip_to_string(&mcSrcBuf, &mcSrc), ! olsr_ip_to_string(&mcDstBuf, &mcDst), ! olsr_ip_to_string(&forwardedByBuf, forwardedBy), ! forwardedTo != NULL ? olsr_ip_to_string(&forwardedToBuf, forwardedTo) : "me"); /* Get encapsulation header */ *************** *** 654,658 **** * update its destination address to match the subnet of the EtherTunTap * interface */ ! broadAddr.v4 = htonl(EtherTunTapIpBroadcast); CheckAndUpdateLocalBroadcast(ipPacket, &broadAddr); --- 669,673 ---- * update its destination address to match the subnet of the EtherTunTap * interface */ ! broadAddr.v4.s_addr = htonl(EtherTunTapIpBroadcast); CheckAndUpdateLocalBroadcast(ipPacket, &broadAddr); *************** *** 781,785 **** /* Compose destination of encapsulation packet. * Start by filling in the local broadcast address. */ ! COPY_IP(&forwardTo.sin_addr.s_addr, &walker->broadAddr); /* - If the BMF mechanism is BM_UNICAST_PROMISCUOUS, always send just one --- 796,801 ---- /* Compose destination of encapsulation packet. * Start by filling in the local broadcast address. */ ! //COPY_IP(&forwardTo.sin_addr.s_addr, &walker->broadAddr); ! forwardTo.sin_addr = walker->broadAddr.v4; /* - If the BMF mechanism is BM_UNICAST_PROMISCUOUS, always send just one *************** *** 805,809 **** /* For unicast, overwrite the local broadcast address which was filled in * above */ ! COPY_IP(&forwardTo.sin_addr.s_addr, &bestNeighborLinks.links[i]->neighbor_iface_addr); } --- 821,826 ---- /* For unicast, overwrite the local broadcast address which was filled in * above */ ! //COPY_IP(&forwardTo.sin_addr.s_addr, &bestNeighborLinks.links[i]->neighbor_iface_addr); ! forwardTo.sin_addr = bestNeighborLinks.links[i]->neighbor_iface_addr.v4; } *************** *** 839,842 **** --- 856,862 ---- else /* walker->olsrIntf != NULL && !iAmMpr */ { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif /* 'walker' is an OLSR interface, but I am not selected as MPR. In that * case, don't forward. */ *************** *** 846,850 **** PLUGIN_NAME_SHORT, walker->ifName, ! olsr_ip_to_string(forwardedBy)); } /* else */ } /* for */ --- 866,870 ---- PLUGIN_NAME_SHORT, walker->ifName, ! olsr_ip_to_string(&buf, forwardedBy)); } /* else */ } /* for */ *************** *** 873,877 **** u_int32_t crc32; struct TEncapHeader* encapHdr; ! ipPacket = GetIpPacket(encapsulationUdpData); ipPacketLen = GetIpTotalLength(ipPacket); --- 893,899 ---- u_int32_t crc32; struct TEncapHeader* encapHdr; ! #ifndef NODEBUG ! struct ipaddr_str srcIpBuf, dstIpBuf; ! #endif ipPacket = GetIpPacket(encapsulationUdpData); ipPacketLen = GetIpTotalLength(ipPacket); *************** *** 879,886 **** /* Only forward multicast packets. If configured, also forward local broadcast packets */ ! COPY_IP(&dstIp, &ipHeader->ip_dst); ! broadAddr.v4 = htonl(EtherTunTapIpBroadcast); if (IsMulticast(&dstIp) || ! (EnableLocalBroadcast != 0 && COMP_IP(&dstIp, &broadAddr))) { /* continue */ --- 901,910 ---- /* Only forward multicast packets. If configured, also forward local broadcast packets */ ! //COPY_IP(&dstIp, &ipHeader->ip_dst); ! dstIp.v4 = ipHeader->ip_dst; ! ! broadAddr.v4.s_addr = htonl(EtherTunTapIpBroadcast); if (IsMulticast(&dstIp) || ! (EnableLocalBroadcast != 0 && ipequal(&dstIp, &broadAddr))) { /* continue */ *************** *** 891,895 **** } ! COPY_IP(&srcIp, &ipHeader->ip_src); OLSR_PRINTF( 8, --- 915,921 ---- } ! //COPY_IP(&srcIp, &ipHeader->ip_src); ! srcIp.v4 = ipHeader->ip_src; ! OLSR_PRINTF( 8, *************** *** 898,903 **** (long)ipPacketLen, EtherTunTapIfName, ! olsr_ip_to_string(&srcIp), ! olsr_ip_to_string(&dstIp)); /* Calculate packet fingerprint */ --- 924,929 ---- (long)ipPacketLen, EtherTunTapIfName, ! olsr_ip_to_string(&srcIpBuf, &srcIp), ! olsr_ip_to_string(&dstIpBuf, &dstIp)); /* Calculate packet fingerprint */ *************** *** 1174,1179 **** } ! COPY_IP(&forwardedBy, &ipHeader->ip_src); ! COPY_IP(&forwardedTo, &ipHeader->ip_dst); BmfEncapsulationPacketReceived( walker, --- 1200,1207 ---- } ! //COPY_IP(&forwardedBy, &ipHeader->ip_src); ! forwardedBy.v4 = ipHeader->ip_src; ! //COPY_IP(&forwardedTo, &ipHeader->ip_dst); ! forwardedTo.v4 = ipHeader->ip_dst; BmfEncapsulationPacketReceived( walker, *************** *** 1216,1220 **** } /* if (nBytes < 0) */ ! COPY_IP(&forwardedBy, &from.sin_addr.s_addr); /* Check if the number of received bytes is large enough for a minimal BMF --- 1244,1249 ---- } /* if (nBytes < 0) */ ! //COPY_IP(&forwardedBy, &from.sin_addr.s_addr); ! forwardedBy.v4 = from.sin_addr; /* Check if the number of received bytes is large enough for a minimal BMF *************** *** 1227,1230 **** --- 1256,1260 ---- if (nBytes < minimumLength) { + struct ipaddr_str buf; olsr_printf( 1, *************** *** 1232,1236 **** PLUGIN_NAME, nBytes, ! olsr_ip_to_string(&forwardedBy), walker->ifName); --- 1262,1266 ---- PLUGIN_NAME, nBytes, ! olsr_ip_to_string(&buf, &forwardedBy), walker->ifName); From (spam-protected) Thu Nov 8 23:47:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw_plain/src olsrd_dyn_gw_plain.c, 1.5, 1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw_plain/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/dyn_gw_plain/src Modified Files: olsrd_dyn_gw_plain.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! 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.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** olsrd_dyn_gw_plain.c 19 Aug 2007 20:37:41 -0000 1.5 --- olsrd_dyn_gw_plain.c 8 Nov 2007 22:47:40 -0000 1.6 *************** *** 84,89 **** printf("OLSRD dyn_gw_plain plugin by Sven-Ola\n"); ! gw_net.v4 = INET_NET; ! gw_netmask.v4 = INET_PREFIX; has_inet_gateway = 0; --- 84,89 ---- printf("OLSRD dyn_gw_plain plugin by Sven-Ola\n"); ! gw_net.v4.s_addr = INET_NET; ! gw_netmask.v4.s_addr = INET_PREFIX; has_inet_gateway = 0; *************** *** 148,153 **** (iflags & RTF_UP) && (metric == 0) && ! (netmask == mask->v4) && ! (dest_addr == net->v4)) { olsr_printf(DEBUGLEV, "INTERNET GATEWAY VIA %s detected in routing table.\n", iface); --- 148,153 ---- (iflags & RTF_UP) && (metric == 0) && ! (netmask == mask->v4.s_addr) && ! (dest_addr == net->v4.s_addr)) { olsr_printf(DEBUGLEV, "INTERNET GATEWAY VIA %s detected in routing table.\n", iface); From (spam-protected) Thu Nov 8 23:47:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.34, 1.35 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/nameservice/src Modified Files: nameservice.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** nameservice.c 5 Nov 2007 15:32:55 -0000 1.34 --- nameservice.c 8 Nov 2007 22:47:40 -0000 1.35 *************** *** 170,174 **** { *v = add_name_to_list(*v, "", addon.ui, NULL); ! OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value); return 0; } --- 170,174 ---- { *v = add_name_to_list(*v, "", addon.ui, NULL); ! OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value); return 0; [...997 lines suppressed...] ! OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! struct ipaddr_str dstbuf, addrbuf; ! fprintf(js, "Link('%s','%s',%f,%f,%f);\n", ! olsr_ip_to_string(&dstbuf, &tc_edge->T_dest_addr), ! olsr_ip_to_string(&addrbuf, &tc->addr), tc_edge->link_quality, tc_edge->inverse_link_quality, ! olsr_calc_tc_etx(tc_edge)); ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); fclose(js); *************** *** 1543,1546 **** --- 1584,1588 ---- * mode: c * c-indent-tabs-mode: t + * indent-tabs-mode: t * c-basic-offset: 4 * tab-width: 4 From (spam-protected) Thu Nov 8 23:47:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c,1.23,1.24 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/dyn_gw/src Modified Files: olsrd_dyn_gw.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: olsrd_dyn_gw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** olsrd_dyn_gw.c 17 Sep 2007 21:57:05 -0000 1.23 --- olsrd_dyn_gw.c 8 Nov 2007 22:47:39 -0000 1.24 *************** *** 166,171 **** union olsr_ip_addr temp_net; union olsr_ip_addr temp_netmask; ! temp_net.v4 = INET_NET; ! temp_netmask.v4 = INET_PREFIX; the_hna_list = add_to_hna_list(the_hna_list, &temp_net, &temp_netmask); if (the_hna_list == NULL) { --- 166,171 ---- union olsr_ip_addr temp_net; union olsr_ip_addr temp_netmask; ! temp_net.v4.s_addr = INET_NET; ! temp_netmask.v4.s_addr = INET_PREFIX; the_hna_list = add_to_hna_list(the_hna_list, &temp_net, &temp_netmask); if (the_hna_list == NULL) { *************** *** 365,372 **** if( (iflags & RTF_UP) && (metric == 0) && ! (netmask == mask->v4) && ! (dest_addr == net->v4)) { ! if ( ((mask->v4==INET_PREFIX)&&(net->v4==INET_NET))&&(!(iflags & RTF_GATEWAY))) { fclose(fp); --- 365,372 ---- if( (iflags & RTF_UP) && (metric == 0) && ! (netmask == mask->v4.s_addr) && ! (dest_addr == net->v4.s_addr)) { ! if ( ((mask->v4.s_addr == INET_PREFIX)&&(net->v4.s_addr == INET_NET))&&(!(iflags & RTF_GATEWAY))) { fclose(fp); *************** *** 389,393 **** fclose(fp); if(retval == 0){ ! olsr_printf(1, "HNA[%08x/%08x] is invalid\n", net->v4,mask->v4); } return retval; --- 389,393 ---- fclose(fp); if(retval == 0){ ! olsr_printf(1, "HNA[%08x/%08x] is invalid\n", net->v4.s_addr, mask->v4.s_addr); } return retval; From (spam-protected) Thu Nov 8 23:47:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/pgraph/src olsrd_pgraph.c,1.9,1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/pgraph/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/pgraph/src Modified Files: olsrd_pgraph.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: olsrd_pgraph.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_pgraph.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** olsrd_pgraph.c 2 Nov 2007 20:58:07 -0000 1.9 --- olsrd_pgraph.c 8 Nov 2007 22:47:40 -0000 1.10 *************** *** 49,52 **** --- 49,53 ---- #include "olsrd_plugin.h" #include "plugin_util.h" + #include "net_olsr.h" #include *************** *** 99,103 **** ipc_port = 2004; if (olsr_cnf->ip_version == AF_INET) { ! ipc_accept_ip.v4 = htonl(INADDR_LOOPBACK); } else { ipc_accept_ip.v6 = in6addr_loopback; --- 100,104 ---- ipc_port = 2004; if (olsr_cnf->ip_version == AF_INET) { ! ipc_accept_ip.v4.s_addr = htonl(INADDR_LOOPBACK); } else { ipc_accept_ip.v6 = in6addr_loopback; *************** *** 163,175 **** char buf[256]; int len; ! const char* main_adr; ! const char* adr; // double etx=0.0; // char* style = "solid"; // struct link_entry* link; ! main_adr = olsr_ip_to_string(&olsr_cnf->main_addr); ! adr = olsr_ip_to_string(&neighbor->neighbor_main_addr); ! len = sprintf( buf, "add link %s %s\n", main_adr, adr ); ipc_send(buf, len); --- 164,176 ---- char buf[256]; int len; ! struct ipaddr_str main_adr, adr; // double etx=0.0; // char* style = "solid"; // struct link_entry* link; ! len = sprintf(buf, ! "add link %s %s\n", ! olsr_ip_to_string(&main_adr, &olsr_cnf->main_addr), ! olsr_ip_to_string(&adr, &neighbor->neighbor_main_addr)); ipc_send(buf, len); *************** *** 292,295 **** --- 293,297 ---- else { + struct ipaddr_str main_addr; addr = inet_ntoa(pin.sin_addr); /* *************** *** 304,308 **** */ olsr_printf(1, "(DOT DRAW)IPC: Connection from %s\n",addr); ! len = sprintf(buf, "add node %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); ipc_send(buf, len); pcf_event(1, 1, 1); --- 306,310 ---- */ olsr_printf(1, "(DOT DRAW)IPC: Connection from %s\n",addr); ! len = sprintf(buf, "add node %s\n", olsr_ip_to_string(&main_addr, &olsr_cnf->main_addr)); ipc_send(buf, len); pcf_event(1, 1, 1); *************** *** 404,414 **** char buf[256]; int len; ! const char* main_adr; ! const char* adr; // double etx = olsr_calc_tc_etx(dst_entry); ! main_adr = olsr_ip_to_string(&entry->addr); ! adr = olsr_ip_to_string(&dst_entry->T_dest_addr); ! len = sprintf( buf, "add link %s %s\n", main_adr, adr ); ipc_send(buf, len); } --- 406,415 ---- char buf[256]; int len; ! struct ipaddr_str main_adr, adr; // double etx = olsr_calc_tc_etx(dst_entry); ! len = sprintf( buf, "add link %s %s\n", ! olsr_ip_to_string(&main_adr, &entry->addr), ! olsr_ip_to_string(&adr, &dst_entry->T_dest_addr)); ipc_send(buf, len); } *************** *** 477,481 **** // check whether it's a link to the requested neighbor and // whether the link's quality is better than what we have ! if(COMP_IP(main, &walker->neighbor->neighbor_main_addr)) { curr = walker->loss_link_quality * walker->neigh_link_quality; --- 478,482 ---- // check whether it's a link to the requested neighbor and // whether the link's quality is better than what we have ! if(ipequal(main, &walker->neighbor->neighbor_main_addr)) { curr = walker->loss_link_quality * walker->neigh_link_quality; From (spam-protected) Thu Nov 8 23:47:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src plugin.c,1.14,1.15 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/tas/src Modified Files: plugin.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/plugin.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** plugin.c 2 Nov 2007 20:58:07 -0000 1.14 --- plugin.c 8 Nov 2007 22:47:40 -0000 1.15 *************** *** 52,55 **** --- 52,56 ---- #include "glua_ext.h" #include "olsrd_plugin.h" + #include "net_olsr.h" #include From (spam-protected) Thu Nov 8 23:47:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga/src olsrd_plugin.c, 1.8, 1.9 quagga.c, 1.9, 1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/quagga/src Modified Files: olsrd_plugin.c quagga.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/olsrd_plugin.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** olsrd_plugin.c 10 Oct 2007 21:24:54 -0000 1.8 --- olsrd_plugin.c 8 Nov 2007 22:47:40 -0000 1.9 *************** *** 26,29 **** --- 26,30 ---- #include "quagga.h" #include "kernel_routes.h" + #include "net_olsr.h" #define PLUGIN_NAME "OLSRD quagga plugin" Index: quagga.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/quagga.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** quagga.c 10 Oct 2007 21:29:48 -0000 1.9 --- quagga.c 8 Nov 2007 22:47:40 -0000 1.10 *************** *** 691,696 **** #endif ! mask.v4 = prefixlentomask(r.prefixlen); ! net.v4 = r.prefix; add_local_hna4_entry(&net, &mask); --- 691,696 ---- #endif ! mask.v4.s_addr = prefixlentomask(r.prefixlen); ! net.v4.s_addr = r.prefix; add_local_hna4_entry(&net, &mask); *************** *** 707,712 **** #endif ! mask.v4 = prefixlentomask(r.prefixlen); ! net.v4 = r.prefix; remove_local_hna4_entry(&net, &mask) ? 0 : -1; --- 707,712 ---- #endif ! mask.v4.s_addr = prefixlentomask(r.prefixlen); ! net.v4.s_addr = r.prefix; remove_local_hna4_entry(&net, &mask) ? 0 : -1; *************** *** 745,751 **** route.message = ZAPI_MESSAGE_METRIC; route.flags = zebra.flags; ! route.prefixlen =(r->rt_dst.prefix_len); ! route.prefix = r->rt_dst.prefix.v4; ! if ((r->rt_best->rtp_nexthop.gateway.v4 == r->rt_dst.prefix.v4 && route.prefixlen == 32)) { route.message |= ZAPI_MESSAGE_IFINDEX | ZAPI_MESSAGE_NEXTHOP; --- 745,751 ---- route.message = ZAPI_MESSAGE_METRIC; route.flags = zebra.flags; ! route.prefixlen = r->rt_dst.prefix_len; ! route.prefix = r->rt_dst.prefix.v4.s_addr; ! if ((r->rt_best->rtp_nexthop.gateway.v4.s_addr == r->rt_dst.prefix.v4.s_addr && route.prefixlen == 32)) { route.message |= ZAPI_MESSAGE_IFINDEX | ZAPI_MESSAGE_NEXTHOP; *************** *** 768,772 **** "zebra_add_olsr_v4_route"); route.nexthops->type = ZEBRA_NEXTHOP_IPV4; ! route.nexthops->payload.v4 = r->rt_best->rtp_nexthop.gateway.v4; } --- 768,772 ---- "zebra_add_olsr_v4_route"); route.nexthops->type = ZEBRA_NEXTHOP_IPV4; ! route.nexthops->payload.v4 = r->rt_best->rtp_nexthop.gateway.v4.s_addr; } *************** *** 792,797 **** route.flags = zebra.flags; route.prefixlen = r->rt_dst.prefix_len; ! route.prefix = r->rt_dst.prefix.v4; ! if ((r->rt_best->rtp_nexthop.gateway.v4 == r->rt_dst.prefix.v4 && route.prefixlen == 32)){ route.message |= ZAPI_MESSAGE_IFINDEX; --- 792,797 ---- route.flags = zebra.flags; route.prefixlen = r->rt_dst.prefix_len; ! route.prefix = r->rt_dst.prefix.v4.s_addr; ! if ((r->rt_best->rtp_nexthop.gateway.v4.s_addr == r->rt_dst.prefix.v4.s_addr && route.prefixlen == 32)){ route.message |= ZAPI_MESSAGE_IFINDEX; *************** *** 814,818 **** "zebra_add_olsr_v4_route"); route.nexthops->type = ZEBRA_NEXTHOP_IPV4; ! route.nexthops->payload.v4 = r->rt_best->rtp_nexthop.gateway.v4; } route.metric = r->rt_best->rtp_metric.hops; --- 814,818 ---- "zebra_add_olsr_v4_route"); route.nexthops->type = ZEBRA_NEXTHOP_IPV4; ! route.nexthops->payload.v4 = r->rt_best->rtp_nexthop.gateway.v4.s_addr; } route.metric = r->rt_best->rtp_metric.hops; From (spam-protected) Thu Nov 8 23:47:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src admin_interface.c, 1.11, 1.12 olsrd_httpinfo.c, 1.82, 1.83 olsrd_plugin.c, 1.20, 1.21 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/httpinfo/src Modified Files: admin_interface.c olsrd_httpinfo.c olsrd_plugin.c Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** olsrd_httpinfo.c 5 Nov 2007 15:32:55 -0000 1.82 --- olsrd_httpinfo.c 8 Nov 2007 22:47:40 -0000 1.83 *************** *** 162,166 **** static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, ! const union olsr_ip_addr * const ipaddr, const int prefix_len); static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, --- 162,166 ---- static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, ! const char * const ipaddrstr, const int prefix_len); [...1191 lines suppressed...] size = snprintf(buf, size, "ERROR GENERATING CONFIGFILE!\n"); } i++; ! while (cfgfile_body[i]) { size += snprintf(&buf[size], bufsize-size, cfgfile_body[i]); i++; *************** *** 1164,1168 **** const struct allowed_net *alln; for (alln = allowed_nets; alln != NULL; alln = alln->next) { ! if((addr->v4 & alln->mask.v4) == (alln->net.v4 & alln->mask.v4)) { return 1; } --- 1136,1140 ---- const struct allowed_net *alln; for (alln = allowed_nets; alln != NULL; alln = alln->next) { ! if ((addr->v4.s_addr & alln->mask.v4.s_addr) == (alln->net.v4.s_addr & alln->mask.v4.s_addr)) { return 1; } Index: admin_interface.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/admin_interface.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** admin_interface.c 5 Nov 2007 15:32:55 -0000 1.11 --- admin_interface.c 8 Nov 2007 22:47:40 -0000 1.12 *************** *** 52,55 **** --- 52,56 ---- #include "admin_interface.h" #include "local_hna_set.h" /* add_local_hna4_entry() */ + #include "net_olsr.h" #include *************** *** 124,128 **** if(olsr_cnf->ip_version == AF_INET) { struct local_hna_entry *hna; ! for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { union olsr_ip_addr netmask; --- 125,129 ---- if(olsr_cnf->ip_version == AF_INET) { struct local_hna_entry *hna; ! struct ipaddr_str netbuf, maskbuf; for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { union olsr_ip_addr netmask; *************** *** 130,142 **** size += snprintf(&buf[size], bufsize-size, "%1$s%2$s\n", ! olsr_ip_to_string(&hna->net.prefix), ! olsr_ip_to_string(&netmask)); } } else { struct local_hna_entry *hna; for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { size += snprintf(&buf[size], bufsize-size, "%1$s%2$d\n", ! olsr_ip_to_string(&hna->net.prefix), hna->net.prefix_len); } --- 131,144 ---- size += snprintf(&buf[size], bufsize-size, "%1$s%2$s\n", ! olsr_ip_to_string(&netbuf, &hna->net.prefix), ! olsr_ip_to_string(&maskbuf, &netmask)); } } else { struct local_hna_entry *hna; for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { + struct ipaddr_str netbuf; size += snprintf(&buf[size], bufsize-size, "%1$s%2$d\n", ! olsr_ip_to_string(&netbuf, &hna->net.prefix), hna->net.prefix_len); } Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_plugin.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** olsrd_plugin.c 17 Sep 2007 21:57:05 -0000 1.20 --- olsrd_plugin.c 8 Nov 2007 22:47:40 -0000 1.21 *************** *** 118,131 **** static int insert_plugin_ipnet(const char *sz_net, const char *sz_mask, struct allowed_net **allowed_nets) { - struct in_addr net, mask; struct allowed_net *an; - if(inet_aton(sz_net, &net) == 0) { - return 1; - } - if(inet_aton(sz_mask, &mask) == 0) { - return 1; - } - an = olsr_malloc(sizeof(*an), __func__); if (an == NULL) { --- 118,123 ---- *************** *** 134,139 **** } ! an->net.v4 = net.s_addr; ! an->mask.v4 = mask.s_addr; an->next = *allowed_nets; *allowed_nets = an; --- 126,134 ---- } ! if(inet_aton(sz_net, &an->net.v4) == 0 || ! inet_aton(sz_mask, &an->mask.v4) == 0) { ! free(an); ! return 1; ! } an->next = *allowed_nets; *allowed_nets = an; From (spam-protected) Thu Nov 8 23:47:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/secure/src olsrd_secure.c, 1.28, 1.29 secure_messages.h, 1.3, 1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/secure/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/secure/src Modified Files: olsrd_secure.c secure_messages.h Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: secure_messages.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/secure_messages.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** secure_messages.h 15 Jul 2007 21:47:17 -0000 1.3 --- secure_messages.h 8 Nov 2007 22:47:40 -0000 1.4 *************** *** 89,93 **** time_t timestamp; ! char signature[SIGSIZE]; }; --- 89,93 ---- time_t timestamp; ! olsr_u8_t signature[SIGSIZE]; }; Index: olsrd_secure.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/olsrd_secure.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** olsrd_secure.c 20 Oct 2007 15:16:32 -0000 1.28 --- olsrd_secure.c 8 Nov 2007 22:47:40 -0000 1.29 *************** *** 59,62 **** --- 59,63 ---- #include "parser.h" #include "scheduler.h" + #include "net_olsr.h" #ifdef USE_OPENSSL *************** *** 151,160 **** #endif static int add_signature(olsr_u8_t *, int*); ! static int validate_packet(char *, int*); static void packet_parser(int); static void timeout_timestamps(void*); static int check_timestamp(union olsr_ip_addr *, time_t); static struct stamp *lookup_timestamp_entry(union olsr_ip_addr *); ! static int read_key_from_file(char *); /** --- 152,161 ---- #endif static int add_signature(olsr_u8_t *, int*); ! static int validate_packet(const char *, int*); static void packet_parser(int); static void timeout_timestamps(void*); static int check_timestamp(union olsr_ip_addr *, time_t); static struct stamp *lookup_timestamp_entry(union olsr_ip_addr *); ! static int read_key_from_file(const char *); /** *************** *** 308,311 **** --- 309,313 ---- for (;;) { + struct ipaddr_str buf; fromlen = sizeof(struct sockaddr_storage); *************** *** 351,356 **** if((olsr_in_if = if_ifwithsock(fd)) == NULL) { olsr_printf(1, "[ENC]Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&from_addr), cc); return ; --- 353,359 ---- if((olsr_in_if = if_ifwithsock(fd)) == NULL) { + struct ipaddr_str buf; olsr_printf(1, "[ENC]Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&buf, &from_addr), cc); return ; *************** *** 368,377 **** if(!validate_packet(inbuf.buf, &cc)) { ! olsr_printf(1, "[ENC]Rejecting packet from %s\n", olsr_ip_to_string((union olsr_ip_addr *)&((struct sockaddr_in *)&from)->sin_addr.s_addr)); return; } ! olsr_printf(1, "[ENC]Packet from %s OK size %d\n", olsr_ip_to_string((union olsr_ip_addr *)&((struct sockaddr_in *)&from)->sin_addr.s_addr), cc); --- 371,380 ---- if(!validate_packet(inbuf.buf, &cc)) { ! olsr_printf(1, "[ENC]Rejecting packet from %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&((struct sockaddr_in *)&from)->sin_addr.s_addr)); return; } ! olsr_printf(1, "[ENC]Packet from %s OK size %d\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&((struct sockaddr_in *)&from)->sin_addr.s_addr), cc); *************** *** 452,456 **** unsigned int i; int j; ! char *sigmsg; #endif --- 455,459 ---- unsigned int i; int j; ! const olsr_u8_t *sigmsg; #endif *************** *** 481,485 **** /* Set the new size */ ! *size = *size + sizeof(struct s_olsrmsg); { --- 484,488 ---- /* Set the new size */ ! *size += sizeof(struct s_olsrmsg); { *************** *** 499,507 **** j = 0; ! sigmsg = (char *)msg; for(i = 0; i < sizeof(struct s_olsrmsg); i++) { ! olsr_printf(1, " %3i", (u_char) sigmsg[i]); j++; if(j == 4) --- 502,510 ---- j = 0; ! sigmsg = (olsr_u8_t *)msg; for(i = 0; i < sizeof(struct s_olsrmsg); i++) { ! olsr_printf(1, " %3i", sigmsg[i]); j++; if(j == 4) *************** *** 520,525 **** ! int ! validate_packet(char *pck, int *size) { int packetsize; --- 523,528 ---- ! static int ! validate_packet(const char *pck, int *size) { int packetsize; *************** *** 531,535 **** unsigned int i; int j; ! olsr_u8_t *sigmsg; #endif --- 534,538 ---- unsigned int i; int j; ! const olsr_u8_t *sigmsg; #endif *************** *** 548,556 **** j = 0; ! sigmsg = (olsr_u8_t *)sig; for(i = 0; i < sizeof(struct s_olsrmsg); i++) { ! olsr_printf(1, " %3i", (u_char) sigmsg[i]); j++; if(j == 4) --- 551,559 ---- j = 0; ! sigmsg = (const olsr_u8_t *)sig; for(i = 0; i < sizeof(struct s_olsrmsg); i++) { ! olsr_printf(1, " %3i", sigmsg[i]); j++; if(j == 4) *************** *** 564,568 **** /* Sanity check first */ if((sig->olsr_msgtype != MESSAGE_TYPE) || ! (sig->olsr_vtime) || (sig->olsr_msgsize != ntohs(sizeof(struct s_olsrmsg))) || (sig->ttl != 1) || --- 567,571 ---- /* Sanity check first */ if((sig->olsr_msgtype != MESSAGE_TYPE) || ! (sig->olsr_vtime != 0) || (sig->olsr_msgsize != ntohs(sizeof(struct s_olsrmsg))) || (sig->ttl != 1) || *************** *** 589,594 **** olsr_printf(1, "[ENC]Unsupported sceme: %d enc: %d!\n", sig->sig.type, sig->sig.algorithm); return 0; - break; - } //olsr_printf(1, "Packet sane...\n"); --- 592,595 ---- *************** *** 611,619 **** olsr_printf(1, "Recevied hash:\n"); ! sigmsg = (olsr_u8_t *)sig->sig.signature; for(i = 0; i < SIGNATURE_SIZE; i++) { ! olsr_printf(1, " %3i", (u_char) sigmsg[i]); } olsr_printf(1, "\n"); --- 612,620 ---- olsr_printf(1, "Recevied hash:\n"); ! sigmsg = (const olsr_u8_t *)sig->sig.signature; for(i = 0; i < SIGNATURE_SIZE; i++) { ! olsr_printf(1, " %3i", sigmsg[i]); } olsr_printf(1, "\n"); *************** *** 625,629 **** for(i = 0; i < SIGNATURE_SIZE; i++) { ! olsr_printf(1, " %3i", (u_char) sigmsg[i]); } olsr_printf(1, "\n"); --- 626,630 ---- for(i = 0; i < SIGNATURE_SIZE; i++) { ! olsr_printf(1, " %3i", sigmsg[i]); } olsr_printf(1, "\n"); *************** *** 641,646 **** if(!check_timestamp((union olsr_ip_addr *)&sig->originator, rec_time)) { olsr_printf(1, "[ENC]Timestamp missmatch in packet from %s!\n", ! olsr_ip_to_string((union olsr_ip_addr *)&sig->originator)); return 0; } --- 642,648 ---- if(!check_timestamp((union olsr_ip_addr *)&sig->originator, rec_time)) { + struct ipaddr_str buf; olsr_printf(1, "[ENC]Timestamp missmatch in packet from %s!\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&sig->originator)); return 0; } *************** *** 715,718 **** --- 717,721 ---- struct stamp *entry; olsr_u32_t challenge, hash; + struct ipaddr_str buf; olsr_printf(1, "[ENC]Building CHALLENGE message\n"); *************** *** 753,757 **** } olsr_printf(3, "[ENC]Sending timestamp request to %s challenge 0x%x\n", ! olsr_ip_to_string(new_host), challenge); --- 756,760 ---- } olsr_printf(3, "[ENC]Sending timestamp request to %s challenge 0x%x\n", ! olsr_ip_to_string(&buf, new_host), challenge); *************** *** 793,801 **** olsr_u8_t sha1_hash[SIGNATURE_SIZE]; struct stamp *entry; msg = (struct c_respmsg *)in_msg; olsr_printf(1, "[ENC]Challenge-response message received\n"); ! olsr_printf(3, "[ENC]To: %s\n", olsr_ip_to_string((union olsr_ip_addr *)&msg->destination)); if(if_ifwithaddr((union olsr_ip_addr *)&msg->destination) == NULL) --- 796,805 ---- olsr_u8_t sha1_hash[SIGNATURE_SIZE]; struct stamp *entry; + struct ipaddr_str buf; msg = (struct c_respmsg *)in_msg; olsr_printf(1, "[ENC]Challenge-response message received\n"); ! olsr_printf(3, "[ENC]To: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->destination)); if(if_ifwithaddr((union olsr_ip_addr *)&msg->destination) == NULL) *************** *** 835,840 **** if((entry = lookup_timestamp_entry((union olsr_ip_addr *)&msg->originator)) == NULL) { olsr_printf(1, "[ENC]Received challenge-response from non-registered node %s!\n", ! olsr_ip_to_string((union olsr_ip_addr *)&msg->originator)); return 0; } --- 839,845 ---- if((entry = lookup_timestamp_entry((union olsr_ip_addr *)&msg->originator)) == NULL) { + struct ipaddr_str buf; olsr_printf(1, "[ENC]Received challenge-response from non-registered node %s!\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->originator)); return 0; } *************** *** 858,863 **** if(memcmp(msg->res_sig, sha1_hash, SIGNATURE_SIZE) != 0) { olsr_printf(1, "[ENC]Error in challenge signature from %s!\n", ! olsr_ip_to_string((union olsr_ip_addr *)&msg->originator)); return 0; --- 863,869 ---- if(memcmp(msg->res_sig, sha1_hash, SIGNATURE_SIZE) != 0) { + struct ipaddr_str buf; olsr_printf(1, "[ENC]Error in challenge signature from %s!\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->originator)); return 0; *************** *** 877,881 **** olsr_printf(1, "[ENC]%s registered with diff %d!\n", ! olsr_ip_to_string((union olsr_ip_addr *)&msg->originator), entry->diff); --- 883,887 ---- olsr_printf(1, "[ENC]%s registered with diff %d!\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->originator), entry->diff); *************** *** 895,903 **** olsr_u8_t sha1_hash[SIGNATURE_SIZE]; struct stamp *entry; msg = (struct r_respmsg *)in_msg; olsr_printf(1, "[ENC]Response-response message received\n"); ! olsr_printf(3, "[ENC]To: %s\n", olsr_ip_to_string((union olsr_ip_addr *)&msg->destination)); if(if_ifwithaddr((union olsr_ip_addr *)&msg->destination) == NULL) --- 901,910 ---- olsr_u8_t sha1_hash[SIGNATURE_SIZE]; struct stamp *entry; + struct ipaddr_str buf; msg = (struct r_respmsg *)in_msg; olsr_printf(1, "[ENC]Response-response message received\n"); ! olsr_printf(3, "[ENC]To: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->destination)); if(if_ifwithaddr((union olsr_ip_addr *)&msg->destination) == NULL) *************** *** 935,940 **** if((entry = lookup_timestamp_entry((union olsr_ip_addr *)&msg->originator)) == NULL) { olsr_printf(1, "[ENC]Received response-response from non-registered node %s!\n", ! olsr_ip_to_string((union olsr_ip_addr *)&msg->originator)); return 0; } --- 942,948 ---- if((entry = lookup_timestamp_entry((union olsr_ip_addr *)&msg->originator)) == NULL) { + struct ipaddr_str buf; olsr_printf(1, "[ENC]Received response-response from non-registered node %s!\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->originator)); return 0; } *************** *** 958,963 **** if(memcmp(msg->res_sig, sha1_hash, SIGNATURE_SIZE) != 0) { olsr_printf(1, "[ENC]Error in response signature from %s!\n", ! olsr_ip_to_string((union olsr_ip_addr *)&msg->originator)); return 0; --- 966,972 ---- if(memcmp(msg->res_sig, sha1_hash, SIGNATURE_SIZE) != 0) { + struct ipaddr_str buf; olsr_printf(1, "[ENC]Error in response signature from %s!\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->originator)); return 0; *************** *** 977,981 **** olsr_printf(1, "[ENC]%s registered with diff %d!\n", ! olsr_ip_to_string((union olsr_ip_addr *)&msg->originator), entry->diff); --- 986,990 ---- olsr_printf(1, "[ENC]%s registered with diff %d!\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->originator), entry->diff); *************** *** 991,999 **** struct stamp *entry; olsr_u32_t hash; ! msg = (struct challengemsg *)in_msg; olsr_printf(1, "[ENC]Challenge message received\n"); ! olsr_printf(3, "[ENC]To: %s\n", olsr_ip_to_string((union olsr_ip_addr *)&msg->destination)); if(if_ifwithaddr((union olsr_ip_addr *)&msg->destination) == NULL) --- 1000,1009 ---- struct stamp *entry; olsr_u32_t hash; ! struct ipaddr_str buf; ! msg = (struct challengemsg *)in_msg; olsr_printf(1, "[ENC]Challenge message received\n"); ! olsr_printf(3, "[ENC]To: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->destination)); if(if_ifwithaddr((union olsr_ip_addr *)&msg->destination) == NULL) *************** *** 1088,1091 **** --- 1098,1102 ---- struct c_respmsg crmsg; olsr_u32_t challenge; + struct ipaddr_str buf; olsr_printf(1, "[ENC]Building CRESPONSE message\n"); *************** *** 1148,1152 **** olsr_printf(3, "[ENC]Sending challenge response to %s challenge 0x%x\n", ! olsr_ip_to_string(to), challenge); --- 1159,1163 ---- olsr_printf(3, "[ENC]Sending challenge response to %s challenge 0x%x\n", ! olsr_ip_to_string(&buf, to), challenge); *************** *** 1173,1176 **** --- 1184,1188 ---- { struct r_respmsg rrmsg; + struct ipaddr_str buf; olsr_printf(1, "[ENC]Building RRESPONSE message\n"); *************** *** 1226,1230 **** olsr_printf(3, "[ENC]Sending response response to %s\n", ! olsr_ip_to_string(to)); /* add to buffer */ --- 1238,1242 ---- olsr_printf(3, "[ENC]Sending response response to %s\n", ! olsr_ip_to_string(&buf, to)); /* add to buffer */ *************** *** 1244,1247 **** --- 1256,1260 ---- olsr_u32_t hash; struct stamp *entry; + struct ipaddr_str buf; hash = olsr_hashing(adr); *************** *** 1253,1262 **** if(memcmp(&entry->addr, adr, olsr_cnf->ipsize) == 0) { ! olsr_printf(3, "[ENC]Match for %s\n", olsr_ip_to_string(adr)); return entry; } } ! olsr_printf(1, "[ENC]No match for %s\n", olsr_ip_to_string(adr)); return NULL; --- 1266,1275 ---- if(memcmp(&entry->addr, adr, olsr_cnf->ipsize) == 0) { ! olsr_printf(3, "[ENC]Match for %s\n", olsr_ip_to_string(&buf, adr)); return entry; } } ! olsr_printf(1, "[ENC]No match for %s\n", olsr_ip_to_string(&buf, adr)); return NULL; *************** *** 1287,1295 **** if((TIMED_OUT(tmp_list->valtime)) && (TIMED_OUT(tmp_list->conftime))) { entry_to_delete = tmp_list; tmp_list = tmp_list->next; olsr_printf(1, "[ENC]timestamp info for %s timed out.. deleting it\n", ! olsr_ip_to_string(&entry_to_delete->addr)); /*Delete it*/ --- 1300,1309 ---- if((TIMED_OUT(tmp_list->valtime)) && (TIMED_OUT(tmp_list->conftime))) { + struct ipaddr_str buf; entry_to_delete = tmp_list; tmp_list = tmp_list->next; olsr_printf(1, "[ENC]timestamp info for %s timed out.. deleting it\n", ! olsr_ip_to_string(&buf, &entry_to_delete->addr)); /*Delete it*/ *************** *** 1310,1314 **** static int ! read_key_from_file(char *file) { FILE *kf; --- 1324,1328 ---- static int ! read_key_from_file(const char *file) { FILE *kf; From (spam-protected) Fri Nov 9 00:23:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 23:23:15 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c,1.24,1.25 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12075/lib/dyn_gw/src Modified Files: olsrd_dyn_gw.c Log Message: * and make it compile on Win32 Index: olsrd_dyn_gw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** olsrd_dyn_gw.c 8 Nov 2007 22:47:39 -0000 1.24 --- olsrd_dyn_gw.c 8 Nov 2007 23:23:13 -0000 1.25 *************** *** 389,393 **** fclose(fp); if(retval == 0){ ! olsr_printf(1, "HNA[%08x/%08x] is invalid\n", net->v4.s_addr, mask->v4.s_addr); } return retval; --- 389,393 ---- fclose(fp); if(retval == 0){ ! olsr_printf(1, "HNA[%08x/%08x] is invalid\n", (unsigned int)net->v4.s_addr, (unsigned int)mask->v4.s_addr); } return retval; From (spam-protected) Fri Nov 9 00:23:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 23:23:15 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch main.c,1.29,1.30 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12075/src/olsr_switch Modified Files: main.c Log Message: * and make it compile on Win32 Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/main.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** main.c 8 Nov 2007 22:47:42 -0000 1.29 --- main.c 8 Nov 2007 23:23:13 -0000 1.30 *************** *** 171,175 **** for (i = 0; i < 20; i++) { ! if (recv(oc->socket, &new_addr, sizeof(new_addr), 0) == 4) break; --- 171,175 ---- for (i = 0; i < 20; i++) { ! if (recv(oc->socket, (void *)&new_addr, sizeof(new_addr), 0) == 4) break; From (spam-protected) Fri Nov 9 00:23:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 23:23:15 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 compat.c, 1.16, 1.17 ifnet.c, 1.39, 1.40 kernel_routes.c, 1.23, 1.24 net.c, 1.22, 1.23 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12075/src/win32 Modified Files: compat.c ifnet.c kernel_routes.c net.c Log Message: * and make it compile on Win32 Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/ifnet.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** ifnet.c 8 Nov 2007 22:47:43 -0000 1.39 --- ifnet.c 8 Nov 2007 23:23:13 -0000 1.40 *************** *** 51,58 **** --- 51,61 ---- #include "mantissa.h" #include "lq_packet.h" + #include "net_olsr.h" #include #include + #include + struct MibIpInterfaceRow { *************** *** 545,550 **** else { ! COPY_IP(&olsr_cnf->main_addr, &ifnet->ip_addr); ! OLSR_PRINTF(1, "New main address: %s.\n", olsr_ip_to_string(&olsr_cnf->main_addr)); } } --- 548,555 ---- else { ! struct ipaddr_str buf; ! //COPY_IP(&olsr_cnf->main_addr, &ifnet->ip_addr); ! olsr_cnf->main_addr = ifnet->ip_addr; ! OLSR_PRINTF(1, "New main address: %s.\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); } } *************** *** 604,607 **** --- 609,613 ---- union olsr_ip_addr null_addr; olsr_u32_t addr[4]; + struct ipaddr_str buf; if(!iface->host_emul) *************** *** 623,627 **** OLSR_PRINTF(1, "Adding %s(host emulation):\n", ifp->int_name); ! OLSR_PRINTF(1, " Address:%s\n", olsr_ip_to_string(&iface->hemu_ip)); OLSR_PRINTF(1, " NB! This is a emulated interface\n that does not exist in the kernel!\n"); --- 629,633 ---- OLSR_PRINTF(1, "Adding %s(host emulation):\n", ifp->int_name); ! OLSR_PRINTF(1, " Address:%s\n", olsr_ip_to_string(&buf, &iface->hemu_ip)); OLSR_PRINTF(1, " NB! This is a emulated interface\n that does not exist in the kernel!\n"); *************** *** 633,638 **** if(ipequal(&null_addr, &olsr_cnf->main_addr)) { ! COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip); ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); } --- 639,645 ---- if(ipequal(&null_addr, &olsr_cnf->main_addr)) { ! //COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip); ! olsr_cnf->main_addr = iface->hemu_ip; ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); } *************** *** 777,780 **** --- 784,788 ---- int chk_if_changed(struct olsr_if *IntConf) { + struct ipaddr_str buf; struct interface *Int; struct InterfaceInfo Info; *************** *** 837,852 **** } ! OldVal.v4 = ((struct sockaddr_in *)&Int->int_addr)->sin_addr.s_addr; ! NewVal.v4 = Info.Addr; #ifdef DEBUG ! OLSR_PRINTF(3, "\tAddress: %s\n", olsr_ip_to_string(&NewVal)); #endif ! if (NewVal.v4 != OldVal.v4) { OLSR_PRINTF(1, "\tAddress change.\n"); ! OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&OldVal)); ! OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&NewVal)); Int->ip_addr.v4 = NewVal.v4; --- 845,860 ---- } ! OldVal.v4 = ((struct sockaddr_in *)&Int->int_addr)->sin_addr; ! NewVal.v4.s_addr = Info.Addr; #ifdef DEBUG ! OLSR_PRINTF(3, "\tAddress: %s\n", olsr_ip_to_string(&buf, &NewVal)); #endif ! if (NewVal.v4.s_addr != OldVal.v4.s_addr) { OLSR_PRINTF(1, "\tAddress change.\n"); ! OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&buf, &OldVal)); ! OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&buf, &NewVal)); Int->ip_addr.v4 = NewVal.v4; *************** *** 856,862 **** AddrIn->sin_family = AF_INET; AddrIn->sin_port = 0; ! AddrIn->sin_addr.s_addr = NewVal.v4; ! if (olsr_cnf->main_addr.v4 == OldVal.v4) { OLSR_PRINTF(1, "\tMain address change.\n"); --- 864,870 ---- AddrIn->sin_family = AF_INET; AddrIn->sin_port = 0; ! AddrIn->sin_addr = NewVal.v4; ! if (olsr_cnf->main_addr.v4.s_addr == OldVal.v4.s_addr) { OLSR_PRINTF(1, "\tMain address change.\n"); *************** *** 871,886 **** OLSR_PRINTF(3, "\tNo address change.\n"); ! OldVal.v4 = ((struct sockaddr_in *)&Int->int_netmask)->sin_addr.s_addr; ! NewVal.v4 = Info.Mask; #ifdef DEBUG ! OLSR_PRINTF(3, "\tNetmask: %s\n", olsr_ip_to_string(&NewVal)); #endif ! if (NewVal.v4 != OldVal.v4) { OLSR_PRINTF(1, "\tNetmask change.\n"); ! OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&OldVal)); ! OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&NewVal)); AddrIn = (struct sockaddr_in *)&Int->int_netmask; --- 879,894 ---- OLSR_PRINTF(3, "\tNo address change.\n"); ! OldVal.v4 = ((struct sockaddr_in *)&Int->int_netmask)->sin_addr; ! NewVal.v4.s_addr = Info.Mask; #ifdef DEBUG ! OLSR_PRINTF(3, "\tNetmask: %s\n", olsr_ip_to_string(&buf, &NewVal)); #endif ! if (NewVal.v4.s_addr != OldVal.v4.s_addr) { OLSR_PRINTF(1, "\tNetmask change.\n"); ! OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&buf, &OldVal)); ! OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&buf, &NewVal)); AddrIn = (struct sockaddr_in *)&Int->int_netmask; *************** *** 888,892 **** AddrIn->sin_family = AF_INET; AddrIn->sin_port = 0; ! AddrIn->sin_addr.s_addr = NewVal.v4; Res = 1; --- 896,900 ---- AddrIn->sin_family = AF_INET; AddrIn->sin_port = 0; ! AddrIn->sin_addr = NewVal.v4; Res = 1; *************** *** 896,911 **** OLSR_PRINTF(3, "\tNo netmask change.\n"); ! OldVal.v4 = ((struct sockaddr_in *)&Int->int_broadaddr)->sin_addr.s_addr; ! NewVal.v4 = Info.Broad; #ifdef DEBUG ! OLSR_PRINTF(3, "\tBroadcast address: %s\n", olsr_ip_to_string(&NewVal)); #endif ! if (NewVal.v4 != OldVal.v4) { OLSR_PRINTF(1, "\tBroadcast address change.\n"); ! OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&OldVal)); ! OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&NewVal)); AddrIn = (struct sockaddr_in *)&Int->int_broadaddr; --- 904,919 ---- OLSR_PRINTF(3, "\tNo netmask change.\n"); ! OldVal.v4 = ((struct sockaddr_in *)&Int->int_broadaddr)->sin_addr; ! NewVal.v4.s_addr = Info.Broad; #ifdef DEBUG ! OLSR_PRINTF(3, "\tBroadcast address: %s\n", olsr_ip_to_string(&buf, &NewVal)); #endif ! if (NewVal.v4.s_addr != OldVal.v4.s_addr) { OLSR_PRINTF(1, "\tBroadcast address change.\n"); ! OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&buf, &OldVal)); ! OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&buf, &NewVal)); AddrIn = (struct sockaddr_in *)&Int->int_broadaddr; *************** *** 913,917 **** AddrIn->sin_family = AF_INET; AddrIn->sin_port = 0; ! AddrIn->sin_addr.s_addr = NewVal.v4; Res = 1; --- 921,925 ---- AddrIn->sin_family = AF_INET; AddrIn->sin_port = 0; ! AddrIn->sin_addr = NewVal.v4; Res = 1; *************** *** 929,932 **** --- 937,941 ---- int chk_if_up(struct olsr_if *IntConf, int DebugLevel __attribute__((unused))) { + struct ipaddr_str buf; struct InterfaceInfo Info; struct interface *New; *************** *** 966,971 **** AddrIn->sin_addr.s_addr = Info.Broad; ! if (IntConf->cnf->ipv4_broadcast.v4 != 0) ! AddrIn->sin_addr.s_addr = IntConf->cnf->ipv4_broadcast.v4; New->int_flags = 0; --- 975,980 ---- AddrIn->sin_addr.s_addr = Info.Broad; ! if (IntConf->cnf->ipv4_broadcast.v4.s_addr != 0) ! AddrIn->sin_addr = IntConf->cnf->ipv4_broadcast.v4; New->int_flags = 0; *************** *** 999,1009 **** OLSR_PRINTF(1, "\tMTU: %d\n", New->int_mtu); ! OLSR_PRINTF(1, "\tAddress: %s\n", sockaddr_to_string(&New->int_addr)); ! OLSR_PRINTF(1, "\tNetmask: %s\n", sockaddr_to_string(&New->int_netmask)); ! OLSR_PRINTF(1, "\tBroadcast address: %s\n", ! sockaddr_to_string(&New->int_broadaddr)); ! New->ip_addr.v4 = ! ((struct sockaddr_in *)&New->int_addr)->sin_addr.s_addr; New->if_index = Info.Index; --- 1008,1016 ---- OLSR_PRINTF(1, "\tMTU: %d\n", New->int_mtu); ! OLSR_PRINTF(1, "\tAddress: %s\n", sockaddr_to_string(&buf, (const struct sockaddr*)&New->int_addr)); ! OLSR_PRINTF(1, "\tNetmask: %s\n", sockaddr_to_string(&buf, (const struct sockaddr*)&New->int_netmask)); ! OLSR_PRINTF(1, "\tBroadcast address: %s\n", sockaddr_to_string(&buf, (const struct sockaddr*)&New->int_broadaddr)); ! New->ip_addr.v4 = New->int_addr.sin_addr; New->if_index = Info.Index; *************** *** 1012,1016 **** AddrSockAddr = addrsock.sin_addr.s_addr; ! addrsock.sin_addr.s_addr = New->ip_addr.v4; New->olsr_socket = getsocket((struct sockaddr *)&addrsock, --- 1019,1023 ---- AddrSockAddr = addrsock.sin_addr.s_addr; ! addrsock.sin_addr = New->ip_addr.v4; New->olsr_socket = getsocket((struct sockaddr *)&addrsock, *************** *** 1037,1042 **** if(ipequal(&NullAddr, &olsr_cnf->main_addr)) { ! COPY_IP(&olsr_cnf->main_addr, &New->ip_addr); ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr)); } --- 1044,1050 ---- if(ipequal(&NullAddr, &olsr_cnf->main_addr)) { ! //COPY_IP(&olsr_cnf->main_addr, &New->ip_addr); ! olsr_cnf->main_addr = New->ip_addr; ! OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); } Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/net.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** net.c 25 Apr 2007 22:24:09 -0000 1.22 --- net.c 8 Nov 2007 23:23:13 -0000 1.23 *************** *** 55,58 **** --- 55,59 ---- #include "defs.h" #include "net_os.h" + #include "net_olsr.h" #if defined WINCE *************** *** 338,348 **** { /* See linux/in6.h */ ! struct ipv6_mreq McastReq; ! COPY_IP(&McastReq.ipv6mr_multiaddr, &Nic->int6_multaddr.sin6_addr); McastReq.ipv6mr_interface = Nic->if_index; ! OLSR_PRINTF(3, "Interface %s joining multicast %s...", Nic->int_name, olsr_ip_to_string((union olsr_ip_addr *)&Nic->int6_multaddr.sin6_addr)); /* Send multicast */ if(setsockopt(Sock, --- 339,350 ---- { /* See linux/in6.h */ ! struct ipaddr_str buf; struct ipv6_mreq McastReq; ! //COPY_IP(&McastReq.ipv6mr_multiaddr, &Nic->int6_multaddr.sin6_addr); ! McastReq.ipv6mr_multiaddr = Nic->int6_multaddr.sin6_addr; McastReq.ipv6mr_interface = Nic->if_index; ! OLSR_PRINTF(3, "Interface %s joining multicast %s...", Nic->int_name, olsr_ip_to_string(&buf, (union olsr_ip_addr *)&Nic->int6_multaddr.sin6_addr)); /* Send multicast */ if(setsockopt(Sock, Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/kernel_routes.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** kernel_routes.c 5 Sep 2007 22:17:26 -0000 1.23 --- kernel_routes.c 8 Nov 2007 23:23:13 -0000 1.24 *************** *** 44,48 **** #include "kernel_routes.h" ! #include "defs.h" #define WIN32_LEAN_AND_MEAN --- 44,49 ---- #include "kernel_routes.h" ! #include "net_olsr.h" ! #include "ipc_frontend.h" #define WIN32_LEAN_AND_MEAN *************** *** 70,86 **** memset(&Row, 0, sizeof (MIB_IPFORWARDROW)); ! Row.dwForwardDest = rt->rt_dst.prefix.v4; if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { return -1; } else { ! Row.dwForwardMask = mask.v4; } Row.dwForwardPolicy = 0; ! Row.dwForwardNextHop = rt->rt_best->rtp_nexthop.gateway.v4; Row.dwForwardIfIndex = rt->rt_best->rtp_nexthop.iif_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT ! Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_best->rtp_nexthop.gateway.v4) ? 3 : 4; Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT Row.dwForwardAge = INFINITE; --- 71,87 ---- memset(&Row, 0, sizeof (MIB_IPFORWARDROW)); ! Row.dwForwardDest = rt->rt_dst.prefix.v4.s_addr; if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { return -1; } else { ! Row.dwForwardMask = mask.v4.s_addr; } Row.dwForwardPolicy = 0; ! Row.dwForwardNextHop = rt->rt_best->rtp_nexthop.gateway.v4.s_addr; Row.dwForwardIfIndex = rt->rt_best->rtp_nexthop.iif_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT ! Row.dwForwardType = (rt->rt_dst.prefix.v4.s_addr == rt->rt_best->rtp_nexthop.gateway.v4.s_addr) ? 3 : 4; Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT Row.dwForwardAge = INFINITE; *************** *** 147,165 **** OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); ! memset(&Row, 0, sizeof (MIB_IPFORWARDROW)); ! Row.dwForwardDest = rt->rt_dst.prefix.v4; if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { return -1; - } else { - Row.dwForwardMask = mask.v4; } ! Row.dwForwardPolicy = 0; ! Row.dwForwardNextHop = rt->rt_nexthop.gateway.v4; Row.dwForwardIfIndex = rt->rt_nexthop.iif_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT ! Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_nexthop.gateway.v4) ? 3 : 4; Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT Row.dwForwardAge = INFINITE; --- 148,164 ---- OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt)); ! memset(&Row, 0, sizeof (Row)); ! Row.dwForwardDest = rt->rt_dst.prefix.v4.s_addr; if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) { return -1; } ! Row.dwForwardMask = mask.v4.s_addr; Row.dwForwardPolicy = 0; ! Row.dwForwardNextHop = rt->rt_nexthop.gateway.v4.s_addr; Row.dwForwardIfIndex = rt->rt_nexthop.iif_index; // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT ! Row.dwForwardType = (rt->rt_dst.prefix.v4.s_addr == rt->rt_nexthop.gateway.v4.s_addr) ? 3 : 4; Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT Row.dwForwardAge = INFINITE; Index: compat.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/compat.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** compat.c 15 Jul 2007 21:09:38 -0000 1.16 --- compat.c 8 Nov 2007 23:23:13 -0000 1.17 *************** *** 63,66 **** --- 63,68 ---- #include #include + #include + #include "defs.h" From (spam-protected) Fri Nov 9 00:33:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 23:33:56 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.83, 1.84 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16070/lib/httpinfo/src Modified Files: olsrd_httpinfo.c Log Message: * win32 doesn't support that feature Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** olsrd_httpinfo.c 8 Nov 2007 22:47:40 -0000 1.83 --- olsrd_httpinfo.c 8 Nov 2007 23:33:54 -0000 1.84 *************** *** 711,718 **** int size = 0; struct rt_entry *rt; size += section_title(&buf[size], bufsize-size, "OLSR Routes in Kernel"); size += snprintf(&buf[size], bufsize-size, ! "DestinationGatewayMetricETXInterface\n", ! resolve_ip_addresses ? " colspan=\"2\"" : ""); /* Walk the route table */ --- 711,720 ---- int size = 0; struct rt_entry *rt; + const char *s = resolve_ip_addresses ? " colspan=\"2\"" : ""; size += section_title(&buf[size], bufsize-size, "OLSR Routes in Kernel"); size += snprintf(&buf[size], bufsize-size, ! "DestinationGatewayMetricETXInterface\n", ! s, ! s); /* Walk the route table */ From (spam-protected) Fri Nov 9 00:53:45 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 23:53:45 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c,1.25,1.26 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25403/lib/dyn_gw/src Modified Files: olsrd_dyn_gw.c Log Message: * added a comment Index: olsrd_dyn_gw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** olsrd_dyn_gw.c 8 Nov 2007 23:23:13 -0000 1.25 --- olsrd_dyn_gw.c 8 Nov 2007 23:53:43 -0000 1.26 *************** *** 389,392 **** --- 389,393 ---- fclose(fp); if(retval == 0){ + /* And we cast here since we get warnings on Win32 */ olsr_printf(1, "HNA[%08x/%08x] is invalid\n", (unsigned int)net->v4.s_addr, (unsigned int)mask->v4.s_addr); } From (spam-protected) Fri Nov 9 00:54:30 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 23:54:30 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch main.c,1.30,1.31 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25816/src/olsr_switch Modified Files: main.c Log Message: * added a comment Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/main.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** main.c 8 Nov 2007 23:23:13 -0000 1.30 --- main.c 8 Nov 2007 23:54:28 -0000 1.31 *************** *** 171,174 **** --- 171,175 ---- for (i = 0; i < 20; i++) { + /* Win32 needs that cast. */ if (recv(oc->socket, (void *)&new_addr, sizeof(new_addr), 0) == 4) break; From (spam-protected) Fri Nov 9 01:11:03 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 09 Nov 2007 00:11:03 +0000 Subject: [Olsr-cvs] olsrd-current/src process_package.c,1.43,1.44 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32179/src Modified Files: process_package.c Log Message: * killed gotos Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** process_package.c 8 Nov 2007 22:47:41 -0000 1.43 --- process_package.c 9 Nov 2007 00:11:01 -0000 1.44 *************** *** 235,255 **** struct tc_entry *tc_last; ! if(!olsr_check_dup_table_proc(&message->originator, ! message->packet_seq_number)) ! { ! goto forward; ! } ! ! OLSR_PRINTF(3, "Processing TC from %s, seq 0x%04x\n", ! olsr_ip_to_string(&buf, &message->originator), message->ansn); ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! if(check_neighbor_link(from_addr) != SYM_LINK) ! { OLSR_PRINTF(2, "Received TC from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); --- 235,250 ---- struct tc_entry *tc_last; ! if (olsr_check_dup_table_proc(&message->originator, ! message->packet_seq_number)) { ! OLSR_PRINTF(3, "Processing TC from %s, seq 0x%04x\n", ! olsr_ip_to_string(&buf, &message->originator), message->ansn); ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! if (check_neighbor_link(from_addr) != SYM_LINK) { OLSR_PRINTF(2, "Received TC from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); *************** *** 258,295 **** } ! if(olsr_cnf->debug_level > 2) ! { mpr = message->multipoint_relay_selector_address; OLSR_PRINTF(3, "mpr_selector_list:["); ! while(mpr!=NULL) ! { OLSR_PRINTF(3, "%s:", olsr_ip_to_string(&buf, &mpr->address)); mpr=mpr->next; ! } OLSR_PRINTF(3, "]\n"); } ! tc_last = olsr_lookup_tc_entry(&message->originator); ! if(tc_last != NULL) ! { /* Update entry */ /* Delete destinations with lower ANSN */ ! if(olsr_tc_delete_mprs(tc_last, message)) changes_topology = OLSR_TRUE; ! /* Update destinations */ ! if(olsr_tc_update_mprs(tc_last, message)) changes_topology = OLSR_TRUE; ! } ! ! else ! { /*if message is empty then skip it */ ! if(message->multipoint_relay_selector_address != NULL) ! { /* New entry */ tc_last = olsr_add_tc_entry(&message->originator); --- 253,284 ---- } ! if (olsr_cnf->debug_level > 2) { mpr = message->multipoint_relay_selector_address; OLSR_PRINTF(3, "mpr_selector_list:["); ! while (mpr != NULL) { OLSR_PRINTF(3, "%s:", olsr_ip_to_string(&buf, &mpr->address)); mpr=mpr->next; ! } OLSR_PRINTF(3, "]\n"); } ! tc_last = olsr_lookup_tc_entry(&message->originator); ! if(tc_last != NULL) { /* Update entry */ /* Delete destinations with lower ANSN */ ! if(olsr_tc_delete_mprs(tc_last, message)) { changes_topology = OLSR_TRUE; ! } /* Update destinations */ ! if(olsr_tc_update_mprs(tc_last, message)) { changes_topology = OLSR_TRUE; ! } ! } else { /*if message is empty then skip it */ ! if (message->multipoint_relay_selector_address != NULL) { /* New entry */ tc_last = olsr_add_tc_entry(&message->originator); *************** *** 299,308 **** changes_topology = OLSR_TRUE; ! } ! else ! { ! OLSR_PRINTF(3, "Dropping empty TC from %s\n", ! olsr_ip_to_string(&buf, &message->originator)); ! } } --- 288,295 ---- changes_topology = OLSR_TRUE; ! } else { ! OLSR_PRINTF(3, "Dropping empty TC from %s\n", ! olsr_ip_to_string(&buf, &message->originator)); ! } } *************** *** 310,314 **** //olsr_process_changes(); ! forward: olsr_forward_message(m, --- 297,301 ---- //olsr_process_changes(); ! } olsr_forward_message(m, *************** *** 319,324 **** olsr_free_tc_packet(message); - - return; } --- 306,309 ---- *************** *** 348,356 **** } - - - - - /** *Process a received(and parsed) MID message --- 333,336 ---- *************** *** 375,403 **** mid_chgestruct(&message, m); ! if(!olsr_validate_address(&message.mid_origaddr)) ! { ! olsr_free_mid_packet(&message); ! return; ! } ! if(!olsr_check_dup_table_proc(&message.mid_origaddr, ! message.mid_seqno)) ! { ! goto forward; ! } #ifdef DEBUG ! OLSR_PRINTF(5, "Processing MID from %s...\n", olsr_ip_to_string(&buf, &message.mid_origaddr)); #endif ! tmp_adr = message.mid_addr; ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! if(check_neighbor_link(from_addr) != SYM_LINK) ! { #ifndef NODEBUG struct ipaddr_str buf; --- 355,378 ---- mid_chgestruct(&message, m); ! if (!olsr_validate_address(&message.mid_origaddr)) { ! olsr_free_mid_packet(&message); ! return; ! } ! if (olsr_check_dup_table_proc(&message.mid_origaddr, ! message.mid_seqno)) { #ifdef DEBUG ! OLSR_PRINTF(5, "Processing MID from %s...\n", olsr_ip_to_string(&buf, &message.mid_origaddr)); #endif ! tmp_adr = message.mid_addr; ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! if(check_neighbor_link(from_addr) != SYM_LINK) { #ifndef NODEBUG struct ipaddr_str buf; *************** *** 408,433 **** } ! /* Update the timeout of the MID */ ! olsr_update_mid_table(&message.mid_origaddr, (float)message.vtime); ! while(tmp_adr) ! { ! if(!mid_lookup_main_addr(&tmp_adr->alias_addr)) ! { #ifndef NODEBUG ! struct ipaddr_str buf; #endif ! OLSR_PRINTF(1, "MID new: (%s, ", olsr_ip_to_string(&buf, &message.mid_origaddr)); ! OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&buf, &tmp_adr->alias_addr)); ! insert_mid_alias(&message.mid_origaddr, &tmp_adr->alias_addr, (float)message.vtime); ! } ! ! tmp_adr = tmp_adr->next; } ! olsr_prune_aliases(&message.mid_origaddr, message.mid_addr); - forward: olsr_forward_message(m, &message.mid_origaddr, --- 383,404 ---- } ! /* Update the timeout of the MID */ ! olsr_update_mid_table(&message.mid_origaddr, (float)message.vtime); ! while (tmp_adr) { ! if (!mid_lookup_main_addr(&tmp_adr->alias_addr)){ #ifndef NODEBUG ! struct ipaddr_str buf; #endif ! OLSR_PRINTF(1, "MID new: (%s, ", olsr_ip_to_string(&buf, &message.mid_origaddr)); ! OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&buf, &tmp_adr->alias_addr)); ! insert_mid_alias(&message.mid_origaddr, &tmp_adr->alias_addr, (float)message.vtime); ! } tmp_adr = tmp_adr->next; } ! olsr_prune_aliases(&message.mid_origaddr, message.mid_addr); ! } olsr_forward_message(m, &message.mid_origaddr, *************** *** 436,447 **** from_addr); olsr_free_mid_packet(&message); - - return; } - - - /** *Process incoming HNA message. --- 407,413 ---- *************** *** 467,491 **** hna_chgestruct(&message, m); ! if(!olsr_validate_address(&message.originator)) ! { ! olsr_free_hna_packet(&message); ! return; ! } ! if(!olsr_check_dup_table_proc(&message.originator, ! message.packet_seq_number)) ! { ! goto forward; ! } ! hna_tmp = message.hna_net; ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! if(check_neighbor_link(from_addr) != SYM_LINK) ! { #ifndef NODEBUG struct ipaddr_str buf; --- 433,452 ---- hna_chgestruct(&message, m); ! if(!olsr_validate_address(&message.originator)) { ! olsr_free_hna_packet(&message); ! return; ! } ! if (olsr_check_dup_table_proc(&message.originator, ! message.packet_seq_number)) { ! hna_tmp = message.hna_net; ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! if(check_neighbor_link(from_addr) != SYM_LINK) { #ifndef NODEBUG struct ipaddr_str buf; *************** *** 496,512 **** } ! 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; } - forward: olsr_forward_message(m, &message.originator, --- 457,471 ---- } ! 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; } + } olsr_forward_message(m, &message.originator, *************** *** 515,528 **** from_addr); olsr_free_hna_packet(&message); - - return; } - - - - - - /** *Processes an list of neighbors from an incoming HELLO message. --- 474,479 ---- From (spam-protected) Thu Nov 8 23:47:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 08 Nov 2007 22:47:44 +0000 Subject: [Olsr-cvs] olsrd-current/src build_msg.c, 1.37, 1.38 defs.h, 1.65, 1.66 duplicate_set.c, 1.18, 1.19 generate_msg.c, 1.25, 1.26 hna_set.c, 1.23, 1.24 hysteresis.c, 1.21, 1.22 interfaces.c, 1.35, 1.36 interfaces.h, 1.43, 1.44 ipc_frontend.c, 1.37, 1.38 ipc_frontend.h, 1.15, 1.16 link_set.c, 1.76, 1.77 local_hna_set.c, 1.15, 1.16 lq_avl.c, 1.13, 1.14 lq_avl.h, 1.11, 1.12 lq_packet.c, 1.28, 1.29 lq_route.c, 1.56, 1.57 main.c, 1.101, 1.102 mid_set.c, 1.22, 1.23 mid_set.h, 1.15, 1.16 mpr.c, 1.19, 1.20 mpr_selector_set.c, 1.19, 1.20 neighbor_table.c, 1.34, 1.35 net_olsr.c, 1.31, 1.32 net_olsr.h, 1.14, 1.15 olsr.c, 1.60, 1.61 olsr_protocol.h, 1.22, 1.23 olsr_types.h, 1.11, 1.12 packet.c, 1.25, 1.26 parser.c, 1.35, 1.36 parser.h, 1.11, 1.12 plugin_util.c, 1.7, 1.8 print_packet.c, 1.12, 1.13 process_package.c, 1.42, 1.43 process_package.h, 1.12, 1.13 process_routes.c, 1.37, 1.38 rebuild_packet.c, 1.22, 1.23 rebuild_packet.h, 1.8, 1.9 routing_table.c, 1.32, 1.33 routing_table.h, 1.23, 1.24 scheduler.c, 1.43, 1.44 tc_set.c, 1.35, 1.36 tc_set.h, 1.21, 1.22 two_hop_neighbor_table.c, 1.19, 1.20 two_hop_neighbor_table.h, 1.14, 1.15 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/src Modified Files: build_msg.c defs.h duplicate_set.c generate_msg.c hna_set.c hysteresis.c interfaces.c interfaces.h ipc_frontend.c ipc_frontend.h link_set.c local_hna_set.c lq_avl.c lq_avl.h lq_packet.c lq_route.c main.c mid_set.c mid_set.h mpr.c mpr_selector_set.c neighbor_table.c net_olsr.c net_olsr.h olsr.c olsr_protocol.h olsr_types.h packet.c parser.c parser.h plugin_util.c print_packet.c process_package.c process_package.h process_routes.c rebuild_packet.c rebuild_packet.h routing_table.c routing_table.h scheduler.c tc_set.c tc_set.h two_hop_neighbor_table.c two_hop_neighbor_table.h Log Message: Another fat commit: The main target was: - Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of temporary variables to call inet_ntoa()/inet_ptoa() vanished ..... - declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface" as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). To get that thoroughly via compiler errors, we get: - We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string() to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr" into a string buffer. Alas, this also annoyed me since ages: - cleanup: olsr_ip_to_string() and similar non-reentrant functions now must get a target buffer. To ease that, there is the "struct ipaddr_str" which is large enough for all of them (read: for an IPv6 address). This also removes the cyclic buffer there. All of these function return a "const char *" which can be directly used for printf(3) and friends. And some cleanups: - const'ified more functions - converted the source to UTF-8. - "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char") - force the few inline function to always be inlined. - #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table() if nothing is done - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c This version was breing since weeks and running for severa day in Vienna's FunkFeuer net without any noticably problem! Please report anything that broke! Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** lq_route.c 5 Nov 2007 15:32:55 -0000 1.56 --- lq_route.c 8 Nov 2007 22:47:41 -0000 1.57 *************** *** 54,57 **** --- 54,58 ---- #include "lq_avl.h" #include "lq_route.h" + #include "net_olsr.h" /* *************** *** 65,69 **** */ static int ! avl_comp_etx (void *etx1, void *etx2) { if (*(float *)etx1 < *(float *)etx2) { --- 66,70 ---- */ static int ! avl_comp_etx (const void *etx1, const void *etx2) { if (*(float *)etx1 < *(float *)etx2) { *************** *** 87,90 **** --- 88,94 ---- struct tc_entry *vert) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif vert->cand_tree_node.key = &vert->path_etx; vert->cand_tree_node.data = vert; *************** *** 92,96 **** #ifdef DEBUG OLSR_PRINTF(1, "SPF: insert candidate %s, cost %f\n", ! olsr_ip_to_string(&(vert->addr)), vert->path_etx); #endif --- 96,100 ---- #ifdef DEBUG OLSR_PRINTF(1, "SPF: insert candidate %s, cost %f\n", ! olsr_ip_to_string(&buf, &vert->addr), vert->path_etx); #endif *************** *** 110,115 **** #ifdef DEBUG OLSR_PRINTF(1, "SPF: delete candidate %s, cost %f\n", ! olsr_ip_to_string(&(vert->addr)), vert->path_etx); #endif --- 114,122 ---- #ifdef DEBUG + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF(1, "SPF: delete candidate %s, cost %f\n", ! olsr_ip_to_string(&buf, &vert->addr), vert->path_etx); #endif *************** *** 128,138 **** struct tc_entry *vert) { vert->path_list_node.data = vert; #ifdef DEBUG OLSR_PRINTF(1, "SPF: append path %s, cost %f, via %s\n", ! olsr_ip_to_string(&(vert->addr)), vert->path_etx, ! vert->next_hop ? olsr_ip_to_string(&vert->next_hop->neighbor_iface_addr) : "-"); #endif --- 135,148 ---- struct tc_entry *vert) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str pathbuf, nbuf; + #endif vert->path_list_node.data = vert; #ifdef DEBUG OLSR_PRINTF(1, "SPF: append path %s, cost %f, via %s\n", ! olsr_ip_to_string(&pathbuf, &vert->addr), vert->path_etx, ! vert->next_hop ? olsr_ip_to_string(&nbuf, &vert->next_hop->neighbor_iface_addr) : "-"); #endif *************** *** 177,188 **** olsr_spf_relax (struct avl_tree *cand_tree, struct tc_entry *vert) { - struct tc_entry *new_vert; - struct tc_edge_entry *tc_edge; struct avl_node *edge_node; float new_etx; #ifdef DEBUG OLSR_PRINTF(1, "SPF: exploring node %s, cost %f\n", ! olsr_ip_to_string(&vert->addr), vert->path_etx); #endif --- 187,199 ---- olsr_spf_relax (struct avl_tree *cand_tree, struct tc_entry *vert) { struct avl_node *edge_node; float new_etx; #ifdef DEBUG + #ifndef NODEBUG + struct ipaddr_str buf, nbuf; + #endif OLSR_PRINTF(1, "SPF: exploring node %s, cost %f\n", ! olsr_ip_to_string(&buf, &vert->addr), vert->path_etx); #endif *************** *** 194,199 **** edge_node; edge_node = avl_walk_next(edge_node)) { ! ! tc_edge = edge_node->data; /* --- 205,210 ---- edge_node; edge_node = avl_walk_next(edge_node)) { ! struct tc_entry *new_vert; ! struct tc_edge_entry *tc_edge = edge_node->data; /* *************** *** 203,207 **** #ifdef DEBUG OLSR_PRINTF(1, "SPF: ignoring edge %s\n", ! olsr_ip_to_string(&tc_edge->T_dest_addr)); if (tc_edge->flags & OLSR_TC_EDGE_DOWN) { OLSR_PRINTF(1, "SPF: edge down\n"); --- 214,218 ---- #ifdef DEBUG OLSR_PRINTF(1, "SPF: ignoring edge %s\n", ! olsr_ip_to_string(&buf, &tc_edge->T_dest_addr)); if (tc_edge->flags & OLSR_TC_EDGE_DOWN) { OLSR_PRINTF(1, "SPF: edge down\n"); *************** *** 222,226 **** #ifdef DEBUG OLSR_PRINTF(1, "SPF: exploring edge %s, cost %s\n", ! olsr_ip_to_string(&(tc_edge->T_dest_addr)), olsr_etx_to_string(new_etx)); #endif --- 233,237 ---- #ifdef DEBUG OLSR_PRINTF(1, "SPF: exploring edge %s, cost %s\n", ! olsr_ip_to_string(&buf, &tc_edge->T_dest_addr), olsr_etx_to_string(new_etx)); #endif *************** *** 231,234 **** --- 242,246 ---- */ new_vert = tc_edge->edge_inv->tc; + if (new_etx < new_vert->path_etx) { *************** *** 250,258 **** #ifdef DEBUG OLSR_PRINTF(1, "SPF: better path to %s, cost %s -> %s, via %s, hops %u\n", ! olsr_ip_to_string(&new_vert->addr), olsr_etx_to_string(new_vert->path_etx), olsr_etx_to_string(new_etx), ! olsr_ip_to_string(vert->next_hop ? ! &vert->next_hop->neighbor_iface_addr : NULL), new_vert->hops); #endif --- 262,269 ---- #ifdef DEBUG OLSR_PRINTF(1, "SPF: better path to %s, cost %s -> %s, via %s, hops %u\n", ! olsr_ip_to_string(&buf, &new_vert->addr), olsr_etx_to_string(new_vert->path_etx), olsr_etx_to_string(new_etx), ! vert->next_hop ? olsr_ip_to_string(&nbuf, &vert->next_hop->neighbor_iface_addr) : "", new_vert->hops); #endif *************** *** 410,414 **** if (!link) { ! OLSR_PRINTF(2, "%s no next-hop\n", olsr_ip_to_string(&vert->addr)); continue; } --- 421,428 ---- if (!link) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(2, "%s no next-hop\n", olsr_ip_to_string(&buf, &vert->addr)); continue; } Index: rebuild_packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** rebuild_packet.h 21 Nov 2004 11:28:56 -0000 1.8 --- rebuild_packet.h 8 Nov 2007 22:47:41 -0000 1.9 *************** *** 50,66 **** void ! hna_chgestruct(struct hna_message *, union olsr_message *); void ! mid_chgestruct(struct mid_message *, union olsr_message *); void ! unk_chgestruct(struct unknown_message *, union olsr_message *); void ! hello_chgestruct(struct hello_message *, union olsr_message *); void ! tc_chgestruct(struct tc_message *, union olsr_message *, union olsr_ip_addr *); #endif --- 50,66 ---- void ! hna_chgestruct(struct hna_message *, const union olsr_message *); void ! mid_chgestruct(struct mid_message *, const union olsr_message *); void ! unk_chgestruct(struct unknown_message *, const union olsr_message *); void ! hello_chgestruct(struct hello_message *, const union olsr_message *); void ! tc_chgestruct(struct tc_message *, const union olsr_message *, const union olsr_ip_addr *); #endif Index: rebuild_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** rebuild_packet.c 28 Aug 2007 20:45:17 -0000 1.22 --- rebuild_packet.c 8 Nov 2007 22:47:41 -0000 1.23 *************** *** 46,49 **** --- 46,50 ---- #include "mid_set.h" #include "mantissa.h" + #include "net_olsr.h" /** *************** *** 57,61 **** void ! hna_chgestruct(struct hna_message *hmsg, union olsr_message *m) { struct hna_net_addr *hna_pairs, *tmp_pairs; --- 58,62 ---- void ! hna_chgestruct(struct hna_message *hmsg, const union olsr_message *m) { struct hna_net_addr *hna_pairs, *tmp_pairs; *************** *** 70,76 **** { /* IPv4 */ ! struct hnapair *haddr; ! ! haddr = m->v4.message.hna.hna_net; /* --- 71,75 ---- { /* IPv4 */ ! const struct hnapair *haddr = m->v4.message.hna.hna_net; /* *************** *** 81,89 **** no_pairs = (ntohs(m->v4.olsr_msgsize) - 12) / 8; ! COPY_IP(&hmsg->originator, &m->v4.originator); hmsg->packet_seq_number = ntohs(m->v4.seqno); hmsg->hop_count = m->v4.hopcnt; ! //printf("HNA from %s\n\n", olsr_ip_to_string((union olsr_ip_addr *)&hmsg->originator)); /* Get vtime */ --- 80,90 ---- no_pairs = (ntohs(m->v4.olsr_msgsize) - 12) / 8; ! //COPY_IP(&hmsg->originator, &m->v4.originator); ! hmsg->originator.v4.s_addr = m->v4.originator; ! hmsg->packet_seq_number = ntohs(m->v4.seqno); hmsg->hop_count = m->v4.hopcnt; ! //printf("HNA from %s\n\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&hmsg->originator)); /* Get vtime */ *************** *** 94,118 **** for(i = 0; i < no_pairs; i++) ! { ! hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct"); ! ! COPY_IP(&hna_pairs->net, &haddr->addr); ! COPY_IP(&hna_pairs->netmask, &haddr->netmask); hna_pairs->next = tmp_pairs; tmp_pairs = hna_pairs; haddr++; - } - } else { /* IPv6 */ ! struct hnapair6 *haddr6; ! ! haddr6 = m->v6.message.hna.hna_net; /* --- 95,116 ---- for(i = 0; i < no_pairs; i++) ! { hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct"); ! //COPY_IP(&hna_pairs->net, &haddr->addr); ! hna_pairs->net.v4.s_addr = haddr->addr; ! //COPY_IP(&hna_pairs->netmask, &haddr->netmask); ! hna_pairs->netmask.v4 = haddr->netmask; ! hna_pairs->next = tmp_pairs; tmp_pairs = hna_pairs; haddr++; } } else { /* IPv6 */ ! const struct hnapair6 *haddr6 = m->v6.message.hna.hna_net; /* *************** *** 123,127 **** no_pairs = (ntohs(m->v6.olsr_msgsize) - 24) / 32; /* NB 32 not 8 */ ! COPY_IP(&hmsg->originator, &m->v6.originator); hmsg->packet_seq_number = ntohs(m->v6.seqno); hmsg->hop_count = m->v6.hopcnt; --- 121,126 ---- no_pairs = (ntohs(m->v6.olsr_msgsize) - 24) / 32; /* NB 32 not 8 */ ! //COPY_IP(&hmsg->originator, &m->v6.originator); ! hmsg->originator.v6 = m->v6.originator; hmsg->packet_seq_number = ntohs(m->v6.seqno); hmsg->hop_count = m->v6.hopcnt; *************** *** 138,142 **** hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct 2"); ! COPY_IP(&hna_pairs->net, &haddr6->addr); hna_pairs->netmask.v6 = olsr_netmask_to_prefix((union olsr_ip_addr *)&haddr6->netmask); --- 137,142 ---- hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct 2"); ! //COPY_IP(&hna_pairs->net, &haddr6->addr); ! hna_pairs->net.v6 = haddr6->addr; hna_pairs->netmask.v6 = olsr_netmask_to_prefix((union olsr_ip_addr *)&haddr6->netmask); *************** *** 144,152 **** tmp_pairs = hna_pairs; ! haddr6++; ! } - - } --- 144,149 ---- tmp_pairs = hna_pairs; ! haddr6++; } } *************** *** 180,184 **** void ! mid_chgestruct(struct mid_message *mmsg, union olsr_message *m) { int i; --- 177,181 ---- void ! mid_chgestruct(struct mid_message *mmsg, const union olsr_message *m) { int i; *************** *** 195,201 **** { /* IPv4 */ ! struct midaddr *maddr; ! ! maddr = m->v4.message.mid.mid_addr; /* * How many aliases? --- 192,196 ---- { /* IPv4 */ ! const struct midaddr *maddr = m->v4.message.mid.mid_addr; /* * How many aliases? *************** *** 206,211 **** //printf("Aliases: %d\n", no_aliases); ! COPY_IP(&mmsg->mid_origaddr, &m->v4.originator); ! COPY_IP(&mmsg->addr, &m->v4.originator); /*seq number*/ mmsg->mid_seqno = ntohs(m->v4.seqno); --- 201,208 ---- //printf("Aliases: %d\n", no_aliases); ! //COPY_IP(&mmsg->mid_origaddr, &m->v4.originator); ! mmsg->mid_origaddr.v4.s_addr = m->v4.originator; ! //COPY_IP(&mmsg->addr, &m->v4.originator); ! mmsg->addr.v4.s_addr = m->v4.originator; /*seq number*/ mmsg->mid_seqno = ntohs(m->v4.seqno); *************** *** 222,226 **** alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct"); ! COPY_IP(&alias->alias_addr, &maddr->addr); alias->next = mmsg->mid_addr; mmsg->mid_addr = alias; --- 219,224 ---- alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct"); ! //COPY_IP(&alias->alias_addr, &maddr->addr); ! alias->alias_addr.v4.s_addr = maddr->addr; alias->next = mmsg->mid_addr; mmsg->mid_addr = alias; *************** *** 231,240 **** if(olsr_cnf->debug_level > 1) { ! OLSR_PRINTF(3, "Alias list for %s: ", ip_to_string(&mmsg->mid_origaddr.v4)); ! OLSR_PRINTF(3, "%s", ip_to_string(&mmsg->addr.v4)); alias_tmp = mmsg->mid_addr; while(alias_tmp) { ! OLSR_PRINTF(3, " - %s", ip_to_string(&alias_tmp->alias_addr.v4)); alias_tmp = alias_tmp->next; } --- 229,241 ---- if(olsr_cnf->debug_level > 1) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(3, "Alias list for %s: ", olsr_ip_to_string(&buf, &mmsg->mid_origaddr)); ! OLSR_PRINTF(3, "%s", olsr_ip_to_string(&buf, &mmsg->addr)); alias_tmp = mmsg->mid_addr; while(alias_tmp) { ! OLSR_PRINTF(3, " - %s", olsr_ip_to_string(&buf, &alias_tmp->alias_addr)); alias_tmp = alias_tmp->next; } *************** *** 245,251 **** { /* IPv6 */ ! struct midaddr6 *maddr6; ! ! maddr6 = m->v6.message.mid.mid_addr; /* * How many aliases? --- 246,250 ---- { /* IPv6 */ ! const struct midaddr6 *maddr6 = m->v6.message.mid.mid_addr; /* * How many aliases? *************** *** 256,261 **** //printf("Aliases: %d\n", no_aliases); ! COPY_IP(&mmsg->mid_origaddr, &m->v6.originator); ! COPY_IP(&mmsg->addr, &m->v6.originator); /*seq number*/ mmsg->mid_seqno = ntohs(m->v6.seqno); --- 255,262 ---- //printf("Aliases: %d\n", no_aliases); ! //COPY_IP(&mmsg->mid_origaddr, &m->v6.originator); ! mmsg->mid_origaddr.v6 = m->v6.originator; ! //COPY_IP(&mmsg->addr, &m->v6.originator); ! mmsg->addr.v6 = m->v6.originator; /*seq number*/ mmsg->mid_seqno = ntohs(m->v6.seqno); *************** *** 267,277 **** //printf("Sequencenuber of MID from %s is %d\n", ip_to_string(&mmsg->addr), mmsg->mid_seqno); - for(i = 0; i < no_aliases; i++) { alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct 2"); ! //printf("Adding alias: %s\n", olsr_ip_to_string((union olsr_ip_addr *)&maddr6->addr)); ! COPY_IP(&alias->alias_addr, &maddr6->addr); alias->next = mmsg->mid_addr; mmsg->mid_addr = alias; --- 268,278 ---- //printf("Sequencenuber of MID from %s is %d\n", ip_to_string(&mmsg->addr), mmsg->mid_seqno); for(i = 0; i < no_aliases; i++) { alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct 2"); ! //printf("Adding alias: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&maddr6->addr)); ! //COPY_IP(&alias->alias_addr, &maddr6->addr); ! alias->alias_addr.v6 = maddr6->addr; alias->next = mmsg->mid_addr; mmsg->mid_addr = alias; *************** *** 283,293 **** if(olsr_cnf->debug_level > 1) { ! OLSR_PRINTF(3, "Alias list for %s", ip6_to_string(&mmsg->mid_origaddr.v6)); ! OLSR_PRINTF(3, "%s", ip6_to_string(&mmsg->addr.v6)); alias_tmp = mmsg->mid_addr; while(alias_tmp) { ! OLSR_PRINTF(3, " - %s", ip6_to_string(&alias_tmp->alias_addr.v6)); alias_tmp = alias_tmp->next; } --- 284,297 ---- if(olsr_cnf->debug_level > 1) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(3, "Alias list for %s", ip6_to_string(&buf, &mmsg->mid_origaddr.v6)); ! OLSR_PRINTF(3, "%s", ip6_to_string(&buf, &mmsg->addr.v6)); alias_tmp = mmsg->mid_addr; while(alias_tmp) { ! OLSR_PRINTF(3, " - %s", ip6_to_string(&buf, &alias_tmp->alias_addr.v6)); alias_tmp = alias_tmp->next; } *************** *** 311,315 **** void ! unk_chgestruct(struct unknown_message *umsg, union olsr_message *m) { --- 315,319 ---- void ! unk_chgestruct(struct unknown_message *umsg, const union olsr_message *m) { *************** *** 323,327 **** /* IPv4 */ /* address */ ! COPY_IP(&umsg->originator, &m->v4.originator); /*seq number*/ umsg->seqno = ntohs(m->v4.seqno); --- 327,332 ---- /* IPv4 */ /* address */ ! //COPY_IP(&umsg->originator, &m->v4.originator); ! umsg->originator.v4.s_addr = m->v4.originator; /*seq number*/ umsg->seqno = ntohs(m->v4.seqno); *************** *** 333,337 **** /* IPv6 */ /* address */ ! COPY_IP(&umsg->originator, &m->v6.originator); /*seq number*/ umsg->seqno = ntohs(m->v6.seqno); --- 338,343 ---- /* IPv6 */ /* address */ ! //COPY_IP(&umsg->originator, &m->v6.originator); ! umsg->originator.v6 = m->v6.originator; /*seq number*/ umsg->seqno = ntohs(m->v6.seqno); *************** *** 354,358 **** void ! hello_chgestruct(struct hello_message *hmsg, union olsr_message *m) { union olsr_ip_addr *hadr; --- 360,364 ---- void ! hello_chgestruct(struct hello_message *hmsg, const union olsr_message *m) { union olsr_ip_addr *hadr; *************** *** 366,373 **** if(olsr_cnf->ip_version == AF_INET) { ! struct hellinfo *hinf; /* IPv4 */ ! COPY_IP(&hmsg->source_addr, &m->v4.originator); hmsg->packet_seq_number = ntohs(m->v4.seqno); --- 372,380 ---- if(olsr_cnf->ip_version == AF_INET) { ! const struct hellinfo *hinf; /* IPv4 */ ! //COPY_IP(&hmsg->source_addr, &m->v4.originator); ! hmsg->source_addr.v4.s_addr = m->v4.originator; hmsg->packet_seq_number = ntohs(m->v4.seqno); *************** *** 395,399 **** nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct"); ! COPY_IP(&nb->address, hadr); /* Fetch link and status */ --- 402,407 ---- nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct"); ! //COPY_IP(&nb->address, hadr); ! nb->address = *hadr; /* Fetch link and status */ *************** *** 410,418 **** else { ! struct hellinfo6 *hinf6; /* IPv6 */ ! COPY_IP(&hmsg->source_addr, &m->v6.originator); ! //printf("parsing HELLO from %s\n", olsr_ip_to_string(&hmsg->source_addr)); hmsg->packet_seq_number = ntohs(m->v6.seqno); --- 418,427 ---- else { ! const struct hellinfo6 *hinf6; /* IPv6 */ ! //COPY_IP(&hmsg->source_addr, &m->v6.originator); ! hmsg->source_addr.v6 = m->v6.originator; ! //printf("parsing HELLO from %s\n", olsr_ip_to_string(&buf, &hmsg->source_addr)); hmsg->packet_seq_number = ntohs(m->v6.seqno); *************** *** 440,444 **** nb = olsr_malloc(sizeof (struct hello_neighbor), "OLSR chgestruct 2"); ! COPY_IP(&nb->address, hadr); /* Fetch link and status */ --- 449,454 ---- nb = olsr_malloc(sizeof (struct hello_neighbor), "OLSR chgestruct 2"); ! //COPY_IP(&nb->address, hadr); ! nb->address = *hadr; /* Fetch link and status */ *************** *** 467,474 **** void ! tc_chgestruct(struct tc_message *tmsg, union olsr_message *m, union olsr_ip_addr *from_addr) { struct tc_mpr_addr *mprs; - union olsr_ip_addr *tmp_addr; tmsg->multipoint_relay_selector_address = NULL; --- 477,483 ---- void ! tc_chgestruct(struct tc_message *tmsg, const union olsr_message *m, const union olsr_ip_addr *from_addr) { struct tc_mpr_addr *mprs; tmsg->multipoint_relay_selector_address = NULL; *************** *** 480,498 **** { /* IPv4 */ ! struct olsr_tcmsg *tc; ! struct neigh_info *mprsaddr, *maddr; ! ! tc = &m->v4.message.tc; ! mprsaddr = tc->neigh; ! ! if((tmp_addr = mid_lookup_main_addr(from_addr)) == 0) ! { ! COPY_IP(&tmsg->source_addr, from_addr); ! } ! else ! { ! COPY_IP(&tmsg->source_addr, tmp_addr); ! } /* Get vtime */ --- 489,504 ---- { /* IPv4 */ ! const struct olsr_tcmsg *tc = &m->v4.message.tc; ! const struct neigh_info *mprsaddr = tc->neigh; ! const struct neigh_info *maddr; ! const union olsr_ip_addr * const tmp_addr = mid_lookup_main_addr(from_addr); + if(tmp_addr == NULL) { + //COPY_IP(&tmsg->source_addr, from_addr); + tmsg->source_addr = *from_addr; + } else { + //COPY_IP(&tmsg->source_addr, tmp_addr); + tmsg->source_addr = *tmp_addr; + } /* Get vtime */ *************** *** 501,510 **** OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime); ! COPY_IP(&tmsg->originator, &m->v4.originator); tmsg->packet_seq_number = ntohs(m->v4.seqno); tmsg->hop_count = m->v4.hopcnt; tmsg->ansn = ntohs(tc->ansn); ! //printf("TC from %s seqno %d\n", olsr_ip_to_string(&tmsg->originator), tmsg->packet_seq_number); for (maddr = mprsaddr; (char *)maddr < ((char *)m + (ntohs(m->v4.olsr_msgsize))); maddr++) --- 507,517 ---- OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime); ! //COPY_IP(&tmsg->originator, &m->v4.originator); ! tmsg->originator.v4.s_addr = m->v4.originator; tmsg->packet_seq_number = ntohs(m->v4.seqno); tmsg->hop_count = m->v4.hopcnt; tmsg->ansn = ntohs(tc->ansn); ! //printf("TC from %s seqno %d\n", olsr_ip_to_string(&buf, &tmsg->originator), tmsg->packet_seq_number); for (maddr = mprsaddr; (char *)maddr < ((char *)m + (ntohs(m->v4.olsr_msgsize))); maddr++) *************** *** 513,517 **** mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct"); ! COPY_IP(&mprs->address, &maddr->addr); mprs->next = tmsg->multipoint_relay_selector_address; tmsg->multipoint_relay_selector_address = mprs; --- 520,525 ---- mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct"); ! //COPY_IP(&mprs->address, &maddr->addr); ! mprs->address.v4.s_addr = maddr->addr; mprs->next = tmsg->multipoint_relay_selector_address; tmsg->multipoint_relay_selector_address = mprs; *************** *** 521,538 **** { /* IPv6 */ ! struct olsr_tcmsg6 *tc6; ! struct neigh_info6 *mprsaddr6, *maddr6; ! ! tc6 = &m->v6.message.tc; ! mprsaddr6 = tc6->neigh; ! if((tmp_addr = mid_lookup_main_addr(from_addr)) == 0) ! { ! COPY_IP(&tmsg->source_addr, from_addr); ! } ! else ! { ! COPY_IP(&tmsg->source_addr, tmp_addr); ! } /* Check if sender is symmetric neighbor here !! */ --- 529,544 ---- { /* IPv6 */ ! const struct neigh_info6 *maddr6; ! const struct olsr_tcmsg6 *tc6 = &m->v6.message.tc; ! const struct neigh_info6 *mprsaddr6 = tc6->neigh; ! const union olsr_ip_addr * const tmp_addr = mid_lookup_main_addr(from_addr); ! if(tmp_addr == NULL) { ! //COPY_IP(&tmsg->source_addr, from_addr); ! tmsg->source_addr = *from_addr; ! } else { ! //COPY_IP(&tmsg->source_addr, tmp_addr); ! tmsg->source_addr = *tmp_addr; ! } /* Check if sender is symmetric neighbor here !! */ *************** *** 543,547 **** OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime); ! COPY_IP(&tmsg->originator, &m->v6.originator); tmsg->packet_seq_number = ntohs(m->v6.seqno); tmsg->hop_count = m->v6.hopcnt; --- 549,554 ---- OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime); ! //COPY_IP(&tmsg->originator, &m->v6.originator); ! tmsg->originator.v6 = m->v6.originator; tmsg->packet_seq_number = ntohs(m->v6.seqno); tmsg->hop_count = m->v6.hopcnt; *************** *** 553,557 **** mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct 2"); ! COPY_IP(&mprs->address, &maddr6->addr); mprs->next = tmsg->multipoint_relay_selector_address; tmsg->multipoint_relay_selector_address = mprs; --- 560,565 ---- mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct 2"); ! //COPY_IP(&mprs->address, &maddr6->addr); ! mprs->address.v6 = maddr6->addr; mprs->next = tmsg->multipoint_relay_selector_address; tmsg->multipoint_relay_selector_address = mprs; Index: hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** hna_set.c 21 Oct 2007 20:37:58 -0000 1.23 --- hna_set.c 8 Nov 2007 22:47:41 -0000 1.24 *************** *** 43,46 **** --- 43,47 ---- #include "olsr.h" #include "scheduler.h" + #include "net_olsr.h" *************** *** 112,116 **** tmp_net = tmp_net->next) { ! if(COMP_IP(&tmp_net->A_network_addr, net) && (memcmp(&tmp_net->A_netmask, mask, netmask_size) == 0)) return tmp_net; --- 113,117 ---- tmp_net = tmp_net->next) { ! if(ipequal(&tmp_net->A_network_addr, net) && (memcmp(&tmp_net->A_netmask, mask, netmask_size) == 0)) return tmp_net; *************** *** 142,146 **** tmp_hna = tmp_hna->next) { ! if(COMP_IP(&tmp_hna->A_gateway_addr, gw)) return tmp_hna; } --- 143,147 ---- tmp_hna = tmp_hna->next) { ! if(ipequal(&tmp_hna->A_gateway_addr, gw)) return tmp_hna; } *************** *** 168,172 **** /* Fill struct */ ! COPY_IP(&new_entry->A_gateway_addr, addr); /* Link nets */ --- 169,174 ---- /* Fill struct */ ! //COPY_IP(&new_entry->A_gateway_addr, addr); ! new_entry->A_gateway_addr = *addr; /* Link nets */ *************** *** 205,210 **** /* Fill struct */ ! COPY_IP(&new_net->A_network_addr, net); ! memcpy(&new_net->A_netmask, mask, netmask_size); /* Queue */ --- 207,214 ---- /* Fill struct */ ! //COPY_IP(&new_net->A_network_addr, net); ! new_net->A_network_addr = *net; ! //memcpy(&new_net->A_netmask, mask, netmask_size); ! new_net->A_netmask = *mask; /* Queue */ *************** *** 323,326 **** --- 327,332 ---- olsr_print_hna_set(void) { + #ifdef NODEBUG + /* The whole function doesn't do anything else. */ int idx; *************** *** 349,360 **** if(olsr_cnf->ip_version == AF_INET) { ! OLSR_PRINTF(1, "%-15s ", olsr_ip_to_string(&tmp_net->A_network_addr)); ! OLSR_PRINTF(1, "%-15s ", olsr_ip_to_string((union olsr_ip_addr *)&tmp_net->A_netmask.v4)); ! OLSR_PRINTF(1, "%-15s\n", olsr_ip_to_string(&tmp_hna->A_gateway_addr)); } else { ! OLSR_PRINTF(1, "%-27s/%d", olsr_ip_to_string(&tmp_net->A_network_addr), tmp_net->A_netmask.v6); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&tmp_hna->A_gateway_addr)); } --- 355,374 ---- if(olsr_cnf->ip_version == AF_INET) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! struct in_addr a; ! OLSR_PRINTF(1, "%-15s ", olsr_ip_to_string(&buf, &tmp_net->A_network_addr)); ! a.s_addr = tmp_net->A_netmask.v4; /* Ugly! */ ! OLSR_PRINTF(1, "%-15s ", ip4_to_string(&buf, a)); ! OLSR_PRINTF(1, "%-15s\n", olsr_ip_to_string(&buf, &tmp_hna->A_gateway_addr)); } else { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "%-27s/%d", olsr_ip_to_string(&buf, &tmp_net->A_network_addr), tmp_net->A_netmask.v6); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, &tmp_hna->A_gateway_addr)); } *************** *** 364,368 **** } } ! } --- 378,382 ---- } } ! #endif } Index: generate_msg.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/generate_msg.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** generate_msg.c 20 Apr 2007 13:46:04 -0000 1.25 --- generate_msg.c 8 Nov 2007 22:47:41 -0000 1.26 *************** *** 57,60 **** --- 57,61 ---- #include "link_set.h" #include "two_hop_neighbor_table.h" + #include "net_olsr.h" Index: two_hop_neighbor_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/two_hop_neighbor_table.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** two_hop_neighbor_table.c 2 Aug 2007 22:07:19 -0000 1.19 --- two_hop_neighbor_table.c 8 Nov 2007 22:47:41 -0000 1.20 *************** *** 46,49 **** --- 46,50 ---- #include "mid_set.h" #include "neighbor_table.h" + #include "net_olsr.h" *************** *** 54,62 **** *Initialize 2 hop neighbor table */ ! int olsr_init_two_hop_table(void) { int idx; - for(idx=0;idxneighbor_2_nblist.next; ! ! while(entry != &two_hop_entry->neighbor_2_nblist) { ! if(COMP_IP(&entry->neighbor->neighbor_main_addr, address)) { struct neighbor_list_entry *entry_to_delete = entry; --- 79,88 ---- void ! olsr_delete_neighbor_pointer(struct neighbor_2_entry *two_hop_entry, const union olsr_ip_addr *address) { ! struct neighbor_list_entry *entry = two_hop_entry->neighbor_2_nblist.next; while(entry != &two_hop_entry->neighbor_2_nblist) { ! if(ipequal(&entry->neighbor->neighbor_main_addr, address)) { struct neighbor_list_entry *entry_to_delete = entry; *************** *** 151,159 **** olsr_insert_two_hop_neighbor_table(struct neighbor_2_entry *two_hop_neighbor) { ! olsr_u32_t hash; ! ! //printf("Adding 2 hop neighbor %s\n", olsr_ip_to_string(&two_hop_neighbor->neighbor_2_addr)); ! hash = olsr_hashing(&two_hop_neighbor->neighbor_2_addr); /* Queue */ --- 146,152 ---- olsr_insert_two_hop_neighbor_table(struct neighbor_2_entry *two_hop_neighbor) { ! olsr_u32_t hash = olsr_hashing(&two_hop_neighbor->neighbor_2_addr); ! //printf("Adding 2 hop neighbor %s\n", olsr_ip_to_string(&buf, &two_hop_neighbor->neighbor_2_addr)); /* Queue */ *************** *** 171,184 **** */ struct neighbor_2_entry * ! olsr_lookup_two_hop_neighbor_table(union olsr_ip_addr *dest) { struct neighbor_2_entry *neighbor_2; ! olsr_u32_t hash; ! ! //printf("LOOKING FOR %s\n", olsr_ip_to_string(dest)); ! hash = olsr_hashing(dest); ! for(neighbor_2 = two_hop_neighbortable[hash].next; neighbor_2 != &two_hop_neighbortable[hash]; --- 164,174 ---- */ struct neighbor_2_entry * ! olsr_lookup_two_hop_neighbor_table(const union olsr_ip_addr *dest) { struct neighbor_2_entry *neighbor_2; ! olsr_u32_t hash = olsr_hashing(dest); ! //printf("LOOKING FOR %s\n", olsr_ip_to_string(&buf, dest)); for(neighbor_2 = two_hop_neighbortable[hash].next; neighbor_2 != &two_hop_neighbortable[hash]; *************** *** 187,192 **** struct mid_address *adr; ! //printf("Checking %s\n", olsr_ip_to_string(dest)); ! if (COMP_IP(&neighbor_2->neighbor_2_addr, dest)) return neighbor_2; --- 177,182 ---- struct mid_address *adr; ! //printf("Checking %s\n", olsr_ip_to_string(&buf, dest)); ! if (ipequal(&neighbor_2->neighbor_2_addr, dest)) return neighbor_2; *************** *** 195,199 **** while(adr) { ! if(COMP_IP(&adr->alias, dest)) return neighbor_2; adr = adr->next_alias; --- 185,189 ---- while(adr) { ! if(ipequal(&adr->alias, dest)) return neighbor_2; adr = adr->next_alias; *************** *** 216,225 **** */ struct neighbor_2_entry * ! olsr_lookup_two_hop_neighbor_table_mid(union olsr_ip_addr *dest) { struct neighbor_2_entry *neighbor_2; olsr_u32_t hash; ! //printf("LOOKING FOR %s\n", olsr_ip_to_string(dest)); hash = olsr_hashing(dest); --- 206,215 ---- */ struct neighbor_2_entry * ! olsr_lookup_two_hop_neighbor_table_mid(const union olsr_ip_addr *dest) { struct neighbor_2_entry *neighbor_2; olsr_u32_t hash; ! //printf("LOOKING FOR %s\n", olsr_ip_to_string(&buf, dest)); hash = olsr_hashing(dest); *************** *** 228,232 **** neighbor_2 = neighbor_2->next) { ! if (COMP_IP(&neighbor_2->neighbor_2_addr, dest)) return neighbor_2; } --- 218,222 ---- neighbor_2 = neighbor_2->next) { ! if (ipequal(&neighbor_2->neighbor_2_addr, dest)) return neighbor_2; } *************** *** 245,250 **** olsr_print_two_hop_neighbor_table(void) { int i; - OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.02%d ----------------------- TWO-HOP NEIGHBORS\n\n", nowtm->tm_hour, --- 235,241 ---- olsr_print_two_hop_neighbor_table(void) { + #ifndef NODEBUG + /* The whole function makes no sense without it. */ int i; OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.02%d ----------------------- TWO-HOP NEIGHBORS\n\n", nowtm->tm_hour, *************** *** 255,290 **** OLSR_PRINTF(1, "IP addr (2-hop) IP addr (1-hop) TLQ\n"); ! for (i = 0; i < HASHSIZE; i++) ! { ! struct neighbor_2_entry *neigh2; ! for (neigh2 = two_hop_neighbortable[i].next; ! neigh2 != &two_hop_neighbortable[i]; neigh2 = neigh2->next) ! { ! struct neighbor_list_entry *entry; ! olsr_bool first = OLSR_TRUE; ! ! for (entry = neigh2->neighbor_2_nblist.next; ! entry != &neigh2->neighbor_2_nblist; entry = entry->next) ! { ! double total_lq; ! struct neighbor_entry *neigh = entry->neighbor; ! ! if (first) ! { ! OLSR_PRINTF(1, "%-15s ", ! olsr_ip_to_string(&neigh2->neighbor_2_addr)); ! first = OLSR_FALSE; ! } ! ! else ! OLSR_PRINTF(1, " "); ! ! total_lq = entry->path_link_quality; ! OLSR_PRINTF(1, "%-15s %5.3f\n", ! olsr_ip_to_string(&neigh->neighbor_main_addr), ! total_lq); ! } ! } } } --- 246,274 ---- OLSR_PRINTF(1, "IP addr (2-hop) IP addr (1-hop) TLQ\n"); ! for (i = 0; i < HASHSIZE; i++) { ! struct neighbor_2_entry *neigh2; ! for (neigh2 = two_hop_neighbortable[i].next; ! neigh2 != &two_hop_neighbortable[i]; ! neigh2 = neigh2->next) { ! struct neighbor_list_entry *entry; ! olsr_bool first = OLSR_TRUE; ! for (entry = neigh2->neighbor_2_nblist.next; ! entry != &neigh2->neighbor_2_nblist; ! entry = entry->next) { ! struct ipaddr_str buf; ! if (first) { ! OLSR_PRINTF(1, "%-15s ", ! olsr_ip_to_string(&buf, &neigh2->neighbor_2_addr)); ! first = OLSR_FALSE; ! } else { ! OLSR_PRINTF(1, " "); ! } ! OLSR_PRINTF(1, "%-15s %5.3f\n", ! olsr_ip_to_string(&buf, &entry->neighbor->neighbor_main_addr), ! entry->path_link_quality); ! } } + } + #endif } Index: olsr_protocol.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_protocol.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** olsr_protocol.h 22 Apr 2007 20:25:48 -0000 1.22 --- olsr_protocol.h 8 Nov 2007 22:47:41 -0000 1.23 *************** *** 49,52 **** --- 49,55 ---- #include "olsr_types.h" + #include "olsr_cfg.h" + + #include /* Port for OLSR to use */ *************** *** 186,199 **** - /* - * Macros for comparing and copying IP addresses - */ - - #define COMP_IP(ip1, ip2) (!memcmp(ip1, ip2, olsr_cnf->ipsize)) - - #define COPY_IP(to, from) memcpy(to, from, olsr_cnf->ipsize) - - - /*********************************************** * OLSR packet definitions * --- 189,192 ---- Index: lq_avl.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** lq_avl.c 5 Sep 2007 16:30:50 -0000 1.13 --- lq_avl.c 8 Nov 2007 22:47:41 -0000 1.14 *************** *** 56,74 **** * inline ipv4 comparison will be executed. */ ! int (*avl_comp_default)(void *, void *) = NULL; ! int (*avl_comp_prefix_default)(void *, void *); ! int avl_comp_ipv4(void *ip1, void *ip2) { ! return(*(unsigned int *)ip1 == *(unsigned int *)ip2 ? 0 : \ ! *(unsigned int *)ip1 < *(unsigned int *)ip2 ? -1 : +1); } ! int avl_comp_ipv6(void *ip1, void *ip2) { return memcmp(ip1, ip2, 16); } ! void avl_init(struct avl_tree *tree, int (*comp)(void *, void *)) { tree->root = NULL; --- 56,73 ---- * inline ipv4 comparison will be executed. */ ! int (*avl_comp_default)(const void *, const void *) = NULL; ! int (*avl_comp_prefix_default)(const void *, const void *); ! int avl_comp_ipv4(const void *ip1, const void *ip2) { ! return inline_avl_comp_ipv4(ip1, ip2); } ! int avl_comp_ipv6(const void *ip1, const void *ip2) { return memcmp(ip1, ip2, 16); } ! void avl_init(struct avl_tree *tree, int (*comp)(const void *, const void *)) { tree->root = NULL; *************** *** 79,85 **** } ! static struct avl_node *avl_find_rec_ipv4(struct avl_node *node, void *key) { ! if (*(unsigned int *)key < *(unsigned int *)node->key) { if (node->left != NULL) --- 78,84 ---- } ! static struct avl_node *avl_find_rec_ipv4(struct avl_node *node, const void *key) { ! if (*(const unsigned int *)key < *(const unsigned int *)node->key) { if (node->left != NULL) *************** *** 96,101 **** } ! static struct avl_node *avl_find_rec(struct avl_node *node, void *key, ! int (*comp)(void *, void *)) { int diff; --- 95,100 ---- } ! static struct avl_node *avl_find_rec(struct avl_node *node, const void *key, ! int (*comp)(const void *, const void *)) { int diff; *************** *** 125,129 **** } ! struct avl_node *avl_find(struct avl_tree *tree, void *key) { struct avl_node *node; --- 124,128 ---- } ! struct avl_node *avl_find(struct avl_tree *tree, const void *key) { struct avl_node *node; Index: link_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** link_set.c 2 Nov 2007 20:58:06 -0000 1.76 --- link_set.c 8 Nov 2007 22:47:41 -0000 1.77 *************** *** 54,57 **** --- 54,58 ---- #include "scheduler.h" #include "lq_route.h" + #include "net_olsr.h" *************** *** 145,150 **** if(entry->L_link_pending == 1) { ! #ifdef DEBUG ! OLSR_PRINTF(3, "HYST[%s]: Setting to HIDE\n", olsr_ip_to_string(&entry->neighbor_iface_addr)); #endif return HIDE_LINK; --- 146,152 ---- if(entry->L_link_pending == 1) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! OLSR_PRINTF(3, "HYST[%s]: Setting to HIDE\n", olsr_ip_to_string(&buf, &entry->neighbor_iface_addr)); #endif return HIDE_LINK; *************** *** 262,266 **** // if this is not a link to the neighour in question, skip ! if (!COMP_IP(&walker->neighbor->neighbor_main_addr, main_addr)) continue; --- 264,268 ---- // if this is not a link to the neighour in question, skip ! if (!ipequal(&walker->neighbor->neighbor_main_addr, main_addr)) continue; *************** *** 284,288 **** // use the requested remote interface address as a tie-breaker ((tmp_if->int_metric == curr_metric) && ! COMP_IP(&walker->local_iface_addr, remote))) { // memorize the interface's metric --- 286,290 ---- // use the requested remote interface address as a tie-breaker ((tmp_if->int_metric == curr_metric) && ! ipequal(&walker->local_iface_addr, remote))) { // memorize the interface's metric *************** *** 315,319 **** if((tmp_lq > curr_lq) || // use the requested remote interface address as a tie-breaker ! ((tmp_lq == curr_lq) && COMP_IP(&walker->local_iface_addr, remote))) { // memorize the link quality --- 317,321 ---- if((tmp_lq > curr_lq) || // use the requested remote interface address as a tie-breaker ! ((tmp_lq == curr_lq) && ipequal(&walker->local_iface_addr, remote))) { // memorize the link quality *************** *** 368,373 **** // has a matching IP address ! if ((COMP_IP(&mult->addr, &null_addr) && val < 0.0) || ! COMP_IP(&mult->addr, &entry->neighbor_iface_addr)) val = mult->val; } --- 370,375 ---- // has a matching IP address ! if ((ipequal(&mult->addr, &null_addr) && val < 0.0) || ! ipequal(&mult->addr, &entry->neighbor_iface_addr)) val = mult->val; } *************** *** 403,407 **** { ! if(COMP_IP(int_addr, &tmp_link_set->local_iface_addr)) { if(last_link_entry != NULL) --- 405,409 ---- { ! if(ipequal(int_addr, &tmp_link_set->local_iface_addr)) { if(last_link_entry != NULL) *************** *** 478,482 **** #ifdef DEBUG ! OLSR_PRINTF(1, "Adding %s=>%s to link set\n", olsr_ip_to_string(local), olsr_ip_to_string(remote)); #endif --- 480,489 ---- #ifdef DEBUG ! { ! #ifndef NODEBUG ! struct ipaddr_str localbuf, rembuf; ! #endif ! OLSR_PRINTF(1, "Adding %s=>%s to link set\n", olsr_ip_to_string(&localbuf, local), olsr_ip_to_string(&rembuf, remote)); ! } #endif *************** *** 500,506 **** */ //printf("\tLocal IF: %s\n", olsr_ip_to_string(local)); ! COPY_IP(&new_link->local_iface_addr, local); /* L_neighbor_iface_addr = Source Address */ ! COPY_IP(&new_link->neighbor_iface_addr, remote); /* L_SYM_time = current time - 1 (expired) */ --- 507,515 ---- */ //printf("\tLocal IF: %s\n", olsr_ip_to_string(local)); ! //COPY_IP(&new_link->local_iface_addr, local); ! new_link->local_iface_addr = *local; /* L_neighbor_iface_addr = Source Address */ ! //COPY_IP(&new_link->neighbor_iface_addr, remote); ! new_link->neighbor_iface_addr = *remote; /* L_SYM_time = current time - 1 (expired) */ *************** *** 564,573 **** /* Neighbor MUST exist! */ ! if(NULL == (neighbor = olsr_lookup_neighbor_table(remote_main))) { - neighbor = olsr_insert_neighbor_table(remote_main); #ifdef DEBUG ! OLSR_PRINTF(3, "ADDING NEW NEIGHBOR ENTRY %s FROM LINK SET\n", olsr_ip_to_string(remote_main)); #endif } --- 573,586 ---- /* Neighbor MUST exist! */ ! neighbor = olsr_lookup_neighbor_table(remote_main); ! if(neighbor == NULL) { #ifdef DEBUG ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(3, "ADDING NEW NEIGHBOR ENTRY %s FROM LINK SET\n", olsr_ip_to_string(&buf, remote_main)); #endif + neighbor = olsr_insert_neighbor_table(remote_main); } *************** *** 586,590 **** new_link->neighbor = neighbor; ! if(!COMP_IP(remote, remote_main)) { /* Add MID alias if not already registered */ --- 599,603 ---- new_link->neighbor = neighbor; ! if(!ipequal(remote, remote_main)) { /* Add MID alias if not already registered */ *************** *** 626,630 **** while(tmp_link_set) { ! if(COMP_IP(int_addr, &tmp_link_set->neighbor_iface_addr)) return lookup_link_status(tmp_link_set); tmp_link_set = tmp_link_set->next; --- 639,643 ---- while(tmp_link_set) { ! if(ipequal(int_addr, &tmp_link_set->neighbor_iface_addr)) return lookup_link_status(tmp_link_set); tmp_link_set = tmp_link_set->next; *************** *** 652,662 **** while(tmp_link_set) { ! 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; --- 665,675 ---- while(tmp_link_set) { ! if(ipequal(remote, &tmp_link_set->neighbor_iface_addr) && (tmp_link_set->if_name ? !strcmp(tmp_link_set->if_name, local->int_name) ! : ipequal(&local->ip_addr, &tmp_link_set->local_iface_addr) ) && /* check the remote-main address only if there is one given */ ! (remote_main == NULL || ipequal(remote_main, &tmp_link_set->neighbor->neighbor_main_addr)) ) return tmp_link_set; *************** *** 811,815 **** * will send a Hello with the same IP mentined twice */ ! if(COMP_IP(&neighbors->address, &in_if->ip_addr)) { //printf("ok"); --- 824,828 ---- * will send a Hello with the same IP mentined twice */ ! if(ipequal(&neighbors->address, &in_if->ip_addr)) { //printf("ok"); *************** *** 923,928 **** if(TIMED_OUT(tmp_link_set->hello_timeout)) { tmp_link_set->L_link_quality = olsr_hyst_calc_instability(tmp_link_set->L_link_quality); ! OLSR_PRINTF(1, "HYST[%s] HELLO timeout %0.3f\n", olsr_ip_to_string(&tmp_link_set->neighbor_iface_addr), tmp_link_set->L_link_quality); /* Update hello_timeout - NO SLACK THIS TIME */ tmp_link_set->hello_timeout = GET_TIMESTAMP(tmp_link_set->last_htime*1000); --- 936,944 ---- if(TIMED_OUT(tmp_link_set->hello_timeout)) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif tmp_link_set->L_link_quality = olsr_hyst_calc_instability(tmp_link_set->L_link_quality); ! OLSR_PRINTF(1, "HYST[%s] HELLO timeout %0.3f\n", olsr_ip_to_string(&buf, &tmp_link_set->neighbor_iface_addr), tmp_link_set->L_link_quality); /* Update hello_timeout - NO SLACK THIS TIME */ tmp_link_set->hello_timeout = GET_TIMESTAMP(tmp_link_set->last_htime*1000); *************** *** 954,958 **** const int addrsize = olsr_cnf->ip_version == AF_INET ? 15 : 39; ! OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ---------------------------------------------------- LINKS\n\n", nowtm->tm_hour, nowtm->tm_min, --- 970,974 ---- const int addrsize = olsr_cnf->ip_version == AF_INET ? 15 : 39; ! OLSR_PRINTF(0, "\n--- %02d:%02d:%02d.%02d ---------------------------------------------------- LINKS\n\n", nowtm->tm_hour, nowtm->tm_min, *************** *** 963,966 **** --- 979,983 ---- for (walker = link_set; walker != NULL; walker = walker->next) { + struct ipaddr_str buf; float etx; *************** *** 971,975 **** OLSR_PRINTF(1, "%-*s %5.3f %5.3f %-3d %-3d %5.3f %.2f\n", ! addrsize, olsr_ip_to_string(&walker->neighbor_iface_addr), walker->L_link_quality, walker->loss_link_quality, --- 988,992 ---- OLSR_PRINTF(1, "%-*s %5.3f %5.3f %-3d %-3d %5.3f %.2f\n", ! addrsize, olsr_ip_to_string(&buf, &walker->neighbor_iface_addr), walker->L_link_quality, walker->loss_link_quality, Index: two_hop_neighbor_table.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/two_hop_neighbor_table.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** two_hop_neighbor_table.h 29 May 2005 12:47:46 -0000 1.14 --- two_hop_neighbor_table.h 8 Nov 2007 22:47:42 -0000 1.15 *************** *** 76,84 **** ! int olsr_init_two_hop_table(void); void ! olsr_delete_neighbor_pointer(struct neighbor_2_entry *, union olsr_ip_addr *); void --- 76,84 ---- ! void olsr_init_two_hop_table(void); void ! olsr_delete_neighbor_pointer(struct neighbor_2_entry *, const union olsr_ip_addr *); void *************** *** 89,96 **** struct neighbor_2_entry * ! olsr_lookup_two_hop_neighbor_table(union olsr_ip_addr *); struct neighbor_2_entry * ! olsr_lookup_two_hop_neighbor_table_mid(union olsr_ip_addr *); void --- 89,96 ---- struct neighbor_2_entry * ! olsr_lookup_two_hop_neighbor_table(const union olsr_ip_addr *); struct neighbor_2_entry * ! olsr_lookup_two_hop_neighbor_table_mid(const union olsr_ip_addr *); void Index: process_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** process_routes.c 16 Sep 2007 21:14:25 -0000 1.37 --- process_routes.c 8 Nov 2007 22:47:41 -0000 1.38 *************** *** 48,53 **** #include "log.h" #include "kernel_routes.h" - #include #include "lq_avl.h" #ifdef WIN32 --- 48,53 ---- #include "log.h" #include "kernel_routes.h" #include "lq_avl.h" + #include "net_olsr.h" #ifdef WIN32 *************** *** 91,95 **** nh = olsr_get_nh(rt); ! if(!COMP_IP(&rt->rt_dst.prefix, &nh->gateway)) { flags |= RTF_GATEWAY; } --- 91,95 ---- nh = olsr_get_nh(rt); ! if(!ipequal(&rt->rt_dst.prefix, &nh->gateway)) { flags |= RTF_GATEWAY; } *************** *** 279,283 **** nh = olsr_get_nh(rt); ! if (COMP_IP(&rt->rt_dst.prefix, &nh->gateway)) { list_add_after(head_node, &rt->rt_change_node); } else { --- 279,283 ---- nh = olsr_get_nh(rt); ! if (ipequal(&rt->rt_dst.prefix, &nh->gateway)) { list_add_after(head_node, &rt->rt_change_node); } else { Index: neighbor_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** neighbor_table.c 17 Sep 2007 22:24:22 -0000 1.34 --- neighbor_table.c 8 Nov 2007 22:47:41 -0000 1.35 *************** *** 51,54 **** --- 51,55 ---- #include "link_set.h" #include "mpr_selector_set.h" + #include "net_olsr.h" *************** *** 91,95 **** while(entry != &neighbor->neighbor_2_list) { ! if(COMP_IP(&entry->neighbor_2->neighbor_2_addr, address)) { /* Dequeue */ --- 92,96 ---- while(entry != &neighbor->neighbor_2_list) { ! if(ipequal(&entry->neighbor_2->neighbor_2_addr, address)) { /* Dequeue */ *************** *** 126,130 **** { ! if(COMP_IP(&entry->neighbor_2->neighbor_2_addr, neighbor_main_address)) return entry; --- 127,131 ---- { ! if(ipequal(&entry->neighbor_2->neighbor_2_addr, neighbor_main_address)) return entry; *************** *** 163,167 **** while(entry != &neighbortable[hash]) { ! if(COMP_IP(&entry->neighbor_main_addr, neighbor_addr)) break; --- 164,168 ---- while(entry != &neighbortable[hash]) { ! if(ipequal(&entry->neighbor_main_addr, neighbor_addr)) break; *************** *** 233,237 **** new_neigh = new_neigh->next) { ! if(COMP_IP(&new_neigh->neighbor_main_addr, main_addr)) return new_neigh; } --- 234,238 ---- new_neigh = new_neigh->next) { ! if(ipequal(&new_neigh->neighbor_main_addr, main_addr)) return new_neigh; } *************** *** 242,246 **** /* Set address, willingness and status */ ! COPY_IP(&new_neigh->neighbor_main_addr, main_addr); new_neigh->willingness = WILL_NEVER; new_neigh->status = NOT_SYM; --- 243,248 ---- /* Set address, willingness and status */ ! //COPY_IP(&new_neigh->neighbor_main_addr, main_addr); ! new_neigh->neighbor_main_addr = *main_addr; new_neigh->willingness = WILL_NEVER; new_neigh->status = NOT_SYM; *************** *** 296,306 **** olsr_u32_t hash = olsr_hashing(dst); ! //printf("\nLookup %s\n", olsr_ip_to_string(dst)); for(entry = neighbortable[hash].next; entry != &neighbortable[hash]; entry = entry->next) { ! //printf("Checking %s\n", olsr_ip_to_string(&entry->neighbor_main_addr)); ! if(COMP_IP(&entry->neighbor_main_addr, dst)) return entry; --- 298,308 ---- olsr_u32_t hash = olsr_hashing(dst); ! //printf("\nLookup %s\n", olsr_ip_to_string(&buf, dst)); for(entry = neighbortable[hash].next; entry != &neighbortable[hash]; entry = entry->next) { ! //printf("Checking %s\n", olsr_ip_to_string(&buf, &entry->neighbor_main_addr)); ! if(ipequal(&entry->neighbor_main_addr, dst)) return entry; *************** *** 432,474 **** olsr_print_neighbor_table(void) { ! int i; ! char *fstr; ! ! OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------ NEIGHBORS\n\n", nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec, ! (int)now.tv_usec/10000); ! ! if (olsr_cnf->ip_version == AF_INET) ! { ! OLSR_PRINTF(1, "IP address LQ NLQ SYM MPR MPRS will\n"); ! fstr = "%-15s %5.3f %5.3f %s %s %s %d\n"; ! } ! else ! { ! OLSR_PRINTF(1, "IP address LQ NLQ SYM MPR MPRS will\n"); ! fstr = "%-39s %5.3f %5.3f %s %s %s %d\n"; ! } ! ! for (i = 0; i < HASHSIZE; i++) ! { ! struct neighbor_entry *neigh; ! for(neigh = neighbortable[i].next; neigh != &neighbortable[i]; neigh = neigh->next) ! { ! struct link_entry *lnk = get_best_link_to_neighbor(&neigh->neighbor_main_addr); ! if(lnk) ! { ! const double best_lq = lnk->neigh_link_quality; ! const double inv_best_lq = lnk->loss_link_quality; ! OLSR_PRINTF(1, fstr, olsr_ip_to_string(&neigh->neighbor_main_addr), ! inv_best_lq, best_lq, ! (neigh->status == SYM) ? "YES " : "NO ", ! neigh->is_mpr ? "YES " : "NO ", ! olsr_lookup_mprs_set(&neigh->neighbor_main_addr) == NULL ? "NO " : "YES ", ! neigh->willingness); ! } ! } } } --- 434,472 ---- olsr_print_neighbor_table(void) { ! #ifdef NODEBUG ! /* The whole function doesn't do anything else. */ ! #ifndef NODEBUG ! const int iplen = olsr_cnf->ip_version == AF_INET ? 15 : 39; ! #endif ! int idx; ! OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------ NEIGHBORS\n\n" ! "%*s LQ NLQ SYM MPR MPRS will\n", nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec, ! (int)now.tv_usec/10000, ! iplen, ! "IP address"); ! for (idx = 0; idx < HASHSIZE; idx++) { ! struct neighbor_entry *neigh; ! for(neigh = neighbortable[idx].next; neigh != &neighbortable[idx]; neigh = neigh->next) { ! struct link_entry *lnk = get_best_link_to_neighbor(&neigh->neighbor_main_addr); ! if(lnk) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "%-*s %5.3f %5.3f %s %s %s %d\n", ! iplen, ! olsr_ip_to_string(&buf, &neigh->neighbor_main_addr), ! lnk->loss_link_quality, ! lnk->neigh_link_quality, ! neigh->status == SYM ? "YES " : "NO ", ! neigh->is_mpr ? "YES " : "NO ", ! olsr_lookup_mprs_set(&neigh->neighbor_main_addr) == NULL ? "NO " : "YES ", ! neigh->willingness); ! } } + } + #endif } Index: lq_avl.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** lq_avl.h 25 Sep 2007 13:47:36 -0000 1.11 --- lq_avl.h 8 Nov 2007 22:47:41 -0000 1.12 *************** *** 63,67 **** struct avl_node *last; unsigned int count; ! int (*comp)(void *, void *); }; --- 63,67 ---- struct avl_node *last; unsigned int count; ! int (*comp)(const void *, const void *); }; *************** *** 69,74 **** #define AVL_DUP_NO 0 ! void avl_init(struct avl_tree *, int (*)(void *, void *)); ! struct avl_node *avl_find(struct avl_tree *, void *); int avl_insert(struct avl_tree *, struct avl_node *, int); void avl_delete(struct avl_tree *, struct avl_node *); --- 69,74 ---- #define AVL_DUP_NO 0 ! void avl_init(struct avl_tree *, int (*)(const void *, const void *)); ! struct avl_node *avl_find(struct avl_tree *, const void *); int avl_insert(struct avl_tree *, struct avl_node *, int); void avl_delete(struct avl_tree *, struct avl_node *); *************** *** 78,85 **** struct avl_node *avl_walk_prev(struct avl_node *); ! extern int (*avl_comp_default)(void *, void *); ! extern int (*avl_comp_prefix_default)(void *, void *); ! extern int avl_comp_ipv4(void *, void *); ! extern int avl_comp_ipv6(void *, void *); #define inline_avl_comp_ipv4(ip1, ip2) \ --- 78,85 ---- struct avl_node *avl_walk_prev(struct avl_node *); ! extern int (*avl_comp_default)(const void *, const void *); ! extern int (*avl_comp_prefix_default)(const void *, const void *); ! extern int avl_comp_ipv4(const void *, const void *); ! extern int avl_comp_ipv6(const void *, const void *); #define inline_avl_comp_ipv4(ip1, ip2) \ Index: print_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/print_packet.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** print_packet.c 17 Sep 2007 22:14:07 -0000 1.12 --- print_packet.c 8 Nov 2007 22:47:41 -0000 1.13 *************** *** 45,48 **** --- 45,50 ---- #include "olsr.h" #include "lq_packet.h" + #include "net_olsr.h" + static void *************** *** 74,81 **** olsr_16_t remainsize = size - OLSR_HEADERSIZE; union olsr_message *msg; /* Print packet header (no IP4/6 difference) */ fprintf(handle, " ============== OLSR PACKET ==============\n source: %s\n length: %d bytes\n seqno: %d\n\n", ! from_addr ? olsr_ip_to_string(from_addr) : "UNKNOWN", ntohs(pkt->v4.olsr_packlen), ntohs(pkt->v4.olsr_seqno)); --- 76,84 ---- olsr_16_t remainsize = size - OLSR_HEADERSIZE; union olsr_message *msg; + struct ipaddr_str buf; /* Print packet header (no IP4/6 difference) */ fprintf(handle, " ============== OLSR PACKET ==============\n source: %s\n length: %d bytes\n seqno: %d\n\n", ! from_addr ? olsr_ip_to_string(&buf, from_addr) : "UNKNOWN", ntohs(pkt->v4.olsr_packlen), ntohs(pkt->v4.olsr_seqno)); *************** *** 103,110 **** print_olsr_serialized_message(FILE *handle, union olsr_message *msg) { fprintf(handle, " ------------ OLSR MESSAGE ------------\n"); fprintf(handle, " Sender main addr: %s\n", ! olsr_ip_to_string((union olsr_ip_addr *)&msg->v4.originator)); fprintf(handle, " Type: %s, size: %d, vtime: %0.2f\n", olsr_msgtype_to_string(msg->v4.olsr_msgtype), --- 106,114 ---- print_olsr_serialized_message(FILE *handle, union olsr_message *msg) { + struct ipaddr_str buf; fprintf(handle, " ------------ OLSR MESSAGE ------------\n"); fprintf(handle, " Sender main addr: %s\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&msg->v4.originator)); fprintf(handle, " Type: %s, size: %d, vtime: %0.2f\n", olsr_msgtype_to_string(msg->v4.olsr_msgtype), *************** *** 219,224 **** haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[4]) { ! ! fprintf(handle, " ++ %s\n", olsr_ip_to_string(haddr)); } } --- 223,228 ---- haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[4]) { ! struct ipaddr_str buf; ! fprintf(handle, " ++ %s\n", olsr_ip_to_string(&buf, haddr)); } } *************** *** 246,250 **** haddr++) { ! fprintf(handle, " ++ %s\n", olsr_ip_to_string(haddr)); } } --- 250,255 ---- haddr++) { ! struct ipaddr_str buf; ! fprintf(handle, " ++ %s\n", olsr_ip_to_string(&buf, haddr)); } } *************** *** 286,291 **** haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[8]) { olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize; ! fprintf(handle, " ++ %s\n", olsr_ip_to_string(haddr)); fprintf(handle, " ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]); } --- 291,297 ---- haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[8]) { + struct ipaddr_str buf; olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize; ! fprintf(handle, " ++ %s\n", olsr_ip_to_string(&buf, haddr)); fprintf(handle, " ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]); } *************** *** 314,319 **** haddr++) { olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize; ! fprintf(handle, " ++ %s\n", olsr_ip_to_string(haddr)); fprintf(handle, " ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]); } --- 320,326 ---- haddr++) { + struct ipaddr_str buf; olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize; ! fprintf(handle, " ++ %s\n", olsr_ip_to_string(&buf, haddr)); fprintf(handle, " ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]); } *************** *** 335,339 **** while(remsize) { ! fprintf(handle, " +Neighbor: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; fprintf(handle, " +LQ: %d, ", *data); --- 342,347 ---- while(remsize) { ! struct ipaddr_str buf; ! fprintf(handle, " +Neighbor: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; fprintf(handle, " +LQ: %d, ", *data); *************** *** 359,363 **** while(remsize) { ! fprintf(handle, " +Neighbor: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; --- 367,372 ---- while(remsize) { ! struct ipaddr_str buf; ! fprintf(handle, " +Neighbor: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; *************** *** 375,381 **** while(remsize) { ! fprintf(handle, " +Network: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; ! fprintf(handle, " +Netmask: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; --- 384,391 ---- while(remsize) { ! struct ipaddr_str buf; ! fprintf(handle, " +Network: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; ! fprintf(handle, " +Netmask: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; *************** *** 392,396 **** while(remsize) { ! fprintf(handle, " +Alias: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; remsize -= olsr_cnf->ipsize; --- 402,407 ---- while(remsize) { ! struct ipaddr_str buf; ! fprintf(handle, " +Alias: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *) data)); data += olsr_cnf->ipsize; remsize -= olsr_cnf->ipsize; Index: olsr_types.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_types.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** olsr_types.h 2 Nov 2007 10:16:39 -0000 1.11 --- olsr_types.h 8 Nov 2007 22:47:41 -0000 1.12 *************** *** 75,95 **** #include ! union olsr_ip_addr ! { ! /* struct in_addr v4; - */ - olsr_u32_t v4; struct in6_addr v6; }; ! struct olsr_ip_prefix ! { union olsr_ip_addr prefix; olsr_u8_t prefix_len; }; ! union hna_netmask ! { olsr_u32_t v4; olsr_u16_t v6; --- 75,89 ---- #include ! union olsr_ip_addr { struct in_addr v4; struct in6_addr v6; }; ! struct olsr_ip_prefix { union olsr_ip_addr prefix; olsr_u8_t prefix_len; }; ! union hna_netmask { olsr_u32_t v4; olsr_u16_t v6; Index: ipc_frontend.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ipc_frontend.h 13 Oct 2007 12:31:04 -0000 1.15 --- ipc_frontend.h 8 Nov 2007 22:47:41 -0000 1.16 *************** *** 100,104 **** olsr_bool ! ipc_check_allowed_ip(union olsr_ip_addr *); void --- 100,104 ---- olsr_bool ! ipc_check_allowed_ip(const union olsr_ip_addr *); void Index: duplicate_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/duplicate_set.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** duplicate_set.c 8 Nov 2007 15:34:11 -0000 1.18 --- duplicate_set.c 8 Nov 2007 22:47:41 -0000 1.19 *************** *** 46,49 **** --- 46,50 ---- #include "scheduler.h" #include "olsr.h" + #include "net_olsr.h" /* The duplicate table */ *************** *** 97,101 **** /* Address */ ! COPY_IP(&new_dup_entry->addr, originator); /* Seqno */ new_dup_entry->seqno = seqno; --- 98,103 ---- /* Address */ ! //COPY_IP(&new_dup_entry->addr, originator); ! new_dup_entry->addr = *originator; /* Seqno */ new_dup_entry->seqno = seqno; *************** *** 137,141 **** tmp_dup_table = tmp_dup_table->next) { ! if(COMP_IP(&tmp_dup_table->addr, originator) && (tmp_dup_table->seqno == seqno)) { --- 139,143 ---- tmp_dup_table = tmp_dup_table->next) { ! if(ipequal(&tmp_dup_table->addr, originator) && (tmp_dup_table->seqno == seqno)) { *************** *** 168,172 **** tmp_dup_table = tmp_dup_table->next) { ! if(COMP_IP(&tmp_dup_table->addr, originator) && (tmp_dup_table->seqno == seqno)) { --- 170,174 ---- tmp_dup_table = tmp_dup_table->next) { ! if(ipequal(&tmp_dup_table->addr, originator) && (tmp_dup_table->seqno == seqno)) { *************** *** 179,183 **** while(tmp_dup_iface) { ! if(COMP_IP(&tmp_dup_iface->addr, int_addr)) return 0; --- 181,185 ---- while(tmp_dup_iface) { ! if(ipequal(&tmp_dup_iface->addr, int_addr)) return 0; *************** *** 236,241 **** struct dup_entry *entry_to_delete = tmp_dup_table; #ifdef DEBUG OLSR_PRINTF(5, "DUP TIMEOUT[%s] s: %d\n", ! olsr_ip_to_string(&tmp_dup_table->addr), tmp_dup_table->seqno); #endif --- 238,246 ---- struct dup_entry *entry_to_delete = tmp_dup_table; #ifdef DEBUG + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF(5, "DUP TIMEOUT[%s] s: %d\n", ! olsr_ip_to_string(&buf, &tmp_dup_table->addr), tmp_dup_table->seqno); #endif *************** *** 270,274 **** tmp_dup_table = tmp_dup_table->next) { ! if(COMP_IP(&tmp_dup_table->addr, originator) && (tmp_dup_table->seqno == seqno)) { --- 275,279 ---- tmp_dup_table = tmp_dup_table->next) { ! if(ipequal(&tmp_dup_table->addr, originator) && (tmp_dup_table->seqno == seqno)) { *************** *** 286,290 **** new_iface = olsr_malloc(sizeof(struct dup_iface), "New dup iface"); ! COPY_IP(&new_iface->addr, iface); new_iface->next = tmp_dup_table->ifaces; tmp_dup_table->ifaces = new_iface; --- 291,296 ---- new_iface = olsr_malloc(sizeof(struct dup_iface), "New dup iface"); ! //COPY_IP(&new_iface->addr, iface); ! new_iface->addr = *iface; new_iface->next = tmp_dup_table->ifaces; tmp_dup_table->ifaces = new_iface; *************** *** 300,303 **** --- 306,312 ---- const olsr_u16_t seqno) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif olsr_u32_t hash; struct dup_entry *tmp_dup_table; *************** *** 311,315 **** tmp_dup_table = tmp_dup_table->next) { ! if(COMP_IP(&tmp_dup_table->addr, originator) && (tmp_dup_table->seqno == seqno)) { --- 320,324 ---- tmp_dup_table = tmp_dup_table->next) { ! if(ipequal(&tmp_dup_table->addr, originator) && (tmp_dup_table->seqno == seqno)) { *************** *** 323,327 **** #ifdef DEBUG ! OLSR_PRINTF(3, "Setting DUP %s/%d forwarded\n", olsr_ip_to_string(&tmp_dup_table->addr), seqno); #endif --- 332,336 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "Setting DUP %s/%d forwarded\n", olsr_ip_to_string(&buf, &tmp_dup_table->addr), seqno); #endif *************** *** 349,354 **** while(tmp_dup_table != &dup_set[i]) { ! printf("[%s] s: %d\n", ! olsr_ip_to_string(&tmp_dup_table->addr), tmp_dup_table->seqno); tmp_dup_table = tmp_dup_table->next; --- 358,364 ---- while(tmp_dup_table != &dup_set[i]) { ! struct ipaddr_str buf; ! printf("[%s] s: %d\n", ! olsr_ip_to_string(&buf, &tmp_dup_table->addr), tmp_dup_table->seqno); tmp_dup_table = tmp_dup_table->next; Index: local_hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/local_hna_set.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** local_hna_set.c 5 Nov 2007 15:32:55 -0000 1.15 --- local_hna_set.c 8 Nov 2007 22:47:41 -0000 1.16 *************** *** 43,46 **** --- 43,47 ---- #include "local_hna_set.h" #include "olsr.h" + #include "net_olsr.h" void *************** *** 80,85 **** while(h) { ! if((net->v4 == h->net.prefix.v4) && ! (mask->v4 == prefix_len)) { /* Dequeue */ --- 81,86 ---- while(h) { ! if((net->v4.s_addr == h->net.prefix.v4.s_addr) && ! (mask->v4.s_addr == prefix_len)) { /* Dequeue */ *************** *** 129,137 **** { struct local_hna_entry *h = olsr_cnf->hna_entries; ! const union olsr_ip_addr ip_addr = { .v4 = mask }; const olsr_u16_t prefix_len = olsr_netmask_to_prefix(&ip_addr); while(h) { ! if((net->v4 == h->net.prefix.v4) && (prefix_len == h->net.prefix_len)) { --- 130,138 ---- { struct local_hna_entry *h = olsr_cnf->hna_entries; ! const union olsr_ip_addr ip_addr = { .v4 = { .s_addr = mask } }; const olsr_u16_t prefix_len = olsr_netmask_to_prefix(&ip_addr); while(h) { ! if((net->v4.s_addr == h->net.prefix.v4.s_addr) && (prefix_len == h->net.prefix_len)) { *************** *** 174,178 **** for(h = olsr_cnf->hna_entries; h != NULL; h = h->next) { ! if(h->net.prefix_len == 0 && h->net.prefix.v4 == 0) return 1; } --- 175,179 ---- for(h = olsr_cnf->hna_entries; h != NULL; h = h->next) { ! if(h->net.prefix_len == 0 && h->net.prefix.v4.s_addr == 0) return 1; } Index: lq_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** lq_packet.c 29 Aug 2007 23:08:54 -0000 1.28 --- lq_packet.c 8 Nov 2007 22:47:41 -0000 1.29 *************** *** 56,59 **** --- 56,60 ---- #include "olsr.h" #include "build_msg.h" + #include "net_olsr.h" *************** *** 62,92 **** static unsigned char msg_buffer[MAXMESSAGESIZE - OLSR_HEADERSIZE]; ! static inline void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); } ! static inline void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); } ! static inline void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); } ! static inline void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(olsr_8_t *)(*p); *p += sizeof(olsr_8_t); } ! static inline void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); } ! static inline void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); } ! static inline void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); } ! static inline void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { COPY_IP(var, *p); *p += olsr_cnf->ipsize; } ! static inline void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (double)**p / 255.0; *p += sizeof(olsr_u8_t); } ! static inline void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); } ! static inline void pkt_ignore_u16(const olsr_u8_t **p) { *p += sizeof(olsr_u16_t); } ! static inline void pkt_ignore_u32(const olsr_u8_t **p) { *p += sizeof(olsr_u32_t); } ! static inline void pkt_ignore_s8(const olsr_u8_t **p) { *p += sizeof(olsr_8_t); } ! static inline void pkt_ignore_s16(const olsr_u8_t **p) { *p += sizeof(olsr_16_t); } ! static inline void pkt_ignore_s32(const olsr_u8_t **p) { *p += sizeof(olsr_32_t); } ! static inline void pkt_ignore_ipaddress(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; } ! static inline void pkt_put_u8(olsr_u8_t **p, const olsr_u8_t var) { *(olsr_u8_t *)(*p) = var; *p += sizeof(olsr_u8_t); } ! static inline void pkt_put_u16(olsr_u8_t **p, const olsr_u16_t var) { *(olsr_u16_t *)(*p) = htons(var); *p += sizeof(olsr_u16_t); } ! static inline void pkt_put_u32(olsr_u8_t **p, const olsr_u32_t var) { *(olsr_u32_t *)(*p) = htonl(var); *p += sizeof(olsr_u32_t); } ! static inline void pkt_put_s8(olsr_u8_t **p, const olsr_8_t var) { *(olsr_8_t *)(*p) = var; *p += sizeof(olsr_8_t); } ! static inline void pkt_put_s16(olsr_u8_t **p, const olsr_16_t var) { *(olsr_16_t *)(*p) = htons(var); *p += sizeof(olsr_16_t); } ! static inline void pkt_put_s32(olsr_u8_t **p, const olsr_32_t var) { *(olsr_32_t *)(*p) = htonl(var); *p += sizeof(olsr_32_t); } ! static inline void pkt_put_double(olsr_u8_t **p, const double var) { **p = double_to_me(var); *p += sizeof(olsr_u8_t); } ! static inline void pkt_put_ipaddress(olsr_u8_t **p, const union olsr_ip_addr var) { COPY_IP(*p, &var); *p += olsr_cnf->ipsize; } ! static inline void pkt_put_lq(olsr_u8_t **p, const double var) { **p = var * 255.0; *p += sizeof(olsr_u8_t); } --- 63,93 ---- static unsigned char msg_buffer[MAXMESSAGESIZE - OLSR_HEADERSIZE]; ! static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(olsr_8_t *)(*p); *p += sizeof(olsr_8_t); } ! static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); } ! static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); } ! static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (double)**p / 255.0; *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_ignore_u16(const olsr_u8_t **p) { *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_ignore_u32(const olsr_u8_t **p) { *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_ignore_s8(const olsr_u8_t **p) { *p += sizeof(olsr_8_t); } ! static INLINE void pkt_ignore_s16(const olsr_u8_t **p) { *p += sizeof(olsr_16_t); } ! static INLINE void pkt_ignore_s32(const olsr_u8_t **p) { *p += sizeof(olsr_32_t); } ! static INLINE void pkt_ignore_ipaddress(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; } ! static INLINE void pkt_put_u8(olsr_u8_t **p, const olsr_u8_t var) { *(olsr_u8_t *)(*p) = var; *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_put_u16(olsr_u8_t **p, const olsr_u16_t var) { *(olsr_u16_t *)(*p) = htons(var); *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_put_u32(olsr_u8_t **p, const olsr_u32_t var) { *(olsr_u32_t *)(*p) = htonl(var); *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_put_s8(olsr_u8_t **p, const olsr_8_t var) { *(olsr_8_t *)(*p) = var; *p += sizeof(olsr_8_t); } ! static INLINE void pkt_put_s16(olsr_u8_t **p, const olsr_16_t var) { *(olsr_16_t *)(*p) = htons(var); *p += sizeof(olsr_16_t); } ! static INLINE void pkt_put_s32(olsr_u8_t **p, const olsr_32_t var) { *(olsr_32_t *)(*p) = htonl(var); *p += sizeof(olsr_32_t); } ! static INLINE void pkt_put_double(olsr_u8_t **p, const double var) { **p = double_to_me(var); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_put_ipaddress(olsr_u8_t **p, const union olsr_ip_addr var) { memcpy(*p, &var, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_put_lq(olsr_u8_t **p, const double var) { **p = var * 255.0; *p += sizeof(olsr_u8_t); } *************** *** 103,107 **** lq_hello->comm.size = 0; ! COPY_IP(&lq_hello->comm.orig, &olsr_cnf->main_addr); lq_hello->comm.ttl = 1; --- 104,109 ---- lq_hello->comm.size = 0; ! //COPY_IP(&lq_hello->comm.orig, &olsr_cnf->main_addr); ! lq_hello->comm.orig = olsr_cnf->main_addr; lq_hello->comm.ttl = 1; *************** *** 122,126 **** // a) this neighbor interface IS NOT visible via the output interface ! if(!COMP_IP(&walker->local_iface_addr, &outif->ip_addr)) neigh->link_type = UNSPEC_LINK; --- 124,128 ---- // a) this neighbor interface IS NOT visible via the output interface ! if(!ipequal(&walker->local_iface_addr, &outif->ip_addr)) neigh->link_type = UNSPEC_LINK; *************** *** 148,152 **** // set the entry's neighbour interface address ! COPY_IP(&neigh->addr, &walker->neighbor_iface_addr); // queue the neighbour entry --- 150,155 ---- // set the entry's neighbour interface address ! //COPY_IP(&neigh->addr, &walker->neighbor_iface_addr); ! neigh->addr = walker->neighbor_iface_addr; // queue the neighbour entry *************** *** 190,194 **** lq_tc->comm.size = 0; ! COPY_IP(&lq_tc->comm.orig, &olsr_cnf->main_addr); if (olsr_cnf->lq_fish > 0) --- 193,198 ---- lq_tc->comm.size = 0; ! //COPY_IP(&lq_tc->comm.orig, &olsr_cnf->main_addr); ! lq_tc->comm.orig = olsr_cnf->main_addr; if (olsr_cnf->lq_fish > 0) *************** *** 212,216 **** lq_tc->comm.seqno = get_msg_seqno(); ! COPY_IP(&lq_tc->from, &olsr_cnf->main_addr); lq_tc->ansn = get_local_ansn(); --- 216,221 ---- lq_tc->comm.seqno = get_msg_seqno(); ! //COPY_IP(&lq_tc->from, &olsr_cnf->main_addr); ! lq_tc->from = olsr_cnf->main_addr; lq_tc->ansn = get_local_ansn(); *************** *** 249,253 **** // set the entry's main address ! COPY_IP(&neigh->address, &walker->neighbor_main_addr); // set the entry's link quality --- 254,259 ---- // set the entry's main address ! //COPY_IP(&neigh->address, &walker->neighbor_main_addr); ! neigh->address = walker->neighbor_main_addr; // set the entry's link quality *************** *** 300,304 **** olsr_head_v4->size = htons(comm->size); ! COPY_IP(&olsr_head_v4->orig, &comm->orig); olsr_head_v4->ttl = comm->ttl; --- 306,310 ---- olsr_head_v4->size = htons(comm->size); ! olsr_head_v4->orig = comm->orig.v4.s_addr; olsr_head_v4->ttl = comm->ttl; *************** *** 315,319 **** olsr_head_v6->size = htons(comm->size); ! COPY_IP(&olsr_head_v6->orig, &comm->orig); olsr_head_v6->ttl = comm->ttl; --- 321,325 ---- olsr_head_v6->size = htons(comm->size); ! memcpy(&olsr_head_v6->orig, &comm->orig.v6.s6_addr, sizeof(olsr_head_v6->orig)); olsr_head_v6->ttl = comm->ttl; *************** *** 446,450 **** // add the current neighbor's IP address ! COPY_IP(buff + size, &neigh->addr); size += olsr_cnf->ipsize; --- 452,456 ---- // add the current neighbor's IP address ! genipcopy(buff + size, &neigh->addr); size += olsr_cnf->ipsize; *************** *** 556,560 **** // add the current neighbor's IP address ! COPY_IP(buff + size, &neigh->address); size += olsr_cnf->ipsize; --- 562,566 ---- // add the current neighbor's IP address ! genipcopy(buff + size, &neigh->address); size += olsr_cnf->ipsize; *************** *** 670,674 **** return 1; } ! COPY_IP(&tc->source_addr, addr); pkt_get_u8(&curr, &tc->ttl); --- 676,681 ---- return 1; } ! //COPY_IP(&tc->source_addr, addr); ! tc->source_addr = *addr; pkt_get_u8(&curr, &tc->ttl); Index: mid_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** mid_set.h 2 Aug 2007 21:50:22 -0000 1.15 --- mid_set.h 8 Nov 2007 22:47:41 -0000 1.16 *************** *** 45,48 **** --- 45,49 ---- #include "olsr_types.h" + #include "hashing.h" Index: process_package.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** process_package.h 20 Feb 2005 18:52:18 -0000 1.12 --- process_package.h 8 Nov 2007 22:47:41 -0000 1.13 *************** *** 52,56 **** void ! olsr_hello_tap(struct hello_message *, struct interface *, union olsr_ip_addr *); void --- 52,56 ---- void ! olsr_hello_tap(struct hello_message *, struct interface *, const union olsr_ip_addr *); void Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** net_olsr.h 5 Nov 2007 15:32:55 -0000 1.14 --- net_olsr.h 8 Nov 2007 22:47:41 -0000 1.15 *************** *** 48,51 **** --- 48,52 ---- #include "interfaces.h" #include "process_routes.h" + #include #include *************** *** 53,56 **** --- 54,80 ---- typedef int (*packet_transform_function)(olsr_u8_t *, int *); + struct ipaddr_str { + char buf[MAX(INET6_ADDRSTRLEN, INET_ADDRSTRLEN)]; + }; + + /* + * Macros for comparing and copying IP addresses + */ + #define INLINE inline __attribute__((always_inline)) + static INLINE int ip4cmp(const struct in_addr *a, const struct in_addr *b) { return ntohl(a->s_addr) - ntohl(b->s_addr); } + static INLINE int ip4equal(const struct in_addr *a, const struct in_addr *b) { return a->s_addr == b->s_addr; } + + static INLINE int ip6cmp(const struct in6_addr *a, const struct in6_addr *b) { return memcmp(a, b, sizeof(*a)); } + static INLINE int ip6equal(const struct in6_addr *a, const struct in6_addr *b) { return ip6cmp(a, b) == 0; } + + int ipcmp(const union olsr_ip_addr *a, const union olsr_ip_addr *b); + static INLINE int ipequal(const union olsr_ip_addr *a, const union olsr_ip_addr *b) { return ipcmp(a, b) == 0; } + + /* Do not use this - this is as evil as the COPY_IP() macro was and only used in + * source which also needs cleanups. + */ + static INLINE void genipcopy(void *dst, const void *src) { memcpy(dst, src, olsr_cnf->ipsize); } + + void net_set_disp_pack_out(olsr_bool); *************** *** 69,73 **** olsr_u16_t ! net_output_pending(struct interface *); int --- 93,97 ---- olsr_u16_t ! net_output_pending(const struct interface *); int *************** *** 87,106 **** int ! olsr_prefix_to_netmask(union olsr_ip_addr *, olsr_u16_t); olsr_u16_t olsr_netmask_to_prefix(const union olsr_ip_addr *); ! char * ! sockaddr_to_string(const struct sockaddr *); const char * ! ip_to_string(const olsr_u32_t *); const char * ! ip6_to_string(const struct in6_addr *); const char * ! olsr_ip_to_string(const union olsr_ip_addr *); const char * --- 111,133 ---- int ! olsr_prefix_to_netmask(union olsr_ip_addr *, const olsr_u16_t); olsr_u16_t olsr_netmask_to_prefix(const union olsr_ip_addr *); ! const char * ! sockaddr_to_string(struct ipaddr_str * const , const struct sockaddr *); const char * ! ip4_to_string(struct ipaddr_str * const buf, const struct in_addr); const char * ! ip6_to_string(struct ipaddr_str * const buf, const struct in6_addr * const addr6); const char * ! olsr_ip_to_string(struct ipaddr_str * const buf, const union olsr_ip_addr *); ! ! const char * ! sockaddr_to_string(struct ipaddr_str * const buf, const struct sockaddr *); const char * Index: defs.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/defs.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** defs.h 20 Oct 2007 21:07:24 -0000 1.65 --- defs.h 8 Nov 2007 22:47:41 -0000 1.66 *************** *** 57,61 **** #include "olsr_protocol.h" - #include "net_olsr.h" /* IPaddr -> string conversions is used by everyone */ #include "olsr_cfg.h" --- 57,60 ---- *************** *** 88,92 **** #define OLSR_PRINTF(lvl, format, args...) do { } while(0) #else ! #define OLSR_PRINTF(lvl, format, args...) do { \ if((olsr_cnf->debug_level >= (lvl)) && debug_handle) \ fprintf(debug_handle, (format), ##args); \ --- 87,91 ---- #define OLSR_PRINTF(lvl, format, args...) do { } while(0) #else ! #define OLSR_PRINTF(lvl, format, args...) do { \ if((olsr_cnf->debug_level >= (lvl)) && debug_handle) \ fprintf(debug_handle, (format), ##args); \ Index: packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/packet.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** packet.c 20 Oct 2007 15:16:32 -0000 1.25 --- packet.c 8 Nov 2007 22:47:41 -0000 1.26 *************** *** 48,51 **** --- 48,52 ---- #include "neighbor_table.h" #include "build_msg.h" + #include "net_olsr.h" static olsr_bool sending_tc = OLSR_FALSE; *************** *** 61,65 **** olsr_free_hello_packet(struct hello_message *message) { ! struct hello_neighbor *nb, *prev_nb; if(!message) --- 62,66 ---- olsr_free_hello_packet(struct hello_message *message) { ! struct hello_neighbor *nb; if(!message) *************** *** 67,77 **** nb = message->neighbors; ! ! while (nb) ! { ! prev_nb = nb; ! nb = nb->next; ! free(prev_nb); ! } } --- 68,76 ---- nb = message->neighbors; ! while (nb) { ! struct hello_neighbor *prev_nb = nb; ! nb = nb->next; ! free(prev_nb); ! } } *************** *** 94,98 **** #ifdef DEBUG ! OLSR_PRINTF(3, "\tBuilding HELLO on interface %s\n", outif->int_name); #endif --- 93,97 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "\tBuilding HELLO on interface \"%s\"\n", outif->int_name ? outif->int_name : ""); #endif *************** *** 112,116 **** message->ttl = 1; ! COPY_IP(&message->source_addr, &olsr_cnf->main_addr); #ifdef DEBUG --- 111,116 ---- message->ttl = 1; ! //COPY_IP(&message->source_addr, &olsr_cnf->main_addr); ! message->source_addr = olsr_cnf->main_addr; #ifdef DEBUG *************** *** 123,131 **** while(links != NULL) { int lnk = lookup_link_status(links); /* Update the status */ /* Check if this link tuple is registered on the outgoing interface */ ! if(!COMP_IP(&links->local_iface_addr, &outif->ip_addr)) { links = links->next; --- 123,134 ---- while(links != NULL) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif int lnk = lookup_link_status(links); /* Update the status */ /* Check if this link tuple is registered on the outgoing interface */ ! if(!ipequal(&links->local_iface_addr, &outif->ip_addr)) { links = links->next; *************** *** 187,197 **** /* Set the remote interface address */ ! COPY_IP(&message_neighbor->address, &links->neighbor_iface_addr); /* Set the main address */ ! COPY_IP(&message_neighbor->main_address, &links->neighbor->neighbor_main_addr); #ifdef DEBUG ! OLSR_PRINTF(5, "Added: %s - ", olsr_ip_to_string(&message_neighbor->address)); ! OLSR_PRINTF(5, " status %d\n", message_neighbor->status); #endif message_neighbor->next=message->neighbors; --- 190,201 ---- /* Set the remote interface address */ ! //COPY_IP(&message_neighbor->address, &links->neighbor_iface_addr); ! message_neighbor->address = links->neighbor_iface_addr; /* Set the main address */ ! //COPY_IP(&message_neighbor->main_address, &links->neighbor->neighbor_main_addr); ! message_neighbor->main_address = links->neighbor->neighbor_main_addr; #ifdef DEBUG ! OLSR_PRINTF(5, "Added: %s - status %d\n", olsr_ip_to_string(&buf, &message_neighbor->address), message_neighbor->status); #endif message_neighbor->next=message->neighbors; *************** *** 218,221 **** --- 222,228 ---- neighbor=neighbor->next) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif /* Check that the neighbor is not added yet */ tmp_neigh = message->neighbors; *************** *** 223,227 **** while(tmp_neigh) { ! if(COMP_IP(&tmp_neigh->main_address, &neighbor->neighbor_main_addr)) { //printf("Not adding duplicate neighbor %s\n", olsr_ip_to_string(&neighbor->neighbor_main_addr)); --- 230,234 ---- while(tmp_neigh) { ! if(ipequal(&tmp_neigh->main_address, &neighbor->neighbor_main_addr)) { //printf("Not adding duplicate neighbor %s\n", olsr_ip_to_string(&neighbor->neighbor_main_addr)); *************** *** 286,295 **** ! COPY_IP(&message_neighbor->address, &neighbor->neighbor_main_addr); ! COPY_IP(&message_neighbor->main_address, &neighbor->neighbor_main_addr); #ifdef DEBUG ! OLSR_PRINTF(5, "Added: %s - ", olsr_ip_to_string(&message_neighbor->address)); ! OLSR_PRINTF(5, " status %d\n", message_neighbor->status); #endif message_neighbor->next=message->neighbors; --- 293,303 ---- ! //COPY_IP(&message_neighbor->address, &neighbor->neighbor_main_addr); ! message_neighbor->address = neighbor->neighbor_main_addr; ! //COPY_IP(&message_neighbor->main_address, &neighbor->neighbor_main_addr); ! message_neighbor->main_address = neighbor->neighbor_main_addr; #ifdef DEBUG ! OLSR_PRINTF(5, "Added: %s - status %d\n", olsr_ip_to_string(&buf, &message_neighbor->address), message_neighbor->status); #endif message_neighbor->next=message->neighbors; *************** *** 313,317 **** olsr_free_tc_packet(struct tc_message *message) { ! struct tc_mpr_addr *mprs, *prev_mprs; if(!message) --- 321,325 ---- olsr_free_tc_packet(struct tc_message *message) { ! struct tc_mpr_addr *mprs; if(!message) *************** *** 319,329 **** mprs = message->multipoint_relay_selector_address; ! ! while (mprs) ! { ! prev_mprs = mprs; ! mprs = mprs->next; ! free(prev_mprs); ! } } --- 327,335 ---- mprs = message->multipoint_relay_selector_address; ! while (mprs != NULL) { ! struct tc_mpr_addr *prev_mprs = mprs; ! mprs = mprs->next; ! free(prev_mprs); ! } } *************** *** 352,357 **** message->ansn = get_local_ansn(); ! COPY_IP(&message->originator, &olsr_cnf->main_addr); ! COPY_IP(&message->source_addr, &olsr_cnf->main_addr); --- 358,365 ---- message->ansn = get_local_ansn(); ! //COPY_IP(&message->originator, &olsr_cnf->main_addr); ! message->originator = olsr_cnf->main_addr; ! //COPY_IP(&message->source_addr, &olsr_cnf->main_addr); ! message->source_addr = olsr_cnf->main_addr; *************** *** 374,378 **** message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC"); ! COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); message_mpr->next = message->multipoint_relay_selector_address; message->multipoint_relay_selector_address = message_mpr; --- 382,387 ---- message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC"); ! //COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); ! message_mpr->address = entry->neighbor_main_addr; message_mpr->next = message->multipoint_relay_selector_address; message->multipoint_relay_selector_address = message_mpr; *************** *** 390,394 **** message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 2"); ! COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); message_mpr->next = message->multipoint_relay_selector_address; message->multipoint_relay_selector_address = message_mpr; --- 399,404 ---- message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 2"); ! //COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); ! message_mpr->address = entry->neighbor_main_addr; message_mpr->next = message->multipoint_relay_selector_address; message->multipoint_relay_selector_address = message_mpr; *************** *** 405,409 **** message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 3"); ! COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); message_mpr->next = message->multipoint_relay_selector_address; message->multipoint_relay_selector_address = message_mpr; --- 415,420 ---- message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 3"); ! //COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); ! message_mpr->address = entry->neighbor_main_addr; message_mpr->next = message->multipoint_relay_selector_address; message->multipoint_relay_selector_address = message_mpr; Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** process_package.c 13 Sep 2007 15:31:59 -0000 1.42 --- process_package.c 8 Nov 2007 22:47:41 -0000 1.43 *************** *** 55,58 **** --- 55,59 ---- #include "scheduler.h" #include "local_hna_set.h" + #include "net_olsr.h" *************** *** 79,84 **** void ! olsr_hello_tap(struct hello_message *message, struct interface *in_if, ! union olsr_ip_addr *from_addr) { struct neighbor_entry *neighbor; --- 80,86 ---- void ! olsr_hello_tap(struct hello_message *message, ! struct interface *in_if, ! const union olsr_ip_addr *from_addr) { struct neighbor_entry *neighbor; *************** *** 100,104 **** for (walker = message->neighbors; walker != NULL; walker = walker->next) ! if (COMP_IP(&walker->address, &in_if->ip_addr)) break; --- 102,106 ---- for (walker = message->neighbors; walker != NULL; walker = walker->next) ! if (ipequal(&walker->address, &in_if->ip_addr)) break; *************** *** 168,173 **** if(neighbor->willingness != message->willingness) { OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n", ! olsr_ip_to_string(&neighbor->neighbor_main_addr), neighbor->willingness, message->willingness); --- 170,178 ---- if(neighbor->willingness != message->willingness) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n", ! olsr_ip_to_string(&buf, &neighbor->neighbor_main_addr), neighbor->willingness, message->willingness); *************** *** 201,205 **** void ! olsr_process_received_hello(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *from_addr) { struct hello_message message; --- 206,212 ---- void ! olsr_process_received_hello(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) { struct hello_message message; *************** *** 217,223 **** void ! olsr_tc_tap(struct tc_message *message, struct interface *in_if, ! union olsr_ip_addr *from_addr, union olsr_message *m) { struct tc_mpr_addr *mpr; struct tc_entry *tc_last; --- 224,235 ---- void ! olsr_tc_tap(struct tc_message *message, ! struct interface *in_if, ! union olsr_ip_addr *from_addr, ! union olsr_message *m) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif struct tc_mpr_addr *mpr; struct tc_entry *tc_last; *************** *** 230,234 **** OLSR_PRINTF(3, "Processing TC from %s, seq 0x%04x\n", ! olsr_ip_to_string(&message->originator), message->ansn); /* --- 242,246 ---- OLSR_PRINTF(3, "Processing TC from %s, seq 0x%04x\n", ! olsr_ip_to_string(&buf, &message->originator), message->ansn); /* *************** *** 241,245 **** { OLSR_PRINTF(2, "Received TC from NON SYM neighbor %s\n", ! olsr_ip_to_string(from_addr)); olsr_free_tc_packet(message); return; --- 253,257 ---- { OLSR_PRINTF(2, "Received TC from NON SYM neighbor %s\n", ! olsr_ip_to_string(&buf, from_addr)); olsr_free_tc_packet(message); return; *************** *** 253,257 **** while(mpr!=NULL) { ! OLSR_PRINTF(3, "%s:", olsr_ip_to_string(&mpr->address)); mpr=mpr->next; } --- 265,269 ---- while(mpr!=NULL) { ! OLSR_PRINTF(3, "%s:", olsr_ip_to_string(&buf, &mpr->address)); mpr=mpr->next; } *************** *** 291,295 **** { OLSR_PRINTF(3, "Dropping empty TC from %s\n", ! olsr_ip_to_string(&message->originator)); } } --- 303,307 ---- { OLSR_PRINTF(3, "Dropping empty TC from %s\n", ! olsr_ip_to_string(&buf, &message->originator)); } } *************** *** 319,323 **** */ void ! olsr_process_received_tc(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *from_addr) { struct tc_message message; --- 331,337 ---- */ void ! olsr_process_received_tc(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) { struct tc_message message; *************** *** 349,354 **** void ! olsr_process_received_mid(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *from_addr) { struct mid_alias *tmp_adr; struct mid_message message; --- 363,373 ---- void ! olsr_process_received_mid(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif struct mid_alias *tmp_adr; struct mid_message message; *************** *** 369,373 **** #ifdef DEBUG ! OLSR_PRINTF(5, "Processing MID from %s...\n", olsr_ip_to_string(&message.mid_origaddr)); #endif tmp_adr = message.mid_addr; --- 388,392 ---- #ifdef DEBUG ! OLSR_PRINTF(5, "Processing MID from %s...\n", olsr_ip_to_string(&buf, &message.mid_origaddr)); #endif tmp_adr = message.mid_addr; *************** *** 381,385 **** if(check_neighbor_link(from_addr) != SYM_LINK) { ! OLSR_PRINTF(2, "Received MID from NON SYM neighbor %s\n", olsr_ip_to_string(from_addr)); olsr_free_mid_packet(&message); return; --- 400,407 ---- if(check_neighbor_link(from_addr) != SYM_LINK) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(2, "Received MID from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); olsr_free_mid_packet(&message); return; *************** *** 393,398 **** if(!mid_lookup_main_addr(&tmp_adr->alias_addr)) { ! OLSR_PRINTF(1, "MID new: (%s, ", olsr_ip_to_string(&message.mid_origaddr)); ! OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&tmp_adr->alias_addr)); insert_mid_alias(&message.mid_origaddr, &tmp_adr->alias_addr, (float)message.vtime); } --- 415,423 ---- if(!mid_lookup_main_addr(&tmp_adr->alias_addr)) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "MID new: (%s, ", olsr_ip_to_string(&buf, &message.mid_origaddr)); ! OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&buf, &tmp_adr->alias_addr)); insert_mid_alias(&message.mid_origaddr, &tmp_adr->alias_addr, (float)message.vtime); } *************** *** 429,433 **** void ! olsr_process_received_hna(union olsr_message *m, struct interface *in_if, union olsr_ip_addr *from_addr) { struct hna_net_addr *hna_tmp; --- 454,460 ---- void ! olsr_process_received_hna(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) { struct hna_net_addr *hna_tmp; *************** *** 461,465 **** if(check_neighbor_link(from_addr) != SYM_LINK) { ! OLSR_PRINTF(2, "Received HNA from NON SYM neighbor %s\n", olsr_ip_to_string(from_addr)); olsr_free_hna_packet(&message); return; --- 488,495 ---- if(check_neighbor_link(from_addr) != SYM_LINK) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(2, "Received HNA from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); olsr_free_hna_packet(&message); return; *************** *** 511,514 **** --- 541,547 ---- message_neighbors = message_neighbors->next) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif union olsr_ip_addr *neigh_addr; struct neighbor_2_entry *two_hop_neighbor; *************** *** 526,532 **** neigh_addr = mid_lookup_main_addr(&message_neighbors->address); ! if (neigh_addr != NULL) ! COPY_IP(&message_neighbors->address, neigh_addr); ! if(((message_neighbors->status == SYM_NEIGH) || (message_neighbors->status == MPR_NEIGH))) --- 559,567 ---- neigh_addr = mid_lookup_main_addr(&message_neighbors->address); ! if (neigh_addr != NULL) { ! //COPY_IP(&message_neighbors->address, neigh_addr); ! message_neighbors->address = *neigh_addr; ! } ! if(((message_neighbors->status == SYM_NEIGH) || (message_neighbors->status == MPR_NEIGH))) *************** *** 535,539 **** olsr_lookup_my_neighbors(neighbor, &message_neighbors->address); #ifdef DEBUG ! OLSR_PRINTF(7, "\tProcessing %s\n", olsr_ip_to_string(&message_neighbors->address)); #endif if (two_hop_neighbor_yet != NULL) --- 570,574 ---- olsr_lookup_my_neighbors(neighbor, &message_neighbors->address); #ifdef DEBUG ! OLSR_PRINTF(7, "\tProcessing %s\n", olsr_ip_to_string(&buf, &message_neighbors->address)); #endif if (two_hop_neighbor_yet != NULL) *************** *** 577,581 **** OLSR_PRINTF(5, "Adding 2 hop neighbor %s\n\n", ! olsr_ip_to_string(&message_neighbors->address)); #endif changes_neighborhood = OLSR_TRUE; --- 612,616 ---- OLSR_PRINTF(5, "Adding 2 hop neighbor %s\n\n", ! olsr_ip_to_string(&buf, &message_neighbors->address)); #endif changes_neighborhood = OLSR_TRUE; *************** *** 583,588 **** two_hop_neighbor = ! olsr_malloc(sizeof(struct neighbor_2_entry), ! "Process HELLO"); two_hop_neighbor->neighbor_2_nblist.next = --- 618,622 ---- two_hop_neighbor = ! olsr_malloc(sizeof(struct neighbor_2_entry), "Process HELLO"); two_hop_neighbor->neighbor_2_nblist.next = *************** *** 594,604 **** two_hop_neighbor->neighbor_2_pointer = 0; ! COPY_IP(&two_hop_neighbor->neighbor_2_addr, ! &message_neighbors->address); olsr_insert_two_hop_neighbor_table(two_hop_neighbor); ! olsr_linking_this_2_entries(neighbor, two_hop_neighbor, ! (float)message->vtime); } else --- 628,637 ---- two_hop_neighbor->neighbor_2_pointer = 0; ! //COPY_IP(&two_hop_neighbor->neighbor_2_addr,&message_neighbors->address); ! two_hop_neighbor->neighbor_2_addr = message_neighbors->address; olsr_insert_two_hop_neighbor_table(two_hop_neighbor); ! olsr_linking_this_2_entries(neighbor, two_hop_neighbor, (float)message->vtime); } else *************** *** 610,615 **** changes_topology = OLSR_TRUE; ! olsr_linking_this_2_entries(neighbor, two_hop_neighbor, ! (float)message->vtime); } } --- 643,647 ---- changes_topology = OLSR_TRUE; ! olsr_linking_this_2_entries(neighbor, two_hop_neighbor, (float)message->vtime); } } *************** *** 846,857 **** { ! struct hello_neighbor *neighbors; ! ! neighbors=message->neighbors; while(neighbors!=NULL) { ! //printf("(linkstatus)Checking %s ",olsr_ip_to_string(&neighbors->address)); ! //printf("against %s\n",olsr_ip_to_string(&main_addr)); --- 878,887 ---- { ! struct hello_neighbor *neighbors = message->neighbors; while(neighbors!=NULL) { ! //printf("(linkstatus)Checking %s ",olsr_ip_to_string(&buf, &neighbors->address)); ! //printf("against %s\n",olsr_ip_to_string(&buf, &main_addr)); *************** *** 859,863 **** { /* IPv4 */ ! if(COMP_IP(&neighbors->address, &in_if->ip_addr)) { //printf("ok"); --- 889,893 ---- { /* IPv4 */ ! if(ip4equal(&neighbors->address.v4, &in_if->ip_addr.v4)) { //printf("ok"); *************** *** 871,875 **** { /* IPv6 */ ! if(COMP_IP(&neighbors->address, &in_if->int6_addr.sin6_addr)) { //printf("ok"); --- 901,905 ---- { /* IPv6 */ ! if(ip6equal(&neighbors->address.v6, &in_if->int6_addr.sin6_addr)) { //printf("ok"); Index: mid_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** mid_set.c 17 Sep 2007 22:24:22 -0000 1.22 --- mid_set.c 8 Nov 2007 22:47:41 -0000 1.23 *************** *** 48,51 **** --- 48,52 ---- #include "link_set.h" #include "packet.h" /* struct mid_alias */ + #include "net_olsr.h" *************** *** 112,116 **** tmp = tmp->next) { ! if(COMP_IP(&tmp->main_addr, m_addr)) break; } --- 113,117 ---- tmp = tmp->next) { ! if(ipequal(&tmp->main_addr, m_addr)) break; } *************** *** 118,122 **** /* 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. */ --- 119,123 ---- /* Check if alias is already registered with m_addr */ registered_m_addr = mid_lookup_main_addr(&alias->alias); ! if (registered_m_addr != NULL && ipequal(registered_m_addr, m_addr)) { /* Alias is already registered with main address. Nothing to do here. */ *************** *** 142,146 **** alias->main_entry = tmp; QUEUE_ELEM(reverse_mid_set[alias_hash], alias); ! COPY_IP(&tmp->main_addr, m_addr); tmp->ass_timer = GET_TIMESTAMP(vtime*1000); /* Queue */ --- 143,148 ---- alias->main_entry = tmp; QUEUE_ELEM(reverse_mid_set[alias_hash], alias); ! //COPY_IP(&tmp->main_addr, m_addr); ! tmp->main_addr = *m_addr; tmp->ass_timer = GET_TIMESTAMP(vtime*1000); /* Queue */ *************** *** 168,173 **** if((tmp_2_neighbor = olsr_lookup_two_hop_neighbor_table_mid(&tmp_adr->alias)) != NULL) { ! OLSR_PRINTF(1, "Deleting 2 hop node from MID: %s to ", olsr_ip_to_string(&tmp_adr->alias)); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(m_addr)); olsr_delete_two_hop_neighbor_table(tmp_2_neighbor); --- 170,178 ---- if((tmp_2_neighbor = olsr_lookup_two_hop_neighbor_table_mid(&tmp_adr->alias)) != NULL) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "Deleting 2 hop node from MID: %s to ", olsr_ip_to_string(&buf, &tmp_adr->alias)); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, m_addr)); olsr_delete_two_hop_neighbor_table(tmp_2_neighbor); *************** *** 181,186 **** { ! OLSR_PRINTF(1, "[MID]Deleting bogus neighbor entry %s real ", olsr_ip_to_string(&tmp_adr->alias)); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(m_addr)); replace_neighbor_link_set(tmp_neigh, real_neigh); --- 186,194 ---- { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "[MID]Deleting bogus neighbor entry %s real ", olsr_ip_to_string(&buf, &tmp_adr->alias)); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, m_addr)); replace_neighbor_link_set(tmp_neigh, real_neigh); *************** *** 215,229 **** insert_mid_alias(const union olsr_ip_addr *main_add, const union olsr_ip_addr *alias, float vtime) { - struct mid_address *adr; struct neighbor_entry *ne_old, *ne_new; struct mid_entry *me_old; int ne_ref_rp_count; ! ! adr = olsr_malloc(sizeof(struct mid_address), "Insert MID alias"); ! OLSR_PRINTF(1, "Inserting alias %s for ", olsr_ip_to_string(alias)); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(main_add)); ! COPY_IP(&adr->alias, alias); adr->next_alias = NULL; --- 223,239 ---- insert_mid_alias(const union olsr_ip_addr *main_add, const union olsr_ip_addr *alias, float vtime) { struct neighbor_entry *ne_old, *ne_new; struct mid_entry *me_old; int ne_ref_rp_count; ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! struct mid_address *adr = olsr_malloc(sizeof(struct mid_address), "Insert MID alias"); ! OLSR_PRINTF(1, "Inserting alias %s for ", olsr_ip_to_string(&buf, alias)); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, main_add)); ! //COPY_IP(&adr->alias, alias); ! adr->alias = *alias; adr->next_alias = NULL; *************** *** 233,237 **** ne_old = olsr_lookup_neighbor_table_alias(alias); if (ne_old != NULL) { ! OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(alias), olsr_ip_to_string(main_add)); olsr_delete_neighbor_table(alias); ne_new = olsr_insert_neighbor_table(main_add); --- 243,247 ---- ne_old = olsr_lookup_neighbor_table_alias(alias); if (ne_old != NULL) { ! OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(&buf, alias), olsr_ip_to_string(&buf, main_add)); olsr_delete_neighbor_table(alias); ne_new = olsr_insert_neighbor_table(main_add); *************** *** 281,285 **** tmp_list = tmp_list->next) { ! if(COMP_IP(&tmp_list->alias, adr)) return &tmp_list->main_entry->main_addr; } --- 291,295 ---- tmp_list = tmp_list->next) { ! if(ipequal(&tmp_list->alias, adr)) return &tmp_list->main_entry->main_addr; } *************** *** 308,312 **** tmp_list = tmp_list->next) { ! if(COMP_IP(&tmp_list->main_addr, adr)) return tmp_list; } --- 318,322 ---- tmp_list = tmp_list->next) { ! if(ipequal(&tmp_list->main_addr, adr)) return tmp_list; } *************** *** 339,346 **** olsr_update_mid_table(const union olsr_ip_addr *adr, float vtime) { - struct mid_entry *tmp_list = mid_set; olsr_u32_t hash; ! OLSR_PRINTF(3, "MID: update %s\n", olsr_ip_to_string(adr)); hash = olsr_hashing(adr); --- 349,359 ---- olsr_update_mid_table(const union olsr_ip_addr *adr, float vtime) { olsr_u32_t hash; + #ifndef NODEBUG + struct ipaddr_str buf; + #endif + struct mid_entry *tmp_list = mid_set; ! OLSR_PRINTF(3, "MID: update %s\n", olsr_ip_to_string(&buf, adr)); hash = olsr_hashing(adr); *************** *** 351,357 **** { /*find match*/ ! 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); --- 364,370 ---- { /*find match*/ ! if(ipequal(&tmp_list->main_addr, adr)) { ! // printf("MID: Updating timer for node %s\n", olsr_ip_to_string(&buf, &tmp_list->main_addr)); tmp_list->ass_timer = GET_TIMESTAMP(vtime*1000); *************** *** 387,391 **** entry = entry->next) { ! if(COMP_IP(&entry->main_addr, m_addr)) break; } --- 400,404 ---- entry = entry->next) { ! if(ipequal(&entry->main_addr, m_addr)) break; } *************** *** 408,412 **** /* 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; --- 421,425 ---- /* Go through the list of declared aliases to find the matching current alias */ while(declared_aliases != 0 && ! ! ipequal(¤t_alias->alias, &declared_aliases->alias_addr)) { declared_aliases = declared_aliases->next; *************** *** 415,421 **** if (declared_aliases == NULL) { /* 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' */ --- 428,437 ---- if (declared_aliases == NULL) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif /* Current alias not found in list of declared aliases: free current alias */ ! OLSR_PRINTF(1, "MID remove: (%s, ", olsr_ip_to_string(&buf, &entry->main_addr)); ! OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&buf, ¤t_alias->alias)); /* Update linked list as seen by 'entry' */ *************** *** 468,476 **** if(TIMED_OUT(tmp_list->ass_timer)) { struct mid_entry *entry_to_delete = tmp_list; tmp_list = tmp_list->next; #ifdef DEBUG OLSR_PRINTF(1, "MID info for %s timed out.. deleting it\n", ! olsr_ip_to_string(&entry_to_delete->main_addr)); #endif /*Delete it*/ --- 484,495 ---- if(TIMED_OUT(tmp_list->ass_timer)) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif struct mid_entry *entry_to_delete = tmp_list; tmp_list = tmp_list->next; #ifdef DEBUG OLSR_PRINTF(1, "MID info for %s timed out.. deleting it\n", ! olsr_ip_to_string(&buf, &entry_to_delete->main_addr)); #endif /*Delete it*/ *************** *** 533,541 **** { struct mid_address *tmp_addr; ! ! OLSR_PRINTF(1, "%s: ", olsr_ip_to_string(&tmp_list->main_addr)); for(tmp_addr = tmp_list->aliases;tmp_addr;tmp_addr = tmp_addr->next_alias) { ! OLSR_PRINTF(1, " %s ", olsr_ip_to_string(&tmp_addr->alias)); } OLSR_PRINTF(1, "\n"); --- 552,562 ---- { struct mid_address *tmp_addr; ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "%s: ", olsr_ip_to_string(&buf, &tmp_list->main_addr)); for(tmp_addr = tmp_list->aliases;tmp_addr;tmp_addr = tmp_addr->next_alias) { ! OLSR_PRINTF(1, " %s ", olsr_ip_to_string(&buf, &tmp_addr->alias)); } OLSR_PRINTF(1, "\n"); Index: plugin_util.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_util.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** plugin_util.c 24 Oct 2007 13:45:00 -0000 1.7 --- plugin_util.c 8 Nov 2007 22:47:41 -0000 1.8 *************** *** 45,48 **** --- 45,50 ---- #include "defs.h" + #include + int set_plugin_port(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** net_olsr.c 5 Nov 2007 15:32:55 -0000 1.31 --- net_olsr.c 8 Nov 2007 22:47:41 -0000 1.32 *************** *** 207,211 **** */ olsr_u16_t ! net_output_pending(struct interface *ifp) { return ifp->netbuf.pending; --- 207,211 ---- */ olsr_u16_t ! net_output_pending(const struct interface *ifp) { return ifp->netbuf.pending; *************** *** 311,319 **** del_ptf(packet_transform_function f) { ! struct ptf *tmp_ptf, *prev; ! ! tmp_ptf = ptf_list; ! prev = NULL; ! while(tmp_ptf) { --- 311,316 ---- del_ptf(packet_transform_function f) { ! struct ptf *prev = NULL; ! struct ptf *tmp_ptf = ptf_list; while(tmp_ptf) { *************** *** 345,359 **** net_output(struct interface *ifp) { ! struct sockaddr_in *sin; ! struct sockaddr_in dst; ! struct sockaddr_in6 *sin6; ! struct sockaddr_in6 dst6; struct ptf *tmp_ptf_list; union olsr_packet *outmsg; int retval; - sin = NULL; - sin6 = NULL; - if(!ifp->netbuf.pending) return 0; --- 342,351 ---- net_output(struct interface *ifp) { ! struct sockaddr_in *sin = NULL; ! struct sockaddr_in6 *sin6 = NULL; struct ptf *tmp_ptf_list; union olsr_packet *outmsg; int retval; if(!ifp->netbuf.pending) return 0; *************** *** 371,374 **** --- 363,367 ---- if(olsr_cnf->ip_version == AF_INET) { + struct sockaddr_in dst; /* IP version 4 */ sin = (struct sockaddr_in *)&ifp->int_broadaddr; *************** *** 383,386 **** --- 376,380 ---- else { + struct sockaddr_in6 dst6; /* IP version 6 */ sin6 = (struct sockaddr_in6 *)&ifp->int6_multaddr; *************** *** 433,440 **** < 0) { perror("sendto(v6)"); olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv6 %m"); fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_index); ! fprintf(stderr, "To: %s (size: %d)\n", ip6_to_string(&sin6->sin6_addr), (int)sizeof(*sin6)); fprintf(stderr, "Outputsize: %d\n", ifp->netbuf.pending); retval = -1; --- 427,435 ---- < 0) { + struct ipaddr_str buf; perror("sendto(v6)"); olsr_syslog(OLSR_LOG_ERR, "OLSR: sendto IPv6 %m"); fprintf(stderr, "Socket: %d interface: %d\n", ifp->olsr_socket, ifp->if_index); ! fprintf(stderr, "To: %s (size: %u)\n", ip6_to_string(&buf, &sin6->sin6_addr), (unsigned int)sizeof(*sin6)); fprintf(stderr, "Outputsize: %d\n", ifp->netbuf.pending); retval = -1; *************** *** 455,459 **** /** ! * Create a IPv6 netmask based on a prefix length * * @param allocated address to build the netmask in --- 450,454 ---- /** ! * Create a IPv4 or IPv6 netmask based on a prefix length * * @param allocated address to build the netmask in *************** *** 465,488 **** olsr_prefix_to_netmask(union olsr_ip_addr *adr, const olsr_u16_t prefix) { int p; olsr_u8_t *a; ! if(adr == NULL) { return 0; } a = adr->v6.s6_addr; ! for (p = prefix; p > 8; p -= 8) { *a++ = 0xff; } ! *a++ = 0xff << p; ! while (a < adr->v6.s6_addr+olsr_cnf->ipsize) { *a++ = 0; } #ifdef DEBUG ! OLSR_PRINTF(3, "Prefix %d = Netmask: %s\n", prefix, olsr_ip_to_string(adr)); #endif - return 1; } --- 460,486 ---- olsr_prefix_to_netmask(union olsr_ip_addr *adr, const olsr_u16_t prefix) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif int p; + const olsr_u8_t * const a_end = adr->v6.s6_addr+olsr_cnf->ipsize; olsr_u8_t *a; ! if (adr == NULL) { return 0; } a = adr->v6.s6_addr; ! for (p = prefix; a < a_end && p > 8; p -= 8) { *a++ = 0xff; } ! *a++ = 0xff << (8 - p); ! while (a < a_end) { *a++ = 0; } #ifdef DEBUG ! OLSR_PRINTF(3, "Prefix %d = Netmask: %s\n", prefix, olsr_ip_to_string(&buf, adr)); #endif return 1; } *************** *** 500,516 **** olsr_netmask_to_prefix(const union olsr_ip_addr *adr) { olsr_u16_t prefix = 0; - unsigned int i; olsr_u8_t tmp; ! for (i = 0; i < olsr_cnf->ipsize && adr->v6.s6_addr[i] == 0xff; i++) { prefix += 8; } ! for (tmp = adr->v6.s6_addr[i]; tmp > 0; tmp <<= 1) { prefix++; } #ifdef DEBUG ! OLSR_PRINTF(3, "Netmask: %s = Prefix %d\n", olsr_ip_to_string(adr), prefix); #endif --- 498,518 ---- olsr_netmask_to_prefix(const union olsr_ip_addr *adr) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif olsr_u16_t prefix = 0; olsr_u8_t tmp; + const olsr_u8_t * const a_end = adr->v6.s6_addr+olsr_cnf->ipsize; + const olsr_u8_t *a; ! for (a = adr->v6.s6_addr; a < a_end && *a == 0xff; a++) { prefix += 8; } ! for (tmp = *a; tmp > 0; tmp <<= 1) { prefix++; } #ifdef DEBUG ! OLSR_PRINTF(3, "Netmask: %s = Prefix %d\n", olsr_ip_to_string(&buf, adr), prefix); #endif *************** *** 518,557 **** } - /** *Converts a sockaddr struct to a string representing *the IP address from the sockaddr struct * - *NON REENTRANT!!!! - * *@param address_to_convert the sockaddr struct to "convert" *@return a char pointer to the string containing the IP */ ! char * ! sockaddr_to_string(const struct sockaddr *address_to_convert) { ! const struct sockaddr_in *address = (const struct sockaddr_in *)address_to_convert; ! return inet_ntoa(address->sin_addr); ! } - /** *Converts the 32bit olsr_u32_t datatype to *a char array. * - *NON REENTRANT!!!! - * *@param address the olsr_u32_t to "convert" *@return a char pointer to the string containing the IP */ - const char * ! ip_to_string(const olsr_u32_t *address) { ! struct in_addr in; ! in.s_addr=*address; ! return inet_ntoa(in); ! } --- 520,548 ---- } /** *Converts a sockaddr struct to a string representing *the IP address from the sockaddr struct * *@param address_to_convert the sockaddr struct to "convert" *@return a char pointer to the string containing the IP */ ! const char * ! sockaddr_to_string(struct ipaddr_str * const buf, const struct sockaddr * const addr) { ! const struct sockaddr_in * const addr4 = (const struct sockaddr_in *)addr; ! return ip4_to_string(buf, addr4->sin_addr); } /** *Converts the 32bit olsr_u32_t datatype to *a char array. * *@param address the olsr_u32_t to "convert" *@return a char pointer to the string containing the IP */ const char * ! ip4_to_string(struct ipaddr_str * const buf, const struct in_addr addr4) { ! return inet_ntop(AF_INET, &addr4, buf->buf, sizeof(buf->buf)); } *************** *** 560,596 **** *a char array. * - *NON REENTRANT - * *@param addr6 the address to "convert" *@return a char pointer to the string containing the IP */ - const char * ! ip6_to_string(const struct in6_addr *addr6) { ! static char ipv6_buf[INET6_ADDRSTRLEN]; /* for address coversion */ ! return inet_ntop(AF_INET6, addr6, ipv6_buf, sizeof(ipv6_buf)); } const char * ! olsr_ip_to_string(const union olsr_ip_addr *addr) { ! static int idx = 0; ! static char buff[4][MAX(INET6_ADDRSTRLEN,INET_ADDRSTRLEN)]; ! const char *ret; ! ! if (!addr) { ! return "null"; ! } ! ! if(olsr_cnf->ip_version == AF_INET) { ! ret = inet_ntop(AF_INET, &addr->v4, buff[idx], sizeof(buff[idx])); ! } else { ! /* IPv6 */ ! ret = inet_ntop(AF_INET6, &addr->v6, buff[idx], sizeof(buff[idx])); ! } ! idx = (idx + 1) & 3; ! ! return ret; } --- 551,572 ---- *a char array. * *@param addr6 the address to "convert" *@return a char pointer to the string containing the IP */ const char * ! ip6_to_string(struct ipaddr_str * const buf, const struct in6_addr * const addr6) { ! return inet_ntop(AF_INET6, addr6, buf->buf, sizeof(buf->buf)); } const char * ! olsr_ip_to_string(struct ipaddr_str * const buf, const union olsr_ip_addr *addr) { ! #if 0 ! if (!addr) { ! return "null"; ! } ! #endif ! return inet_ntop(olsr_cnf->ip_version, addr, buf->buf, sizeof(buf->buf)); } *************** *** 629,672 **** olsr_add_invalid_address(const union olsr_ip_addr *adr) { ! struct deny_address_entry *new_entry; ! ! new_entry = olsr_malloc(sizeof(struct deny_address_entry), "Add deny address"); new_entry->next = deny_entries; - COPY_IP(&new_entry->addr, adr); - deny_entries = new_entry; ! ! OLSR_PRINTF(1, "Added %s to IP deny set\n", olsr_ip_to_string(&new_entry->addr)); ! return; } ! /** ! *Converts the 32bit olsr_u32_t datatype to ! *a char array. ! * ! *NON REENTRANT ! * ! *@param addr6 the address to "convert" ! *@return a char pointer to the string containing the IP ! */ olsr_bool olsr_validate_address(const union olsr_ip_addr *adr) { ! const struct deny_address_entry *deny_entry = deny_entries; ! while (deny_entry) { ! if (COMP_IP(adr, &deny_entry->addr)) { ! OLSR_PRINTF(1, "Validation of address %s failed!\n", ! olsr_ip_to_string(adr)); return OLSR_FALSE; } - - deny_entry = deny_entry->next; } - return OLSR_TRUE; } /* * Local Variables: --- 605,645 ---- olsr_add_invalid_address(const union olsr_ip_addr *adr) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! struct deny_address_entry *new_entry = olsr_malloc(sizeof(struct deny_address_entry), "Add deny address"); + new_entry->addr = *adr; new_entry->next = deny_entries; deny_entries = new_entry; ! OLSR_PRINTF(1, "Added %s to IP deny set\n", olsr_ip_to_string(&buf, &new_entry->addr)); } ! olsr_bool olsr_validate_address(const union olsr_ip_addr *adr) { ! const struct deny_address_entry *deny_entry; ! for (deny_entry = deny_entries; deny_entry != NULL; deny_entry = deny_entry->next) { ! if(ipequal(adr, &deny_entry->addr)) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "Validation of address %s failed!\n", olsr_ip_to_string(&buf, adr)); return OLSR_FALSE; } } return OLSR_TRUE; } + + int ipcmp(const union olsr_ip_addr * const a, const union olsr_ip_addr * const b) + { + return olsr_cnf->ip_version == AF_INET + ? ip4cmp(&a->v4, &b->v4) + : ip6cmp(&a->v6, &b->v6); + } + /* * Local Variables: Index: build_msg.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** build_msg.c 5 Nov 2007 15:32:55 -0000 1.37 --- build_msg.c 8 Nov 2007 22:47:41 -0000 1.38 *************** *** 46,49 **** --- 46,50 ---- #include "local_hna_set.h" #include "mantissa.h" + #include "net_olsr.h" #define BMSG_DBGLVL 5 *************** *** 298,302 **** m->v4.olsr_msgtype = HELLO_MESSAGE; /* Set source(main) addr */ ! COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); m->v4.olsr_vtime = ifp->valtimes.hello; --- 299,304 ---- m->v4.olsr_msgtype = HELLO_MESSAGE; /* Set source(main) addr */ ! //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); ! m->v4.originator = olsr_cnf->main_addr.v4.s_addr; m->v4.olsr_vtime = ifp->valtimes.hello; *************** *** 320,323 **** --- 322,328 ---- for(j = 0; j <= MAX_LINK; j++) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif /* HYSTERESIS - Not adding neighbors with link type HIDE */ *************** *** 335,341 **** #ifdef DEBUG ! OLSR_PRINTF(BMSG_DBGLVL, "\t%s - ", olsr_ip_to_string(&nb->address)); OLSR_PRINTF(BMSG_DBGLVL, "L:%d N:%d\n", j, i); ! #endif /* * If there is not enough room left --- 340,346 ---- #ifdef DEBUG ! OLSR_PRINTF(BMSG_DBGLVL, "\t%s - ", olsr_ip_to_string(&buf, &nb->address)); OLSR_PRINTF(BMSG_DBGLVL, "L:%d N:%d\n", j, i); ! #endif /* * If there is not enough room left *************** *** 391,395 **** } ! COPY_IP(haddr, &nb->address); /* Point to next address */ --- 396,401 ---- } ! //COPY_IP(haddr, &nb->address); ! *haddr = nb->address; /* Point to next address */ *************** *** 469,473 **** m->v6.hopcnt = 0; /* Set source(main) addr */ ! COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); m->v6.olsr_msgtype = HELLO_MESSAGE; --- 475,480 ---- m->v6.hopcnt = 0; /* Set source(main) addr */ ! //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); ! m->v6.originator = olsr_cnf->main_addr.v6; m->v6.olsr_msgtype = HELLO_MESSAGE; *************** *** 488,491 **** --- 495,501 ---- for(j = 0; j <= MAX_LINK; j++) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif first_entry = OLSR_TRUE; *************** *** 499,505 **** #ifdef DEBUG ! OLSR_PRINTF(BMSG_DBGLVL, "\t%s - ", olsr_ip_to_string(&nb->address)); OLSR_PRINTF(BMSG_DBGLVL, "L:%d N:%d\n", j, i); ! #endif --- 509,515 ---- #ifdef DEBUG ! OLSR_PRINTF(BMSG_DBGLVL, "\t%s - ", olsr_ip_to_string(&buf, &nb->address)); OLSR_PRINTF(BMSG_DBGLVL, "L:%d N:%d\n", j, i); ! #endif *************** *** 556,560 **** } ! COPY_IP(haddr, &nb->address); /* Point to next address */ --- 566,571 ---- } ! //COPY_IP(haddr, &nb->address); ! *haddr = nb->address; /* Point to next address */ *************** *** 600,604 **** serialize_tc4(struct tc_message *message, struct interface *ifp) { ! olsr_u16_t remainsize, curr_size; struct tc_mpr_addr *mprs; --- 611,617 ---- serialize_tc4(struct tc_message *message, struct interface *ifp) { ! #if !defined(NODEBUG) && defined(DEBUG) ! struct ipaddr_str buf; ! #endif olsr_u16_t remainsize, curr_size; struct tc_mpr_addr *mprs; *************** *** 634,638 **** m->v4.hopcnt = message->hop_count; m->v4.ttl = message->ttl; ! COPY_IP(&m->v4.originator, &message->originator); /* Fill TC header */ --- 647,652 ---- m->v4.hopcnt = message->hop_count; m->v4.ttl = message->ttl; ! //COPY_IP(&m->v4.originator, &message->originator); ! m->v4.originator = message->originator.v4.s_addr; /* Fill TC header */ *************** *** 675,682 **** #ifdef DEBUG OLSR_PRINTF(BMSG_DBGLVL, "\t%s\n", ! olsr_ip_to_string(&mprs->address)); #endif ! COPY_IP(&mprsaddr->addr, &mprs->address); ! curr_size += olsr_cnf->ipsize; mprsaddr++; --- 689,696 ---- #ifdef DEBUG OLSR_PRINTF(BMSG_DBGLVL, "\t%s\n", ! olsr_ip_to_string(&buf, &mprs->address)); #endif ! //COPY_IP(&mprsaddr->addr, &mprs->address); ! mprsaddr->addr = mprs->address.v4.s_addr; curr_size += olsr_cnf->ipsize; mprsaddr++; *************** *** 726,730 **** serialize_tc6(struct tc_message *message, struct interface *ifp) { ! olsr_u16_t remainsize, curr_size; struct tc_mpr_addr *mprs; --- 740,746 ---- serialize_tc6(struct tc_message *message, struct interface *ifp) { ! #if !defined(NODEBUG) && defined(DEBUG) ! struct ipaddr_str buf; ! #endif olsr_u16_t remainsize, curr_size; struct tc_mpr_addr *mprs; *************** *** 759,763 **** m->v6.hopcnt = message->hop_count; m->v6.ttl = message->ttl; ! COPY_IP(&m->v6.originator, &message->originator); /* Fill TC header */ --- 775,780 ---- m->v6.hopcnt = message->hop_count; m->v6.ttl = message->ttl; ! //COPY_IP(&m->v6.originator, &message->originator); ! m->v6.originator = message->originator.v6; /* Fill TC header */ *************** *** 796,802 **** #ifdef DEBUG OLSR_PRINTF(BMSG_DBGLVL, "\t%s\n", ! olsr_ip_to_string(&mprs->address)); #endif ! COPY_IP(&mprsaddr6->addr, &mprs->address); curr_size += olsr_cnf->ipsize; --- 813,820 ---- #ifdef DEBUG OLSR_PRINTF(BMSG_DBGLVL, "\t%s\n", ! olsr_ip_to_string(&buf, &mprs->address)); #endif ! //COPY_IP(&mprsaddr6->addr, &mprs->address); ! mprsaddr6->addr = mprs->address.v6; curr_size += olsr_cnf->ipsize; *************** *** 872,876 **** m->v4.ttl = MAX_TTL; /* Set main(first) address */ ! COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); m->v4.olsr_msgtype = MID_MESSAGE; m->v4.olsr_vtime = ifp->valtimes.mid; --- 890,895 ---- m->v4.ttl = MAX_TTL; /* Set main(first) address */ ! //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); ! m->v4.originator = olsr_cnf->main_addr.v4.s_addr; m->v4.olsr_msgtype = MID_MESSAGE; m->v4.olsr_vtime = ifp->valtimes.mid; *************** *** 881,886 **** for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next) { ! if(!COMP_IP(&olsr_cnf->main_addr, &ifs->ip_addr)) { if((curr_size + olsr_cnf->ipsize) > remainsize) --- 900,908 ---- for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next) { ! if(!ipequal(&olsr_cnf->main_addr, &ifs->ip_addr)) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif if((curr_size + olsr_cnf->ipsize) > remainsize) *************** *** 906,914 **** #ifdef DEBUG OLSR_PRINTF(BMSG_DBGLVL, "\t%s(%s)\n", ! olsr_ip_to_string(&ifs->ip_addr), ifs->int_name); #endif ! COPY_IP(&addrs->addr, &ifs->ip_addr); addrs++; curr_size += olsr_cnf->ipsize; --- 928,937 ---- #ifdef DEBUG OLSR_PRINTF(BMSG_DBGLVL, "\t%s(%s)\n", ! olsr_ip_to_string(&buf, &ifs->ip_addr), ifs->int_name); #endif ! //COPY_IP(&addrs->addr, &ifs->ip_addr); ! addrs->addr = ifs->ip_addr.v4.s_addr; addrs++; curr_size += olsr_cnf->ipsize; *************** *** 973,978 **** m->v6.olsr_vtime = ifp->valtimes.mid; /* Set main(first) address */ ! COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); ! addrs6 = m->v6.message.mid.mid_addr; --- 996,1001 ---- m->v6.olsr_vtime = ifp->valtimes.mid; /* Set main(first) address */ ! //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); ! m->v6.originator = olsr_cnf->main_addr.v6; addrs6 = m->v6.message.mid.mid_addr; *************** *** 981,986 **** for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next) { ! if(!COMP_IP(&olsr_cnf->main_addr, &ifs->ip_addr)) { if((curr_size + olsr_cnf->ipsize) > remainsize) { --- 1004,1012 ---- for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next) { ! if(!ipequal(&olsr_cnf->main_addr, &ifs->ip_addr)) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif if((curr_size + olsr_cnf->ipsize) > remainsize) { *************** *** 1005,1013 **** #ifdef DEBUG OLSR_PRINTF(BMSG_DBGLVL, "\t%s(%s)\n", ! olsr_ip_to_string(&ifs->ip_addr), ifs->int_name); #endif ! COPY_IP(&addrs6->addr, &ifs->ip_addr); addrs6++; curr_size += olsr_cnf->ipsize; --- 1031,1040 ---- #ifdef DEBUG OLSR_PRINTF(BMSG_DBGLVL, "\t%s(%s)\n", ! olsr_ip_to_string(&buf, &ifs->ip_addr), ifs->int_name); #endif ! //COPY_IP(&addrs6->addr, &ifs->ip_addr); ! addrs6->addr = ifs->ip_addr.v6; addrs6++; curr_size += olsr_cnf->ipsize; *************** *** 1063,1067 **** /* Fill header */ ! COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); m->v4.hopcnt = 0; m->v4.ttl = MAX_TTL; --- 1090,1095 ---- /* Fill header */ ! //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); ! m->v4.originator = olsr_cnf->main_addr.v4.s_addr; m->v4.hopcnt = 0; m->v4.ttl = MAX_TTL; *************** *** 1096,1102 **** OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net)); #endif ! COPY_IP(&pair->addr, &h->net.prefix); olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! pair->addr = ip_addr.v4; pair++; curr_size += (2 * olsr_cnf->ipsize); --- 1124,1132 ---- OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net)); #endif ! //COPY_IP(&pair->addr, &h->net); ! pair->addr = h->net.prefix.v4.s_addr; ! //COPY_IP(&pair->netmask, &h->netmask); olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! pair->netmask = ip_addr.v4.s_addr; pair++; curr_size += (2 * olsr_cnf->ipsize); *************** *** 1114,1120 **** - - - /** *IP version 6 --- 1144,1147 ---- *************** *** 1153,1157 **** /* Fill header */ ! COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); m->v6.hopcnt = 0; m->v6.ttl = MAX_TTL; --- 1180,1185 ---- /* Fill header */ ! //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); ! m->v6.originator = olsr_cnf->main_addr.v6; m->v6.hopcnt = 0; m->v6.ttl = MAX_TTL; *************** *** 1185,1191 **** OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net)); #endif ! COPY_IP(&pair6->addr, &h->net.prefix); olsr_prefix_to_netmask(&tmp_netmask, h->net.prefix_len); ! COPY_IP(&pair6->netmask, &tmp_netmask); pair6++; curr_size += (2 * olsr_cnf->ipsize); --- 1213,1221 ---- OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net)); #endif ! //COPY_IP(&pair6->addr, &h->net); ! pair6->addr = h->net.prefix.v6; ! //COPY_IP(&pair6->netmask, &tmp_netmask); olsr_prefix_to_netmask(&tmp_netmask, h->net.prefix_len); ! pair6->netmask = tmp_netmask.v6; pair6++; curr_size += (2 * olsr_cnf->ipsize); Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** routing_table.c 16 Oct 2007 09:54:43 -0000 1.32 --- routing_table.c 8 Nov 2007 22:47:41 -0000 1.33 *************** *** 51,55 **** #include "lq_avl.h" #include "lq_route.h" ! #include "assert.h" struct avl_tree routingtree; --- 51,57 ---- #include "lq_avl.h" #include "lq_route.h" ! #include "net_olsr.h" ! ! #include struct avl_tree routingtree; *************** *** 81,96 **** */ int ! avl_comp_ipv4_prefix (void *prefix1, void *prefix2) { ! struct olsr_ip_prefix *pfx1, *pfx2; ! ! pfx1 = prefix1; ! pfx2 = prefix2; /* prefix */ ! if (pfx1->prefix.v4 < pfx2->prefix.v4) { return -1; } ! if (pfx1->prefix.v4 > pfx2->prefix.v4) { return +1; } --- 83,96 ---- */ int ! avl_comp_ipv4_prefix (const void *prefix1, const void *prefix2) { ! const struct olsr_ip_prefix *pfx1 = prefix1; ! const struct olsr_ip_prefix *pfx2 = prefix2; /* prefix */ ! if (pfx1->prefix.v4.s_addr < pfx2->prefix.v4.s_addr) { return -1; } ! if (pfx1->prefix.v4.s_addr > pfx2->prefix.v4.s_addr) { return +1; } *************** *** 118,128 **** */ int ! avl_comp_ipv6_prefix (void *prefix1, void *prefix2) { - struct olsr_ip_prefix *pfx1, *pfx2; int res; ! ! pfx1 = prefix1; ! pfx2 = prefix2; /* prefix */ --- 118,126 ---- */ int ! avl_comp_ipv6_prefix (const void *prefix1, const void *prefix2) { int res; ! const struct olsr_ip_prefix *pfx1 = prefix1; ! const struct olsr_ip_prefix *pfx2 = prefix2; /* prefix */ *************** *** 174,178 **** struct olsr_ip_prefix prefix; ! COPY_IP(&prefix, dst); prefix.prefix_len = olsr_cnf->maxplen; --- 172,176 ---- struct olsr_ip_prefix prefix; ! prefix.prefix = *dst; prefix.prefix_len = olsr_cnf->maxplen; *************** *** 261,265 **** memset(rtp, 0, sizeof(struct rt_path)); ! COPY_IP(&rtp->rtp_originator, originator); /* set key and backpointer prior to tree insertion */ --- 259,264 ---- memset(rtp, 0, sizeof(struct rt_path)); ! //COPY_IP(&rtp->rtp_originator, originator); ! rtp->rtp_originator = *originator; /* set key and backpointer prior to tree insertion */ *************** *** 282,286 **** olsr_nh_change(struct rt_nexthop *nh1, struct rt_nexthop *nh2) { ! if ((!COMP_IP(&nh1->gateway, &nh2->gateway)) || (nh1->iif_index != nh2->iif_index)) { return OLSR_TRUE; --- 281,285 ---- olsr_nh_change(struct rt_nexthop *nh1, struct rt_nexthop *nh2) { ! if (!ipequal(&nh1->gateway, &nh2->gateway) || (nh1->iif_index != nh2->iif_index)) { return OLSR_TRUE; *************** *** 362,368 **** node = avl_walk_first(&rt->rt_path_tree); ! if (!node) { ! assert(0); /* should not happen */ ! } rt->rt_best = node->data; --- 361,365 ---- node = avl_walk_first(&rt->rt_path_tree); ! assert(node != 0); /* should not happen */ rt->rt_best = node->data; *************** *** 472,481 **** { static char buff[128]; snprintf(buff, sizeof(buff), "%s/%u via %s", ! olsr_ip_to_string(&rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&rt->rt_nexthop.gateway)); return buff; --- 469,479 ---- { static char buff[128]; + struct ipaddr_str prefixstr, gwstr; snprintf(buff, sizeof(buff), "%s/%u via %s", ! olsr_ip_to_string(&prefixstr, &rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&gwstr, &rt->rt_nexthop.gateway)); return buff; *************** *** 488,503 **** olsr_rtp_to_string(struct rt_path *rtp) { - struct rt_entry *rt; static char buff[128]; ! ! rt = rtp->rtp_rt; snprintf(buff, sizeof(buff), "%s/%u from %s via %s, " "etx %.3f, metric %u, v %u", ! olsr_ip_to_string(&rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&rtp->rtp_originator), ! olsr_ip_to_string(&rtp->rtp_nexthop.gateway), rtp->rtp_metric.etx, rtp->rtp_metric.hops, --- 486,500 ---- olsr_rtp_to_string(struct rt_path *rtp) { static char buff[128]; ! struct ipaddr_str prefixstr, origstr, gwstr; ! struct rt_entry *rt = rtp->rtp_rt; snprintf(buff, sizeof(buff), "%s/%u from %s via %s, " "etx %.3f, metric %u, v %u", ! olsr_ip_to_string(&prefixstr, &rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&origstr, &rtp->rtp_originator), ! olsr_ip_to_string(&gwstr, &rtp->rtp_nexthop.gateway), rtp->rtp_metric.etx, rtp->rtp_metric.hops, *************** *** 563,570 **** olsr_print_routing_table(struct avl_tree *tree) { ! struct rt_entry *rt; ! struct rt_path *rtp; ! ! struct avl_node *rt_tree_node, *rtp_tree_node; printf("ROUTING TABLE\n"); --- 560,564 ---- olsr_print_routing_table(struct avl_tree *tree) { ! struct avl_node *rt_tree_node; printf("ROUTING TABLE\n"); *************** *** 573,585 **** rt_tree_node; rt_tree_node = avl_walk_next(rt_tree_node)) { ! ! rt = rt_tree_node->data; /* first the route entry */ printf("%s/%u, via %s, best-originator %s\n", ! olsr_ip_to_string(&rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&rt->rt_nexthop.gateway), ! olsr_ip_to_string(&rt->rt_best->rtp_originator)); /* walk the per-originator path tree of routes */ --- 567,580 ---- rt_tree_node; rt_tree_node = avl_walk_next(rt_tree_node)) { ! struct avl_node *rtp_tree_node; ! struct ipaddr_str prefixstr, origstr, gwstr; ! struct rt_entry * const rt = rt_tree_node->data; /* first the route entry */ printf("%s/%u, via %s, best-originator %s\n", ! olsr_ip_to_string(&prefixstr, &rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&origstr, &rt->rt_nexthop.gateway), ! olsr_ip_to_string(&gwstr, &rt->rt_best->rtp_originator)); /* walk the per-originator path tree of routes */ *************** *** 588,601 **** rtp_tree_node = avl_walk_next(rtp_tree_node)) { ! rtp = rtp_tree_node->data; ! printf("\tfrom %s, etx %.3f, metric %u, via %s, %s, v %u\n", ! olsr_ip_to_string(&rtp->rtp_originator), rtp->rtp_metric.etx, rtp->rtp_metric.hops, ! olsr_ip_to_string(&rtp->rtp_nexthop.gateway), if_ifwithindex_name(rt->rt_nexthop.iif_index), ! rtp->rtp_version); ! } } --- 583,594 ---- rtp_tree_node = avl_walk_next(rtp_tree_node)) { ! const struct rt_path * const rtp = rtp_tree_node->data; printf("\tfrom %s, etx %.3f, metric %u, via %s, %s, v %u\n", ! olsr_ip_to_string(&origstr, &rtp->rtp_originator), rtp->rtp_metric.etx, rtp->rtp_metric.hops, ! olsr_ip_to_string(&gwstr, &rtp->rtp_nexthop.gateway), if_ifwithindex_name(rt->rt_nexthop.iif_index), ! rtp->rtp_version); } } Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ipc_frontend.c 5 Nov 2007 15:32:55 -0000 1.37 --- ipc_frontend.c 8 Nov 2007 22:47:41 -0000 1.38 *************** *** 54,57 **** --- 54,58 ---- #include "socket_parser.h" #include "local_hna_set.h" + #include "net_olsr.h" #ifdef WIN32 *************** *** 177,186 **** olsr_bool ! ipc_check_allowed_ip(union olsr_ip_addr *addr) { struct ipc_host *ipch = olsr_cnf->ipc_hosts; struct ipc_net *ipcn = olsr_cnf->ipc_nets; ! if(addr->v4 == ntohl(INADDR_LOOPBACK)) return OLSR_TRUE; --- 178,187 ---- olsr_bool ! ipc_check_allowed_ip(const union olsr_ip_addr *addr) { struct ipc_host *ipch = olsr_cnf->ipc_hosts; struct ipc_net *ipcn = olsr_cnf->ipc_nets; ! if(addr->v4.s_addr == ntohl(INADDR_LOOPBACK)) return OLSR_TRUE; *************** *** 188,192 **** while(ipch) { ! if(addr->v4 == ipch->host.v4) return OLSR_TRUE; ipch = ipch->next; --- 189,193 ---- while(ipch) { ! if(ipequal(addr, &ipch->host)) return OLSR_TRUE; ipch = ipch->next; *************** *** 196,200 **** while(ipcn) { ! if((addr->v4 & ipcn->mask.v4) == (ipcn->net.v4 & ipcn->mask.v4)) return OLSR_TRUE; ipcn = ipcn->next; --- 197,201 ---- while(ipcn) { ! if((addr->v4.s_addr & ipcn->mask.v4.s_addr) == (ipcn->net.v4.s_addr & ipcn->mask.v4.s_addr)) return OLSR_TRUE; ipcn = ipcn->next; *************** *** 218,222 **** { char buf[MAXPACKETSIZE+1]; ! struct olsr olsr; } inbuf; --- 219,223 ---- { char buf[MAXPACKETSIZE+1]; ! struct olsr olsr; } inbuf; *************** *** 271,276 **** */ int ! ipc_route_send_rtentry(union olsr_ip_addr *dst, union olsr_ip_addr *gw, ! int met, int add, const char *int_name) { struct ipcmsg packet; --- 272,280 ---- */ int ! ipc_route_send_rtentry(union olsr_ip_addr *dst, ! union olsr_ip_addr *gw, ! int met, ! int add, ! const char *int_name) { struct ipcmsg packet; *************** *** 288,292 **** packet.msgtype = ROUTE_IPC; ! COPY_IP(&packet.target_addr, dst); packet.add = add; --- 292,297 ---- packet.msgtype = ROUTE_IPC; ! //COPY_IP(&packet.target_addr, dst); ! packet.target_addr = *dst; packet.add = add; *************** *** 294,298 **** { packet.metric = met; ! COPY_IP(&packet.gateway_addr, gw); } --- 299,304 ---- { packet.metric = met; ! //COPY_IP(&packet.gateway_addr, gw); ! packet.gateway_addr = *gw; } *************** *** 352,361 **** packet.msgtype = ROUTE_IPC; ! COPY_IP(&packet.target_addr, &rt->rt_dst.prefix); ! packet.add = 1; packet.metric = (olsr_u8_t)(rt->rt_best->rtp_metric.hops); ! COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway); memcpy(&packet.device[0], if_ifwithindex_name(rt->rt_nexthop.iif_index), 4); --- 358,369 ---- packet.msgtype = ROUTE_IPC; ! //COPY_IP(&packet.target_addr, &rt->rt_dst.prefix); ! packet.target_addr = rt->rt_dst.prefix; ! packet.add = 1; packet.metric = (olsr_u8_t)(rt->rt_best->rtp_metric.hops); ! //COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway); ! packet.gateway_addr = rt->rt_nexthop.gateway; memcpy(&packet.device[0], if_ifwithindex_name(rt->rt_nexthop.iif_index), 4); *************** *** 423,428 **** /* Main addr */ ! COPY_IP(&net_msg->main_addr, &olsr_cnf->main_addr); ! /* --- 431,436 ---- /* Main addr */ ! //COPY_IP(&net_msg->main_addr, &olsr_cnf->main_addr); ! net_msg->main_addr = olsr_cnf->main_addr; /* Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** main.c 3 Nov 2007 23:21:27 -0000 1.101 --- main.c 8 Nov 2007 22:47:41 -0000 1.102 *************** *** 55,58 **** --- 55,59 ---- #include "net_os.h" #include "build_msg.h" + #include "net_olsr.h" #if LINUX_POLICY_ROUTING *************** *** 110,114 **** char conf_file_name[FILENAME_MAX]; struct tms tms_buf; ! #ifdef WIN32 WSADATA WsaData; --- 111,117 ---- char conf_file_name[FILENAME_MAX]; struct tms tms_buf; ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif #ifdef WIN32 WSADATA WsaData; *************** *** 149,157 **** /* Get initial timestep */ ! nowtm = NULL; ! while (nowtm == NULL) ! { ! nowtm = localtime((time_t *)&now.tv_sec); ! } printf("\n *** %s ***\n Build date: %s on %s\n http://www.olsr.org\n\n", --- 152,158 ---- /* Get initial timestep */ ! do { ! nowtm = localtime(&now.tv_sec); ! } while (nowtm == NULL); printf("\n *** %s ***\n Build date: %s on %s\n http://www.olsr.org\n\n", *************** *** 398,402 **** olsr_load_plugins(); ! OLSR_PRINTF(1, "Main address: %s\n\n", olsr_ip_to_string(&olsr_cnf->main_addr)); /* Start syslog entry */ --- 399,403 ---- olsr_load_plugins(); ! OLSR_PRINTF(1, "Main address: %s\n\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); /* Start syslog entry */ *************** *** 414,419 **** #else signal(SIGHUP, olsr_reconfigure); ! signal(SIGINT, olsr_shutdown); ! signal(SIGTERM, olsr_shutdown); signal(SIGPIPE, SIG_IGN); #endif --- 415,424 ---- #else signal(SIGHUP, olsr_reconfigure); ! signal(SIGINT, olsr_shutdown); ! signal(SIGQUIT, olsr_shutdown); ! signal(SIGILL, olsr_shutdown); ! signal(SIGABRT, olsr_shutdown); ! signal(SIGSEGV, olsr_shutdown); ! signal(SIGTERM, olsr_shutdown); signal(SIGPIPE, SIG_IGN); #endif *************** *** 467,471 **** #else static void ! olsr_shutdown(int signal) #endif { --- 472,476 ---- #else static void ! olsr_shutdown(int signal __attribute__((unused))) #endif { Index: olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** olsr.c 16 Oct 2007 10:01:29 -0000 1.60 --- olsr.c 8 Nov 2007 22:47:41 -0000 1.61 *************** *** 62,65 **** --- 62,66 ---- #include "lq_packet.h" #include "lq_avl.h" + #include "net_olsr.h" #include *************** *** 333,337 **** { #ifdef DEBUG ! OLSR_PRINTF(5, "Forward - sender %s not MPR selector\n", olsr_ip_to_string(src)); #endif return 0; --- 334,341 ---- { #ifdef DEBUG ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(5, "Forward - sender %s not MPR selector\n", olsr_ip_to_string(&buf, src)); #endif return 0; Index: routing_table.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** routing_table.h 16 Oct 2007 09:54:43 -0000 1.23 --- routing_table.h 8 Nov 2007 22:47:41 -0000 1.24 *************** *** 150,155 **** unsigned int olsr_bump_routingtree_version(void); ! int avl_comp_ipv4_prefix (void *, void *); ! int avl_comp_ipv6_prefix (void *, void *); void olsr_rt_best(struct rt_entry *); --- 150,155 ---- unsigned int olsr_bump_routingtree_version(void); ! int avl_comp_ipv4_prefix (const void *, const void *); ! int avl_comp_ipv6_prefix (const void *, const void *); void olsr_rt_best(struct rt_entry *); Index: interfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** interfaces.c 13 Oct 2007 12:09:11 -0000 1.35 --- interfaces.c 8 Nov 2007 22:47:41 -0000 1.36 *************** *** 45,48 **** --- 45,49 ---- #include "scheduler.h" #include "olsr.h" + #include "net_olsr.h" static olsr_u32_t if_property_id; *************** *** 227,231 **** struct interface * ! if_ifwithaddr(const union olsr_ip_addr * const addr) { struct interface *ifp; --- 228,232 ---- struct interface * ! if_ifwithaddr(const union olsr_ip_addr *addr) { struct interface *ifp; *************** *** 242,246 **** //printf("%s\n", olsr_ip_to_string(addr)); ! if (COMP_IP(&((struct sockaddr_in *)&ifp->int_addr)->sin_addr, addr)) return ifp; } --- 243,247 ---- //printf("%s\n", olsr_ip_to_string(addr)); ! if (((struct sockaddr_in *)&ifp->int_addr)->sin_addr.s_addr == addr->v4.s_addr) return ifp; } *************** *** 250,254 **** //printf("Checking %s ", olsr_ip_to_string((union olsr_ip_addr *)&ifp->int6_addr.sin6_addr)); //printf("== %s\n", olsr_ip_to_string((union olsr_ip_addr *)&((struct sockaddr_in6 *)addr)->sin6_addr)); ! if (COMP_IP(&ifp->int6_addr.sin6_addr, addr)) return ifp; } --- 251,255 ---- //printf("Checking %s ", olsr_ip_to_string((union olsr_ip_addr *)&ifp->int6_addr.sin6_addr)); //printf("== %s\n", olsr_ip_to_string((union olsr_ip_addr *)&((struct sockaddr_in6 *)addr)->sin6_addr)); ! if (ip6equal(&ifp->int6_addr.sin6_addr, &addr->v6)) return ifp; } Index: tc_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tc_set.h 4 Nov 2007 17:52:13 -0000 1.21 --- tc_set.h 8 Nov 2007 22:47:41 -0000 1.22 *************** *** 46,49 **** --- 46,51 ---- #include "defs.h" #include "packet.h" + #include "lq_avl.h" + #include "lq_list.h" /* *************** *** 116,120 **** extern struct tc_entry *tc_myself; ! int olsr_init_tc(void); void olsr_change_myself_tc(void); int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *); --- 118,122 ---- extern struct tc_entry *tc_myself; ! void olsr_init_tc(void); void olsr_change_myself_tc(void); int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *); Index: mpr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mpr.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mpr.c 21 Oct 2007 20:53:13 -0000 1.19 --- mpr.c 8 Nov 2007 22:47:41 -0000 1.20 *************** *** 46,49 **** --- 46,50 ---- #include "neighbor_table.h" #include "scheduler.h" + #include "net_olsr.h" /* Begin: *************** *** 122,126 **** { ! //OLSR_PRINTF(1, "(1)Skipping 2h neighbor %s - already 1hop\n", olsr_ip_to_string(&two_hop_neighbor->neighbor_2_addr)); continue; --- 123,127 ---- { ! //OLSR_PRINTF(1, "(1)Skipping 2h neighbor %s - already 1hop\n", olsr_ip_to_string(&buf, &two_hop_neighbor->neighbor_2_addr)); continue; *************** *** 134,138 **** two_hop_list_tmp = olsr_malloc(sizeof(struct neighbor_2_list_entry), "MPR two hop list"); ! //OLSR_PRINTF(1, "ONE LINK ADDING %s\n", olsr_ip_to_string(&two_hop_neighbor->neighbor_2_addr)); /* Only queue one way here */ --- 135,139 ---- two_hop_list_tmp = olsr_malloc(sizeof(struct neighbor_2_list_entry), "MPR two hop list"); ! //OLSR_PRINTF(1, "ONE LINK ADDING %s\n", olsr_ip_to_string(&buf, &two_hop_neighbor->neighbor_2_addr)); /* Only queue one way here */ *************** *** 168,175 **** struct neighbor_entry *dup_neighbor; olsr_u16_t count; ! count = *two_hop_covered_count; ! OLSR_PRINTF(1, "Setting %s as MPR\n", olsr_ip_to_string(&one_hop_neighbor->neighbor_main_addr)); //printf("PRE COUNT: %d\n\n", count); --- 169,178 ---- struct neighbor_entry *dup_neighbor; olsr_u16_t count; ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif count = *two_hop_covered_count; ! OLSR_PRINTF(1, "Setting %s as MPR\n", olsr_ip_to_string(&buf, &one_hop_neighbor->neighbor_main_addr)); //printf("PRE COUNT: %d\n\n", count); *************** *** 185,189 **** if((dup_neighbor != NULL) && (dup_neighbor->status == SYM)) { ! //OLSR_PRINTF(7, "(2)Skipping 2h neighbor %s - already 1hop\n", olsr_ip_to_string(&second_hop_entries->neighbor_2->neighbor_2_addr)); continue; } --- 188,192 ---- if((dup_neighbor != NULL) && (dup_neighbor->status == SYM)) { ! //OLSR_PRINTF(7, "(2)Skipping 2h neighbor %s - already 1hop\n", olsr_ip_to_string(&buf, &second_hop_entries->neighbor_2->neighbor_2_addr)); continue; } *************** *** 198,202 **** the_one_hop_list = second_hop_entries->neighbor_2->neighbor_2_nblist.next; ! //OLSR_PRINTF(1, "[%s](%x) has coverage %d\n", olsr_ip_to_string(&second_hop_entries->neighbor_2->neighbor_2_addr), second_hop_entries->neighbor_2, second_hop_entries->neighbor_2->mpr_covered_count); if(second_hop_entries->neighbor_2->mpr_covered_count >= olsr_cnf->mpr_coverage) --- 201,205 ---- the_one_hop_list = second_hop_entries->neighbor_2->neighbor_2_nblist.next; ! //OLSR_PRINTF(1, "[%s](%x) has coverage %d\n", olsr_ip_to_string(&buf, &second_hop_entries->neighbor_2->neighbor_2_addr), second_hop_entries->neighbor_2, second_hop_entries->neighbor_2->mpr_covered_count); if(second_hop_entries->neighbor_2->mpr_covered_count >= olsr_cnf->mpr_coverage) *************** *** 253,257 **** /* printf("[%s] nocov: %d mpr: %d will: %d max: %d\n\n", ! olsr_ip_to_string(&a_neighbor->neighbor_main_addr), a_neighbor->neighbor_2_nocov, a_neighbor->is_mpr, --- 256,260 ---- /* printf("[%s] nocov: %d mpr: %d will: %d max: %d\n\n", ! olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr), a_neighbor->neighbor_2_nocov, a_neighbor->is_mpr, *************** *** 395,399 **** twohop_neighbors = twohop_neighbors->next) { ! //printf("\tChecking %s....", olsr_ip_to_string(&twohop_neighbors->neighbor_2->neighbor_2_addr)); struct neighbor_entry *dup_neighbor = olsr_lookup_neighbor_table(&twohop_neighbors->neighbor_2->neighbor_2_addr); --- 398,402 ---- twohop_neighbors = twohop_neighbors->next) { ! //printf("\tChecking %s....", olsr_ip_to_string(&buf, &twohop_neighbors->neighbor_2->neighbor_2_addr)); struct neighbor_entry *dup_neighbor = olsr_lookup_neighbor_table(&twohop_neighbors->neighbor_2->neighbor_2_addr); *************** *** 429,449 **** { olsr_u16_t count = 0; ! olsr_u8_t index; //printf("\nAdding WILL ALWAYS nodes....\n"); ! for(index=0;indexnext) { ! if((a_neighbor->status == NOT_SYM) || (a_neighbor->willingness != WILL_ALWAYS)) continue; ! olsr_chosen_mpr(a_neighbor, &count); ! OLSR_PRINTF(3, "Adding WILL_ALWAYS: %s\n", olsr_ip_to_string(&a_neighbor->neighbor_main_addr)); } --- 432,455 ---- { olsr_u16_t count = 0; ! olsr_u8_t idx; //printf("\nAdding WILL ALWAYS nodes....\n"); ! for(idx=0;idxnext) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! if((a_neighbor->status == NOT_SYM) || (a_neighbor->willingness != WILL_ALWAYS)) { continue; ! } olsr_chosen_mpr(a_neighbor, &count); ! OLSR_PRINTF(3, "Adding WILL_ALWAYS: %s\n", olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr)); } *************** *** 461,466 **** olsr_calculate_mpr(void) { ! olsr_u16_t two_hop_covered_count; ! olsr_u16_t two_hop_count; int i; --- 467,472 ---- olsr_calculate_mpr(void) { ! olsr_u16_t two_hop_covered_count; ! olsr_u16_t two_hop_count; int i; *************** *** 548,557 **** for(i = WILL_NEVER + 1; i < WILL_ALWAYS; i++) { ! int index; ! for(index=0;indexnext) { --- 554,563 ---- for(i = WILL_NEVER + 1; i < WILL_ALWAYS; i++) { ! int idx; ! for(idx=0;idxnext) { *************** *** 563,567 **** { struct neighbor_2_list_entry *two_hop_list; ! //printf("\tChecking %s\n", olsr_ip_to_string(&a_neighbor->neighbor_main_addr)); remove = 1; --- 569,573 ---- { struct neighbor_2_list_entry *two_hop_list; ! //printf("\tChecking %s\n", olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr)); remove = 1; *************** *** 576,580 **** continue; ! //printf("\t[%s] coverage %d\n", olsr_ip_to_string(&two_hop_list->neighbor_2->neighbor_2_addr), two_hop_list->neighbor_2->mpr_covered_count); /* Do not remove if we find a entry which need this MPR */ if(two_hop_list->neighbor_2->mpr_covered_count <= olsr_cnf->mpr_coverage) --- 582,586 ---- continue; ! //printf("\t[%s] coverage %d\n", olsr_ip_to_string(&buf, &two_hop_list->neighbor_2->neighbor_2_addr), two_hop_list->neighbor_2->mpr_covered_count); /* Do not remove if we find a entry which need this MPR */ if(two_hop_list->neighbor_2->mpr_covered_count <= olsr_cnf->mpr_coverage) *************** *** 584,588 **** if(remove) { ! OLSR_PRINTF(3, "MPR OPTIMIZE: removiong mpr %s\n\n", olsr_ip_to_string(&a_neighbor->neighbor_main_addr)); a_neighbor->is_mpr = OLSR_FALSE; } --- 590,597 ---- if(remove) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(3, "MPR OPTIMIZE: removiong mpr %s\n\n", olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr)); a_neighbor->is_mpr = OLSR_FALSE; } *************** *** 598,619 **** #ifndef NODEBUG /* The whole function makes no sense without it. */ ! int index; OLSR_PRINTF(1, "MPR SET: "); ! for(index=0;indexnext) ! { ! /* ! * Remove MPR settings ! */ ! if(a_neighbor->is_mpr) ! OLSR_PRINTF(1, "[%s] ", olsr_ip_to_string(&a_neighbor->neighbor_main_addr)); ! } } OLSR_PRINTF(1, "\n"); #endif --- 607,626 ---- #ifndef NODEBUG /* The whole function makes no sense without it. */ ! int idx; OLSR_PRINTF(1, "MPR SET: "); ! for(idx = 0; idx < HASHSIZE; idx++) { ! struct neighbor_entry *a_neighbor; ! for(a_neighbor = neighbortable[idx].next; a_neighbor != &neighbortable[idx]; a_neighbor = a_neighbor->next) { ! /* ! * Remove MPR settings ! */ ! if(a_neighbor->is_mpr) { ! struct ipaddr_str buf; ! OLSR_PRINTF(1, "[%s] ", olsr_ip_to_string(&buf, &a_neighbor->neighbor_main_addr)); ! } } + } OLSR_PRINTF(1, "\n"); #endif Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tc_set.c 4 Nov 2007 17:52:13 -0000 1.35 --- tc_set.c 8 Nov 2007 22:47:41 -0000 1.36 *************** *** 46,50 **** #include "lq_route.h" #include "lq_avl.h" ! #include "assert.h" /* Root of the link state database */ --- 46,52 ---- #include "lq_route.h" #include "lq_avl.h" ! #include "net_olsr.h" ! ! #include /* Root of the link state database */ *************** *** 56,60 **** * */ ! int olsr_init_tc(void) { --- 58,62 ---- * */ ! void olsr_init_tc(void) { *************** *** 69,73 **** */ tc_myself = olsr_add_tc_entry(&olsr_cnf->main_addr); - return 1; } --- 71,74 ---- *************** *** 82,90 **** if (tc_myself) { - /* * Check if there was a change. */ ! if (COMP_IP(&tc_myself->addr, &olsr_cnf->main_addr)) { return; } --- 83,90 ---- if (tc_myself) { /* * Check if there was a change. */ ! if (ipequal(&tc_myself->addr, &olsr_cnf->main_addr)) { return; } *************** *** 115,121 **** olsr_delete_tc_entry(struct tc_entry *tc) { - #if 0 ! OLSR_PRINTF(1, "TC: del entry %s\n", olsr_ip_to_string(&tc->addr)); #endif --- 115,121 ---- olsr_delete_tc_entry(struct tc_entry *tc) { #if 0 ! struct ipaddr_str buf; ! OLSR_PRINTF(1, "TC: del entry %s\n", olsr_ip_to_string(%buf, &tc->addr)); #endif *************** *** 160,166 **** olsr_getnext_tc_entry(struct tc_entry *tc) { ! struct avl_node *node; ! ! node = avl_walk_next(&tc->vertex_node); if (node) { --- 160,164 ---- olsr_getnext_tc_entry(struct tc_entry *tc) { ! struct avl_node *node = avl_walk_next(&tc->vertex_node); if (node) { *************** *** 181,187 **** { struct tc_entry *tc; - #if 0 ! OLSR_PRINTF(1, "TC: add entry %s\n", olsr_ip_to_string(adr)); #endif --- 179,185 ---- { struct tc_entry *tc; #if 0 ! struct ipaddr_str buf; ! OLSR_PRINTF(1, "TC: add entry %s\n", olsr_ip_to_string(&buf, adr)); #endif *************** *** 193,197 **** /* Fill entry */ ! COPY_IP(&tc->addr, adr); tc->vertex_node.data = tc; tc->vertex_node.key = &tc->addr; --- 191,196 ---- /* Fill entry */ ! //COPY_IP(&tc->addr, adr); ! tc->addr = *adr; tc->vertex_node.data = tc; tc->vertex_node.key = &tc->addr; *************** *** 216,233 **** olsr_tc_edge_to_string(struct tc_edge_entry *tc_edge) { ! struct tc_entry *tc; ! static char buff[128]; ! ! tc = tc_edge->tc; ! snprintf(buff, sizeof(buff), "%s > %s, lq %.3f, inv-lq %.3f, etx %.3f", ! olsr_ip_to_string(&tc->addr), ! olsr_ip_to_string(&tc_edge->T_dest_addr), tc_edge->link_quality, tc_edge->inverse_link_quality, tc_edge->etx); ! return buff; } --- 215,231 ---- olsr_tc_edge_to_string(struct tc_edge_entry *tc_edge) { ! static char buf[128]; ! struct ipaddr_str addrbuf, dstbuf; ! struct tc_entry *tc = tc_edge->tc; ! snprintf(buf, sizeof(buf), "%s > %s, lq %.3f, inv-lq %.3f, etx %.3f", ! olsr_ip_to_string(&addrbuf, &tc->addr), ! olsr_ip_to_string(&dstbuf, &tc_edge->T_dest_addr), tc_edge->link_quality, tc_edge->inverse_link_quality, tc_edge->etx); ! return buf; } *************** *** 282,286 **** /* Fill entry */ ! COPY_IP(&tc_edge->T_dest_addr, addr); olsr_set_tc_edge_timer(tc_edge, vtime*1000); tc_edge->T_seq = ansn; --- 280,285 ---- /* Fill entry */ ! //COPY_IP(&tc_edge->T_dest_addr, addr); ! tc_edge->T_dest_addr = *addr; olsr_set_tc_edge_timer(tc_edge, vtime*1000); tc_edge->T_seq = ansn; *************** *** 289,296 **** if (olsr_cnf->lq_level > 0) { - tc_edge->link_quality = neigh_link_quality; tc_edge->inverse_link_quality = link_quality; - } else { --- 288,293 ---- *************** *** 323,327 **** tc_neighbor = olsr_lookup_tc_entry(&tc_edge->T_dest_addr); if (tc_neighbor) { - #if 0 OLSR_PRINTF(1, "TC: found neighbor tc_entry %s\n", --- 320,323 ---- *************** *** 331,335 **** tc_edge_inv = olsr_lookup_tc_edge(tc_neighbor, &tc->addr); if (tc_edge_inv) { - #if 0 OLSR_PRINTF(1, "TC: found inverse edge for %s\n", --- 327,330 ---- *************** *** 411,415 **** { struct tc_edge_entry *tc_edge; ! int retval; #if 0 --- 406,410 ---- { struct tc_edge_entry *tc_edge; ! int retval = 0; #if 0 *************** *** 417,426 **** #endif - retval = 0; - OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { - if (SEQNO_GREATER_THAN(msg->ansn, tc_edge->T_seq)) { - /* * Do not delete the edge now, just mark the edge as down. --- 412,417 ---- *************** *** 591,608 **** { struct tc_entry *tc; - struct tc_edge_entry *tc_edge; ! OLSR_FOR_ALL_TC_ENTRIES(tc) OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! ! /* ! * Delete outdated edges. ! */ ! if(TIMED_OUT(tc_edge->T_time)) { ! olsr_delete_tc_edge_entry(tc_edge); ! changes_topology = OLSR_TRUE; ! } ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! OLSR_FOR_ALL_TC_ENTRIES_END(tc) } --- 582,598 ---- { struct tc_entry *tc; ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! struct tc_edge_entry *tc_edge; OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! /* ! * Delete outdated edges. ! */ ! if(TIMED_OUT(tc_edge->T_time)) { ! olsr_delete_tc_edge_entry(tc_edge); ! changes_topology = OLSR_TRUE; ! } ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc) } *************** *** 627,633 **** struct tc_edge_entry *tc_edge; OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { OLSR_PRINTF(1, "%-*s %-*s %5.3f %5.3f %.2f\n", ! ipwidth, olsr_ip_to_string(&tc->addr), ! ipwidth, olsr_ip_to_string(&tc_edge->T_dest_addr), tc_edge->link_quality, tc_edge->inverse_link_quality, --- 617,624 ---- struct tc_edge_entry *tc_edge; OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { + struct ipaddr_str addrbuf, dstaddrbuf; OLSR_PRINTF(1, "%-*s %-*s %5.3f %5.3f %.2f\n", ! ipwidth, olsr_ip_to_string(&addrbuf, &tc->addr), ! ipwidth, olsr_ip_to_string(&dstaddrbuf, &tc_edge->T_dest_addr), tc_edge->link_quality, tc_edge->inverse_link_quality, Index: mpr_selector_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mpr_selector_set.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mpr_selector_set.c 21 Oct 2007 20:55:11 -0000 1.19 --- mpr_selector_set.c 8 Nov 2007 22:47:41 -0000 1.20 *************** *** 45,48 **** --- 45,49 ---- #include "olsr.h" #include "scheduler.h" + #include "net_olsr.h" static olsr_u16_t ansn; *************** *** 102,113 **** olsr_add_mpr_selector(const union olsr_ip_addr *addr, float vtime) { struct mpr_selector *new_entry; ! OLSR_PRINTF(1, "MPRS: adding %s\n", olsr_ip_to_string(addr)); new_entry = olsr_malloc(sizeof(struct mpr_selector), "Add MPR selector"); /* Fill struct */ ! COPY_IP(&new_entry->MS_main_addr, addr); new_entry->MS_time = GET_TIMESTAMP(vtime*1000); --- 103,118 ---- olsr_add_mpr_selector(const union olsr_ip_addr *addr, float vtime) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif struct mpr_selector *new_entry; ! OLSR_PRINTF(1, "MPRS: adding %s\n", olsr_ip_to_string(&buf, addr)); new_entry = olsr_malloc(sizeof(struct mpr_selector), "Add MPR selector"); /* Fill struct */ ! //COPY_IP(&new_entry->MS_main_addr, addr); ! new_entry->MS_main_addr = *addr; new_entry->MS_time = GET_TIMESTAMP(vtime*1000); *************** *** 143,147 **** for (mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) { ! if(COMP_IP(&mprs->MS_main_addr, addr)) { //OLSR_PRINTF(1, "MATCH\n"); return mprs; --- 148,152 ---- for (mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) { ! if(ipequal(&mprs->MS_main_addr, addr)) { //OLSR_PRINTF(1, "MATCH\n"); return mprs; *************** *** 165,171 **** olsr_update_mprs_set(const union olsr_ip_addr *addr, float vtime) { struct mpr_selector *mprs = olsr_lookup_mprs_set(addr); ! OLSR_PRINTF(5, "MPRS: Update %s\n", olsr_ip_to_string(addr)); if(mprs == NULL) { --- 170,179 ---- olsr_update_mprs_set(const union olsr_ip_addr *addr, float vtime) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif struct mpr_selector *mprs = olsr_lookup_mprs_set(addr); ! OLSR_PRINTF(5, "MPRS: Update %s\n", olsr_ip_to_string(&buf, addr)); if(mprs == NULL) { *************** *** 193,199 **** /* Dequeue */ struct mpr_selector *mprs_to_delete = mprs; mprs = mprs->next; ! OLSR_PRINTF(1, "MPRS: Timing out %s\n", olsr_ip_to_string(&mprs_to_delete->MS_main_addr)); DEQUEUE_ELEM(mprs_to_delete); --- 201,210 ---- /* Dequeue */ struct mpr_selector *mprs_to_delete = mprs; + #ifndef NODEBUG + struct ipaddr_str buf; + #endif mprs = mprs->next; ! OLSR_PRINTF(1, "MPRS: Timing out %s\n", olsr_ip_to_string(&buf, &mprs_to_delete->MS_main_addr)); DEQUEUE_ELEM(mprs_to_delete); *************** *** 216,221 **** struct mpr_selector *mprs; OLSR_PRINTF(1, "MPR SELECTORS: "); ! for (mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) { ! OLSR_PRINTF(1, "%s ", olsr_ip_to_string(&mprs->MS_main_addr)); } OLSR_PRINTF(1, "\n"); --- 227,235 ---- struct mpr_selector *mprs; OLSR_PRINTF(1, "MPR SELECTORS: "); ! for(mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "%s ", olsr_ip_to_string(&buf, &mprs->MS_main_addr)); } OLSR_PRINTF(1, "\n"); Index: parser.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/parser.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** parser.c 8 May 2007 23:34:52 -0000 1.35 --- parser.c 8 Nov 2007 22:47:41 -0000 1.36 *************** *** 52,55 **** --- 52,56 ---- #include "log.h" #include "print_packet.h" + #include "net_olsr.h" #ifdef WIN32 *************** *** 98,102 **** void ! olsr_parser_add_function(void (*function)(union olsr_message *, struct interface *, union olsr_ip_addr *), olsr_u32_t type, int forwarding) { struct parse_function_entry *new_entry; --- 99,103 ---- void ! olsr_parser_add_function(parse_function *function, olsr_u32_t type, int forwarding) { struct parse_function_entry *new_entry; *************** *** 122,126 **** int ! olsr_parser_remove_function(void (*function)(union olsr_message *, struct interface *, union olsr_ip_addr *), olsr_u32_t type, int forwarding) { struct parse_function_entry *entry, *prev; --- 123,127 ---- int ! olsr_parser_remove_function(parse_function *function, olsr_u32_t type, int forwarding) { struct parse_function_entry *entry, *prev; *************** *** 182,193 **** if (ntohs(olsr->olsr_packlen) != size) { OLSR_PRINTF(1, "Size error detected in received packet.\nRecieved %d, in packet %d\n", size, ntohs(olsr->olsr_packlen)); olsr_syslog(OLSR_LOG_ERR, " packet length error in packet received from %s!", ! olsr_ip_to_string(from_addr)); return; } ! //printf("Message from %s\n\n", olsr_ip_to_string(from_addr)); /* Display packet */ --- 183,195 ---- if (ntohs(olsr->olsr_packlen) != size) { + struct ipaddr_str buf; OLSR_PRINTF(1, "Size error detected in received packet.\nRecieved %d, in packet %d\n", size, ntohs(olsr->olsr_packlen)); olsr_syslog(OLSR_LOG_ERR, " packet length error in packet received from %s!", ! olsr_ip_to_string(&buf, from_addr)); return; } ! //printf("Message from %s\n\n", olsr_ip_to_string(&buf, from_addr)); /* Display packet */ *************** *** 245,253 **** if(count < 0) { OLSR_PRINTF(1, "packet length error in packet received from %s!", ! olsr_ip_to_string(from_addr)); olsr_syslog(OLSR_LOG_ERR, " packet length error in packet received from %s!", ! olsr_ip_to_string(from_addr)); break; } --- 247,256 ---- if(count < 0) { + struct ipaddr_str buf; OLSR_PRINTF(1, "packet length error in packet received from %s!", ! olsr_ip_to_string(&buf, from_addr)); olsr_syslog(OLSR_LOG_ERR, " packet length error in packet received from %s!", ! olsr_ip_to_string(&buf, from_addr)); break; } *************** *** 260,266 **** if (m->v4.ttl <= 0 && olsr_cnf->lq_fish == 0) { OLSR_PRINTF(2, "Dropping packet type %d from neigh %s with TTL 0\n", m->v4.olsr_msgtype, ! olsr_ip_to_string(from_addr)); continue; } --- 263,272 ---- if (m->v4.ttl <= 0 && olsr_cnf->lq_fish == 0) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF(2, "Dropping packet type %d from neigh %s with TTL 0\n", m->v4.olsr_msgtype, ! olsr_ip_to_string(&buf, from_addr)); continue; } *************** *** 271,277 **** if (m->v6.ttl <= 0 && olsr_cnf->lq_fish == 0) { OLSR_PRINTF(2, "Dropping packet type %d from %s with TTL 0\n", m->v4.olsr_msgtype, ! olsr_ip_to_string(from_addr)); continue; } --- 277,286 ---- if (m->v6.ttl <= 0 && olsr_cnf->lq_fish == 0) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF(2, "Dropping packet type %d from %s with TTL 0\n", m->v4.olsr_msgtype, ! olsr_ip_to_string(&buf, from_addr)); continue; } *************** *** 287,291 **** /* Should be the same for IPv4 and IPv6 */ ! if(COMP_IP(&m->v4.originator, &olsr_cnf->main_addr)) { #ifdef DEBUG --- 296,300 ---- /* Should be the same for IPv4 and IPv6 */ ! if(m->v4.originator == olsr_cnf->main_addr.v4.s_addr) { #ifdef DEBUG *************** *** 319,322 **** --- 328,334 ---- if(processed == 0) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif unk_chgestruct(&unkpacket, m); *************** *** 324,331 **** m->v4.olsr_msgtype, size, ! olsr_ip_to_string(&unkpacket.originator)); /* Forward message */ ! if(!COMP_IP(&unkpacket.originator, &olsr_cnf->main_addr)) { /* Forward */ --- 336,343 ---- m->v4.olsr_msgtype, size, ! olsr_ip_to_string(&buf, &unkpacket.originator)); /* Forward message */ ! if(!ipequal(&unkpacket.originator, &olsr_cnf->main_addr)) { /* Forward */ *************** *** 358,365 **** olsr_input(int fd) { - /* sockaddr_in6 is bigger than sockaddr !!!! */ - struct sockaddr_storage from; - socklen_t fromlen; - int cc; struct interface *olsr_in_if; union olsr_ip_addr from_addr; --- 370,373 ---- *************** *** 368,371 **** --- 376,387 ---- for (;;) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif + /* sockaddr_in6 is bigger than sockaddr !!!! */ + struct sockaddr_storage from; + socklen_t fromlen; + int cc; + if (32 < ++cpu_overload_exit) { *************** *** 375,379 **** fromlen = sizeof(struct sockaddr_storage); - cc = olsr_recvfrom(fd, inbuf, --- 391,394 ---- *************** *** 392,410 **** break; } - if(olsr_cnf->ip_version == AF_INET) { /* IPv4 sender address */ ! COPY_IP(&from_addr, &((struct sockaddr_in *)&from)->sin_addr.s_addr); } else { /* IPv6 sender address */ ! COPY_IP(&from_addr, &((struct sockaddr_in6 *)&from)->sin6_addr); } #ifdef DEBUG ! OLSR_PRINTF(5, "Recieved a packet from %s\n", olsr_ip_to_string((union olsr_ip_addr *)&((struct sockaddr_in *)&from)->sin_addr.s_addr)); #endif --- 407,426 ---- break; } if(olsr_cnf->ip_version == AF_INET) { /* IPv4 sender address */ ! //COPY_IP(&from_addr, &((struct sockaddr_in *)&from)->sin_addr.s_addr); ! from_addr.v4 = ((struct sockaddr_in *)&from)->sin_addr; } else { /* IPv6 sender address */ ! //COPY_IP(&from_addr, &((struct sockaddr_in6 *)&from)->sin6_addr); ! from_addr.v6 = ((struct sockaddr_in6 *)&from)->sin6_addr; } #ifdef DEBUG ! OLSR_PRINTF(5, "Recieved a packet from %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&((struct sockaddr_in *)&from)->sin_addr.s_addr)); #endif *************** *** 420,428 **** if((olsr_in_if = if_ifwithsock(fd)) == NULL) { OLSR_PRINTF(1, "Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&from_addr), cc); olsr_syslog(OLSR_LOG_ERR, "Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&from_addr), cc); return ; --- 436,445 ---- if((olsr_in_if = if_ifwithsock(fd)) == NULL) { + struct ipaddr_str buf; OLSR_PRINTF(1, "Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&buf, &from_addr), cc); olsr_syslog(OLSR_LOG_ERR, "Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&buf, &from_addr), cc); return ; *************** *** 456,460 **** struct sockaddr_storage from; socklen_t fromlen; - int cc; struct interface *olsr_in_if; union olsr_ip_addr from_addr; --- 473,476 ---- *************** *** 464,471 **** direct link */ ! if((cc = recv(fd, from_addr.v6.s6_addr, olsr_cnf->ipsize, 0)) != (int)olsr_cnf->ipsize) { fprintf(stderr, "Error receiving host-client IP hook(%d) %s!\n", cc, strerror(errno)); ! COPY_IP(&from_addr, &((struct olsr *)inbuf)->olsr_msg->originator); } --- 480,489 ---- direct link */ ! int cc = recv(fd, from_addr.v6.s6_addr, olsr_cnf->ipsize, 0); ! if(cc != (int)olsr_cnf->ipsize) { fprintf(stderr, "Error receiving host-client IP hook(%d) %s!\n", cc, strerror(errno)); ! //COPY_IP(&from_addr, &((struct olsr *)inbuf)->olsr_msg->originator); ! memcpy(&from_addr, &((struct olsr *)inbuf)->olsr_msg->originator, olsr_cnf->ipsize); } *************** *** 518,526 **** if((olsr_in_if = if_ifwithsock(fd)) == NULL) { OLSR_PRINTF(1, "Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&from_addr), cc); olsr_syslog(OLSR_LOG_ERR, "Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&from_addr), cc); return; --- 536,545 ---- if((olsr_in_if = if_ifwithsock(fd)) == NULL) { + struct ipaddr_str buf; OLSR_PRINTF(1, "Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&buf, &from_addr), cc); olsr_syslog(OLSR_LOG_ERR, "Could not find input interface for message from %s size %d\n", ! olsr_ip_to_string(&buf, &from_addr), cc); return; Index: scheduler.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/scheduler.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** scheduler.c 17 Sep 2007 22:24:22 -0000 1.43 --- scheduler.c 8 Nov 2007 22:47:41 -0000 1.44 *************** *** 52,55 **** --- 52,56 ---- #include "olsr.h" #include "build_msg.h" + #include "net_olsr.h" /* Timer data, global. Externed in defs.h */ *************** *** 94,118 **** scheduler(void) { - struct timespec remainder_spec; - struct timespec sleeptime_spec; - - /* - *Used to calculate sleep time - */ - clock_t end_of_loop; - struct timeval time_used; struct timeval interval; - struct timeval sleeptime_val; - olsr_u32_t interval_usec; - struct event_entry *entry; - struct timeout_entry *time_out_entry; - - struct interface *ifn; - - /* Global buffer for times(2) calls. Do not remove - at least OpenBSD needs it. */ - struct tms tms_buf; - link_changes = OLSR_FALSE; --- 95,101 ---- *************** *** 120,124 **** olsr_register_scheduler_event(trigger_dijkstra, NULL, olsr_cnf->lq_dinter, 0, NULL); ! interval_usec = (olsr_u32_t)(olsr_cnf->pollrate * 1000000); interval.tv_sec = interval_usec / 1000000; --- 103,107 ---- olsr_register_scheduler_event(trigger_dijkstra, NULL, olsr_cnf->lq_dinter, 0, NULL); ! interval_usec = olsr_cnf->pollrate * 1000000; interval.tv_sec = interval_usec / 1000000; *************** *** 131,134 **** --- 114,129 ---- for(;;) { + /* + * Used to calculate sleep time + */ + clock_t end_of_loop; + struct timeval time_used; + struct event_entry *entry; + struct timeout_entry *time_out_entry; + struct interface *ifn; + + /* Global buffer for times(2) calls. Do not remove - at least OpenBSD needs it. */ + struct tms tms_buf; + /* Update now_times */ now_times = times(&tms_buf); *************** *** 136,162 **** /* Update the global timestamp - kept for plugin compat */ gettimeofday(&now, NULL); ! nowtm = localtime((time_t *)&now.tv_sec); ! ! while (nowtm == NULL) ! { ! nowtm = localtime((time_t *)&now.tv_sec); ! } ! ! ! /* Run timout functions (before packet generation) */ ! time_out_entry = timeout_functions; ! ! while(time_out_entry) ! { time_out_entry->function(); ! time_out_entry = time_out_entry->next; ! } ! /* Update */ ! olsr_process_changes(); - /* Check for changes in topology */ if(link_changes) --- 131,146 ---- /* Update the global timestamp - kept for plugin compat */ gettimeofday(&now, NULL); ! do { ! nowtm = localtime(&now.tv_sec); ! } while (nowtm == NULL); ! /* Run timeout functions (before packet generation) */ ! for (time_out_entry = timeout_functions; time_out_entry != NULL; time_out_entry = time_out_entry->next) { time_out_entry->function(); ! } ! /* Update */ olsr_process_changes(); /* Check for changes in topology */ if(link_changes) *************** *** 169,205 **** /* Check scheduled events */ ! entry = event_functions; ! /* UPDATED - resets timer upon triggered execution */ ! while(entry) { entry->since_last += olsr_cnf->pollrate; /* Timed out */ ! if((entry->since_last > entry->interval) || ! /* Triggered */ ! ((entry->trigger != NULL) && ! (*(entry->trigger) == 1))) ! { /* Run scheduled function */ entry->function(entry->param); /* Set jitter */ ! entry->since_last = (float) random()/RAND_MAX; ! entry->since_last *= olsr_cnf->max_jitter; /* Reset trigger */ ! if(entry->trigger != NULL) ! *(entry->trigger) = 0; ! ! //OLSR_PRINTF(3, "Since_last jitter: %0.2f\n", entry->since_last); } - - entry = entry->next; } - - /* looping trough interfaces and emmittin pending data */ for (ifn = ifnet; ifn ; ifn = ifn->int_next) --- 153,182 ---- /* Check scheduled events */ ! /* UPDATED - resets timer upon triggered execution */ ! for (entry = event_functions; entry != NULL; entry = entry->next) { entry->since_last += olsr_cnf->pollrate; /* Timed out */ ! if ((entry->since_last > entry->interval) || ! /* Triggered */ ! ((entry->trigger != NULL) && (*entry->trigger == 1)) ! ) { /* Run scheduled function */ entry->function(entry->param); /* Set jitter */ ! entry->since_last = (float)(random() / RAND_MAX) * olsr_cnf->max_jitter; /* Reset trigger */ ! if(entry->trigger != NULL) { ! *entry->trigger = 0; ! } + //OLSR_PRINTF(3, "Since_last jitter: %0.2f\n", entry->since_last); } } /* looping trough interfaces and emmittin pending data */ for (ifn = ifnet; ifn ; ifn = ifn->int_next) *************** *** 220,223 **** --- 197,203 ---- if(timercmp(&time_used, &interval, <)) { + struct timespec remainder_spec; + struct timespec sleeptime_spec; + struct timeval sleeptime_val; timersub(&interval, &time_used, &sleeptime_val); Index: parser.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/parser.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** parser.h 7 Jan 2006 08:16:20 -0000 1.11 --- parser.h 8 Nov 2007 22:47:41 -0000 1.12 *************** *** 49,57 **** #define PROMISCUOUS 0xffffffff struct parse_function_entry { olsr_u32_t type; /* If set to PROMISCUOUS all messages will be received */ int caller_forwarding; /* If set to 0 this entry is not registered as forwarding packets */ ! void (*function)(union olsr_message *, struct interface *, union olsr_ip_addr *); struct parse_function_entry *next; }; --- 49,59 ---- #define PROMISCUOUS 0xffffffff + typedef void parse_function(union olsr_message *, struct interface *, union olsr_ip_addr *); + struct parse_function_entry { olsr_u32_t type; /* If set to PROMISCUOUS all messages will be received */ int caller_forwarding; /* If set to 0 this entry is not registered as forwarding packets */ ! parse_function *function; struct parse_function_entry *next; }; *************** *** 73,80 **** void ! olsr_parser_add_function(void (*)(union olsr_message *, struct interface *, union olsr_ip_addr *), olsr_u32_t, int); int ! olsr_parser_remove_function(void (*)(union olsr_message *, struct interface *, union olsr_ip_addr *), olsr_u32_t, int); void --- 75,82 ---- void ! olsr_parser_add_function(parse_function, olsr_u32_t, int); int ! olsr_parser_remove_function(parse_function, olsr_u32_t, int); void Index: hysteresis.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hysteresis.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** hysteresis.c 2 Aug 2007 22:07:19 -0000 1.21 --- hysteresis.c 8 Nov 2007 22:47:41 -0000 1.22 *************** *** 47,50 **** --- 47,51 ---- #include "defs.h" #include "olsr.h" + #include "net_olsr.h" #define hscaling olsr_cnf->hysteresis_param.scaling *************** *** 78,83 **** if(entry->L_link_pending == 1) { OLSR_PRINTF(1, "HYST[%s] link set to NOT pending!\n", ! olsr_ip_to_string(&entry->neighbor_iface_addr)); changes_neighborhood = OLSR_TRUE; } --- 79,87 ---- if(entry->L_link_pending == 1) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF(1, "HYST[%s] link set to NOT pending!\n", ! olsr_ip_to_string(&buf, &entry->neighbor_iface_addr)); changes_neighborhood = OLSR_TRUE; } *************** *** 99,104 **** if(entry->L_link_pending == 0) { OLSR_PRINTF(1, "HYST[%s] link set to pending!\n", ! olsr_ip_to_string(&entry->neighbor_iface_addr)); changes_neighborhood = OLSR_TRUE; } --- 103,111 ---- if(entry->L_link_pending == 0) { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif OLSR_PRINTF(1, "HYST[%s] link set to pending!\n", ! olsr_ip_to_string(&buf, &entry->neighbor_iface_addr)); changes_neighborhood = OLSR_TRUE; } *************** *** 148,154 **** olsr_update_hysteresis_hello(struct link_entry *entry, double htime) { ! #ifdef DEBUG ! OLSR_PRINTF(3, "HYST[%s]: HELLO update vtime %f\n", olsr_ip_to_string(&entry->neighbor_iface_addr), htime*1.5); #endif /* hello timeout = current time + hint time */ /* SET TIMER TO 1.5 TIMES THE INTERVAL */ --- 155,162 ---- olsr_update_hysteresis_hello(struct link_entry *entry, double htime) { ! #ifndef NODEBUG ! struct ipaddr_str buf; #endif + OLSR_PRINTF(3, "HYST[%s]: HELLO update vtime %f\n", olsr_ip_to_string(&buf, &entry->neighbor_iface_addr), htime*1.5); /* hello timeout = current time + hint time */ /* SET TIMER TO 1.5 TIMES THE INTERVAL */ *************** *** 167,176 **** struct link_entry *lnk = lookup_link_entry(remote, NULL, local); ! /* Calculate new quality */ if(lnk != NULL) { lnk->L_link_quality = olsr_hyst_calc_stability(lnk->L_link_quality); #ifdef DEBUG ! OLSR_PRINTF(3, "HYST[%s]: %0.3f\n", olsr_ip_to_string(remote), lnk->L_link_quality); #endif --- 175,187 ---- struct link_entry *lnk = lookup_link_entry(remote, NULL, local); ! /* Calculate new quality */ if(lnk != NULL) { + #if !defined(NODEBUG) && defined(DEBUG) + struct ipaddr_str buf; + #endif lnk->L_link_quality = olsr_hyst_calc_stability(lnk->L_link_quality); #ifdef DEBUG ! OLSR_PRINTF(3, "HYST[%s]: %0.3f\n", olsr_ip_to_string(&buf, remote), lnk->L_link_quality); #endif *************** *** 189,193 **** #ifdef DEBUG OLSR_PRINTF(5, "HYST[%s] PACKET LOSS! %0.3f\n", ! olsr_ip_to_string(remote), lnk->L_link_quality); #endif if(lnk->L_link_quality < olsr_cnf->hysteresis_param.thr_low) --- 200,204 ---- #ifdef DEBUG OLSR_PRINTF(5, "HYST[%s] PACKET LOSS! %0.3f\n", ! olsr_ip_to_string(&buf, remote), lnk->L_link_quality); #endif if(lnk->L_link_quality < olsr_cnf->hysteresis_param.thr_low) Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** interfaces.h 13 Oct 2007 12:09:11 -0000 1.43 --- interfaces.h 8 Nov 2007 22:47:41 -0000 1.44 *************** *** 122,133 **** /** *A struct containing all necessary information about each ! *interface participating in the OLSD routing */ struct interface { /* IP version 4 */ ! struct sockaddr int_addr; /* address */ ! struct sockaddr int_netmask; /* netmask */ ! struct sockaddr int_broadaddr; /* broadcast address */ /* IP version 6 */ struct sockaddr_in6 int6_addr; /* Address */ --- 122,133 ---- /** *A struct containing all necessary information about each ! *interface participating in the OLSRD routing */ struct interface { /* IP version 4 */ ! struct sockaddr_in int_addr; /* address */ ! struct sockaddr_in int_netmask; /* netmask */ ! struct sockaddr_in int_broadaddr; /* broadcast address */ /* IP version 6 */ struct sockaddr_in6 int6_addr; /* Address */ From (spam-protected) Sun Nov 11 22:32:05 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 21:32:05 +0000 Subject: [Olsr-cvs] olsrd-current/files olsrd.conf.default.lq-fisheye, 1.6, 1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/files In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6952/files Modified Files: olsrd.conf.default.lq-fisheye Log Message: * adapted to the one delivered by the Debian package as a result of a recent discussion on olsr-dev at olsr.org Index: olsrd.conf.default.lq-fisheye =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/files/olsrd.conf.default.lq-fisheye,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** olsrd.conf.default.lq-fisheye 19 Apr 2007 22:28:09 -0000 1.6 --- olsrd.conf.default.lq-fisheye 11 Nov 2007 21:32:03 -0000 1.7 *************** *** 4,8 **** # Lines starting with a # are discarded # ! # This file was shipped with olsrd 0.5.0-unoffical # --- 4,8 ---- # Lines starting with a # are discarded # ! # This file was shipped with olsrd 0.5.4 # *************** *** 18,39 **** ! # Fisheye mechanism for TC messages 0=off, 1=on ! LinkQualityFishEye 1 ! # Don't recalculate the Dijkstra-table for every incoming topology ! # control packet. There is no need to recalculate the whole table ! # if a minor change occured several hops away. Small CPUs will start ! # to glow if you do this in a mesh of considerable size. Rather the table ! # should be recalculated if a change occured in the neighborhood ! # of this node. The first number is the number of hops. Nodes within ! # this number of hops trigger a recalculation of the table. If the ! # number is 0 no incoming topology control packet will trigger ! # a recalculation of the table. The second number (floating point!) ! # is the length ot the interval until the table is recalculated anyway. ! LinkQualityDijkstraLimit 1 6.0 # IP version to use (4 or 6) --- 18,131 ---- ! # Interfaces and their rules ! # Omitted options will be set to the ! # default values. Multiple interfaces ! # can be specified in the same block ! # and multiple blocks can be set. ! # !!CHANGE THE INTERFACE LABEL(s) TO MATCH YOUR INTERFACE(s)!! ! # (eg. wlan0 or eth1): ! # ! # this is (in most cases) the only configuration you need to change + #Interface "eth1" "eth0" "wlan0" "wlan1" "ath0" "ath1" + Interface "eth1" + { ! # IPv4 broadcast address to use. The ! # one usefull example would be 255.255.255.255 ! # If not defined the broadcastaddress ! # every card is configured with is used ! # Ip4Broadcast 255.255.255.255 ! ! # IPv6 address scope to use. ! # Must be 'site-local' or 'global' ! ! # Ip6AddrType site-local ! ! # IPv6 multicast address to use when ! # using site-local addresses. ! # If not defined, ff05::15 is used ! ! # Ip6MulticastSite ff05::11 ! ! # IPv6 multicast address to use when ! # using global addresses ! # If not defined, ff0e::1 is used ! ! # Ip6MulticastGlobal ff0e::1 ! ! ! # Emission intervals. ! # If not defined, RFC proposed values will ! # be used in most cases. ! ! # Hello interval in seconds(float) ! HelloInterval 6.0 ! ! # HELLO validity time ! HelloValidityTime 600.0 ! ! ! # TC interval in seconds(float) 0.5 is only viable when ! # LinkQualityFishEye is enabled. Otherwise larger networks would ! # suffocate from a massive protocol overhead of TC-messages ! ! TcInterval 0.5 ! ! # TC validity time ! TcValidityTime 300.0 ! ! # MID interval in seconds(float) ! MidInterval 10.0 ! ! # MID validity time ! MidValidityTime 300.0 ! ! # HNA interval in seconds(float) ! HnaInterval 10.0 + # HNA validity time + HnaValidityTime 300.0 + + # When multiple links exist between hosts + # the weight of interface is used to determine + # the link to use. Normally the weight is + # automatically calculated by olsrd based + # on the characteristics of the interface, + # but here you can specify a fixed value. + # Olsrd will choose links with the lowest value. + + # 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. + + # LinkQualityMult 192.168.0.1 0.5 + + # This multiplier applies to all other nodes + # LinkQualityMult default 0.8 + } + + + # Fisheye mechanism for TC messages 0=off, 1=on + + LinkQualityFishEye 1 + + + # ignore topology information from nodes further than 3 hops away + # + # update topology information every 3.0 seconds + # (on slower embedded hardware with more than 100 nodes use something like 9 sec) + # + LinkQualityDijkstraLimit 3 3.0 # IP version to use (4 or 6) *************** *** 88,92 **** # if such information is available ! #Willingness 4 # Allow processes like the GUI front-end --- 180,184 ---- # if such information is available ! Willingness 7 # Allow processes like the GUI front-end *************** *** 153,157 **** # Default value 0.05 sec ! Pollrate 0.05 --- 245,249 ---- # Default value 0.05 sec ! Pollrate 0.1 *************** *** 189,195 **** # - /lib, followed by /usr/lib ! # Example plugin entry with parameters: ! #LoadPlugin "olsrd_dyn_gw.so.0.3" #{ # Here parameters are set to be sent to the --- 281,299 ---- # - /lib, followed by /usr/lib ! # Configuration examples for plugins: ! # see /usr/share/doc/olsrd-plugins/ for some for documentation ! #LoadPlugin "olsrd_httpinfo.so.0.1" ! #{ ! # # defaults to 1978 ! # PlParam "Port" "8080" ! # # if you dont set these, the default is to listen only on the loopback device ! # #PlParam "Host" "80.23.53.22" ! # #PlParam "Net" "10.0.0.0 255.0.0.0" ! # #PlParam "Net" "0.0.0.0 0.0.0.0" ! #} ! ! # useful if your machine has an uplink ! #LoadPlugin "olsrd_dyn_gw.so.0.4" #{ # Here parameters are set to be sent to the *************** *** 214,312 **** #} ! LoadPlugin "olsrd_httpinfo.so.0.1" ! { ! PlParam "port" "8080" ! PlParam "Host" "127.0.0.1" ! # PlParam "Host" "80.23.53.22" ! # PlParam "Net" "10.0.0.0 255.0.0.0" ! # PlParam "Net" "192.168.0.0 255.255.0.0" ! } ! ! ! # Interfaces and their rules ! # Omitted options will be set to the ! # default values. Multiple interfaces ! # can be specified in the same block ! # and multiple blocks can be set. ! ! # !!CHANGE THE INTERFACE LABEL(s) TO MATCH YOUR INTERFACE(s)!! ! # (eg. wlan0 or eth1): ! ! #Interface "eth0" "eth1" "eth2" "wlan0" "ath0" "rausb0" ! ! Interface "rausb0" ! { ! ! # IPv4 broadcast address to use. The ! # one usefull example would be 255.255.255.255 ! # If not defined the broadcastaddress ! # every card is configured with is used ! ! # Ip4Broadcast 255.255.255.255 ! ! # IPv6 address scope to use. ! # Must be 'site-local' or 'global' ! ! # Ip6AddrType site-local ! ! # IPv6 multicast address to use when ! # using site-local addresses. ! # If not defined, ff05::15 is used ! ! # Ip6MulticastSite ff05::11 ! ! # IPv6 multicast address to use when ! # using global addresses ! # If not defined, ff0e::1 is used ! ! # Ip6MulticastGlobal ff0e::1 ! ! ! # Emission intervals. ! # If not defined, RFC proposed values will ! # be used in most cases. ! ! # Hello interval in seconds(float) ! HelloInterval 5.0 ! ! # HELLO validity time ! HelloValidityTime 200.0 ! ! ! # TC interval in seconds(float) 0.5 is only viable when ! # LinkQualityFishEye is enabled. Otherwise larger networks would ! # suffocate from a massive protocol overhead of TC-messages ! ! TcInterval 2.5 ! ! # TC validity time ! TcValidityTime 250.0 ! ! # MID interval in seconds(float) ! MidInterval 5.0 ! ! # MID validity time ! MidValidityTime 300.0 ! ! # HNA interval in seconds(float) ! HnaInterval 5.0 ! ! # HNA validity time ! HnaValidityTime 100.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 ! ! } --- 318,335 ---- #} ! #LoadPlugin "olsrd_nameservice.so.0.2" ! #{ ! #PlParam "name" "xxx" ! #PlParam "a.b.c.d" "xxx-eth" ! #PlParam "a.b.c.e" "xxx-bbb" ! #PlParam "a.b.c.f" "xxx-olsr" ! #PlParam "suffix" ".olsr" ! #} + #LoadPlugin "olsrd_dot_draw.so.0.3" + #{ + # accept connection from IP: + # default 127.0.0.1 (localhost) + #PlParam "accept" "192.168.0.5" + #PlParam "port" "2004" + #} From (spam-protected) Sun Nov 11 23:00:41 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 22:00:41 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.84, 1.85 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18618/lib/httpinfo/src Modified Files: olsrd_httpinfo.c Log Message: * do not print / in the routeing table Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** olsrd_httpinfo.c 8 Nov 2007 23:33:54 -0000 1.84 --- olsrd_httpinfo.c 11 Nov 2007 22:00:39 -0000 1.85 *************** *** 312,316 **** addrlen = sizeof(struct sockaddr_in); ! if ((client_sockets[curr_clients] = accept(fd, (struct sockaddr *) &pin, &addrlen)) == -1) { olsr_printf(1, "(HTTPINFO) accept: %s\n", strerror(errno)); goto close_connection; --- 312,317 ---- addrlen = sizeof(struct sockaddr_in); ! client_sockets[curr_clients] = accept(fd, (struct sockaddr *) &pin, &addrlen); ! if (client_sockets[curr_clients] == -1) { olsr_printf(1, "(HTTPINFO) accept: %s\n", strerror(errno)); goto close_connection; *************** *** 631,635 **** size += snprintf(&buf[size], bufsize-size, "%s", ipaddrstr); /* print ip address or ip prefix ? */ ! if (prefix_len != -1) { size += snprintf(&buf[size], bufsize-size, "/%d", prefix_len); } --- 632,636 ---- size += snprintf(&buf[size], bufsize-size, "%s", ipaddrstr); /* print ip address or ip prefix ? */ ! if (prefix_len != -1 && prefix_len != olsr_cnf->maxplen) { size += snprintf(&buf[size], bufsize-size, "/%d", prefix_len); } *************** *** 693,697 **** rt->rt_dst.prefix_len); size += build_ipaddr_with_link(&buf[size], bufsize-size, ! &rt->rt_best->rtp_nexthop.gateway, -1); size += snprintf(&buf[size], bufsize-size, --- 694,699 ---- rt->rt_dst.prefix_len); size += build_ipaddr_with_link(&buf[size], bufsize-size, ! &rt->rt_best->rtp_nexthop.gateway, ! -1); size += snprintf(&buf[size], bufsize-size, From (spam-protected) Sun Nov 11 23:51:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 22:51:57 +0000 Subject: [Olsr-cvs] olsrd-current/src net_olsr.h, 1.15, 1.16 defs.h, 1.66, 1.67 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6474/src Modified Files: net_olsr.h defs.h Log Message: * moved the #define INLINE to a more appropriate .h file Index: defs.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/defs.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** defs.h 8 Nov 2007 22:47:41 -0000 1.66 --- defs.h 11 Nov 2007 22:51:54 -0000 1.67 *************** *** 108,111 **** --- 108,113 ---- #endif + #define INLINE inline __attribute__((always_inline)) + /* * Queueing macros Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** net_olsr.h 8 Nov 2007 22:47:41 -0000 1.15 --- net_olsr.h 11 Nov 2007 22:51:54 -0000 1.16 *************** *** 61,65 **** * Macros for comparing and copying IP addresses */ - #define INLINE inline __attribute__((always_inline)) static INLINE int ip4cmp(const struct in_addr *a, const struct in_addr *b) { return ntohl(a->s_addr) - ntohl(b->s_addr); } static INLINE int ip4equal(const struct in_addr *a, const struct in_addr *b) { return a->s_addr == b->s_addr; } --- 61,64 ---- From (spam-protected) Sun Nov 11 23:55:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 22:55:19 +0000 Subject: [Olsr-cvs] olsrd-current/src lq_avl.h, 1.12, 1.13 lq_avl.c, 1.14, 1.15 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6880/src Modified Files: lq_avl.h lq_avl.c Log Message: * made inline functions from avl_walk_{first,last,next,prev} * created "const" versions of it * inline_avl_comp_ipv4() is now also an inline function (and not a macro) * created a typedef for the avl tree comparison functions and use it! * cleanup: compare tree->comp to NULL as it is a pointer * killed a superflous "return"at the end of a void function Index: lq_avl.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** lq_avl.h 8 Nov 2007 22:47:41 -0000 1.12 --- lq_avl.h 11 Nov 2007 22:55:16 -0000 1.13 *************** *** 44,47 **** --- 44,49 ---- #define _LQ_AVL_H + #include "defs.h" + struct avl_node { *************** *** 57,60 **** --- 59,64 ---- }; + typedef int (*avl_tree_comp)(const void *, const void *); + struct avl_tree { *************** *** 63,67 **** struct avl_node *last; unsigned int count; ! int (*comp)(const void *, const void *); }; --- 67,71 ---- struct avl_node *last; unsigned int count; ! avl_tree_comp comp; }; *************** *** 69,89 **** #define AVL_DUP_NO 0 ! void avl_init(struct avl_tree *, int (*)(const void *, const void *)); struct avl_node *avl_find(struct avl_tree *, const void *); int avl_insert(struct avl_tree *, struct avl_node *, int); void avl_delete(struct avl_tree *, struct avl_node *); - struct avl_node *avl_walk_first(struct avl_tree *); - struct avl_node *avl_walk_last(struct avl_tree *); - struct avl_node *avl_walk_next(struct avl_node *); - struct avl_node *avl_walk_prev(struct avl_node *); ! extern int (*avl_comp_default)(const void *, const void *); ! extern int (*avl_comp_prefix_default)(const void *, const void *); extern int avl_comp_ipv4(const void *, const void *); extern int avl_comp_ipv6(const void *, const void *); ! #define inline_avl_comp_ipv4(ip1, ip2) \ ! (*(unsigned int *)(ip1) == *(unsigned int *)(ip2) ? 0 : \ ! *(unsigned int *)(ip1) < *(unsigned int *)(ip2) ? -1 : +1) #endif --- 73,99 ---- #define AVL_DUP_NO 0 ! void avl_init(struct avl_tree *, avl_tree_comp); struct avl_node *avl_find(struct avl_tree *, const void *); int avl_insert(struct avl_tree *, struct avl_node *, int); void avl_delete(struct avl_tree *, struct avl_node *); ! static INLINE struct avl_node *avl_walk_first(struct avl_tree *tree) { return tree->first; } ! static INLINE struct avl_node *avl_walk_last(struct avl_tree *tree) { return tree->last; } ! static INLINE struct avl_node *avl_walk_next(struct avl_node *node) { return node->next; } ! static INLINE struct avl_node *avl_walk_prev(struct avl_node *node) { return node->prev; } ! /* and const versions*/ ! static INLINE const struct avl_node *avl_walk_first_c(const struct avl_tree *tree) { return tree->first; } ! static INLINE const struct avl_node *avl_walk_last_c(const struct avl_tree *tree) { return tree->last; } ! static INLINE const struct avl_node *avl_walk_next_c(const struct avl_node *node) { return node->next; } ! static INLINE const struct avl_node *avl_walk_prev_c(const struct avl_node *node) { return node->prev; } ! ! extern avl_tree_comp avl_comp_default; ! extern avl_tree_comp avl_comp_prefix_default; extern int avl_comp_ipv4(const void *, const void *); extern int avl_comp_ipv6(const void *, const void *); ! static INLINE int inline_avl_comp_ipv4(const void *_ip1, const void *_ip2) { ! const unsigned int *ip1 = _ip1, *ip2 = _ip2; ! return *ip1 == *ip2 ? 0 : *ip1 < *ip2 ? -1 : +1; } #endif Index: lq_avl.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** lq_avl.c 8 Nov 2007 22:47:41 -0000 1.14 --- lq_avl.c 11 Nov 2007 22:55:17 -0000 1.15 *************** *** 56,61 **** * inline ipv4 comparison will be executed. */ ! int (*avl_comp_default)(const void *, const void *) = NULL; ! int (*avl_comp_prefix_default)(const void *, const void *); int avl_comp_ipv4(const void *ip1, const void *ip2) --- 56,61 ---- * inline ipv4 comparison will be executed. */ ! avl_tree_comp avl_comp_default = NULL; ! avl_tree_comp avl_comp_prefix_default; int avl_comp_ipv4(const void *ip1, const void *ip2) *************** *** 69,73 **** } ! void avl_init(struct avl_tree *tree, int (*comp)(const void *, const void *)) { tree->root = NULL; --- 69,73 ---- } ! void avl_init(struct avl_tree *tree, avl_tree_comp comp) { tree->root = NULL; *************** *** 96,104 **** static struct avl_node *avl_find_rec(struct avl_node *node, const void *key, ! int (*comp)(const void *, const void *)) { int diff; ! if (0 == comp) return avl_find_rec_ipv4(node, key); --- 96,104 ---- static struct avl_node *avl_find_rec(struct avl_node *node, const void *key, ! avl_tree_comp comp) { int diff; ! if (NULL == comp) return avl_find_rec_ipv4(node, key); *************** *** 133,137 **** node = avl_find_rec(tree->root, key, tree->comp); ! if (0 == tree->comp) { if (0 != inline_avl_comp_ipv4(node->key, key)) --- 133,137 ---- node = avl_find_rec(tree->root, key, tree->comp); ! if (NULL == tree->comp) { if (0 != inline_avl_comp_ipv4(node->key, key)) *************** *** 214,220 **** static void post_insert(struct avl_tree *tree, struct avl_node *node) { ! struct avl_node *parent; ! if ((parent = node->parent) == NULL) return; --- 214,220 ---- static void post_insert(struct avl_tree *tree, struct avl_node *node) { ! struct avl_node *parent = node->parent; ! if (parent == NULL) return; *************** *** 262,266 **** avl_rotate_right(tree, node); avl_rotate_left(tree, node->parent->parent); - return; } --- 262,265 ---- *************** *** 345,349 **** last = last->next; ! if (0 == tree->comp) diff = inline_avl_comp_ipv4(new->key, node->key); --- 344,348 ---- last = last->next; ! if (NULL == tree->comp) diff = inline_avl_comp_ipv4(new->key, node->key); *************** *** 691,714 **** } - struct avl_node *avl_walk_first(struct avl_tree *tree) - { - return tree->first; - } - - struct avl_node *avl_walk_last(struct avl_tree *tree) - { - return tree->last; - } - - struct avl_node *avl_walk_next(struct avl_node *node) - { - return node->next; - } - - struct avl_node *avl_walk_prev(struct avl_node *node) - { - return node->prev; - } - /* * Local Variables: --- 690,693 ---- From (spam-protected) Sun Nov 11 23:56:36 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 22:56:36 +0000 Subject: [Olsr-cvs] olsrd-current/src olsr.c,1.61,1.62 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8447/src Modified Files: olsr.c Log Message: * killed a superflous "return" at the end of a void function Index: olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** olsr.c 8 Nov 2007 22:47:41 -0000 1.61 --- olsr.c 11 Nov 2007 22:56:34 -0000 1.62 *************** *** 222,228 **** changes_hna = OLSR_FALSE; changes_force = OLSR_FALSE; - - - return; } --- 222,225 ---- From (spam-protected) Sun Nov 11 23:59:32 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 22:59:32 +0000 Subject: [Olsr-cvs] olsrd-current/src ipc_frontend.c, 1.38, 1.39 ipc_frontend.h, 1.16, 1.17 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9663/src Modified Files: ipc_frontend.c ipc_frontend.h Log Message: * const'ified ipc_route_send_rtentry Index: ipc_frontend.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ipc_frontend.h 8 Nov 2007 22:47:41 -0000 1.16 --- ipc_frontend.h 11 Nov 2007 22:59:29 -0000 1.17 *************** *** 109,113 **** int ! ipc_route_send_rtentry(union olsr_ip_addr *, union olsr_ip_addr *, int, int, const char *); #endif --- 109,113 ---- int ! ipc_route_send_rtentry(const union olsr_ip_addr *, const union olsr_ip_addr *, int, int, const char *); #endif Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** ipc_frontend.c 8 Nov 2007 22:47:41 -0000 1.38 --- ipc_frontend.c 11 Nov 2007 22:59:29 -0000 1.39 *************** *** 272,277 **** */ int ! ipc_route_send_rtentry(union olsr_ip_addr *dst, ! union olsr_ip_addr *gw, int met, int add, --- 272,277 ---- */ int ! ipc_route_send_rtentry(const union olsr_ip_addr *dst, ! const union olsr_ip_addr *gw, int met, int add, From (spam-protected) Mon Nov 12 00:10:25 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 23:10:25 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 kernel_routes.c,1.24,1.25 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10534/src/win32 Modified Files: kernel_routes.c Log Message: * const'ified olsr_ioctl_{add,del}_route{,6}() There are probably a few "const" missing for win32 and BSD. * const'ified moer parameters in many more functions in the .h and .c files * init-functions with constant or ignored return values are "void" * created a typedef fro the callback in "struct export_route_entry" and using it! * moved the initilaization of the {add,chg,del}_kernel_list variables into process_routes.c. So they are now "static" there. * olsr_export_{add,del}_route{,6} are now static in process_routes.c since they are not used elsewhere. * olsr_addroute_add_function() and olsr_deldroute_add_function() were almost identical - made one function out of it. Same for olsr_addroute_del_function() and olsr_deldroute_del_function(). * factored out common code * fixed the sort order in avl_comp_ipv4_prefix(): We compare now the IPv4 values in host byte order (and not network byte order). So the route list in the e.g. httpinfo plugin is now nicely sorted. Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/kernel_routes.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** kernel_routes.c 8 Nov 2007 23:23:13 -0000 1.24 --- kernel_routes.c 11 Nov 2007 23:10:22 -0000 1.25 *************** *** 61,65 **** *@return negative on error */ ! int olsr_ioctl_add_route(struct rt_entry *rt) { MIB_IPFORWARDROW Row; --- 61,65 ---- *@return negative on error */ ! int olsr_ioctl_add_route(const struct rt_entry *rt) { MIB_IPFORWARDROW Row; *************** *** 128,132 **** // XXX - to be implemented ! int olsr_ioctl_add_route6(struct rt_entry *rt __attribute__((unused))) { return 0; --- 128,132 ---- // XXX - to be implemented ! int olsr_ioctl_add_route6(const struct rt_entry *rt __attribute__((unused))) { return 0; *************** *** 140,144 **** *@return negative on error */ ! int olsr_ioctl_del_route(struct rt_entry *rt) { MIB_IPFORWARDROW Row; --- 140,144 ---- *@return negative on error */ ! int olsr_ioctl_del_route(const struct rt_entry *rt) { MIB_IPFORWARDROW Row; *************** *** 195,199 **** // XXX - to be implemented ! int olsr_ioctl_del_route6(struct rt_entry *rt __attribute__((unused))) { return 0; --- 195,199 ---- // XXX - to be implemented ! int olsr_ioctl_del_route6(const struct rt_entry *rt __attribute__((unused))) { return 0; From (spam-protected) Mon Nov 12 00:10:26 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 23:10:26 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.30,1.31 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10534/src/linux Modified Files: kernel_routes.c Log Message: * const'ified olsr_ioctl_{add,del}_route{,6}() There are probably a few "const" missing for win32 and BSD. * const'ified moer parameters in many more functions in the .h and .c files * init-functions with constant or ignored return values are "void" * created a typedef fro the callback in "struct export_route_entry" and using it! * moved the initilaization of the {add,chg,del}_kernel_list variables into process_routes.c. So they are now "static" there. * olsr_export_{add,del}_route{,6} are now static in process_routes.c since they are not used elsewhere. * olsr_addroute_add_function() and olsr_deldroute_add_function() were almost identical - made one function out of it. Same for olsr_addroute_del_function() and olsr_deldroute_del_function(). * factored out common code * fixed the sort order in avl_comp_ipv4_prefix(): We compare now the IPv4 values in host byte order (and not network byte order). So the route list in the e.g. httpinfo plugin is now nicely sorted. Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** kernel_routes.c 8 Nov 2007 22:47:42 -0000 1.30 --- kernel_routes.c 11 Nov 2007 23:10:23 -0000 1.31 *************** *** 62,66 **** }; ! static void olsr_netlink_addreq(struct olsr_rtreq *req, int type, void *data, int len) { struct rtattr *rta = (struct rtattr*)(((char*)req) + NLMSG_ALIGN(req->n.nlmsg_len)); --- 62,66 ---- }; ! static void olsr_netlink_addreq(struct olsr_rtreq *req, int type, const void *data, int len) { struct rtattr *rta = (struct rtattr*)(((char*)req) + NLMSG_ALIGN(req->n.nlmsg_len)); *************** *** 72,76 **** } ! static int olsr_netlink_route(struct rt_entry *rt, olsr_u8_t family, olsr_u8_t rttable, __u16 cmd) { int ret = 0; --- 72,76 ---- } ! static int olsr_netlink_route(const struct rt_entry *rt, olsr_u8_t family, olsr_u8_t rttable, __u16 cmd) { int ret = 0; *************** *** 89,93 **** }; olsr_u32_t metric = 1; ! struct rt_nexthop* nexthop = (RTM_NEWROUTE == cmd) ? &rt->rt_best->rtp_nexthop : &rt->rt_nexthop; --- 89,93 ---- }; olsr_u32_t metric = 1; ! const struct rt_nexthop* nexthop = (RTM_NEWROUTE == cmd) ? &rt->rt_best->rtp_nexthop : &rt->rt_nexthop; *************** *** 174,178 **** */ int ! olsr_ioctl_add_route(struct rt_entry *rt) { #if !LINUX_POLICY_ROUTING --- 174,178 ---- */ int ! olsr_ioctl_add_route(const struct rt_entry *rt) { #if !LINUX_POLICY_ROUTING *************** *** 253,257 **** */ int ! olsr_ioctl_add_route6(struct rt_entry *rt) { #if !LINUX_POLICY_ROUTING --- 253,257 ---- */ int ! olsr_ioctl_add_route6(const struct rt_entry *rt) { #if !LINUX_POLICY_ROUTING *************** *** 305,309 **** */ int ! olsr_ioctl_del_route(struct rt_entry *rt) { #if !LINUX_POLICY_ROUTING --- 305,309 ---- */ int ! olsr_ioctl_del_route(const struct rt_entry *rt) { #if !LINUX_POLICY_ROUTING *************** *** 372,376 **** */ int ! olsr_ioctl_del_route6(struct rt_entry *rt) { #if !LINUX_POLICY_ROUTING --- 372,376 ---- */ int ! olsr_ioctl_del_route6(const struct rt_entry *rt) { #if !LINUX_POLICY_ROUTING From (spam-protected) Mon Nov 12 00:10:26 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 23:10:26 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd kernel_routes.c,1.14,1.15 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10534/src/bsd Modified Files: kernel_routes.c Log Message: * const'ified olsr_ioctl_{add,del}_route{,6}() There are probably a few "const" missing for win32 and BSD. * const'ified moer parameters in many more functions in the .h and .c files * init-functions with constant or ignored return values are "void" * created a typedef fro the callback in "struct export_route_entry" and using it! * moved the initilaization of the {add,chg,del}_kernel_list variables into process_routes.c. So they are now "static" there. * olsr_export_{add,del}_route{,6} are now static in process_routes.c since they are not used elsewhere. * olsr_addroute_add_function() and olsr_deldroute_add_function() were almost identical - made one function out of it. Same for olsr_addroute_del_function() and olsr_deldroute_del_function(). * factored out common code * fixed the sort order in avl_comp_ipv4_prefix(): We compare now the IPv4 values in host byte order (and not network byte order). So the route list in the e.g. httpinfo plugin is now nicely sorted. Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/kernel_routes.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** kernel_routes.c 4 Oct 2007 22:27:31 -0000 1.14 --- kernel_routes.c 11 Nov 2007 23:10:24 -0000 1.15 *************** *** 50,54 **** static unsigned int seq = 0; ! static int add_del_route(struct rt_entry *rt, int add) { struct rt_msghdr *rtm; --- 50,54 ---- static unsigned int seq = 0; ! static int add_del_route(const struct rt_entry *rt, int add) { struct rt_msghdr *rtm; *************** *** 165,179 **** } ! int olsr_ioctl_add_route(struct rt_entry *rt) { return add_del_route(rt, 1); } ! int olsr_ioctl_del_route(struct rt_entry *rt) { return add_del_route(rt, 0); } ! static int add_del_route6(struct rt_entry *rt, int add) { struct rt_msghdr *rtm; --- 165,179 ---- } ! int olsr_ioctl_add_route(const struct rt_entry *rt) { return add_del_route(rt, 1); } ! int olsr_ioctl_del_route(const struct rt_entry *rt) { return add_del_route(rt, 0); } ! static int add_del_route6(const struct rt_entry *rt, int add) { struct rt_msghdr *rtm; *************** *** 301,310 **** } ! int olsr_ioctl_add_route6(struct rt_entry *rt) { return add_del_route6(rt, 1); } ! int olsr_ioctl_del_route6(struct rt_entry *rt) { return add_del_route6(rt, 0); --- 301,310 ---- } ! int olsr_ioctl_add_route6(const struct rt_entry *rt) { return add_del_route6(rt, 1); } ! int olsr_ioctl_del_route6(const struct rt_entry *rt) { return add_del_route6(rt, 0); From (spam-protected) Mon Nov 12 00:10:27 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 23:10:27 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga/src quagga.h, 1.5, 1.6 quagga.c, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10534/lib/quagga/src Modified Files: quagga.h quagga.c Log Message: * const'ified olsr_ioctl_{add,del}_route{,6}() There are probably a few "const" missing for win32 and BSD. * const'ified moer parameters in many more functions in the .h and .c files * init-functions with constant or ignored return values are "void" * created a typedef fro the callback in "struct export_route_entry" and using it! * moved the initilaization of the {add,chg,del}_kernel_list variables into process_routes.c. So they are now "static" there. * olsr_export_{add,del}_route{,6} are now static in process_routes.c since they are not used elsewhere. * olsr_addroute_add_function() and olsr_deldroute_add_function() were almost identical - made one function out of it. Same for olsr_addroute_del_function() and olsr_deldroute_del_function(). * factored out common code * fixed the sort order in avl_comp_ipv4_prefix(): We compare now the IPv4 values in host byte order (and not network byte order). So the route list in the e.g. httpinfo plugin is now nicely sorted. Index: quagga.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/quagga.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** quagga.h 10 Oct 2007 21:24:54 -0000 1.5 --- quagga.h 11 Nov 2007 23:10:25 -0000 1.6 *************** *** 55,60 **** void zebra_cleanup (void); unsigned char zebra_send_command (unsigned char, unsigned char *, int ); ! int zebra_add_v4_route (struct ipv4_route r); ! int zebra_delete_v4_route (struct ipv4_route r); void zebra_check (void*); int zebra_parse_packet (unsigned char*, ssize_t); --- 55,60 ---- void zebra_cleanup (void); unsigned char zebra_send_command (unsigned char, unsigned char *, int ); ! int zebra_add_v4_route (const struct ipv4_route r); ! int zebra_delete_v4_route (const struct ipv4_route r); void zebra_check (void*); int zebra_parse_packet (unsigned char*, ssize_t); *************** *** 64,69 **** int delete_hna4_route (struct ipv4_route); void *my_realloc (void *, size_t, const char *); ! int zebra_add_olsr_v4_route (struct rt_entry *); ! int zebra_del_olsr_v4_route (struct rt_entry *); void zebra_olsr_localpref (void); void zebra_olsr_distance (unsigned char); --- 64,69 ---- int delete_hna4_route (struct ipv4_route); void *my_realloc (void *, size_t, const char *); ! int zebra_add_olsr_v4_route (const struct rt_entry *); ! int zebra_del_olsr_v4_route (const struct rt_entry *); void zebra_olsr_localpref (void); void zebra_olsr_distance (unsigned char); Index: quagga.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/quagga.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** quagga.c 8 Nov 2007 22:47:40 -0000 1.10 --- quagga.c 11 Nov 2007 23:10:25 -0000 1.11 *************** *** 27,32 **** #include #include - #include "quagga.h" #include "olsr.h" #include "log.h" --- 27,32 ---- #include #include + #include "quagga.h" #include "olsr.h" #include "log.h" *************** *** 365,369 **** /* adds a route to zebra-daemon */ ! int zebra_add_v4_route (struct ipv4_route r) { unsigned char *cmdopt; --- 365,369 ---- /* adds a route to zebra-daemon */ ! int zebra_add_v4_route (const struct ipv4_route r) { unsigned char *cmdopt; *************** *** 737,741 **** */ ! int zebra_add_olsr_v4_route (struct rt_entry *r) { struct ipv4_route route; --- 737,741 ---- */ ! int zebra_add_olsr_v4_route (const struct rt_entry *r) { struct ipv4_route route; *************** *** 784,788 **** } ! int zebra_del_olsr_v4_route (struct rt_entry *r) { struct ipv4_route route; --- 784,788 ---- } ! int zebra_del_olsr_v4_route (const struct rt_entry *r) { struct ipv4_route route; From (spam-protected) Mon Nov 12 00:10:27 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 23:10:27 +0000 Subject: [Olsr-cvs] olsrd-current/src routing_table.h, 1.24, 1.25 routing_table.c, 1.33, 1.34 process_routes.h, 1.12, 1.13 process_routes.c, 1.38, 1.39 kernel_routes.h, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10534/src Modified Files: routing_table.h routing_table.c process_routes.h process_routes.c kernel_routes.h Log Message: * const'ified olsr_ioctl_{add,del}_route{,6}() There are probably a few "const" missing for win32 and BSD. * const'ified moer parameters in many more functions in the .h and .c files * init-functions with constant or ignored return values are "void" * created a typedef fro the callback in "struct export_route_entry" and using it! * moved the initilaization of the {add,chg,del}_kernel_list variables into process_routes.c. So they are now "static" there. * olsr_export_{add,del}_route{,6} are now static in process_routes.c since they are not used elsewhere. * olsr_addroute_add_function() and olsr_deldroute_add_function() were almost identical - made one function out of it. Same for olsr_addroute_del_function() and olsr_deldroute_del_function(). * factored out common code * fixed the sort order in avl_comp_ipv4_prefix(): We compare now the IPv4 values in host byte order (and not network byte order). So the route list in the e.g. httpinfo plugin is now nicely sorted. Index: kernel_routes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/kernel_routes.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** kernel_routes.h 17 Sep 2007 22:55:40 -0000 1.10 --- kernel_routes.h 11 Nov 2007 23:10:25 -0000 1.11 *************** *** 47,60 **** int ! olsr_ioctl_add_route(struct rt_entry *); int ! olsr_ioctl_add_route6(struct rt_entry *); int ! olsr_ioctl_del_route(struct rt_entry *); int ! olsr_ioctl_del_route6(struct rt_entry *); #endif --- 47,60 ---- int ! olsr_ioctl_add_route(const struct rt_entry *); int ! olsr_ioctl_add_route6(const struct rt_entry *); int ! olsr_ioctl_del_route(const struct rt_entry *); int ! olsr_ioctl_del_route6(const struct rt_entry *); #endif Index: routing_table.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** routing_table.h 8 Nov 2007 22:47:41 -0000 1.24 --- routing_table.h 11 Nov 2007 23:10:24 -0000 1.25 *************** *** 145,149 **** extern unsigned int routingtree_version; ! int olsr_init_routing_table(void); --- 145,149 ---- extern unsigned int routingtree_version; ! void olsr_init_routing_table(void); *************** *** 154,164 **** void olsr_rt_best(struct rt_entry *); ! olsr_bool olsr_nh_change(struct rt_nexthop *, struct rt_nexthop *); ! olsr_bool olsr_cmp_rt(struct rt_entry *, struct rt_entry *); void olsr_calculate_hna_routes(void); ! char *olsr_rt_to_string(struct rt_entry *); ! char *olsr_rtp_to_string(struct rt_path *); ! void olsr_print_routing_table(struct avl_tree *); const struct rt_nexthop * olsr_get_nh(const struct rt_entry *); --- 154,164 ---- void olsr_rt_best(struct rt_entry *); ! olsr_bool olsr_nh_change(const struct rt_nexthop *, const struct rt_nexthop *); ! olsr_bool olsr_cmp_rt(const struct rt_entry *, const struct rt_entry *); void olsr_calculate_hna_routes(void); ! char *olsr_rt_to_string(const struct rt_entry *); ! char *olsr_rtp_to_string(const struct rt_path *); ! void olsr_print_routing_table(const struct avl_tree *); const struct rt_nexthop * olsr_get_nh(const struct rt_entry *); Index: process_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** process_routes.c 8 Nov 2007 22:47:41 -0000 1.38 --- process_routes.c 11 Nov 2007 23:10:25 -0000 1.39 *************** *** 59,63 **** { olsr_u8_t type; /* AF_INET/AF_INET6 */ ! int (*function)(struct rt_entry*); struct export_route_entry *next; }; --- 59,63 ---- { olsr_u8_t type; /* AF_INET/AF_INET6 */ ! export_route_function function; struct export_route_entry *next; }; *************** *** 67,73 **** static struct export_route_entry *del_routes; ! struct list_node add_kernel_list; ! struct list_node chg_kernel_list; ! struct list_node del_kernel_list; /** --- 67,74 ---- static struct export_route_entry *del_routes; ! static struct list_node add_kernel_list; ! static struct list_node chg_kernel_list; ! static struct list_node del_kernel_list; ! /** *************** *** 81,87 **** { const struct rt_nexthop *nh; ! olsr_u8_t flags; ! ! flags = (RTF_UP); if (rt->rt_dst.prefix_len == olsr_cnf->maxplen) { --- 82,86 ---- { const struct rt_nexthop *nh; ! olsr_u8_t flags = RTF_UP; if (rt->rt_dst.prefix_len == olsr_cnf->maxplen) { *************** *** 98,238 **** } ! void ! olsr_addroute_add_function(int (*function)(struct rt_entry*), olsr_u8_t type) { ! struct export_route_entry *tmp; ! tmp = olsr_malloc(sizeof *tmp, "olsr_addroute_add_function"); tmp->type = type; tmp->function = function; ! tmp->next = add_routes; ! add_routes = tmp; } void ! olsr_delroute_add_function(int (*function) (struct rt_entry*), olsr_u8_t type) { ! struct export_route_entry *tmp; ! tmp = olsr_malloc(sizeof *tmp, "olsr_delroute_add_function"); ! tmp->type = type; ! tmp->function = function; ! tmp->next = del_routes; ! del_routes = tmp; } ! ! int ! olsr_addroute_remove_function(int (*function) (struct rt_entry*), olsr_u8_t type) { ! struct export_route_entry *tmp, *prev = NULL /* Make compiler happy */; ! tmp = add_routes; ! while (tmp) ! { ! if (function == tmp->function && type == tmp->type) ! { ! if (tmp == add_routes) ! { ! add_routes = add_routes->next; ! free (tmp); ! return 1; ! } ! else ! { ! prev->next = tmp->next; ! free (tmp); ! return 1; ! } ! } ! prev = tmp; ! tmp = tmp->next; ! } ! return 0; } ! int ! olsr_delroute_remove_function(int (*function) (struct rt_entry*), olsr_u8_t type) { ! struct export_route_entry *tmp, *prev = NULL /* Make compiler happy */; ! tmp = del_routes; ! while (tmp) ! { ! if (function == tmp->function && type == tmp->type) ! { ! if (tmp == del_routes) ! { ! del_routes = del_routes->next; ! free (tmp); ! return 1; ! } ! else ! { ! prev->next = tmp->next; ! free (tmp); ! return 1; ! } ! } ! prev = tmp; ! tmp = tmp->next; } return 0; } ! void ! olsr_init_export_route(void) { ! olsr_addroute_add_function(&olsr_ioctl_add_route, AF_INET); ! olsr_addroute_add_function(&olsr_ioctl_add_route6, AF_INET6); ! olsr_delroute_add_function(&olsr_ioctl_del_route, AF_INET); ! olsr_delroute_add_function(&olsr_ioctl_del_route6, AF_INET6); } int ! olsr_export_add_route (struct rt_entry *rt) { ! int retval = 0; ! struct export_route_entry *tmp; ! for (tmp = add_routes; tmp; tmp = tmp->next) ! { ! if (tmp->type == AF_INET) ! retval = tmp->function(rt); ! } ! return retval; } - int - olsr_export_add_route6 (struct rt_entry *rt) - { - int retval = 0; - struct export_route_entry *tmp; - for (tmp = add_routes; tmp; tmp = tmp->next) - { - if (tmp->type == AF_INET6) - retval = tmp->function(rt); - } - return retval; - } ! int ! olsr_export_del_route (struct rt_entry *rt) { ! int retval = 0; ! struct export_route_entry *tmp; ! for (tmp = del_routes; tmp; tmp = tmp->next) ! { ! if (tmp->type == AF_INET) ! retval = tmp->function(rt); ! } ! return retval; } ! int ! olsr_export_del_route6 (struct rt_entry *rt) { int retval = 0; struct export_route_entry *tmp; ! for (tmp = del_routes; tmp; tmp = tmp->next) ! { ! if (tmp->type == AF_INET6) ! retval = tmp->function(rt); } return retval; } --- 97,179 ---- } ! ! static void ! olsr_route_add_function(struct export_route_entry **routes, export_route_function function, olsr_u8_t type) { ! struct export_route_entry *tmp = olsr_malloc(sizeof(*tmp), __func__); tmp->type = type; tmp->function = function; ! tmp->next = *routes; ! *routes = tmp; } void ! olsr_addroute_add_function(export_route_function function, olsr_u8_t type) { ! olsr_route_add_function(&add_routes, function, type); } ! void ! olsr_delroute_add_function(export_route_function function, olsr_u8_t type) { ! olsr_route_add_function(&del_routes, function, type); } ! ! static int ! olsr_route_remove_function(struct export_route_entry **routes, export_route_function function, olsr_u8_t type) { ! struct export_route_entry *tmp, *prev; ! for (tmp = *routes, prev = NULL; tmp != NULL; prev = tmp, tmp = tmp->next) { ! if (function == tmp->function && type == tmp->type) { ! if (prev == NULL) { /* i.e. tmp == *routes */ ! *routes = (*routes)->next; ! } else { ! prev->next = tmp->next; ! } ! free(tmp); ! return 1; } + } return 0; } ! int ! olsr_addroute_remove_function(export_route_function function, olsr_u8_t type) { ! return olsr_route_remove_function(&add_routes, function, type); } int ! olsr_delroute_remove_function(export_route_function function, olsr_u8_t type) { ! return olsr_route_remove_function(&del_routes, function, type); } ! void ! olsr_init_export_route(void) { ! /* the add/chg/del kernel queues */ ! list_head_init(&add_kernel_list); ! list_head_init(&chg_kernel_list); ! list_head_init(&del_kernel_list); ! ! olsr_addroute_add_function(&olsr_ioctl_add_route, AF_INET); ! olsr_addroute_add_function(&olsr_ioctl_add_route6, AF_INET6); ! olsr_delroute_add_function(&olsr_ioctl_del_route, AF_INET); ! olsr_delroute_add_function(&olsr_ioctl_del_route6, AF_INET6); } ! static int ! olsr_export_route(struct export_route_entry *routes, const struct rt_entry *rt, int ip_version) { int retval = 0; struct export_route_entry *tmp; ! for (tmp = routes; tmp != NULL; tmp = tmp->next) { ! if (tmp->type == ip_version) { ! retval = tmp->function(rt); } + } return retval; } *************** *** 247,251 **** *@return 1 */ ! int olsr_delete_all_kernel_routes(void) { --- 188,192 ---- *@return 1 */ ! void olsr_delete_all_kernel_routes(void) { *************** *** 254,259 **** olsr_bump_routingtree_version(); olsr_update_kernel_routes(); - - return 1; } --- 195,198 ---- *************** *** 294,306 **** olsr_delete_kernel_route(struct rt_entry *rt) { - olsr_16_t error; - if(!olsr_cnf->host_emul) { ! ! if(olsr_cnf->ip_version == AF_INET) { ! error = olsr_export_del_route(rt); ! } else { ! error = olsr_export_del_route6(rt); ! } if(error < 0) { --- 233,238 ---- olsr_delete_kernel_route(struct rt_entry *rt) { if(!olsr_cnf->host_emul) { ! olsr_16_t error = olsr_export_route(del_routes, rt, olsr_cnf->ip_version); if(error < 0) { *************** *** 324,337 **** olsr_add_kernel_route(struct rt_entry *rt) { - olsr_16_t error; if(!olsr_cnf->host_emul) { - if(olsr_cnf->ip_version == AF_INET) { - error = olsr_export_add_route(rt); - } else { - error = olsr_export_add_route6(rt); - } - if(error < 0) { const char * const err_msg = strerror(errno); --- 256,263 ---- olsr_add_kernel_route(struct rt_entry *rt) { if(!olsr_cnf->host_emul) { + olsr_16_t error = olsr_export_route(add_routes, rt, olsr_cnf->ip_version); if(error < 0) { const char * const err_msg = strerror(errno); *************** *** 360,368 **** olsr_add_kernel_routes(struct list_node *head_node) { - struct rt_entry *rt; - while (!list_is_empty(head_node)) { ! ! rt = head_node->next->data; olsr_add_kernel_route(rt); --- 286,291 ---- olsr_add_kernel_routes(struct list_node *head_node) { while (!list_is_empty(head_node)) { ! struct rt_entry *rt = head_node->next->data; olsr_add_kernel_route(rt); *************** *** 381,385 **** olsr_chg_kernel_routes(struct list_node *head_node) { - struct rt_entry *rt; struct list_node *node; --- 304,307 ---- *************** *** 394,399 **** */ for (node = head_node->prev; head_node != node; node = node->prev) { ! ! rt = node->data; olsr_delete_kernel_route(rt); } --- 316,320 ---- */ for (node = head_node->prev; head_node != node; node = node->prev) { ! struct rt_entry *rt = node->data; olsr_delete_kernel_route(rt); } *************** *** 405,410 **** */ while (!list_is_empty(head_node)) { ! ! rt = head_node->next->data; olsr_add_kernel_route(rt); --- 326,330 ---- */ while (!list_is_empty(head_node)) { ! struct rt_entry *rt = head_node->next->data; olsr_add_kernel_route(rt); *************** *** 423,431 **** olsr_del_kernel_routes(struct list_node *head_node) { - struct rt_entry *rt; - while (!list_is_empty(head_node)) { ! ! rt = head_node->prev->data; olsr_delete_kernel_route(rt); --- 343,348 ---- olsr_del_kernel_routes(struct list_node *head_node) { while (!list_is_empty(head_node)) { ! struct rt_entry *rt = head_node->prev->data; olsr_delete_kernel_route(rt); *************** *** 447,451 **** for (rtp_tree_node = avl_walk_first(&rt->rt_path_tree); ! rtp_tree_node; rtp_tree_node = next_rtp_tree_node) { --- 364,368 ---- for (rtp_tree_node = avl_walk_first(&rt->rt_path_tree); ! rtp_tree_node != NULL; rtp_tree_node = next_rtp_tree_node) { Index: process_routes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** process_routes.h 16 Sep 2007 21:14:25 -0000 1.12 --- process_routes.h 11 Nov 2007 23:10:25 -0000 1.13 *************** *** 40,54 **** */ - #include "routing_table.h" - - #ifndef _OLSR_PROCESS_RT #define _OLSR_PROCESS_RT #include ! extern struct list_node add_kernel_list; ! extern struct list_node chg_kernel_list; ! extern struct list_node del_kernel_list; void --- 40,50 ---- */ #ifndef _OLSR_PROCESS_RT #define _OLSR_PROCESS_RT + #include "routing_table.h" #include ! typedef int (*export_route_function)(const struct rt_entry*); void *************** *** 56,86 **** void ! olsr_addroute_add_function(int (*)(struct rt_entry*), olsr_u8_t); int ! olsr_addroute_remove_function(int (*)(struct rt_entry*), olsr_u8_t); void ! olsr_delroute_add_function(int (*)(struct rt_entry*), olsr_u8_t); ! ! int ! olsr_delroute_remove_function(int (*)(struct rt_entry*), olsr_u8_t); ! ! int ! olsr_export_add_route (struct rt_entry*); ! ! int ! olsr_export_del_route (struct rt_entry*); ! ! int ! olsr_export_add_route6 (struct rt_entry*); int ! olsr_export_del_route6 (struct rt_entry*); void olsr_update_kernel_routes(void); ! int olsr_delete_all_kernel_routes(void); --- 52,70 ---- void ! olsr_addroute_add_function(export_route_function, olsr_u8_t); int ! olsr_addroute_remove_function(export_route_function, olsr_u8_t); void ! olsr_delroute_add_function(export_route_function, olsr_u8_t); int ! olsr_delroute_remove_function(export_route_function, olsr_u8_t); void olsr_update_kernel_routes(void); ! void olsr_delete_all_kernel_routes(void); Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** routing_table.c 8 Nov 2007 22:47:41 -0000 1.33 --- routing_table.c 11 Nov 2007 23:10:24 -0000 1.34 *************** *** 69,73 **** olsr_bump_routingtree_version(void) { ! return(routingtree_version++); } --- 69,73 ---- olsr_bump_routingtree_version(void) { ! return routingtree_version++; } *************** *** 87,96 **** const struct olsr_ip_prefix *pfx1 = prefix1; const struct olsr_ip_prefix *pfx2 = prefix2; /* prefix */ ! if (pfx1->prefix.v4.s_addr < pfx2->prefix.v4.s_addr) { return -1; } ! if (pfx1->prefix.v4.s_addr > pfx2->prefix.v4.s_addr) { return +1; } --- 87,98 ---- const struct olsr_ip_prefix *pfx1 = prefix1; const struct olsr_ip_prefix *pfx2 = prefix2; + const olsr_u32_t addr1 = ntohl(pfx1->prefix.v4.s_addr); + const olsr_u32_t addr2 = ntohl(pfx2->prefix.v4.s_addr); /* prefix */ ! if (addr1 < addr2) { return -1; } ! if (addr1 > addr2) { return +1; } *************** *** 143,147 **** * Initialize the routingtree and kernel change queues. */ ! int olsr_init_routing_table(void) { --- 145,149 ---- * Initialize the routingtree and kernel change queues. */ ! void olsr_init_routing_table(void) { *************** *** 149,159 **** avl_init(&routingtree, avl_comp_prefix_default); routingtree_version = 0; - - /* the add/chg/del kernel queues */ - list_head_init(&add_kernel_list); - list_head_init(&chg_kernel_list); - list_head_init(&del_kernel_list); - - return 1; } --- 151,154 ---- *************** *** 177,181 **** rt_tree_node = avl_find(&routingtree, &prefix); ! return (rt_tree_node ? rt_tree_node->data : NULL); } --- 172,176 ---- rt_tree_node = avl_find(&routingtree, &prefix); ! return rt_tree_node ? rt_tree_node->data : NULL; } *************** *** 215,227 **** olsr_alloc_rt_entry(struct olsr_ip_prefix *prefix) { ! struct rt_entry *rt; ! ! rt = olsr_malloc(sizeof(struct rt_entry), __FUNCTION__); ! if (!rt) { return NULL; } ! memset(rt, 0, sizeof(struct rt_entry)); /* Mark this entry as fresh (see process_routes.c:512) */ --- 210,219 ---- olsr_alloc_rt_entry(struct olsr_ip_prefix *prefix) { ! struct rt_entry *rt = olsr_malloc(sizeof(struct rt_entry), __FUNCTION__); if (!rt) { return NULL; } ! memset(rt, 0, sizeof(*rt)); /* Mark this entry as fresh (see process_routes.c:512) */ *************** *** 249,255 **** union olsr_ip_addr *originator) { ! struct rt_path *rtp; ! ! rtp = olsr_malloc(sizeof(struct rt_path), __FUNCTION__); if (!rtp) { --- 241,245 ---- union olsr_ip_addr *originator) { ! struct rt_path *rtp = olsr_malloc(sizeof(struct rt_path), __FUNCTION__); if (!rtp) { *************** *** 257,261 **** } ! memset(rtp, 0, sizeof(struct rt_path)); //COPY_IP(&rtp->rtp_originator, originator); --- 247,251 ---- } ! memset(rtp, 0, sizeof(*rtp)); //COPY_IP(&rtp->rtp_originator, originator); *************** *** 279,283 **** */ olsr_bool ! olsr_nh_change(struct rt_nexthop *nh1, struct rt_nexthop *nh2) { if (!ipequal(&nh1->gateway, &nh2->gateway) || --- 269,273 ---- */ olsr_bool ! olsr_nh_change(const struct rt_nexthop *nh1, const struct rt_nexthop *nh2) { if (!ipequal(&nh1->gateway, &nh2->gateway) || *************** *** 313,317 **** */ static olsr_bool ! olsr_cmp_rtp(struct rt_path *rtp1, struct rt_path *rtp2) { /* etx comes first */ --- 303,307 ---- */ static olsr_bool ! olsr_cmp_rtp(const struct rt_path *rtp1, const struct rt_path *rtp2) { /* etx comes first */ *************** *** 343,349 **** */ olsr_bool ! olsr_cmp_rt(struct rt_entry *rt1, struct rt_entry *rt2) { ! return(olsr_cmp_rtp(rt1->rt_best, rt2->rt_best)); } --- 333,339 ---- */ olsr_bool ! olsr_cmp_rt(const struct rt_entry *rt1, const struct rt_entry *rt2) { ! return olsr_cmp_rtp(rt1->rt_best, rt2->rt_best); } *************** *** 355,363 **** olsr_rt_best(struct rt_entry *rt) { - struct rt_path *rtp; - struct avl_node *node; - /* grab the first entry */ ! node = avl_walk_first(&rt->rt_path_tree); assert(node != 0); /* should not happen */ --- 345,350 ---- olsr_rt_best(struct rt_entry *rt) { /* grab the first entry */ ! struct avl_node *node = avl_walk_first(&rt->rt_path_tree); assert(node != 0); /* should not happen */ *************** *** 367,372 **** /* walk all remaining originator entries */ while ((node = avl_walk_next(node))) { ! ! rtp = node->data; if (olsr_cmp_rtp(rtp, rt->rt_best)) { --- 354,358 ---- /* walk all remaining originator entries */ while ((node = avl_walk_next(node))) { ! struct rt_path *rtp = node->data; if (olsr_cmp_rtp(rtp, rt->rt_best)) { *************** *** 466,470 **** */ char * ! olsr_rt_to_string(struct rt_entry *rt) { static char buff[128]; --- 452,456 ---- */ char * ! olsr_rt_to_string(const struct rt_entry *rt) { static char buff[128]; *************** *** 484,488 **** */ char * ! olsr_rtp_to_string(struct rt_path *rtp) { static char buff[128]; --- 470,474 ---- */ char * ! olsr_rtp_to_string(const struct rt_path *rtp) { static char buff[128]; *************** *** 511,516 **** olsr_calculate_hna_routes(void) { ! int index, plen; ! struct rt_entry *rt; #ifdef DEBUG --- 497,501 ---- olsr_calculate_hna_routes(void) { ! int idx; #ifdef DEBUG *************** *** 518,548 **** #endif ! for(index=0;indexnext) ! { struct hna_net *tmp_net; /* All networks */ ! for(tmp_net = tmp_hna->networks.next; ! tmp_net != &tmp_hna->networks; ! tmp_net = tmp_net->next) { ! /* If no route to gateway - skip */ ! if((rt = olsr_lookup_routing_table(&tmp_hna->A_gateway_addr)) == NULL) ! continue; ! ! /* update if better */ ! plen = olsr_get_hna_prefix_len(tmp_net); ! olsr_insert_routing_table(&tmp_net->A_network_addr, plen, ! &tmp_hna->A_gateway_addr, ! &rt->rt_best->rtp_nexthop.gateway, ! rt->rt_best->rtp_nexthop.iif_index, ! rt->rt_best->rtp_metric.hops, ! rt->rt_best->rtp_metric.etx); ! } } --- 503,525 ---- #endif ! for (idx = 0; idx < HASHSIZE; idx++) { struct hna_entry *tmp_hna; /* All entries */ ! for (tmp_hna = hna_set[idx].next; tmp_hna != &hna_set[idx]; tmp_hna = tmp_hna->next) { struct hna_net *tmp_net; /* All networks */ ! for (tmp_net = tmp_hna->networks.next; tmp_net != &tmp_hna->networks; tmp_net = tmp_net->next) { /* If no route to gateway - skip */ ! struct rt_entry *rt = olsr_lookup_routing_table(&tmp_hna->A_gateway_addr); ! if (rt != NULL) { ! /* update if better */ ! olsr_insert_routing_table(&tmp_net->A_network_addr, ! olsr_get_hna_prefix_len(tmp_net), ! &tmp_hna->A_gateway_addr, ! &rt->rt_best->rtp_nexthop.gateway, ! rt->rt_best->rtp_nexthop.iif_index, ! rt->rt_best->rtp_metric.hops, ! rt->rt_best->rtp_metric.etx); ! } } } *************** *** 558,573 **** */ void ! olsr_print_routing_table(struct avl_tree *tree) { ! struct avl_node *rt_tree_node; printf("ROUTING TABLE\n"); ! for (rt_tree_node = avl_walk_first(tree); ! rt_tree_node; ! rt_tree_node = avl_walk_next(rt_tree_node)) { ! struct avl_node *rtp_tree_node; struct ipaddr_str prefixstr, origstr, gwstr; ! struct rt_entry * const rt = rt_tree_node->data; /* first the route entry */ --- 535,550 ---- */ void ! olsr_print_routing_table(const struct avl_tree *tree) { ! const struct avl_node *rt_tree_node; printf("ROUTING TABLE\n"); ! for (rt_tree_node = avl_walk_first_c(tree); ! rt_tree_node != NULL; ! rt_tree_node = avl_walk_next_c(rt_tree_node)) { ! const struct avl_node *rtp_tree_node; struct ipaddr_str prefixstr, origstr, gwstr; ! const struct rt_entry * const rt = rt_tree_node->data; /* first the route entry */ *************** *** 579,586 **** /* walk the per-originator path tree of routes */ ! for (rtp_tree_node = avl_walk_first(&rt->rt_path_tree); ! rtp_tree_node; ! rtp_tree_node = avl_walk_next(rtp_tree_node)) { ! const struct rt_path * const rtp = rtp_tree_node->data; printf("\tfrom %s, etx %.3f, metric %u, via %s, %s, v %u\n", --- 556,562 ---- /* walk the per-originator path tree of routes */ ! for (rtp_tree_node = avl_walk_first_c(&rt->rt_path_tree); ! rtp_tree_node != NULL; ! rtp_tree_node = avl_walk_next_c(rtp_tree_node)) { const struct rt_path * const rtp = rtp_tree_node->data; printf("\tfrom %s, etx %.3f, metric %u, via %s, %s, v %u\n", From (spam-protected) Mon Nov 12 00:25:31 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 11 Nov 2007 23:25:31 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.112,1.113 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19999 Modified Files: CHANGELOG Log Message: * and something for the CHANGELOG Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** CHANGELOG 8 Nov 2007 22:47:39 -0000 1.112 --- CHANGELOG 11 Nov 2007 23:25:29 -0000 1.113 *************** *** 91,98 **** --- 91,121 ---- as "struct sockaddr_in" since it is that what we actually want there (and it is similar to the IPv6 code). + - updated the olsrd.conf.default.lq-fisheye to the Debian-deliverd version + after recent discussions olsr-dev at olsr.org - use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()" - clean up the routes on more signals. Basically we want to do this on all signals which terminate the program. - killed a superflous global buffer in src/main.c + - made inline functions from avl_walk_{first,last,next,prev} and created + "const" versions of it. inline_avl_comp_ipv4() is now also an inline function + (and not a macro) + - created a typedef's for various function pointers - much easier to read. + - cleanup: compare tree->comp (adn other pointers)) to NULL (and not 0) + - killed superflous "return"s at the end of void functions + - const'ified more parameters in many more functions in the .h and + .c files + - init-functions with constant or ignored return values are "void" + - created a typedef fro the callback in "struct export_route_entry" + and using it! + - moved the initialization of the {add,chg,del}_kernel_list variables + into process_routes.c. So they are now "static" there. + - olsr_export_{add,del}_route{,6} are now static in process_routes.c + since they are not used elsewhere. + - olsr_addroute_add_function() and olsr_deldroute_add_function() were + almost identical - made one function out of it. + Same for olsr_addroute_del_function() and olsr_deldroute_del_function(). + - fixed the sort order in avl_comp_ipv4_prefix(): We compare now the IPv4 + values in host byte order (and not network byte order). So the route + list in the e.g. httpinfo plugin is now nicely sorted. 0.5.4 --------------------------------------------------------------------- From (spam-protected) Mon Nov 12 01:12:17 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 12 Nov 2007 00:12:17 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG, 1.113, 1.114 gcc-warnings, 1.5, 1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6618 Modified Files: CHANGELOG gcc-warnings Log Message: fixed and improved the `gcc-warnings` script: * support older gcc's (as on Debian/Sarge) as they have slightly different error messages * removed superflous lines * replaced the call of `sed` with shell built-in features fixing syntax errors on Debian/Sarge * set all locale-relevant variables to "C" (just to be sure) Index: gcc-warnings =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gcc-warnings,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gcc-warnings 4 Nov 2007 18:45:30 -0000 1.5 --- gcc-warnings 12 Nov 2007 00:12:15 -0000 1.6 *************** *** 9,12 **** --- 9,15 ---- #set -vx + # make sure we do not use some locale .... + export LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C LC_MESSAGES=C LC_NUMERIC=C + OPTS="" for param; do *************** *** 28,37 **** while read error; do case "$error" in ! *error:\ unrecognized\ *option*) ! opt="${error#*\`}" ! opt="${opt%\'*}" opt="${error#*\"}" opt="${opt%\"*}" ! OPTS=`echo $OPTS | sed -e s/$opt//g` ;; esac --- 31,43 ---- while read error; do case "$error" in ! *error:\ unrecognized\ *option\ \"*) opt="${error#*\"}" opt="${opt%\"*}" ! OPTS="${OPTS//$opt}" ! ;; ! *error:\ unrecognized\ *option\ \`*) ! opt="${error#*\`}" ! opt="${opt%\'*}" ! OPTS="${OPTS//$opt}" ;; esac Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** CHANGELOG 11 Nov 2007 23:25:29 -0000 1.113 --- CHANGELOG 12 Nov 2007 00:12:15 -0000 1.114 *************** *** 118,121 **** --- 118,128 ---- values in host byte order (and not network byte order). So the route list in the e.g. httpinfo plugin is now nicely sorted. + - fixed and improved the `gcc-warnings` script: + * support older gcc's (as on Debian/Sarge) as they have slightly different + error messages + * removed superflous lines + * replaced the call of `sed` with shell built-in features fixing syntax + errors on Debian/Sarge + * set all locale-relevant variables to "C" (just to be sure) 0.5.4 --------------------------------------------------------------------- From (spam-protected) Wed Nov 14 12:01:05 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 14 Nov 2007 11:01:05 +0000 Subject: [Olsr-cvs] olsrd-current/src net_olsr.c,1.32,1.33 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25997/src Modified Files: net_olsr.c Log Message: * fixed a bug in the olsr_netmask_to_prefix() function which produced invalid netmasks if feeded with 255.255.255.255. Thnaks to Hannes Gredler for pointing to that function. * replaced the second "(for()" loop with a simple "switch()" for the 9 legal/valid/supported values of 1 byte netmasks. So we can now detect illegal ones and report this with returning UINT_MAX as prefix length (and writing something out). That really shouldn't happen but God knows what some clowns sends over the net to annoy us. Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** net_olsr.c 8 Nov 2007 22:47:41 -0000 1.32 --- net_olsr.c 14 Nov 2007 11:01:03 -0000 1.33 *************** *** 498,506 **** olsr_netmask_to_prefix(const union olsr_ip_addr *adr) { - #if !defined(NODEBUG) && defined(DEBUG) struct ipaddr_str buf; - #endif olsr_u16_t prefix = 0; - olsr_u8_t tmp; const olsr_u8_t * const a_end = adr->v6.s6_addr+olsr_cnf->ipsize; const olsr_u8_t *a; --- 498,503 ---- *************** *** 509,520 **** prefix += 8; } ! for (tmp = *a; tmp > 0; tmp <<= 1) { ! prefix++; } - #ifdef DEBUG OLSR_PRINTF(3, "Netmask: %s = Prefix %d\n", olsr_ip_to_string(&buf, adr), prefix); #endif - return prefix; } --- 506,530 ---- prefix += 8; } ! if (a < a_end) { ! /* handle the last byte */ ! switch (*a) { ! case 0: prefix += 0; break; ! case 128: prefix += 1; break; ! case 192: prefix += 2; break; ! case 224: prefix += 3; break; ! case 240: prefix += 4; break; ! case 248: prefix += 5; break; ! case 252: prefix += 6; break; ! case 254: prefix += 7; break; ! case 255: prefix += 8; break; /* Shouldn't happen */ ! default: ! OLSR_PRINTF(0, "%s: Got bogus netmask %s\n", __func__, olsr_ip_to_string(&buf, adr)); ! prefix = USHRT_MAX; ! break; ! } } #ifdef DEBUG OLSR_PRINTF(3, "Netmask: %s = Prefix %d\n", olsr_ip_to_string(&buf, adr), prefix); #endif return prefix; } From (spam-protected) Wed Nov 14 12:03:54 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 14 Nov 2007 11:03:54 +0000 Subject: [Olsr-cvs] olsrd-current/src routing_table.c,1.34,1.35 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28409/src Modified Files: routing_table.c Log Message: Patch by Hannes Gredler to avoid setting routes with an invalid impossible netmask. Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** routing_table.c 11 Nov 2007 23:10:24 -0000 1.34 --- routing_table.c 14 Nov 2007 11:03:52 -0000 1.35 *************** *** 404,407 **** --- 404,414 ---- /* + * No bogus prefix lengths. + */ + if (plen > olsr_cnf->maxplen) { + return NULL; + } + + /* * first check if there is a route_entry for the prefix. */ *************** *** 539,543 **** --- 546,552 ---- const struct avl_node *rt_tree_node; + #ifdef DEBUG printf("ROUTING TABLE\n"); + #endif for (rt_tree_node = avl_walk_first_c(tree); From (spam-protected) Wed Nov 14 12:08:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 14 Nov 2007 11:08:07 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.114,1.115 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30292 Modified Files: CHANGELOG Log Message: * and somethigng here too Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** CHANGELOG 12 Nov 2007 00:12:15 -0000 1.114 --- CHANGELOG 14 Nov 2007 11:08:05 -0000 1.115 *************** *** 4,8 **** 0.5.5 --------------------------------------------------------------------- ! BUGFIX by Hannes Gredler fixing not deleted tc entry. PATCH by John Hay : --- 4,10 ---- 0.5.5 --------------------------------------------------------------------- ! BUGFIX by Hannes Gredler ! - fix not deleted tc entry. ! - avoid setting routes with an invalid/impossible netmask. PATCH by John Hay : From (spam-protected) Thu Nov 15 01:35:34 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 15 Nov 2007 00:35:34 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src gfx.h, 1.3, 1.4 olsrd_httpinfo.c, 1.85, 1.86 html.h, 1.11, NONE Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24798/lib/httpinfo/src Modified Files: gfx.h olsrd_httpinfo.c Removed Files: html.h Log Message: cleanup: merged html.h into the places where it is used since it is much easier to see what's going on cleanup: avoid hard-coded values and use sizeof() fixed the generated html Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** olsrd_httpinfo.c 11 Nov 2007 22:00:39 -0000 1.85 --- olsrd_httpinfo.c 15 Nov 2007 00:35:32 -0000 1.86 *************** *** 66,70 **** #include "olsrd_httpinfo.h" #include "admin_interface.h" - #include "html.h" #include "gfx.h" --- 66,69 ---- *************** *** 98,102 **** #define HTML_BUFSIZE (1024 * 4000) ! #define FRAMEWIDTH 800 #define FILENREQ_MATCH(req, filename) \ --- 97,101 ---- #define HTML_BUFSIZE (1024 * 4000) ! #define FRAMEWIDTH (resolve_ip_addresses ? 900 : 800) #define FILENREQ_MATCH(req, filename) \ *************** *** 104,107 **** --- 103,139 ---- (strlen(req) && !strcmp(&req[1], filename)) + 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" + "h2\n {\nfont-family: Helvetica;\n font-size: 14px;text-align: center;\n" + "line-height: 16px;\ntext-decoration: none;\nborder: 1px solid #ccc;\n" + "margin: 5px;\nbackground: #ececec;\n}\n" + "hr\n{\nborder: none;\npadding: 1px;\nbackground: url(grayline.gif) repeat-x bottom;\n}\n" + "#maintable\n{\nmargin: 0px;\npadding: 5px;\nborder-left: 1px solid #ccc;\n" + "border-right: 1px solid #ccc;\nborder-bottom: 1px solid #ccc;\n}\n" + "#footer\n{\nfont-size: 10px;\nline-height: 14px;\ntext-decoration: none;\ncolor: #666;\n}\n" + "#hdr\n{\nfont-size: 14px;\ntext-align: center;\nline-height: 16px;\n" + "text-decoration: none;\nborder: 1px solid #ccc;\n" + "margin: 5px;\nbackground: #ececec;\n}\n" + "#container\n{\nwidth: 1000px;\npadding: 30px;\nborder: 1px solid #ccc;\nbackground: #fff;\n}\n" + "#tabnav\n{\nheight: 20px;\nmargin: 0;\npadding-left: 10px;\n" + "background: url(grayline.gif) repeat-x bottom;\n}\n" + "#tabnav li\n{\nmargin: 0;\npadding: 0;\ndisplay: inline;\nlist-style-type: none;\n}\n" + "#tabnav a:link, #tabnav a:visited\n{\nfloat: left;\nbackground: #ececec;\n" + "font-size: 12px;\nline-height: 14px;\nfont-weight: bold;\npadding: 2px 10px 2px 10px;\n" + "margin-right: 4px;\nborder: 1px solid #ccc;\ntext-decoration: none;\ncolor: #777;\n}\n" + "#tabnav a:link.active, #tabnav a:visited.active\n{\nborder-bottom: 1px solid #fff;\n" + "background: #ffffff;\ncolor: #000;\n}\n" + "#tabnav a:hover\n{\nbackground: #777777;\ncolor: #ffffff;\n}\n" + ".input_text\n{\nbackground: #E5E5E5;\nmargin-left: 5px; margin-top: 0px;\n" + "text-align: left;\n\nwidth: 100px;\npadding: 0px;\ncolor: #000000;\n" + "text-decoration: none;\nfont-family: verdana;\nfont-size: 12px;\n" + "border: 1px solid #ccc;\n}\n" + ".input_button\n{\nbackground: #B5D1EE;\nmargin-left: 5px;\nmargin-top: 0px;\n" + "text-align: center;\nwidth: 120px;\npadding: 0px;\ncolor: #000000;\n" + "text-decoration: none;\nfont-family: verdana;\nfont-size: 12px;\n" + "border: 1px solid #000;\n}\n"; + struct tab_entry { *************** *** 122,126 **** { char *filename; ! const char **data; }; --- 154,158 ---- { char *filename; ! const char *data; }; *************** *** 199,205 **** --- 231,243 ---- static const struct static_bin_file_entry static_bin_files[] = { + #if 0 {"favicon.ico", favicon_ico, 1406/*favicon_ico_len*/}, {"logo.gif", logo_gif, 2801/*logo_gif_len*/}, {"grayline.gif", grayline_gif, 43/*grayline_gif_len*/}, + #else + {"favicon.ico", favicon_ico, sizeof(favicon_ico)}, + {"logo.gif", logo_gif, sizeof(logo_gif)}, + {"grayline.gif", grayline_gif, sizeof(grayline_gif)}, + #endif {NULL, NULL, 0} }; *************** *** 385,395 **** } else if (!strcmp(req_type, "GET")) { int i = 0; - int y = 0; ! while (static_bin_files[i].filename) { if (FILENREQ_MATCH(filename, static_bin_files[i].filename)) { break; } - i++; } --- 423,431 ---- } else if (!strcmp(req_type, "GET")) { int i = 0; ! for (i = 0; static_bin_files[i].filename; i++) { if (FILENREQ_MATCH(filename, static_bin_files[i].filename)) { break; } } *************** *** 412,420 **** if (static_txt_files[i].filename) { stats.ok_hits++; ! y = 0; ! while (static_txt_files[i].data[y]) { ! size += snprintf(&body[size], sizeof(body)-size, static_txt_files[i].data[y]); ! y++; ! } c = build_http_header(HTTP_OK, OLSR_FALSE, size, req, sizeof(req)); goto send_http_data; --- 448,452 ---- if (static_txt_files[i].filename) { stats.ok_hits++; ! size += snprintf(&body[size], sizeof(body)-size, "%s", static_txt_files[i].data); c = build_http_header(HTTP_OK, OLSR_FALSE, size, req, sizeof(req)); goto send_http_data; *************** *** 442,446 **** netsprintf_direct = 1; #endif ! size += snprintf(&body[size], sizeof(body)-size, "%s", http_ok_head); size += build_tabs(&body[size], sizeof(body)-size, i); --- 474,497 ---- netsprintf_direct = 1; #endif ! size += snprintf(&body[size], sizeof(body)-size, ! "\n" ! "\n" ! "\n" ! "olsr.org httpinfo plugin\n" ! "\n" ! "\n" ! "\n" ! "\n" ! "\n" ! "\n" ! "\n" ! "\n" ! "\n" ! "\n" ! "\n" ! "
\n" ! "   olsr.org OLSR daemon\n" ! "\"olsrd
\n", ! FRAMEWIDTH); size += build_tabs(&body[size], sizeof(body)-size, i); *************** *** 454,458 **** stats.ok_hits++; ! size += snprintf(&body[size], sizeof(body)-size, http_ok_tail); #ifdef NETDIRECT --- 505,518 ---- stats.ok_hits++; ! size += snprintf(&body[size], sizeof(body)-size, ! "\n" ! "
\n" ! "
\n" ! "(C)2005 Andreas Tønnesen
\n" ! "http://www.olsr.org\n" ! "
\n" ! "
\n" ! "\n" ! "\n"); #ifdef NETDIRECT *************** *** 562,566 **** int size = 0, tabs = 0; ! size += snprintf(&buf[size], bufsize-size, html_tabs_prolog); for (tabs = 0; tab_entries[tabs].tab_label; tabs++) { if (!tab_entries[tabs].display_tab) { --- 622,630 ---- int size = 0, tabs = 0; ! size += snprintf(&buf[size], bufsize-size, ! "\n" ! "\n" ! "", rt->rt_best->rtp_metric.etx); size += snprintf(&buf[size], bufsize-size, --- 768,772 ---- rt->rt_best->rtp_metric.hops); size += snprintf(&buf[size], bufsize-size, ! "", rt->rt_best->rtp_metric.etx); size += snprintf(&buf[size], bufsize-size, *************** *** 713,722 **** int size = 0; struct rt_entry *rt; ! const char *s = resolve_ip_addresses ? " colspan=\"2\"" : ""; size += section_title(&buf[size], bufsize-size, "OLSR Routes in Kernel"); ! size += snprintf(&buf[size], bufsize-size, ! "DestinationGateway\n", ! s, ! s); /* Walk the route table */ --- 780,786 ---- int size = 0; struct rt_entry *rt; ! const char *colspan = resolve_ip_addresses ? " colspan=\"2\"" : ""; size += section_title(&buf[size], bufsize-size, "OLSR Routes in Kernel"); ! size += snprintf(&buf[size], bufsize-size, "\n", colspan, colspan); /* Walk the route table */ *************** *** 796,800 **** size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->tos); ! size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->rttable); size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->willingness, olsr_cnf->willingness_auto ? "(auto)" : ""); --- 860,864 ---- size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->tos); ! size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->rttable, olsr_cnf->rttable); size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->willingness, olsr_cnf->willingness_auto ? "(auto)" : ""); *************** *** 802,814 **** size += snprintf(&buf[size], bufsize-size, "\n\n"); ! if (olsr_cnf->lq_level == 0) ! { ! size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->use_hysteresis ? "Enabled" : "Disabled"); ! if (olsr_cnf->use_hysteresis) ! { ! size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->hysteresis_param.scaling); ! size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->hysteresis_param.thr_low, olsr_cnf->hysteresis_param.thr_high); ! } } size += snprintf(&buf[size], bufsize-size, "\n\n"); --- 866,878 ---- size += snprintf(&buf[size], bufsize-size, "\n\n"); ! if (olsr_cnf->lq_level == 0) { ! size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->use_hysteresis ? "Enabled" : "Disabled"); ! if (olsr_cnf->use_hysteresis) { ! size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->hysteresis_param.scaling); ! size += snprintf(&buf[size], bufsize-size, "\n", olsr_cnf->hysteresis_param.thr_low, olsr_cnf->hysteresis_param.thr_high); } + } else { + size += snprintf(&buf[size], bufsize-size, "\n"); + } size += snprintf(&buf[size], bufsize-size, "\n\n"); *************** *** 914,917 **** --- 978,983 ---- } } + } else { + size += snprintf(&buf[size], bufsize-size, "\n"); } size += snprintf(&buf[size], bufsize-size, "
\n" ! "
    \n", ! FRAMEWIDTH); for (tabs = 0; tab_entries[tabs].tab_label; tabs++) { if (!tab_entries[tabs].display_tab) { *************** *** 573,577 **** tab_entries[tabs].tab_label); } ! size += snprintf(&buf[size], bufsize-size, html_tabs_epilog); return size; } --- 637,644 ---- tab_entries[tabs].tab_label); } ! size += snprintf(&buf[size], bufsize-size, ! "
\n" ! "
\n"); return size; } *************** *** 701,705 **** rt->rt_best->rtp_metric.hops); size += snprintf(&buf[size], bufsize-size, ! "%.3f%.3f
MetricETXInterface
DestinationGatewayMetricETXInterface
TOS: 0x%04xRtTable: 0x%04xWillingness: %d %sTOS: 0x%04xRtTable: 0x%04x/%dWillingness: %d %s
Hysteresis: %sHyst scaling: %0.2fHyst lower/upper: %0.2f/%0.2f
Hysteresis: %sHyst scaling: %0.2fHyst lower/upper: %0.2f/%0.2f
\n"); *************** *** 926,937 **** struct link_entry *link = NULL; int size = 0, idx; size += section_title(&buf[size], bufsize-size, "Links"); size += snprintf(&buf[size], bufsize-size, ! "Local IPRemote IPHysteresis\n"); if (olsr_cnf->lq_level > 0) { size += snprintf(&buf[size], bufsize-size, ! "LinkQualitylosttotalNLQETX\n"); } size += snprintf(&buf[size], bufsize-size, "\n"); --- 992,1004 ---- struct link_entry *link = NULL; int size = 0, idx; + const char *colspan = resolve_ip_addresses ? " colspan=\"2\"" : ""; size += section_title(&buf[size], bufsize-size, "Links"); size += snprintf(&buf[size], bufsize-size, ! "Local IPRemote IPHysteresis", colspan, colspan); if (olsr_cnf->lq_level > 0) { size += snprintf(&buf[size], bufsize-size, ! "LinkQualitylosttotalNLQETX"); } size += snprintf(&buf[size], bufsize-size, "\n"); *************** *** 949,953 **** "%d" "%0.2f" ! "%0.2f\n", link->loss_link_quality, link->lost_packets, --- 1016,1020 ---- "%d" "%0.2f" ! "%0.2f\n", link->loss_link_quality, link->lost_packets, *************** *** 963,967 **** size += section_title(&buf[size], bufsize-size, "Neighbors"); size += snprintf(&buf[size], bufsize-size, ! "IP addressSYMMPRMPRSWillingness2 Hop Neighbors\n"); /* Neighbors */ for (idx = 0; idx < HASHSIZE; idx++) { --- 1030,1034 ---- size += section_title(&buf[size], bufsize-size, "Neighbors"); size += snprintf(&buf[size], bufsize-size, ! "IP AddressSYMMPRMPRSWillingness2 Hop Neighbors\n", colspan); /* Neighbors */ for (idx = 0; idx < HASHSIZE; idx++) { *************** *** 984,992 **** "\n"); ! thop_cnt = 0; ! for (list_2 = neigh->neighbor_2_list.next; list_2 != &neigh->neighbor_2_list; list_2 = list_2->next) { struct ipaddr_str strbuf; size += snprintf(&buf[size], bufsize-size, "\n", olsr_ip_to_string(&strbuf, &list_2->neighbor_2->neighbor_2_addr)); - thop_cnt++; } size += snprintf(&buf[size], bufsize-size, " (%d)\n", thop_cnt); --- 1051,1058 ---- "\n"); ! ! for (list_2 = neigh->neighbor_2_list.next, thop_cnt = 0; list_2 != &neigh->neighbor_2_list; list_2 = list_2->next, thop_cnt++) { struct ipaddr_str strbuf; size += snprintf(&buf[size], bufsize-size, "\n", olsr_ip_to_string(&strbuf, &list_2->neighbor_2->neighbor_2_addr)); } size += snprintf(&buf[size], bufsize-size, " (%d)\n", thop_cnt); *************** *** 1001,1007 **** int size = 0; struct tc_entry *tc; size += section_title(&buf[size], bufsize-size, "Topology Entries"); ! size += snprintf(&buf[size], bufsize-size, "Destination IPLast Hop IP"); if (olsr_cnf->lq_level > 0) { size += snprintf(&buf[size], bufsize-size, "LQILQETX"); --- 1067,1074 ---- int size = 0; struct tc_entry *tc; + const char *colspan = resolve_ip_addresses ? " colspan=\"2\"" : ""; size += section_title(&buf[size], bufsize-size, "Topology Entries"); ! size += snprintf(&buf[size], bufsize-size, "Destination IPLast Hop IP", colspan, colspan); if (olsr_cnf->lq_level > 0) { size += snprintf(&buf[size], bufsize-size, "LQILQETX"); *************** *** 1012,1016 **** struct tc_edge_entry *tc_edge; OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { - size += snprintf(&buf[size], bufsize-size, ""); size += build_ipaddr_with_link(&buf[size], bufsize, &tc_edge->T_dest_addr, -1); --- 1079,1082 ---- *************** *** 1039,1046 **** int size = 0; int idx; size += section_title(&buf[size], bufsize-size, "MID Entries"); size += snprintf(&buf[size], bufsize-size, ! "Main AddressAliases\n"); /* MID */ --- 1105,1113 ---- int size = 0; int idx; + const char *colspan = resolve_ip_addresses ? " colspan=\"2\"" : ""; size += section_title(&buf[size], bufsize-size, "MID Entries"); size += snprintf(&buf[size], bufsize-size, ! "Main AddressAliases\n", colspan); /* MID */ *************** *** 1054,1062 **** size += snprintf(&buf[size], bufsize-size, " (%d)\n", mid_cnt); --- 1121,1127 ---- size += snprintf(&buf[size], bufsize-size, " (%d)\n", mid_cnt); *************** *** 1096,1110 **** static int build_about_body(char *buf, olsr_u32_t bufsize) { ! return snprintf(buf, bufsize, about_frame, build_date, build_host); } static int build_cfgfile_body(char *buf, olsr_u32_t bufsize) { ! int size = 0, i = 0; ! while (cfgfile_body[i] && strcmp(cfgfile_body[i], "")) { ! size += snprintf(&buf[size], bufsize-size, cfgfile_body[i]); ! i++; ! } #ifdef NETDIRECT --- 1161,1217 ---- static int build_about_body(char *buf, olsr_u32_t bufsize) { ! return snprintf(buf, bufsize, ! "" PLUGIN_NAME " version " PLUGIN_VERSION "
\n" ! "by Andreas Tønnesen (C)2005.
\n" ! "Compiled " ! #ifdef ADMIN_INTERFACE ! "with experimental admin interface " ! #endif ! "%s at %s
\n" ! "This plugin implements a HTTP server that supplies\n" ! "the client with various dynamic web pages representing\n" ! "the current olsrd status.
The different pages include:\n" ! "
    \n
  • Configuration - This page displays information\n" ! "about the current olsrd configuration. This includes various\n" ! "olsr settings such as IP version, MID/TC redundancy, hysteresis\n" ! "etc. Information about the current status of the interfaces on\n" ! "which olsrd is configured to run is also displayed. Loaded olsrd\n" ! "plugins are shown with their plugin parameters. Finally all local\n" ! "HNA entries are shown. These are the networks that the local host\n" ! "will anounce itself as a gateway to.
  • \n" ! "
  • Routes - This page displays all routes currently set in\n" ! "the kernel by olsrd. The type of route is also displayed(host\n" ! "or HNA).
  • \n" ! "
  • Links/Topology - This page displays all information about\n" ! "links, neighbors, topology, MID and HNA entries.
  • \n" ! "
  • All - Here all the previous pages are displayed as one.\n" ! "This is to make all information available as easy as possible(for example\n" ! "for a script) and using as few resources as possible.
  • \n" ! #ifdef ADMIN_INTERFACE ! "
  • Admin - This page is highly experimental(and unsecure)!\n" ! "As of now it is not working at all but it provides a impression of\n" ! "the future possibilities of httpinfo. This is to be a interface to\n" ! "changing olsrd settings in realtime. These settings include various\n" ! "\"basic\" settings and local HNA settings.
  • \n" ! #endif ! "
  • About - this help page.
  • \n
" ! "
\n" ! "Send questions or comments to\n" ! "olsr-users at olsr.org or\n" ! "andreto-at-olsr.org
\n" ! "Official olsrd homepage: http://www.olsr.org
\n", ! build_date, build_host); } static int build_cfgfile_body(char *buf, olsr_u32_t bufsize) { ! int size = 0; ! size += snprintf(&buf[size], bufsize-size, ! "\n\n" ! "This is a automatically generated configuration\n" ! "file based on the current olsrd configuration of this node.
\n" ! "
\n" ! "
\n");
  
  #ifdef NETDIRECT
***************
*** 1125,1133 ****
    }
  
!   i++;
!   while (cfgfile_body[i]) {
!       size += snprintf(&buf[size], bufsize-size, cfgfile_body[i]);
!       i++;
!   }
  #if 0
    printf("RETURNING %d\n", size);
--- 1232,1237 ----
    }
  
!   size += snprintf(&buf[size], bufsize-size, "
\n
\n"); ! #if 0 printf("RETURNING %d\n", size); Index: gfx.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/gfx.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gfx.h 2 Jan 2005 13:54:40 -0000 1.3 --- gfx.h 15 Nov 2007 00:35:32 -0000 1.4 *************** *** 173,181 **** - const unsigned int favicon_ico_len = 1406; - - - - static unsigned char logo_gif[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x50, 0x00, 0x50, 0x00, 0xf7, 0x00, --- 173,176 ---- *************** *** 415,421 **** }; - const unsigned int logo_gif_len = 2801; - - static unsigned char grayline_gif[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, --- 410,413 ---- *************** *** 425,430 **** }; - const unsigned int grayline_gif_len = 43; - - #endif --- 417,419 ---- --- html.h DELETED --- From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser oparse.y,1.37,1.38 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/src/cfgparser Modified Files: oparse.y Log Message: * added -Wwrite-strings Index: oparse.y =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** oparse.y 8 Nov 2007 22:47:42 -0000 1.37 --- oparse.y 16 Nov 2007 19:12:55 -0000 1.38 *************** *** 66,70 **** #define YYSTYPE struct conf_token * ! void yyerror(char *); int yylex(void); --- 66,70 ---- #define YYSTYPE struct conf_token * ! void yyerror(const char *); int yylex(void); *************** *** 965,969 **** %% ! void yyerror (char *string) { fprintf(stderr, "Config line %d: %s\n", current_line, string); --- 965,969 ---- %% ! void yyerror (const char *string) { fprintf(stderr, "Config line %d: %s\n", current_line, string); From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.31, 1.32 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/lib/dot_draw/src Modified Files: olsrd_dot_draw.c Log Message: * added -Wwrite-strings Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** olsrd_dot_draw.c 8 Nov 2007 22:47:39 -0000 1.31 --- olsrd_dot_draw.c 16 Nov 2007 19:12:55 -0000 1.32 *************** *** 157,161 **** struct ipaddr_str strbuf; double etx = 0.0; ! char* style = "solid"; struct link_entry* link; --- 157,161 ---- struct ipaddr_str strbuf; double etx = 0.0; ! const char* style = "solid"; struct link_entry* link; From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.41,1.42 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640 Modified Files: Makefile.inc Log Message: * added -Wwrite-strings Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Makefile.inc 4 Nov 2007 15:27:50 -0000 1.41 --- Makefile.inc 16 Nov 2007 19:12:55 -0000 1.42 *************** *** 73,76 **** --- 73,77 ---- WARNINGS += -Wno-multichar WARNINGS += -Wno-deprecated-declarations + WARNINGS += -Wwrite-strings #WARNINGS += -Wredundant-decls ifeq ($(MUDFLAP),0) From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.35, 1.36 nameservice.h, 1.15, 1.16 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/lib/nameservice/src Modified Files: nameservice.c nameservice.h Log Message: * added -Wwrite-strings Index: nameservice.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** nameservice.h 5 Nov 2007 15:32:55 -0000 1.15 --- nameservice.h 16 Nov 2007 19:12:55 -0000 1.16 *************** *** 183,187 **** lookup_defhna_latlon(union olsr_ip_addr *ip); ! char* lookup_name_latlon(union olsr_ip_addr *ip); --- 183,187 ---- lookup_defhna_latlon(union olsr_ip_addr *ip); ! const char* lookup_name_latlon(union olsr_ip_addr *ip); Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** nameservice.c 8 Nov 2007 22:47:40 -0000 1.35 --- nameservice.c 16 Nov 2007 19:12:55 -0000 1.36 *************** *** 303,307 **** //regex string for validating the hostnames ! char *regex_name = "^[[:alnum:]_.-]+$"; //regex string for the service line char *regex_service = olsr_malloc(256*sizeof(char) + strlen(my_suffix), "new *char from name_init for regex_service"); --- 303,307 ---- //regex string for validating the hostnames ! const char *regex_name = "^[[:alnum:]_.-]+$"; //regex string for the service line char *regex_service = olsr_malloc(256*sizeof(char) + strlen(my_suffix), "new *char from name_init for regex_service"); *************** *** 1456,1460 **** * lookup a nodes name */ ! char* lookup_name_latlon(union olsr_ip_addr *ip) { --- 1456,1460 ---- * lookup a nodes name */ ! const char* lookup_name_latlon(union olsr_ip_addr *ip) { From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Bmf.c, 1.9, 1.10 Bmf.h, 1.5, 1.6 NetworkInterfaces.c, 1.11, 1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/lib/bmf/src Modified Files: Bmf.c Bmf.h NetworkInterfaces.c Log Message: * added -Wwrite-strings Index: Bmf.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Bmf.h 11 Sep 2007 23:08:20 -0000 1.5 --- Bmf.h 16 Nov 2007 19:12:55 -0000 1.6 *************** *** 56,60 **** struct interface; ! void BmfPError(char* format, ...) __attribute__((format(printf, 1, 2))); union olsr_ip_addr* MainAddressOf(union olsr_ip_addr* ip); int InterfaceChange(struct interface* interf, int action); --- 56,60 ---- struct interface; ! void BmfPError(const char* format, ...) __attribute__((format(printf, 1, 2))); union olsr_ip_addr* MainAddressOf(union olsr_ip_addr* ip); int InterfaceChange(struct interface* interf, int action); Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** NetworkInterfaces.c 8 Nov 2007 22:47:39 -0000 1.11 --- NetworkInterfaces.c 16 Nov 2007 19:12:55 -0000 1.12 *************** *** 1213,1217 **** static int CreateLocalEtherTunTap(void) { ! static char* deviceName = "/dev/net/tun"; struct ifreq ifreq; int etfd; --- 1213,1217 ---- static int CreateLocalEtherTunTap(void) { ! static const char deviceName[] = "/dev/net/tun"; struct ifreq ifreq; int etfd; Index: Bmf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Bmf.c 8 Nov 2007 22:47:39 -0000 1.9 --- Bmf.c 16 Nov 2007 19:12:55 -0000 1.10 *************** *** 85,89 **** * Data Used : none * ------------------------------------------------------------------------- */ ! void BmfPError(char* format, ...) { #define MAX_STR_DESC 255 --- 85,89 ---- * Data Used : none * ------------------------------------------------------------------------- */ ! void BmfPError(const char* format, ...) { #define MAX_STR_DESC 255 From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src admin_interface.h, 1.3, 1.4 olsrd_httpinfo.c, 1.86, 1.87 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/lib/httpinfo/src Modified Files: admin_interface.h olsrd_httpinfo.c Log Message: * added -Wwrite-strings Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** olsrd_httpinfo.c 15 Nov 2007 00:35:32 -0000 1.86 --- olsrd_httpinfo.c 16 Nov 2007 19:12:55 -0000 1.87 *************** *** 136,144 **** "border: 1px solid #000;\n}\n"; struct tab_entry { ! char *tab_label; ! char *filename; ! int(*build_body_cb)(char *, olsr_u32_t); olsr_bool display_tab; }; --- 136,146 ---- "border: 1px solid #000;\n}\n"; + typedef int(*build_body_callback)(char *, olsr_u32_t); + struct tab_entry { ! const char *tab_label; ! const char *filename; ! build_body_callback build_body_cb; olsr_bool display_tab; }; *************** *** 146,150 **** struct static_bin_file_entry { ! char *filename; unsigned char *data; unsigned int data_size; --- 148,152 ---- struct static_bin_file_entry { ! const char *filename; unsigned char *data; unsigned int data_size; *************** *** 153,157 **** struct static_txt_file_entry { ! char *filename; const char *data; }; --- 155,159 ---- struct static_txt_file_entry { ! const char *filename; const char *data; }; *************** *** 159,163 **** struct dynamic_file_entry { ! char *filename; int(*process_data_cb)(char *, olsr_u32_t, char *, olsr_u32_t); }; --- 161,165 ---- struct dynamic_file_entry { ! const char *filename; int(*process_data_cb)(char *, olsr_u32_t, char *, olsr_u32_t); }; *************** *** 171,175 **** static int build_http_header(http_header_type, olsr_bool, olsr_u32_t, char *, olsr_u32_t); ! static int build_frame(char *, olsr_u32_t, char *, char *, int, int(*frame_body_cb)(char *, olsr_u32_t)); static int build_routes_body(char *, olsr_u32_t); --- 173,177 ---- static int build_http_header(http_header_type, olsr_bool, olsr_u32_t, char *, olsr_u32_t); ! static int build_frame(char *, olsr_u32_t, const char *, const char *, int, build_body_callback frame_body_cb); static int build_routes_body(char *, olsr_u32_t); *************** *** 666,673 **** static int build_frame(char *buf, olsr_u32_t bufsize, ! char *title __attribute__((unused)), ! char *link __attribute__((unused)), int width __attribute__((unused)), ! int(*frame_body_cb)(char *, olsr_u32_t)) { int size = 0; --- 668,675 ---- static int build_frame(char *buf, olsr_u32_t bufsize, ! const char *title __attribute__((unused)), ! const char *link __attribute__((unused)), int width __attribute__((unused)), ! build_body_callback frame_body_cb) { int size = 0; Index: admin_interface.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/admin_interface.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** admin_interface.h 15 Jul 2007 17:54:07 -0000 1.3 --- admin_interface.h 16 Nov 2007 19:12:55 -0000 1.4 *************** *** 1,5 **** /* * HTTP Info plugin for the olsr.org OLSR daemon ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * HTTP Info plugin for the olsr.org OLSR daemon ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current/src build_msg.c, 1.38, 1.39 interfaces.c, 1.36, 1.37 interfaces.h, 1.44, 1.45 log.h, 1.6, 1.7 lq_route.c, 1.57, 1.58 lq_route.h, 1.6, 1.7 olsr.c, 1.62, 1.63 olsr.h, 1.26, 1.27 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/src Modified Files: build_msg.c interfaces.c interfaces.h log.h lq_route.c lq_route.h olsr.c olsr.h Log Message: * added -Wwrite-strings Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** lq_route.c 8 Nov 2007 22:47:41 -0000 1.57 --- lq_route.c 16 Nov 2007 19:12:55 -0000 1.58 *************** *** 165,175 **** ! char *olsr_etx_to_string(float etx) { static char buff[20]; ! if (etx == INFINITE_ETX) return "INF"; ! snprintf(buff, sizeof(buff), "%.6f", etx); return buff; --- 165,175 ---- ! const char *olsr_etx_to_string(float etx) { static char buff[20]; ! if (etx == INFINITE_ETX) { return "INF"; ! } snprintf(buff, sizeof(buff), "%.6f", etx); return buff; Index: interfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** interfaces.c 8 Nov 2007 22:47:41 -0000 1.36 --- interfaces.c 16 Nov 2007 19:12:55 -0000 1.37 *************** *** 357,361 **** */ struct olsr_if * ! queue_if(char *name, int hemu) { struct olsr_if *interf_n = olsr_cnf->interfaces; --- 357,361 ---- */ struct olsr_if * ! queue_if(const char *name, int hemu) { struct olsr_if *interf_n = olsr_cnf->interfaces; Index: lq_route.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** lq_route.h 13 Sep 2007 15:31:59 -0000 1.6 --- lq_route.h 16 Nov 2007 19:12:55 -0000 1.7 *************** *** 48,52 **** void olsr_calculate_routing_table(void); ! char *olsr_etx_to_string(float); #endif --- 48,52 ---- void olsr_calculate_routing_table(void); ! const char *olsr_etx_to_string(float); #endif Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** interfaces.h 8 Nov 2007 22:47:41 -0000 1.44 --- interfaces.h 16 Nov 2007 19:12:55 -0000 1.45 *************** *** 219,223 **** struct olsr_if * ! queue_if(char *, int); int --- 219,223 ---- struct olsr_if * ! queue_if(const char *, int); int Index: build_msg.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** build_msg.c 8 Nov 2007 22:47:41 -0000 1.38 --- build_msg.c 16 Nov 2007 19:12:55 -0000 1.39 *************** *** 239,243 **** static void ! check_buffspace(int msgsize, int buffsize, char *type) { if(msgsize > buffsize) --- 239,243 ---- static void ! check_buffspace(int msgsize, int buffsize, const char *type) { if(msgsize > buffsize) Index: olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** olsr.h 20 Apr 2007 13:46:04 -0000 1.26 --- olsr.h 16 Nov 2007 19:12:55 -0000 1.27 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 102,106 **** int ! olsr_printf(int, char *, ...) __attribute__((format(printf,2,3))); #endif --- 102,106 ---- int ! olsr_printf(int, const char *, ...) __attribute__((format(printf,2,3))); #endif Index: log.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/log.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** log.h 20 Apr 2007 13:46:04 -0000 1.6 --- log.h 16 Nov 2007 19:12:55 -0000 1.7 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 56,60 **** void ! olsr_syslog(int level, char *format, ...) __attribute__((format(printf,2,3))); --- 56,60 ---- void ! olsr_syslog(int level, const char *format, ...) __attribute__((format(printf,2,3))); Index: olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** olsr.c 11 Nov 2007 22:56:34 -0000 1.62 --- olsr.c 16 Nov 2007 19:12:55 -0000 1.63 *************** *** 588,592 **** int ! olsr_printf(int loglevel, char *format, ...) { if((loglevel <= olsr_cnf->debug_level) && debug_handle) --- 588,592 ---- int ! olsr_printf(int loglevel, const char *format, ...) { if((loglevel <= olsr_cnf->debug_level) && debug_handle) From (spam-protected) Fri Nov 16 20:12:58 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:58 +0000 Subject: [Olsr-cvs] olsrd-current/src/unix log.c,1.3,1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/unix In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/src/unix Modified Files: log.c Log Message: * added -Wwrite-strings Index: log.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/unix/log.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** log.c 21 Nov 2004 10:50:52 -0000 1.3 --- log.c 16 Nov 2007 19:12:55 -0000 1.4 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 59,63 **** void ! olsr_syslog(int level, char *format, ...) { --- 59,63 ---- void ! olsr_syslog(int level, const char *format, ...) { From (spam-protected) Fri Nov 16 20:12:58 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:58 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 log.c,1.5,1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/src/win32 Modified Files: log.c Log Message: * added -Wwrite-strings Index: log.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/log.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** log.c 25 Apr 2007 22:23:09 -0000 1.5 --- log.c 16 Nov 2007 19:12:56 -0000 1.6 *************** *** 46,50 **** } ! void olsr_syslog(int Level __attribute__((unused)), char *Format __attribute__((unused)), ...) { } --- 46,50 ---- } ! void olsr_syslog(int Level __attribute__((unused)), const char *Format __attribute__((unused)), ...) { } From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src glua.c, 1.4, 1.5 glua_ext.c, 1.3, 1.4 http.c, 1.7, 1.8 http.h, 1.3, 1.4 lib.c, 1.2, 1.3 lib.h, 1.3, 1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/lib/tas/src Modified Files: glua.c glua_ext.c http.c http.h lib.c lib.h Log Message: * added -Wwrite-strings Index: glua_ext.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/glua_ext.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** glua_ext.c 13 Apr 2005 22:53:13 -0000 1.3 --- glua_ext.c 16 Nov 2007 19:12:55 -0000 1.4 *************** *** 175,179 **** } ! static void addTable(lua_State *lua, char *name, void (*init)(void), int (*next)(char *buff, int len)) { --- 175,179 ---- } ! static void addTable(lua_State *lua, const char *name, void (*init)(void), int (*next)(char *buff, int len)) { Index: lib.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lib.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lib.c 12 Apr 2005 19:57:26 -0000 1.2 --- lib.c 16 Nov 2007 19:12:55 -0000 1.3 *************** *** 55,59 **** static unsigned int debugMask = 0; ! void error(char *form, ...) { va_list args; --- 55,59 ---- static unsigned int debugMask = 0; ! void error(const char *form, ...) { va_list args; *************** *** 64,68 **** } ! void debug(int facility, char *form, ...) { va_list args; --- 64,68 ---- } ! void debug(int facility, const char *form, ...) { va_list args; Index: lib.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lib.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lib.h 20 Apr 2007 13:46:03 -0000 1.3 --- lib.h 16 Nov 2007 19:12:55 -0000 1.4 *************** *** 51,56 **** #define DEBUG_QUANTUM 32 ! extern void error(char *form, ...) __attribute__((format(printf,1,2))); ! extern void debug(int facility, char *form, ...) __attribute__((format(printf,2,3))); extern char *strdupAdd(const char *string, int add); extern char *myStrdup(const char *string); --- 51,56 ---- #define DEBUG_QUANTUM 32 ! extern void error(const char *form, ...) __attribute__((format(printf,1,2))); ! extern void debug(int facility, const char *form, ...) __attribute__((format(printf,2,3))); extern char *strdupAdd(const char *string, int add); extern char *myStrdup(const char *string); Index: http.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** http.c 17 Sep 2007 21:57:06 -0000 1.7 --- http.c 16 Nov 2007 19:12:55 -0000 1.8 *************** *** 69,79 **** static struct ipAddr confAddr; static int confPort; ! static char *confRootDir; ! static char *confWorkDir; ! static char *confIndexFile; static char *confUser; static char *confPassword; static int confSessTime; ! static char *confPubDir; static int confQuantum; static int confMessTime; --- 69,79 ---- static struct ipAddr confAddr; static int confPort; ! static const char *confRootDir; ! static const char *confWorkDir; ! static const char *confIndexFile; static char *confUser; static char *confPassword; static int confSessTime; ! static const char *confPubDir; static int confQuantum; static int confMessTime; *************** *** 105,110 **** static struct extMap { ! char *ext; ! char *type; int state; } --- 105,110 ---- static struct extMap { ! const char *ext; ! const char *type; int state; } *************** *** 201,205 **** static void encHexString(char *hexString, unsigned char *hex, int len) { ! static char *map = "0123456789ABCDEF"; while (len-- > 0) --- 201,205 ---- static void encHexString(char *hexString, unsigned char *hex, int len) { ! static const char map[] = "0123456789ABCDEF"; while (len-- > 0) *************** *** 975,979 **** } ! static char *errNoToErrStr(int errNo) { switch (errNo) --- 975,979 ---- } ! static const char *errNoToErrStr(int errNo) { switch (errNo) Index: glua.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/glua.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** glua.c 20 Apr 2007 13:46:03 -0000 1.4 --- glua.c 16 Nov 2007 19:12:55 -0000 1.5 *************** *** 348,351 **** --- 348,352 ---- struct connInfo *info; const char *contType; + char *s; lua_pushlightuserdata(lua, (void *)&infoKey); *************** *** 356,361 **** contType = luaL_checkstring(lua, 1); ! info->contType = allocBuff(info, strlen(contType) + 1); ! strcpy(info->contType, contType); return 0; --- 357,362 ---- contType = luaL_checkstring(lua, 1); ! s = allocBuff(info, strlen(contType) + 1); ! strcpy(s, contType); return 0; Index: http.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** http.h 17 Sep 2007 21:57:06 -0000 1.3 --- http.h 16 Nov 2007 19:12:55 -0000 1.4 *************** *** 107,111 **** char *proto; ! char *contType; int contLen; --- 107,111 ---- char *proto; ! const char *contType; int contLen; From (spam-protected) Fri Nov 16 20:12:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:12:57 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch commands.h, 1.8, 1.9 ohs_cmd.c, 1.24, 1.25 ohs_cmd.h, 1.6, 1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27640/src/olsr_switch Modified Files: commands.h ohs_cmd.c ohs_cmd.h Log Message: * added -Wwrite-strings Index: ohs_cmd.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/ohs_cmd.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ohs_cmd.c 28 Jul 2007 12:58:23 -0000 1.24 --- ohs_cmd.c 16 Nov 2007 19:12:55 -0000 1.25 *************** *** 2,6 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 2,6 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 63,67 **** static int ! get_next_token(char *src, char *dst, size_t buflen) { int i = 0, j = 0; --- 63,67 ---- static int ! get_next_token(const char *src, char *dst, size_t buflen) { int i = 0, j = 0; *************** *** 89,93 **** int ! ohs_set_olsrd_path(char *path) { strncpy(olsrd_path, path, FILENAME_MAX); --- 89,93 ---- int ! ohs_set_olsrd_path(const char *path) { strncpy(olsrd_path, path, FILENAME_MAX); *************** *** 104,110 **** #else int ! ohs_cmd_olsrd(char *args) { ! char *olsrd_args[MAX_OLSRD_ARGS]; struct in_addr iaddr; --- 104,110 ---- #else int ! ohs_cmd_olsrd(const char *args) { ! const char *olsrd_args[MAX_OLSRD_ARGS]; struct in_addr iaddr; *************** *** 153,157 **** return 1; ! if(execve(olsrd_path, olsrd_args, NULL) < 0) { printf("Error executing olsrd: %s\n", strerror(errno)); --- 153,157 ---- return 1; ! if(execve(olsrd_path, (char * const *)olsrd_args, NULL) < 0) { printf("Error executing olsrd: %s\n", strerror(errno)); *************** *** 237,241 **** int ! ohs_cmd_link(char *args) { olsr_u8_t bi = 0, wildc_src = 0, wildc_dst = 0; --- 237,241 ---- int ! ohs_cmd_link(const char *args) { olsr_u8_t bi = 0, wildc_src = 0, wildc_dst = 0; *************** *** 391,395 **** int ! ohs_cmd_list(char *args) { struct ohs_connection *oc = ohs_conns; --- 391,395 ---- int ! ohs_cmd_list(const char *args) { struct ohs_connection *oc = ohs_conns; *************** *** 440,444 **** int ! ohs_cmd_help(char *args) { int i; --- 440,444 ---- int ! ohs_cmd_help(const char *args) { int i; *************** *** 480,484 **** int ! ohs_cmd_log(char *args) { olsr_u8_t set = 0; --- 480,484 ---- int ! ohs_cmd_log(const char *args) { olsr_u8_t set = 0; *************** *** 541,545 **** int ! ohs_cmd_exit(char *args __attribute__((unused))) { --- 541,545 ---- int ! ohs_cmd_exit(const char *args __attribute__((unused))) { Index: ohs_cmd.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/ohs_cmd.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ohs_cmd.h 28 Jul 2007 12:53:15 -0000 1.6 --- ohs_cmd.h 16 Nov 2007 19:12:55 -0000 1.7 *************** *** 2,6 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 2,6 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 49,61 **** struct ohs_command { ! char *cmd; ! char *syntax; ! char *helptext_brief; ! char *helptext_long; ! int (*cmd_cb)(char *); }; int ! ohs_set_olsrd_path(char *); void --- 49,61 ---- struct ohs_command { ! const char *cmd; ! const char *syntax; ! const char *helptext_brief; ! const char *helptext_long; ! int (*cmd_cb)(const char *); }; int ! ohs_set_olsrd_path(const char *); void *************** *** 63,82 **** int ! ohs_cmd_olsrd(char *); int ! ohs_cmd_list(char *); int ! ohs_cmd_help(char *); int ! ohs_cmd_exit(char *) __attribute__((noreturn)); int ! ohs_cmd_log(char *); int ! ohs_cmd_link(char *); #endif --- 63,82 ---- int ! ohs_cmd_olsrd(const char *); int ! ohs_cmd_list(const char *); int ! ohs_cmd_help(const char *); int ! ohs_cmd_exit(const char *) __attribute__((noreturn)); int ! ohs_cmd_log(const char *); int ! ohs_cmd_link(const char *); #endif Index: commands.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/commands.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** commands.h 31 May 2007 00:16:52 -0000 1.8 --- commands.h 16 Nov 2007 19:12:55 -0000 1.9 *************** *** 2,6 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 2,6 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 48,52 **** ! static struct ohs_command ohs_commands[] = { { "help", "help", --- 48,52 ---- ! static const struct ohs_command ohs_commands[] = { { "help", "help", From (spam-protected) Fri Nov 16 20:14:35 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:14:35 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.42,1.43 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28481 Modified Files: Makefile.inc Log Message: * added -WWendif-labels Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** Makefile.inc 16 Nov 2007 19:12:55 -0000 1.42 --- Makefile.inc 16 Nov 2007 19:14:33 -0000 1.43 *************** *** 73,76 **** --- 73,77 ---- WARNINGS += -Wno-multichar WARNINGS += -Wno-deprecated-declarations + WARNINGS += -Wendif-labels WARNINGS += -Wwrite-strings #WARNINGS += -Wredundant-decls From (spam-protected) Fri Nov 16 20:34:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:34:28 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.43,1.44 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3811 Modified Files: Makefile.inc Log Message: * added -Wbad-function-cast Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Makefile.inc 16 Nov 2007 19:14:33 -0000 1.43 --- Makefile.inc 16 Nov 2007 19:34:26 -0000 1.44 *************** *** 75,78 **** --- 75,79 ---- WARNINGS += -Wendif-labels WARNINGS += -Wwrite-strings + WARNINGS += -Wbad-function-cast #WARNINGS += -Wredundant-decls ifeq ($(MUDFLAP),0) From (spam-protected) Fri Nov 16 20:34:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:34:28 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src/lua lauxlib.c, 1.2, 1.3 lauxlib.h, 1.2, 1.3 lbaselib.c, 1.2, 1.3 ldblib.c, 1.1, 1.2 liolib.c, 1.2, 1.3 lmathlib.c, 1.1, 1.2 lstrlib.c, 1.1, 1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src/lua In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3811/lib/tas/src/lua Modified Files: lauxlib.c lauxlib.h lbaselib.c ldblib.c liolib.c lmathlib.c lstrlib.c Log Message: * added -Wbad-function-cast Index: liolib.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/liolib.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** liolib.c 20 Apr 2007 13:46:03 -0000 1.2 --- liolib.c 16 Nov 2007 19:34:26 -0000 1.3 *************** *** 375,379 **** for (n = first; nargs-- && success; n++) { if (lua_type(L, n) == LUA_TNUMBER) { ! size_t l = (size_t)lua_tonumber(L, n); success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); } --- 375,379 ---- for (n = first; nargs-- && success; n++) { if (lua_type(L, n) == LUA_TNUMBER) { ! size_t l = lua_tonumber(L, n); success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); } *************** *** 584,588 **** static int io_clock (lua_State *L) { ! lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); return 1; } --- 584,588 ---- static int io_clock (lua_State *L) { ! lua_pushnumber(L, clock()/(lua_Number)CLOCKS_PER_SEC); return 1; } *************** *** 624,628 **** lua_gettable(L, -2); if (lua_isnumber(L, -1)) ! res = (int)(lua_tonumber(L, -1)); else { if (d == -2) --- 624,628 ---- lua_gettable(L, -2); if (lua_isnumber(L, -1)) ! res = lua_tonumber(L, -1); else { if (d == -2) *************** *** 637,641 **** static int io_date (lua_State *L) { const char *s = luaL_optstring(L, 1, "%c"); ! time_t t = (time_t)(luaL_optnumber(L, 2, -1)); struct tm *stm; if (t == (time_t)(-1)) /* no time given? */ --- 637,641 ---- static int io_date (lua_State *L) { const char *s = luaL_optstring(L, 1, "%c"); ! time_t t = luaL_optnumber(L, 2, -1); struct tm *stm; if (t == (time_t)(-1)) /* no time given? */ *************** *** 698,703 **** static int io_difftime (lua_State *L) { ! lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), ! (time_t)(luaL_optnumber(L, 2, 0)))); return 1; } --- 698,703 ---- static int io_difftime (lua_State *L) { ! lua_pushnumber(L, difftime(luaL_checknumber(L, 1), ! luaL_optnumber(L, 2, 0))); return 1; } Index: lstrlib.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lstrlib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lstrlib.c 12 Apr 2005 17:17:27 -0000 1.1 --- lstrlib.c 16 Nov 2007 19:34:26 -0000 1.2 *************** *** 518,526 **** size_t ls = lua_strlen(L, lua_upvalueindex(1)); const char *p = lua_tostring(L, lua_upvalueindex(2)); const char *src; ms.L = L; ms.src_init = s; ms.src_end = s+ls; ! for (src = s + (size_t)lua_tonumber(L, lua_upvalueindex(3)); src <= ms.src_end; src++) { --- 518,527 ---- size_t ls = lua_strlen(L, lua_upvalueindex(1)); const char *p = lua_tostring(L, lua_upvalueindex(2)); + unsigned int idx3 = lua_tonumber(L, lua_upvalueindex(3)); const char *src; ms.L = L; ms.src_init = s; ms.src_end = s+ls; ! for (src = s + idx3; src <= ms.src_end; src++) { *************** *** 705,709 **** } case 'o': case 'u': case 'x': case 'X': { ! sprintf(buff, form, (unsigned int)(luaL_checknumber(L, arg))); break; } --- 706,711 ---- } case 'o': case 'u': case 'x': case 'X': { ! const unsigned int n = luaL_checknumber(L, arg); ! sprintf(buff, form, n); break; } Index: lauxlib.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lauxlib.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lauxlib.c 20 Apr 2007 13:46:03 -0000 1.2 --- lauxlib.c 16 Nov 2007 19:34:26 -0000 1.3 *************** *** 258,262 **** static int checkint (lua_State *L, int topop) { ! int n = (int)lua_tonumber(L, -1); if (n == 0 && !lua_isnumber(L, -1)) n = -1; lua_pop(L, topop); --- 258,262 ---- static int checkint (lua_State *L, int topop) { ! int n = lua_tonumber(L, -1); if (n == 0 && !lua_isnumber(L, -1)) n = -1; lua_pop(L, topop); *************** *** 426,430 **** } lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ ! ref = (int)lua_tonumber(L, -1); /* ref = t[FREELIST_REF] */ lua_pop(L, 1); /* remove it from stack */ if (ref != 0) { /* any free element? */ --- 426,430 ---- } lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ ! ref = lua_tonumber(L, -1); /* ref = t[FREELIST_REF] */ lua_pop(L, 1); /* remove it from stack */ if (ref != 0) { /* any free element? */ Index: lauxlib.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lauxlib.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lauxlib.h 20 Apr 2007 13:46:03 -0000 1.2 --- lauxlib.h 16 Nov 2007 19:34:26 -0000 1.3 *************** *** 71,82 **** */ ! #define luaL_argcheck(L, cond,numarg,extramsg) if (!(cond)) \ ! luaL_argerror(L, numarg,extramsg) ! #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) ! #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) ! #define luaL_checkint(L,n) ((int)luaL_checknumber(L, n)) ! #define luaL_checklong(L,n) ((long)luaL_checknumber(L, n)) ! #define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,(lua_Number)(d))) ! #define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,(lua_Number)(d))) --- 71,82 ---- */ ! #define luaL_argcheck(L, cond,numarg,extramsg) do { if (!(cond)) \ ! luaL_argerror(L, numarg,extramsg); } while (0) ! #define luaL_checkstring(L,n) luaL_checklstring(L, (n), NULL) ! #define luaL_optstring(L,n,d) luaL_optlstring(L, (n), (d), NULL) ! #define luaL_checkint(L,n) luaL_checknumber(L, n) ! #define luaL_checklong(L,n) luaL_checknumber(L, n) ! #define luaL_optint(L,n,d) luaL_optnumber(L, n,(lua_Number)(d)) ! #define luaL_optlong(L,n,d) luaL_optnumber(L, n,(lua_Number)(d)) Index: lmathlib.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lmathlib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lmathlib.c 12 Apr 2005 17:17:26 -0000 1.1 --- lmathlib.c 16 Nov 2007 19:34:26 -0000 1.2 *************** *** 180,184 **** int u = luaL_checkint(L, 1); luaL_argcheck(L, 1<=u, 1, "interval is empty"); ! lua_pushnumber(L, (int)floor(r*u)+1); /* int between 1 and `u' */ break; } --- 180,184 ---- int u = luaL_checkint(L, 1); luaL_argcheck(L, 1<=u, 1, "interval is empty"); ! lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ break; } *************** *** 187,191 **** int u = luaL_checkint(L, 2); luaL_argcheck(L, l<=u, 2, "interval is empty"); ! lua_pushnumber(L, (int)floor(r*(u-l+1))+l); /* int between `l' and `u' */ break; } --- 187,191 ---- int u = luaL_checkint(L, 2); luaL_argcheck(L, l<=u, 2, "interval is empty"); ! lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ break; } Index: ldblib.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/ldblib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ldblib.c 12 Apr 2005 17:17:26 -0000 1.1 --- ldblib.c 16 Nov 2007 19:34:26 -0000 1.2 *************** *** 37,41 **** const char *options = luaL_optstring(L, 2, "flnSu"); if (lua_isnumber(L, 1)) { ! if (!lua_getstack(L, (int)(lua_tonumber(L, 1)), &ar)) { lua_pushnil(L); /* level out of range */ return 1; --- 37,41 ---- const char *options = luaL_optstring(L, 2, "flnSu"); if (lua_isnumber(L, 1)) { ! if (!lua_getstack(L, lua_tonumber(L, 1), &ar)) { lua_pushnil(L); /* level out of range */ return 1; *************** *** 204,208 **** } lua_pushstring(L, unmakemask(mask, buff)); ! lua_pushnumber(L, (lua_Number)lua_gethookcount(L)); return 3; } --- 204,208 ---- } lua_pushstring(L, unmakemask(mask, buff)); ! lua_pushnumber(L, lua_gethookcount(L)); return 3; } Index: lbaselib.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lbaselib.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lbaselib.c 20 Apr 2007 13:46:03 -0000 1.2 --- lbaselib.c 16 Nov 2007 19:34:26 -0000 1.3 *************** *** 188,193 **** static int luaB_gcinfo (lua_State *L) { ! lua_pushnumber(L, (lua_Number)lua_getgccount(L)); ! lua_pushnumber(L, (lua_Number)lua_getgcthreshold(L)); return 2; } --- 188,193 ---- static int luaB_gcinfo (lua_State *L) { ! lua_pushnumber(L, lua_getgccount(L)); ! lua_pushnumber(L, lua_getgcthreshold(L)); return 2; } From (spam-protected) Fri Nov 16 20:52:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 19:52:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.32, 1.33 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7883/lib/dot_draw/src Modified Files: olsrd_dot_draw.c Log Message: * fixed bug: we got garbled output on the line with "shape=box" * fixed file descriptor leaks ipc_action() * killed the two indicator variables "ipc_open" and "ipc_socket_up". We use the filedescriptors as we can easily use -1 as the "socket is down" indocation * killed unused return values * reduced the clutter: we have now a ipc_send_fmt() function which does the snprintf() and not spread that all over Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** olsrd_dot_draw.c 16 Nov 2007 19:12:55 -0000 1.32 --- olsrd_dot_draw.c 16 Nov 2007 19:52:09 -0000 1.33 *************** *** 58,61 **** --- 58,62 ---- #include #include + #include #include "olsr.h" *************** *** 80,86 **** static int ipc_socket; - static int ipc_open; static int ipc_connection; - static int ipc_socket_up; --- 81,85 ---- *************** *** 109,117 **** ipc_print_net(const union olsr_ip_addr *, const union olsr_ip_addr *, const union hna_netmask *); ! static int ipc_send(const char *, int); ! static int ! ipc_send_str(const char *); --- 108,118 ---- ipc_print_net(const union olsr_ip_addr *, const union olsr_ip_addr *, const union hna_netmask *); ! static void ipc_send(const char *, int); ! static void ! ipc_send_fmt(const char *format, ...) __attribute__((format(printf,1,2))); ! ! #define ipc_send_str(data) ipc_send((data), strlen(data)) *************** *** 126,131 **** { /* Initial IPC value */ - ipc_open = 0; - ipc_socket_up = 0; ipc_socket = -1; ipc_connection = -1; --- 127,130 ---- *************** *** 146,151 **** olsr_plugin_exit(void) { ! if(ipc_open) ! close(ipc_socket); } --- 145,154 ---- olsr_plugin_exit(void) { ! if (ipc_connection != -1) { ! CLOSE(ipc_connection); ! } ! if (ipc_socket != -1) { ! CLOSE(ipc_socket); ! } } *************** *** 154,182 **** ipc_print_neigh_link(const struct neighbor_entry *neighbor) { ! char buf[256]; ! struct ipaddr_str strbuf; double etx = 0.0; ! const char* style = "solid"; struct link_entry* link; - sprintf( buf, "\"%s\" -> ", olsr_ip_to_string(&strbuf, &olsr_cnf->main_addr)); - ipc_send_str(buf); - if (neighbor->status == 0) { // non SYM ! style = "dashed"; ! } ! else { ! link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr); ! if (link) { ! etx = olsr_calc_link_etx(link); ! } } ! sprintf( buf, "\"%s\"[label=\"%.2f\", style=%s];\n", olsr_ip_to_string(&strbuf, &neighbor->neighbor_main_addr), etx, style ); ! ipc_send_str(buf); if (neighbor->is_mpr) { ! sprintf( buf, "\"%s\"[shape=box];\n", buf); ! ipc_send_str(buf); } } --- 157,184 ---- ipc_print_neigh_link(const struct neighbor_entry *neighbor) { ! struct ipaddr_str mainaddrstrbuf, strbuf; double etx = 0.0; ! const char *style; ! const char *adr = olsr_ip_to_string(&mainaddrstrbuf, &olsr_cnf->main_addr); struct link_entry* link; if (neighbor->status == 0) { // non SYM ! style = "dashed"; ! } else { ! link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr); ! if (link) { ! etx = olsr_calc_link_etx(link); ! } ! style = "solid"; } ! ipc_send_fmt("\"%s\" -> \"%s\"[label=\"%.2f\", style=%s];\n", ! adr, ! olsr_ip_to_string(&strbuf, &neighbor->neighbor_main_addr), ! etx, ! style); if (neighbor->is_mpr) { ! ipc_send_fmt("\"%s\"[shape=box];\n", adr); } } *************** *** 189,241 **** olsr_u32_t yes = 1; /* Init ipc socket */ ! if ((ipc_socket = socket(AF_INET, SOCK_STREAM, 0)) == -1) ! { ! olsr_printf(1, "(DOT DRAW)IPC socket %s\n", strerror(errno)); ! return 0; ! } ! else ! { ! if (setsockopt(ipc_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0) ! { ! perror("SO_REUSEADDR failed"); ! return 0; ! } #if defined __FreeBSD__ && defined SO_NOSIGPIPE ! if (setsockopt(ipc_socket, SOL_SOCKET, SO_NOSIGPIPE, (char *)&yes, sizeof(yes)) < 0) ! { ! perror("SO_REUSEADDR failed"); ! return 0; ! } #endif ! /* Bind the socket */ ! /* complete the socket structure */ ! memset(&sin, 0, sizeof(sin)); ! sin.sin_family = AF_INET; ! sin.sin_addr.s_addr = INADDR_ANY; ! sin.sin_port = htons(ipc_port); ! /* bind the socket to the port number */ ! if (bind(ipc_socket, (struct sockaddr *) &sin, sizeof(sin)) == -1) ! { ! olsr_printf(1, "(DOT DRAW)IPC bind %s\n", strerror(errno)); ! return 0; ! } ! /* show that we are willing to listen */ ! if (listen(ipc_socket, 1) == -1) ! { ! olsr_printf(1, "(DOT DRAW)IPC listen %s\n", strerror(errno)); ! return 0; ! } ! /* Register with olsrd */ ! //printf("Adding socket with olsrd\n"); ! add_olsr_socket(ipc_socket, &ipc_action); ! ipc_socket_up = 1; ! } return 1; --- 191,244 ---- olsr_u32_t yes = 1; + if (ipc_socket != -1) { + close(ipc_socket); + } + /* Init ipc socket */ ! ipc_socket = socket(AF_INET, SOCK_STREAM, 0); ! if (ipc_socket == -1) { ! olsr_printf(1, "(DOT DRAW)IPC socket %s\n", strerror(errno)); ! return 0; ! } ! ! if (setsockopt(ipc_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0) { ! perror("SO_REUSEADDR failed"); ! CLOSE(ipc_socket); ! return 0; ! } #if defined __FreeBSD__ && defined SO_NOSIGPIPE ! if (setsockopt(ipc_socket, SOL_SOCKET, SO_NOSIGPIPE, (char *)&yes, sizeof(yes)) < 0) { ! perror("SO_REUSEADDR failed"); ! CLOSE(ipc_socket); ! return 0; ! } #endif ! /* Bind the socket */ ! /* complete the socket structure */ ! memset(&sin, 0, sizeof(sin)); ! sin.sin_family = AF_INET; ! sin.sin_addr.s_addr = INADDR_ANY; ! sin.sin_port = htons(ipc_port); ! /* bind the socket to the port number */ ! if (bind(ipc_socket, (struct sockaddr *) &sin, sizeof(sin)) == -1) { ! olsr_printf(1, "(DOT DRAW)IPC bind %s\n", strerror(errno)); ! CLOSE(ipc_socket); ! return 0; ! } ! /* show that we are willing to listen */ ! if (listen(ipc_socket, 1) == -1) { ! olsr_printf(1, "(DOT DRAW)IPC listen %s\n", strerror(errno)); ! CLOSE(ipc_socket); ! return 0; ! } ! /* Register with olsrd */ ! //printf("Adding socket with olsrd\n"); ! add_olsr_socket(ipc_socket, &ipc_action); return 1; *************** *** 249,283 **** socklen_t addrlen = sizeof(struct sockaddr_in); ! if (ipc_open) ! { ! int rc; ! do { ! rc = close(ipc_connection); ! } while (rc == -1 && (errno == EINTR || errno == EAGAIN)); ! if (rc == -1) { ! olsr_printf(1, "(DOT DRAW) Error on closing previously active TCP connection on fd %d: %s\n", ipc_connection, strerror(errno)); ! } ! ipc_open = 0; ! } ! if ((ipc_connection = accept(ipc_socket, (struct sockaddr *) &pin, &addrlen)) == -1) ! { ! olsr_printf(1, "(DOT DRAW)IPC accept: %s\n", strerror(errno)); ! } ! else ! { ! if(!ip4equal(&pin.sin_addr, &ipc_accept_ip.v4)) ! { ! olsr_printf(0, "Front end-connection from foreign host (%s) not allowed!\n", inet_ntoa(pin.sin_addr)); ! close(ipc_connection); ! ipc_connection = -1; ! } ! else ! { ! ipc_open = 1; ! olsr_printf(1, "(DOT DRAW)IPC: Connection from %s\n",inet_ntoa(pin.sin_addr)); ! pcf_event(1, 1, 1); ! } ! } } --- 252,271 ---- socklen_t addrlen = sizeof(struct sockaddr_in); ! if (ipc_connection != -1) { ! close(ipc_connection); ! } ! ipc_connection = accept(ipc_socket, (struct sockaddr *)&pin, &addrlen); ! if (ipc_connection == -1) { ! olsr_printf(1, "(DOT DRAW)IPC accept: %s\n", strerror(errno)); ! return; ! } ! if (!ip4equal(&pin.sin_addr, &ipc_accept_ip.v4)) { ! olsr_printf(0, "Front end-connection from foreign host (%s) not allowed!\n", inet_ntoa(pin.sin_addr)); ! CLOSE(ipc_connection); ! return; ! } ! olsr_printf(1, "(DOT DRAW)IPC: Connection from %s\n", inet_ntoa(pin.sin_addr)); ! pcf_event(1, 1, 1); } *************** *** 291,373 **** int changes_hna) { ! int res; ! int index; ! struct neighbor_entry *neighbor_table_tmp; ! struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; ! ! res = 0; ! ! if(changes_neighborhood || changes_topology || changes_hna) ! { ! /* Print tables to IPC socket */ ! ! ipc_send_str("digraph topology\n{\n"); ! /* Neighbors */ ! for(index=0;indexnext) ! { ! ipc_print_neigh_link( neighbor_table_tmp ); ! } ! } ! /* Topology */ ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! ipc_print_tc_link(tc, tc_edge); ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); ! /* HNA entries */ ! for(index=0;indexnext) { ! /* Check all networks */ ! struct hna_net *tmp_net; ! for (tmp_net = tmp_hna->networks.next; tmp_net != &tmp_hna->networks; tmp_net = tmp_net->next) { ! ipc_print_net(&tmp_hna->A_gateway_addr, ! &tmp_net->A_network_addr, ! &tmp_net->A_netmask); ! } ! } } ! /* Local HNA entries */ if (olsr_cnf->ip_version == AF_INET) { ! struct local_hna_entry *hna; ! for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { ! union olsr_ip_addr netmask; ! union hna_netmask hna_msk; ! //hna_msk.v4 = hna4->netmask.v4; ! olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! hna_msk.v4 = netmask.v4.s_addr; ! ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, ! &hna->net.prefix, ! &hna_msk); ! ! } } else { ! struct local_hna_entry *hna; ! for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { ! union hna_netmask hna_msk; ! hna_msk.v6 = hna->net.prefix_len; ! ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, ! &hna->net.prefix, ! &hna_msk); ! } } ! ! ipc_send_str("}\n\n"); ! ! res = 1; } ! if (!ipc_socket_up) { plugin_ipc_init(); } --- 279,345 ---- int changes_hna) { ! int res = 0; ! if(changes_neighborhood || changes_topology || changes_hna) { ! struct neighbor_entry *neighbor_table_tmp; ! struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; ! struct local_hna_entry *hna; ! int idx; ! ! /* Print tables to IPC socket */ ! ipc_send_str("digraph topology\n{\n"); ! /* Neighbors */ ! for (idx = 0; idx < HASHSIZE; idx++) { ! for(neighbor_table_tmp = neighbortable[idx].next; ! neighbor_table_tmp != &neighbortable[idx]; ! neighbor_table_tmp = neighbor_table_tmp->next){ ! ipc_print_neigh_link( neighbor_table_tmp ); ! } ! } ! /* Topology */ ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! ipc_print_tc_link(tc, tc_edge); ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); ! /* HNA entries */ ! for (idx = 0; idx < HASHSIZE; idx++) { ! struct hna_entry *tmp_hna; ! /* Check all entrys */ ! for (tmp_hna = hna_set[idx].next; tmp_hna != &hna_set[idx]; tmp_hna = tmp_hna->next) { ! /* Check all networks */ ! struct hna_net *tmp_net; ! for (tmp_net = tmp_hna->networks.next; tmp_net != &tmp_hna->networks; tmp_net = tmp_net->next) { ! ipc_print_net(&tmp_hna->A_gateway_addr, ! &tmp_net->A_network_addr, ! &tmp_net->A_netmask); ! } } + } ! /* Local HNA entries */ ! for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { ! union hna_netmask hna_msk; if (olsr_cnf->ip_version == AF_INET) { ! union olsr_ip_addr netmask; ! //hna_msk.v4 = hna4->netmask.v4; ! olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); ! hna_msk.v4 = netmask.v4.s_addr; } else { ! hna_msk.v6 = hna->net.prefix_len; } ! ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, ! &hna->net.prefix, ! &hna_msk); } + ipc_send_str("}\n\n"); + res = 1; + } ! if (ipc_socket == -1) { plugin_ipc_init(); } *************** *** 378,389 **** ipc_print_tc_link(const struct tc_entry *entry, const struct tc_edge_entry *dst_entry) { - char buf[512]; struct ipaddr_str strbuf1, strbuf2; ! sprintf( buf, "\"%s\" -> \"%s\"[label=\"%.2f\"];\n", ! olsr_ip_to_string(&strbuf1, &entry->addr), ! olsr_ip_to_string(&strbuf2, &dst_entry->T_dest_addr), ! olsr_calc_tc_etx(dst_entry)); ! ipc_send_str(buf); } --- 350,359 ---- ipc_print_tc_link(const struct tc_entry *entry, const struct tc_edge_entry *dst_entry) { struct ipaddr_str strbuf1, strbuf2; ! ipc_send_fmt("\"%s\" -> \"%s\"[label=\"%.2f\"];\n", ! olsr_ip_to_string(&strbuf1, &entry->addr), ! olsr_ip_to_string(&strbuf2, &dst_entry->T_dest_addr), ! olsr_calc_tc_etx(dst_entry)); } *************** *** 392,425 **** ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, const union hna_netmask *mask) { - char buf[512]; struct ipaddr_str gwbuf, netbuf; ! sprintf( buf, "\"%s\" -> \"%s/%s\"[label=\"HNA\"];\n", ! olsr_ip_to_string(&gwbuf, gw), ! olsr_ip_to_string(&netbuf, net), ! olsr_netmask_to_string(mask)); ! ipc_send_str(buf); ! ! sprintf( buf,"\"%s/%s\"[shape=diamond];\n", ! olsr_ip_to_string(&netbuf, net), ! olsr_netmask_to_string(mask)); ! ipc_send_str(buf); ! } ! static int ! ipc_send_str(const char *data) ! { ! if(!ipc_open) ! return 0; ! return ipc_send(data, strlen(data)); } ! ! static int ipc_send(const char *data, int size) { ! if(!ipc_open) ! return 0; ! #if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __MacOSX__ #define FLAGS 0 --- 362,381 ---- ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, const union hna_netmask *mask) { struct ipaddr_str gwbuf, netbuf; ! ipc_send_fmt("\"%s\" -> \"%s/%s\"[label=\"HNA\"];\n", ! olsr_ip_to_string(&gwbuf, gw), ! olsr_ip_to_string(&netbuf, net), ! olsr_netmask_to_string(mask)); ! ipc_send_fmt("\"%s/%s\"[shape=diamond];\n", ! olsr_ip_to_string(&netbuf, net), ! olsr_netmask_to_string(mask)); } ! static void ipc_send(const char *data, int size) { ! if (ipc_connection != -1) { #if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __MacOSX__ #define FLAGS 0 *************** *** 427,439 **** #define FLAGS MSG_NOSIGNAL #endif ! if (send(ipc_connection, data, size, FLAGS) == -1) ! { olsr_printf(1, "(DOT DRAW)IPC connection lost!\n"); ! close(ipc_connection); ! ipc_open = 0; ! return -1; } ! return 1; } --- 383,405 ---- #define FLAGS MSG_NOSIGNAL #endif ! if (send(ipc_connection, data, size, FLAGS) == -1) { olsr_printf(1, "(DOT DRAW)IPC connection lost!\n"); ! CLOSE(ipc_connection); } + } + } ! static void ! ipc_send_fmt(const char *format, ...) ! { ! if (ipc_connection != -1) { ! char buf[4096]; ! int len; ! va_list arg; ! va_start(arg, format); ! len = vsnprintf(buf, sizeof(buf), format, arg); ! va_end(arg); ! ipc_send(buf, len); ! } } *************** *** 444,448 **** struct in_addr in; ! if(olsr_cnf->ip_version == AF_INET) { in.s_addr = mask->v4; ret = inet_ntoa(in); --- 410,414 ---- struct in_addr in; ! if (olsr_cnf->ip_version == AF_INET) { in.s_addr = mask->v4; ret = inet_ntoa(in); From (spam-protected) Fri Nov 16 22:43:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 21:43:57 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.115,1.116 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18770 Modified Files: CHANGELOG Log Message: PATCH by Hannes Gredler : - refactoring of TC parsing to kill another pile of malloc()/free()s saving (again) code and especially run.time performance. Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** CHANGELOG 14 Nov 2007 11:08:05 -0000 1.115 --- CHANGELOG 16 Nov 2007 21:43:55 -0000 1.116 *************** *** 4,10 **** 0.5.5 --------------------------------------------------------------------- ! BUGFIX by Hannes Gredler - fix not deleted tc entry. - avoid setting routes with an invalid/impossible netmask. PATCH by John Hay : --- 4,12 ---- 0.5.5 --------------------------------------------------------------------- ! BUGFIXES and PATCHES by Hannes Gredler - fix not deleted tc entry. - avoid setting routes with an invalid/impossible netmask. + - refactoring of TC parsing to kill another pile of malloc()/free()s + saving (again) code and especially run.time performance. PATCH by John Hay : From (spam-protected) Fri Nov 16 22:43:58 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 21:43:58 +0000 Subject: [Olsr-cvs] olsrd-current/src lq_packet.c, 1.29, 1.30 lq_packet.h, 1.8, 1.9 lq_route.c, 1.58, 1.59 process_package.c, 1.44, 1.45 process_package.h, 1.13, 1.14 rebuild_packet.c, 1.23, 1.24 rebuild_packet.h, 1.9, 1.10 tc_set.c, 1.36, 1.37 tc_set.h, 1.22, 1.23 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18770/src Modified Files: lq_packet.c lq_packet.h lq_route.c process_package.c process_package.h rebuild_packet.c rebuild_packet.h tc_set.c tc_set.h Log Message: PATCH by Hannes Gredler : - refactoring of TC parsing to kill another pile of malloc()/free()s saving (again) code and especially run.time performance. Index: tc_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tc_set.h 8 Nov 2007 22:47:41 -0000 1.22 --- tc_set.h 16 Nov 2007 21:43:55 -0000 1.23 *************** *** 63,67 **** struct tc_entry *tc; /* backpointer to owning tc entry */ clock_t T_time; /* expiration timer, timer_node key */ ! olsr_u16_t T_seq; /* sequence number */ olsr_u16_t flags; /* misc flags */ float etx; /* metric used for SPF calculation */ --- 63,67 ---- struct tc_entry *tc; /* backpointer to owning tc entry */ clock_t T_time; /* expiration timer, timer_node key */ ! olsr_u16_t T_seq; /* sequence number of the advertised neighbor set */ olsr_u16_t flags; /* misc flags */ float etx; /* metric used for SPF calculation */ *************** *** 86,89 **** --- 86,91 ---- struct link_entry *next_hop; /* SPF calculated link to the 1st hop neighbor */ float path_etx; /* SPF calculated distance, cand_tree_node key */ + olsr_u16_t msg_seq; /* sequence number of the tc message */ + olsr_u8_t msg_hops; /* hopcount as per the tc message */ olsr_u8_t hops; /* SPF calculated hopcount */ }; *************** *** 120,128 **** void olsr_init_tc(void); void olsr_change_myself_tc(void); - int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *); - int olsr_tc_update_mprs(struct tc_entry *, struct tc_message *); void olsr_print_tc_table(void); void olsr_time_out_tc_set(void); /* tc_entry manipulation */ struct tc_entry *olsr_lookup_tc_entry(union olsr_ip_addr *); --- 122,132 ---- void olsr_init_tc(void); void olsr_change_myself_tc(void); void olsr_print_tc_table(void); void olsr_time_out_tc_set(void); + /* tc msg input parser */ + void olsr_input_tc(union olsr_message *, struct interface *, + union olsr_ip_addr *from); + /* tc_entry manipulation */ struct tc_entry *olsr_lookup_tc_entry(union olsr_ip_addr *); Index: process_package.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** process_package.h 8 Nov 2007 22:47:41 -0000 1.13 --- process_package.h 16 Nov 2007 21:43:55 -0000 1.14 *************** *** 58,67 **** void - olsr_tc_tap(struct tc_message *, struct interface *, union olsr_ip_addr *, union olsr_message *); - - void - olsr_process_received_tc(union olsr_message *, struct interface *, union olsr_ip_addr *); - - void olsr_process_received_mid(union olsr_message *, struct interface *, union olsr_ip_addr *); --- 58,61 ---- Index: rebuild_packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** rebuild_packet.h 8 Nov 2007 22:47:41 -0000 1.9 --- rebuild_packet.h 16 Nov 2007 21:43:55 -0000 1.10 *************** *** 61,66 **** hello_chgestruct(struct hello_message *, const union olsr_message *); - void - tc_chgestruct(struct tc_message *, const union olsr_message *, const union olsr_ip_addr *); - #endif --- 61,63 ---- Index: lq_packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** lq_packet.h 29 Aug 2007 22:57:17 -0000 1.8 --- lq_packet.h 16 Nov 2007 21:43:55 -0000 1.9 *************** *** 45,48 **** --- 45,49 ---- #include "olsr_types.h" #include "packet.h" + #include "mantissa.h" #define LQ_HELLO_MESSAGE 201 *************** *** 141,144 **** --- 142,173 ---- }; + static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); } + static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); } + static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); } + static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(olsr_8_t *)(*p); *p += sizeof(olsr_8_t); } + static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); } + static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); } + static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); } + static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } + static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (double)**p / 255.0; *p += sizeof(olsr_u8_t); } + + static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); } + static INLINE void pkt_ignore_u16(const olsr_u8_t **p) { *p += sizeof(olsr_u16_t); } + static INLINE void pkt_ignore_u32(const olsr_u8_t **p) { *p += sizeof(olsr_u32_t); } + static INLINE void pkt_ignore_s8(const olsr_u8_t **p) { *p += sizeof(olsr_8_t); } + static INLINE void pkt_ignore_s16(const olsr_u8_t **p) { *p += sizeof(olsr_16_t); } + static INLINE void pkt_ignore_s32(const olsr_u8_t **p) { *p += sizeof(olsr_32_t); } + static INLINE void pkt_ignore_ipaddress(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; } + + static INLINE void pkt_put_u8(olsr_u8_t **p, const olsr_u8_t var) { *(olsr_u8_t *)(*p) = var; *p += sizeof(olsr_u8_t); } + static INLINE void pkt_put_u16(olsr_u8_t **p, const olsr_u16_t var) { *(olsr_u16_t *)(*p) = htons(var); *p += sizeof(olsr_u16_t); } + static INLINE void pkt_put_u32(olsr_u8_t **p, const olsr_u32_t var) { *(olsr_u32_t *)(*p) = htonl(var); *p += sizeof(olsr_u32_t); } + static INLINE void pkt_put_s8(olsr_u8_t **p, const olsr_8_t var) { *(olsr_8_t *)(*p) = var; *p += sizeof(olsr_8_t); } + static INLINE void pkt_put_s16(olsr_u8_t **p, const olsr_16_t var) { *(olsr_16_t *)(*p) = htons(var); *p += sizeof(olsr_16_t); } + static INLINE void pkt_put_s32(olsr_u8_t **p, const olsr_32_t var) { *(olsr_32_t *)(*p) = htonl(var); *p += sizeof(olsr_32_t); } + static INLINE void pkt_put_double(olsr_u8_t **p, const double var) { **p = double_to_me(var); *p += sizeof(olsr_u8_t); } + static INLINE void pkt_put_ipaddress(olsr_u8_t **p, const union olsr_ip_addr var) { memcpy(*p, &var, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } + static INLINE void pkt_put_lq(olsr_u8_t **p, const double var) { **p = var * 255.0; *p += sizeof(olsr_u8_t); } + void olsr_output_lq_hello(void *para); *************** *** 148,154 **** union olsr_ip_addr *from); - void olsr_input_lq_tc(union olsr_message *ser, struct interface *inif, - union olsr_ip_addr *from); - extern olsr_bool lq_tc_pending; --- 177,180 ---- Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** lq_route.c 16 Nov 2007 19:12:55 -0000 1.58 --- lq_route.c 16 Nov 2007 21:43:55 -0000 1.59 *************** *** 42,45 **** --- 42,47 ---- */ + #define SPF_PROFILING 1 + #include "defs.h" #include "olsr.h" *************** *** 490,494 **** timersub(&t5, &t4, &kernel); timersub(&t5, &t1, &total); ! olsr_printf(1, "\n--- SPF-stats for %d nodes, %d routes (total/init/run/route/kern): " "%d, %d, %d, %d, %d\n", path_count, routingtree.count, --- 492,496 ---- timersub(&t5, &t4, &kernel); timersub(&t5, &t1, &total); ! OLSR_PRINTF(1, "\n--- SPF-stats for %d nodes, %d routes (total/init/run/route/kern): " "%d, %d, %d, %d, %d\n", path_count, routingtree.count, Index: rebuild_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** rebuild_packet.c 8 Nov 2007 22:47:41 -0000 1.23 --- rebuild_packet.c 16 Nov 2007 21:43:55 -0000 1.24 *************** *** 464,570 **** } - - - /** - *Process/rebuild TC message. Converts the OLSR - *packet to the internal tc_message format. - *@param tmsg the tc_message struct in wich infomation - *is to be put. - *@param m the entire OLSR message revieved. - *@param from a sockaddr struct describing the 1 hop sender - *@return negative on error - */ - - void - tc_chgestruct(struct tc_message *tmsg, const union olsr_message *m, const union olsr_ip_addr *from_addr) - { - struct tc_mpr_addr *mprs; - - tmsg->multipoint_relay_selector_address = NULL; - - if ((!m) || (m->v4.olsr_msgtype != TC_MESSAGE)) - return; - - if(olsr_cnf->ip_version == AF_INET) - { - /* IPv4 */ - const struct olsr_tcmsg *tc = &m->v4.message.tc; - const struct neigh_info *mprsaddr = tc->neigh; - const struct neigh_info *maddr; - const union olsr_ip_addr * const tmp_addr = mid_lookup_main_addr(from_addr); - - if(tmp_addr == NULL) { - //COPY_IP(&tmsg->source_addr, from_addr); - tmsg->source_addr = *from_addr; - } else { - //COPY_IP(&tmsg->source_addr, tmp_addr); - tmsg->source_addr = *tmp_addr; - } - - /* Get vtime */ - tmsg->vtime = me_to_double(m->v4.olsr_vtime); - - OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime); - - //COPY_IP(&tmsg->originator, &m->v4.originator); - tmsg->originator.v4.s_addr = m->v4.originator; - tmsg->packet_seq_number = ntohs(m->v4.seqno); - tmsg->hop_count = m->v4.hopcnt; - tmsg->ansn = ntohs(tc->ansn); - - //printf("TC from %s seqno %d\n", olsr_ip_to_string(&buf, &tmsg->originator), tmsg->packet_seq_number); - - for (maddr = mprsaddr; (char *)maddr < ((char *)m + (ntohs(m->v4.olsr_msgsize))); maddr++) - { - - mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct"); - - //COPY_IP(&mprs->address, &maddr->addr); - mprs->address.v4.s_addr = maddr->addr; - mprs->next = tmsg->multipoint_relay_selector_address; - tmsg->multipoint_relay_selector_address = mprs; - } - } - else - { - /* IPv6 */ - const struct neigh_info6 *maddr6; - const struct olsr_tcmsg6 *tc6 = &m->v6.message.tc; - const struct neigh_info6 *mprsaddr6 = tc6->neigh; - const union olsr_ip_addr * const tmp_addr = mid_lookup_main_addr(from_addr); - - if(tmp_addr == NULL) { - //COPY_IP(&tmsg->source_addr, from_addr); - tmsg->source_addr = *from_addr; - } else { - //COPY_IP(&tmsg->source_addr, tmp_addr); - tmsg->source_addr = *tmp_addr; - } - - /* Check if sender is symmetric neighbor here !! */ - - /* Get vtime */ - tmsg->vtime = me_to_double(m->v6.olsr_vtime); - - OLSR_PRINTF(3, "Got TC vtime: %f\n", tmsg->vtime); - - //COPY_IP(&tmsg->originator, &m->v6.originator); - tmsg->originator.v6 = m->v6.originator; - tmsg->packet_seq_number = ntohs(m->v6.seqno); - tmsg->hop_count = m->v6.hopcnt; - tmsg->ansn = ntohs(tc6->ansn); - - for (maddr6 = mprsaddr6; (char *)maddr6 < ((char *)m + (ntohs(m->v6.olsr_msgsize))); maddr6++) - { - - mprs = olsr_malloc(sizeof(struct tc_mpr_addr), "TC chgestruct 2"); - - //COPY_IP(&mprs->address, &maddr6->addr); - mprs->address.v6 = maddr6->addr; - mprs->next = tmsg->multipoint_relay_selector_address; - tmsg->multipoint_relay_selector_address = mprs; - } - - } - - } --- 464,465 ---- Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** process_package.c 9 Nov 2007 00:11:01 -0000 1.44 --- process_package.c 16 Nov 2007 21:43:55 -0000 1.45 *************** *** 67,76 **** { olsr_parser_add_function(&olsr_process_received_hello, HELLO_MESSAGE, 1); ! olsr_parser_add_function(&olsr_process_received_tc, TC_MESSAGE, 1); } else { olsr_parser_add_function(&olsr_input_lq_hello, LQ_HELLO_MESSAGE, 1); ! olsr_parser_add_function(&olsr_input_lq_tc, LQ_TC_MESSAGE, 1); } --- 67,76 ---- { olsr_parser_add_function(&olsr_process_received_hello, HELLO_MESSAGE, 1); ! olsr_parser_add_function(&olsr_input_tc, TC_MESSAGE, 1); } else { olsr_parser_add_function(&olsr_input_lq_hello, LQ_HELLO_MESSAGE, 1); ! olsr_parser_add_function(&olsr_input_tc, LQ_TC_MESSAGE, 1); } *************** *** 223,336 **** } - void - olsr_tc_tap(struct tc_message *message, - struct interface *in_if, - union olsr_ip_addr *from_addr, - union olsr_message *m) - { - #ifndef NODEBUG - struct ipaddr_str buf; - #endif - struct tc_mpr_addr *mpr; - struct tc_entry *tc_last; - - if (olsr_check_dup_table_proc(&message->originator, - message->packet_seq_number)) { - OLSR_PRINTF(3, "Processing TC from %s, seq 0x%04x\n", - olsr_ip_to_string(&buf, &message->originator), message->ansn); - - /* - * If the sender interface (NB: not originator) of this message - * is not in the symmetric 1-hop neighborhood of this node, the - * message MUST be discarded. - */ - - if (check_neighbor_link(from_addr) != SYM_LINK) { - OLSR_PRINTF(2, "Received TC from NON SYM neighbor %s\n", - olsr_ip_to_string(&buf, from_addr)); - olsr_free_tc_packet(message); - return; - } - - if (olsr_cnf->debug_level > 2) { - mpr = message->multipoint_relay_selector_address; - OLSR_PRINTF(3, "mpr_selector_list:["); - - while (mpr != NULL) { - OLSR_PRINTF(3, "%s:", olsr_ip_to_string(&buf, &mpr->address)); - mpr=mpr->next; - } - - OLSR_PRINTF(3, "]\n"); - } - - tc_last = olsr_lookup_tc_entry(&message->originator); - - if(tc_last != NULL) { - /* Update entry */ - - /* Delete destinations with lower ANSN */ - if(olsr_tc_delete_mprs(tc_last, message)) { - changes_topology = OLSR_TRUE; - } - /* Update destinations */ - if(olsr_tc_update_mprs(tc_last, message)) { - changes_topology = OLSR_TRUE; - } - } else { - /*if message is empty then skip it */ - if (message->multipoint_relay_selector_address != NULL) { - /* New entry */ - tc_last = olsr_add_tc_entry(&message->originator); - - /* Update destinations */ - olsr_tc_update_mprs(tc_last, message); - - changes_topology = OLSR_TRUE; - } else { - OLSR_PRINTF(3, "Dropping empty TC from %s\n", - olsr_ip_to_string(&buf, &message->originator)); - } - } - - /* Process changes */ - //olsr_process_changes(); - - } - - olsr_forward_message(m, - &message->originator, - message->packet_seq_number, - in_if, - from_addr); - - olsr_free_tc_packet(message); - } - - /** - *Process a received TopologyControl message - * - * - *@param m the incoming OLSR message - *@return 0 on success - */ - void - olsr_process_received_tc(union olsr_message *m, - struct interface *in_if, - union olsr_ip_addr *from_addr) - { - struct tc_message message; - - tc_chgestruct(&message, m, from_addr); - - if(!olsr_validate_address(&message.source_addr)) - { - olsr_free_tc_packet(&message); - return; - } - - olsr_tc_tap(&message, in_if, from_addr, m); - } - /** *Process a received(and parsed) MID message --- 223,226 ---- Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** tc_set.c 8 Nov 2007 22:47:41 -0000 1.36 --- tc_set.c 16 Nov 2007 21:43:55 -0000 1.37 *************** *** 42,49 **** --- 42,52 ---- #include "tc_set.h" + #include "mid_set.h" + #include "link_set.h" #include "olsr.h" #include "scheduler.h" #include "lq_route.h" #include "lq_avl.h" + #include "lq_packet.h" #include "net_olsr.h" *************** *** 280,284 **** /* Fill entry */ - //COPY_IP(&tc_edge->T_dest_addr, addr); tc_edge->T_dest_addr = *addr; olsr_set_tc_edge_timer(tc_edge, vtime*1000); --- 283,286 ---- *************** *** 395,407 **** /** ! * Delete all destinations that have a ! * lower ANSN than the one in the message * * @param tc the entry to delete edges from ! * @param msg the message to fetch the ANSN from * @return 1 if any destinations were deleted 0 if not */ ! int ! olsr_tc_delete_mprs(struct tc_entry *tc, struct tc_message *msg) { struct tc_edge_entry *tc_edge; --- 397,408 ---- /** ! * Delete all destinations that have a lower ANSN. * * @param tc the entry to delete edges from ! * @param ansn the advertised neighbor set sequence number * @return 1 if any destinations were deleted 0 if not */ ! static int ! olsr_delete_outdated_tc_edges(struct tc_entry *tc, olsr_u16_t ansn) { struct tc_edge_entry *tc_edge; *************** *** 413,417 **** OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! if (SEQNO_GREATER_THAN(msg->ansn, tc_edge->T_seq)) { /* * Do not delete the edge now, just mark the edge as down. --- 414,418 ---- OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! if (SEQNO_GREATER_THAN(ansn, tc_edge->T_seq)) { /* * Do not delete the edge now, just mark the edge as down. *************** *** 456,546 **** /** ! * Update the destinations registered on an entry. ! * Creates new dest-entries if not registered. ! * Bases update on a receivied TC message * * @param entry the TC entry to check ! * @msg the TC message to update by * @return 1 if entries are added 0 if not */ ! int ! olsr_tc_update_mprs(struct tc_entry *tc, struct tc_message *msg) { - struct tc_mpr_addr *mprs; struct tc_edge_entry *tc_edge; int edge_change; - #if 0 - OLSR_PRINTF(1, "TC: update MPRS\n"); - #endif - edge_change = 0; ! mprs = msg->multipoint_relay_selector_address; ! ! /* Add all the MPRs */ ! while (mprs) { ! /* First check if we know this edge */ ! tc_edge = olsr_lookup_tc_edge(tc, &mprs->address); ! if(!tc_edge) { ! /* ! * Yet unknown - create it. ! */ ! olsr_add_tc_edge_entry(tc, &mprs->address, msg->ansn, ! (unsigned int )msg->vtime, ! mprs->link_quality, mprs->neigh_link_quality); ! edge_change = 1; ! } else { ! /* ! * We know this edge - Update entry. ! */ ! olsr_set_tc_edge_timer(tc_edge, msg->vtime*1000); ! tc_edge->T_seq = msg->ansn; ! /* ! * Clear the (possibly set) down flag. ! */ ! tc_edge->flags &= ~OLSR_TC_EDGE_DOWN; ! /* ! * Determine if the etx change is meaningful enough ! * in order to trigger a SPF calculation. ! */ ! if (olsr_etx_significant_change(tc_edge->link_quality, ! mprs->neigh_link_quality)) { ! if (msg->hop_count <= olsr_cnf->lq_dlimit) ! edge_change = 1; ! } ! tc_edge->link_quality = mprs->neigh_link_quality; ! if (olsr_etx_significant_change(tc_edge->inverse_link_quality, ! mprs->link_quality)) { ! if (msg->hop_count <= olsr_cnf->lq_dlimit) ! edge_change = 1; ! } ! tc_edge->inverse_link_quality = mprs->link_quality; ! /* ! * Update the etx. ! */ ! olsr_calc_tc_edge_entry_etx(tc_edge); #if 0 ! if (edge_change) { ! OLSR_PRINTF(1, "TC: chg edge entry %s\n", ! olsr_tc_edge_to_string(tc_edge)); ! } #endif - } - mprs = mprs->next; } --- 457,556 ---- /** ! * Update an edge registered on an entry. ! * Creates new edge-entries if not registered. ! * Bases update on a received TC message * * @param entry the TC entry to check ! * @pkt the TC edge entry in the packet * @return 1 if entries are added 0 if not */ ! static int ! olsr_tc_update_edge(struct tc_entry *tc, unsigned int vtime_s, olsr_u16_t ansn, ! olsr_u8_t type, const unsigned char **curr) { struct tc_edge_entry *tc_edge; + double link_quality, neigh_link_quality; + union olsr_ip_addr neighbor; int edge_change; edge_change = 0; ! /* ! * Fetch the per-edge data ! * LQ messages also contain LQ data. ! */ ! pkt_get_ipaddress(curr, &neighbor); ! if (type == LQ_TC_MESSAGE) { ! pkt_get_lq(curr, &link_quality); ! pkt_get_lq(curr, &neigh_link_quality); ! pkt_ignore_u16(curr); ! } else { ! link_quality = 1.0; ! neigh_link_quality = 1.0; ! } ! /* First check if we know this edge */ ! tc_edge = olsr_lookup_tc_edge(tc, &neighbor); ! if(!tc_edge) { ! /* ! * Yet unknown - create it. ! * Check if the address is allowed. ! */ ! if (!olsr_validate_address(&neighbor)) { ! return 0; ! } ! olsr_add_tc_edge_entry(tc, &neighbor, ansn, vtime_s, ! link_quality, neigh_link_quality); ! edge_change = 1; ! } else { ! /* ! * We know this edge - Update entry. ! */ ! olsr_set_tc_edge_timer(tc_edge, vtime_s*1000); ! tc_edge->T_seq = ansn; ! /* ! * Clear the (possibly set) down flag. ! */ ! tc_edge->flags &= ~OLSR_TC_EDGE_DOWN; ! /* ! * Determine if the etx change is meaningful enough ! * in order to trigger a SPF calculation. ! */ ! if (olsr_etx_significant_change(tc_edge->link_quality, ! neigh_link_quality)) { ! if (tc->msg_hops <= olsr_cnf->lq_dlimit) ! edge_change = 1; ! } ! tc_edge->link_quality = neigh_link_quality; ! if (olsr_etx_significant_change(tc_edge->inverse_link_quality, ! link_quality)) { ! if (tc->msg_hops <= olsr_cnf->lq_dlimit) ! edge_change = 1; ! } ! tc_edge->inverse_link_quality = link_quality; ! ! /* ! * Update the etx. ! */ ! olsr_calc_tc_edge_entry_etx(tc_edge); #if 0 ! if (edge_change) { ! OLSR_PRINTF(1, "TC: chg edge entry %s\n", ! olsr_tc_edge_to_string(tc_edge)); ! } #endif } *************** *** 638,641 **** --- 648,780 ---- /* + * Process an incoming TC or TC_LQ message. + * + * If the message is interesting enough, update our edges for it, + * trigger SPF and finally flood it to all our 2way neighbors. + * + * The order for extracting data off the message does matter, + * as every call to pkt_get increases the packet offset and + * hence the spot we are looking at. + */ + void + olsr_input_tc(union olsr_message *msg, struct interface *input_if, + union olsr_ip_addr *from_addr) + { + #ifndef NODEBUG + struct ipaddr_str buf; + #endif + olsr_u16_t size, msg_seq, ansn; + olsr_u8_t type, ttl, msg_hops; + double vtime; + unsigned int vtime_s; + union olsr_ip_addr originator; + union olsr_ip_addr *main_addr; + const unsigned char *limit, *curr; + struct tc_entry *tc; + + curr = (void *)msg; + if (!msg) { + return; + } + + /* We are only interested in TC message types. */ + pkt_get_u8(&curr, &type); + if ((type != LQ_TC_MESSAGE) && (type != TC_MESSAGE)) { + return; + } + + pkt_get_double(&curr, &vtime); + vtime_s = (unsigned int)vtime; + pkt_get_u16(&curr, &size); + + pkt_get_ipaddress(&curr, &originator); + + /* Copy header values */ + pkt_get_u8(&curr, &ttl); + pkt_get_u8(&curr, &msg_hops); + pkt_get_u16(&curr, &msg_seq); + pkt_get_u16(&curr, &ansn); + pkt_ignore_u16(&curr); + + /* + * Check if we know this guy and if we already know what he has to say. + */ + tc = olsr_lookup_tc_entry(&originator); + if (tc) { + if (!SEQNO_GREATER_THAN(msg_seq, tc->msg_seq)) { + return; + } + } + + /* Check the sender address. */ + if (!olsr_validate_address(&originator)) { + return; + } + + /* Check the main address. */ + main_addr = mid_lookup_main_addr(from_addr); + if (!main_addr) { + main_addr = from_addr; + } + if (!olsr_validate_address(main_addr)) { + return; + } + + /* + * Generate an new tc_entry in the lsdb and store the sequence number. + */ + if (!tc) { + tc = olsr_add_tc_entry(&originator); + tc->msg_seq = msg_seq; + } + + OLSR_PRINTF(1, "Processing TC from %s, seq 0x%04x\n", + olsr_ip_to_string(&buf, &originator), ansn); + + /* + * If the sender interface (NB: not originator) of this message + * is not in the symmetric 1-hop neighborhood of this node, the + * message MUST be discarded. + */ + if (check_neighbor_link(from_addr) != SYM_LINK) { + OLSR_PRINTF(2, "Received TC from NON SYM neighbor %s\n", + olsr_ip_to_string(&buf, from_addr)); + return; + } + + /* + * Update the tc entry. + */ + tc->msg_hops = msg_hops; + tc->msg_seq = msg_seq; + + /* + * Now walk the edge advertisements contained in the packet. + * Play some efficiency games here, like checking first + * if the edge exists in order to avoid address validation. + */ + limit = (void *)msg + size; + while (curr < limit) { + if (olsr_tc_update_edge(tc, vtime_s, ansn, type, &curr)) { + changes_topology = OLSR_TRUE; + } + } + + /* + * Do the edge garbage collection at the end in order + * to avoid malloc() churn. + */ + if (olsr_delete_outdated_tc_edges(tc, ansn)) { + changes_topology = OLSR_TRUE; + } + + /* + * Last, flood the message to our other neighbors. + */ + olsr_forward_message(msg, &originator, msg_seq, input_if, from_addr); + return; + } + + /* * Local Variables: * c-basic-offset: 2 Index: lq_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** lq_packet.c 8 Nov 2007 22:47:41 -0000 1.29 --- lq_packet.c 16 Nov 2007 21:43:55 -0000 1.30 *************** *** 63,96 **** static unsigned char msg_buffer[MAXMESSAGESIZE - OLSR_HEADERSIZE]; - static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); } - static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); } - static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); } - static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(olsr_8_t *)(*p); *p += sizeof(olsr_8_t); } - static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); } - static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); } - static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); } - static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } - static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (double)**p / 255.0; *p += sizeof(olsr_u8_t); } - - static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); } - static INLINE void pkt_ignore_u16(const olsr_u8_t **p) { *p += sizeof(olsr_u16_t); } - static INLINE void pkt_ignore_u32(const olsr_u8_t **p) { *p += sizeof(olsr_u32_t); } - static INLINE void pkt_ignore_s8(const olsr_u8_t **p) { *p += sizeof(olsr_8_t); } - static INLINE void pkt_ignore_s16(const olsr_u8_t **p) { *p += sizeof(olsr_16_t); } - static INLINE void pkt_ignore_s32(const olsr_u8_t **p) { *p += sizeof(olsr_32_t); } - static INLINE void pkt_ignore_ipaddress(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; } - - static INLINE void pkt_put_u8(olsr_u8_t **p, const olsr_u8_t var) { *(olsr_u8_t *)(*p) = var; *p += sizeof(olsr_u8_t); } - static INLINE void pkt_put_u16(olsr_u8_t **p, const olsr_u16_t var) { *(olsr_u16_t *)(*p) = htons(var); *p += sizeof(olsr_u16_t); } - static INLINE void pkt_put_u32(olsr_u8_t **p, const olsr_u32_t var) { *(olsr_u32_t *)(*p) = htonl(var); *p += sizeof(olsr_u32_t); } - static INLINE void pkt_put_s8(olsr_u8_t **p, const olsr_8_t var) { *(olsr_8_t *)(*p) = var; *p += sizeof(olsr_8_t); } - static INLINE void pkt_put_s16(olsr_u8_t **p, const olsr_16_t var) { *(olsr_16_t *)(*p) = htons(var); *p += sizeof(olsr_16_t); } - static INLINE void pkt_put_s32(olsr_u8_t **p, const olsr_32_t var) { *(olsr_32_t *)(*p) = htonl(var); *p += sizeof(olsr_32_t); } - static INLINE void pkt_put_double(olsr_u8_t **p, const double var) { **p = double_to_me(var); *p += sizeof(olsr_u8_t); } - static INLINE void pkt_put_ipaddress(olsr_u8_t **p, const union olsr_ip_addr var) { memcpy(*p, &var, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } - static INLINE void pkt_put_lq(olsr_u8_t **p, const double var) { **p = var * 255.0; *p += sizeof(olsr_u8_t); } - - - static void create_lq_hello(struct lq_hello_message *lq_hello, struct interface *outif) --- 63,66 ---- *************** *** 642,716 **** } - static int - deserialize_lq_tc(struct tc_message *tc, - const void *ser, - union olsr_ip_addr *from) - { - const union olsr_ip_addr *addr; - olsr_u8_t type; - olsr_u16_t size; - const unsigned char *limit; - - // convert received packet from transmission format into internal format - const unsigned char *curr = ser; - pkt_get_u8(&curr, &type); - if (type != LQ_TC_MESSAGE) { - /* No need to do anything more */ - return 1; - } - pkt_get_double(&curr, &tc->vtime); - pkt_get_u16(&curr, &size); - // Sven-Ola: Check the message source addr - if (!olsr_validate_address((const union olsr_ip_addr *)curr)) { - /* No need to do anything more */ - return 1; - } - pkt_get_ipaddress(&curr, &tc->originator); - - addr = mid_lookup_main_addr(from); - if (addr == NULL) { - addr = from; - } - // Sven-Ola: Check the message source addr - if (!olsr_validate_address(addr)) { - return 1; - } - //COPY_IP(&tc->source_addr, addr); - tc->source_addr = *addr; - - pkt_get_u8(&curr, &tc->ttl); - pkt_get_u8(&curr, &tc->hop_count); - pkt_get_u16(&curr, &tc->packet_seq_number); - pkt_get_u16(&curr, &tc->ansn); - pkt_ignore_u16(&curr); - - tc->multipoint_relay_selector_address = NULL; - limit = ser + size; - while (curr < limit) { - struct tc_mpr_addr *neigh; - - if (!olsr_validate_address((const union olsr_ip_addr *)curr)) { - /* Ignore the same amount as below */ - pkt_ignore_ipaddress(&curr); - pkt_ignore_u8(&curr); - pkt_ignore_u8(&curr); - pkt_ignore_u16(&curr); - continue; - } - - neigh = olsr_malloc(sizeof (struct tc_mpr_addr), "LQ_TC deserialization"); - - pkt_get_ipaddress(&curr, &neigh->address); - - pkt_get_lq(&curr, &neigh->link_quality); - pkt_get_lq(&curr, &neigh->neigh_link_quality); - pkt_ignore_u16(&curr); - - neigh->next = tc->multipoint_relay_selector_address; - tc->multipoint_relay_selector_address = neigh; - } - return 0; - } - void olsr_output_lq_hello(void *para) --- 612,615 ---- *************** *** 799,816 **** olsr_hello_tap(&hello, inif, from); } - - void - olsr_input_lq_tc(union olsr_message *ser, - struct interface *inif, - union olsr_ip_addr *from) - { - struct tc_message tc; - - if (ser == NULL) { - return; - } - if (deserialize_lq_tc(&tc, ser, from) != 0) { - return; - } - olsr_tc_tap(&tc, inif, from, ser); - } --- 698,699 ---- From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.44,1.45 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005 Modified Files: Makefile.inc Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Makefile.inc 16 Nov 2007 19:34:26 -0000 1.44 --- Makefile.inc 16 Nov 2007 22:56:53 -0000 1.45 *************** *** 76,79 **** --- 76,83 ---- WARNINGS += -Wwrite-strings WARNINGS += -Wbad-function-cast + #WARNINGS += -Wpointer-arith + WARNINGS += -Wcast-qual + #WARNINGS += -Wcast-align + #WARNINGS += -Wconversion #WARNINGS += -Wredundant-decls ifeq ($(MUDFLAP),0) From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current/lib/secure/src md5.c, 1.4, 1.5 olsrd_secure.c, 1.29, 1.30 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/secure/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/lib/secure/src Modified Files: md5.c olsrd_secure.c Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: md5.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/md5.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** md5.c 2 Nov 2007 15:51:46 -0000 1.4 --- md5.c 16 Nov 2007 22:56:54 -0000 1.5 *************** *** 269,273 **** if (inputLen >= partLen) { MD5_memcpy ! ((POINTER)&context->buffer[index], (POINTER)input, partLen); MD5Transform (context->state, context->buffer); --- 269,273 ---- if (inputLen >= partLen) { MD5_memcpy ! ((POINTER)&context->buffer[index], input, partLen); MD5Transform (context->state, context->buffer); *************** *** 282,286 **** /* Buffer remaining input */ MD5_memcpy ! ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i); } --- 282,286 ---- /* Buffer remaining input */ MD5_memcpy ! ((POINTER)&context->buffer[index], &input[i], inputLen-i); } Index: olsrd_secure.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/olsrd_secure.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** olsrd_secure.c 8 Nov 2007 22:47:40 -0000 1.29 --- olsrd_secure.c 16 Nov 2007 22:56:54 -0000 1.30 *************** *** 140,144 **** static void olsr_event(void); #endif ! static int send_challenge(union olsr_ip_addr *); static int ifchange(struct interface *, int); static int send_cres(union olsr_ip_addr *, union olsr_ip_addr *, olsr_u32_t, struct stamp *); --- 140,144 ---- static void olsr_event(void); #endif ! static int send_challenge(const union olsr_ip_addr *); static int ifchange(struct interface *, int); static int send_cres(union olsr_ip_addr *, union olsr_ip_addr *, olsr_u32_t, struct stamp *); *************** *** 155,160 **** static void packet_parser(int); static void timeout_timestamps(void*); ! static int check_timestamp(union olsr_ip_addr *, time_t); ! static struct stamp *lookup_timestamp_entry(union olsr_ip_addr *); static int read_key_from_file(const char *); --- 155,160 ---- static void packet_parser(int); static void timeout_timestamps(void*); ! static int check_timestamp(const union olsr_ip_addr *, time_t); ! static struct stamp *lookup_timestamp_entry(const union olsr_ip_addr *); static int read_key_from_file(const char *); *************** *** 528,532 **** int packetsize; olsr_u8_t sha1_hash[SIGNATURE_SIZE]; ! struct s_olsrmsg *sig; time_t rec_time; --- 528,532 ---- int packetsize; olsr_u8_t sha1_hash[SIGNATURE_SIZE]; ! const struct s_olsrmsg *sig; time_t rec_time; *************** *** 543,547 **** return 0; ! sig = (struct s_olsrmsg *)&pck[packetsize]; //olsr_printf(1, "Size: %d\n", packetsize); --- 543,547 ---- return 0; ! sig = (const struct s_olsrmsg *)&pck[packetsize]; //olsr_printf(1, "Size: %d\n", packetsize); *************** *** 640,648 **** rec_time = ntohl(sig->sig.timestamp); ! if(!check_timestamp((union olsr_ip_addr *)&sig->originator, rec_time)) { struct ipaddr_str buf; olsr_printf(1, "[ENC]Timestamp missmatch in packet from %s!\n", ! olsr_ip_to_string(&buf, (union olsr_ip_addr *)&sig->originator)); return 0; } --- 640,648 ---- rec_time = ntohl(sig->sig.timestamp); ! if(!check_timestamp((const union olsr_ip_addr *)&sig->originator, rec_time)) { struct ipaddr_str buf; olsr_printf(1, "[ENC]Timestamp missmatch in packet from %s!\n", ! olsr_ip_to_string(&buf, (const union olsr_ip_addr *)&sig->originator)); return 0; } *************** *** 657,661 **** int ! check_timestamp(union olsr_ip_addr *originator, time_t tstamp) { struct stamp *entry; --- 657,661 ---- int ! check_timestamp(const union olsr_ip_addr *originator, time_t tstamp) { struct stamp *entry; *************** *** 712,716 **** int ! send_challenge(union olsr_ip_addr *new_host) { struct challengemsg cmsg; --- 712,716 ---- int ! send_challenge(const union olsr_ip_addr *new_host) { struct challengemsg cmsg; *************** *** 837,841 **** /* Now to check the digest from the emitted challenge */ ! if((entry = lookup_timestamp_entry((union olsr_ip_addr *)&msg->originator)) == NULL) { struct ipaddr_str buf; --- 837,841 ---- /* Now to check the digest from the emitted challenge */ ! if((entry = lookup_timestamp_entry((const union olsr_ip_addr *)&msg->originator)) == NULL) { struct ipaddr_str buf; *************** *** 940,944 **** /* Now to check the digest from the emitted challenge */ ! if((entry = lookup_timestamp_entry((union olsr_ip_addr *)&msg->originator)) == NULL) { struct ipaddr_str buf; --- 940,944 ---- /* Now to check the digest from the emitted challenge */ ! if((entry = lookup_timestamp_entry((const union olsr_ip_addr *)&msg->originator)) == NULL) { struct ipaddr_str buf; *************** *** 1014,1018 **** /* Create entry if not registered */ ! if((entry = lookup_timestamp_entry((union olsr_ip_addr *)&msg->originator)) == NULL) { entry = malloc(sizeof(struct stamp)); --- 1014,1018 ---- /* Create entry if not registered */ ! if((entry = lookup_timestamp_entry((const union olsr_ip_addr *)&msg->originator)) == NULL) { entry = malloc(sizeof(struct stamp)); *************** *** 1252,1256 **** static struct stamp * ! lookup_timestamp_entry(union olsr_ip_addr *adr) { olsr_u32_t hash; --- 1252,1256 ---- static struct stamp * ! lookup_timestamp_entry(const union olsr_ip_addr *adr) { olsr_u32_t hash; From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas Makefile,1.5,1.6 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/lib/tas Modified Files: Makefile Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 15 Jul 2007 21:50:46 -0000 1.5 --- Makefile 16 Nov 2007 22:56:54 -0000 1.6 *************** *** 1,4 **** # The olsr.org Optimized Link-State Routing daemon(olsrd) ! # Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) # All rights reserved. # --- 1,4 ---- # The olsr.org Optimized Link-State Routing daemon(olsrd) ! # Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) # All rights reserved. # *************** *** 64,67 **** --- 64,70 ---- $(CC) $(LDFLAGS) -o $(PLUGIN_FULLNAME) $(OBJS) $(LIBS) + # this is not nice but there is no nicer solution + src/lua/lapi.o src/lua/ltable.o: CFLAGS += -Wno-cast-qual + install: $(PLUGIN_FULLNAME) $(STRIP) $(PLUGIN_FULLNAME) From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.36, 1.37 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/lib/nameservice/src Modified Files: nameservice.c Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** nameservice.c 16 Nov 2007 19:12:55 -0000 1.36 --- nameservice.c 16 Nov 2007 22:56:54 -0000 1.37 *************** *** 191,195 **** if (0 < strlen(value)) { ! *v = add_name_to_list(*v, (char*)value, addon.ui, NULL); OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value); return 0; --- 191,195 ---- if (0 < strlen(value)) { ! *v = add_name_to_list(*v, value, addon.ui, NULL); OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value); return 0; *************** *** 209,213 **** { // the IP is validated later ! *v = add_name_to_list(*v, (char*)value, NAME_HOST, &ip); OLSR_PRINTF(1, "%s: %s got %s\n", "Got", addon.pc, value); return 0; --- 209,213 ---- { // the IP is validated later ! *v = add_name_to_list(*v, value, NAME_HOST, &ip); OLSR_PRINTF(1, "%s: %s got %s\n", "Got", addon.pc, value); return 0; From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src glua.c, 1.5, 1.6 http.c, 1.8, 1.9 os_unix.c, 1.6, 1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/lib/tas/src Modified Files: glua.c http.c os_unix.c Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: glua.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/glua.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** glua.c 16 Nov 2007 19:12:55 -0000 1.5 --- glua.c 16 Nov 2007 22:56:54 -0000 1.6 *************** *** 295,299 **** struct connInfo *info; ! lua_pushlightuserdata(lua, (void *)&infoKey); lua_gettable(lua, LUA_REGISTRYINDEX); --- 295,299 ---- struct connInfo *info; ! lua_pushlightuserdata(lua, &infoKey); lua_gettable(lua, LUA_REGISTRYINDEX); *************** *** 314,318 **** return luaL_error(lua, "cannot convert value to string"); ! writeBuff(&info->write[2], (unsigned char *)strConv, strlen(strConv)); lua_pop(lua, 1); --- 314,318 ---- return luaL_error(lua, "cannot convert value to string"); ! writeBuff(&info->write[2], (const unsigned char *)strConv, strlen(strConv)); lua_pop(lua, 1); *************** *** 327,331 **** char *line; ! lua_pushlightuserdata(lua, (void *)&infoKey); lua_gettable(lua, LUA_REGISTRYINDEX); --- 327,331 ---- char *line; ! lua_pushlightuserdata(lua, &infoKey); lua_gettable(lua, LUA_REGISTRYINDEX); *************** *** 336,341 **** chomp(line, strlen(line)); ! writeBuff(&info->write[1], (unsigned char *)line, strlen(line)); ! writeBuff(&info->write[1], (unsigned char *)"\r\n", 2); freeMem(line); --- 336,341 ---- chomp(line, strlen(line)); ! writeBuff(&info->write[1], (const unsigned char *)line, strlen(line)); ! writeBuff(&info->write[1], (const unsigned char *)"\r\n", 2); freeMem(line); *************** *** 350,354 **** char *s; ! lua_pushlightuserdata(lua, (void *)&infoKey); lua_gettable(lua, LUA_REGISTRYINDEX); --- 350,354 ---- char *s; ! lua_pushlightuserdata(lua, &infoKey); lua_gettable(lua, LUA_REGISTRYINDEX); *************** *** 367,371 **** int *keepFlag; ! lua_pushlightuserdata(lua, (void *)&keepFlagKey); lua_gettable(lua, LUA_REGISTRYINDEX); --- 367,371 ---- int *keepFlag; ! lua_pushlightuserdata(lua, &keepFlagKey); lua_gettable(lua, LUA_REGISTRYINDEX); *************** *** 382,386 **** char **argList; ! lua_pushlightuserdata(lua, (void *)&argListKey); lua_gettable(lua, LUA_REGISTRYINDEX); --- 382,386 ---- char **argList; ! lua_pushlightuserdata(lua, &argListKey); lua_gettable(lua, LUA_REGISTRYINDEX); *************** *** 449,462 **** lua = *session; ! lua_pushlightuserdata(lua, (void *)&infoKey); ! lua_pushlightuserdata(lua, (void *)info); lua_settable(lua, LUA_REGISTRYINDEX); ! lua_pushlightuserdata(lua, (void *)&argListKey); ! lua_pushlightuserdata(lua, (void *)argList); lua_settable(lua, LUA_REGISTRYINDEX); ! lua_pushlightuserdata(lua, (void *)&keepFlagKey); ! lua_pushlightuserdata(lua, (void *)&keepFlag); lua_settable(lua, LUA_REGISTRYINDEX); --- 449,462 ---- lua = *session; ! lua_pushlightuserdata(lua, &infoKey); ! lua_pushlightuserdata(lua, info); lua_settable(lua, LUA_REGISTRYINDEX); ! lua_pushlightuserdata(lua, &argListKey); ! lua_pushlightuserdata(lua, argList); lua_settable(lua, LUA_REGISTRYINDEX); ! lua_pushlightuserdata(lua, &keepFlagKey); ! lua_pushlightuserdata(lua, &keepFlag); lua_settable(lua, LUA_REGISTRYINDEX); Index: http.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/http.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** http.c 16 Nov 2007 19:12:55 -0000 1.8 --- http.c 16 Nov 2007 22:56:54 -0000 1.9 *************** *** 865,869 **** static void writeBuffString(struct inOutBuff *write, const char *string) { ! writeBuff(write, (unsigned char *)string, strlen(string)); } --- 865,869 ---- static void writeBuffString(struct inOutBuff *write, const char *string) { ! writeBuff(write, (const unsigned char *)string, strlen(string)); } *************** *** 949,953 **** if (i > start) ! writeBuff(buff, (unsigned char *)(form + start), i - start); if (form[i] == 0) --- 949,953 ---- if (i > start) ! writeBuff(buff, (const unsigned char *)(form + start), i - start); if (form[i] == 0) *************** *** 955,959 **** if (form[i + 1] == '%') ! writeBuff(buff, (unsigned char *)"%", 1); else if (form[i + 1] == 's') --- 955,959 ---- if (form[i + 1] == '%') ! writeBuff(buff, (const unsigned char *)"%", 1); else if (form[i + 1] == 's') Index: os_unix.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/os_unix.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** os_unix.c 19 Apr 2007 23:01:32 -0000 1.6 --- os_unix.c 16 Nov 2007 22:56:54 -0000 1.7 *************** *** 435,440 **** static int addrFromSockAddr(struct ipAddr *addr, const struct sockaddr *sockAddr) { ! struct sockaddr_in *sockAddr4 = (struct sockaddr_in *)sockAddr; ! struct sockaddr_in6 *sockAddr6 = (struct sockaddr_in6 *)sockAddr; memset(addr, 0, sizeof (struct ipAddr)); --- 435,440 ---- static int addrFromSockAddr(struct ipAddr *addr, const struct sockaddr *sockAddr) { ! const struct sockaddr_in *sockAddr4 = (const struct sockaddr_in *)sockAddr; ! const struct sockaddr_in6 *sockAddr6 = (const struct sockaddr_in6 *)sockAddr; memset(addr, 0, sizeof (struct ipAddr)); From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current/lib/tas/src/lua lapi.c, 1.2, 1.3 ldblib.c, 1.2, 1.3 lua.h, 1.2, 1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/tas/src/lua In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/lib/tas/src/lua Modified Files: lapi.c ldblib.c lua.h Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: ldblib.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/ldblib.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ldblib.c 16 Nov 2007 19:34:26 -0000 1.2 --- ldblib.c 16 Nov 2007 22:56:54 -0000 1.3 *************** *** 140,144 **** static const char *const hooknames[] = {"call", "return", "line", "count", "tail return"}; ! lua_pushlightuserdata(L, (void *)&KEY_HOOK); lua_rawget(L, LUA_REGISTRYINDEX); if (lua_isfunction(L, -1)) { --- 140,144 ---- static const char *const hooknames[] = {"call", "return", "line", "count", "tail return"}; ! lua_pushlightuserdata(L, &KEY_HOOK); lua_rawget(L, LUA_REGISTRYINDEX); if (lua_isfunction(L, -1)) { *************** *** 186,190 **** lua_sethook(L, hookf, makemask(smask, count), count); } ! lua_pushlightuserdata(L, (void *)&KEY_HOOK); lua_pushvalue(L, 1); lua_rawset(L, LUA_REGISTRYINDEX); /* set new hook */ --- 186,190 ---- lua_sethook(L, hookf, makemask(smask, count), count); } ! lua_pushlightuserdata(L, &KEY_HOOK); lua_pushvalue(L, 1); lua_rawset(L, LUA_REGISTRYINDEX); /* set new hook */ *************** *** 200,204 **** lua_pushliteral(L, "external hook"); else { ! lua_pushlightuserdata(L, (void *)&KEY_HOOK); lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ } --- 200,204 ---- lua_pushliteral(L, "external hook"); else { ! lua_pushlightuserdata(L, &KEY_HOOK); lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ } Index: lapi.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lapi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lapi.c 20 Apr 2007 13:46:03 -0000 1.2 --- lapi.c 16 Nov 2007 22:56:54 -0000 1.3 *************** *** 468,474 **** ! LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { lua_lock(L); ! setpvalue(L->top, p); api_incr_top(L); lua_unlock(L); --- 468,474 ---- ! LUA_API void lua_pushlightuserdata (lua_State *L, const void *p) { lua_lock(L); ! setpvalue(L->top, (void *)p); api_incr_top(L); lua_unlock(L); Index: lua.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lua.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lua.h 20 Apr 2007 13:46:03 -0000 1.2 --- lua.h 16 Nov 2007 22:56:54 -0000 1.3 *************** *** 158,162 **** LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); LUA_API void lua_pushboolean (lua_State *L, int b); ! LUA_API void lua_pushlightuserdata (lua_State *L, void *p); --- 158,162 ---- LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); LUA_API void lua_pushboolean (lua_State *L, int b); ! LUA_API void lua_pushlightuserdata (lua_State *L, const void *p); From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch Makefile,1.12,1.13 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/src/olsr_switch Modified Files: Makefile Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: Makefile =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/Makefile,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Makefile 11 Sep 2007 23:30:41 -0000 1.12 --- Makefile 16 Nov 2007 22:56:54 -0000 1.13 *************** *** 12,15 **** --- 12,17 ---- $(CC) $(LDFLAGS) -o $(TOPDIR)/$(BINNAME) $(OBJS) $(LIBS) $(OS_LIB_PTHREAD) + ohs_cmd.o: CFLAGS += -Wno-cast-qual + clean: rm -f *.[od] From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current/src hna_set.c, 1.24, 1.25 lq_avl.c, 1.15, 1.16 lq_packet.c, 1.30, 1.31 lq_packet.h, 1.9, 1.10 lq_route.c, 1.59, 1.60 rebuild_packet.c, 1.24, 1.25 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/src Modified Files: hna_set.c lq_avl.c lq_packet.c lq_packet.h lq_route.c rebuild_packet.c Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** lq_route.c 16 Nov 2007 21:43:55 -0000 1.59 --- lq_route.c 16 Nov 2007 22:56:54 -0000 1.60 *************** *** 70,78 **** avl_comp_etx (const void *etx1, const void *etx2) { ! if (*(float *)etx1 < *(float *)etx2) { return -1; } ! if (*(float *)etx1 > *(float *)etx2) { return +1; } --- 70,78 ---- avl_comp_etx (const void *etx1, const void *etx2) { ! if (*(const float *)etx1 < *(const float *)etx2) { return -1; } ! if (*(const float *)etx1 > *(const float *)etx2) { return +1; } Index: lq_packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** lq_packet.h 16 Nov 2007 21:43:55 -0000 1.9 --- lq_packet.h 16 Nov 2007 22:56:54 -0000 1.10 *************** *** 142,154 **** }; ! static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(olsr_8_t *)(*p); *p += sizeof(olsr_8_t); } ! static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); } ! static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); } ! static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (double)**p / 255.0; *p += sizeof(olsr_u8_t); } static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); } --- 142,154 ---- }; ! static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(const olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(const olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(const olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(const olsr_8_t *)(*p); *p += sizeof(olsr_8_t); } ! static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(const olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); } ! static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(const olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); } ! static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (const double)**p / 255.0; *p += sizeof(olsr_u8_t); } static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); } Index: rebuild_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** rebuild_packet.c 16 Nov 2007 21:43:55 -0000 1.24 --- rebuild_packet.c 16 Nov 2007 22:56:54 -0000 1.25 *************** *** 139,143 **** //COPY_IP(&hna_pairs->net, &haddr6->addr); hna_pairs->net.v6 = haddr6->addr; ! hna_pairs->netmask.v6 = olsr_netmask_to_prefix((union olsr_ip_addr *)&haddr6->netmask); hna_pairs->next = tmp_pairs; --- 139,143 ---- //COPY_IP(&hna_pairs->net, &haddr6->addr); hna_pairs->net.v6 = haddr6->addr; ! hna_pairs->netmask.v6 = olsr_netmask_to_prefix((const union olsr_ip_addr *)&haddr6->netmask); hna_pairs->next = tmp_pairs; *************** *** 362,366 **** hello_chgestruct(struct hello_message *hmsg, const union olsr_message *m) { ! union olsr_ip_addr *hadr; struct hello_neighbor *nb; --- 362,366 ---- hello_chgestruct(struct hello_message *hmsg, const union olsr_message *m) { ! const union olsr_ip_addr *hadr; struct hello_neighbor *nb; *************** *** 392,402 **** for (hinf = m->v4.message.hello.hell_info; ! (char *)hinf < ((char *)m + (ntohs(m->v4.olsr_msgsize))); ! hinf = (struct hellinfo *)((char *)hinf + ntohs(hinf->size))) { ! for (hadr = (union olsr_ip_addr *)&hinf->neigh_addr; ! (char *)hadr < (char *)hinf + ntohs(hinf->size); ! hadr = (union olsr_ip_addr *)&hadr->v6.s6_addr[4]) { nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct"); --- 392,402 ---- for (hinf = m->v4.message.hello.hell_info; ! (const char *)hinf < ((const char *)m + (ntohs(m->v4.olsr_msgsize))); ! hinf = (const struct hellinfo *)((const char *)hinf + ntohs(hinf->size))) { ! for (hadr = (const union olsr_ip_addr *)&hinf->neigh_addr; ! (const char *)hadr < (const char *)hinf + ntohs(hinf->size); ! hadr = (const union olsr_ip_addr *)&hadr->v6.s6_addr[4]) { nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct"); *************** *** 439,448 **** for (hinf6 = m->v6.message.hello.hell_info; ! (char *)hinf6 < ((char *)m + (ntohs(m->v6.olsr_msgsize))); ! hinf6 = (struct hellinfo6 *)((char *)hinf6 + ntohs(hinf6->size))) { ! for (hadr = (union olsr_ip_addr *)hinf6->neigh_addr; ! (char *)hadr < (char *)hinf6 + ntohs(hinf6->size); hadr++) { --- 439,448 ---- for (hinf6 = m->v6.message.hello.hell_info; ! (const char *)hinf6 < ((const char *)m + (ntohs(m->v6.olsr_msgsize))); ! hinf6 = (const struct hellinfo6 *)((const char *)hinf6 + ntohs(hinf6->size))) { ! for (hadr = (const union olsr_ip_addr *)hinf6->neigh_addr; ! (const char *)hadr < (const char *)hinf6 + ntohs(hinf6->size); hadr++) { Index: lq_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** lq_packet.c 16 Nov 2007 21:43:55 -0000 1.30 --- lq_packet.c 16 Nov 2007 22:56:54 -0000 1.31 *************** *** 589,596 **** limit = ser + size; while (curr < limit) { ! struct lq_hello_info_header *info_head = (struct lq_hello_info_header *)curr; const unsigned char *limit2 = curr + ntohs(info_head->size); ! curr = (unsigned char *)(info_head + 1); while (curr < limit2) { struct hello_neighbor *neigh = olsr_malloc(sizeof (struct hello_neighbor), --- 589,596 ---- limit = ser + size; while (curr < limit) { ! const struct lq_hello_info_header *info_head = (const struct lq_hello_info_header *)curr; const unsigned char *limit2 = curr + ntohs(info_head->size); ! curr = (const unsigned char *)(info_head + 1); while (curr < limit2) { struct hello_neighbor *neigh = olsr_malloc(sizeof (struct hello_neighbor), Index: hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** hna_set.c 8 Nov 2007 22:47:41 -0000 1.24 --- hna_set.c 16 Nov 2007 22:56:54 -0000 1.25 *************** *** 86,90 **** { if (olsr_cnf->ip_version == AF_INET) { ! return olsr_netmask_to_prefix((union olsr_ip_addr *)&hna->A_netmask.v4); } else { return hna->A_netmask.v6; --- 86,90 ---- { if (olsr_cnf->ip_version == AF_INET) { ! return olsr_netmask_to_prefix((const union olsr_ip_addr *)&hna->A_netmask.v4); } else { return hna->A_netmask.v6; Index: lq_avl.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** lq_avl.c 11 Nov 2007 22:55:17 -0000 1.15 --- lq_avl.c 16 Nov 2007 22:56:54 -0000 1.16 *************** *** 86,90 **** } ! else if (*(unsigned int *)key > *(unsigned int *)node->key) { if (node->right != NULL) --- 86,90 ---- } ! else if (*(const unsigned int *)key > *(const unsigned int *)node->key) { if (node->right != NULL) From (spam-protected) Fri Nov 16 23:56:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 16 Nov 2007 22:56:56 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c,1.11,1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/src/cfgparser Modified Files: cfgfile_gen.c Log Message: * added -Wcast-qual: this killed lots of unnecessary type-casts Index: cfgfile_gen.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/cfgfile_gen.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** cfgfile_gen.c 8 Nov 2007 22:47:42 -0000 1.11 --- cfgfile_gen.c 16 Nov 2007 22:56:54 -0000 1.12 *************** *** 245,251 **** fprintf(fd, " # IPv6 multicast address to use when\n # using site-local addresses.\n # If not defined, ff05::15 is used\n"); ! fprintf(fd, " Ip6MulticastSite\t%s\n\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf))); fprintf(fd, " # IPv6 multicast address to use when\n # using global addresses\n # If not defined, ff0e::1 is used\n"); ! fprintf(fd, " Ip6MulticastGlobal\t%s\n\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf))); --- 245,251 ---- fprintf(fd, " # IPv6 multicast address to use when\n # using site-local addresses.\n # If not defined, ff05::15 is used\n"); ! fprintf(fd, " Ip6MulticastSite\t%s\n\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf))); fprintf(fd, " # IPv6 multicast address to use when\n # using global addresses\n # If not defined, ff0e::1 is used\n"); ! fprintf(fd, " Ip6MulticastGlobal\t%s\n\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf))); *************** *** 546,554 **** if(first) WRITE_TO_BUF(" # IPv6 multicast address to use when\n # using site-local addresses.\n # If not defined, ff05::15 is used\n"); ! WRITE_TO_BUF(" Ip6MulticastSite\t%s\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf))); if(first) WRITE_TO_BUF("\n"); if(first) WRITE_TO_BUF(" # IPv6 multicast address to use when\n # using global addresses\n # If not defined, ff0e::1 is used\n"); ! WRITE_TO_BUF(" Ip6MulticastGlobal\t%s\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf))); if(first) WRITE_TO_BUF("\n"); --- 546,554 ---- if(first) WRITE_TO_BUF(" # IPv6 multicast address to use when\n # using site-local addresses.\n # If not defined, ff05::15 is used\n"); ! WRITE_TO_BUF(" Ip6MulticastSite\t%s\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf))); if(first) WRITE_TO_BUF("\n"); if(first) WRITE_TO_BUF(" # IPv6 multicast address to use when\n # using global addresses\n # If not defined, ff0e::1 is used\n"); ! WRITE_TO_BUF(" Ip6MulticastGlobal\t%s\n", inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf))); if(first) WRITE_TO_BUF("\n"); From (spam-protected) Sat Nov 17 01:05:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sat, 17 Nov 2007 00:05:57 +0000 Subject: [Olsr-cvs] olsrd-current/src net_olsr.c,1.33,1.34 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10295/src Modified Files: net_olsr.c Log Message: * patch by Hannes Gredler : fixed a compile warning Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** net_olsr.c 14 Nov 2007 11:01:03 -0000 1.33 --- net_olsr.c 17 Nov 2007 00:05:54 -0000 1.34 *************** *** 498,502 **** --- 498,504 ---- olsr_netmask_to_prefix(const union olsr_ip_addr *adr) { + #ifndef NODEBUG struct ipaddr_str buf; + #endif olsr_u16_t prefix = 0; const olsr_u8_t * const a_end = adr->v6.s6_addr+olsr_cnf->ipsize; From (spam-protected) Sun Nov 18 21:01:10 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 18 Nov 2007 20:01:10 +0000 Subject: [Olsr-cvs] olsrd-current/src net_olsr.h, 1.16, 1.17 net_olsr.c, 1.34, 1.35 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10762/src Modified Files: net_olsr.h net_olsr.c Log Message: consolidated ip{4,6,}{cmp,equal}: all are nwo inline functions using only the minimal necessary operations. Thanks to Hannes Gredler and Sven-Ola Tuecke for pointing that out and suggesting the `inline`, respectively. Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** net_olsr.c 17 Nov 2007 00:05:54 -0000 1.34 --- net_olsr.c 18 Nov 2007 20:01:08 -0000 1.35 *************** *** 646,657 **** } - - int ipcmp(const union olsr_ip_addr * const a, const union olsr_ip_addr * const b) - { - return olsr_cnf->ip_version == AF_INET - ? ip4cmp(&a->v4, &b->v4) - : ip6cmp(&a->v6, &b->v6); - } - /* * Local Variables: --- 646,649 ---- Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** net_olsr.h 11 Nov 2007 22:51:54 -0000 1.16 --- net_olsr.h 18 Nov 2007 20:01:08 -0000 1.17 *************** *** 67,72 **** static INLINE int ip6equal(const struct in6_addr *a, const struct in6_addr *b) { return ip6cmp(a, b) == 0; } ! int ipcmp(const union olsr_ip_addr *a, const union olsr_ip_addr *b); ! static INLINE int ipequal(const union olsr_ip_addr *a, const union olsr_ip_addr *b) { return ipcmp(a, b) == 0; } /* Do not use this - this is as evil as the COPY_IP() macro was and only used in --- 67,74 ---- static INLINE int ip6equal(const struct in6_addr *a, const struct in6_addr *b) { return ip6cmp(a, b) == 0; } ! #if 0 ! static INLINE int ipcmp(const union olsr_ip_addr *a, const union olsr_ip_addr *b) { return olsr_cnf->ip_version == AF_INET ? ip4cmp(&a->v4, &b->v4) : ip6cmp(&a->v6, &b->v6); } ! #endif ! static INLINE int ipequal(const union olsr_ip_addr *a, const union olsr_ip_addr *b) { return olsr_cnf->ip_version == AF_INET ? ip4equal(&a->v4, &b->v4) : ip6equal(&a->v6, &b->v6); } /* Do not use this - this is as evil as the COPY_IP() macro was and only used in From (spam-protected) Sun Nov 18 21:36:01 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 18 Nov 2007 20:36:01 +0000 Subject: [Olsr-cvs] olsrd-current/src lq_avl.c, 1.16, 1.17 lq_avl.h, 1.13, 1.14 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25945/src Modified Files: lq_avl.c lq_avl.h Log Message: - use ip{4,}cmp in lq_avl.[ch] to resue the code. inline_avl_comp_ipv4 is superflous now (and replaced by ip4cmp). - use the global MIN and MAX macro instead of AVLMIN and AVLMAX Index: lq_avl.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** lq_avl.h 11 Nov 2007 22:55:16 -0000 1.13 --- lq_avl.h 18 Nov 2007 20:35:59 -0000 1.14 *************** *** 93,100 **** extern int avl_comp_ipv6(const void *, const void *); - static INLINE int inline_avl_comp_ipv4(const void *_ip1, const void *_ip2) { - const unsigned int *ip1 = _ip1, *ip2 = _ip2; - return *ip1 == *ip2 ? 0 : *ip1 < *ip2 ? -1 : +1; } - #endif --- 93,96 ---- Index: lq_avl.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** lq_avl.c 16 Nov 2007 22:56:54 -0000 1.16 --- lq_avl.c 18 Nov 2007 20:35:59 -0000 1.17 *************** *** 46,52 **** #include "lq_avl.h" ! ! #define AVLMAX(x, y) ((x > y) ? x : y) ! #define AVLMIN(x, y) ((x < y) ? x : y) /* --- 46,50 ---- #include "lq_avl.h" ! #include "net_olsr.h" /* *************** *** 61,70 **** int avl_comp_ipv4(const void *ip1, const void *ip2) { ! return inline_avl_comp_ipv4(ip1, ip2); } int avl_comp_ipv6(const void *ip1, const void *ip2) { ! return memcmp(ip1, ip2, 16); } --- 59,68 ---- int avl_comp_ipv4(const void *ip1, const void *ip2) { ! return ip4cmp(ip1, ip2); } int avl_comp_ipv6(const void *ip1, const void *ip2) { ! return ip6cmp(ip1, ip2); } *************** *** 135,139 **** if (NULL == tree->comp) { ! if (0 != inline_avl_comp_ipv4(node->key, key)) return NULL; } --- 133,137 ---- if (NULL == tree->comp) { ! if (0 != ip4cmp(node->key, key)) return NULL; } *************** *** 176,181 **** node->left->parent = node; ! node->balance += 1 - AVLMIN(left->balance, 0); ! left->balance += 1 + AVLMAX(node->balance, 0); } --- 174,179 ---- node->left->parent = node; ! node->balance += 1 - MIN(left->balance, 0); ! left->balance += 1 + MAX(node->balance, 0); } *************** *** 208,213 **** node->right->parent = node; ! node->balance -= 1 + AVLMAX(right->balance, 0); ! right->balance -= 1 - AVLMIN(node->balance, 0); } --- 206,211 ---- node->right->parent = node; ! node->balance -= 1 + MAX(right->balance, 0); ! right->balance -= 1 - MIN(node->balance, 0); } *************** *** 345,349 **** if (NULL == tree->comp) ! diff = inline_avl_comp_ipv4(new->key, node->key); else --- 343,347 ---- if (NULL == tree->comp) ! diff = ip4cmp(new->key, node->key); else From (spam-protected) Sun Nov 18 21:39:11 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 18 Nov 2007 20:39:11 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.116,1.117 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28270 Modified Files: CHANGELOG Log Message: * and a few lines in the CHANGELOG Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** CHANGELOG 16 Nov 2007 21:43:55 -0000 1.116 --- CHANGELOG 18 Nov 2007 20:39:09 -0000 1.117 *************** *** 129,132 **** --- 129,139 ---- errors on Debian/Sarge * set all locale-relevant variables to "C" (just to be sure) + - consolidated ip{4,6,}{cmp,equal}: all are nwo inline functions using only + the minimal necessary operations. Thanks to Hannes Gredler + and Sven-Ola Tuecke for pointing + that out and suggesting the `inline`, respectively. + use ip{4,}cmp in lq_avl.[ch] to resue the code. inline_avl_comp_ipv4 + is superflous now (and replaced by ip4cmp) and use the global MIN and MAX + macro instead of AVLMIN and AVLMAX 0.5.4 --------------------------------------------------------------------- From (spam-protected) Sun Nov 18 22:58:35 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 18 Nov 2007 21:58:35 +0000 Subject: [Olsr-cvs] olsrd-current/src packet.h,1.17,1.18 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26860/src Modified Files: packet.h Log Message: * killed an unused field Index: packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/packet.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** packet.h 29 May 2005 12:47:45 -0000 1.17 --- packet.h 18 Nov 2007 21:58:32 -0000 1.18 *************** *** 113,118 **** olsr_u16_t packet_seq_number; olsr_u8_t hop_count; ! olsr_u8_t hna_ttl; ! struct hna_net_addr *hna_net; }; --- 113,117 ---- olsr_u16_t packet_seq_number; olsr_u8_t hop_count; ! struct hna_net_addr *hna_net; }; From (spam-protected) Sun Nov 18 23:28:37 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 18 Nov 2007 22:28:37 +0000 Subject: [Olsr-cvs] olsrd-current/src process_package.h, 1.14, 1.15 process_package.c, 1.45, 1.46 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5684/src Modified Files: process_package.h process_package.c Log Message: - olsr_process_message_neighbors is now a static function and called process_message_neighbors - olsr_linking_this_2_entries is now a static function and called linking_this_2_entries - lookup_mpr_status() is now a static function All of them are defined at the to allow automatic inlining. Index: process_package.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** process_package.h 16 Nov 2007 21:43:55 -0000 1.14 --- process_package.h 18 Nov 2007 22:28:35 -0000 1.15 *************** *** 63,74 **** olsr_process_received_hna(union olsr_message *, struct interface *, union olsr_ip_addr *); - void - olsr_process_message_neighbors(struct neighbor_entry *,struct hello_message *); - - void - olsr_linking_this_2_entries(struct neighbor_entry *,struct neighbor_2_entry *, float); - - int - olsr_lookup_mpr_status(struct hello_message *, struct interface *); - #endif --- 63,65 ---- Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** process_package.c 16 Nov 2007 21:43:55 -0000 1.45 --- process_package.c 18 Nov 2007 22:28:35 -0000 1.46 *************** *** 57,368 **** #include "net_olsr.h" ! /** ! *Initializing the parser functions we are using ! */ ! void ! olsr_init_package_process(void) ! { ! if (olsr_cnf->lq_level == 0) ! { ! olsr_parser_add_function(&olsr_process_received_hello, HELLO_MESSAGE, 1); ! olsr_parser_add_function(&olsr_input_tc, TC_MESSAGE, 1); ! } ! else ! { ! olsr_parser_add_function(&olsr_input_lq_hello, LQ_HELLO_MESSAGE, 1); ! olsr_parser_add_function(&olsr_input_tc, LQ_TC_MESSAGE, 1); ! } ! ! olsr_parser_add_function(&olsr_process_received_mid, MID_MESSAGE, 1); ! olsr_parser_add_function(&olsr_process_received_hna, HNA_MESSAGE, 1); ! } ! ! void ! olsr_hello_tap(struct hello_message *message, ! struct interface *in_if, ! const union olsr_ip_addr *from_addr) ! { ! struct neighbor_entry *neighbor; ! ! /* ! * Update link status ! */ ! struct link_entry *lnk = update_link_entry(&in_if->ip_addr, from_addr, message, in_if); ! ! if (olsr_cnf->lq_level > 0) ! { ! double saved_lq; ! double rel_lq; ! struct hello_neighbor *walker; ! // just in case our neighbor has changed its HELLO interval ! olsr_update_packet_loss_hello_int(lnk, message->htime); ! ! // find the input interface in the list of neighbor interfaces ! ! for (walker = message->neighbors; walker != NULL; walker = walker->next) ! if (ipequal(&walker->address, &in_if->ip_addr)) ! break; ! ! // the current reference link quality ! ! saved_lq = lnk->saved_neigh_link_quality; ! ! if (saved_lq == 0.0) ! saved_lq = -1.0; ! ! // memorize our neighbour's idea of the link quality, so that we ! // know the link quality in both directions ! ! if (walker != NULL) ! lnk->neigh_link_quality = walker->link_quality; ! ! else ! lnk->neigh_link_quality = 0.0; ! ! // if the link quality has changed by more than 10 percent, ! // print the new link quality table ! ! rel_lq = lnk->neigh_link_quality / saved_lq; ! ! if (rel_lq > 1.1 || rel_lq < 0.9) ! { ! lnk->saved_neigh_link_quality = lnk->neigh_link_quality; ! ! if (olsr_cnf->lq_dlimit > 0) ! { ! changes_neighborhood = OLSR_TRUE; ! changes_topology = OLSR_TRUE; ! } ! ! else ! OLSR_PRINTF(3, "Skipping Dijkstra (2)\n"); ! ! // create a new ANSN ! ! // XXX - we should check whether we actually ! // announce this neighbour ! ! signal_link_changes(OLSR_TRUE); ! } ! } ! ! neighbor = lnk->neighbor; ! ! /* ! * Hysteresis ! */ ! if(olsr_cnf->use_hysteresis) ! { ! /* Update HELLO timeout */ ! //printf("MESSAGE HTIME: %f\n", message->htime); ! olsr_update_hysteresis_hello(lnk, message->htime); ! } ! ! /* Check if we are chosen as MPR */ ! if(olsr_lookup_mpr_status(message, in_if)) ! /* source_addr is always the main addr of a node! */ ! olsr_update_mprs_set(&message->source_addr, message->vtime); ! ! ! ! /* Check willingness */ ! if(neighbor->willingness != message->willingness) ! { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n", ! olsr_ip_to_string(&buf, &neighbor->neighbor_main_addr), ! neighbor->willingness, ! message->willingness); ! /* ! *If willingness changed - recalculate ! */ ! neighbor->willingness = message->willingness; ! changes_neighborhood = OLSR_TRUE; ! changes_topology = OLSR_TRUE; ! } ! ! ! /* Don't register neighbors of neighbors that announces WILL_NEVER */ ! if(neighbor->willingness != WILL_NEVER) ! olsr_process_message_neighbors(neighbor, message); ! ! /* Process changes immedeatly in case of MPR updates */ ! olsr_process_changes(); ! ! olsr_free_hello_packet(message); ! ! return; ! } ! ! /** ! *Processes a received HELLO message. ! * ! *@param m the incoming OLSR message ! *@return 0 on sucess ! */ ! ! void ! olsr_process_received_hello(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) ! { ! struct hello_message message; ! ! hello_chgestruct(&message, m); ! ! if(!olsr_validate_address(&message.source_addr)) ! { ! olsr_free_hello_packet(&message); ! return; ! } ! ! olsr_hello_tap(&message, in_if, from_addr); ! } ! ! /** ! *Process a received(and parsed) MID message ! *For every address check if there is a topology node ! *registered with it and update its addresses. ! * ! *@param m the OLSR message received. ! *@return 1 on success ! */ ! ! void ! olsr_process_received_mid(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) ! { ! #if !defined(NODEBUG) && defined(DEBUG) ! struct ipaddr_str buf; ! #endif ! struct mid_alias *tmp_adr; ! struct mid_message message; ! ! mid_chgestruct(&message, m); ! ! if (!olsr_validate_address(&message.mid_origaddr)) { ! olsr_free_mid_packet(&message); ! return; ! } ! ! if (olsr_check_dup_table_proc(&message.mid_origaddr, ! message.mid_seqno)) { ! ! #ifdef DEBUG ! OLSR_PRINTF(5, "Processing MID from %s...\n", olsr_ip_to_string(&buf, &message.mid_origaddr)); ! #endif ! tmp_adr = message.mid_addr; ! ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! ! if(check_neighbor_link(from_addr) != SYM_LINK) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(2, "Received MID from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); ! olsr_free_mid_packet(&message); ! return; ! } ! ! /* Update the timeout of the MID */ ! olsr_update_mid_table(&message.mid_origaddr, (float)message.vtime); ! ! while (tmp_adr) { ! if (!mid_lookup_main_addr(&tmp_adr->alias_addr)){ ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "MID new: (%s, ", olsr_ip_to_string(&buf, &message.mid_origaddr)); ! OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&buf, &tmp_adr->alias_addr)); ! insert_mid_alias(&message.mid_origaddr, &tmp_adr->alias_addr, (float)message.vtime); ! } ! tmp_adr = tmp_adr->next; ! } ! ! olsr_prune_aliases(&message.mid_origaddr, message.mid_addr); ! } ! ! olsr_forward_message(m, ! &message.mid_origaddr, ! message.mid_seqno, ! in_if, ! from_addr); ! olsr_free_mid_packet(&message); ! } ! ! ! /** ! *Process incoming HNA message. ! *Forwards the message if that is to be done. ! * ! *@param m the incoming OLSR message ! *the OLSR message. ! *@return 1 on success ! */ ! ! void ! olsr_process_received_hna(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) ! { ! struct hna_net_addr *hna_tmp; ! struct hna_message message; ! ! #ifdef DEBUG ! OLSR_PRINTF(5, "Processing HNA\n"); ! #endif ! ! hna_chgestruct(&message, m); ! ! if(!olsr_validate_address(&message.originator)) { ! olsr_free_hna_packet(&message); ! return; ! } ! ! if (olsr_check_dup_table_proc(&message.originator, ! message.packet_seq_number)) { ! ! hna_tmp = message.hna_net; ! ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! if(check_neighbor_link(from_addr) != SYM_LINK) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(2, "Received HNA from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); ! olsr_free_hna_packet(&message); ! return; ! } ! 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; - } - } - - olsr_forward_message(m, - &message.originator, - message.packet_seq_number, - in_if, - from_addr); - olsr_free_hna_packet(&message); - } /** --- 57,66 ---- #include "net_olsr.h" + static void process_message_neighbors(struct neighbor_entry *, const struct hello_message *); ! static void linking_this_2_entries(struct neighbor_entry *, struct neighbor_2_entry *, float); ! static int lookup_mpr_status(const struct hello_message *, const struct interface *); /** *************** *** 372,378 **** *@return nada */ ! void ! olsr_process_message_neighbors(struct neighbor_entry *neighbor, ! struct hello_message *message) { struct hello_neighbor *message_neighbors; --- 70,75 ---- *@return nada */ ! static void ! process_message_neighbors(struct neighbor_entry *neighbor, const struct hello_message *message) { struct hello_neighbor *message_neighbors; *************** *** 474,478 **** olsr_insert_two_hop_neighbor_table(two_hop_neighbor); ! olsr_linking_this_2_entries(neighbor, two_hop_neighbor, (float)message->vtime); } else --- 171,175 ---- olsr_insert_two_hop_neighbor_table(two_hop_neighbor); ! linking_this_2_entries(neighbor, two_hop_neighbor, message->vtime); } else *************** *** 484,488 **** changes_topology = OLSR_TRUE; ! olsr_linking_this_2_entries(neighbor, two_hop_neighbor, (float)message->vtime); } } --- 181,185 ---- changes_topology = OLSR_TRUE; ! linking_this_2_entries(neighbor, two_hop_neighbor, message->vtime); } } *************** *** 650,660 **** } - - - - - - - /** *Links a one-hop neighbor with a 2-hop neighbor. --- 347,350 ---- *************** *** 664,676 **** *@return nada */ ! void ! olsr_linking_this_2_entries(struct neighbor_entry *neighbor,struct neighbor_2_entry *two_hop_neighbor, float vtime) { ! struct neighbor_list_entry *list_of_1_neighbors; ! struct neighbor_2_list_entry *list_of_2_neighbors; ! ! list_of_1_neighbors = olsr_malloc(sizeof(struct neighbor_list_entry), "Link entries 1"); ! ! list_of_2_neighbors = olsr_malloc(sizeof(struct neighbor_2_list_entry), "Link entries 2"); list_of_1_neighbors->neighbor = neighbor; --- 354,362 ---- *@return nada */ ! static void ! linking_this_2_entries(struct neighbor_entry *neighbor, struct neighbor_2_entry *two_hop_neighbor, float vtime) { ! struct neighbor_list_entry *list_of_1_neighbors = olsr_malloc(sizeof(struct neighbor_list_entry), "Link entries 1"); ! struct neighbor_2_list_entry *list_of_2_neighbors = olsr_malloc(sizeof(struct neighbor_2_list_entry), "Link entries 2"); list_of_1_neighbors->neighbor = neighbor; *************** *** 683,690 **** two_hop_neighbor->neighbor_2_nblist.next->prev = list_of_1_neighbors; list_of_1_neighbors->next = two_hop_neighbor->neighbor_2_nblist.next; two_hop_neighbor->neighbor_2_nblist.next = list_of_1_neighbors; list_of_1_neighbors->prev = &two_hop_neighbor->neighbor_2_nblist; - - list_of_2_neighbors->neighbor_2 = two_hop_neighbor; --- 369,375 ---- two_hop_neighbor->neighbor_2_nblist.next->prev = list_of_1_neighbors; list_of_1_neighbors->next = two_hop_neighbor->neighbor_2_nblist.next; + two_hop_neighbor->neighbor_2_nblist.next = list_of_1_neighbors; list_of_1_neighbors->prev = &two_hop_neighbor->neighbor_2_nblist; list_of_2_neighbors->neighbor_2 = two_hop_neighbor; *************** *** 701,709 **** } - - - - - /** *Check if a hello message states this node as a MPR. --- 386,389 ---- *************** *** 715,759 **** *@return 1 if we are selected as MPR 0 if not */ ! int ! olsr_lookup_mpr_status(struct hello_message *message, struct interface *in_if) { ! struct hello_neighbor *neighbors = message->neighbors; ! ! while(neighbors!=NULL) ! { ! //printf("(linkstatus)Checking %s ",olsr_ip_to_string(&buf, &neighbors->address)); ! //printf("against %s\n",olsr_ip_to_string(&buf, &main_addr)); ! if(olsr_cnf->ip_version == AF_INET) ! { ! /* IPv4 */ ! if(ip4equal(&neighbors->address.v4, &in_if->ip_addr.v4)) ! { ! //printf("ok"); ! if((neighbors->link == SYM_LINK) && (neighbors->status == MPR_NEIGH)) ! return 1; ! ! return 0; ! } } ! else ! { ! /* IPv6 */ ! if(ip6equal(&neighbors->address.v6, &in_if->int6_addr.sin6_addr)) ! { ! //printf("ok"); ! if((neighbors->link == SYM_LINK) && (neighbors->status == MPR_NEIGH)) ! return 1; ! ! return 0; ! } } ! ! neighbors = neighbors->next; } ! /* Not found */ ! return 0; } --- 395,726 ---- *@return 1 if we are selected as MPR 0 if not */ ! static int ! lookup_mpr_status(const struct hello_message *message, const struct interface *in_if) ! { ! struct hello_neighbor *neighbors; ! for (neighbors = message->neighbors; neighbors != NULL; neighbors = neighbors->next) { ! //printf("(linkstatus)Checking %s ",olsr_ip_to_string(&buf, &neighbors->address)); ! //printf("against %s\n",olsr_ip_to_string(&buf, &main_addr)); ! ! if (olsr_cnf->ip_version == AF_INET ! ? /* IPv4 */ ip4equal(&neighbors->address.v4, &in_if->ip_addr.v4) ! : /* IPv6 */ ip6equal(&neighbors->address.v6, &in_if->int6_addr.sin6_addr)) { ! //printf("ok"); ! if (neighbors->link == SYM_LINK && neighbors->status == MPR_NEIGH) { ! return 1; ! } ! break; ! } ! } ! /* Not found */ ! return 0; ! } ! ! ! /** ! *Initializing the parser functions we are using ! */ ! void ! olsr_init_package_process(void) { + if (olsr_cnf->lq_level == 0) + { + olsr_parser_add_function(&olsr_process_received_hello, HELLO_MESSAGE, 1); + olsr_parser_add_function(&olsr_input_tc, TC_MESSAGE, 1); + } + else + { + olsr_parser_add_function(&olsr_input_lq_hello, LQ_HELLO_MESSAGE, 1); + olsr_parser_add_function(&olsr_input_tc, LQ_TC_MESSAGE, 1); + } + + olsr_parser_add_function(&olsr_process_received_mid, MID_MESSAGE, 1); + olsr_parser_add_function(&olsr_process_received_hna, HNA_MESSAGE, 1); + } + + void + olsr_hello_tap(struct hello_message *message, + struct interface *in_if, + const union olsr_ip_addr *from_addr) + { + struct neighbor_entry *neighbor; + + /* + * Update link status + */ + struct link_entry *lnk = update_link_entry(&in_if->ip_addr, from_addr, message, in_if); + + if (olsr_cnf->lq_level > 0) + { + double saved_lq; + double rel_lq; + struct hello_neighbor *walker; + // just in case our neighbor has changed its HELLO interval + olsr_update_packet_loss_hello_int(lnk, message->htime); + + // find the input interface in the list of neighbor interfaces + + for (walker = message->neighbors; walker != NULL; walker = walker->next) + if (ipequal(&walker->address, &in_if->ip_addr)) + break; + + // the current reference link quality + + saved_lq = lnk->saved_neigh_link_quality; + + if (saved_lq == 0.0) + saved_lq = -1.0; + + // memorize our neighbour's idea of the link quality, so that we + // know the link quality in both directions + + if (walker != NULL) + lnk->neigh_link_quality = walker->link_quality; + + else + lnk->neigh_link_quality = 0.0; + + // if the link quality has changed by more than 10 percent, + // print the new link quality table + + rel_lq = lnk->neigh_link_quality / saved_lq; + + if (rel_lq > 1.1 || rel_lq < 0.9) + { + lnk->saved_neigh_link_quality = lnk->neigh_link_quality; + + if (olsr_cnf->lq_dlimit > 0) + { + changes_neighborhood = OLSR_TRUE; + changes_topology = OLSR_TRUE; + } + + else + OLSR_PRINTF(3, "Skipping Dijkstra (2)\n"); + + // create a new ANSN + + // XXX - we should check whether we actually + // announce this neighbour + + signal_link_changes(OLSR_TRUE); + } + } ! neighbor = lnk->neighbor; + /* + * Hysteresis + */ + if(olsr_cnf->use_hysteresis) + { + /* Update HELLO timeout */ + //printf("MESSAGE HTIME: %f\n", message->htime); + olsr_update_hysteresis_hello(lnk, message->htime); + } ! /* Check if we are chosen as MPR */ ! if(lookup_mpr_status(message, in_if)) ! /* source_addr is always the main addr of a node! */ ! olsr_update_mprs_set(&message->source_addr, message->vtime); ! ! ! ! /* Check willingness */ ! if(neighbor->willingness != message->willingness) ! { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n", ! olsr_ip_to_string(&buf, &neighbor->neighbor_main_addr), ! neighbor->willingness, ! message->willingness); ! /* ! *If willingness changed - recalculate ! */ ! neighbor->willingness = message->willingness; ! changes_neighborhood = OLSR_TRUE; ! changes_topology = OLSR_TRUE; ! } ! ! ! /* Don't register neighbors of neighbors that announces WILL_NEVER */ ! if(neighbor->willingness != WILL_NEVER) ! process_message_neighbors(neighbor, message); ! ! /* Process changes immedeatly in case of MPR updates */ ! olsr_process_changes(); ! ! olsr_free_hello_packet(message); ! ! return; ! } ! ! /** ! *Processes a received HELLO message. ! * ! *@param m the incoming OLSR message ! *@return 0 on sucess ! */ ! ! void ! olsr_process_received_hello(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) ! { ! struct hello_message message; ! ! hello_chgestruct(&message, m); ! ! if(!olsr_validate_address(&message.source_addr)) ! { ! olsr_free_hello_packet(&message); ! return; ! } ! ! olsr_hello_tap(&message, in_if, from_addr); ! } ! ! /** ! *Process a received(and parsed) MID message ! *For every address check if there is a topology node ! *registered with it and update its addresses. ! * ! *@param m the OLSR message received. ! *@return 1 on success ! */ ! ! void ! olsr_process_received_mid(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) ! { ! #if !defined(NODEBUG) && defined(DEBUG) ! struct ipaddr_str buf; ! #endif ! struct mid_alias *tmp_adr; ! struct mid_message message; ! ! mid_chgestruct(&message, m); ! ! if (!olsr_validate_address(&message.mid_origaddr)) { ! olsr_free_mid_packet(&message); ! return; ! } ! ! if (olsr_check_dup_table_proc(&message.mid_origaddr, ! message.mid_seqno)) { ! ! #ifdef DEBUG ! OLSR_PRINTF(5, "Processing MID from %s...\n", olsr_ip_to_string(&buf, &message.mid_origaddr)); ! #endif ! tmp_adr = message.mid_addr; ! ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! ! if(check_neighbor_link(from_addr) != SYM_LINK) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(2, "Received MID from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); ! olsr_free_mid_packet(&message); ! return; ! } ! ! /* Update the timeout of the MID */ ! olsr_update_mid_table(&message.mid_origaddr, (float)message.vtime); ! ! while (tmp_adr) { ! if (!mid_lookup_main_addr(&tmp_adr->alias_addr)){ ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(1, "MID new: (%s, ", olsr_ip_to_string(&buf, &message.mid_origaddr)); ! OLSR_PRINTF(1, "%s)\n", olsr_ip_to_string(&buf, &tmp_adr->alias_addr)); ! insert_mid_alias(&message.mid_origaddr, &tmp_adr->alias_addr, (float)message.vtime); } ! tmp_adr = tmp_adr->next; ! } ! ! olsr_prune_aliases(&message.mid_origaddr, message.mid_addr); ! } ! ! olsr_forward_message(m, ! &message.mid_origaddr, ! message.mid_seqno, ! in_if, ! from_addr); ! olsr_free_mid_packet(&message); ! } ! ! ! /** ! *Process incoming HNA message. ! *Forwards the message if that is to be done. ! * ! *@param m the incoming OLSR message ! *the OLSR message. ! *@return 1 on success ! */ ! ! void ! olsr_process_received_hna(union olsr_message *m, ! struct interface *in_if, ! union olsr_ip_addr *from_addr) ! { ! struct hna_net_addr *hna_tmp; ! struct hna_message message; ! ! #ifdef DEBUG ! OLSR_PRINTF(5, "Processing HNA\n"); ! #endif ! ! hna_chgestruct(&message, m); ! ! if(!olsr_validate_address(&message.originator)) { ! olsr_free_hna_packet(&message); ! return; ! } ! ! if (olsr_check_dup_table_proc(&message.originator, ! message.packet_seq_number)) { ! ! hna_tmp = message.hna_net; ! ! /* ! * If the sender interface (NB: not originator) of this message ! * is not in the symmetric 1-hop neighborhood of this node, the ! * message MUST be discarded. ! */ ! if(check_neighbor_link(from_addr) != SYM_LINK) { ! #ifndef NODEBUG ! struct ipaddr_str buf; ! #endif ! OLSR_PRINTF(2, "Received HNA from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); ! olsr_free_hna_packet(&message); ! return; ! } ! ! 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; } + } ! olsr_forward_message(m, ! &message.originator, ! message.packet_seq_number, ! in_if, ! from_addr); ! olsr_free_hna_packet(&message); } From (spam-protected) Mon Nov 19 15:35:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Mon, 19 Nov 2007 14:35:12 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.45,1.46 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17299 Modified Files: Makefile.inc Log Message: * added support for EXTRA_CPPFLAGS Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Makefile.inc 16 Nov 2007 22:56:53 -0000 1.45 --- Makefile.inc 19 Nov 2007 14:35:10 -0000 1.46 *************** *** 124,127 **** --- 124,130 ---- LIBS += $(OS_LIB_PTHREAD) + # extra options from the outside + CPPFLAGS += $(EXTRA_CPPFLAGS) + ################################### # From (spam-protected) Wed Nov 21 00:16:20 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 20 Nov 2007 23:16:20 +0000 Subject: [Olsr-cvs] olsrd-current/src net_olsr.c,1.35,1.36 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9445/src Modified Files: net_olsr.c Log Message: * added "#include " as we use some constant from it Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** net_olsr.c 18 Nov 2007 20:01:08 -0000 1.35 --- net_olsr.c 20 Nov 2007 23:16:17 -0000 1.36 *************** *** 50,53 **** --- 50,54 ---- #include #include + #include static olsr_bool disp_pack_out = OLSR_FALSE; From (spam-protected) Wed Nov 21 00:19:10 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 20 Nov 2007 23:19:10 +0000 Subject: [Olsr-cvs] olsrd-current/src main.c,1.102,1.103 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9779/src Modified Files: main.c Log Message: * use "__attribute__((unused))" * "olsr_argv = argv" is not used in Win32 so compile completely it out * Fixed a compiler warning reported by G.Fischer at vt.TU-Berlin.DE * avoid to cluttered source * sanitize macros Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** main.c 8 Nov 2007 22:47:41 -0000 1.102 --- main.c 20 Nov 2007 23:19:08 -0000 1.103 *************** *** 96,102 **** struct if_config_options *); static char **olsr_argv; ! static char copyright_string[] = "The olsr.org Optimized Link-State Routing daemon(olsrd) Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) All rights reserved."; --- 96,104 ---- struct if_config_options *); + #ifndef WIN32 static char **olsr_argv; + #endif ! static char copyright_string[] __attribute__((unused)) = "The olsr.org Optimized Link-State Routing daemon(olsrd) Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) All rights reserved."; *************** *** 119,128 **** #endif - /* Stop the compiler from complaining */ - (void)copyright_string; - debug_handle = stdout; olsr_argv = argv; ! setbuf(stdout, NULL); setbuf(stderr, NULL); --- 121,128 ---- #endif debug_handle = stdout; + #ifndef WIN32 olsr_argv = argv; ! #endif setbuf(stdout, NULL); setbuf(stderr, NULL); *************** *** 145,157 **** #endif - /* Grab initial timestamp */ - now_times = times(&tms_buf); - /* Open syslog */ olsr_openlog("olsrd"); ! /* Get initial timestep */ do { ! nowtm = localtime(&now.tv_sec); } while (nowtm == NULL); --- 145,156 ---- #endif /* Open syslog */ olsr_openlog("olsrd"); ! /* Grab initial timestamp */ ! now_times = times(&tms_buf); do { ! time_t t = now.tv_sec; ! nowtm = localtime(&t); } while (nowtm == NULL); *************** *** 216,224 **** olsr_cnf = olsrd_get_default_cnf(); } ! if((default_ifcnf = get_default_if_config()) == NULL) ! { ! fprintf(stderr, "No default ifconfig found!\n"); ! exit(EXIT_FAILURE); ! } /* Initialize tick resolution */ --- 215,224 ---- olsr_cnf = olsrd_get_default_cnf(); } ! ! default_ifcnf = get_default_if_config(); ! if (default_ifcnf == NULL) { ! fprintf(stderr, "No default ifconfig found!\n"); ! exit(EXIT_FAILURE); ! } /* Initialize tick resolution */ *************** *** 385,397 **** /* daemon mode */ #ifndef WIN32 ! if((olsr_cnf->debug_level == 0) && (!olsr_cnf->no_fork)) ! { ! printf("%s detaching from the current process...\n", olsrd_version); ! if(daemon(0, 0) < 0) ! { ! printf("daemon(3) failed: %s\n", strerror(errno)); ! exit(EXIT_FAILURE); ! } } #endif --- 385,395 ---- /* daemon mode */ #ifndef WIN32 ! if(olsr_cnf->debug_level == 0 && !olsr_cnf->no_fork) { ! printf("%s detaching from the current process...\n", olsrd_version); ! if (daemon(0, 0) < 0) { ! printf("daemon(3) failed: %s\n", strerror(errno)); ! exit(EXIT_FAILURE); } + } #endif *************** *** 430,436 **** scheduler(); - /* Stop the compiler from complaining */ - (void)copyright_string; - /* Like we're ever going to reach this ;-) */ return 1; --- 428,431 ---- *************** *** 573,587 **** ! #define NEXT_ARG argv++;argc-- ! #define CHECK_ARGC if(!argc) { \ if((argc - 1) == 1){ \ fprintf(stderr, "Error parsing command line options!\n"); \ - olsr_exit(__func__, EXIT_FAILURE); \ } else { \ argv--; \ fprintf(stderr, "You must provide a parameter when using the %s switch!\n", *argv); \ - olsr_exit(__func__, EXIT_FAILURE); \ } \ ! } /** --- 568,581 ---- ! #define NEXT_ARG do { argv++;argc--; } while (0) ! #define CHECK_ARGC do { if(!argc) { \ if((argc - 1) == 1){ \ fprintf(stderr, "Error parsing command line options!\n"); \ } else { \ argv--; \ fprintf(stderr, "You must provide a parameter when using the %s switch!\n", *argv); \ } \ ! olsr_exit(__func__, EXIT_FAILURE); \ ! } } while (0) /** From (spam-protected) Wed Nov 21 00:20:25 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 20 Nov 2007 23:20:25 +0000 Subject: [Olsr-cvs] olsrd-current/src ipc_frontend.c,1.39,1.40 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10737/src Modified Files: ipc_frontend.c Log Message: * #define MSG_NOSIGNAL only if it's really not defined. Thanks to G.Fischer at vt.TU-Berlin.DE for reporting this Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** ipc_frontend.c 11 Nov 2007 22:59:29 -0000 1.39 --- ipc_frontend.c 20 Nov 2007 23:20:23 -0000 1.40 *************** *** 63,67 **** #endif ! #ifndef linux #define MSG_NOSIGNAL 0 #endif --- 63,67 ---- #endif ! #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 #endif From (spam-protected) Thu Nov 22 12:43:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 22 Nov 2007 11:43:38 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser oparse.y, 1.38, 1.39 olsrd_conf.c, 1.61, 1.62 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26486/src/cfgparser Modified Files: oparse.y olsrd_conf.c Log Message: * bug fix: set "ipsize" and "maxplen" if we set the the "ip_version" Index: olsrd_conf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** olsrd_conf.c 8 Nov 2007 22:47:42 -0000 1.61 --- olsrd_conf.c 22 Nov 2007 11:43:36 -0000 1.62 *************** *** 428,431 **** --- 428,433 ---- cnf->host_emul = OLSR_FALSE; cnf->ip_version = AF_INET; + cnf->ipsize = sizeof(struct in_addr); + cnf->maxplen = 32; cnf->allow_no_interfaces = DEF_ALLOW_NO_INTS; cnf->tos = DEF_TOS; Index: oparse.y =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** oparse.y 16 Nov 2007 19:12:55 -0000 1.38 --- oparse.y 22 Nov 2007 11:43:36 -0000 1.39 *************** *** 652,657 **** --- 652,661 ---- if ($2->integer == 4) { olsr_cnf->ip_version = AF_INET; + olsr_cnf->ipsize = sizeof(struct in_addr); + olsr_cnf->maxplen = 32; } else if ($2->integer == 6) { olsr_cnf->ip_version = AF_INET6; + olsr_cnf->ipsize = sizeof(struct in6_addr); + olsr_cnf->maxplen = 128; } else { fprintf(stderr, "IPversion must be 4 or 6!\n"); From (spam-protected) Thu Nov 22 12:43:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 22 Nov 2007 11:43:38 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch main.c,1.31,1.32 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26486/src/olsr_switch Modified Files: main.c Log Message: * bug fix: set "ipsize" and "maxplen" if we set the the "ip_version" Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/main.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** main.c 8 Nov 2007 23:54:28 -0000 1.31 --- main.c 22 Nov 2007 11:43:35 -0000 1.32 *************** *** 545,549 **** logbits = LOG_DEFAULT; ip_version = AF_INET; ! ipsize = 4; srand((unsigned int)time(NULL)); --- 545,549 ---- logbits = LOG_DEFAULT; ip_version = AF_INET; ! ipsize = sizeof(struct in_addr); srand((unsigned int)time(NULL)); From (spam-protected) Thu Nov 22 12:43:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 22 Nov 2007 11:43:38 +0000 Subject: [Olsr-cvs] olsrd-current/src main.c,1.103,1.104 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26486/src Modified Files: main.c Log Message: * bug fix: set "ipsize" and "maxplen" if we set the the "ip_version" Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** main.c 20 Nov 2007 23:19:08 -0000 1.103 --- main.c 22 Nov 2007 11:43:36 -0000 1.104 *************** *** 333,350 **** } - /* Set ipsize */ - if(olsr_cnf->ip_version == AF_INET6) - { - OLSR_PRINTF(1, "Using IP version %d\n", 6); - olsr_cnf->ipsize = sizeof(struct in6_addr); - olsr_cnf->maxplen = 128; - } - else - { - OLSR_PRINTF(1, "Using IP version %d\n", 4); - olsr_cnf->ipsize = sizeof(struct in_addr); - olsr_cnf->maxplen = 32; - } - /* Initialize net */ init_net(); --- 333,336 ---- From (spam-protected) Sat Nov 24 00:40:46 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Fri, 23 Nov 2007 23:40:46 +0000 Subject: [Olsr-cvs] olsrd-current/src olsr_cfg.h,1.37,1.38 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22400/src Modified Files: olsr_cfg.h Log Message: * prefix_len is always an unsigned 8 bit int Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** olsr_cfg.h 5 Nov 2007 15:32:55 -0000 1.37 --- olsr_cfg.h 23 Nov 2007 23:40:43 -0000 1.38 *************** *** 224,228 **** /* Stuff set by olsrd */ size_t ipsize; /* Size of address */ ! olsr_8_t maxplen; /* maximum prefix len */ olsr_u16_t system_tick_divider; /* Tick resolution */ olsr_bool del_gws; /* Delete InternetGWs at startup */ --- 224,228 ---- /* Stuff set by olsrd */ size_t ipsize; /* Size of address */ ! olsr_u8_t maxplen; /* maximum prefix len */ olsr_u16_t system_tick_divider; /* Tick resolution */ olsr_bool del_gws; /* Delete InternetGWs at startup */ From (spam-protected) Sun Nov 25 14:08:57 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 25 Nov 2007 13:08:57 +0000 Subject: [Olsr-cvs] olsrd-current/src main.c,1.104,1.105 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31052/src Modified Files: main.c Log Message: * added paranoia checks Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** main.c 22 Nov 2007 11:43:36 -0000 1.104 --- main.c 25 Nov 2007 13:08:54 -0000 1.105 *************** *** 43,46 **** --- 43,47 ---- #include #include + #include #include "defs.h" *************** *** 121,124 **** --- 122,133 ---- #endif + /* paranoia checks */ + assert(sizeof(olsr_u8_t) == 1); + assert(sizeof(olsr_u16_t) == 2); + assert(sizeof(olsr_u32_t) == 4); + assert(sizeof(olsr_8_t) == 1); + assert(sizeof(olsr_16_t) == 2); + assert(sizeof(olsr_32_t) == 4); + debug_handle = stdout; #ifndef WIN32 From (spam-protected) Sun Nov 25 22:23:31 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 25 Nov 2007 21:23:31 +0000 Subject: [Olsr-cvs] olsrd-current/src net_olsr.h,1.17,1.18 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25299/src Modified Files: net_olsr.h Log Message: * fixed bug: ip4cmp() was severly broken Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** net_olsr.h 18 Nov 2007 20:01:08 -0000 1.17 --- net_olsr.h 25 Nov 2007 21:23:29 -0000 1.18 *************** *** 61,65 **** * Macros for comparing and copying IP addresses */ ! static INLINE int ip4cmp(const struct in_addr *a, const struct in_addr *b) { return ntohl(a->s_addr) - ntohl(b->s_addr); } static INLINE int ip4equal(const struct in_addr *a, const struct in_addr *b) { return a->s_addr == b->s_addr; } --- 61,65 ---- * Macros for comparing and copying IP addresses */ ! static INLINE int ip4cmp(const struct in_addr *a, const struct in_addr *b) { return a->s_addr > b->s_addr ? +1 : a->s_addr < b->s_addr ? -1 : 0; } static INLINE int ip4equal(const struct in_addr *a, const struct in_addr *b) { return a->s_addr == b->s_addr; } From (spam-protected) Sun Nov 25 22:38:15 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 25 Nov 2007 21:38:15 +0000 Subject: [Olsr-cvs] olsrd-current/src duplicate_set.h, 1.11, 1.12 olsr_cfg.h, 1.38, 1.39 link_set.h, 1.33, 1.34 interfaces.h, 1.45, 1.46 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31242/src Modified Files: duplicate_set.h olsr_cfg.h link_set.h interfaces.h Log Message: * rearranged fields a little bit to save space Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** olsr_cfg.h 23 Nov 2007 23:40:43 -0000 1.38 --- olsr_cfg.h 25 Nov 2007 21:38:13 -0000 1.39 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 200,234 **** olsr_u16_t tos; olsr_u8_t rttable; - olsr_bool willingness_auto; olsr_u8_t willingness; int ipc_connections; olsr_bool open_ipc; olsr_bool use_hysteresis; struct hyst_param hysteresis_param; float pollrate; float nic_chgs_pollrate; olsr_u8_t tc_redundancy; olsr_u8_t mpr_coverage; - olsr_bool clear_screen; olsr_u8_t lq_level; - olsr_u32_t lq_wsize; olsr_u8_t lq_fish; - olsr_u8_t lq_dlimit; float lq_dinter; ! struct plugin_entry *plugins; ! struct local_hna_entry *hna_entries; ! struct ipc_host *ipc_hosts; ! struct ipc_net *ipc_nets; ! struct olsr_if *interfaces; /* Stuff set by olsrd */ - size_t ipsize; /* Size of address */ - olsr_u8_t maxplen; /* maximum prefix len */ olsr_u16_t system_tick_divider; /* Tick resolution */ olsr_bool del_gws; /* Delete InternetGWs at startup */ union olsr_ip_addr main_addr; /* Main address of this node */ float will_int; float max_jitter; ! int exit_value; /* Global return value for process termination */ float max_tc_vtime; --- 200,234 ---- olsr_u16_t tos; olsr_u8_t rttable; olsr_u8_t willingness; + olsr_bool willingness_auto; int ipc_connections; olsr_bool open_ipc; olsr_bool use_hysteresis; struct hyst_param hysteresis_param; + struct plugin_entry *plugins; + struct local_hna_entry *hna_entries; + struct ipc_host *ipc_hosts; + struct ipc_net *ipc_nets; + struct olsr_if *interfaces; float pollrate; float nic_chgs_pollrate; + olsr_bool clear_screen; olsr_u8_t tc_redundancy; olsr_u8_t mpr_coverage; olsr_u8_t lq_level; olsr_u8_t lq_fish; float lq_dinter; ! olsr_u32_t lq_wsize; ! olsr_u8_t lq_dlimit; /* Stuff set by olsrd */ olsr_u16_t system_tick_divider; /* Tick resolution */ + olsr_u8_t maxplen; /* maximum prefix len */ + size_t ipsize; /* Size of address */ olsr_bool del_gws; /* Delete InternetGWs at startup */ union olsr_ip_addr main_addr; /* Main address of this node */ float will_int; float max_jitter; ! int exit_value; /* Global return value for process termination */ float max_tc_vtime; Index: duplicate_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/duplicate_set.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** duplicate_set.h 21 Oct 2007 20:15:51 -0000 1.11 --- duplicate_set.h 25 Nov 2007 21:38:13 -0000 1.12 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 51,57 **** union olsr_ip_addr addr; /* IP address of originator */ olsr_u16_t seqno; /* Seqno of message */ clock_t timer; /* Holding time */ struct dup_iface *ifaces; /* Interfaces this message was recieved on */ - olsr_u8_t forwarded; /* If this message was forwarded or not */ struct dup_entry *next; /* Next entry */ struct dup_entry *prev; /* Prev entry */ --- 51,57 ---- union olsr_ip_addr addr; /* IP address of originator */ olsr_u16_t seqno; /* Seqno of message */ + olsr_u8_t forwarded; /* If this message was forwarded or not */ clock_t timer; /* Holding time */ struct dup_iface *ifaces; /* Interfaces this message was recieved on */ struct dup_entry *next; /* Next entry */ struct dup_entry *prev; /* Prev entry */ Index: link_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** link_set.h 2 Nov 2007 20:58:06 -0000 1.33 --- link_set.h 25 Nov 2007 21:38:13 -0000 1.34 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 62,65 **** --- 62,66 ---- struct neighbor_entry *neighbor; olsr_u8_t prev_status; + /* *Hysteresis *************** *** 87,91 **** unsigned int total_packets; ! double loss_link_quality, loss_link_quality2; double loss_link_multiplier; --- 88,93 ---- unsigned int total_packets; ! double loss_link_quality ! double loss_link_quality2; double loss_link_multiplier; Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** interfaces.h 16 Nov 2007 19:12:55 -0000 1.45 --- interfaces.h 25 Nov 2007 21:38:13 -0000 1.46 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 140,147 **** int int_mtu; /* MTU of interface */ int int_flags; /* see below */ - char *int_name; /* from kernel if structure */ int if_index; /* Kernels index of this interface */ int is_wireless; /* wireless interface or not*/ olsr_u16_t olsr_seqnum; /* Olsr message seqno */ float hello_etime; --- 140,147 ---- int int_mtu; /* MTU of interface */ int int_flags; /* see below */ int if_index; /* Kernels index of this interface */ int is_wireless; /* wireless interface or not*/ olsr_u16_t olsr_seqnum; /* Olsr message seqno */ + char *int_name; /* from kernel if structure */ float hello_etime; From (spam-protected) Sun Nov 25 22:40:37 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 25 Nov 2007 21:40:37 +0000 Subject: [Olsr-cvs] olsrd-current/src link_set.h,1.34,1.35 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32083/src Modified Files: link_set.h Log Message: * oops, fixed typo Index: link_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** link_set.h 25 Nov 2007 21:38:13 -0000 1.34 --- link_set.h 25 Nov 2007 21:40:35 -0000 1.35 *************** *** 88,92 **** unsigned int total_packets; ! double loss_link_quality double loss_link_quality2; double loss_link_multiplier; --- 88,92 ---- unsigned int total_packets; ! double loss_link_quality; double loss_link_quality2; double loss_link_multiplier; From (spam-protected) Sun Nov 25 22:41:07 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 25 Nov 2007 21:41:07 +0000 Subject: [Olsr-cvs] olsrd-current/src interfaces.h,1.46,1.47 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32441/src Modified Files: interfaces.h Log Message: * fixed name - and commented the unused enum out Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** interfaces.h 25 Nov 2007 21:38:13 -0000 1.46 --- interfaces.h 25 Nov 2007 21:41:05 -0000 1.47 *************** *** 73,78 **** #define MAX_IF_METRIC 100 ! ! enum olsr_if_wieght { WEIGHT_LOWEST = 0, --- 73,78 ---- #define MAX_IF_METRIC 100 ! #if 0 ! enum olsr_if_weight { WEIGHT_LOWEST = 0, *************** *** 92,95 **** --- 92,96 ---- WEIGHT_HIGHEST = WEIGHT_HIGH }; + #endif struct if_gen_property From (spam-protected) Sun Nov 25 23:02:35 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 25 Nov 2007 22:02:35 +0000 Subject: [Olsr-cvs] olsrd-current/src interfaces.h,1.47,1.48 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6894/src Modified Files: interfaces.h Log Message: * saved a few bytes Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** interfaces.h 25 Nov 2007 21:41:05 -0000 1.47 --- interfaces.h 25 Nov 2007 22:02:33 -0000 1.48 *************** *** 143,148 **** int if_index; /* Kernels index of this interface */ int is_wireless; /* wireless interface or not*/ - olsr_u16_t olsr_seqnum; /* Olsr message seqno */ char *int_name; /* from kernel if structure */ float hello_etime; --- 143,156 ---- int if_index; /* Kernels index of this interface */ int is_wireless; /* wireless interface or not*/ char *int_name; /* from kernel if structure */ + olsr_u16_t olsr_seqnum; /* Olsr message seqno */ + #ifdef linux + /* Struct used 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 float hello_etime; *************** *** 157,169 **** 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; }; --- 165,168 ---- From (spam-protected) Sun Nov 25 23:08:59 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Sun, 25 Nov 2007 22:08:59 +0000 Subject: [Olsr-cvs] olsrd-current/src link_set.h,1.35,1.36 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9410/src Modified Files: link_set.h Log Message: * saved a few bytes Index: link_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** link_set.h 25 Nov 2007 21:40:35 -0000 1.35 --- link_set.h 25 Nov 2007 22:08:57 -0000 1.36 *************** *** 71,88 **** clock_t hello_timeout; /* When we should receive a new HELLO */ double last_htime; - olsr_u16_t olsr_seqno; olsr_bool olsr_seqno_valid; /* * packet loss */ - - double loss_hello_int; - clock_t loss_timeout; - olsr_u16_t loss_seqno; int loss_seqno_valid; int loss_missed_hellos; unsigned int lost_packets; unsigned int total_packets; --- 71,87 ---- clock_t hello_timeout; /* When we should receive a new HELLO */ double last_htime; olsr_bool olsr_seqno_valid; + olsr_u16_t olsr_seqno; /* * packet loss */ olsr_u16_t loss_seqno; int loss_seqno_valid; int loss_missed_hellos; + double loss_hello_int; + clock_t loss_timeout; + unsigned int lost_packets; unsigned int total_packets; From (spam-protected) Tue Nov 27 14:35:08 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 27 Nov 2007 13:35:08 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd apm.c,1.4,1.5 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30878/src/bsd Modified Files: apm.c Log Message: * fixed compile warnings Index: apm.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/apm.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** apm.c 27 Feb 2005 10:43:38 -0000 1.4 --- apm.c 27 Nov 2007 13:35:06 -0000 1.5 *************** *** 45,58 **** #include ! int apm_init() { return -1; } ! void apm_printinfo(struct olsr_apm_info *ApmInfo) { } ! int apm_read(struct olsr_apm_info *ApmInfo) { return -1; --- 45,58 ---- #include ! int apm_init(void) { return -1; } ! void apm_printinfo(struct olsr_apm_info *ApmInfo __attribute__((unused))) { } ! int apm_read(struct olsr_apm_info *ApmInfo __attribute__((unused))) { return -1; From (spam-protected) Tue Nov 27 14:39:24 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Tue, 27 Nov 2007 13:39:24 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd kernel_routes.c,1.15,1.16 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32535/src/bsd Modified Files: kernel_routes.c Log Message: * fixed compile warnings Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/kernel_routes.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** kernel_routes.c 11 Nov 2007 23:10:24 -0000 1.15 --- kernel_routes.c 27 Nov 2007 13:39:22 -0000 1.16 *************** *** 44,47 **** --- 44,49 ---- #include "olsr.h" #include "defs.h" + #include "process_routes.h" + #include "net_olsr.h" #include *************** *** 59,63 **** struct ifaddrs *addrs; struct ifaddrs *awalker; ! struct rt_nexthop *nexthop; union olsr_ip_addr mask; int step, step2; --- 61,65 ---- struct ifaddrs *addrs; struct ifaddrs *awalker; ! const struct rt_nexthop *nexthop; union olsr_ip_addr mask; int step, step2; *************** *** 102,106 **** walker = buff + sizeof (struct rt_msghdr); ! sin.sin_addr.s_addr = rt->rt_dst.prefix.v4; memcpy(walker, &sin, sizeof (sin)); --- 104,108 ---- walker = buff + sizeof (struct rt_msghdr); ! sin.sin_addr = rt->rt_dst.prefix.v4; memcpy(walker, &sin, sizeof (sin)); *************** *** 150,154 **** return -1; } ! sin.sin_addr.s_addr = mask.v4; memcpy(walker, &sin, sizeof (sin)); --- 152,156 ---- return -1; } ! sin.sin_addr = mask.v4; memcpy(walker, &sin, sizeof (sin)); *************** *** 182,186 **** struct sockaddr_in6 sin6; struct sockaddr_dl sdl; ! struct rt_nexthop *nexthop; int step, step_dl; int len; --- 184,188 ---- struct sockaddr_in6 sin6; struct sockaddr_dl sdl; ! const struct rt_nexthop *nexthop; int step, step_dl; int len; From (spam-protected) Wed Nov 28 11:09:05 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Wed, 28 Nov 2007 10:09:05 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd net.h, 1.4, 1.5 kernel_routes.c, 1.16, 1.17 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25983/src/bsd Modified Files: net.h kernel_routes.c Log Message: * applied (a somewhat modified) patch by Patrick McCarty Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/kernel_routes.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** kernel_routes.c 27 Nov 2007 13:39:22 -0000 1.16 --- kernel_routes.c 28 Nov 2007 10:09:03 -0000 1.17 *************** *** 112,116 **** if ((flags & RTF_GATEWAY) != 0) { ! sin.sin_addr.s_addr = nexthop->gateway.v4; memcpy(walker, &sin, sizeof (sin)); --- 112,116 ---- if ((flags & RTF_GATEWAY) != 0) { ! sin.sin_addr = nexthop->gateway.v4; memcpy(walker, &sin, sizeof (sin)); Index: net.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/net.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** net.h 20 Apr 2007 13:46:05 -0000 1.4 --- net.h 28 Nov 2007 10:09:03 -0000 1.5 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 44,47 **** --- 44,48 ---- #define _OLSR_NET_LINUX + #include #include #include From (spam-protected) Thu Nov 29 01:07:39 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:07:39 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.117,1.118 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv556 Modified Files: CHANGELOG Log Message: - a forgotten hangelog entry - a few more trivial BSD fixes Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** CHANGELOG 18 Nov 2007 20:39:09 -0000 1.117 --- CHANGELOG 29 Nov 2007 00:07:36 -0000 1.118 *************** *** 13,16 **** --- 13,19 ---- - also printout our own HNAs in the dotdraw plugin. + PATCH by Patrick McCarty : + - fixed compile errors in the BSD port + PATCHES and CLEANUPS by Bernd Petrovitsch - Jens Nachtigall suggested (and reminded) to use From (spam-protected) Thu Nov 29 01:07:39 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:07:39 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd net.c,1.39,1.40 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv556/src/bsd Modified Files: net.c Log Message: - a forgotten hangelog entry - a few more trivial BSD fixes Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/net.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** net.c 4 Nov 2007 18:57:17 -0000 1.39 --- net.c 29 Nov 2007 00:07:37 -0000 1.40 *************** *** 155,168 **** int enable_ip_forwarding(int version) { ! char *name; ! ! if (olsr_cnf->ip_version == AF_INET) ! name = "net.inet.ip.forwarding"; ! ! else ! name = "net.inet6.ip6.forwarding"; gateway = set_sysctl_int(name, 1); - if (gateway < 0) { --- 155,163 ---- int enable_ip_forwarding(int version) { ! const char *name = version == AF_INET ! ? "net.inet.ip.forwarding" ! : "net.inet6.ip6.forwarding"; gateway = set_sysctl_int(name, 1); if (gateway < 0) { *************** *** 177,188 **** disable_redirects_global(int version) { ! char *name; // do not accept ICMP redirects #ifdef __OpenBSD__ ! if (olsr_cnf->ip_version == AF_INET) name = "net.inet.icmp.rediraccept"; - else name = "net.inet6.icmp6.rediraccept"; --- 172,182 ---- disable_redirects_global(int version) { ! const char *name; // do not accept ICMP redirects #ifdef __OpenBSD__ ! if (version == AF_INET) name = "net.inet.icmp.rediraccept"; else name = "net.inet6.icmp6.rediraccept"; *************** *** 190,194 **** ignore_redir = set_sysctl_int(name, 0); #elif defined __FreeBSD__ || defined __MacOSX__ ! if (olsr_cnf->ip_version == AF_INET) { name = "net.inet.icmp.drop_redirect"; --- 184,188 ---- ignore_redir = set_sysctl_int(name, 0); #elif defined __FreeBSD__ || defined __MacOSX__ ! if (version == AF_INET) { name = "net.inet.icmp.drop_redirect"; *************** *** 201,207 **** } #else ! if (olsr_cnf->ip_version == AF_INET) name = "net.inet.icmp.drop_redirect"; - else name = "net.inet6.icmp6.drop_redirect"; --- 195,200 ---- } #else ! if (version == AF_INET) name = "net.inet.icmp.drop_redirect"; else name = "net.inet6.icmp6.drop_redirect"; *************** *** 218,229 **** // do not send ICMP redirects ! if (olsr_cnf->ip_version == AF_INET) name = "net.inet.ip.redirect"; - else name = "net.inet6.ip6.redirect"; send_redir = set_sysctl_int(name, 0); - if (send_redir < 0) { --- 211,220 ---- // do not send ICMP redirects ! if (version == AF_INET) name = "net.inet.ip.redirect"; else name = "net.inet6.ip6.redirect"; send_redir = set_sysctl_int(name, 0); if (send_redir < 0) { *************** *** 251,261 **** int restore_settings(int version) { ! char *name; // reset IP forwarding ! if (olsr_cnf->ip_version == AF_INET) name = "net.inet.ip.forwarding"; - else name = "net.inet6.ip6.forwarding"; --- 242,251 ---- int restore_settings(int version) { ! const char *name; // reset IP forwarding ! if (version == AF_INET) name = "net.inet.ip.forwarding"; else name = "net.inet6.ip6.forwarding"; *************** *** 266,270 **** #ifdef __OpenBSD__ ! if (olsr_cnf->ip_version == AF_INET) name = "net.inet.icmp.rediraccept"; else --- 256,260 ---- #ifdef __OpenBSD__ ! if (version == AF_INET) name = "net.inet.icmp.rediraccept"; else *************** *** 272,284 **** #elif defined __FreeBSD__ || defined __MacOSX__ ! if (olsr_cnf->ip_version == AF_INET) name = "net.inet.icmp.drop_redirect"; - else name = "net.inet6.icmp6.rediraccept"; #else ! if (olsr_cnf->ip_version == AF_INET) name = "net.inet.icmp.drop_redirect"; - else name = "net.inet6.icmp6.drop_redirect"; --- 262,272 ---- #elif defined __FreeBSD__ || defined __MacOSX__ ! if (version == AF_INET) name = "net.inet.icmp.drop_redirect"; else name = "net.inet6.icmp6.rediraccept"; #else ! if (version == AF_INET) name = "net.inet.icmp.drop_redirect"; else name = "net.inet6.icmp6.drop_redirect"; *************** *** 289,295 **** // reset outgoing ICMP redirects ! if (olsr_cnf->ip_version == AF_INET) name = "net.inet.ip.redirect"; - else name = "net.inet6.ip6.redirect"; --- 277,282 ---- // reset outgoing ICMP redirects ! if (version == AF_INET) name = "net.inet.ip.redirect"; else name = "net.inet6.ip6.redirect"; *************** *** 490,494 **** mcastreq.ipv6mr_interface = ifs->if_index; ! OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string((union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr)); /* rfc 3493 */ --- 477,481 ---- mcastreq.ipv6mr_interface = ifs->if_index; ! OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string((union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr)); /* rfc 3493 */ From (spam-protected) Thu Nov 29 01:10:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:10:19 +0000 Subject: [Olsr-cvs] olsrd-current/src mid_set.c,1.23,1.24 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1006/src Modified Files: mid_set.c Log Message: Bug Fixes (of stupid and forgotten bugs) from Sven-Ola Tücke from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/102-olsrd-cvs-fixes.patch Index: mid_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mid_set.c 8 Nov 2007 22:47:41 -0000 1.23 --- mid_set.c 29 Nov 2007 00:10:17 -0000 1.24 *************** *** 227,236 **** int ne_ref_rp_count; #ifndef NODEBUG ! struct ipaddr_str buf; #endif struct mid_address *adr = olsr_malloc(sizeof(struct mid_address), "Insert MID alias"); ! OLSR_PRINTF(1, "Inserting alias %s for ", olsr_ip_to_string(&buf, alias)); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, main_add)); //COPY_IP(&adr->alias, alias); --- 227,236 ---- int ne_ref_rp_count; #ifndef NODEBUG ! struct ipaddr_str buf1, buf2; #endif struct mid_address *adr = olsr_malloc(sizeof(struct mid_address), "Insert MID alias"); ! OLSR_PRINTF(1, "Inserting alias %s for ", olsr_ip_to_string(&buf1, alias)); ! OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf1, main_add)); //COPY_IP(&adr->alias, alias); *************** *** 243,247 **** ne_old = olsr_lookup_neighbor_table_alias(alias); if (ne_old != NULL) { ! OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(&buf, alias), olsr_ip_to_string(&buf, main_add)); olsr_delete_neighbor_table(alias); ne_new = olsr_insert_neighbor_table(main_add); --- 243,247 ---- ne_old = olsr_lookup_neighbor_table_alias(alias); if (ne_old != NULL) { ! OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(&buf1, alias), olsr_ip_to_string(&buf2, main_add)); olsr_delete_neighbor_table(alias); ne_new = olsr_insert_neighbor_table(main_add); From (spam-protected) Thu Nov 29 01:10:20 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:10:20 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.37, 1.38 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1006/lib/nameservice/src Modified Files: nameservice.c Log Message: Bug Fixes (of stupid and forgotten bugs) from Sven-Ola Tücke from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/102-olsrd-cvs-fixes.patch Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** nameservice.c 16 Nov 2007 22:56:54 -0000 1.37 --- nameservice.c 29 Nov 2007 00:10:17 -0000 1.38 *************** *** 830,837 **** if (!ipequal(&already_saved_name_entries->ip, &from_packet->ip)) { OLSR_PRINTF(4, "NAME PLUGIN: updating ip %s -> %s (%s)\n", olsr_ip_to_string(&strbuf, &already_saved_name_entries->ip), ! olsr_ip_to_string(&strbuf, &from_packet->ip), ! olsr_ip_to_string(&strbuf, &already_saved_name_entries->ip)); memcpy(&already_saved_name_entries->ip, &from_packet->ip, olsr_cnf->ipsize); *this_table_changed = OLSR_TRUE; --- 830,840 ---- if (!ipequal(&already_saved_name_entries->ip, &from_packet->ip)) { + #ifndef NODEBUG + struct ipaddr_str strbuf2, strbuf3; + #endif OLSR_PRINTF(4, "NAME PLUGIN: updating ip %s -> %s (%s)\n", olsr_ip_to_string(&strbuf, &already_saved_name_entries->ip), ! olsr_ip_to_string(&strbuf2, &from_packet->ip), ! olsr_ip_to_string(&strbuf3, &already_saved_name_entries->ip)); memcpy(&already_saved_name_entries->ip, &from_packet->ip, olsr_cnf->ipsize); *this_table_changed = OLSR_TRUE; *************** *** 1485,1489 **** struct olsr_if *ifs; union olsr_ip_addr ip; ! struct ipaddr_str strbuf; struct tc_entry *tc; struct tc_edge_entry *tc_edge; --- 1488,1492 ---- struct olsr_if *ifs; union olsr_ip_addr ip; ! struct ipaddr_str strbuf1, strbuf2; struct tc_entry *tc; struct tc_edge_entry *tc_edge; *************** *** 1507,1517 **** if (olsr_cnf->ip_version == AF_INET) { - struct ipaddr_str strbuf; /* * Didn't find a good sample to grab a simple * olsr_ip_addr from a given interface. Sven-Ola */ ! const char* p = olsr_ip_to_string(&strbuf, &olsr_cnf->main_addr); ! const char* q = ip4_to_string(&strbuf, ifs->interf->int_addr.sin_addr); if (0 != strcmp(p, q)) { --- 1510,1519 ---- if (olsr_cnf->ip_version == AF_INET) { /* * Didn't find a good sample to grab a simple * olsr_ip_addr from a given interface. Sven-Ola */ ! const char* p = olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr); ! const char* q = ip4_to_string(&strbuf1, ifs->interf->int_addr.sin_addr); if (0 != strcmp(p, q)) { *************** *** 1521,1528 **** else if (!(ipequal(&olsr_cnf->main_addr, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr))) { - struct ipaddr_str strbuf; fprintf(js, "Mid('%s','%s');\n", ! olsr_ip_to_string(&strbuf, &olsr_cnf->main_addr), ! olsr_ip_to_string(&strbuf, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr)); } } --- 1523,1529 ---- else if (!(ipequal(&olsr_cnf->main_addr, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr))) { fprintf(js, "Mid('%s','%s');\n", ! olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr), ! olsr_ip_to_string(&strbuf2, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr)); } } *************** *** 1538,1543 **** { fprintf(js, "Mid('%s','%s');\n", ! olsr_ip_to_string(&strbuf, &entry->main_addr), ! olsr_ip_to_string(&strbuf, &alias->alias)); alias = alias->next_alias; } --- 1539,1544 ---- { fprintf(js, "Mid('%s','%s');\n", ! olsr_ip_to_string(&strbuf1, &entry->main_addr), ! olsr_ip_to_string(&strbuf2, &alias->alias)); alias = alias->next_alias; } *************** *** 1546,1551 **** } lookup_defhna_latlon(&ip); ! fprintf(js, "Self('%s',%f,%f,%d,'%s','%s');\n", olsr_ip_to_string(&strbuf, &olsr_cnf->main_addr), ! my_lat, my_lon, get_isdefhna_latlon(), olsr_ip_to_string(&strbuf, &ip), my_names->name); for (hash = 0; hash < HASHSIZE; hash++) { --- 1547,1552 ---- } lookup_defhna_latlon(&ip); ! fprintf(js, "Self('%s',%f,%f,%d,'%s','%s');\n", olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr), ! my_lat, my_lon, get_isdefhna_latlon(), olsr_ip_to_string(&strbuf2, &ip), my_names->name); for (hash = 0; hash < HASHSIZE; hash++) { *************** *** 1557,1562 **** { fprintf(js, "Node('%s',%s,'%s','%s');\n", ! olsr_ip_to_string(&strbuf, &entry->originator), ! name->name, olsr_ip_to_string(&strbuf, &name->ip), lookup_name_latlon(&entry->originator)); } --- 1558,1563 ---- { fprintf(js, "Node('%s',%s,'%s','%s');\n", ! olsr_ip_to_string(&strbuf1, &entry->originator), ! name->name, olsr_ip_to_string(&strbuf2, &name->ip), lookup_name_latlon(&entry->originator)); } *************** *** 1566,1573 **** OLSR_FOR_ALL_TC_ENTRIES(tc) { OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { - struct ipaddr_str dstbuf, addrbuf; fprintf(js, "Link('%s','%s',%f,%f,%f);\n", ! olsr_ip_to_string(&dstbuf, &tc_edge->T_dest_addr), ! olsr_ip_to_string(&addrbuf, &tc->addr), tc_edge->link_quality, tc_edge->inverse_link_quality, --- 1567,1573 ---- OLSR_FOR_ALL_TC_ENTRIES(tc) { OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { fprintf(js, "Link('%s','%s',%f,%f,%f);\n", ! olsr_ip_to_string(&strbuf1, &tc_edge->T_dest_addr), ! olsr_ip_to_string(&strbuf2, &tc->addr), tc_edge->link_quality, tc_edge->inverse_link_quality, From (spam-protected) Thu Nov 29 01:10:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:10:19 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c, 1.15, 1.16 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1006/lib/txtinfo/src Modified Files: olsrd_txtinfo.c Log Message: Bug Fixes (of stupid and forgotten bugs) from Sven-Ola Tücke from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/102-olsrd-cvs-fixes.patch Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** olsrd_txtinfo.c 8 Nov 2007 22:47:41 -0000 1.15 --- olsrd_txtinfo.c 29 Nov 2007 00:10:17 -0000 1.16 *************** *** 298,302 **** static void ipc_print_neigh_link(void) { ! struct ipaddr_str buf; struct neighbor_entry *neigh; struct neighbor_2_list_entry *list_2; --- 298,302 ---- static void ipc_print_neigh_link(void) { ! struct ipaddr_str buf1, buf2; struct neighbor_entry *neigh; struct neighbor_2_list_entry *list_2; *************** *** 310,315 **** while(link) { ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%d\t%d\t%0.2f\t%0.2f\t\n", ! olsr_ip_to_string(&buf, &link->local_iface_addr), ! olsr_ip_to_string(&buf, &link->neighbor_iface_addr), link->L_link_quality, link->loss_link_quality, --- 310,315 ---- while(link) { ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%d\t%d\t%0.2f\t%0.2f\t\n", ! olsr_ip_to_string(&buf1, &link->local_iface_addr), ! olsr_ip_to_string(&buf2, &link->neighbor_iface_addr), link->L_link_quality, link->loss_link_quality, *************** *** 328,332 **** neigh = neigh->next) { ipc_sendf("%s\t%s\t%s\t%s\t%d\t", ! olsr_ip_to_string(&buf, &neigh->neighbor_main_addr), (neigh->status == SYM) ? "YES" : "NO", neigh->is_mpr ? "YES" : "NO", --- 328,332 ---- neigh = neigh->next) { ipc_sendf("%s\t%s\t%s\t%s\t%d\t", ! olsr_ip_to_string(&buf1, &neigh->neighbor_main_addr), (neigh->status == SYM) ? "YES" : "NO", neigh->is_mpr ? "YES" : "NO", *************** *** 339,343 **** list_2 = list_2->next) { ! //size += sprintf(&buf[size], "\n", olsr_ip_to_string(&buf, &list_2->neighbor_2->neighbor_2_addr)); thop_cnt ++; } --- 339,343 ---- list_2 = list_2->next) { ! //size += sprintf(&buf[size], "\n", olsr_ip_to_string(&buf1, &list_2->neighbor_2->neighbor_2_addr)); thop_cnt ++; } *************** *** 350,354 **** static void ipc_print_routes(void) { ! struct ipaddr_str buf; struct rt_entry *rt; struct avl_node *rt_tree_node; --- 350,354 ---- static void ipc_print_routes(void) { ! struct ipaddr_str buf1, buf2; struct rt_entry *rt; struct avl_node *rt_tree_node; *************** *** 364,370 **** ipc_sendf( "%s/%d\t%s\t%d\t%.3f\t%s\t\n", ! olsr_ip_to_string(&buf, &rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&buf, &rt->rt_best->rtp_nexthop.gateway), rt->rt_best->rtp_metric.hops, rt->rt_best->rtp_metric.etx, --- 364,370 ---- ipc_sendf( "%s/%d\t%s\t%d\t%.3f\t%s\t\n", ! olsr_ip_to_string(&buf1, &rt->rt_dst.prefix), rt->rt_dst.prefix_len, ! olsr_ip_to_string(&buf2, &rt->rt_best->rtp_nexthop.gateway), rt->rt_best->rtp_metric.hops, rt->rt_best->rtp_metric.etx, From (spam-protected) Thu Nov 29 01:18:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:18:56 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga/src olsrd_plugin.c,1.9,1.10 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5107/lib/quagga/src Modified Files: olsrd_plugin.c Log Message: Patch from Sven-Ola Tücke from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/103-olsrd-rt-exportroute-cleanup.patch: avoid a malloc()ed list of functions Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/olsrd_plugin.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** olsrd_plugin.c 8 Nov 2007 22:47:40 -0000 1.9 --- olsrd_plugin.c 29 Nov 2007 00:18:53 -0000 1.10 *************** *** 42,45 **** --- 42,47 ---- static set_plugin_parameter set_localpref; + static export_route_function orig_addroute_function; + static export_route_function orig_delroute_function; int olsrd_plugin_interface_version (void) { *************** *** 81,95 **** set_plugin_parameter_addon addon __attribute__((unused))) { if (!strcmp(value, "only")) { ! if (!olsr_addroute_remove_function(&olsr_ioctl_add_route, AF_INET)) ! puts ("AIII, could not remove the kernel route exporter"); ! if (!olsr_delroute_remove_function(&olsr_ioctl_del_route, AF_INET)) ! puts ("AIII, could not remove the kernel route deleter"); ! olsr_addroute_add_function(&zebra_add_olsr_v4_route, AF_INET); ! olsr_delroute_add_function(&zebra_del_olsr_v4_route, AF_INET); zebra_export_routes(1); } else if (!strcmp(value, "additional")) { ! olsr_addroute_add_function(&zebra_add_olsr_v4_route, AF_INET); ! olsr_delroute_add_function(&zebra_del_olsr_v4_route, AF_INET); zebra_export_routes(1); } --- 83,97 ---- set_plugin_parameter_addon addon __attribute__((unused))) { if (!strcmp(value, "only")) { ! orig_addroute_function = NULL; ! orig_delroute_function = NULL; ! olsr_addroute_function = zebra_add_olsr_v4_route; ! olsr_delroute_function = zebra_del_olsr_v4_route; zebra_export_routes(1); } else if (!strcmp(value, "additional")) { ! orig_addroute_function = olsr_addroute_function; ! orig_delroute_function = olsr_delroute_function; ! olsr_addroute_function = zebra_add_olsr_v4_route; ! olsr_delroute_function = zebra_del_olsr_v4_route; zebra_export_routes(1); } From (spam-protected) Thu Nov 29 01:18:56 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:18:56 +0000 Subject: [Olsr-cvs] olsrd-current/src process_routes.c, 1.39, 1.40 process_routes.h, 1.13, 1.14 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5107/src Modified Files: process_routes.c process_routes.h Log Message: Patch from Sven-Ola Tücke from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/103-olsrd-rt-exportroute-cleanup.patch: avoid a malloc()ed list of functions Index: process_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** process_routes.c 11 Nov 2007 23:10:25 -0000 1.39 --- process_routes.c 29 Nov 2007 00:18:53 -0000 1.40 *************** *** 6,10 **** * * export_route_entry interface added by Immo 'FaUl Wehrenberg ! * * * Redistribution and use in source and binary forms, with or without --- 6,10 ---- * * export_route_entry interface added by Immo 'FaUl Wehrenberg ! * and reworked by sven-ola 2007 * * Redistribution and use in source and binary forms, with or without *************** *** 56,70 **** #endif - struct export_route_entry - { - olsr_u8_t type; /* AF_INET/AF_INET6 */ - export_route_function function; - struct export_route_entry *next; - }; - - - static struct export_route_entry *add_routes; - static struct export_route_entry *del_routes; - static struct list_node add_kernel_list; static struct list_node chg_kernel_list; --- 56,59 ---- *************** *** 98,153 **** ! static void ! olsr_route_add_function(struct export_route_entry **routes, export_route_function function, olsr_u8_t type) ! { ! struct export_route_entry *tmp = olsr_malloc(sizeof(*tmp), __func__); ! tmp->type = type; ! tmp->function = function; ! tmp->next = *routes; ! *routes = tmp; ! } ! ! void ! olsr_addroute_add_function(export_route_function function, olsr_u8_t type) ! { ! olsr_route_add_function(&add_routes, function, type); ! } ! ! void ! olsr_delroute_add_function(export_route_function function, olsr_u8_t type) ! { ! olsr_route_add_function(&del_routes, function, type); ! } ! ! ! static int ! olsr_route_remove_function(struct export_route_entry **routes, export_route_function function, olsr_u8_t type) ! { ! struct export_route_entry *tmp, *prev; ! for (tmp = *routes, prev = NULL; tmp != NULL; prev = tmp, tmp = tmp->next) { ! if (function == tmp->function && type == tmp->type) { ! if (prev == NULL) { /* i.e. tmp == *routes */ ! *routes = (*routes)->next; ! } else { ! prev->next = tmp->next; ! } ! free(tmp); ! return 1; ! } ! } ! return 0; ! } ! ! int ! olsr_addroute_remove_function(export_route_function function, olsr_u8_t type) ! { ! return olsr_route_remove_function(&add_routes, function, type); ! } ! ! int ! olsr_delroute_remove_function(export_route_function function, olsr_u8_t type) ! { ! return olsr_route_remove_function(&del_routes, function, type); ! } --- 87,94 ---- ! export_route_function olsr_addroute_function; ! export_route_function olsr_addroute6_function; ! export_route_function olsr_delroute_function; ! export_route_function olsr_delroute6_function; *************** *** 160,180 **** list_head_init(&del_kernel_list); ! olsr_addroute_add_function(&olsr_ioctl_add_route, AF_INET); ! olsr_addroute_add_function(&olsr_ioctl_add_route6, AF_INET6); ! olsr_delroute_add_function(&olsr_ioctl_del_route, AF_INET); ! olsr_delroute_add_function(&olsr_ioctl_del_route6, AF_INET6); ! } ! ! static int ! olsr_export_route(struct export_route_entry *routes, const struct rt_entry *rt, int ip_version) ! { ! int retval = 0; ! struct export_route_entry *tmp; ! for (tmp = routes; tmp != NULL; tmp = tmp->next) { ! if (tmp->type == ip_version) { ! retval = tmp->function(rt); ! } ! } ! return retval; } --- 101,108 ---- list_head_init(&del_kernel_list); ! olsr_addroute_function = olsr_ioctl_add_route; ! olsr_addroute6_function = olsr_ioctl_add_route6; ! olsr_delroute_function = olsr_ioctl_del_route; ! olsr_delroute6_function = olsr_ioctl_del_route6; } *************** *** 234,238 **** { if(!olsr_cnf->host_emul) { ! olsr_16_t error = olsr_export_route(del_routes, rt, olsr_cnf->ip_version); if(error < 0) { --- 162,167 ---- { if(!olsr_cnf->host_emul) { ! olsr_16_t error = olsr_cnf->ip_version == AF_INET ? ! olsr_delroute_function(rt) : olsr_delroute6_function(rt); if(error < 0) { *************** *** 258,262 **** if(!olsr_cnf->host_emul) { ! olsr_16_t error = olsr_export_route(add_routes, rt, olsr_cnf->ip_version); if(error < 0) { --- 187,192 ---- if(!olsr_cnf->host_emul) { ! olsr_16_t error = olsr_cnf->ip_version == AF_INET ? ! olsr_addroute_function(rt) : olsr_addroute6_function(rt); if(error < 0) { Index: process_routes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** process_routes.h 11 Nov 2007 23:10:25 -0000 1.13 --- process_routes.h 29 Nov 2007 00:18:53 -0000 1.14 *************** *** 48,65 **** typedef int (*export_route_function)(const struct rt_entry*); ! void ! olsr_init_export_route(void); ! ! void ! olsr_addroute_add_function(export_route_function, olsr_u8_t); ! ! int ! olsr_addroute_remove_function(export_route_function, olsr_u8_t); void ! olsr_delroute_add_function(export_route_function, olsr_u8_t); ! ! int ! olsr_delroute_remove_function(export_route_function, olsr_u8_t); void --- 48,58 ---- typedef int (*export_route_function)(const struct rt_entry*); ! extern export_route_function olsr_addroute_function; ! extern export_route_function olsr_addroute6_function; ! extern export_route_function olsr_delroute_function; ! extern export_route_function olsr_delroute6_function; void ! olsr_init_export_route(void); void From (spam-protected) Thu Nov 29 01:24:02 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:24:02 +0000 Subject: [Olsr-cvs] olsrd-current/src parser.c, 1.36, 1.37 olsr.c, 1.63, 1.64 lq_packet.c, 1.31, 1.32 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6409/src Modified Files: parser.c olsr.c lq_packet.c Log Message: Patch from Sven-Ola Tücke from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/132-save-the-fish.patch: really savet he fish and avoid to forward invlaid messages from older olsrd versions Index: parser.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/parser.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** parser.c 8 Nov 2007 22:47:41 -0000 1.36 --- parser.c 29 Nov 2007 00:24:00 -0000 1.37 *************** *** 257,260 **** --- 257,270 ---- + #if 0 + /* + * Sven-Ola: This code leads to flooding our meshes with invalid / + * overdue messages if lq_fish is enabled (which is true since 2005) + * because there was no "do not forward"-check in olsr.c. If a message + * (yes: ttl=0 is invalid) is received, we should say: Welcome message, + * let us evaluate! But: if TTL < 2 or TTL + hopcount is higher than + * plausible, we should not forward. See olsr.c:olsr_forward_message() + */ + /* Treat TTL hopcnt */ if(olsr_cnf->ip_version == AF_INET) *************** *** 286,289 **** --- 296,300 ---- } } + #endif /*RFC 3626 section 3.4: Index: lq_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** lq_packet.c 16 Nov 2007 22:56:54 -0000 1.31 --- lq_packet.c 29 Nov 2007 00:24:00 -0000 1.32 *************** *** 150,154 **** { int i; ! static int ttl_list[] = { 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, MAX_TTL-1, 0}; // remember that we have generated an LQ TC message; this is --- 150,154 ---- { int i; ! static int ttl_list[] = { 2, 8, 2, 16, 2, 8, 2, MAX_TTL}; // remember that we have generated an LQ TC message; this is *************** *** 172,178 **** outif->ttl_index = 0; - if (ttl_list[outif->ttl_index] == 0) - outif->ttl_index = 0; - lq_tc->comm.ttl = ttl_list[outif->ttl_index++]; --- 172,175 ---- Index: olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** olsr.c 16 Nov 2007 19:12:55 -0000 1.63 --- olsr.c 29 Nov 2007 00:24:00 -0000 1.64 *************** *** 298,306 **** int msgsize; struct interface *ifn; - const int ttl = olsr_cnf->ip_version == AF_INET ? m->v4.ttl : m->v6.ttl; ! if (ttl < 2) { ! return 0; } if(!olsr_check_dup_table_fwd(originator, seqno, &in_if->ip_addr)) { --- 298,316 ---- int msgsize; struct interface *ifn; ! /* ! * Sven-Ola: We should not flood the mesh with overdue messages. Because ! * of a bug in parser.c:parse_packet, we have a lot of messages because ! * all older olsrd's have lq_fish enabled. ! */ ! if (AF_INET == olsr_cnf->ip_version) ! { ! if (2 > m->v4.ttl || 255 < (int)m->v4.hopcnt + (int)m->v4.ttl) return 0; ! } ! else ! { ! if (2 > m->v6.ttl || 255 < (int)m->v6.hopcnt + (int)m->v6.ttl) return 0; } + if(!olsr_check_dup_table_fwd(originator, seqno, &in_if->ip_addr)) { From (spam-protected) Thu Nov 29 01:26:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:26:19 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src mapwrite.h, NONE, 1.1 mapwrite.c, NONE, 1.1 nameservice.h, 1.16, 1.17 nameservice.c, 1.38, 1.39 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7957/lib/nameservice/src Modified Files: nameservice.h nameservice.c Added Files: mapwrite.h mapwrite.c Log Message: Patch from Sven-Ola Tücke from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/135-georss-map-for-nameservice.patch: fixes and extensions for the namesaervice plugin --- NEW FILE: mapwrite.c --- /* * Copyright (c) 2007, Sven-Ola * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the UniK olsr daemon nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* $Id: mapwrite.c,v 1.1 2007/11/29 00:26:16 bernd67 Exp $ */ #include #include #include #include #include #include #include #include "defs.h" #include "scheduler.h" #include "nameservice.h" #include "mid_set.h" #include "tc_set.h" #include "net_olsr.h" #include "mapwrite.h" static char my_latlon_str[48]; /** * lookup a nodes position */ static char* lookup_position_latlon(union olsr_ip_addr *ip) { int hash; struct db_entry *entry; if (ipequal(ip, &olsr_cnf->main_addr)) { return my_latlon_str; } for (hash = 0; hash < HASHSIZE; hash++) { for(entry = latlon_list[hash]; entry != NULL; entry = entry->next) { if (NULL != entry->names && ipequal(&entry->originator, ip)) { return entry->names->name; } } } return NULL; } /** * write latlon positions to a file */ void mapwrite_work(FILE* fmap) { int hash; struct olsr_if *ifs; union olsr_ip_addr ip; struct ipaddr_str strbuf1, strbuf2; struct tc_entry *tc; struct tc_edge_entry *tc_edge; if (!my_names || !fmap) return; for (ifs = olsr_cnf->interfaces; ifs; ifs = ifs->next) { if (0 != ifs->interf) { if (olsr_cnf->ip_version == AF_INET) { if (!(ip4equal((struct in_addr *)&olsr_cnf->main_addr, &ifs->interf->int_addr.sin_addr))) { if (0 > fprintf(fmap, "Mid('%s','%s');\n", olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr), olsr_ip_to_string(&strbuf2, (union olsr_ip_addr *)&ifs->interf->int_addr.sin_addr))) { return; } } } else if (!(ip6equal((struct in6_addr *)&olsr_cnf->main_addr, &ifs->interf->int6_addr.sin6_addr))) { if (0 > fprintf(fmap, "Mid('%s','%s');\n", olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr), olsr_ip_to_string(&strbuf2, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr))) { return; } } } } for (hash = 0; hash < HASHSIZE; hash++) { struct mid_entry *entry = mid_set[hash].next; while(entry != &mid_set[hash]) { struct mid_address *alias = entry->aliases; while(alias) { if (0 > fprintf(fmap, "Mid('%s','%s');\n", olsr_ip_to_string(&strbuf1, &entry->main_addr), olsr_ip_to_string(&strbuf2, &alias->alias))) { return; } alias = alias->next_alias; } entry = entry->next; } } lookup_defhna_latlon(&ip); sprintf(my_latlon_str, "%f,%f,%d", my_lat, my_lon, get_isdefhna_latlon()); if (0 > fprintf(fmap, "Self('%s',%s,'%s','%s');\n", olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr), my_latlon_str, olsr_ip_to_string(&strbuf2, &ip), my_names->name)) { return; } for (hash = 0; hash < HASHSIZE; hash++) { struct db_entry *entry; for(entry = latlon_list[hash]; entry != NULL; entry = entry->next) { if (NULL != entry->names) { if (0 > fprintf(fmap, "Node('%s',%s,'%s','%s');\n", olsr_ip_to_string(&strbuf1, &entry->originator), entry->names->name, olsr_ip_to_string(&strbuf2, &entry->names->ip), lookup_name_latlon(&entry->originator))) { return; } } } } OLSR_FOR_ALL_TC_ENTRIES(tc) { OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { char* lla = lookup_position_latlon(&tc->addr); char* llb = lookup_position_latlon(&tc_edge->T_dest_addr); if (NULL != lla && NULL != llb) { /* * To speed up processing, Links with both positions are named PLink() */ if (0 > fprintf(fmap, "PLink('%s','%s',%f,%f,%f,%s,%s);\n", olsr_ip_to_string(&strbuf1, &tc_edge->T_dest_addr), olsr_ip_to_string(&strbuf2, &tc->addr), tc_edge->link_quality, tc_edge->inverse_link_quality, (tc_edge->link_quality * tc_edge->inverse_link_quality) ? 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality) : 0.0, lla, llb)) { return; } } else { /* * If one link end pos is unkown, only send Link() */ if (0 > fprintf(fmap, "Link('%s','%s',%f,%f,%f);\n", olsr_ip_to_string(&strbuf1, &tc_edge->T_dest_addr), olsr_ip_to_string(&strbuf2, &tc->addr), tc_edge->link_quality, tc_edge->inverse_link_quality, (tc_edge->link_quality * tc_edge->inverse_link_quality) ? 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality) : 0.0)) { return; } } } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); } OLSR_FOR_ALL_TC_ENTRIES_END(tc); } #ifndef WIN32 /* * Windows doesn't know fifo's AFAIK. We better write * to a file (done in nameservice.c, see #ifdef WIN32) */ static const char* the_fifoname = 0; static int fifopolltime = 0; static void mapwrite_poll(void) { fifopolltime++; if (0 == (fifopolltime & 7) && 0 != the_fifoname) { FILE * fout; /* Non-blocking means: fail open if no pipe reader */ int fd = open(the_fifoname, O_WRONLY | O_NONBLOCK); if (0 <= fd) { /* * Change to blocking, otherwhise expect fprintf errors */ fcntl(fd, F_SETFL, O_WRONLY); fout = fdopen(fd, "w"); if (0 != fout) { mapwrite_work(fout); fclose(fout); /* Give pipe reader cpu slot to detect EOF */ usleep(1); } else { close(fd); } } } } int mapwrite_init(const char* fifoname) { the_fifoname = fifoname; if (0 != fifoname && 0 != *fifoname) { unlink(fifoname); if (0 > mkfifo(fifoname, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH)) { OLSR_PRINTF(1, "mkfifo(%s): %s", fifoname, strerror(errno)); return OLSR_FALSE; } else { the_fifoname = fifoname; olsr_register_timeout_function(&mapwrite_poll, OLSR_FALSE); } } return OLSR_TRUE; } void mapwrite_exit(void) { if (0 != the_fifoname) { unlink(the_fifoname); /* Ignore any Error */ the_fifoname = 0; } } #endif /* * Local Variables: * mode: c * c-indent-tabs-mode: t * c-basic-offset: 4 * tab-width: 4 * End: */ Index: nameservice.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** nameservice.h 16 Nov 2007 19:12:55 -0000 1.16 --- nameservice.h 29 Nov 2007 00:26:16 -0000 1.17 *************** *** 48,51 **** --- 48,53 ---- #include "olsrd_plugin.h" #include "nameservice_msg.h" + #include "hashing.h" + #include "mapwrite.h" #define PLUGIN_NAME "OLSRD nameservice plugin" *************** *** 104,107 **** --- 106,112 ---- }; + extern struct name_entry *my_names; + extern struct db_entry* latlon_list[HASHSIZE]; + extern float my_lat, my_lon; /* Timeout function to register with the sceduler */ Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** nameservice.c 29 Nov 2007 00:10:17 -0000 1.38 --- nameservice.c 29 Nov 2007 00:26:16 -0000 1.39 *************** *** 60,63 **** --- 60,64 ---- #include "plugin_util.h" #include "nameservice.h" + #include "mapwrite.h" #include "olsrd_copy.h" #include "compat.h" *************** *** 74,78 **** static char latlon_in_file[MAX_FILE + 1]; static char my_latlon_file[MAX_FILE + 1]; ! static float my_lat = 0.0, my_lon = 0.0; /* the databases (using hashing) --- 75,79 ---- static char latlon_in_file[MAX_FILE + 1]; static char my_latlon_file[MAX_FILE + 1]; ! float my_lat = 0.0, my_lon = 0.0; /* the databases (using hashing) *************** *** 83,87 **** * */ static struct db_entry* list[HASHSIZE]; ! static struct name_entry *my_names = NULL; static olsr_bool name_table_changed = OLSR_TRUE; --- 84,88 ---- * */ static struct db_entry* list[HASHSIZE]; ! struct name_entry *my_names = NULL; static olsr_bool name_table_changed = OLSR_TRUE; *************** *** 94,98 **** static olsr_bool forwarder_table_changed = OLSR_TRUE; ! static struct db_entry* latlon_list[HASHSIZE]; static olsr_bool latlon_table_changed = OLSR_TRUE; --- 95,99 ---- static olsr_bool forwarder_table_changed = OLSR_TRUE; ! struct db_entry* latlon_list[HASHSIZE]; static olsr_bool latlon_table_changed = OLSR_TRUE; *************** *** 119,123 **** GetWindowsDirectory(my_hosts_file, MAX_FILE - 12); GetWindowsDirectory(my_services_file, MAX_FILE - 12); ! GetWindowsDirectory(my_latlon_file, MAX_FILE - 12); len = strlen(my_hosts_file); --- 120,124 ---- GetWindowsDirectory(my_hosts_file, MAX_FILE - 12); GetWindowsDirectory(my_services_file, MAX_FILE - 12); ! GetWindowsDirectory(my_resolv_file, MAX_FILE - 12); len = strlen(my_hosts_file); *************** *** 135,152 **** my_resolv_file[len++] = '\\'; strcpy(my_resolv_file + len, "resolvconf_olsr"); - - len = strlen(my_latlon_file); - if (my_latlon_file[len - 1] != '\\') - my_latlon_file[len++] = '\\'; - strcpy(my_latlon_file + len, "latlon.js"); #else strcpy(my_hosts_file, "/var/run/hosts_olsr"); strcpy(my_services_file, "/var/run/services_olsr"); strcpy(my_resolv_file, "/var/run/resolvconf_olsr"); - strcpy(my_latlon_file, "/var/run/latlon.js"); #endif my_suffix[0] = '\0'; my_add_hosts[0] = '\0'; latlon_in_file[0] = '\0'; --- 136,148 ---- my_resolv_file[len++] = '\\'; strcpy(my_resolv_file + len, "resolvconf_olsr"); #else strcpy(my_hosts_file, "/var/run/hosts_olsr"); strcpy(my_services_file, "/var/run/services_olsr"); strcpy(my_resolv_file, "/var/run/resolvconf_olsr"); #endif my_suffix[0] = '\0'; my_add_hosts[0] = '\0'; + my_latlon_file[0] = '\0'; latlon_in_file[0] = '\0'; *************** *** 357,363 **** for (name = my_names; name != NULL; name = name->next) { ! if (memcmp(&name->ip, &ipz, olsr_cnf->ipsize) == 0) { OLSR_PRINTF(2, "NAME PLUGIN: insert main addr for name %s \n", name->name); ! memcpy(&name->ip, &olsr_cnf->main_addr, olsr_cnf->ipsize); } } --- 353,359 ---- for (name = my_names; name != NULL; name = name->next) { ! if (ipequal(&name->ip, &ipz)) { OLSR_PRINTF(2, "NAME PLUGIN: insert main addr for name %s \n", name->name); ! name->ip = olsr_cnf->main_addr; } } *************** *** 365,369 **** if (name->ip.v4.s_addr == 0) { OLSR_PRINTF(2, "NAME PLUGIN: insert main addr for name %s \n", name->name); ! memcpy(&name->ip, &olsr_cnf->main_addr, olsr_cnf->ipsize); } } --- 361,365 ---- if (name->ip.v4.s_addr == 0) { OLSR_PRINTF(2, "NAME PLUGIN: insert main addr for name %s \n", name->name); ! name->ip = olsr_cnf->main_addr; } } *************** *** 379,382 **** --- 375,379 ---- olsr_register_timeout_function(&olsr_timeout, OLSR_TRUE); olsr_register_scheduler_event(&olsr_event, NULL, my_interval, 0, NULL); + mapwrite_init(my_latlon_file); return 1; *************** *** 452,456 **** regfree(®ex_t_name); regfree(®ex_t_service); ! } --- 449,453 ---- regfree(®ex_t_name); regfree(®ex_t_service); ! mapwrite_exit(); } *************** *** 508,514 **** --- 505,513 ---- write_services_file(); // if service_table_changed break; + #ifdef WIN32 case 4: write_latlon_file(); // latlon_table_changed break; + #endif default: timeout_roundrobin = 0; *************** *** 647,651 **** /* Check if message originated from this node. If so - back off */ ! if(memcmp(&originator, &olsr_cnf->main_addr, olsr_cnf->ipsize) == 0) return; --- 646,650 ---- /* Check if message originated from this node. If so - back off */ ! if(ipequal(&originator, &olsr_cnf->main_addr)) return; *************** *** 762,766 **** to->type = htons(from->type); to->len = htons(from->len); ! memcpy(&to->ip, &from->ip, olsr_cnf->ipsize); pos += sizeof(struct name); strncpy(pos, from->name, from->len); --- 761,765 ---- to->type = htons(from->type); to->len = htons(from->len); ! to->ip = from->ip; pos += sizeof(struct name); strncpy(pos, from->name, from->len); *************** *** 788,792 **** type_of_from_packet, len_of_name, name); ! //XXX: should I check the from_packet->ip here? If so, why not also check the ip fro HOST and SERVICE? if( (type_of_from_packet==NAME_HOST && !is_name_wellformed(name)) || (type_of_from_packet==NAME_SERVICE && !is_service_wellformed(name)) || --- 787,791 ---- type_of_from_packet, len_of_name, name); ! //XXX: should I check the from_packet->ip here? If so, why not also check the ip from HOST and SERVICE? if( (type_of_from_packet==NAME_HOST && !is_name_wellformed(name)) || (type_of_from_packet==NAME_SERVICE && !is_service_wellformed(name)) || *************** *** 799,803 **** //ignore all packets with a too long name //or a spoofed len of its included name string ! if (len_of_name > MAX_NAME || strlen(name) != len_of_name) { OLSR_PRINTF(4, "NAME PLUGIN: from_packet->len %d > MAX_NAME %d or from_packet->len %d !0 strlen(name [%s] in packet)\n", len_of_name, MAX_NAME, len_of_name, name ); --- 798,802 ---- //ignore all packets with a too long name //or a spoofed len of its included name string ! if (len_of_name > MAX_NAME || strlen(name) != len_of_name || NULL != strchr(name, '\\') || NULL != strchr(name, '\'')) { OLSR_PRINTF(4, "NAME PLUGIN: from_packet->len %d > MAX_NAME %d or from_packet->len %d !0 strlen(name [%s] in packet)\n", len_of_name, MAX_NAME, len_of_name, name ); *************** *** 837,841 **** olsr_ip_to_string(&strbuf2, &from_packet->ip), olsr_ip_to_string(&strbuf3, &already_saved_name_entries->ip)); ! memcpy(&already_saved_name_entries->ip, &from_packet->ip, olsr_cnf->ipsize); *this_table_changed = OLSR_TRUE; } --- 836,840 ---- olsr_ip_to_string(&strbuf2, &from_packet->ip), olsr_ip_to_string(&strbuf3, &already_saved_name_entries->ip)); ! already_saved_name_entries->ip = from_packet->ip; *this_table_changed = OLSR_TRUE; } *************** *** 854,858 **** tmp->len = len_of_name > MAX_NAME ? MAX_NAME : ntohs(from_packet->len); tmp->name = olsr_malloc(tmp->len+1, "new name_entry name"); ! memcpy(&tmp->ip, &from_packet->ip, olsr_cnf->ipsize); strncpy(tmp->name, name, tmp->len); tmp->name[tmp->len] = '\0'; --- 853,857 ---- tmp->len = len_of_name > MAX_NAME ? MAX_NAME : ntohs(from_packet->len); tmp->name = olsr_malloc(tmp->len+1, "new name_entry name"); ! tmp->ip = from_packet->ip; strncpy(tmp->name, name, tmp->len); tmp->name[tmp->len] = '\0'; *************** *** 942,946 **** for (entry = this_list[hash]; entry != NULL; entry = entry->next) { ! if (memcmp(originator, &entry->originator, olsr_cnf->ipsize) == 0) { #ifndef NODEBUG struct ipaddr_str strbuf; --- 941,945 ---- for (entry = this_list[hash]; entry != NULL; entry = entry->next) { ! if (ipequal(originator, &entry->originator)) { #ifndef NODEBUG struct ipaddr_str strbuf; *************** *** 967,971 **** entry = olsr_malloc(sizeof(struct db_entry), "new db_entry"); ! memcpy(&entry->originator, originator, olsr_cnf->ipsize); olsr_get_timestamp(vtime * 1000, &entry->timer); entry->names = NULL; --- 966,970 ---- entry = olsr_malloc(sizeof(struct db_entry), "new db_entry"); ! entry->originator = *originator; olsr_get_timestamp(vtime * 1000, &entry->timer); entry->names = NULL; *************** *** 1446,1457 **** void lookup_defhna_latlon(union olsr_ip_addr *ip) { ! union olsr_ip_addr dest; ! struct rt_entry* rt_hna; ! memset(ip, 0, sizeof(ip)); ! memset(&dest, 0, sizeof(dest)); ! if (NULL != (rt_hna = olsr_lookup_routing_table(&dest))) { ! //COPY_IP(ip, &rt_hna->rt_best->rtp_nexthop.gateway); ! *ip = rt_hna->rt_best->rtp_nexthop.gateway; ! } } --- 1445,1458 ---- void lookup_defhna_latlon(union olsr_ip_addr *ip) { ! struct avl_node *rt_tree_node; ! struct olsr_ip_prefix prefix; ! ! memset(ip, 0, sizeof(ip)); ! memset(&prefix, 0, sizeof(prefix)); ! ! if (NULL != (rt_tree_node = avl_find(&routingtree, &prefix))) ! { ! *ip = ((struct rt_entry *)rt_tree_node->data)->rt_best->rtp_nexthop.gateway; ! } } *************** *** 1478,1481 **** --- 1479,1483 ---- } + #ifdef WIN32 /** * write latlon positions to a javascript file *************** *** 1484,1582 **** write_latlon_file(void) { ! int hash; ! FILE* js; ! struct olsr_if *ifs; ! union olsr_ip_addr ip; ! struct ipaddr_str strbuf1, strbuf2; ! struct tc_entry *tc; ! struct tc_edge_entry *tc_edge; ! ! if (!my_names || !latlon_table_changed) { ! return; ! } ! OLSR_PRINTF(2, "NAME PLUGIN: writing latlon file\n"); ! ! js = fopen( my_latlon_file, "w" ); ! if (js == NULL) { ! OLSR_PRINTF(0, "NAME PLUGIN: cant write latlon file\n"); ! return; ! } ! fprintf(js, "/* This file is overwritten regularly by olsrd */\n"); ! ! for (ifs = olsr_cnf->interfaces; ifs; ifs = ifs->next) ! { ! if (0 != ifs->interf) ! { ! if (olsr_cnf->ip_version == AF_INET) ! { ! /* ! * Didn't find a good sample to grab a simple ! * olsr_ip_addr from a given interface. Sven-Ola ! */ ! const char* p = olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr); ! const char* q = ip4_to_string(&strbuf1, ifs->interf->int_addr.sin_addr); ! if (0 != strcmp(p, q)) ! { ! fprintf(js, "Mid('%s','%s');\n", p, q); ! } ! } ! else if (!(ipequal(&olsr_cnf->main_addr, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr))) ! { ! fprintf(js, "Mid('%s','%s');\n", ! olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr), ! olsr_ip_to_string(&strbuf2, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr)); ! } ! } ! } ! ! for (hash = 0; hash < HASHSIZE; hash++) ! { ! struct mid_entry *entry = mid_set[hash].next; ! while(entry != &mid_set[hash]) ! { ! struct mid_address *alias = entry->aliases; ! while(alias) ! { ! fprintf(js, "Mid('%s','%s');\n", ! olsr_ip_to_string(&strbuf1, &entry->main_addr), ! olsr_ip_to_string(&strbuf2, &alias->alias)); ! alias = alias->next_alias; ! } ! entry = entry->next; ! } ! } ! lookup_defhna_latlon(&ip); ! fprintf(js, "Self('%s',%f,%f,%d,'%s','%s');\n", olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr), ! my_lat, my_lon, get_isdefhna_latlon(), olsr_ip_to_string(&strbuf2, &ip), my_names->name); ! for (hash = 0; hash < HASHSIZE; hash++) ! { ! struct db_entry *entry; ! for(entry = latlon_list[hash]; entry != NULL; entry = entry->next) ! { ! struct name_entry *name; ! for (name = entry->names; name != NULL; name = name->next) ! { ! fprintf(js, "Node('%s',%s,'%s','%s');\n", ! olsr_ip_to_string(&strbuf1, &entry->originator), ! name->name, olsr_ip_to_string(&strbuf2, &name->ip), ! lookup_name_latlon(&entry->originator)); ! } ! } ! } ! ! OLSR_FOR_ALL_TC_ENTRIES(tc) { ! OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) { ! fprintf(js, "Link('%s','%s',%f,%f,%f);\n", ! olsr_ip_to_string(&strbuf1, &tc_edge->T_dest_addr), ! olsr_ip_to_string(&strbuf2, &tc->addr), ! tc_edge->link_quality, ! tc_edge->inverse_link_quality, ! olsr_calc_tc_etx(tc_edge)); ! } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge); ! } OLSR_FOR_ALL_TC_ENTRIES_END(tc); ! fclose(js); ! latlon_table_changed = OLSR_FALSE; } /* --- 1486,1505 ---- write_latlon_file(void) { ! FILE* fmap; ! ! if (!my_names || !latlon_table_changed) return; ! ! OLSR_PRINTF(2, "NAME PLUGIN: writing latlon file\n"); ! if (NULL == (fmap = fopen(my_latlon_file, "w"))) { ! OLSR_PRINTF(0, "NAME PLUGIN: cant write latlon file\n"); ! return; ! } ! fprintf(fmap, "/* This file is overwritten regularly by olsrd */\n"); ! mapwrite_work(fmap); ! fclose(fmap); ! latlon_table_changed = OLSR_FALSE; } + #endif /* --- NEW FILE: mapwrite.h --- /* * Copyright (c) 2007, Sven-Ola * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the UniK olsr daemon nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* $Id: mapwrite.h,v 1.1 2007/11/29 00:26:16 bernd67 Exp $ */ #ifndef _MAPWRITE_H #define _MAPWRITE_H int mapwrite_init(const char* fifoname); void mapwrite_work(FILE* fmap); void mapwrite_exit(void); #endif /* _MAPWRITE_H */ /* * Local Variables: * mode: c * c-indent-tabs-mode: t * c-basic-offset: 4 * tab-width: 4 * End: */ From (spam-protected) Thu Nov 29 01:34:24 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:34:24 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.33, 1.34 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11217/lib/dot_draw/src Modified Files: olsrd_dot_draw.c Log Message: Patch from Sven-Ola Tücke from http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/138-olsrd-fixdotdraw.patch: fix the dot_draw plugin Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** olsrd_dot_draw.c 16 Nov 2007 19:52:09 -0000 1.33 --- olsrd_dot_draw.c 29 Nov 2007 00:34:22 -0000 1.34 *************** *** 332,336 **** hna_msk.v6 = hna->net.prefix_len; } ! ipc_print_net(&olsr_cnf->interfaces->interf->ip_addr, &hna->net.prefix, &hna_msk); --- 332,336 ---- hna_msk.v6 = hna->net.prefix_len; } ! ipc_print_net(&olsr_cnf->main_addr, &hna->net.prefix, &hna_msk); From (spam-protected) Thu Nov 29 01:49:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:42 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux net.c,1.35,1.36 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/src/linux Modified Files: net.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/net.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** net.c 8 Nov 2007 22:47:42 -0000 1.35 --- net.c 29 Nov 2007 00:49:40 -0000 1.36 *************** *** 46,49 **** --- 46,50 ---- #include "net.h" + #include "../ipcalc.h" #include "../defs.h" #include "../net_os.h" From (spam-protected) Thu Nov 29 01:49:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:42 +0000 Subject: [Olsr-cvs] olsrd-current/src/unix ifnet.c,1.53,1.54 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/unix In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/src/unix Modified Files: ifnet.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** ifnet.c 8 Nov 2007 22:47:42 -0000 1.53 --- ifnet.c 29 Nov 2007 00:49:40 -0000 1.54 *************** *** 45,50 **** #endif - #include "interfaces.h" #include "ifnet.h" #include "defs.h" #include "olsr.h" --- 45,51 ---- #endif #include "ifnet.h" + #include "ipcalc.h" + #include "interfaces.h" #include "defs.h" #include "olsr.h" *************** *** 320,324 **** #ifdef DEBUG ! OLSR_PRINTF(3, "\tAddress:%s\n", sockaddr_to_string(&buf, &ifr.ifr_addr)); #endif --- 321,325 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "\tAddress:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); #endif *************** *** 330,334 **** OLSR_PRINTF(1, "IPv4 address changed for %s\n", ifr.ifr_name); OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_addr.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&buf, &ifr.ifr_addr)); ifp->int_addr = *(struct sockaddr_in *)&ifr.ifr_addr; --- 331,335 ---- OLSR_PRINTF(1, "IPv4 address changed for %s\n", ifr.ifr_name); OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_addr.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); ifp->int_addr = *(struct sockaddr_in *)&ifr.ifr_addr; *************** *** 338,343 **** olsr_cnf->ipsize) == 0) { ! OLSR_PRINTF(1, "New main address: %s\n", sockaddr_to_string(&buf, &ifr.ifr_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", sockaddr_to_string(&buf, &ifr.ifr_addr)); memcpy(&olsr_cnf->main_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, --- 339,344 ---- olsr_cnf->ipsize) == 0) { ! OLSR_PRINTF(1, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); ! olsr_syslog(OLSR_LOG_INFO, "New main address: %s\n", sockaddr4_to_string(&buf, &ifr.ifr_addr)); memcpy(&olsr_cnf->main_addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr, *************** *** 360,364 **** #ifdef DEBUG ! OLSR_PRINTF(3, "\tNetmask:%s\n", sockaddr_to_string(&buf, &ifr.ifr_netmask)); #endif --- 361,365 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "\tNetmask:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_netmask)); #endif *************** *** 373,377 **** OLSR_PRINTF(1, "IPv4 netmask changed for %s\n", ifr.ifr_name); OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_netmask.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&buf, &ifr.ifr_netmask)); ifp->int_netmask = *(struct sockaddr_in *)&ifr.ifr_netmask; --- 374,378 ---- OLSR_PRINTF(1, "IPv4 netmask changed for %s\n", ifr.ifr_name); OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_netmask.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_netmask)); ifp->int_netmask = *(struct sockaddr_in *)&ifr.ifr_netmask; *************** *** 390,394 **** #ifdef DEBUG ! OLSR_PRINTF(3, "\tBroadcast address:%s\n", sockaddr_to_string(&buf, &ifr.ifr_broadaddr)); #endif --- 391,395 ---- #ifdef DEBUG ! OLSR_PRINTF(3, "\tBroadcast address:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_broadaddr)); #endif *************** *** 401,405 **** OLSR_PRINTF(1, "IPv4 broadcast changed for %s\n", ifr.ifr_name); OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_broadaddr.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr_to_string(&buf, &ifr.ifr_broadaddr)); ifp->int_broadaddr = *(struct sockaddr_in *)&ifr.ifr_broadaddr; --- 402,406 ---- OLSR_PRINTF(1, "IPv4 broadcast changed for %s\n", ifr.ifr_name); OLSR_PRINTF(1, "\tOld:%s\n", ip4_to_string(&buf, ifp->int_broadaddr.sin_addr)); ! OLSR_PRINTF(1, "\tNew:%s\n", sockaddr4_to_string(&buf, &ifr.ifr_broadaddr)); ifp->int_broadaddr = *(struct sockaddr_in *)&ifr.ifr_broadaddr; From (spam-protected) Thu Nov 29 01:49:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Bmf.c, 1.10, 1.11 NetworkInterfaces.c, 1.12, 1.13 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/bmf/src Modified Files: Bmf.c NetworkInterfaces.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NetworkInterfaces.c 16 Nov 2007 19:12:55 -0000 1.12 --- NetworkInterfaces.c 29 Nov 2007 00:49:40 -0000 1.13 *************** *** 59,64 **** /* OLSRD includes */ #include "olsr.h" /* olsr_printf() */ #include "defs.h" /* olsr_cnf */ - #include "local_hna_set.h" /* add_local_hna4_entry() */ #include "link_set.h" /* get_link_set() */ #include "lq_route.h" /* MIN_LINK_QUALITY */ --- 59,64 ---- /* OLSRD includes */ #include "olsr.h" /* olsr_printf() */ + #include "ipcalc.h" #include "defs.h" /* olsr_cnf */ #include "link_set.h" /* get_link_set() */ #include "lq_route.h" /* MIN_LINK_QUALITY */ *************** *** 1356,1364 **** { union olsr_ip_addr temp_net; - union olsr_ip_addr temp_netmask; temp_net.v4.s_addr = htonl(EtherTunTapIp); ! temp_netmask.v4.s_addr = htonl(0xFFFFFFFF); ! add_local_hna4_entry(&temp_net, &temp_netmask); } --- 1356,1362 ---- { union olsr_ip_addr temp_net; temp_net.v4.s_addr = htonl(EtherTunTapIp); ! ip_prefix_list_add(&olsr_cnf->hna_entries, &temp_net, 32); } Index: Bmf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Bmf.c 16 Nov 2007 19:12:55 -0000 1.10 --- Bmf.c 29 Nov 2007 00:49:40 -0000 1.11 *************** *** 58,61 **** --- 58,62 ---- /* OLSRD includes */ #include "defs.h" /* olsr_cnf, OLSR_PRINTF */ + #include "ipcalc.h" #include "olsr.h" /* olsr_printf */ #include "scheduler.h" /* olsr_register_scheduler_event */ From (spam-protected) Thu Nov 29 01:49:43 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:43 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw_plain/src olsrd_dyn_gw_plain.c, 1.6, 1.7 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw_plain/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/dyn_gw_plain/src Modified Files: olsrd_dyn_gw_plain.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions 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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** olsrd_dyn_gw_plain.c 8 Nov 2007 22:47:40 -0000 1.6 --- olsrd_dyn_gw_plain.c 29 Nov 2007 00:49:40 -0000 1.7 *************** *** 38,46 **** */ - #include "olsr_types.h" #include "olsrd_dyn_gw_plain.h" #include "scheduler.h" #include "olsr.h" ! #include "local_hna_set.h" #include #include --- 38,47 ---- */ #include "olsrd_dyn_gw_plain.h" + #include "olsr_types.h" + #include "ipcalc.h" #include "scheduler.h" #include "olsr.h" ! #include #include *************** *** 90,94 **** /* Remove all local Inet HNA entries */ ! while(remove_local_hna4_entry(&gw_net, &gw_netmask)) { olsr_printf(DEBUGLEV, "HNA Internet gateway deleted\n"); } --- 91,95 ---- /* Remove all local Inet HNA entries */ ! while(ip_prefix_list_remove(&olsr_cnf->hna_entries, &gw_net, olsr_netmask_to_prefix(&gw_netmask))) { olsr_printf(DEBUGLEV, "HNA Internet gateway deleted\n"); } *************** *** 176,185 **** if (1 == res && 0 == has_inet_gateway) { olsr_printf(DEBUGLEV, "Adding OLSR local HNA entry for Internet\n"); ! add_local_hna4_entry(&gw_net, &gw_netmask); has_inet_gateway = 1; } else if (0 == res && 1 == has_inet_gateway) { /* Remove all local Inet HNA entries */ ! while(remove_local_hna4_entry(&gw_net, &gw_netmask)) { olsr_printf(DEBUGLEV, "Removing OLSR local HNA entry for Internet\n"); } --- 177,186 ---- if (1 == res && 0 == has_inet_gateway) { olsr_printf(DEBUGLEV, "Adding OLSR local HNA entry for Internet\n"); ! ip_prefix_list_add(&olsr_cnf->hna_entries, &gw_net, olsr_netmask_to_prefix(&gw_netmask)); has_inet_gateway = 1; } else if (0 == res && 1 == has_inet_gateway) { /* Remove all local Inet HNA entries */ ! while(ip_prefix_list_remove(&olsr_cnf->hna_entries, &gw_net, olsr_netmask_to_prefix(&gw_netmask))) { olsr_printf(DEBUGLEV, "Removing OLSR local HNA entry for Internet\n"); } From (spam-protected) Thu Nov 29 01:49:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c,1.26,1.27 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/dyn_gw/src Modified Files: olsrd_dyn_gw.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: olsrd_dyn_gw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** olsrd_dyn_gw.c 8 Nov 2007 23:53:43 -0000 1.26 --- olsrd_dyn_gw.c 29 Nov 2007 00:49:40 -0000 1.27 *************** *** 42,46 **** /* ! * -Threaded ping code added by Jens Nachitgall * -HNA4 checking by bjoern riemer */ --- 42,46 ---- /* ! * -Threaded ping code added by Jens Nachtigall * -HNA4 checking by bjoern riemer */ *************** *** 52,57 **** #include "scheduler.h" #include "olsr.h" - #include "local_hna_set.h" #include "defs.h" #include --- 52,57 ---- #include "scheduler.h" #include "olsr.h" #include "defs.h" + #include "ipcalc.h" #include *************** *** 106,110 **** struct hna_list { union olsr_ip_addr hna_net; ! union olsr_ip_addr hna_netmask; struct ping_list *ping_hosts; int hna_added; --- 106,110 ---- struct hna_list { union olsr_ip_addr hna_net; ! olsr_u8_t hna_prefixlen; struct ping_list *ping_hosts; int hna_added; *************** *** 116,120 **** add_to_hna_list(struct hna_list *, union olsr_ip_addr *hna_net, ! union olsr_ip_addr *hna_netmask ); struct hna_list *the_hna_list = NULL; --- 116,120 ---- add_to_hna_list(struct hna_list *, union olsr_ip_addr *hna_net, ! olsr_u8_t hna_prefixlen ); struct hna_list *the_hna_list = NULL; *************** *** 124,128 **** static int ! check_gw(union olsr_ip_addr *, union olsr_ip_addr *,struct ping_list *); static int --- 124,128 ---- static int ! check_gw(union olsr_ip_addr *, olsr_u8_t,struct ping_list *); static int *************** *** 168,172 **** temp_net.v4.s_addr = INET_NET; temp_netmask.v4.s_addr = INET_PREFIX; ! the_hna_list = add_to_hna_list(the_hna_list, &temp_net, &temp_netmask); if (the_hna_list == NULL) { return 1; --- 168,172 ---- temp_net.v4.s_addr = INET_NET; temp_netmask.v4.s_addr = INET_PREFIX; ! the_hna_list = add_to_hna_list(the_hna_list, &temp_net, olsr_netmask_to_prefix(&temp_netmask)); if (the_hna_list == NULL) { return 1; *************** *** 205,209 **** //printf("/%s(%08x)\n",inet_ntoa(foo_addr),foo_addr.s_addr); //printf("%s():got->%s/%s\n",__func__,olsr_ip_to_string((union olsr_ip_addr *)&)); ! the_hna_list = add_to_hna_list(the_hna_list, &temp_net, &temp_netmask); if (the_hna_list != NULL) { return 1; --- 205,209 ---- //printf("/%s(%08x)\n",inet_ntoa(foo_addr),foo_addr.s_addr); //printf("%s():got->%s/%s\n",__func__,olsr_ip_to_string((union olsr_ip_addr *)&)); ! the_hna_list = add_to_hna_list(the_hna_list, &temp_net, olsr_netmask_to_prefix(&temp_netmask)); if (the_hna_list != NULL) { return 1; *************** *** 270,274 **** if (has_available_gw == 1 && gw_already_added == 0) { olsr_printf(1, "Adding OLSR local HNA entry for Internet\n"); ! add_local_hna4_entry(&gw_net, &gw_netmask); gw_already_added = 1; } else if ((has_available_gw == 0) && (gw_already_added == 1)) { --- 270,274 ---- if (has_available_gw == 1 && gw_already_added == 0) { olsr_printf(1, "Adding OLSR local HNA entry for Internet\n"); ! add_local_hna_entry(&gw_net, &gw_netmask); gw_already_added = 1; } else if ((has_available_gw == 0) && (gw_already_added == 1)) { *************** *** 283,290 **** if((li->probe_ok==1)&&(li->hna_added==0)){ olsr_printf(1, "Adding OLSR local HNA entry\n"); ! add_local_hna4_entry(&li->hna_net, &li->hna_netmask); li->hna_added=1; }else if((li->probe_ok==0)&&(li->hna_added==1)){ ! while(remove_local_hna4_entry(&li->hna_net, &li->hna_netmask)) { olsr_printf(1, "Removing OLSR local HNA entry\n"); } --- 283,290 ---- if((li->probe_ok==1)&&(li->hna_added==0)){ olsr_printf(1, "Adding OLSR local HNA entry\n"); ! ip_prefix_list_add(&olsr_cnf->hna_entries, &li->hna_net, li->hna_prefixlen); li->hna_added=1; }else if((li->probe_ok==0)&&(li->hna_added==1)){ ! while(ip_prefix_list_remove(&olsr_cnf->hna_entries, &li->hna_net, li->hna_prefixlen)) { olsr_printf(1, "Removing OLSR local HNA entry\n"); } *************** *** 312,316 **** for(li = the_hna_list; li; li = li->next){ /* check for gw in table entry and if Ping IPs are given also do pings */ ! li->probe_ok = check_gw(&li->hna_net,&li->hna_netmask,li->ping_hosts); //has_available_gw = check_gw(&gw_net, &gw_netmask); } --- 312,316 ---- for(li = the_hna_list; li; li = li->next){ /* check for gw in table entry and if Ping IPs are given also do pings */ ! li->probe_ok = check_gw(&li->hna_net,li->hna_prefixlen,li->ping_hosts); //has_available_gw = check_gw(&gw_net, &gw_netmask); } *************** *** 325,329 **** static int ! check_gw(union olsr_ip_addr *net, union olsr_ip_addr *mask, struct ping_list *the_ping_list) { char buf[1024], iface[16]; --- 325,329 ---- static int ! check_gw(union olsr_ip_addr *net, olsr_u8_t prefixlen, struct ping_list *the_ping_list) { char buf[1024], iface[16]; *************** *** 332,335 **** --- 332,336 ---- int metric, refcnt, use; int retval = 0; + union olsr_ip_addr mask; FILE *fp = fopen(PROCENTRY_ROUTE, "r"); *************** *** 341,344 **** --- 342,346 ---- } + olsr_prefix_to_netmask(&mask, prefixlen); /* olsr_printf(1, "Genmask Destination Gateway " *************** *** 365,372 **** if( (iflags & RTF_UP) && (metric == 0) && ! (netmask == mask->v4.s_addr) && (dest_addr == net->v4.s_addr)) { ! if ( ((mask->v4.s_addr == INET_PREFIX)&&(net->v4.s_addr == INET_NET))&&(!(iflags & RTF_GATEWAY))) { fclose(fp); --- 367,374 ---- if( (iflags & RTF_UP) && (metric == 0) && ! (netmask == mask.v4.s_addr) && (dest_addr == net->v4.s_addr)) { ! if ( ((mask.v4.s_addr == INET_PREFIX)&&(net->v4.s_addr == INET_NET))&&(!(iflags & RTF_GATEWAY))) { fclose(fp); *************** *** 390,394 **** if(retval == 0){ /* And we cast here since we get warnings on Win32 */ ! olsr_printf(1, "HNA[%08x/%08x] is invalid\n", (unsigned int)net->v4.s_addr, (unsigned int)mask->v4.s_addr); } return retval; --- 392,396 ---- if(retval == 0){ /* And we cast here since we get warnings on Win32 */ ! olsr_printf(1, "HNA[%08x/%08x] is invalid\n", (unsigned int)net->v4.s_addr, (unsigned int)mask.v4.s_addr); } return retval; *************** *** 430,434 **** static struct hna_list * ! add_to_hna_list(struct hna_list * list_root, union olsr_ip_addr *hna_net, union olsr_ip_addr *hna_netmask ) { struct hna_list *new = malloc(sizeof(struct hna_list)); --- 432,436 ---- static struct hna_list * ! add_to_hna_list(struct hna_list * list_root, union olsr_ip_addr *hna_net, olsr_u8_t hna_prefixlen ) { struct hna_list *new = malloc(sizeof(struct hna_list)); *************** *** 441,445 **** //memcpy(&new->hna_netmask,hna_netmask,sizeof(union hna_netmask)); new->hna_net.v4=hna_net->v4; ! new->hna_netmask.v4=hna_netmask->v4; new->hna_added=0; new->probe_ok=0; --- 443,447 ---- //memcpy(&new->hna_netmask,hna_netmask,sizeof(union hna_netmask)); new->hna_net.v4=hna_net->v4; ! new->hna_prefixlen=hna_prefixlen; new->hna_added=0; new->probe_ok=0; From (spam-protected) Thu Nov 29 01:49:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:42 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.34, 1.35 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/dot_draw/src Modified Files: olsrd_dot_draw.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: olsrd_dot_draw.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** olsrd_dot_draw.c 29 Nov 2007 00:34:22 -0000 1.34 --- olsrd_dot_draw.c 29 Nov 2007 00:49:40 -0000 1.35 *************** *** 61,64 **** --- 61,65 ---- #include "olsr.h" + #include "ipcalc.h" #include "olsr_types.h" #include "neighbor_table.h" *************** *** 89,95 **** plugin_ipc_init(void); - static char* - olsr_netmask_to_string(const union hna_netmask *mask); - /* Event function to register with the sceduler */ static int --- 90,93 ---- *************** *** 106,110 **** static void ! ipc_print_net(const union olsr_ip_addr *, const union olsr_ip_addr *, const union hna_netmask *); static void --- 104,108 ---- static void ! ipc_print_net(const union olsr_ip_addr *, const union olsr_ip_addr *, olsr_u8_t); static void *************** *** 284,288 **** struct tc_entry *tc; struct tc_edge_entry *tc_edge; ! struct local_hna_entry *hna; int idx; --- 282,286 ---- struct tc_entry *tc; struct tc_edge_entry *tc_edge; ! struct ip_prefix_list *hna; int idx; *************** *** 316,320 **** ipc_print_net(&tmp_hna->A_gateway_addr, &tmp_net->A_network_addr, ! &tmp_net->A_netmask); } } --- 314,318 ---- ipc_print_net(&tmp_hna->A_gateway_addr, &tmp_net->A_network_addr, ! tmp_net->prefixlen); } } *************** *** 323,338 **** /* Local HNA entries */ for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { - union hna_netmask hna_msk; - if (olsr_cnf->ip_version == AF_INET) { - union olsr_ip_addr netmask; - //hna_msk.v4 = hna4->netmask.v4; - olsr_prefix_to_netmask(&netmask, hna->net.prefix_len); - hna_msk.v4 = netmask.v4.s_addr; - } else { - hna_msk.v6 = hna->net.prefix_len; - } ipc_print_net(&olsr_cnf->main_addr, &hna->net.prefix, ! &hna_msk); } ipc_send_str("}\n\n"); --- 321,327 ---- /* Local HNA entries */ for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) { ipc_print_net(&olsr_cnf->main_addr, &hna->net.prefix, ! hna->net.prefix_len); } ipc_send_str("}\n\n"); *************** *** 360,375 **** static void ! ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, const union hna_netmask *mask) { struct ipaddr_str gwbuf, netbuf; ! ipc_send_fmt("\"%s\" -> \"%s/%s\"[label=\"HNA\"];\n", olsr_ip_to_string(&gwbuf, gw), olsr_ip_to_string(&netbuf, net), ! olsr_netmask_to_string(mask)); ! ipc_send_fmt("\"%s/%s\"[shape=diamond];\n", olsr_ip_to_string(&netbuf, net), ! olsr_netmask_to_string(mask)); } --- 349,364 ---- static void ! ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, olsr_u8_t prefixlen) { struct ipaddr_str gwbuf, netbuf; ! ipc_send_fmt("\"%s\" -> \"%s/%d\"[label=\"HNA\"];\n", olsr_ip_to_string(&gwbuf, gw), olsr_ip_to_string(&netbuf, net), ! prefixlen); ! ipc_send_fmt("\"%s/%d\"[shape=diamond];\n", olsr_ip_to_string(&netbuf, net), ! prefixlen); } *************** *** 403,422 **** } } - - static char* - olsr_netmask_to_string(const union hna_netmask *mask) - { - char *ret; - struct in_addr in; - - if (olsr_cnf->ip_version == AF_INET) { - in.s_addr = mask->v4; - ret = inet_ntoa(in); - } else { - /* IPv6 */ - static char netmask[5]; - sprintf(netmask, "%d", mask->v6); - ret = netmask; - } - return ret; - } --- 392,393 ---- From (spam-protected) Thu Nov 29 01:49:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:44 +0000 Subject: [Olsr-cvs] olsrd-current/lib/pgraph/src olsrd_pgraph.c,1.10,1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/pgraph/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/pgraph/src Modified Files: olsrd_pgraph.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: olsrd_pgraph.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_pgraph.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** olsrd_pgraph.c 8 Nov 2007 22:47:40 -0000 1.10 --- olsrd_pgraph.c 29 Nov 2007 00:49:42 -0000 1.11 *************** *** 46,49 **** --- 46,50 ---- #include "olsrd_pgraph.h" + #include "ipcalc.h" #include "socket_parser.h" #include "olsrd_plugin.h" *************** *** 141,156 **** static void ipc_action(int); - #if 0 - static struct link_entry *olsr_neighbor_best_link(union olsr_ip_addr *main); - #endif - static void ipc_print_neigh_link(struct neighbor_entry *neighbor); static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry); - #if 0 - static void ipc_print_net(union olsr_ip_addr *, union olsr_ip_addr *, union hna_netmask *); - #endif - static int ipc_send(const char *, int); --- 142,149 ---- *************** *** 391,405 **** } - #if 0 - #define MIN_LINK_QUALITY 0.01 - static double calc_etx(double loss, double neigh_loss) - { - if (loss < MIN_LINK_QUALITY || neigh_loss < MIN_LINK_QUALITY) - return 0.0; - else - return 1.0 / (loss * neigh_loss); - } - #endif - static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry) { --- 384,387 ---- *************** *** 415,446 **** } - #if 0 - static void - ipc_print_net(union olsr_ip_addr *gw, union olsr_ip_addr *net, union hna_netmask *mask) - { - const char *adr; - - adr = olsr_ip_to_string(gw); - ipc_send("\"", 1); - ipc_send(adr, strlen(adr)); - ipc_send("\" -> \"", strlen("\" -> \"")); - adr = olsr_ip_to_string(net); - ipc_send(adr, strlen(adr)); - ipc_send("/", 1); - adr = olsr_netmask_to_string(mask); - ipc_send(adr, strlen(adr)); - ipc_send("\"[label=\"HNA\"];\n", strlen("\"[label=\"HNA\"];\n")); - ipc_send("\"", 1); - adr = olsr_ip_to_string(net); - ipc_send(adr, strlen(adr)); - ipc_send("/", 1); - adr = olsr_netmask_to_string(mask); - ipc_send(adr, strlen(adr)); - ipc_send("\"", 1); - ipc_send("[shape=diamond];\n", strlen("[shape=diamond];\n")); - } - #endif - - static int ipc_send(const char *data, int size) { --- 397,400 ---- *************** *** 463,494 **** return 1; } - - #if 0 - static struct link_entry *olsr_neighbor_best_link(union olsr_ip_addr *main) - { - struct link_entry *walker; - double best = 0.0; - double curr; - struct link_entry *res = NULL; - - // loop through all links - - for (walker = link_set; walker != NULL; walker = walker->next) - { - // check whether it's a link to the requested neighbor and - // whether the link's quality is better than what we have - if(ipequal(main, &walker->neighbor->neighbor_main_addr)) - { - curr = walker->loss_link_quality * walker->neigh_link_quality; - - if (curr >= best) - { - best = curr; - res = walker; - } - } - } - - return res; - } - #endif --- 417,418 ---- From (spam-protected) Thu Nov 29 01:49:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:44 +0000 Subject: [Olsr-cvs] olsrd-current/lib/quagga/src quagga.c,1.11,1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/quagga/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/quagga/src Modified Files: quagga.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: quagga.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/quagga/src/quagga.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** quagga.c 11 Nov 2007 23:10:25 -0000 1.11 --- quagga.c 29 Nov 2007 00:49:42 -0000 1.12 *************** *** 32,36 **** #include "log.h" #include "defs.h" - #include "local_hna_set.h" #include "routing_table.h" --- 32,35 ---- *************** *** 77,81 **** static void zebra_connect (void); - static uint32_t prefixlentomask (uint8_t); static void free_ipv4_route (struct ipv4_route); /* --- 76,79 ---- *************** *** 673,689 **** } - static uint32_t prefixlentomask (uint8_t prefix) { - uint32_t mask = 0; - - if (prefix) { - mask = 0xffffffff<<(32-prefix); - mask = ntohl(mask); - } - - return mask; - } - int add_hna4_route (struct ipv4_route r) { ! union olsr_ip_addr net, mask; #ifdef MY_DEBUG --- 671,676 ---- } int add_hna4_route (struct ipv4_route r) { ! union olsr_ip_addr net; #ifdef MY_DEBUG *************** *** 691,698 **** #endif - mask.v4.s_addr = prefixlentomask(r.prefixlen); net.v4.s_addr = r.prefix; ! add_local_hna4_entry(&net, &mask); free_ipv4_route(r); return 0; --- 678,684 ---- #endif net.v4.s_addr = r.prefix; ! ip_prefix_list_add(&olsr_cnf->hna_entries, &net, r.prefixlen); free_ipv4_route(r); return 0; *************** *** 701,705 **** int delete_hna4_route (struct ipv4_route r) { ! union olsr_ip_addr net, mask; #ifdef MY_DEBUG --- 687,691 ---- int delete_hna4_route (struct ipv4_route r) { ! union olsr_ip_addr net; #ifdef MY_DEBUG *************** *** 707,714 **** #endif - mask.v4.s_addr = prefixlentomask(r.prefixlen); net.v4.s_addr = r.prefix; ! remove_local_hna4_entry(&net, &mask) ? 0 : -1; free_ipv4_route(r); return 0; --- 693,699 ---- #endif net.v4.s_addr = r.prefix; ! ip_prefix_list_remove(&olsr_cnf->hna_entries, &net, r.prefixlen) ? 0 : -1; free_ipv4_route(r); return 0; From (spam-protected) Thu Nov 29 01:49:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:44 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c, 1.16, 1.17 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/txtinfo/src Modified Files: olsrd_txtinfo.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: olsrd_txtinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** olsrd_txtinfo.c 29 Nov 2007 00:10:17 -0000 1.16 --- olsrd_txtinfo.c 29 Nov 2007 00:49:42 -0000 1.17 *************** *** 66,69 **** --- 66,70 ---- #include + #include "ipcalc.h" #include "olsr.h" #include "olsr_types.h" *************** *** 403,407 **** int size; int index; ! struct local_hna_entry *hna; size = 0; --- 404,408 ---- int size; int index; ! struct ip_prefix_list *hna; size = 0; *************** *** 438,456 **** struct hna_net *tmp_net; for (tmp_net = tmp_hna->networks.next; tmp_net != &tmp_hna->networks; tmp_net = tmp_net->next) { ! if (olsr_cnf->ip_version == AF_INET) { ! struct ipaddr_str addrbuf, maskbuf, mainaddrbuf; ! const union olsr_ip_addr netmask = { .v4 = { .s_addr = tmp_net->A_netmask.v4 } }; ! ipc_sendf("%s\t%s\t%s\n", ! olsr_ip_to_string(&addrbuf, &tmp_net->A_network_addr), ! olsr_ip_to_string(&maskbuf, &netmask), ! olsr_ip_to_string(&mainaddrbuf, &tmp_hna->A_gateway_addr)); ! } else { ! struct ipaddr_str addrbuf, mainaddrbuf; ! ipc_sendf("%s\t%d\t%s\n", ! olsr_ip_to_string(&addrbuf, &tmp_net->A_network_addr), ! tmp_net->A_netmask.v6, ! olsr_ip_to_string(&mainaddrbuf, &tmp_hna->A_gateway_addr)); ! } ! } } } --- 439,448 ---- struct hna_net *tmp_net; for (tmp_net = tmp_hna->networks.next; tmp_net != &tmp_hna->networks; tmp_net = tmp_net->next) { ! struct ipaddr_str addrbuf, mainaddrbuf; ! ipc_sendf("%s\t%d\t%s\n", ! olsr_ip_to_string(&addrbuf, &tmp_net->A_network_addr), ! tmp_net->prefixlen, ! olsr_ip_to_string(&mainaddrbuf, &tmp_hna->A_gateway_addr)); ! } } } From (spam-protected) Thu Nov 29 01:49:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:44 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src mapwrite.c, 1.1, 1.2 nameservice.c, 1.39, 1.40 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/nameservice/src Modified Files: mapwrite.c nameservice.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: mapwrite.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/mapwrite.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mapwrite.c 29 Nov 2007 00:26:16 -0000 1.1 --- mapwrite.c 29 Nov 2007 00:49:41 -0000 1.2 *************** *** 44,48 **** #include "mid_set.h" #include "tc_set.h" ! #include "net_olsr.h" #include "mapwrite.h" --- 44,48 ---- #include "mid_set.h" #include "tc_set.h" ! #include "ipcalc.h" #include "mapwrite.h" Index: nameservice.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** nameservice.c 29 Nov 2007 00:26:16 -0000 1.39 --- nameservice.c 29 Nov 2007 00:49:41 -0000 1.40 *************** *** 47,50 **** --- 47,51 ---- #include "olsr.h" + #include "ipcalc.h" #include "net_olsr.h" #include "routing_table.h" *************** *** 1278,1282 **** allowed_ip(const union olsr_ip_addr *addr) { ! struct local_hna_entry *hna; struct interface *iface; union olsr_ip_addr tmp_ip, tmp_msk; --- 1279,1283 ---- allowed_ip(const union olsr_ip_addr *addr) { ! struct ip_prefix_list *hna; struct interface *iface; union olsr_ip_addr tmp_ip, tmp_msk; *************** *** 1431,1435 **** olsr_bool get_isdefhna_latlon(void) { ! struct local_hna_entry *hna; for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next){ if (hna->net.prefix_len == 0) { --- 1432,1436 ---- olsr_bool get_isdefhna_latlon(void) { ! struct ip_prefix_list *hna; for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next){ if (hna->net.prefix_len == 0) { From (spam-protected) Thu Nov 29 01:49:44 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:44 +0000 Subject: [Olsr-cvs] olsrd-current/lib/secure/src olsrd_secure.c,1.30,1.31 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/secure/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/secure/src Modified Files: olsrd_secure.c Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: olsrd_secure.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/olsrd_secure.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** olsrd_secure.c 16 Nov 2007 22:56:54 -0000 1.30 --- olsrd_secure.c 29 Nov 2007 00:49:42 -0000 1.31 *************** *** 55,58 **** --- 55,59 ---- #include "defs.h" + #include "ipcalc.h" #include "olsr.h" #include "socket_parser.h" From (spam-protected) Thu Nov 29 01:49:43 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:43 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src admin_interface.c, 1.12, 1.13 olsrd_httpinfo.c, 1.87, 1.88 admin_html.h, 1.5, NONE Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/httpinfo/src Modified Files: admin_interface.c olsrd_httpinfo.c Removed Files: admin_html.h Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: olsrd_httpinfo.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** olsrd_httpinfo.c 16 Nov 2007 19:12:55 -0000 1.87 --- olsrd_httpinfo.c 29 Nov 2007 00:49:41 -0000 1.88 *************** *** 63,66 **** --- 63,67 ---- #include "link_set.h" #include "socket_parser.h" + #include "ipcalc.h" #include "olsrd_httpinfo.h" *************** *** 233,245 **** static const struct static_bin_file_entry static_bin_files[] = { ! #if 0 ! {"favicon.ico", favicon_ico, 1406/*favicon_ico_len*/}, ! {"logo.gif", logo_gif, 2801/*logo_gif_len*/}, ! {"grayline.gif", grayline_gif, 43/*grayline_gif_len*/}, ! #else ! {"favicon.ico", favicon_ico, sizeof(favicon_ico)}, ! {"logo.gif", logo_gif, sizeof(logo_gif)}, {"grayline.gif", grayline_gif, sizeof(grayline_gif)}, - #endif {NULL, NULL, 0} }; --- 234,240 ---- static const struct static_bin_file_entry static_bin_files[] = { ! {"favicon.ico", favicon_ico, sizeof(favicon_ico)}, ! {"logo.gif", logo_gif, sizeof(logo_gif)}, {"grayline.gif", grayline_gif, sizeof(grayline_gif)}, {NULL, NULL, 0} }; *************** *** 259,288 **** }; - /** - *Do initialization here - * - *This function is called by the my_init - *function in uolsrd_plugin.c - */ - int - olsrd_plugin_init(void) - { - /* Get start time */ - gettimeofday(&start_time, NULL); - - curr_clients = 0; - /* set up HTTP socket */ - http_socket = get_http_socket(http_port != 0 ? http_port : DEFAULT_TCP_PORT); - - if (http_socket < 0) { - fprintf(stderr, "(HTTPINFO) could not initialize HTTP socket\n"); - exit(0); - } - - /* Register socket */ - add_olsr_socket(http_socket, &parse_http_request); - - return 1; - } static int --- 254,257 ---- *************** *** 330,333 **** --- 299,328 ---- } + /** + *Do initialization here + * + *This function is called by the my_init + *function in uolsrd_plugin.c + */ + int + olsrd_plugin_init(void) + { + /* Get start time */ + gettimeofday(&start_time, NULL); + + curr_clients = 0; + /* set up HTTP socket */ + http_socket = get_http_socket(http_port != 0 ? http_port : DEFAULT_TCP_PORT); + + if (http_socket < 0) { + fprintf(stderr, "(HTTPINFO) could not initialize HTTP socket\n"); + exit(0); + } + + /* Register socket */ + add_olsr_socket(http_socket, &parse_http_request); + + return 1; + } /* Non reentrant - but we are not multithreaded anyway */ *************** *** 489,495 **** "\n" "\n" ! "   olsr.org OLSR daemon\n" "\n" ! "\"olsrd\n" "\n" "\n" --- 484,490 ---- "\n" "\n" ! "   olsr.org OLSR daemon\n" "\n" ! "\"olsrd\n" "\n" "\n" *************** *** 653,658 **** olsr_plugin_exit(void) { ! if (http_socket) { ! close(http_socket); } } --- 648,653 ---- olsr_plugin_exit(void) { ! if (http_socket >= 0) { ! CLOSE(http_socket); } } *************** *** 866,884 **** size += snprintf(&buf[size], bufsize-size, "Willingness: %d %s\n", olsr_cnf->willingness, olsr_cnf->willingness_auto ? "(auto)" : ""); - size += snprintf(&buf[size], bufsize-size, "\n\n"); if (olsr_cnf->lq_level == 0) { ! size += snprintf(&buf[size], bufsize-size, "Hysteresis: %s\n", olsr_cnf->use_hysteresis ? "Enabled" : "Disabled"); if (olsr_cnf->use_hysteresis) { size += snprintf(&buf[size], bufsize-size, "Hyst scaling: %0.2f\n", olsr_cnf->hysteresis_param.scaling); size += snprintf(&buf[size], bufsize-size, "Hyst lower/upper: %0.2f/%0.2f\n", olsr_cnf->hysteresis_param.thr_low, olsr_cnf->hysteresis_param.thr_high); } - } else { - size += snprintf(&buf[size], bufsize-size, "\n"); } ! size += snprintf(&buf[size], bufsize-size, "\n\n"); ! ! size += snprintf(&buf[size], bufsize-size, "LQ extension: %s\n", olsr_cnf->lq_level ? "Enabled" : "Disabled"); if (olsr_cnf->lq_level) { size += snprintf(&buf[size], bufsize-size, --- 861,876 ---- size += snprintf(&buf[size], bufsize-size, "Willingness: %d %s\n", olsr_cnf->willingness, olsr_cnf->willingness_auto ? "(auto)" : ""); if (olsr_cnf->lq_level == 0) { ! size += snprintf(&buf[size], bufsize-size, "\n\n" ! "Hysteresis: %s\n", olsr_cnf->use_hysteresis ? "Enabled" : "Disabled"); if (olsr_cnf->use_hysteresis) { size += snprintf(&buf[size], bufsize-size, "Hyst scaling: %0.2f\n", olsr_cnf->hysteresis_param.scaling); size += snprintf(&buf[size], bufsize-size, "Hyst lower/upper: %0.2f/%0.2f\n", olsr_cnf->hysteresis_param.thr_low, olsr_cnf->hysteresis_param.thr_high); } } ! size += snprintf(&buf[size], bufsize-size, "\n\n" ! "LQ extension: %s\n", olsr_cnf->lq_level ? "Enabled" : "Disabled"); if (olsr_cnf->lq_level) { size += snprintf(&buf[size], bufsize-size, *************** *** 958,962 **** size += section_title(&buf[size], bufsize-size, "Announced HNA entries"); if (olsr_cnf->hna_entries) { ! struct local_hna_entry *hna; if (olsr_cnf->ip_version == AF_INET) { size += snprintf(&buf[size], bufsize-size, "NetworkNetmask\n"); --- 950,954 ---- size += section_title(&buf[size], bufsize-size, "Announced HNA entries"); if (olsr_cnf->hna_entries) { ! struct ip_prefix_list *hna; if (olsr_cnf->ip_version == AF_INET) { size += snprintf(&buf[size], bufsize-size, "NetworkNetmask\n"); Index: admin_interface.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/admin_interface.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** admin_interface.c 8 Nov 2007 22:47:40 -0000 1.12 --- admin_interface.c 29 Nov 2007 00:49:41 -0000 1.13 *************** *** 49,56 **** #include "olsrd_httpinfo.h" #include "olsr_cfg.h" - #include "admin_html.h" #include "admin_interface.h" - #include "local_hna_set.h" /* add_local_hna4_entry() */ #include "net_olsr.h" #include --- 49,55 ---- #include "olsrd_httpinfo.h" #include "olsr_cfg.h" #include "admin_interface.h" #include "net_olsr.h" + #include "ipcalc.h" #include *************** *** 63,66 **** --- 62,96 ---- #endif + static const char admin_basic_setting_int[] = "%s\n"; + static const char admin_basic_setting_float[] = "%s\n"; + static const char admin_basic_setting_string[] = "%s\n"; + + static const char admin_frame_prolog[] = + "Administrator interface
\n" + "

Change basic settings

\n" + "
\n" + "\n"; + + static const char admin_frame_mid[] = + "
\n
\n" + "
\n" + "
\n" + "
\n" + "

Add/remove local HNA entries

\n" + "
\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
Network:Netmask/Prefix:

\n" + "
\n" + "\n" + "\n"; + + static const char admin_frame_epilog[] = + "
DeleteNetworkNetmask
\n
\n" + "
\n" + "
\n"; int *************** *** 124,128 **** if(olsr_cnf->hna_entries) { if(olsr_cnf->ip_version == AF_INET) { ! struct local_hna_entry *hna; struct ipaddr_str netbuf, maskbuf; for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { --- 154,158 ---- if(olsr_cnf->hna_entries) { if(olsr_cnf->ip_version == AF_INET) { ! struct ip_prefix_list *hna; struct ipaddr_str netbuf, maskbuf; for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { *************** *** 135,139 **** } } else { ! struct local_hna_entry *hna; for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { struct ipaddr_str netbuf; --- 165,169 ---- } } else { ! struct ip_prefix_list *hna; for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) { struct ipaddr_str netbuf; --- admin_html.h DELETED --- From (spam-protected) Thu Nov 29 01:49:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:42 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c, 1.12, 1.13 olsrd_conf.c, 1.62, 1.63 oparse.y, 1.39, 1.40 oscan.lex, 1.27, 1.28 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/src/cfgparser Modified Files: cfgfile_gen.c olsrd_conf.c oparse.y oscan.lex Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: cfgfile_gen.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/cfgfile_gen.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** cfgfile_gen.c 16 Nov 2007 22:56:54 -0000 1.12 --- cfgfile_gen.c 29 Nov 2007 00:49:40 -0000 1.13 *************** *** 40,43 **** --- 40,46 ---- */ + #include "olsrd_conf.h" + #include "../ipcalc.h" + #include "../net_olsr.h" #include *************** *** 48,64 **** #include - #include "olsrd_conf.h" - #include "net_olsr.h" - int olsrd_write_cnf(struct olsrd_config *cnf, const char *fname) { ! struct local_hna_entry *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; struct plugin_param *pp; ! struct ipc_host *ih = cnf->ipc_hosts; ! struct ipc_net *ie = cnf->ipc_nets; struct olsr_lq_mult *mult; --- 51,63 ---- #include int olsrd_write_cnf(struct olsrd_config *cnf, const char *fname) { ! struct ip_prefix_list *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; struct plugin_param *pp; ! struct ip_prefix_list *ie = cnf->ipc_nets; struct olsr_lq_mult *mult; *************** *** 77,81 **** printf("Writing config to file \"%s\".... ", fname); ! fprintf(fd, "#\n# Configuration file for olsr.org olsrd\n# automatically generated by olsrd-cnf %s\n#\n\n\n", PARSER_VERSION); /* Debug level */ --- 76,80 ---- printf("Writing config to file \"%s\".... ", fname); ! fprintf(fd, "#\n# Configuration file for s%s\n# automatically generated by olsrd-cnf parser v. %s\n#\n\n", olsrd_version, PARSER_VERSION); /* Debug level */ *************** *** 86,100 **** /* HNA IPv4 */ ! fprintf(fd, "# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6); while(h) { ! struct ipaddr_str buf; ! fprintf(fd, " %s ", olsr_ip_to_string(&buf, &h->net.prefix)); ! if (cnf->ip_version == AF_INET) { ! union olsr_ip_addr ip_addr; ! olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); ! fprintf(fd, "%s\n", olsr_ip_to_string(&buf, &ip_addr)); ! } else { ! fprintf(fd, "%d\n", h->net.prefix_len); ! } h = h->next; } --- 85,92 ---- /* HNA IPv4 */ ! fprintf(fd, "# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna1$d {\n", cnf->ip_version == AF_INET ? 4 : 6); while(h) { ! struct ipaddr_str strbuf; ! fprintf(fd, " %s/%d", olsr_ip_to_string(&strbuf, &h->net.prefix), h->net.prefix_len); h = h->next; } *************** *** 114,118 **** /* RtTable */ fprintf(fd, "# Policy Routing Table to use. Default is 254\n\n"); ! fprintf(fd, "RtTable\t%d\n\n", cnf->rttable); /* Willingness */ --- 106,110 ---- /* RtTable */ fprintf(fd, "# Policy Routing Table to use. Default is 254\n\n"); ! fprintf(fd, "RtTable\t\t%d\n\n", cnf->rttable); /* Willingness */ *************** *** 121,140 **** fprintf(fd, "#Willingness\t4\n\n"); else ! fprintf(fd, "Willingness%d\n\n", cnf->willingness); /* IPC */ fprintf(fd, "# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n"); ! fprintf(fd, "IpcConnect\n{\n"); ! fprintf(fd, " MaxConnections %d\n", cnf->ipc_connections); - while(ih) - { - fprintf(fd, " Host %s\n", inet_ntoa(ih->host.v4)); - ih = ih->next; - } while(ie) { ! fprintf(fd, " Net %s ", inet_ntoa(ie->net.v4)); ! fprintf(fd, "%s\n", inet_ntoa(ie->mask.v4)); ie = ie->next; } --- 113,131 ---- fprintf(fd, "#Willingness\t4\n\n"); else ! fprintf(fd, "Willingness\t%d\n\n", cnf->willingness); /* IPC */ fprintf(fd, "# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n"); ! fprintf(fd, "IpcConnect {\n"); ! fprintf(fd, " MaxConnections\t%d\n", cnf->ipc_connections); while(ie) { ! struct ipaddr_str strbuf; ! if (ie->net.prefix_len == olsr_cnf->maxplen) { ! fprintf(fd, " Host\t\t%s\n", olsr_ip_to_string(&strbuf, &ie->net.prefix)); ! } else { ! fprintf(fd, " Net\t\t\t%s/%d\n", olsr_ip_to_string(&strbuf, &ie->net.prefix), ie->net.prefix_len); ! } ie = ie->next; } *************** *** 142,147 **** fprintf(fd, "}\n\n"); - - /* Hysteresis */ fprintf(fd, "# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n"); --- 133,136 ---- *************** *** 199,203 **** while(pe) { ! fprintf(fd, "LoadPlugin \"%s\"\n{\n", pe->name); pp = pe->params; while(pp) --- 188,192 ---- while(pe) { ! fprintf(fd, "LoadPlugin \"%s\" {\n", pe->name); pp = pe->params; while(pp) *************** *** 222,226 **** while(in) { ! fprintf(fd, "Interface \"%s\"\n{\n", in->name); fprintf(fd, "\n"); --- 211,215 ---- while(in) { ! fprintf(fd, "Interface \"%s\" {\n", in->name); fprintf(fd, "\n"); *************** *** 230,234 **** if(in->cnf->ipv4_broadcast.v4.s_addr) { ! fprintf(fd, " Ip4Broadcast\t %s\n\n", inet_ntoa(in->cnf->ipv4_broadcast.v4)); } else --- 219,223 ---- if(in->cnf->ipv4_broadcast.v4.s_addr) { ! fprintf(fd, " Ip4Broadcast\t%s\n\n", inet_ntoa(in->cnf->ipv4_broadcast.v4)); } else *************** *** 357,366 **** olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize) { ! struct local_hna_entry *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; struct plugin_param *pp; ! struct ipc_host *ih = cnf->ipc_hosts; ! struct ipc_net *ie = cnf->ipc_nets; struct olsr_lq_mult *mult; --- 346,354 ---- olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize) { ! struct ip_prefix_list *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; struct plugin_param *pp; ! struct ip_prefix_list *ie = cnf->ipc_nets; struct olsr_lq_mult *mult; *************** *** 385,389 **** /* HNA IPv4 and IPv6 */ ! WRITE_TO_BUF("# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna%1$d\n{\n", cnf->ip_version == AF_INET ? 4 : 6); while(h) { struct ipaddr_str strbuf; --- 373,377 ---- /* HNA IPv4 and IPv6 */ ! WRITE_TO_BUF("# HNA IPv%1$d routes\n# syntax: netaddr netmask\n\nHna%1$d {\n", cnf->ip_version == AF_INET ? 4 : 6); while(h) { struct ipaddr_str strbuf; *************** *** 413,417 **** /* RtTable */ WRITE_TO_BUF("# Policy Routing Tableto use. Default is 254\n\n"); ! WRITE_TO_BUF("RtTable\t%d\n\n", cnf->rttable); /* Willingness */ --- 401,405 ---- /* RtTable */ WRITE_TO_BUF("# Policy Routing Tableto use. Default is 254\n\n"); ! WRITE_TO_BUF("RtTable\t\t%d\n\n", cnf->rttable); /* Willingness */ *************** *** 420,439 **** WRITE_TO_BUF("#Willingness\t4\n\n"); else ! WRITE_TO_BUF("Willingness%d\n\n", cnf->willingness); /* IPC */ WRITE_TO_BUF("# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n"); ! WRITE_TO_BUF("IpcConnect\n{\n"); ! WRITE_TO_BUF(" MaxConnections %d\n", cnf->ipc_connections); ! ! while(ih) ! { ! WRITE_TO_BUF(" Host %s\n", inet_ntoa(ih->host.v4)); ! ih = ih->next; ! } while(ie) { ! WRITE_TO_BUF(" Net %s ", inet_ntoa(ie->net.v4)); ! WRITE_TO_BUF("%s\n", inet_ntoa(ie->mask.v4)); ie = ie->next; } --- 408,425 ---- WRITE_TO_BUF("#Willingness\t4\n\n"); else ! WRITE_TO_BUF("Willingness\t%d\n\n", cnf->willingness); /* IPC */ WRITE_TO_BUF("# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n"); ! WRITE_TO_BUF("IpcConnect {\n"); ! WRITE_TO_BUF(" MaxConnections\t%d\n", cnf->ipc_connections); while(ie) { ! struct ipaddr_str strbuf; ! if (ie->net.prefix_len == olsr_cnf->maxplen) { ! WRITE_TO_BUF(" Host\t\t%s\n", olsr_ip_to_string(&strbuf, &ie->net.prefix)); ! } else { ! WRITE_TO_BUF(" Net\t\t\t%s/%d\n", olsr_ip_to_string(&strbuf, &ie->net.prefix), ie->net.prefix_len); ! } ie = ie->next; } *************** *** 492,496 **** while(pe) { ! WRITE_TO_BUF("LoadPlugin \"%s\"\n{\n", pe->name); pp = pe->params; while(pp) --- 478,482 ---- while(pe) { ! WRITE_TO_BUF("LoadPlugin \"%s\" {\n", pe->name); pp = pe->params; while(pp) *************** *** 517,521 **** while(in) { ! WRITE_TO_BUF("Interface \"%s\"\n{\n", in->name); if(first) --- 503,507 ---- while(in) { ! WRITE_TO_BUF("Interface \"%s\" {\n", in->name); if(first) *************** *** 525,529 **** if(in->cnf->ipv4_broadcast.v4.s_addr) { ! WRITE_TO_BUF(" Ip4Broadcast\t %s\n", inet_ntoa(in->cnf->ipv4_broadcast.v4)); } else --- 511,515 ---- if(in->cnf->ipv4_broadcast.v4.s_addr) { ! WRITE_TO_BUF(" Ip4Broadcast\t%s\n", inet_ntoa(in->cnf->ipv4_broadcast.v4)); } else Index: oscan.lex =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oscan.lex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** oscan.lex 10 Oct 2007 20:44:34 -0000 1.27 --- oscan.lex 29 Nov 2007 00:49:40 -0000 1.28 *************** *** 165,168 **** --- 165,173 ---- } + \/ { + yylval = NULL; + return TOK_SLASH; + } + \{ { yylval = NULL; *************** *** 200,204 **** return TOK_IP4_ADDR; } - {IPV6ADDR} { yylval = get_string_token(yytext, yyleng + 1); --- 205,208 ---- Index: olsrd_conf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.c,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** olsrd_conf.c 22 Nov 2007 11:43:36 -0000 1.62 --- olsrd_conf.c 29 Nov 2007 00:49:40 -0000 1.63 *************** *** 41,44 **** --- 41,51 ---- + #include "olsrd_conf.h" + #include "ipcalc.h" + #include "olsr_cfg.h" + #include "defs.h" + #include "net_olsr.h" + #include "olsr.h" + #include #include *************** *** 50,58 **** #include - #include "olsrd_conf.h" - #include "olsr_cfg.h" - #include "defs.h" - #include "net_olsr.h" - extern FILE *yyin; --- 57,60 ---- *************** *** 362,366 **** olsrd_free_cnf(struct olsrd_config *cnf) { ! struct local_hna_entry *hd, *h = cnf->hna_entries; struct olsr_if *ind, *in = cnf->interfaces; struct plugin_entry *ped, *pe = cnf->plugins; --- 364,368 ---- olsrd_free_cnf(struct olsrd_config *cnf) { ! struct ip_prefix_list *hd, *h = cnf->hna_entries; struct olsr_if *ind, *in = cnf->interfaces; struct plugin_entry *ped, *pe = cnf->plugins; *************** *** 517,525 **** olsrd_print_cnf(struct olsrd_config *cnf) { ! struct local_hna_entry *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; ! struct ipc_host *ih = cnf->ipc_hosts; ! struct ipc_net *ie = cnf->ipc_nets; struct olsr_lq_mult *mult; char ipv6_buf[100]; /* buffer for IPv6 inet_htop */ --- 519,526 ---- olsrd_print_cnf(struct olsrd_config *cnf) { ! struct ip_prefix_list *h = cnf->hna_entries; struct olsr_if *in = cnf->interfaces; struct plugin_entry *pe = cnf->plugins; ! struct ip_prefix_list *ie = cnf->ipc_nets; struct olsr_lq_mult *mult; char ipv6_buf[100]; /* buffer for IPv6 inet_htop */ *************** *** 544,558 **** printf("IPC connections : %d\n", cnf->ipc_connections); - - while(ih) - { - printf("\tHost %s\n", inet_ntoa(ih->host.v4)); - ih = ih->next; - } - while(ie) { ! printf("\tNet %s/", inet_ntoa(ie->net.v4)); ! printf("%s\n", inet_ntoa(ie->mask.v4)); ie = ie->next; } --- 545,556 ---- printf("IPC connections : %d\n", cnf->ipc_connections); while(ie) { ! struct ipaddr_str strbuf; ! if (ie->net.prefix_len == olsr_cnf->maxplen) { ! printf("\tHost %s\n", olsr_ip_to_string(&strbuf, &ie->net.prefix)); ! } else { ! printf("\tNet %s/%d\n", olsr_ip_to_string(&strbuf, &ie->net.prefix), ie->net.prefix_len); ! } ie = ie->next; } *************** *** 641,668 **** } - #if 0 - /* HNA IPv4 */ - if(h4) - { - - printf("HNA4 entries:\n"); - while(h4) - { - printf("\t%s/", inet_ntoa(h4->net.v4)); - printf("%s\n", inet_ntoa(h4->netmask.v4)); - h4 = h4->next; - } - } - - /* HNA IPv6 */ - if(h6) - { - printf("HNA6 entries:\n"); - while(h6) - { - printf("\t%s/%d\n", inet_ntop(AF_INET6, &h6->net.v6, ipv6_buf, sizeof(ipv6_buf)), h6->prefix_len); - h6 = h6->next; - } - #else /* HNA IPv4 and IPv6 */ if(h) { --- 639,642 ---- *************** *** 679,683 **** } h = h->next; - #endif } } --- 653,656 ---- *************** *** 716,717 **** --- 689,740 ---- } #endif + + void ip_prefix_list_add(struct ip_prefix_list **list, + const union olsr_ip_addr *net, + olsr_u8_t prefix_len) + { + struct ip_prefix_list *new_entry = olsr_malloc(sizeof(*new_entry), "Add local HNA entry"); + + new_entry->net.prefix = *net; + new_entry->net.prefix_len = prefix_len; + + /* Queue */ + new_entry->next = *list; + *list = new_entry; + } + + int ip_prefix_list_remove(struct ip_prefix_list **list, + const union olsr_ip_addr *net, + olsr_u8_t prefix_len) + { + struct ip_prefix_list *h = *list, *prev = NULL; + + while (h != NULL) { + if (ipequal(net, &h->net.prefix) && h->net.prefix_len == prefix_len) { + /* Dequeue */ + if (prev == NULL) { + *list = h->next; + } else { + prev->next = h->next; + } + free(h); + return 1; + } + prev = h; + h = h->next; + } + return 0; + } + + struct ip_prefix_list *ip_prefix_list_find(struct ip_prefix_list *list, + const union olsr_ip_addr *net, + olsr_u8_t prefix_len) + { + struct ip_prefix_list *h; + for (h = list; h != NULL; h = h->next) { + if (prefix_len == h->net.prefix_len && ipequal(net, &h->net.prefix)) { + return h; + } + } + return NULL; + } Index: oparse.y =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** oparse.y 22 Nov 2007 11:43:36 -0000 1.39 --- oparse.y 29 Nov 2007 00:49:40 -0000 1.40 *************** *** 43,46 **** --- 43,51 ---- + #include "olsrd_conf.h" + #include "../defs.h" + #include "../ipcalc.h" + #include "../net_olsr.h" + #include #include *************** *** 52,59 **** #include - #include "olsrd_conf.h" - #include "../defs.h" - #include "../net_olsr.h" - #define PARSER_DEBUG 0 --- 57,60 ---- *************** *** 72,75 **** --- 73,77 ---- static int lq_mult_helper(YYSTYPE ip_addr_arg, YYSTYPE mult_arg); + static int add_ipv6_addr(YYSTYPE ipaddr_arg, YYSTYPE prefixlen_arg); static int lq_mult_helper(YYSTYPE ip_addr_arg, YYSTYPE mult_arg) *************** *** 88,92 **** if (ip_addr_arg != NULL && ! inet_pton(olsr_cnf->ip_version, ip_addr_arg->string, &addr) < 0) { fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string); return -1; --- 90,94 ---- if (ip_addr_arg != NULL && ! inet_pton(olsr_cnf->ip_version, ip_addr_arg->string, &addr) <= 0) { fprintf(stderr, "Cannot parse IP address %s.\n", ip_addr_arg->string); return -1; *************** *** 120,125 **** --- 122,154 ---- return 0; } + + static int add_ipv6_addr(YYSTYPE ipaddr_arg, YYSTYPE prefixlen_arg) + { + union olsr_ip_addr ipaddr; + PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", ipaddr_arg->string, prefixlen_arg->integer); + + if(inet_pton(AF_INET6, ipaddr_arg->string, &ipaddr) <= 0) { + fprintf(stderr, "ihna6entry: Failed converting IP address %s\n", ipaddr_arg->string); + return 1; + } + + if (prefixlen_arg->integer > 128) { + fprintf(stderr, "ihna6entry: Illegal IPv6 prefix length %d\n", prefixlen_arg->integer); + return 1; + } + + /* Queue */ + ip_prefix_list_add(&olsr_cnf->hna_entries, &ipaddr, prefixlen_arg->integer); + + free(ipaddr_arg->string); + free(ipaddr_arg); + free(prefixlen_arg); + + return 0; + } + %} + %token TOK_SLASH %token TOK_OPEN %token TOK_CLOSE *************** *** 302,321 **** ipchost: TOK_HOSTLABEL TOK_IP4_ADDR { ! struct ipc_host *ipch = malloc(sizeof(struct ipc_host)); ! PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string); ! if (inet_aton($2->string, &ipch->host.v4) == 0) { fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string); ! free(ipch); ! return -1; } ! ipch->next = olsr_cnf->ipc_hosts; ! olsr_cnf->ipc_hosts = ipch; free($2->string); free($2); - } ; --- 331,346 ---- ipchost: TOK_HOSTLABEL TOK_IP4_ADDR { ! union olsr_ip_addr ipaddr; PARSER_DEBUG_PRINTF("\tIPC host: %s\n", $2->string); ! if (inet_aton($2->string, &ipaddr.v4) == 0) { fprintf(stderr, "Failed converting IP address IPC %s\n", $2->string); ! YYABORT; } ! ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_cnf->maxplen); free($2->string); free($2); } ; *************** *** 323,343 **** ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR { ! struct ipc_net *ipcn = malloc(sizeof(struct ipc_net)); PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string); ! if (inet_aton($2->string, &ipcn->net.v4) == 0) { fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string); ! free(ipcn); ! return -1; } ! if (inet_aton($3->string, &ipcn->mask.v4) == 0) { fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string); ! free(ipcn); ! return -1; } ! ipcn->next = olsr_cnf->ipc_nets; ! olsr_cnf->ipc_nets = ipcn; free($2->string); --- 348,366 ---- ipcnet: TOK_NETLABEL TOK_IP4_ADDR TOK_IP4_ADDR { ! union olsr_ip_addr ipaddr, netmask; ! PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string); ! if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) { fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string); ! YYABORT; } ! if (inet_pton(AF_INET, $3->string, &netmask.v4) == 0) { fprintf(stderr, "Failed converting IP mask IPC %s\n", $3->string); ! YYABORT; } ! ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, olsr_netmask_to_prefix(&netmask)); free($2->string); *************** *** 345,349 **** --- 368,393 ---- free($3->string); free($3); + } + | TOK_NETLABEL TOK_IP4_ADDR TOK_SLASH TOK_INTEGER + { + union olsr_ip_addr ipaddr; + + PARSER_DEBUG_PRINTF("\tIPC net: %s/%s\n", $2->string, $3->string); + + if (inet_pton(AF_INET, $2->string, &ipaddr.v4) == 0) { + fprintf(stderr, "Failed converting IP net IPC %s\n", $2->string); + YYABORT; + } + if ($4->integer > olsr_cnf->maxplen) { + fprintf(stderr, "ipcnet: Prefix len %u > %d is not allowed!\n", $4->integer, olsr_cnf->maxplen); + YYABORT; + } + + ip_prefix_list_add(&olsr_cnf->ipc_nets, &ipaddr, $4->integer); + + free($2->string); + free($2); + free($4); } ; *************** *** 378,382 **** if (inet_aton($2->string, &in) == 0) { fprintf(stderr, "isetip4br: Failed converting IP address %s\n", $2->string); ! return -1; } --- 422,426 ---- if (inet_aton($2->string, &in) == 0) { fprintf(stderr, "isetip4br: Failed converting IP address %s\n", $2->string); ! YYABORT; } *************** *** 426,432 **** PARSER_DEBUG_PRINTF("\tIPv6 site-local multicast: %s\n", $2->string); ! if (inet_pton(AF_INET6, $2->string, &in6) < 0) { fprintf(stderr, "isetip6mults: Failed converting IP address %s\n", $2->string); ! return -1; } --- 470,476 ---- PARSER_DEBUG_PRINTF("\tIPv6 site-local multicast: %s\n", $2->string); ! if (inet_pton(AF_INET6, $2->string, &in6) <= 0) { fprintf(stderr, "isetip6mults: Failed converting IP address %s\n", $2->string); ! YYABORT; } *************** *** 452,458 **** PARSER_DEBUG_PRINTF("\tIPv6 global multicast: %s\n", $2->string); ! if (inet_pton(AF_INET6, $2->string, &in6) < 0) { fprintf(stderr, "isetip6multg: Failed converting IP address %s\n", $2->string); ! return -1; } --- 496,502 ---- PARSER_DEBUG_PRINTF("\tIPv6 global multicast: %s\n", $2->string); ! if (inet_pton(AF_INET6, $2->string, &in6) <= 0) { fprintf(stderr, "isetip6multg: Failed converting IP address %s\n", $2->string); ! YYABORT; } *************** *** 668,700 **** ; - ihna4entry: TOK_IP4_ADDR TOK_IP4_ADDR { ! struct local_hna_entry *h = malloc(sizeof(*h)); ! union olsr_ip_addr netmask; PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string); ! if (h == NULL) { ! fprintf(stderr, "Out of memory(HNA4)\n"); YYABORT; } ! ! if (inet_aton($1->string, &h->net.prefix.v4) == 0) { fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); ! free(h); ! return -1; } ! if (inet_aton($2->string, &netmask.v4) == 0) { ! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); ! free(h); ! return -1; } - h->net.prefix_len = olsr_netmask_to_prefix(&netmask); - h->net.prefix.v4.s_addr &= netmask.v4.s_addr; /* Queue */ ! h->next = olsr_cnf->hna_entries; ! olsr_cnf->hna_entries = h; free($1->string); --- 712,738 ---- ; ihna4entry: TOK_IP4_ADDR TOK_IP4_ADDR { ! union olsr_ip_addr ipaddr, netmask; PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string); ! if (inet_pton(AF_INET, $1->string, &ipaddr.v4) <= 0) { ! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); YYABORT; } ! if (inet_pton(AF_INET, $2->string, &netmask.v4) <= 0) { fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); ! YYABORT; } ! ! /* check that the given IP address is actually a network address */ ! if ((ipaddr.v4.s_addr & ~netmask.v4.s_addr) != 0) { ! fprintf(stderr, "ihna4entry: The ipaddress \"%s\" is not a network address!\n", $1->string); ! YYABORT; } /* Queue */ ! ip_prefix_list_add(&olsr_cnf->hna_entries, &ipaddr, olsr_netmask_to_prefix(&netmask)); free($1->string); *************** *** 702,742 **** free($2->string); free($2); - } ! ; ! ! ihna6entry: TOK_IP6_ADDR TOK_INTEGER { ! struct local_hna_entry *h = malloc(sizeof(*h)); ! PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", $1->string, $2->integer); ! if (h == NULL) { ! fprintf(stderr, "Out of memory(HNA6)\n"); YYABORT; } ! ! if(inet_pton(AF_INET6, $1->string, &h->net.prefix.v6) < 0) ! { ! fprintf(stderr, "ihna6entry: Failed converting IP address %s\n", $1->string); ! return -1; ! } ! ! if ($2->integer > 128) { ! fprintf(stderr, "ihna6entry: Illegal IPv6 prefix length %d\n", $2->integer); ! free(h); ! return -1; } ! h->net.prefix_len = $2->integer; /* Queue */ ! h->next = olsr_cnf->hna_entries; ! olsr_cnf->hna_entries = h; free($1->string); free($1); ! free($2); } ; --- 740,786 ---- free($2->string); free($2); } ! | TOK_IP4_ADDR TOK_SLASH TOK_INTEGER { ! union olsr_ip_addr ipaddr, netmask; ! PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%d\n", $1->string, $3->integer); ! if (inet_pton(AF_INET, $1->string, &ipaddr.v4) <= 0) { ! fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string); YYABORT; } ! if ($3->integer > olsr_cnf->maxplen) { ! fprintf(stderr, "ihna4entry: Prefix len %u > %d is not allowed!\n", $3->integer, olsr_cnf->maxplen); ! YYABORT; } ! /* check that the given IP address is actually a network address */ ! olsr_prefix_to_netmask(&netmask, $3->integer); ! if ((ipaddr.v4.s_addr & ~netmask.v4.s_addr) != 0) { ! fprintf(stderr, "ihna4entry: The ipaddress \"%s\" is not a network address!\n", $1->string); ! YYABORT; ! } /* Queue */ ! ip_prefix_list_add(&olsr_cnf->hna_entries, &ipaddr, $3->integer); free($1->string); free($1); ! free($3); ! } ! ; + ihna6entry: TOK_IP6_ADDR TOK_INTEGER + { + if (add_ipv6_addr($1, $2)) { + YYABORT; + } + } + | TOK_IP6_ADDR TOK_SLASH TOK_INTEGER + { + if (add_ipv6_addr($1, $3)) { + YYABORT; + } } ; From (spam-protected) Thu Nov 29 01:50:41 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:50:41 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.118,1.119 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18203 Modified Files: CHANGELOG Log Message: * and some blurb for the changelog Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** CHANGELOG 29 Nov 2007 00:07:36 -0000 1.118 --- CHANGELOG 29 Nov 2007 00:50:38 -0000 1.119 *************** *** 16,19 **** --- 16,27 ---- - fixed compile errors in the BSD port + PATCHES by Sven-Ola Tuecke : + - 102-olsrd-cvs-fixes.patch: use different buffers in the same printf() + - 103-olsrd-rt-exportroute-cleanup.patch: avoid a malloc()ed list of functions + - 132-save-the-fish.patch: really save the fish and avoid to forward invalid + messages from older olsrd versions + - 138-olsrd-fixdotdraw.patch: fix the dot_draw plugin + (all to be found on http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/) + PATCHES and CLEANUPS by Bernd Petrovitsch - Jens Nachtigall suggested (and reminded) to use *************** *** 139,142 **** --- 147,153 ---- is superflous now (and replaced by ip4cmp) and use the global MIN and MAX macro instead of AVLMIN and AVLMAX + - killed netmasks from the IPv4 part of the code and use the prefixlen there + (similar to thte IPv6 part). Manymore details on + http://lists.olsr.org/pipermail/olsr-dev/2007-November/001464.html 0.5.4 --------------------------------------------------------------------- From (spam-protected) Thu Nov 29 02:29:55 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 01:29:55 +0000 Subject: [Olsr-cvs] olsrd-current/src hna_set.c,1.26,1.27 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1146/src Modified Files: hna_set.c Log Message: * fixed debug output Index: hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** hna_set.c 29 Nov 2007 00:49:38 -0000 1.26 --- hna_set.c 29 Nov 2007 01:29:53 -0000 1.27 *************** *** 329,336 **** struct ipaddr_str buf; #endif - struct in_addr a; OLSR_PRINTF(1, "%-15s ", olsr_ip_to_string(&buf, &tmp_net->A_network_addr)); ! a.s_addr = tmp_net->A_netmask.v4; /* Ugly! */ ! OLSR_PRINTF(1, "%-15s ", ip4_to_string(&buf, a)); OLSR_PRINTF(1, "%-15s\n", olsr_ip_to_string(&buf, &tmp_hna->A_gateway_addr)); } --- 329,334 ---- struct ipaddr_str buf; #endif OLSR_PRINTF(1, "%-15s ", olsr_ip_to_string(&buf, &tmp_net->A_network_addr)); ! OLSR_PRINTF(1, "%-15d ", tmp_net->prefix_len); OLSR_PRINTF(1, "%-15s\n", olsr_ip_to_string(&buf, &tmp_hna->A_gateway_addr)); } From (spam-protected) Thu Nov 29 02:38:38 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 01:38:38 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src admin_interface.c, 1.13, 1.14 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3323/lib/httpinfo/src Modified Files: admin_interface.c Log Message: * fixed another corner Index: admin_interface.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/admin_interface.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** admin_interface.c 29 Nov 2007 00:49:41 -0000 1.13 --- admin_interface.c 29 Nov 2007 01:38:36 -0000 1.14 *************** *** 185,189 **** process_param(char *key, char *value) { ! static olsr_u32_t curr_hna_net; static olsr_bool curr_hna_ok = OLSR_FALSE; --- 185,189 ---- process_param(char *key, char *value) { ! static union olsr_ip_addr curr_hna_net; static olsr_bool curr_hna_ok = OLSR_FALSE; *************** *** 307,313 **** if(!strcmp(key, "hna_new_net")) { ! struct in_addr in; ! ! if(inet_aton(value, &in) == 0) { fprintf(stderr, "Failed converting new HNA net %s\n", value); --- 307,311 ---- if(!strcmp(key, "hna_new_net")) { ! if(inet_pton(olsr_cnf->ipsize, value, &curr_hna_net.v4) == 0) { fprintf(stderr, "Failed converting new HNA net %s\n", value); *************** *** 315,319 **** } curr_hna_ok = OLSR_TRUE; - curr_hna_net = in.s_addr; return 1; } --- 313,316 ---- *************** *** 322,325 **** --- 319,323 ---- { struct in_addr in; + olsr_u8_t prefixlen; if(!curr_hna_ok) *************** *** 328,339 **** curr_hna_ok = OLSR_FALSE; ! if(inet_aton(value, &in) == 0) ! { ! fprintf(stderr, "Failed converting new HNA netmask %s\n", value); ! return -1; ! } ! add_local_hna4_entry((union olsr_ip_addr *)&curr_hna_net, ! (union olsr_ip_addr *)&in.s_addr); ! return 1; } --- 326,339 ---- curr_hna_ok = OLSR_FALSE; ! if(inet_aton(value, &in) == 0) { ! fprintf(stderr, "Failed converting new HNA netmask %s\n", value); ! return -1; ! } ! prefixlen = netmask_to_prefix((olsr_u8_t *)&in, olsr_cnf->ipsize); ! if(prefixlen == UCHAR_MAX) { ! fprintf(stderr, "Failed converting new HNA netmask %s\n", value); ! return -1; ! } ! ip_prefix_list_add(&olsr_cnf->hna_entries, &curr_hna_net, prefixlen); return 1; } *************** *** 344,351 **** char ip_net[16], ip_mask[16]; int seperator = 0; ! while(key[7 + seperator] != '*') seperator++; ! strncpy(ip_net, &key[7], seperator); ip_net[seperator] = 0; --- 344,352 ---- char ip_net[16], ip_mask[16]; int seperator = 0; + olsr_u8_t prefixlen; ! while(key[7 + seperator] != '*') { seperator++; ! } strncpy(ip_net, &key[7], seperator); ip_net[seperator] = 0; *************** *** 359,371 **** } ! if(inet_aton(ip_mask, &mask) == 0) ! { ! fprintf(stderr, "Failed converting HNA netmask %s for deletion\n", ip_mask); ! return -1; ! } ! ! remove_local_hna4_entry((union olsr_ip_addr *)&net.s_addr, ! (union olsr_ip_addr *)&mask.s_addr); ! return 1; } --- 360,373 ---- } ! if(inet_aton(ip_mask, &mask) == 0) { ! fprintf(stderr, "Failed converting HNA netmask %s for deletion\n", ip_mask); ! return -1; ! } ! prefixlen = netmask_to_prefix((olsr_u8_t *)&mask, olsr_cnf->ipsize); ! if(prefixlen == UCHAR_MAX) { ! fprintf(stderr, "Failed converting new HNA netmask %s\n", value); ! return -1; ! } ! ip_prefix_list_add(&olsr_cnf->hna_entries, &curr_hna_net, prefixlen); return 1; } From (spam-protected) Thu Nov 29 01:49:42 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 00:49:42 +0000 Subject: [Olsr-cvs] olsrd-current/src ipcalc.c, NONE, 1.1 ipcalc.h, NONE, 1.1 build_msg.c, 1.39, 1.40 duplicate_set.c, 1.19, 1.20 hna_set.c, 1.25, 1.26 hna_set.h, 1.16, 1.17 hysteresis.c, 1.22, 1.23 interfaces.c, 1.37, 1.38 ipc_frontend.c, 1.40, 1.41 link_set.c, 1.77, 1.78 lq_avl.c, 1.17, 1.18 lq_packet.c, 1.32, 1.33 lq_route.c, 1.60, 1.61 main.c, 1.105, 1.106 mid_set.c, 1.24, 1.25 mpr.c, 1.20, 1.21 mpr_selector_set.c, 1.20, 1.21 neighbor_table.c, 1.35, 1.36 net_olsr.c, 1.36, 1.37 net_olsr.h, 1.18, 1.19 olsr_cfg.h, 1.39, 1.40 olsr_types.h, 1.12, 1.13 packet.c, 1.26, 1.27 packet.h, 1.18, 1.19 parser.c, 1.37, 1.38 print_packet.c, 1.13, 1.14 process_package.c, 1.46, 1.47 process_routes.c, 1.40, 1.41 rebuild_packet.c, 1.25, 1.26 routing_table.c, 1.35, 1.36 tc_set.c, 1.37, 1.38 two_hop_neighbor_table.c, 1.20, 1.21 local_hna_set.c, 1.16, NONE local_hna_set.h, 1.12, NONE Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/src Modified Files: build_msg.c duplicate_set.c hna_set.c hna_set.h hysteresis.c interfaces.c ipc_frontend.c link_set.c lq_avl.c lq_packet.c lq_route.c main.c mid_set.c mpr.c mpr_selector_set.c neighbor_table.c net_olsr.c net_olsr.h olsr_cfg.h olsr_types.h packet.c packet.h parser.c print_packet.c process_package.c process_routes.c rebuild_packet.c routing_table.c tc_set.c two_hop_neighbor_table.c Added Files: ipcalc.c ipcalc.h Removed Files: local_hna_set.c local_hna_set.h Log Message: Major Changes: - renamed "struct local_hna_entry" to "struct ip_prefix_list" since it is exactly that. Renamed the functions in src/local_hna_set.{c,h} in the same way. - each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is called from the same place and have the same signature. So I condensed each of them. - Since we have only 3 functions left in src/local_hna_set.{c,h} and they are used for the configuration, the .h file is now part of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c. - replaced "struct ipc_net" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" - replaced "struct ipc_host" with "struct ip_prefix_list" since it serves the same purpose as the "struct ip_prefix_list" and is just a special case. No need to duplicate code etc. - removed "union hna_netmask" from src/olsr_types since we use the prefix_len everywhere (and that is an olsr_u8_t in several other struct's). That implies changes and simplifications in the code handling them (since the IPv4 is similar to IPv6). - the config file parser now understands for IPv4 addresses also "/$prefix". - On the output side, the patch generates only "/$prefix" which kills code since it is the same as the IPv6 handling. - There are some netmask conversions left (mainly in the plugins) but that be cleaned up afterwards. - extracted ip{,4,6}{cmp,equal} and formatting functions from net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became IMHO to much of a "put anything in there". - renamed "sockaddr_to_string()" to "sockaddr4_to_string()" since it is exactly that (unless I'm missing something). Minor Changes: - lib/httpinfo/src/admin_html.h contained just some variable definitions so it is now integrated in the only user: admin_interface.c - olsrd_dot_draw.c got rid of two indicator variables if a socket is valid or not. Since sockets may use "-1" as the "not open", "invalid" value, there is no need for two more ints. - and the dot_draw plugin is somewhat smaller and easier to read. - const'ified some functions Index: hna_set.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** hna_set.h 21 Oct 2007 20:37:58 -0000 1.16 --- hna_set.h 29 Nov 2007 00:49:38 -0000 1.17 *************** *** 47,50 **** --- 47,52 ---- #include "olsr_types.h" + #include + /* hna_netmask declared in packet.h */ *************** *** 52,56 **** { union olsr_ip_addr A_network_addr; ! union hna_netmask A_netmask; clock_t A_time; struct hna_net *next; --- 54,58 ---- { union olsr_ip_addr A_network_addr; ! olsr_u8_t prefixlen; clock_t A_time; struct hna_net *next; *************** *** 73,81 **** olsr_init_hna_set(void); - int - olsr_get_hna_prefix_len(const struct hna_net *); - struct hna_net * ! olsr_lookup_hna_net(const struct hna_net *, const union olsr_ip_addr *, const union hna_netmask *); struct hna_entry * --- 75,80 ---- olsr_init_hna_set(void); struct hna_net * ! olsr_lookup_hna_net(const struct hna_net *, const union olsr_ip_addr *, olsr_u8_t); struct hna_entry * *************** *** 86,93 **** struct hna_net * ! olsr_add_hna_net(struct hna_entry *, const union olsr_ip_addr *, const union hna_netmask *); void ! olsr_update_hna_entry(const union olsr_ip_addr *, const union olsr_ip_addr *, const union hna_netmask *, const float); void --- 85,92 ---- struct hna_net * ! olsr_add_hna_net(struct hna_entry *, const union olsr_ip_addr *, olsr_u8_t); void ! olsr_update_hna_entry(const union olsr_ip_addr *, const union olsr_ip_addr *, olsr_u8_t, const float); void Index: rebuild_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** rebuild_packet.c 16 Nov 2007 22:56:54 -0000 1.25 --- rebuild_packet.c 29 Nov 2007 00:49:39 -0000 1.26 *************** *** 42,45 **** --- 42,46 ---- #include "rebuild_packet.h" + #include "ipcalc.h" #include "defs.h" #include "olsr.h" *************** *** 94,99 **** hna_pairs = NULL; ! for(i = 0; i < no_pairs; i++) ! { hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct"); --- 95,99 ---- hna_pairs = NULL; ! for(i = 0; i < no_pairs; i++) { hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct"); *************** *** 101,108 **** hna_pairs->net.v4.s_addr = haddr->addr; //COPY_IP(&hna_pairs->netmask, &haddr->netmask); ! hna_pairs->netmask.v4 = haddr->netmask; ! hna_pairs->next = tmp_pairs; ! tmp_pairs = hna_pairs; haddr++; --- 101,107 ---- hna_pairs->net.v4.s_addr = haddr->addr; //COPY_IP(&hna_pairs->netmask, &haddr->netmask); ! hna_pairs->prefixlen = olsr_netmask4_to_prefix(&haddr->netmask); ! hna_pairs->next = tmp_pairs; tmp_pairs = hna_pairs; haddr++; *************** *** 139,143 **** //COPY_IP(&hna_pairs->net, &haddr6->addr); hna_pairs->net.v6 = haddr6->addr; ! hna_pairs->netmask.v6 = olsr_netmask_to_prefix((const union olsr_ip_addr *)&haddr6->netmask); hna_pairs->next = tmp_pairs; --- 138,142 ---- //COPY_IP(&hna_pairs->net, &haddr6->addr); hna_pairs->net.v6 = haddr6->addr; ! hna_pairs->prefixlen = olsr_netmask6_to_prefix(&haddr6->netmask); hna_pairs->next = tmp_pairs; Index: hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** hna_set.c 16 Nov 2007 22:56:54 -0000 1.25 --- hna_set.c 29 Nov 2007 00:49:38 -0000 1.26 *************** *** 40,43 **** --- 40,44 ---- */ + #include "ipcalc.h" #include "defs.h" #include "olsr.h" *************** *** 47,52 **** struct hna_entry hna_set[HASHSIZE]; - static size_t netmask_size; - /** --- 48,51 ---- *************** *** 56,71 **** olsr_init_hna_set(void) { - int idx; - if(olsr_cnf->ip_version == AF_INET) - { - netmask_size = sizeof(olsr_u32_t); - } - else - { - netmask_size = sizeof(olsr_u16_t); - } - /* Since the holdingtime is assumed to be rather large for * HNA entries, the timeoutfunction is only ran once every second --- 55,60 ---- *************** *** 82,96 **** } - int - olsr_get_hna_prefix_len(const struct hna_net *hna) - { - if (olsr_cnf->ip_version == AF_INET) { - return olsr_netmask_to_prefix((const union olsr_ip_addr *)&hna->A_netmask.v4); - } else { - return hna->A_netmask.v6; - } - } - - /** *Lookup a network entry in a networkentry list --- 71,74 ---- *************** *** 103,121 **** */ struct hna_net * ! olsr_lookup_hna_net(const struct hna_net *nets, const union olsr_ip_addr *net, const union hna_netmask *mask) { ! struct hna_net *tmp_net; ! ! /* Loop trough entrys */ ! for(tmp_net = nets->next; ! tmp_net != nets; ! tmp_net = tmp_net->next) ! { ! if(ipequal(&tmp_net->A_network_addr, net) && ! (memcmp(&tmp_net->A_netmask, mask, netmask_size) == 0)) ! return tmp_net; } ! /* Not found */ return NULL; --- 81,93 ---- */ struct hna_net * ! olsr_lookup_hna_net(const struct hna_net *nets, const union olsr_ip_addr *net, olsr_u8_t prefixlen) { ! struct hna_net *tmp; /* Loop trough entrys */ ! for (tmp = nets->next; tmp != nets; tmp = tmp->next) { ! if (tmp->prefixlen == prefixlen && ipequal(&tmp->A_network_addr, net)) { ! return tmp; } ! } /* Not found */ return NULL; *************** *** 201,205 **** */ struct hna_net * ! olsr_add_hna_net(struct hna_entry *hna_gw, const union olsr_ip_addr *net, const union hna_netmask *mask) { /* Add the net */ --- 173,177 ---- */ struct hna_net * ! olsr_add_hna_net(struct hna_entry *hna_gw, const union olsr_ip_addr *net, olsr_u8_t prefixlen) { /* Add the net */ *************** *** 210,214 **** new_net->A_network_addr = *net; //memcpy(&new_net->A_netmask, mask, netmask_size); ! new_net->A_netmask = *mask; /* Queue */ --- 182,186 ---- new_net->A_network_addr = *net; //memcpy(&new_net->A_netmask, mask, netmask_size); ! new_net->prefixlen = prefixlen; /* Queue */ *************** *** 238,260 **** */ void ! olsr_update_hna_entry(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, const union hna_netmask *mask, const float vtime) { ! struct hna_entry *gw_entry; struct hna_net *net_entry; ! if((gw_entry = olsr_lookup_hna_gw(gw)) == NULL) /* Need to add the entry */ gw_entry = olsr_add_hna_entry(gw); ! ! if((net_entry = olsr_lookup_hna_net(&gw_entry->networks, net, mask)) == NULL) ! { ! /* Need to add the net */ ! net_entry = olsr_add_hna_net(gw_entry, net, mask); ! changes_hna = OLSR_TRUE; ! } /* Update holdingtime */ net_entry->A_time = GET_TIMESTAMP(vtime*1000); - } --- 210,231 ---- */ void ! olsr_update_hna_entry(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, olsr_u8_t prefixlen, const float vtime) { ! struct hna_entry *gw_entry = olsr_lookup_hna_gw(gw); struct hna_net *net_entry; ! if (gw_entry == NULL) { /* Need to add the entry */ gw_entry = olsr_add_hna_entry(gw); ! } ! net_entry = olsr_lookup_hna_net(&gw_entry->networks, net, prefixlen); ! if (net_entry == NULL) { ! /* Need to add the net */ ! net_entry = olsr_add_hna_net(gw_entry, net, prefixlen); ! changes_hna = OLSR_TRUE; ! } /* Update holdingtime */ net_entry->A_time = GET_TIMESTAMP(vtime*1000); } Index: two_hop_neighbor_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/two_hop_neighbor_table.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** two_hop_neighbor_table.c 8 Nov 2007 22:47:41 -0000 1.20 --- two_hop_neighbor_table.c 29 Nov 2007 00:49:39 -0000 1.21 *************** *** 40,47 **** */ - - - #include "defs.h" #include "two_hop_neighbor_table.h" #include "mid_set.h" #include "neighbor_table.h" --- 40,46 ---- */ #include "two_hop_neighbor_table.h" + #include "ipcalc.h" + #include "defs.h" #include "mid_set.h" #include "neighbor_table.h" Index: olsr_types.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_types.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** olsr_types.h 8 Nov 2007 22:47:41 -0000 1.12 --- olsr_types.h 29 Nov 2007 00:49:38 -0000 1.13 *************** *** 75,78 **** --- 75,79 ---- #include + union olsr_ip_addr { struct in_addr v4; *************** *** 85,92 **** }; - union hna_netmask { - olsr_u32_t v4; - olsr_u16_t v6; - }; - #endif --- 86,88 ---- Index: link_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** link_set.c 8 Nov 2007 22:47:41 -0000 1.77 --- link_set.c 29 Nov 2007 00:49:38 -0000 1.78 *************** *** 55,58 **** --- 55,59 ---- #include "lq_route.h" #include "net_olsr.h" + #include "ipcalc.h" Index: process_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** process_routes.c 29 Nov 2007 00:18:53 -0000 1.40 --- process_routes.c 29 Nov 2007 00:49:39 -0000 1.41 *************** *** 44,47 **** --- 44,48 ---- */ + #include "ipcalc.h" #include "defs.h" #include "olsr.h" *************** *** 167,176 **** if(error < 0) { const char * const err_msg = strerror(errno); ! OLSR_PRINTF(1, "KERN: ERROR deleting %s: %s\n", ! olsr_rt_to_string(rt), err_msg); ! ! olsr_syslog(OLSR_LOG_ERR, "Delete route: %s", err_msg); ! } } --- 168,175 ---- if(error < 0) { const char * const err_msg = strerror(errno); + const char * const routestr = olsr_rt_to_string(rt); + OLSR_PRINTF(1, "KERN: ERROR deleting %s: %s\n", routestr, err_msg); ! olsr_syslog(OLSR_LOG_ERR, "Delete route %s: %s", routestr, err_msg); } } *************** *** 192,199 **** if(error < 0) { const char * const err_msg = strerror(errno); ! OLSR_PRINTF(1, "KERN: ERROR adding %s: %s\n", ! olsr_rtp_to_string(rt->rt_best), err_msg); ! olsr_syslog(OLSR_LOG_ERR, "Add route: %s", err_msg); } else { --- 191,198 ---- if(error < 0) { const char * const err_msg = strerror(errno); ! const char * const routestr = olsr_rtp_to_string(rt->rt_best); ! OLSR_PRINTF(1, "KERN: ERROR adding %s: %s\n", routestr, err_msg); ! olsr_syslog(OLSR_LOG_ERR, "Add route %s: %s", routestr, err_msg); } else { Index: neighbor_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** neighbor_table.c 8 Nov 2007 22:47:41 -0000 1.35 --- neighbor_table.c 29 Nov 2007 00:49:38 -0000 1.36 *************** *** 40,45 **** */ ! ! #include "defs.h" #include "two_hop_neighbor_table.h" --- 40,44 ---- */ ! #include "ipcalc.h" #include "defs.h" #include "two_hop_neighbor_table.h" --- NEW FILE: ipcalc.h --- (This appears to be a binary file; contents omitted.) Index: interfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** interfaces.c 16 Nov 2007 19:12:55 -0000 1.37 --- interfaces.c 29 Nov 2007 00:49:38 -0000 1.38 *************** *** 46,49 **** --- 46,50 ---- #include "olsr.h" #include "net_olsr.h" + #include "ipcalc.h" static olsr_u32_t if_property_id; Index: print_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/print_packet.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** print_packet.c 8 Nov 2007 22:47:41 -0000 1.13 --- print_packet.c 29 Nov 2007 00:49:39 -0000 1.14 *************** *** 41,44 **** --- 41,45 ---- #include "print_packet.h" + #include "ipcalc.h" #include "mantissa.h" #include "defs.h" --- NEW FILE: ipcalc.c --- (This appears to be a binary file; contents omitted.) Index: lq_avl.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** lq_avl.c 18 Nov 2007 20:35:59 -0000 1.17 --- lq_avl.c 29 Nov 2007 00:49:38 -0000 1.18 *************** *** 45,48 **** --- 45,49 ---- #include + #include "ipcalc.h" #include "lq_avl.h" #include "net_olsr.h" Index: duplicate_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/duplicate_set.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** duplicate_set.c 8 Nov 2007 22:47:41 -0000 1.19 --- duplicate_set.c 29 Nov 2007 00:49:38 -0000 1.20 *************** *** 40,46 **** */ ! ! ! #include "defs.h" #include "duplicate_set.h" #include "scheduler.h" --- 40,44 ---- */ ! #include "ipcalc.h" #include "duplicate_set.h" #include "scheduler.h" --- local_hna_set.c DELETED --- Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** process_package.c 18 Nov 2007 22:28:35 -0000 1.46 --- process_package.c 29 Nov 2007 00:49:39 -0000 1.47 *************** *** 40,46 **** */ - - #include "defs.h" #include "process_package.h" #include "lq_packet.h" #include "hysteresis.h" --- 40,46 ---- */ #include "process_package.h" + #include "ipcalc.h" + #include "defs.h" #include "lq_packet.h" #include "hysteresis.h" *************** *** 54,60 **** #include "rebuild_packet.h" #include "scheduler.h" - #include "local_hna_set.h" #include "net_olsr.h" static void process_message_neighbors(struct neighbor_entry *, const struct hello_message *); --- 54,60 ---- #include "rebuild_packet.h" #include "scheduler.h" #include "net_olsr.h" + static void process_message_neighbors(struct neighbor_entry *, const struct hello_message *); *************** *** 709,715 **** 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); } --- 709,714 ---- while (hna_tmp) { /* Don't add an HNA entry that we are advertising ourselves. */ ! if (!ip_prefix_list_find(olsr_cnf->hna_entries, &hna_tmp->net, hna_tmp->prefixlen)) { ! olsr_update_hna_entry(&message.originator, &hna_tmp->net, hna_tmp->prefixlen, message.vtime); } --- local_hna_set.h DELETED --- Index: lq_route.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** lq_route.c 16 Nov 2007 22:56:54 -0000 1.60 --- lq_route.c 29 Nov 2007 00:49:38 -0000 1.61 *************** *** 44,47 **** --- 44,48 ---- #define SPF_PROFILING 1 + #include "ipcalc.h" #include "defs.h" #include "olsr.h" *************** *** 313,317 **** struct avl_tree cand_tree; struct list_node path_list; ! int i, plen, path_count = 0; struct tc_entry *tc; struct tc_edge_entry *tc_edge; --- 314,318 ---- struct avl_tree cand_tree; struct list_node path_list; ! int i, path_count = 0; struct tc_entry *tc; struct tc_edge_entry *tc_edge; *************** *** 464,473 **** hna != &hna_gw->networks; hna = hna->next) { ! ! plen = olsr_get_hna_prefix_len(hna); ! if (vert->path_etx != INFINITE_ETX) ! olsr_insert_routing_table(&hna->A_network_addr, plen, &vert->addr, ! &link->neighbor_iface_addr, inter->if_index, ! vert->hops, vert->path_etx); } } --- 465,473 ---- hna != &hna_gw->networks; hna = hna->next) { ! if (vert->path_etx != INFINITE_ETX) { ! olsr_insert_routing_table(&hna->A_network_addr, hna->prefixlen, &vert->addr, ! &link->neighbor_iface_addr, inter->if_index, ! vert->hops, vert->path_etx); ! } } } Index: packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/packet.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** packet.h 18 Nov 2007 21:58:32 -0000 1.18 --- packet.h 29 Nov 2007 00:49:39 -0000 1.19 *************** *** 102,106 **** { union olsr_ip_addr net; ! union hna_netmask netmask; /* IPv4 netmask */ struct hna_net_addr *next; }; --- 102,106 ---- { union olsr_ip_addr net; ! olsr_u8_t prefixlen; struct hna_net_addr *next; }; Index: net_olsr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** net_olsr.h 25 Nov 2007 21:23:29 -0000 1.18 --- net_olsr.h 29 Nov 2007 00:49:38 -0000 1.19 *************** *** 45,49 **** #define _NET_OLSR ! #include "defs.h" #include "interfaces.h" #include "process_routes.h" --- 45,49 ---- #define _NET_OLSR ! #include "olsr_types.h" #include "interfaces.h" #include "process_routes.h" *************** *** 54,81 **** typedef int (*packet_transform_function)(olsr_u8_t *, int *); - struct ipaddr_str { - char buf[MAX(INET6_ADDRSTRLEN, INET_ADDRSTRLEN)]; - }; - - /* - * Macros for comparing and copying IP addresses - */ - static INLINE int ip4cmp(const struct in_addr *a, const struct in_addr *b) { return a->s_addr > b->s_addr ? +1 : a->s_addr < b->s_addr ? -1 : 0; } - static INLINE int ip4equal(const struct in_addr *a, const struct in_addr *b) { return a->s_addr == b->s_addr; } - - static INLINE int ip6cmp(const struct in6_addr *a, const struct in6_addr *b) { return memcmp(a, b, sizeof(*a)); } - static INLINE int ip6equal(const struct in6_addr *a, const struct in6_addr *b) { return ip6cmp(a, b) == 0; } - - #if 0 - static INLINE int ipcmp(const union olsr_ip_addr *a, const union olsr_ip_addr *b) { return olsr_cnf->ip_version == AF_INET ? ip4cmp(&a->v4, &b->v4) : ip6cmp(&a->v6, &b->v6); } - #endif - static INLINE int ipequal(const union olsr_ip_addr *a, const union olsr_ip_addr *b) { return olsr_cnf->ip_version == AF_INET ? ip4equal(&a->v4, &b->v4) : ip6equal(&a->v6, &b->v6); } - - /* Do not use this - this is as evil as the COPY_IP() macro was and only used in - * source which also needs cleanups. - */ - static INLINE void genipcopy(void *dst, const void *src) { memcpy(dst, src, olsr_cnf->ipsize); } - - void net_set_disp_pack_out(olsr_bool); --- 54,57 ---- *************** *** 112,139 **** int - olsr_prefix_to_netmask(union olsr_ip_addr *, const olsr_u16_t); - - olsr_u16_t - olsr_netmask_to_prefix(const union olsr_ip_addr *); - - const char * - sockaddr_to_string(struct ipaddr_str * const , const struct sockaddr *); - - const char * - ip4_to_string(struct ipaddr_str * const buf, const struct in_addr); - - const char * - ip6_to_string(struct ipaddr_str * const buf, const struct in6_addr * const addr6); - - const char * - olsr_ip_to_string(struct ipaddr_str * const buf, const union olsr_ip_addr *); - - const char * - sockaddr_to_string(struct ipaddr_str * const buf, const struct sockaddr *); - - const char * - olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix); - - int add_ptf(packet_transform_function); --- 88,91 ---- Index: packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/packet.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** packet.c 8 Nov 2007 22:47:41 -0000 1.26 --- packet.c 29 Nov 2007 00:49:39 -0000 1.27 *************** *** 41,44 **** --- 41,45 ---- + #include "ipcalc.h" #include "defs.h" #include "link_set.h" Index: lq_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** lq_packet.c 29 Nov 2007 00:24:00 -0000 1.32 --- lq_packet.c 29 Nov 2007 00:49:38 -0000 1.33 *************** *** 42,45 **** --- 42,46 ---- */ + #include "ipcalc.h" #include "olsr_protocol.h" #include "defs.h" Index: mid_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mid_set.c 29 Nov 2007 00:10:17 -0000 1.24 --- mid_set.c 29 Nov 2007 00:49:38 -0000 1.25 *************** *** 40,43 **** --- 40,44 ---- */ + #include "ipcalc.h" #include "defs.h" #include "two_hop_neighbor_table.h" Index: hysteresis.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hysteresis.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** hysteresis.c 8 Nov 2007 22:47:41 -0000 1.22 --- hysteresis.c 29 Nov 2007 00:49:38 -0000 1.23 *************** *** 48,51 **** --- 48,52 ---- #include "olsr.h" #include "net_olsr.h" + #include "ipcalc.h" #define hscaling olsr_cnf->hysteresis_param.scaling Index: net_olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** net_olsr.c 20 Nov 2007 23:16:17 -0000 1.36 --- net_olsr.c 29 Nov 2007 00:49:38 -0000 1.37 *************** *** 41,44 **** --- 41,45 ---- #include "net_olsr.h" + #include "ipcalc.h" #include "log.h" #include "olsr.h" *************** *** 449,618 **** } - - /** - * Create a IPv4 or IPv6 netmask based on a prefix length - * - * @param allocated address to build the netmask in - * @param prefix the prefix length - * - * @returns 1 on success 0 on failure - */ - int - olsr_prefix_to_netmask(union olsr_ip_addr *adr, const olsr_u16_t prefix) - { - #if !defined(NODEBUG) && defined(DEBUG) - struct ipaddr_str buf; - #endif - int p; - const olsr_u8_t * const a_end = adr->v6.s6_addr+olsr_cnf->ipsize; - olsr_u8_t *a; - - if (adr == NULL) { - return 0; - } - - a = adr->v6.s6_addr; - for (p = prefix; a < a_end && p > 8; p -= 8) { - *a++ = 0xff; - } - *a++ = 0xff << (8 - p); - while (a < a_end) { - *a++ = 0; - } - - #ifdef DEBUG - OLSR_PRINTF(3, "Prefix %d = Netmask: %s\n", prefix, olsr_ip_to_string(&buf, adr)); - #endif - return 1; - } - - - - /** - * Calculate prefix length based on a netmask - * - * @param adr the address to use to calculate the prefix length - * - * @return the prefix length - */ - olsr_u16_t - olsr_netmask_to_prefix(const union olsr_ip_addr *adr) - { - #ifndef NODEBUG - struct ipaddr_str buf; - #endif - olsr_u16_t prefix = 0; - const olsr_u8_t * const a_end = adr->v6.s6_addr+olsr_cnf->ipsize; - const olsr_u8_t *a; - - for (a = adr->v6.s6_addr; a < a_end && *a == 0xff; a++) { - prefix += 8; - } - if (a < a_end) { - /* handle the last byte */ - switch (*a) { - case 0: prefix += 0; break; - case 128: prefix += 1; break; - case 192: prefix += 2; break; - case 224: prefix += 3; break; - case 240: prefix += 4; break; - case 248: prefix += 5; break; - case 252: prefix += 6; break; - case 254: prefix += 7; break; - case 255: prefix += 8; break; /* Shouldn't happen */ - default: - OLSR_PRINTF(0, "%s: Got bogus netmask %s\n", __func__, olsr_ip_to_string(&buf, adr)); - prefix = USHRT_MAX; - break; - } - } - #ifdef DEBUG - OLSR_PRINTF(3, "Netmask: %s = Prefix %d\n", olsr_ip_to_string(&buf, adr), prefix); - #endif - return prefix; - } - - /** - *Converts a sockaddr struct to a string representing - *the IP address from the sockaddr struct - * - *@param address_to_convert the sockaddr struct to "convert" - *@return a char pointer to the string containing the IP - */ - const char * - sockaddr_to_string(struct ipaddr_str * const buf, const struct sockaddr * const addr) - { - const struct sockaddr_in * const addr4 = (const struct sockaddr_in *)addr; - return ip4_to_string(buf, addr4->sin_addr); - } - - /** - *Converts the 32bit olsr_u32_t datatype to - *a char array. - * - *@param address the olsr_u32_t to "convert" - *@return a char pointer to the string containing the IP - */ - const char * - ip4_to_string(struct ipaddr_str * const buf, const struct in_addr addr4) - { - return inet_ntop(AF_INET, &addr4, buf->buf, sizeof(buf->buf)); - } - - /** - *Converts the 32bit olsr_u32_t datatype to - *a char array. - * - *@param addr6 the address to "convert" - *@return a char pointer to the string containing the IP - */ - const char * - ip6_to_string(struct ipaddr_str * const buf, const struct in6_addr * const addr6) - { - return inet_ntop(AF_INET6, addr6, buf->buf, sizeof(buf->buf)); - } - - const char * - olsr_ip_to_string(struct ipaddr_str * const buf, const union olsr_ip_addr *addr) - { - #if 0 - if (!addr) { - return "null"; - } - #endif - return inet_ntop(olsr_cnf->ip_version, addr, buf->buf, sizeof(buf->buf)); - } - - const char * - olsr_ip_prefix_to_string(const struct olsr_ip_prefix *prefix) - { - /* We need for IPv6 an IP address + '/' + prefix and for IPv4 an IP address + '/' + a netmask */ - static char buf[MAX(INET6_ADDRSTRLEN + 1 + 3, INET_ADDRSTRLEN + 1 + INET_ADDRSTRLEN)]; - const char *rv; - - if (prefix == NULL) { - return "null"; - } - - if(olsr_cnf->ip_version == AF_INET) { - int len; - union olsr_ip_addr netmask; - rv = inet_ntop(AF_INET, &prefix->prefix.v4, buf, sizeof(buf)); - len = strlen(buf); - buf[len++] = '/'; - olsr_prefix_to_netmask(&netmask, prefix->prefix_len); - inet_ntop(AF_INET, &netmask.v4, buf+len, sizeof(buf)-len); - } else { - int len; - /* IPv6 */ - rv = inet_ntop(AF_INET6, &prefix->prefix.v6, buf, sizeof(buf)); - len = strlen(buf); - buf[len++] = '/'; - snprintf(buf+len, sizeof(buf)-len, "/%d", prefix->prefix_len); - } - return rv; - } - - void olsr_add_invalid_address(const union olsr_ip_addr *adr) --- 450,453 ---- Index: build_msg.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** build_msg.c 16 Nov 2007 19:12:55 -0000 1.39 --- build_msg.c 29 Nov 2007 00:49:38 -0000 1.40 *************** *** 40,48 **** */ ! #include "defs.h" #include "olsr.h" #include "log.h" - #include "build_msg.h" - #include "local_hna_set.h" #include "mantissa.h" #include "net_olsr.h" --- 40,47 ---- */ ! #include "build_msg.h" ! #include "ipcalc.h" #include "olsr.h" #include "log.h" #include "mantissa.h" #include "net_olsr.h" *************** *** 1068,1076 **** union olsr_message *m; struct hnapair *pair; ! struct local_hna_entry *h = olsr_cnf->hna_entries; /* No hna nets */ ! if((olsr_cnf->ip_version != AF_INET) || (!ifp) || h == NULL) return OLSR_FALSE; remainsize = net_outbuffer_bytes_left(ifp); --- 1067,1083 ---- union olsr_message *m; struct hnapair *pair; ! struct ip_prefix_list *h; /* No hna nets */ ! if (ifp == NULL) { return OLSR_FALSE; + } + if (olsr_cnf->ip_version != AF_INET) { + return OLSR_FALSE; + } + h = olsr_cnf->hna_entries; + if (h == NULL) { + return OLSR_FALSE; + } remainsize = net_outbuffer_bytes_left(ifp); *************** *** 1100,1105 **** pair = m->v4.message.hna.hna_net; ! while(h) ! { union olsr_ip_addr ip_addr; if((curr_size + (2 * olsr_cnf->ipsize)) > remainsize) --- 1107,1111 ---- pair = m->v4.message.hna.hna_net; ! for (; h != NULL; h = h->next) { union olsr_ip_addr ip_addr; if((curr_size + (2 * olsr_cnf->ipsize)) > remainsize) *************** *** 1130,1136 **** pair->netmask = ip_addr.v4.s_addr; pair++; ! curr_size += (2 * olsr_cnf->ipsize); ! h = h->next; ! } m->v4.seqno = htons(get_msg_seqno()); --- 1136,1141 ---- pair->netmask = ip_addr.v4.s_addr; pair++; ! curr_size += (2 * olsr_cnf->ipsize); ! } m->v4.seqno = htons(get_msg_seqno()); *************** *** 1158,1162 **** struct hnapair6 *pair6; union olsr_ip_addr tmp_netmask; ! struct local_hna_entry *h = olsr_cnf->hna_entries; /* No hna nets */ --- 1163,1167 ---- struct hnapair6 *pair6; union olsr_ip_addr tmp_netmask; ! struct ip_prefix_list *h = olsr_cnf->hna_entries; /* No hna nets */ Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** routing_table.c 14 Nov 2007 11:03:52 -0000 1.35 --- routing_table.c 29 Nov 2007 00:49:39 -0000 1.36 *************** *** 41,44 **** --- 41,46 ---- */ + #include "routing_table.h" + #include "ipcalc.h" #include "defs.h" #include "two_hop_neighbor_table.h" *************** *** 48,52 **** #include "olsr.h" #include "link_set.h" - #include "routing_table.h" #include "lq_avl.h" #include "lq_route.h" --- 50,53 ---- *************** *** 522,526 **** /* update if better */ olsr_insert_routing_table(&tmp_net->A_network_addr, ! olsr_get_hna_prefix_len(tmp_net), &tmp_hna->A_gateway_addr, &rt->rt_best->rtp_nexthop.gateway, --- 523,527 ---- /* update if better */ olsr_insert_routing_table(&tmp_net->A_network_addr, ! tmp_net->prefixlen, &tmp_hna->A_gateway_addr, &rt->rt_best->rtp_nexthop.gateway, Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ipc_frontend.c 20 Nov 2007 23:20:23 -0000 1.40 --- ipc_frontend.c 29 Nov 2007 00:49:38 -0000 1.41 *************** *** 53,58 **** #include "parser.h" #include "socket_parser.h" - #include "local_hna_set.h" #include "net_olsr.h" #ifdef WIN32 --- 53,58 ---- #include "parser.h" #include "socket_parser.h" #include "net_olsr.h" + #include "ipcalc.h" #ifdef WIN32 *************** *** 180,204 **** ipc_check_allowed_ip(const union olsr_ip_addr *addr) { ! struct ipc_host *ipch = olsr_cnf->ipc_hosts; ! struct ipc_net *ipcn = olsr_cnf->ipc_nets; ! if(addr->v4.s_addr == ntohl(INADDR_LOOPBACK)) return OLSR_TRUE; ! ! /* check hosts */ ! while(ipch) ! { ! if(ipequal(addr, &ipch->host)) ! return OLSR_TRUE; ! ipch = ipch->next; ! } /* check nets */ ! while(ipcn) ! { ! if((addr->v4.s_addr & ipcn->mask.v4.s_addr) == (ipcn->net.v4.s_addr & ipcn->mask.v4.s_addr)) ! return OLSR_TRUE; ! ipcn = ipcn->next; } return OLSR_FALSE; --- 180,195 ---- ipc_check_allowed_ip(const union olsr_ip_addr *addr) { ! struct ip_prefix_list *ipcn; ! if(addr->v4.s_addr == ntohl(INADDR_LOOPBACK)) { return OLSR_TRUE; ! } /* check nets */ ! for (ipcn = olsr_cnf->ipc_nets; ipcn != NULL; ipcn = ipcn->next) { ! if (ip_in_net(addr, &ipcn->net)) { ! return OLSR_TRUE; } + } return OLSR_FALSE; *************** *** 256,260 **** OLSR_PRINTF(1, "(OUTPUT)IPC connection lost!\n"); CLOSE(ipc_conn); - //olsr_cnf->open_ipc = 0; ipc_active = OLSR_FALSE; } --- 247,250 ---- *************** *** 281,291 **** char *tmp; ! if(!olsr_cnf->open_ipc) { return -1; } ! if(!ipc_active) return 0; ! memset(&packet, 0, sizeof(struct ipcmsg)); packet.size = htons(IPC_PACK_SIZE); --- 271,281 ---- char *tmp; ! if (!olsr_cnf->open_ipc) { return -1; } ! if (!ipc_active) { return 0; ! } memset(&packet, 0, sizeof(struct ipcmsg)); packet.size = htons(IPC_PACK_SIZE); *************** *** 331,335 **** CLOSE(ipc_conn); - //olsr_cnf->open_ipc = 0; ipc_active = OLSR_FALSE; return -1; --- 321,324 ---- *************** *** 456,460 **** OLSR_PRINTF(1, "(NETINFO)IPC connection lost!\n"); CLOSE(ipc_conn); - //olsr_cnf->open_ipc = 0; return -1; } --- 445,448 ---- Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** main.c 25 Nov 2007 13:08:54 -0000 1.105 --- main.c 29 Nov 2007 00:49:38 -0000 1.106 *************** *** 45,48 **** --- 45,49 ---- #include + #include "ipcalc.h" #include "defs.h" #include "olsr.h" Index: mpr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mpr.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** mpr.c 8 Nov 2007 22:47:41 -0000 1.20 --- mpr.c 29 Nov 2007 00:49:38 -0000 1.21 *************** *** 40,43 **** --- 40,44 ---- */ + #include "ipcalc.h" #include "defs.h" #include "mpr.h" Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** olsr_cfg.h 25 Nov 2007 21:38:13 -0000 1.39 --- olsr_cfg.h 29 Nov 2007 00:49:38 -0000 1.40 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas TÃ?¸nnesen(andreto at olsr.org) * All rights reserved. * *************** *** 147,154 **** }; ! struct local_hna_entry { struct olsr_ip_prefix net; ! struct local_hna_entry *next; }; --- 147,154 ---- }; ! struct ip_prefix_list { struct olsr_ip_prefix net; ! struct ip_prefix_list *next; }; *************** *** 174,189 **** }; - struct ipc_host - { - union olsr_ip_addr host; - struct ipc_host *next; - }; - - struct ipc_net - { - union olsr_ip_addr net; - union olsr_ip_addr mask; - struct ipc_net *next; - }; /* --- 174,177 ---- *************** *** 207,213 **** struct hyst_param hysteresis_param; struct plugin_entry *plugins; ! struct local_hna_entry *hna_entries; ! struct ipc_host *ipc_hosts; ! struct ipc_net *ipc_nets; struct olsr_if *interfaces; float pollrate; --- 195,200 ---- struct hyst_param hysteresis_param; struct plugin_entry *plugins; ! struct ip_prefix_list *hna_entries; ! struct ip_prefix_list *ipc_nets; struct olsr_if *interfaces; float pollrate; *************** *** 245,248 **** --- 232,247 ---- #endif + + /* + * List functions + */ + + void ip_prefix_list_add(struct ip_prefix_list **, const union olsr_ip_addr *, olsr_u8_t); + + int ip_prefix_list_remove(struct ip_prefix_list **, const union olsr_ip_addr *, olsr_u8_t); + + struct ip_prefix_list *ip_prefix_list_find(struct ip_prefix_list *, const union olsr_ip_addr *net, olsr_u8_t prefix_len); + + /* * Interface to parser Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tc_set.c 16 Nov 2007 21:43:55 -0000 1.37 --- tc_set.c 29 Nov 2007 00:49:39 -0000 1.38 *************** *** 42,45 **** --- 42,46 ---- #include "tc_set.h" + #include "ipcalc.h" #include "mid_set.h" #include "link_set.h" Index: mpr_selector_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mpr_selector_set.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** mpr_selector_set.c 8 Nov 2007 22:47:41 -0000 1.20 --- mpr_selector_set.c 29 Nov 2007 00:49:38 -0000 1.21 *************** *** 41,44 **** --- 41,45 ---- + #include "ipcalc.h" #include "defs.h" #include "mpr_selector_set.h" Index: parser.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/parser.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** parser.c 29 Nov 2007 00:24:00 -0000 1.37 --- parser.c 29 Nov 2007 00:49:39 -0000 1.38 *************** *** 41,44 **** --- 41,45 ---- #include "parser.h" + #include "ipcalc.h" #include "defs.h" #include "process_package.h" From (spam-protected) Thu Nov 29 16:47:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 15:47:28 +0000 Subject: [Olsr-cvs] olsrd-current/src olsr_cfg.h,1.40,1.41 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11160/src Modified Files: olsr_cfg.h Log Message: * define LINUX_POLICY_ROUTING only if it is not defined before Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** olsr_cfg.h 29 Nov 2007 00:49:38 -0000 1.40 --- olsr_cfg.h 29 Nov 2007 15:47:26 -0000 1.41 *************** *** 46,49 **** --- 46,50 ---- #include "olsr_types.h" + #ifndef LINUX_POLICY_ROUTING #if defined linux # define LINUX_POLICY_ROUTING 1 *************** *** 51,54 **** --- 52,56 ---- # define LINUX_POLICY_ROUTING 0 #endif + #endif /* Default values not declared in olsr_protocol.h */ From (spam-protected) Thu Nov 29 18:07:17 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 17:07:17 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch main.c,1.32,1.33 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10759/src/olsr_switch Modified Files: main.c Log Message: * fixed a warning Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/main.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** main.c 22 Nov 2007 11:43:35 -0000 1.32 --- main.c 29 Nov 2007 17:07:15 -0000 1.33 *************** *** 93,98 **** --- 93,103 ---- ohs_configure(void); + #if !defined WIN32 + static void + ohs_listen_loop(void) __attribute__((noreturn)); + #else static void ohs_listen_loop(void); + #endif const char * From (spam-protected) Thu Nov 29 18:09:18 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 17:09:18 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd net.c,1.40,1.41 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11602/src/bsd Modified Files: net.c Log Message: * applied bsdfix_pwm.diff.txt from Patrick McCarty so that *BSD compiles and runs Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/net.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** net.c 29 Nov 2007 00:07:37 -0000 1.40 --- net.c 29 Nov 2007 17:09:16 -0000 1.41 *************** *** 474,478 **** struct ipv6_mreq mcastreq; ! COPY_IP(&mcastreq.ipv6mr_multiaddr, &ifs->int6_multaddr.sin6_addr); mcastreq.ipv6mr_interface = ifs->if_index; --- 474,478 ---- struct ipv6_mreq mcastreq; ! mcastreq.ipv6mr_multiaddr=ifs->int6_multaddr.sin6_addr; mcastreq.ipv6mr_interface = ifs->if_index; From (spam-protected) Thu Nov 29 18:09:18 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 17:09:18 +0000 Subject: [Olsr-cvs] olsrd-current/src interfaces.h,1.48,1.49 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11602/src Modified Files: interfaces.h Log Message: * applied bsdfix_pwm.diff.txt from Patrick McCarty so that *BSD compiles and runs Index: interfaces.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** interfaces.h 25 Nov 2007 22:02:33 -0000 1.48 --- interfaces.h 29 Nov 2007 17:09:16 -0000 1.49 *************** *** 73,96 **** #define MAX_IF_METRIC 100 ! #if 0 ! enum olsr_if_weight ! { ! WEIGHT_LOWEST = 0, ! WEIGHT_LOW, ! WEIGHT_ETHERNET_1GBP, /* Ethernet 1Gb+ */ ! WEIGHT_ETHERNET_1GB, /* Ethernet 1Gb */ ! WEIGHT_ETHERNET_100MB, /* Ethernet 100Mb */ ! WEIGHT_ETHERNET_10MB, /* Ethernet 10Mb */ ! WEIGHT_ETHERNET_DEFAULT, /* Ethernet unknown rate*/ ! WEIGHT_WLAN_HIGH, /* >54Mb WLAN */ ! WEIGHT_WLAN_54MB, /* 54Mb 802.11g */ ! WEIGHT_WLAN_11MB, /* 11Mb 802.11b */ ! WEIGHT_WLAN_LOW, /* <11Mb WLAN */ ! WEIGHT_WLAN_DEFAULT, /* WLAN unknown rate */ ! WEIGHT_SERIAL, /* Serial device */ ! WEIGHT_HIGH, /* Max */ ! WEIGHT_HIGHEST = WEIGHT_HIGH ! }; ! #endif struct if_gen_property --- 73,91 ---- #define MAX_IF_METRIC 100 ! #define WEIGHT_LOWEST 0 /* No weight */ ! #define WEIGHT_LOW 1 /* Low */ ! #define WEIGHT_ETHERNET_1GBP 2 /* Ethernet 1Gb+ */ ! #define WEIGHT_ETHERNET_1GB 4 /* Ethernet 1Gb */ ! #define WEIGHT_ETHERNET_100MB 8 /* Ethernet 100Mb */ ! #define WEIGHT_ETHERNET_10MB 16 /* Ethernet 10Mb */ ! #define WEIGHT_ETHERNET_DEFAULT 32 /* Ethernet unknown rate*/ ! #define WEIGHT_WLAN_HIGH 64 /* >54Mb WLAN */ ! #define WEIGHT_WLAN_54MB 128 /* 54Mb 802.11g */ ! #define WEIGHT_WLAN_11MB 256 /* 11Mb 802.11b */ ! #define WEIGHT_WLAN_LOW 512 /* <11Mb WLAN */ ! #define WEIGHT_WLAN_DEFAULT 1024 /* WLAN unknown rate */ ! #define WEIGHT_SERIAL 2048 /* Serial device */ ! #define WEIGHT_HIGH 4096 /* High */ ! #define WEIGHT_HIGHEST 8192 /* Really high */ struct if_gen_property From (spam-protected) Thu Nov 29 18:14:43 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 17:14:43 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.119,1.120 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13625 Modified Files: CHANGELOG Log Message: * added a forgotten line Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** CHANGELOG 29 Nov 2007 00:50:38 -0000 1.119 --- CHANGELOG 29 Nov 2007 17:14:41 -0000 1.120 *************** *** 21,24 **** --- 21,25 ---- - 132-save-the-fish.patch: really save the fish and avoid to forward invalid messages from older olsrd versions + - 135-georss-map-for-nameservice.patch: fixes and extensions for the namesaervice plugin - 138-olsrd-fixdotdraw.patch: fix the dot_draw plugin (all to be found on http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/) From (spam-protected) Thu Nov 29 18:56:59 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 17:56:59 +0000 Subject: [Olsr-cvs] olsrd-current/src/olsr_switch link_rules.c, 1.6, 1.7 link_rules.h, 1.4, 1.5 main.c, 1.33, 1.34 ohs_cmd.c, 1.25, 1.26 olsr_host_switch.h, 1.11, 1.12 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/olsr_switch In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30499/src/olsr_switch Modified Files: link_rules.c link_rules.h main.c ohs_cmd.c olsr_host_switch.h Log Message: * killed the duplicated olsr_ip_to_string() functions * using "ipcalc.h" and killed the COPY_IP()/COMP_IP() macros Index: ohs_cmd.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/ohs_cmd.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ohs_cmd.c 16 Nov 2007 19:12:55 -0000 1.25 --- ohs_cmd.c 29 Nov 2007 17:56:57 -0000 1.26 *************** *** 45,48 **** --- 45,50 ---- #include "commands.h" #include "link_rules.h" + #include "ipcalc.h" + #include #include *************** *** 247,386 **** args += get_next_token(args, tok_buf, TOK_BUF_SIZE); ! if(!strlen(tok_buf)) goto print_usage; ! if(!strncmp(tok_buf, "bi", strlen("bi"))) ! { ! bi = 1; ! args += get_next_token(args, tok_buf, TOK_BUF_SIZE); ! ! if(!strlen(tok_buf)) ! goto print_usage; } ! if(tok_buf[0] == '*') ! { ! wildc_src = 1; ! src = ohs_conns; } - else - { - if(!inet_aton(tok_buf, &iaddr)) - { - printf("Invalid src IP %s\n", tok_buf); - return -1; - } ! src = get_client_by_addr((union olsr_ip_addr *)&iaddr.s_addr); ! if(!src) ! { ! printf("No such client: %s!\n", tok_buf); ! return -1; ! } } args += get_next_token(args, tok_buf, TOK_BUF_SIZE); ! if(!strlen(tok_buf)) goto print_usage; ! if(tok_buf[0] == '*') ! { ! wildc_dst = 1; ! dst = ohs_conns; } - else - { ! if(!inet_aton(tok_buf, &iaddr)) ! { ! printf("Invalid src IP %s\n", tok_buf); ! return -1; ! } ! ! dst = get_client_by_addr((union olsr_ip_addr *)&iaddr.s_addr); ! if(!dst) ! { ! printf("No such client: %s!\n", tok_buf); ! return -1; ! } } args += get_next_token(args, tok_buf, TOK_BUF_SIZE); ! if(!strlen(tok_buf)) goto print_usage; /* No use for bi if both src and dst are widcards */ ! if(wildc_src && wildc_dst) ! { ! bi = 0; ! } qual = atoi(tok_buf); ! if(qual < 0 || qual > 100) ! { ! printf("Link quality out of range(0-100)\n"); ! return -1; ! } ! ! while(src) ! { ! ! while(dst) ! { ! if(src == dst) ! goto next_iteration; ! link = get_link(src, &dst->ip_addr); ! ! inv_link = bi ? get_link(dst, &src->ip_addr) : NULL; ! ! if(qual == 100) ! { ! /* Remove link entry */ ! if(link) ! remove_link(src, link); ! if(inv_link) ! remove_link(dst, inv_link); ! } ! else ! { ! if(!link) ! { ! /* Create new link */ ! link = add_link(src, dst); ! } ! link->quality = qual; ! if(bi) ! { ! if(!inv_link) ! { ! /* Create new link */ ! inv_link = add_link(dst, src); ! } ! inv_link->quality = qual; ! } ! } ! ! printf("%s %sdirectional link(s) %s %c=> %s quality %d\n", ! (qual == 100) ? "Removing" : "Setting", bi ? "bi" : "uni", ! olsr_ip_to_string(&src->ip_addr), bi ? '<' : '=', ! olsr_ip_to_string(&dst->ip_addr), qual); ! ! next_iteration: ! if(wildc_dst) dst = dst->next; ! else break; ! } ! dst = wildc_dst ? ohs_conns : dst; ! src = wildc_src ? src->next : NULL; } return 1; --- 249,369 ---- args += get_next_token(args, tok_buf, TOK_BUF_SIZE); ! if (!strlen(tok_buf)) { goto print_usage; + } + if(!strncmp(tok_buf, "bi", strlen("bi"))) { + bi = 1; + args += get_next_token(args, tok_buf, TOK_BUF_SIZE); ! if (!strlen(tok_buf)) { ! goto print_usage; } + } ! if(tok_buf[0] == '*') { ! wildc_src = 1; ! src = ohs_conns; ! } else { ! if (!inet_aton(tok_buf, &iaddr)) { ! printf("Invalid src IP %s\n", tok_buf); ! return -1; } ! src = get_client_by_addr((union olsr_ip_addr *)&iaddr.s_addr); ! if (!src) { ! printf("No such client: %s!\n", tok_buf); ! return -1; } + } args += get_next_token(args, tok_buf, TOK_BUF_SIZE); ! if (!strlen(tok_buf)) { goto print_usage; + } ! if(tok_buf[0] == '*') { ! wildc_dst = 1; ! dst = ohs_conns; ! } else { ! if(!inet_aton(tok_buf, &iaddr)) { ! printf("Invalid src IP %s\n", tok_buf); ! return -1; } ! dst = get_client_by_addr((union olsr_ip_addr *)&iaddr.s_addr); ! if (!dst) { ! printf("No such client: %s!\n", tok_buf); ! return -1; } + } args += get_next_token(args, tok_buf, TOK_BUF_SIZE); ! if (!strlen(tok_buf)) { goto print_usage; + } /* No use for bi if both src and dst are widcards */ ! if (wildc_src && wildc_dst) { ! bi = 0; ! } qual = atoi(tok_buf); ! if(qual < 0 || qual > 100) { ! printf("Link quality out of range(0-100)\n"); ! return -1; ! } ! while (src) { ! while (dst) { ! struct ipaddr_str srcaddrstr, dstaddrstr; ! if(src != dst) { ! link = get_link(src, &dst->ip_addr); ! inv_link = bi ? get_link(dst, &src->ip_addr) : NULL; ! if(qual == 100) { ! /* Remove link entry */ ! if (link) { ! remove_link(src, link); ! } ! if (inv_link) { ! remove_link(dst, inv_link); ! } ! } else { ! if (!link) { ! /* Create new link */ ! link = add_link(src, dst); ! } ! link->quality = qual; ! if (bi) { ! if(!inv_link) { ! /* Create new link */ ! inv_link = add_link(dst, src); ! } ! inv_link->quality = qual; ! } ! } ! printf("%s %sdirectional link(s) %s %c=> %s quality %d\n", ! (qual == 100) ? "Removing" : "Setting", ! bi ? "bi" : "uni", ! olsr_ip_to_string(&srcaddrstr, &src->ip_addr), ! bi ? '<' : '=', ! olsr_ip_to_string(&dstaddrstr, &dst->ip_addr), ! qual); ! } ! if (wildc_dst) { dst = dst->next; ! } else { break; ! } } + dst = wildc_dst ? ohs_conns : dst; + src = wildc_src ? src->next : NULL; + } return 1; *************** *** 398,439 **** if(!strlen(tok_buf) || ! !strncmp(tok_buf, "clients", strlen("clients"))) ! { ! printf("All connected clients:\n"); ! ! while(oc) ! { ! printf("\t%s - Rx: %d Tx: %d LinkCnt: %d\n", olsr_ip_to_string(&oc->ip_addr), ! oc->rx, oc->tx, oc->linkcnt); ! oc = oc->next; ! } ! } ! else if(!strncmp(tok_buf, "links", strlen("links"))) ! { ! printf("All configured links:\n"); ! while(oc) ! { ! struct ohs_ip_link *links = oc->links; ! ! while(links) ! { ! printf("\t%s => %s Quality: %d\n", ! olsr_ip_to_string(&oc->ip_addr), ! olsr_ip_to_string(&links->dst), ! links->quality); ! ! links = links->next; ! } ! oc = oc->next; ! } } ! else ! { ! printf("list [clients|links]"); ! return -1; } ! return 1; } --- 381,416 ---- if(!strlen(tok_buf) || ! !strncmp(tok_buf, "clients", strlen("clients"))) { ! printf("All connected clients:\n"); ! while(oc) { ! struct ipaddr_str addrstr; ! printf("\t%s - Rx: %d Tx: %d LinkCnt: %d\n", ! olsr_ip_to_string(&addrstr, &oc->ip_addr), ! oc->rx, ! oc->tx, ! oc->linkcnt); ! oc = oc->next; } ! } ! else if(!strncmp(tok_buf, "links", strlen("links"))) { ! printf("All configured links:\n"); ! while (oc) { ! struct ohs_ip_link *links = oc->links; ! while (links) { ! struct ipaddr_str addrstr, dststr; ! printf("\t%s => %s Quality: %d\n", ! olsr_ip_to_string(&addrstr, &oc->ip_addr), ! olsr_ip_to_string(&dststr, &links->dst), ! links->quality); ! links = links->next; ! } ! oc = oc->next; } ! } else { ! printf("list [clients|links]"); ! return -1; ! } return 1; } Index: olsr_host_switch.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/olsr_host_switch.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** olsr_host_switch.h 8 Nov 2007 22:47:42 -0000 1.11 --- olsr_host_switch.h 29 Nov 2007 17:56:57 -0000 1.12 *************** *** 51,60 **** #define OHS_DEFAULT_OLSRD_PATH "./olsrd" ! #define OHS_OUT_OF_MEMORY(s) \ ! { printf("ohsd: out of memory \"%s\"!\n", s); ohs_close(0);} ! ! #define COMP_IP(ip1, ip2) (!memcmp(ip1, ip2, ipsize)) ! ! #define COPY_IP(to, from) memcpy(to, from, ipsize) #ifdef WIN32 --- 51,55 ---- #define OHS_DEFAULT_OLSRD_PATH "./olsrd" ! #define OHS_OUT_OF_MEMORY(s) do { printf("ohsd: out of memory \"%s\"!\n", s); ohs_close(0); } while (0) #ifdef WIN32 *************** *** 83,88 **** }; - extern int ipsize; - extern olsr_u32_t logbits; --- 78,81 ---- *************** *** 102,108 **** #endif - const char * - olsr_ip_to_string(const union olsr_ip_addr *); - struct ohs_connection * get_client_by_addr(const union olsr_ip_addr *); --- 95,98 ---- Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/main.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** main.c 29 Nov 2007 17:07:15 -0000 1.33 --- main.c 29 Nov 2007 17:56:57 -0000 1.34 *************** *** 46,49 **** --- 46,51 ---- #include "link_rules.h" #include "ohs_cmd.h" + #include "ipcalc.h" + #include #include *************** *** 75,80 **** struct ohs_connection *ohs_conns; ! static int ip_version; ! int ipsize; olsr_u32_t logbits; --- 77,84 ---- struct ohs_connection *ohs_conns; ! //static int ip_version; ! //int ipsize; ! static struct olsrd_config olsr_cnf_data; ! struct olsrd_config *olsr_cnf = &olsr_cnf_data; olsr_u32_t logbits; *************** *** 101,118 **** #endif - const char * - olsr_ip_to_string(const union olsr_ip_addr *addr) - { - static char buff[4][100]; - static int index = 0; - const char *ret = inet_ntop(ip_version, - ip_version == AF_INET ? (const void *)&addr->v4 : (const void *)&addr->v6, - buff[index], - sizeof(buff[index])); - index = (index + 1) & 3; - return ret; - } - - #ifdef WIN32 int __stdcall --- 105,108 ---- *************** *** 133,144 **** get_client_by_addr(const union olsr_ip_addr *adr) { ! struct ohs_connection *oc = ohs_conns; ! ! while(oc) ! { ! if(COMP_IP(adr, &oc->ip_addr)) return oc; - oc = oc->next; } return NULL; } --- 123,132 ---- get_client_by_addr(const union olsr_ip_addr *adr) { ! struct ohs_connection *oc; ! for (oc = ohs_conns; oc != NULL; oc = oc->next) { ! if (ipequal(adr, &oc->ip_addr)) { return oc; } + } return NULL; } *************** *** 149,167 **** { struct ohs_connection *oc; - olsr_u32_t new_addr; int i; ! if(logbits & LOG_CONNECT) printf("ohs_init_new_connection\n"); ! /* Create new client node */ ! oc = malloc(sizeof(struct ohs_connection)); ! if(!oc) OHS_OUT_OF_MEMORY("New connection"); ! ! memset(oc, 0, sizeof(oc)); oc->socket = s; - oc->links = NULL; oc->rx = 0; --- 137,152 ---- { struct ohs_connection *oc; int i; ! if(logbits & LOG_CONNECT) { printf("ohs_init_new_connection\n"); ! } /* Create new client node */ ! oc = calloc(1, sizeof(struct ohs_connection)); ! if (!oc) { OHS_OUT_OF_MEMORY("New connection"); ! } oc->socket = s; oc->links = NULL; oc->rx = 0; *************** *** 174,183 **** /* Get "fake IP" */ ! for (i = 0; i < 20; i++) ! { /* Win32 needs that cast. */ ! if (recv(oc->socket, (void *)&new_addr, sizeof(new_addr), 0) == 4) break; ! #if defined WIN32 Sleep(100); --- 159,167 ---- /* Get "fake IP" */ ! for (i = 0; i < 20; i++) { /* Win32 needs that cast. */ ! if (recv(oc->socket, (void *)&oc->ip_addr, olsr_cnf->ipsize, 0) == (int)olsr_cnf->ipsize) { break; ! } #if defined WIN32 Sleep(100); *************** *** 185,211 **** } ! if (i == 20) ! { printf("Failed to fetch IP address! (%s)\n", strerror(errno)); return -1; } ! oc->ip_addr.v4.s_addr = ntohl(new_addr); ! if(logbits & LOG_CONNECT) ! printf("IP: %s\n", olsr_ip_to_string(&oc->ip_addr)); ! ! if(get_client_by_addr(&oc->ip_addr)) ! { ! if(logbits & LOG_CONNECT) ! printf("IP: %s DUPLICATE! Disconecting client!\n", olsr_ip_to_string(&oc->ip_addr)); ! ! close(s); ! return -1; } /* Queue */ oc->next = ohs_conns; ohs_conns = oc; - return 1; } --- 169,194 ---- } ! if (i == 20) { printf("Failed to fetch IP address! (%s)\n", strerror(errno)); return -1; } ! if (logbits & LOG_CONNECT) { ! struct ipaddr_str addrstr; ! printf("IP: %s\n", olsr_ip_to_string(&addrstr, &oc->ip_addr)); ! } ! if (get_client_by_addr(&oc->ip_addr)) { ! if (logbits & LOG_CONNECT) { ! struct ipaddr_str addrstr; ! printf("IP: %s DUPLICATE! Disconecting client!\n", olsr_ip_to_string(&addrstr, &oc->ip_addr)); } + close(s); + free(oc); + return -1; + } /* Queue */ oc->next = ohs_conns; ohs_conns = oc; return 1; } *************** *** 214,253 **** ohs_delete_connection(struct ohs_connection *oc) { ! ! if(!oc) return -1; ! /* Close the socket */ close(oc->socket); ! if(logbits & LOG_CONNECT) ! printf("Removing entry %s\n", olsr_ip_to_string(&oc->ip_addr)); /* De-queue */ ! if(oc == ohs_conns) ! { ! ohs_conns = ohs_conns->next; ! } ! else ! { ! struct ohs_connection *curr_entry, *prev_entry; ! curr_entry = ohs_conns->next; ! prev_entry = ohs_conns; ! while(curr_entry) ! { ! if(curr_entry == oc) ! { ! prev_entry->next = curr_entry->next; ! break; ! } ! prev_entry = curr_entry; ! curr_entry = curr_entry->next; ! } } ! ohs_delete_all_related_links(oc); - /* Free */ - free(oc); return 0; } --- 197,229 ---- ohs_delete_connection(struct ohs_connection *oc) { ! if (!oc) { return -1; ! } /* Close the socket */ close(oc->socket); ! if(logbits & LOG_CONNECT) { ! struct ipaddr_str addrstr; ! printf("Removing entry %s\n", olsr_ip_to_string(&addrstr, &oc->ip_addr)); ! } /* De-queue */ ! if(oc == ohs_conns) { ! ohs_conns = ohs_conns->next; ! } else { ! struct ohs_connection *curr_entry = ohs_conns->next; ! struct ohs_connection *prev_entry = ohs_conns; ! while (curr_entry != NULL) { ! if(curr_entry == oc) { ! prev_entry->next = curr_entry->next; ! break; ! } ! prev_entry = curr_entry; ! curr_entry = curr_entry->next; } ! } ohs_delete_all_related_links(oc); + free(oc); return 0; } *************** *** 265,300 **** return -1; ! if(logbits & LOG_FORWARD) ! printf("Received %ld bytes from %s\n", (long)len, olsr_ip_to_string(&oc->ip_addr)); ! /* Loop trough clients */ ! for(ohs_cs = ohs_conns; ohs_cs; ohs_cs = ohs_cs->next) ! { ! /* Check that the link is active open */ ! if(ohs_check_link(oc, &ohs_cs->ip_addr) && ! oc->socket != ohs_cs->socket) ! { ! ssize_t sent; ! /* Send link addr */ ! if(send(ohs_cs->socket, oc->ip_addr.v6.s6_addr, ipsize, 0) != ipsize) ! { ! printf("Error sending link address!\n"); ! } ! /* Send data */ ! if(logbits & LOG_FORWARD) ! printf("Sending %d bytes %s=>%s\n", (int)len, ! olsr_ip_to_string(&oc->ip_addr), ! olsr_ip_to_string(&ohs_cs->ip_addr)); ! if((sent = send(ohs_cs->socket, data_buffer, len, 0)) != len) ! { ! printf("Error sending(buf %d != sent %d)\n", (int)len, (int)sent); ! } ! ohs_cs->rx++; ! cnt++; ! } } ! return cnt; } --- 241,276 ---- return -1; ! if(logbits & LOG_FORWARD) { ! struct ipaddr_str addrstr; ! printf("Received %ld bytes from %s\n", (long)len, olsr_ip_to_string(&addrstr, &oc->ip_addr)); ! } /* Loop trough clients */ ! for(ohs_cs = ohs_conns; ohs_cs; ohs_cs = ohs_cs->next) { ! /* Check that the link is active open */ ! if(ohs_check_link(oc, &ohs_cs->ip_addr) && ! oc->socket != ohs_cs->socket) { ! ssize_t sent; ! /* Send link addr */ ! if (send(ohs_cs->socket, (const void *)&oc->ip_addr, olsr_cnf->ipsize, 0) != (int)olsr_cnf->ipsize) { ! printf("Error sending link address!\n"); ! } ! /* Send data */ ! if (logbits & LOG_FORWARD) { ! struct ipaddr_str addrstr, addrstr2; ! printf("Sending %d bytes %s=>%s\n", ! (int)len, ! olsr_ip_to_string(&addrstr, &oc->ip_addr), ! olsr_ip_to_string(&addrstr2, &ohs_cs->ip_addr)); ! } ! sent = send(ohs_cs->socket, data_buffer, len, 0); ! if(sent != len) { ! printf("Error sending(buf %d != sent %d)\n", (int)len, (int)sent); ! } ! ohs_cs->rx++; ! cnt++; } ! } return cnt; } *************** *** 549,554 **** logbits = LOG_DEFAULT; ! ip_version = AF_INET; ! ipsize = sizeof(struct in_addr); srand((unsigned int)time(NULL)); --- 525,530 ---- logbits = LOG_DEFAULT; ! olsr_cnf->ip_version = AF_INET; ! olsr_cnf->ipsize = sizeof(struct in_addr); srand((unsigned int)time(NULL)); Index: link_rules.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/link_rules.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** link_rules.c 3 Jun 2005 06:12:23 -0000 1.6 --- link_rules.c 29 Nov 2007 17:56:57 -0000 1.7 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 42,45 **** --- 42,47 ---- #include "link_rules.h" #include "olsr_host_switch.h" + #include "ipcalc.h" + #include #include *************** *** 49,89 **** ohs_check_link(struct ohs_connection *oc, union olsr_ip_addr *dst) { ! struct ohs_ip_link *links = oc->links; ! ! while(links) ! { ! if(COMP_IP(&links->dst, dst)) ! { ! int r; ! ! if(links->quality == 0) ! { ! if(logbits & LOG_LINK) ! printf("%s -> %s Q: %d\n", ! olsr_ip_to_string(&oc->ip_addr), ! olsr_ip_to_string(dst), ! links->quality); ! ! return 0; ! } ! ! r = 1 + (int)((100.0*rand())/(RAND_MAX + 1.0)); ! ! if(logbits & LOG_LINK) ! printf("%s -> %s Q: %d R: %d\n", ! olsr_ip_to_string(&oc->ip_addr), ! olsr_ip_to_string(dst), ! links->quality, r); ! /* Random - based on quality */ ! if(links->quality > r) ! return 0; ! else ! return 1; ! } ! links = links->next; } ! return 1; } --- 51,81 ---- ohs_check_link(struct ohs_connection *oc, union olsr_ip_addr *dst) { ! struct ohs_ip_link *links; ! for (links = oc->links; links != NULL; links = links->next) { ! int r; ! if (!ipequal(&links->dst, dst)) { ! continue; ! } ! if (links->quality == 0) { ! if (logbits & LOG_LINK) { ! struct ipaddr_str addrstr, dststr; ! printf("%s -> %s Q: %d\n", ! olsr_ip_to_string(&addrstr, &oc->ip_addr), ! olsr_ip_to_string(&dststr, dst), ! links->quality); ! } ! return 0; ! } ! r = 1 + (int)(100.0 / (RAND_MAX + 1.0) * rand()); ! if (logbits & LOG_LINK) { ! struct ipaddr_str addrstr, dststr; ! printf("%s -> %s Q: %d R: %d\n", olsr_ip_to_string(&addrstr, &oc->ip_addr), ! olsr_ip_to_string(&dststr, dst), links->quality, r); } ! /* Random - based on quality */ ! return links->quality > r ? 0 : 1; ! } return 1; } *************** *** 123,127 **** link->next = src->links; src->links = link; ! COPY_IP(&link->dst, &dst->ip_addr); src->linkcnt++; --- 115,119 ---- link->next = src->links; src->links = link; ! link->dst = dst->ip_addr; src->linkcnt++; *************** *** 158,173 **** get_link(struct ohs_connection *oc, union olsr_ip_addr *dst) { ! struct ohs_ip_link *links = oc->links; ! ! while(links) ! { ! if(COMP_IP(&links->dst, dst)) ! { ! return links; ! } ! ! links = links->next; } ! return NULL; } --- 150,159 ---- get_link(struct ohs_connection *oc, union olsr_ip_addr *dst) { ! struct ohs_ip_link *links; ! for (links = oc->links; links != NULL; links = links->next) { ! if (ipequal(&links->dst, dst)) { ! return links; } ! } return NULL; } Index: link_rules.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_switch/link_rules.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** link_rules.h 3 Jun 2005 06:12:23 -0000 1.4 --- link_rules.h 29 Nov 2007 17:56:57 -0000 1.5 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2005, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * From (spam-protected) Thu Nov 29 18:59:32 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 17:59:32 +0000 Subject: [Olsr-cvs] olsrd-current/gui/linux-gtk/src callbacks.c, 1.3, 1.4 common.h, 1.4, 1.5 interface.c, 1.6, 1.7 interface.h, 1.3, 1.4 ipc.c, 1.5, 1.6 ipc.h, 1.3, 1.4 main.c, 1.4, 1.5 main.h, 1.2, 1.3 nodes.c, 1.2, 1.3 nodes.h, 1.2, 1.3 olsr.c, 1.2, 1.3 olsr_protocol.h, 1.2, 1.3 packet.c, 1.2, 1.3 packet.h, 1.3, 1.4 pixmaps.h, 1.2, 1.3 routes.c, 1.2, 1.3 routes.h, 1.2, 1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32095/gui/linux-gtk/src Modified Files: callbacks.c common.h interface.c interface.h ipc.c ipc.h main.c main.h nodes.c nodes.h olsr.c olsr_protocol.h packet.c packet.h pixmaps.h routes.c routes.h Log Message: * ISO8859-* -> UTF_8 Index: packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/packet.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** packet.h 22 Apr 2007 20:25:48 -0000 1.3 --- packet.h 29 Nov 2007 17:59:29 -0000 1.4 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. *************** *** 22,26 **** /* ! *Andreas T�nnesen (andreto at ifi.uio.no) * *The list of cached packets --- 22,26 ---- /* ! *Andreas Tønnesen (andreto at ifi.uio.no) * *The list of cached packets Index: common.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/common.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** common.h 16 Sep 2007 21:20:07 -0000 1.4 --- common.h 29 Nov 2007 17:59:29 -0000 1.5 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. *************** *** 22,26 **** /* ! *Andreas T�nmnesen */ --- 22,26 ---- /* ! *Andreas Tønmnesen */ Index: packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/packet.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** packet.c 19 Sep 2004 11:48:20 -0000 1.2 --- packet.c 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. *************** *** 22,26 **** /* ! *Andreas T�nnesen (andreto at ifi.uio.no) * *The list of cached packets --- 22,26 ---- /* ! *Andreas Tønnesen (andreto at ifi.uio.no) * *The list of cached packets Index: main.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/main.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.h 19 Sep 2004 11:48:20 -0000 1.2 --- main.h 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** main.c 17 Nov 2004 19:34:11 -0000 1.4 --- main.c 29 Nov 2007 17:59:29 -0000 1.5 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: nodes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/nodes.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nodes.c 19 Sep 2004 11:48:20 -0000 1.2 --- nodes.c 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: olsr_protocol.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/olsr_protocol.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** olsr_protocol.h 22 Apr 2007 20:25:48 -0000 1.2 --- olsr_protocol.h 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of the UniK OLSR daemon. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of the UniK OLSR daemon. Index: pixmaps.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/pixmaps.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pixmaps.h 19 Sep 2004 11:48:20 -0000 1.2 --- pixmaps.h 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: nodes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/nodes.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nodes.h 19 Sep 2004 11:48:20 -0000 1.2 --- nodes.h 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. *************** *** 22,26 **** /* ! *Andreas T�nnesen (andreto at ifi.uio.no) * *Node information --- 22,26 ---- /* ! *Andreas Tønnesen (andreto at ifi.uio.no) * *Node information Index: routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/routes.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** routes.c 19 Sep 2004 11:48:20 -0000 1.2 --- routes.c 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: interface.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/interface.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** interface.h 17 Nov 2004 20:01:57 -0000 1.3 --- interface.h 29 Nov 2007 17:59:29 -0000 1.4 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: callbacks.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/callbacks.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** callbacks.c 17 Nov 2004 20:01:57 -0000 1.3 --- callbacks.c 29 Nov 2007 17:59:29 -0000 1.4 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: interface.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/interface.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** interface.c 16 Sep 2007 21:20:07 -0000 1.6 --- interface.c 29 Nov 2007 17:59:29 -0000 1.7 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: routes.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/routes.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** routes.h 19 Sep 2004 11:48:20 -0000 1.2 --- routes.h 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: olsr.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/olsr.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** olsr.c 19 Sep 2004 11:48:20 -0000 1.2 --- olsr.c 29 Nov 2007 17:59:29 -0000 1.3 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: ipc.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/ipc.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ipc.c 17 Nov 2004 19:34:11 -0000 1.5 --- ipc.c 29 Nov 2007 17:59:29 -0000 1.6 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. Index: ipc.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/gui/linux-gtk/src/ipc.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ipc.h 14 Nov 2004 13:23:14 -0000 1.3 --- ipc.h 29 Nov 2007 17:59:29 -0000 1.4 *************** *** 1,5 **** /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas T�nnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. --- 1,5 ---- /* * OLSR ad-hoc routing table management protocol GUI front-end ! * Copyright (C) 2003 Andreas Tønnesen (andreto at ifi.uio.no) * * This file is part of olsr.org. From (spam-protected) Thu Nov 29 19:09:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.h, 1.13, 1.14 olsrd_plugin.c, 1.15, 1.16 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/dyn_gw/src Modified Files: olsrd_dyn_gw.h olsrd_plugin.c Log Message: * ISO8859-* -> UTF_8 Index: olsrd_dyn_gw.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** olsrd_dyn_gw.h 13 Sep 2007 15:41:12 -0000 1.13 --- olsrd_dyn_gw.h 29 Nov 2007 18:09:10 -0000 1.14 *************** *** 2,6 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 2,6 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_plugin.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** olsrd_plugin.c 13 Sep 2007 15:41:12 -0000 1.15 --- olsrd_plugin.c 29 Nov 2007 18:09:10 -0000 1.16 *************** *** 2,6 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 2,6 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * From (spam-protected) Thu Nov 29 19:09:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/arprefresh/src olsrd_arprefresh.c, 1.1, 1.2 olsrd_arprefresh.h, 1.1, 1.2 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/arprefresh/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/arprefresh/src Modified Files: olsrd_arprefresh.c olsrd_arprefresh.h Log Message: * ISO8859-* -> UTF_8 Index: olsrd_arprefresh.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/arprefresh/src/olsrd_arprefresh.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** olsrd_arprefresh.h 19 Aug 2007 20:37:41 -0000 1.1 --- olsrd_arprefresh.h 29 Nov 2007 18:09:10 -0000 1.2 *************** *** 1,5 **** /* * Copyright (c) 2007, Sven-Ola Tuecke ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2007, Sven-Ola Tuecke ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * Index: olsrd_arprefresh.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/arprefresh/src/olsrd_arprefresh.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** olsrd_arprefresh.c 19 Aug 2007 20:37:41 -0000 1.1 --- olsrd_arprefresh.c 29 Nov 2007 18:09:10 -0000 1.2 *************** *** 1,5 **** /* * Copyright (c) 2007, Sven-Ola Tuecke ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2007, Sven-Ola Tuecke ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * From (spam-protected) Thu Nov 29 19:09:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/mini/src olsrd_plugin.c, 1.5, 1.6 olsrd_plugin.h, 1.4, 1.5 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/mini/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/mini/src Modified Files: olsrd_plugin.c olsrd_plugin.h Log Message: * ISO8859-* -> UTF_8 Index: olsrd_plugin.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/src/olsrd_plugin.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** olsrd_plugin.h 2 Sep 2007 21:37:49 -0000 1.4 --- olsrd_plugin.h 29 Nov 2007 18:09:10 -0000 1.5 *************** *** 1,5 **** /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/mini/src/olsrd_plugin.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** olsrd_plugin.c 17 Sep 2007 21:57:05 -0000 1.5 --- olsrd_plugin.c 29 Nov 2007 18:09:10 -0000 1.6 *************** *** 1,5 **** /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * From (spam-protected) Thu Nov 29 19:09:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.h, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/dot_draw/src Modified Files: olsrd_dot_draw.h Log Message: * ISO8859-* -> UTF_8 Index: olsrd_dot_draw.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** olsrd_dot_draw.h 23 Jul 2007 12:58:38 -0000 1.10 --- olsrd_dot_draw.h 29 Nov 2007 18:09:10 -0000 1.11 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * includes code by Bruno Randolf * All rights reserved. --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * includes code by Bruno Randolf * All rights reserved. From (spam-protected) Thu Nov 29 19:09:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/dyn_gw_plain/src olsrd_dyn_gw_plain.h, 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-serv4061/lib/dyn_gw_plain/src Modified Files: olsrd_dyn_gw_plain.h Log Message: * ISO8859-* -> UTF_8 Index: olsrd_dyn_gw_plain.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** olsrd_dyn_gw_plain.h 31 Jan 2007 12:38:26 -0000 1.1 --- olsrd_dyn_gw_plain.h 29 Nov 2007 18:09:10 -0000 1.2 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * From (spam-protected) Thu Nov 29 19:09:12 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:12 +0000 Subject: [Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.h, 1.32, 1.33 olsrd_plugin.h, 1.23, 1.24 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/httpinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/httpinfo/src Modified Files: olsrd_httpinfo.h olsrd_plugin.h Log Message: * ISO8859-* -> UTF_8 Index: olsrd_httpinfo.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** olsrd_httpinfo.h 25 Aug 2007 19:48:42 -0000 1.32 --- olsrd_httpinfo.h 29 Nov 2007 18:09:10 -0000 1.33 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: olsrd_plugin.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_plugin.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** olsrd_plugin.h 15 Jul 2007 19:29:38 -0000 1.23 --- olsrd_plugin.h 29 Nov 2007 18:09:10 -0000 1.24 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 69,73 **** #define PLUGIN_NAME "Httpinfo olsrd plugin" #define PLUGIN_VERSION "0.1" ! #define PLUGIN_AUTHOR "Andreas T�nnesen" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR #define PLUGIN_INTERFACE_VERSION 5 --- 69,73 ---- #define PLUGIN_NAME "Httpinfo olsrd plugin" #define PLUGIN_VERSION "0.1" ! #define PLUGIN_AUTHOR "Andreas Tønnesen" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR #define PLUGIN_INTERFACE_VERSION 5 From (spam-protected) Thu Nov 29 19:09:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:13 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux link_layer.c, 1.14, 1.15 net.h, 1.8, 1.9 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/src/linux Modified Files: link_layer.c net.h Log Message: * ISO8859-* -> UTF_8 Index: net.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/net.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** net.h 4 Feb 2007 23:36:35 -0000 1.8 --- net.h 29 Nov 2007 18:09:11 -0000 1.9 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen (andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen (andreto at olsr.org) * All rights reserved. * Index: link_layer.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/link_layer.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** link_layer.c 19 Aug 2007 23:00:15 -0000 1.14 --- link_layer.c 29 Nov 2007 18:09:11 -0000 1.15 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * From (spam-protected) Thu Nov 29 19:09:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:13 +0000 Subject: [Olsr-cvs] olsrd-current/lib/pgraph/src olsrd_pgraph.h,1.3,1.4 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/pgraph/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/pgraph/src Modified Files: olsrd_pgraph.h Log Message: * ISO8859-* -> UTF_8 Index: olsrd_pgraph.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_pgraph.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** olsrd_pgraph.h 30 Aug 2007 22:49:12 -0000 1.3 --- olsrd_pgraph.h 29 Nov 2007 18:09:11 -0000 1.4 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * includes code by Bruno Randolf * All rights reserved. --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * includes code by Bruno Randolf * All rights reserved. From (spam-protected) Thu Nov 29 19:09:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:13 +0000 Subject: [Olsr-cvs] olsrd-current/lib/nameservice/src nameservice_msg.h, 1.8, 1.9 olsrd_copy.c, 1.4, 1.5 olsrd_copy.h, 1.5, 1.6 olsrd_plugin.c, 1.15, 1.16 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/nameservice/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/nameservice/src Modified Files: nameservice_msg.h olsrd_copy.c olsrd_copy.h olsrd_plugin.c Log Message: * ISO8859-* -> UTF_8 Index: olsrd_copy.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/olsrd_copy.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** olsrd_copy.h 29 May 2005 12:47:42 -0000 1.5 --- olsrd_copy.h 29 Nov 2007 18:09:10 -0000 1.6 *************** *** 1,5 **** /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * Index: olsrd_copy.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/olsrd_copy.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** olsrd_copy.c 29 May 2005 12:47:42 -0000 1.4 --- olsrd_copy.c 29 Nov 2007 18:09:10 -0000 1.5 *************** *** 1,5 **** /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * Index: nameservice_msg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice_msg.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** nameservice_msg.h 2 Jul 2007 10:59:12 -0000 1.8 --- nameservice_msg.h 29 Nov 2007 18:09:10 -0000 1.9 *************** *** 1,5 **** /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/olsrd_plugin.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** olsrd_plugin.c 25 Aug 2007 19:48:42 -0000 1.15 --- olsrd_plugin.c 29 Nov 2007 18:09:10 -0000 1.16 *************** *** 1,5 **** /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * From (spam-protected) Thu Nov 29 19:09:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:13 +0000 Subject: [Olsr-cvs] olsrd-current/src apm.h, 1.9, 1.10 build_msg.h, 1.13, 1.14 generate_msg.h, 1.12, 1.13 hashing.c, 1.16, 1.17 hashing.h, 1.10, 1.11 hysteresis.h, 1.9, 1.10 ifnet.h, 1.11, 1.12 mantissa.c, 1.9, 1.10 mantissa.h, 1.10, 1.11 mpr.h, 1.8, 1.9 neighbor_table.h, 1.15, 1.16 net_os.h, 1.13, 1.14 olsrd_plugin.h, 1.6, 1.7 plugin_loader.c, 1.32, 1.33 plugin_loader.h, 1.17, 1.18 print_packet.h, 1.1, 1.2 scheduler.h, 1.14, 1.15 socket_parser.c, 1.28, 1.29 socket_parser.h, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/src Modified Files: apm.h build_msg.h generate_msg.h hashing.c hashing.h hysteresis.h ifnet.h mantissa.c mantissa.h mpr.h neighbor_table.h net_os.h olsrd_plugin.h plugin_loader.c plugin_loader.h print_packet.h scheduler.h socket_parser.c socket_parser.h Log Message: * ISO8859-* -> UTF_8 Index: mantissa.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mantissa.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mantissa.c 28 Aug 2007 20:45:17 -0000 1.9 --- mantissa.c 29 Nov 2007 18:09:11 -0000 1.10 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: hashing.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hashing.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** hashing.h 2 Aug 2007 14:47:26 -0000 1.10 --- hashing.h 29 Nov 2007 18:09:11 -0000 1.11 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: hysteresis.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hysteresis.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** hysteresis.h 20 Apr 2007 13:46:04 -0000 1.9 --- hysteresis.h 29 Nov 2007 18:09:11 -0000 1.10 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: mantissa.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mantissa.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mantissa.h 28 Aug 2007 20:45:17 -0000 1.10 --- mantissa.h 29 Nov 2007 18:09:11 -0000 1.11 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: mpr.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mpr.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mpr.h 20 Feb 2005 18:52:18 -0000 1.8 --- mpr.h 29 Nov 2007 18:09:11 -0000 1.9 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: print_packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/print_packet.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** print_packet.h 26 May 2005 09:55:11 -0000 1.1 --- print_packet.h 29 Nov 2007 18:09:11 -0000 1.2 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: net_os.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/net_os.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** net_os.h 4 Feb 2007 23:36:35 -0000 1.13 --- net_os.h 29 Nov 2007 18:09:11 -0000 1.14 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: apm.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/apm.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** apm.h 29 May 2005 12:47:45 -0000 1.9 --- apm.h 29 Nov 2007 18:09:11 -0000 1.10 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: build_msg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** build_msg.h 7 Jan 2006 08:16:20 -0000 1.13 --- build_msg.h 29 Nov 2007 18:09:11 -0000 1.14 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: ifnet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ifnet.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ifnet.h 30 May 2005 13:13:37 -0000 1.11 --- ifnet.h 29 Nov 2007 18:09:11 -0000 1.12 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: plugin_loader.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_loader.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** plugin_loader.h 15 Jul 2007 19:29:37 -0000 1.17 --- plugin_loader.h 29 Nov 2007 18:09:11 -0000 1.18 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: neighbor_table.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** neighbor_table.h 2 Aug 2007 21:57:06 -0000 1.15 --- neighbor_table.h 29 Nov 2007 18:09:11 -0000 1.16 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: socket_parser.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/socket_parser.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** socket_parser.h 29 May 2005 12:47:45 -0000 1.10 --- socket_parser.h 29 Nov 2007 18:09:11 -0000 1.11 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: hashing.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hashing.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** hashing.c 2 Aug 2007 21:59:59 -0000 1.16 --- hashing.c 29 Nov 2007 18:09:11 -0000 1.17 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: scheduler.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/scheduler.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** scheduler.h 17 Sep 2007 22:24:22 -0000 1.14 --- scheduler.h 29 Nov 2007 18:09:11 -0000 1.15 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: generate_msg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/generate_msg.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** generate_msg.h 21 Nov 2004 11:28:56 -0000 1.12 --- generate_msg.h 29 Nov 2007 18:09:11 -0000 1.13 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: olsrd_plugin.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsrd_plugin.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** olsrd_plugin.h 17 Sep 2007 21:57:06 -0000 1.6 --- olsrd_plugin.h 29 Nov 2007 18:09:11 -0000 1.7 *************** *** 1,5 **** /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas T�nnesen(andreto-at-olsr.org) * All rights reserved. * --- 1,5 ---- /* * Copyright (c) 2005, Bruno Randolf ! * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org) * All rights reserved. * Index: socket_parser.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/socket_parser.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** socket_parser.c 1 Aug 2007 16:18:30 -0000 1.28 --- socket_parser.c 29 Nov 2007 18:09:11 -0000 1.29 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: plugin_loader.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/plugin_loader.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** plugin_loader.c 17 Sep 2007 21:57:06 -0000 1.32 --- plugin_loader.c 29 Nov 2007 18:09:11 -0000 1.33 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * From (spam-protected) Thu Nov 29 19:09:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:13 +0000 Subject: [Olsr-cvs] olsrd-current/lib/secure/src olsrd_plugin.c, 1.15, 1.16 olsrd_secure.h, 1.8, 1.9 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/secure/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/secure/src Modified Files: olsrd_plugin.c olsrd_secure.h Log Message: * ISO8859-* -> UTF_8 Index: olsrd_secure.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/olsrd_secure.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** olsrd_secure.h 15 Jul 2007 21:47:17 -0000 1.8 --- olsrd_secure.h 29 Nov 2007 18:09:11 -0000 1.9 *************** *** 3,7 **** * http://www.olsr.org * ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 3,7 ---- * http://www.olsr.org * ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * Index: olsrd_plugin.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/olsrd_plugin.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** olsrd_plugin.c 17 Sep 2007 21:57:05 -0000 1.15 --- olsrd_plugin.c 29 Nov 2007 18:09:11 -0000 1.16 *************** *** 4,8 **** * http://www.olsr.org * ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * All rights reserved. * --- 4,8 ---- * http://www.olsr.org * ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * All rights reserved. * *************** *** 47,51 **** #define PLUGIN_NAME "OLSRD signature plugin" #define PLUGIN_VERSION "0.5" ! #define PLUGIN_AUTHOR "Andreas T�nnesen" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR #define PLUGIN_INTERFACE_VERSION 5 --- 47,51 ---- #define PLUGIN_NAME "OLSRD signature plugin" #define PLUGIN_VERSION "0.5" ! #define PLUGIN_AUTHOR "Andreas Tønnesen" #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR #define PLUGIN_INTERFACE_VERSION 5 From (spam-protected) Thu Nov 29 19:09:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:09:13 +0000 Subject: [Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.h,1.2,1.3 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4061/lib/txtinfo/src Modified Files: olsrd_txtinfo.h Log Message: * ISO8859-* -> UTF_8 Index: olsrd_txtinfo.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** olsrd_txtinfo.h 15 Jul 2007 19:29:37 -0000 1.2 --- olsrd_txtinfo.h 29 Nov 2007 18:09:11 -0000 1.3 *************** *** 1,5 **** /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas T�nnesen(andreto at olsr.org) * includes code by Bruno Randolf * All rights reserved. --- 1,5 ---- /* * The olsr.org Optimized Link-State Routing daemon(olsrd) ! * Copyright (c) 2004, Andreas Tønnesen(andreto at olsr.org) * includes code by Bruno Randolf * All rights reserved. From (spam-protected) Thu Nov 29 19:10:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:10:19 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.31,1.32 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4460/src/linux Modified Files: kernel_routes.c Log Message: * removed the commented out COPY_IP() and COMP_IP() macros - everything seems to work Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** kernel_routes.c 11 Nov 2007 23:10:23 -0000 1.31 --- kernel_routes.c 29 Nov 2007 18:10:17 -0000 1.32 *************** *** 263,271 **** memset(&kernel_route, 0, sizeof(struct in6_rtmsg)); - //COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); kernel_route.rtmsg_dst = rt->rt_dst.prefix.v6; kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; - //COPY_IP(&kernel_route.rtmsg_gateway, &rt->rt_best->rtp_nexthop.gateway); kernel_route.rtmsg_gateway = rt->rt_best->rtp_nexthop.gateway.v6; --- 263,269 ---- *************** *** 385,393 **** - //COPY_IP(&kernel_route.rtmsg_dst, &rt->rt_dst.prefix); kernel_route.rtmsg_dst = rt->rt_dst.prefix.v6; kernel_route.rtmsg_dst_len = rt->rt_dst.prefix_len; - //COPY_IP(&kernel_route.rtmsg_gateway, &rt->rt_best->rtp_nexthop.gateway); kernel_route.rtmsg_gateway = rt->rt_best->rtp_nexthop.gateway.v6; --- 383,389 ---- From (spam-protected) Thu Nov 29 19:10:20 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:10:20 +0000 Subject: [Olsr-cvs] olsrd-current/src/unix ifnet.c,1.54,1.55 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/unix In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4460/src/unix Modified Files: ifnet.c Log Message: * removed the commented out COPY_IP() and COMP_IP() macros - everything seems to work Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** ifnet.c 29 Nov 2007 00:49:40 -0000 1.54 --- ifnet.c 29 Nov 2007 18:10:17 -0000 1.55 *************** *** 458,462 **** { struct ipaddr_str buf; - //COPY_IP(&olsr_cnf->main_addr, &ifnet->ip_addr); olsr_cnf->main_addr = ifnet->ip_addr; OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); --- 458,461 ---- *************** *** 573,577 **** if(ipequal(&null_addr, &olsr_cnf->main_addr)) { - //COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip); olsr_cnf->main_addr = iface->hemu_ip; OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); --- 572,575 ---- *************** *** 1031,1035 **** { struct ipaddr_str buf; - //COPY_IP(&olsr_cnf->main_addr, &ifp->ip_addr); olsr_cnf->main_addr = ifp->ip_addr; OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); --- 1029,1032 ---- From (spam-protected) Thu Nov 29 19:10:20 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:10:20 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 ifnet.c, 1.40, 1.41 net.c, 1.23, 1.24 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4460/src/win32 Modified Files: ifnet.c net.c Log Message: * removed the commented out COPY_IP() and COMP_IP() macros - everything seems to work Index: ifnet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/ifnet.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ifnet.c 8 Nov 2007 23:23:13 -0000 1.40 --- ifnet.c 29 Nov 2007 18:10:18 -0000 1.41 *************** *** 549,553 **** { struct ipaddr_str buf; - //COPY_IP(&olsr_cnf->main_addr, &ifnet->ip_addr); olsr_cnf->main_addr = ifnet->ip_addr; OLSR_PRINTF(1, "New main address: %s.\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); --- 549,552 ---- *************** *** 639,643 **** if(ipequal(&null_addr, &olsr_cnf->main_addr)) { - //COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip); olsr_cnf->main_addr = iface->hemu_ip; OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); --- 638,641 ---- *************** *** 1044,1048 **** if(ipequal(&NullAddr, &olsr_cnf->main_addr)) { - //COPY_IP(&olsr_cnf->main_addr, &New->ip_addr); olsr_cnf->main_addr = New->ip_addr; OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr)); --- 1042,1045 ---- Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/net.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** net.c 8 Nov 2007 23:23:13 -0000 1.23 --- net.c 29 Nov 2007 18:10:18 -0000 1.24 *************** *** 342,346 **** struct ipv6_mreq McastReq; - //COPY_IP(&McastReq.ipv6mr_multiaddr, &Nic->int6_multaddr.sin6_addr); McastReq.ipv6mr_multiaddr = Nic->int6_multaddr.sin6_addr; McastReq.ipv6mr_interface = Nic->if_index; --- 342,345 ---- From (spam-protected) Thu Nov 29 19:10:19 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:10:19 +0000 Subject: [Olsr-cvs] olsrd-current/src build_msg.c, 1.40, 1.41 duplicate_set.c, 1.20, 1.21 hna_set.c, 1.27, 1.28 ipc_frontend.c, 1.41, 1.42 link_set.c, 1.78, 1.79 lq_packet.c, 1.33, 1.34 mid_set.c, 1.25, 1.26 mpr_selector_set.c, 1.21, 1.22 neighbor_table.c, 1.36, 1.37 packet.c, 1.27, 1.28 parser.c, 1.38, 1.39 process_package.c, 1.47, 1.48 rebuild_packet.c, 1.26, 1.27 routing_table.c, 1.36, 1.37 tc_set.c, 1.38, 1.39 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4460/src Modified Files: build_msg.c duplicate_set.c hna_set.c ipc_frontend.c link_set.c lq_packet.c mid_set.c mpr_selector_set.c neighbor_table.c packet.c parser.c process_package.c rebuild_packet.c routing_table.c tc_set.c Log Message: * removed the commented out COPY_IP() and COMP_IP() macros - everything seems to work Index: duplicate_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/duplicate_set.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** duplicate_set.c 29 Nov 2007 00:49:38 -0000 1.20 --- duplicate_set.c 29 Nov 2007 18:10:11 -0000 1.21 *************** *** 96,100 **** /* Address */ - //COPY_IP(&new_dup_entry->addr, originator); new_dup_entry->addr = *originator; /* Seqno */ --- 96,99 ---- *************** *** 289,293 **** new_iface = olsr_malloc(sizeof(struct dup_iface), "New dup iface"); - //COPY_IP(&new_iface->addr, iface); new_iface->addr = *iface; new_iface->next = tmp_dup_table->ifaces; --- 288,291 ---- Index: mid_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** mid_set.c 29 Nov 2007 00:49:38 -0000 1.25 --- mid_set.c 29 Nov 2007 18:10:13 -0000 1.26 *************** *** 144,148 **** alias->main_entry = tmp; QUEUE_ELEM(reverse_mid_set[alias_hash], alias); - //COPY_IP(&tmp->main_addr, m_addr); tmp->main_addr = *m_addr; tmp->ass_timer = GET_TIMESTAMP(vtime*1000); --- 144,147 ---- *************** *** 235,239 **** OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf1, main_add)); - //COPY_IP(&adr->alias, alias); adr->alias = *alias; adr->next_alias = NULL; --- 234,237 ---- Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ipc_frontend.c 29 Nov 2007 00:49:38 -0000 1.41 --- ipc_frontend.c 29 Nov 2007 18:10:12 -0000 1.42 *************** *** 282,286 **** packet.msgtype = ROUTE_IPC; - //COPY_IP(&packet.target_addr, dst); packet.target_addr = *dst; --- 282,285 ---- *************** *** 289,293 **** { packet.metric = met; - //COPY_IP(&packet.gateway_addr, gw); packet.gateway_addr = *gw; } --- 288,291 ---- *************** *** 347,351 **** packet.msgtype = ROUTE_IPC; - //COPY_IP(&packet.target_addr, &rt->rt_dst.prefix); packet.target_addr = rt->rt_dst.prefix; --- 345,348 ---- *************** *** 353,357 **** packet.metric = (olsr_u8_t)(rt->rt_best->rtp_metric.hops); - //COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway); packet.gateway_addr = rt->rt_nexthop.gateway; --- 350,353 ---- *************** *** 420,424 **** /* Main addr */ - //COPY_IP(&net_msg->main_addr, &olsr_cnf->main_addr); net_msg->main_addr = olsr_cnf->main_addr; --- 416,419 ---- Index: rebuild_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** rebuild_packet.c 29 Nov 2007 00:49:39 -0000 1.26 --- rebuild_packet.c 29 Nov 2007 18:10:17 -0000 1.27 *************** *** 81,85 **** no_pairs = (ntohs(m->v4.olsr_msgsize) - 12) / 8; - //COPY_IP(&hmsg->originator, &m->v4.originator); hmsg->originator.v4.s_addr = m->v4.originator; --- 81,84 ---- *************** *** 98,104 **** hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct"); - //COPY_IP(&hna_pairs->net, &haddr->addr); hna_pairs->net.v4.s_addr = haddr->addr; - //COPY_IP(&hna_pairs->netmask, &haddr->netmask); hna_pairs->prefixlen = olsr_netmask4_to_prefix(&haddr->netmask); --- 97,101 ---- *************** *** 120,124 **** no_pairs = (ntohs(m->v6.olsr_msgsize) - 24) / 32; /* NB 32 not 8 */ - //COPY_IP(&hmsg->originator, &m->v6.originator); hmsg->originator.v6 = m->v6.originator; hmsg->packet_seq_number = ntohs(m->v6.seqno); --- 117,120 ---- *************** *** 136,140 **** hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct 2"); - //COPY_IP(&hna_pairs->net, &haddr6->addr); hna_pairs->net.v6 = haddr6->addr; hna_pairs->prefixlen = olsr_netmask6_to_prefix(&haddr6->netmask); --- 132,135 ---- *************** *** 200,206 **** //printf("Aliases: %d\n", no_aliases); - //COPY_IP(&mmsg->mid_origaddr, &m->v4.originator); mmsg->mid_origaddr.v4.s_addr = m->v4.originator; - //COPY_IP(&mmsg->addr, &m->v4.originator); mmsg->addr.v4.s_addr = m->v4.originator; /*seq number*/ --- 195,199 ---- *************** *** 218,222 **** alias = olsr_malloc(sizeof(struct mid_alias), "MID chgestruct"); - //COPY_IP(&alias->alias_addr, &maddr->addr); alias->alias_addr.v4.s_addr = maddr->addr; alias->next = mmsg->mid_addr; --- 211,214 ---- *************** *** 254,260 **** //printf("Aliases: %d\n", no_aliases); - //COPY_IP(&mmsg->mid_origaddr, &m->v6.originator); mmsg->mid_origaddr.v6 = m->v6.originator; - //COPY_IP(&mmsg->addr, &m->v6.originator); mmsg->addr.v6 = m->v6.originator; /*seq number*/ --- 246,250 ---- *************** *** 272,276 **** //printf("Adding alias: %s\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&maddr6->addr)); - //COPY_IP(&alias->alias_addr, &maddr6->addr); alias->alias_addr.v6 = maddr6->addr; alias->next = mmsg->mid_addr; --- 262,265 ---- *************** *** 326,330 **** /* IPv4 */ /* address */ - //COPY_IP(&umsg->originator, &m->v4.originator); umsg->originator.v4.s_addr = m->v4.originator; /*seq number*/ --- 315,318 ---- *************** *** 337,341 **** /* IPv6 */ /* address */ - //COPY_IP(&umsg->originator, &m->v6.originator); umsg->originator.v6 = m->v6.originator; /*seq number*/ --- 325,328 ---- *************** *** 374,378 **** /* IPv4 */ - //COPY_IP(&hmsg->source_addr, &m->v4.originator); hmsg->source_addr.v4.s_addr = m->v4.originator; hmsg->packet_seq_number = ntohs(m->v4.seqno); --- 361,364 ---- *************** *** 401,405 **** nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct"); - //COPY_IP(&nb->address, hadr); nb->address = *hadr; --- 387,390 ---- *************** *** 420,424 **** /* IPv6 */ - //COPY_IP(&hmsg->source_addr, &m->v6.originator); hmsg->source_addr.v6 = m->v6.originator; //printf("parsing HELLO from %s\n", olsr_ip_to_string(&buf, &hmsg->source_addr)); --- 405,408 ---- *************** *** 448,452 **** nb = olsr_malloc(sizeof (struct hello_neighbor), "OLSR chgestruct 2"); - //COPY_IP(&nb->address, hadr); nb->address = *hadr; --- 432,435 ---- Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** process_package.c 29 Nov 2007 00:49:39 -0000 1.47 --- process_package.c 29 Nov 2007 18:10:17 -0000 1.48 *************** *** 98,102 **** if (neigh_addr != NULL) { - //COPY_IP(&message_neighbors->address, neigh_addr); message_neighbors->address = *neigh_addr; } --- 98,101 ---- *************** *** 166,170 **** two_hop_neighbor->neighbor_2_pointer = 0; - //COPY_IP(&two_hop_neighbor->neighbor_2_addr,&message_neighbors->address); two_hop_neighbor->neighbor_2_addr = message_neighbors->address; --- 165,168 ---- Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tc_set.c 29 Nov 2007 00:49:39 -0000 1.38 --- tc_set.c 29 Nov 2007 18:10:17 -0000 1.39 *************** *** 195,199 **** /* Fill entry */ - //COPY_IP(&tc->addr, adr); tc->addr = *adr; tc->vertex_node.data = tc; --- 195,198 ---- Index: hna_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** hna_set.c 29 Nov 2007 01:29:53 -0000 1.27 --- hna_set.c 29 Nov 2007 18:10:12 -0000 1.28 *************** *** 141,145 **** /* Fill struct */ - //COPY_IP(&new_entry->A_gateway_addr, addr); new_entry->A_gateway_addr = *addr; --- 141,144 ---- *************** *** 179,183 **** /* Fill struct */ - //COPY_IP(&new_net->A_network_addr, net); new_net->A_network_addr = *net; //memcpy(&new_net->A_netmask, mask, netmask_size); --- 178,181 ---- Index: mpr_selector_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/mpr_selector_set.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** mpr_selector_set.c 29 Nov 2007 00:49:38 -0000 1.21 --- mpr_selector_set.c 29 Nov 2007 18:10:13 -0000 1.22 *************** *** 114,118 **** /* Fill struct */ - //COPY_IP(&new_entry->MS_main_addr, addr); new_entry->MS_main_addr = *addr; new_entry->MS_time = GET_TIMESTAMP(vtime*1000); --- 114,117 ---- Index: parser.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/parser.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** parser.c 29 Nov 2007 00:49:39 -0000 1.38 --- parser.c 29 Nov 2007 18:10:17 -0000 1.39 *************** *** 422,426 **** { /* IPv4 sender address */ - //COPY_IP(&from_addr, &((struct sockaddr_in *)&from)->sin_addr.s_addr); from_addr.v4 = ((struct sockaddr_in *)&from)->sin_addr; } --- 422,425 ---- *************** *** 428,432 **** { /* IPv6 sender address */ - //COPY_IP(&from_addr, &((struct sockaddr_in6 *)&from)->sin6_addr); from_addr.v6 = ((struct sockaddr_in6 *)&from)->sin6_addr; } --- 427,430 ---- *************** *** 496,500 **** { fprintf(stderr, "Error receiving host-client IP hook(%d) %s!\n", cc, strerror(errno)); - //COPY_IP(&from_addr, &((struct olsr *)inbuf)->olsr_msg->originator); memcpy(&from_addr, &((struct olsr *)inbuf)->olsr_msg->originator, olsr_cnf->ipsize); } --- 494,497 ---- Index: build_msg.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** build_msg.c 29 Nov 2007 00:49:38 -0000 1.40 --- build_msg.c 29 Nov 2007 18:10:11 -0000 1.41 *************** *** 298,302 **** m->v4.olsr_msgtype = HELLO_MESSAGE; /* Set source(main) addr */ - //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); m->v4.originator = olsr_cnf->main_addr.v4.s_addr; --- 298,301 ---- *************** *** 395,399 **** } - //COPY_IP(haddr, &nb->address); *haddr = nb->address; --- 394,397 ---- *************** *** 474,478 **** m->v6.hopcnt = 0; /* Set source(main) addr */ - //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); m->v6.originator = olsr_cnf->main_addr.v6; m->v6.olsr_msgtype = HELLO_MESSAGE; --- 472,475 ---- *************** *** 565,569 **** } - //COPY_IP(haddr, &nb->address); *haddr = nb->address; --- 562,565 ---- *************** *** 646,650 **** m->v4.hopcnt = message->hop_count; m->v4.ttl = message->ttl; - //COPY_IP(&m->v4.originator, &message->originator); m->v4.originator = message->originator.v4.s_addr; --- 642,645 ---- *************** *** 690,694 **** olsr_ip_to_string(&buf, &mprs->address)); #endif - //COPY_IP(&mprsaddr->addr, &mprs->address); mprsaddr->addr = mprs->address.v4.s_addr; curr_size += olsr_cnf->ipsize; --- 685,688 ---- *************** *** 774,778 **** m->v6.hopcnt = message->hop_count; m->v6.ttl = message->ttl; - //COPY_IP(&m->v6.originator, &message->originator); m->v6.originator = message->originator.v6; --- 768,771 ---- *************** *** 814,818 **** olsr_ip_to_string(&buf, &mprs->address)); #endif - //COPY_IP(&mprsaddr6->addr, &mprs->address); mprsaddr6->addr = mprs->address.v6; curr_size += olsr_cnf->ipsize; --- 807,810 ---- *************** *** 889,893 **** m->v4.ttl = MAX_TTL; /* Set main(first) address */ - //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); m->v4.originator = olsr_cnf->main_addr.v4.s_addr; m->v4.olsr_msgtype = MID_MESSAGE; --- 881,884 ---- *************** *** 931,935 **** #endif - //COPY_IP(&addrs->addr, &ifs->ip_addr); addrs->addr = ifs->ip_addr.v4.s_addr; addrs++; --- 922,925 ---- *************** *** 995,999 **** m->v6.olsr_vtime = ifp->valtimes.mid; /* Set main(first) address */ - //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); m->v6.originator = olsr_cnf->main_addr.v6; --- 985,988 ---- *************** *** 1034,1038 **** #endif - //COPY_IP(&addrs6->addr, &ifs->ip_addr); addrs6->addr = ifs->ip_addr.v6; addrs6++; --- 1023,1026 ---- *************** *** 1097,1101 **** /* Fill header */ - //COPY_IP(&m->v4.originator, &olsr_cnf->main_addr); m->v4.originator = olsr_cnf->main_addr.v4.s_addr; m->v4.hopcnt = 0; --- 1085,1088 ---- *************** *** 1130,1136 **** OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net)); #endif - //COPY_IP(&pair->addr, &h->net); pair->addr = h->net.prefix.v4.s_addr; - //COPY_IP(&pair->netmask, &h->netmask); olsr_prefix_to_netmask(&ip_addr, h->net.prefix_len); pair->netmask = ip_addr.v4.s_addr; --- 1117,1121 ---- *************** *** 1185,1189 **** /* Fill header */ - //COPY_IP(&m->v6.originator, &olsr_cnf->main_addr); m->v6.originator = olsr_cnf->main_addr.v6; m->v6.hopcnt = 0; --- 1170,1173 ---- *************** *** 1218,1224 **** OLSR_PRINTF(BMSG_DBGLVL, "\tNet: %s\n", olsr_ip_prefix_to_string(&h->net)); #endif - //COPY_IP(&pair6->addr, &h->net); pair6->addr = h->net.prefix.v6; - //COPY_IP(&pair6->netmask, &tmp_netmask); olsr_prefix_to_netmask(&tmp_netmask, h->net.prefix_len); pair6->netmask = tmp_netmask.v6; --- 1202,1206 ---- Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** routing_table.c 29 Nov 2007 00:49:39 -0000 1.36 --- routing_table.c 29 Nov 2007 18:10:17 -0000 1.37 *************** *** 250,254 **** memset(rtp, 0, sizeof(*rtp)); - //COPY_IP(&rtp->rtp_originator, originator); rtp->rtp_originator = *originator; --- 250,253 ---- Index: link_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** link_set.c 29 Nov 2007 00:49:38 -0000 1.78 --- link_set.c 29 Nov 2007 18:10:13 -0000 1.79 *************** *** 508,515 **** */ //printf("\tLocal IF: %s\n", olsr_ip_to_string(local)); - //COPY_IP(&new_link->local_iface_addr, local); new_link->local_iface_addr = *local; /* L_neighbor_iface_addr = Source Address */ - //COPY_IP(&new_link->neighbor_iface_addr, remote); new_link->neighbor_iface_addr = *remote; --- 508,513 ---- *************** *** 586,603 **** } - /* 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++; - - new_link->neighbor = neighbor; - if(!ipequal(remote, remote_main)) { --- 584,589 ---- Index: packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/packet.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** packet.c 29 Nov 2007 00:49:39 -0000 1.27 --- packet.c 29 Nov 2007 18:10:16 -0000 1.28 *************** *** 112,116 **** message->ttl = 1; - //COPY_IP(&message->source_addr, &olsr_cnf->main_addr); message->source_addr = olsr_cnf->main_addr; --- 112,115 ---- *************** *** 191,199 **** /* Set the remote interface address */ - //COPY_IP(&message_neighbor->address, &links->neighbor_iface_addr); message_neighbor->address = links->neighbor_iface_addr; /* Set the main address */ - //COPY_IP(&message_neighbor->main_address, &links->neighbor->neighbor_main_addr); message_neighbor->main_address = links->neighbor->neighbor_main_addr; #ifdef DEBUG --- 190,196 ---- *************** *** 294,301 **** - //COPY_IP(&message_neighbor->address, &neighbor->neighbor_main_addr); message_neighbor->address = neighbor->neighbor_main_addr; - //COPY_IP(&message_neighbor->main_address, &neighbor->neighbor_main_addr); message_neighbor->main_address = neighbor->neighbor_main_addr; #ifdef DEBUG --- 291,296 ---- *************** *** 359,365 **** message->ansn = get_local_ansn(); - //COPY_IP(&message->originator, &olsr_cnf->main_addr); message->originator = olsr_cnf->main_addr; - //COPY_IP(&message->source_addr, &olsr_cnf->main_addr); message->source_addr = olsr_cnf->main_addr; --- 354,358 ---- *************** *** 383,387 **** message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC"); - //COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); message_mpr->address = entry->neighbor_main_addr; message_mpr->next = message->multipoint_relay_selector_address; --- 376,379 ---- *************** *** 400,404 **** message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 2"); - //COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); message_mpr->address = entry->neighbor_main_addr; message_mpr->next = message->multipoint_relay_selector_address; --- 392,395 ---- *************** *** 416,420 **** message_mpr = olsr_malloc(sizeof(struct tc_mpr_addr), "Build TC 3"); - //COPY_IP(&message_mpr->address, &entry->neighbor_main_addr); message_mpr->address = entry->neighbor_main_addr; message_mpr->next = message->multipoint_relay_selector_address; --- 407,410 ---- Index: lq_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** lq_packet.c 29 Nov 2007 00:49:38 -0000 1.33 --- lq_packet.c 29 Nov 2007 18:10:13 -0000 1.34 *************** *** 75,79 **** lq_hello->comm.size = 0; - //COPY_IP(&lq_hello->comm.orig, &olsr_cnf->main_addr); lq_hello->comm.orig = olsr_cnf->main_addr; --- 75,78 ---- *************** *** 121,125 **** // set the entry's neighbour interface address - //COPY_IP(&neigh->addr, &walker->neighbor_iface_addr); neigh->addr = walker->neighbor_iface_addr; --- 120,123 ---- *************** *** 164,168 **** lq_tc->comm.size = 0; - //COPY_IP(&lq_tc->comm.orig, &olsr_cnf->main_addr); lq_tc->comm.orig = olsr_cnf->main_addr; --- 162,165 ---- *************** *** 184,188 **** lq_tc->comm.seqno = get_msg_seqno(); - //COPY_IP(&lq_tc->from, &olsr_cnf->main_addr); lq_tc->from = olsr_cnf->main_addr; --- 181,184 ---- *************** *** 222,226 **** // set the entry's main address - //COPY_IP(&neigh->address, &walker->neighbor_main_addr); neigh->address = walker->neighbor_main_addr; --- 218,221 ---- Index: neighbor_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** neighbor_table.c 29 Nov 2007 00:49:38 -0000 1.36 --- neighbor_table.c 29 Nov 2007 18:10:14 -0000 1.37 *************** *** 242,246 **** /* Set address, willingness and status */ - //COPY_IP(&new_neigh->neighbor_main_addr, main_addr); new_neigh->neighbor_main_addr = *main_addr; new_neigh->willingness = WILL_NEVER; --- 242,245 ---- From (spam-protected) Thu Nov 29 19:10:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:10:13 +0000 Subject: [Olsr-cvs] olsrd-current/lib/bmf/src Bmf.c, 1.11, 1.12 NetworkInterfaces.c, 1.13, 1.14 Message-ID: Update of /cvsroot/olsrd/olsrd-current/lib/bmf/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4460/lib/bmf/src Modified Files: Bmf.c NetworkInterfaces.c Log Message: * removed the commented out COPY_IP() and COMP_IP() macros - everything seems to work Index: NetworkInterfaces.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/NetworkInterfaces.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NetworkInterfaces.c 29 Nov 2007 00:49:40 -0000 1.13 --- NetworkInterfaces.c 29 Nov 2007 18:10:11 -0000 1.14 *************** *** 1469,1475 **** * address from the OLSR interface object. Downcast to correct sockaddr * subtype. */ - //COPY_IP(&newIf->intAddr, &((struct sockaddr_in *)&olsrIntf->int_addr)->sin_addr.s_addr); newIf->intAddr.v4 = ((struct sockaddr_in *)&olsrIntf->int_addr)->sin_addr; - //COPY_IP(&newIf->broadAddr, &((struct sockaddr_in *)&olsrIntf->int_broadaddr)->sin_addr.s_addr); newIf->broadAddr.v4 = ((struct sockaddr_in *)&olsrIntf->int_broadaddr)->sin_addr; } --- 1469,1473 ---- *************** *** 1489,1493 **** { /* Downcast to correct sockaddr subtype */ - //COPY_IP(&newIf->intAddr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr); newIf->intAddr.v4 = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; } --- 1487,1490 ---- *************** *** 1506,1510 **** { /* Downcast to correct sockaddr subtype */ - //COPY_IP(&newIf->broadAddr, &((struct sockaddr_in *)&ifr.ifr_broadaddr)->sin_addr.s_addr); newIf->broadAddr.v4 = ((struct sockaddr_in *)&ifr.ifr_broadaddr)->sin_addr; } --- 1503,1506 ---- *************** *** 1623,1627 **** /* ...find the OLSR interface structure, if any */ - //COPY_IP(&ipAddr, &((struct sockaddr_in*)&ifr->ifr_addr)->sin_addr.s_addr); ipAddr.v4 = ((struct sockaddr_in*)&ifr->ifr_addr)->sin_addr; olsrIntf = if_ifwithaddr(&ipAddr); --- 1619,1622 ---- *************** *** 1866,1870 **** iph = (struct iphdr*) ipPacket; - //COPY_IP(&destIp, &iph->daddr); destIp.v4.s_addr = iph->daddr; if (! IsMulticast(&destIp)) --- 1861,1864 ---- *************** *** 1875,1879 **** origDaddr = ntohl(iph->daddr); - //COPY_IP(&iph->daddr, broadAddr); iph->daddr = broadAddr->v4.s_addr; newDaddr = ntohl(iph->daddr); --- 1869,1872 ---- Index: Bmf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/lib/bmf/src/Bmf.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Bmf.c 29 Nov 2007 00:49:40 -0000 1.11 --- Bmf.c 29 Nov 2007 18:10:11 -0000 1.12 *************** *** 180,184 **** /* Start by filling in the local broadcast address */ - //COPY_IP(&forwardTo.sin_addr.s_addr, &intf->broadAddr); forwardTo.sin_addr = intf->broadAddr.v4; --- 180,183 ---- *************** *** 203,207 **** if (BmfMechanism == BM_UNICAST_PROMISCUOUS || nPossibleNeighbors <= 2) { - //COPY_IP(&forwardTo.sin_addr.s_addr, &bestNeighborLinks.links[i]->neighbor_iface_addr); forwardTo.sin_addr = bestNeighborLinks.links[i]->neighbor_iface_addr.v4; } --- 202,205 ---- *************** *** 272,276 **** ipHeader = GetIpHeader(encapsulationUdpData); - //COPY_IP(&dst, &ipHeader->ip_dst); dst.v4 = ipHeader->ip_dst; --- 270,273 ---- *************** *** 304,308 **** ipPacketLen = GetIpTotalLength(ipPacket); - //COPY_IP(&src, &ipHeader->ip_src); src.v4 = ipHeader->ip_src; --- 301,304 ---- *************** *** 610,616 **** ipHeader = GetIpHeader(encapsulationUdpData); - //COPY_IP(&mcSrc, &ipHeader->ip_src); mcSrc.v4 = ipHeader->ip_src; - //COPY_IP(&mcDst, &ipHeader->ip_dst); mcDst.v4 = ipHeader->ip_dst; --- 606,610 ---- *************** *** 797,801 **** /* Compose destination of encapsulation packet. * Start by filling in the local broadcast address. */ - //COPY_IP(&forwardTo.sin_addr.s_addr, &walker->broadAddr); forwardTo.sin_addr = walker->broadAddr.v4; --- 791,794 ---- *************** *** 822,826 **** /* For unicast, overwrite the local broadcast address which was filled in * above */ - //COPY_IP(&forwardTo.sin_addr.s_addr, &bestNeighborLinks.links[i]->neighbor_iface_addr); forwardTo.sin_addr = bestNeighborLinks.links[i]->neighbor_iface_addr.v4; } --- 815,818 ---- *************** *** 902,906 **** /* Only forward multicast packets. If configured, also forward local broadcast packets */ - //COPY_IP(&dstIp, &ipHeader->ip_dst); dstIp.v4 = ipHeader->ip_dst; --- 894,897 ---- *************** *** 916,920 **** } - //COPY_IP(&srcIp, &ipHeader->ip_src); srcIp.v4 = ipHeader->ip_src; --- 907,910 ---- *************** *** 1201,1207 **** } - //COPY_IP(&forwardedBy, &ipHeader->ip_src); forwardedBy.v4 = ipHeader->ip_src; - //COPY_IP(&forwardedTo, &ipHeader->ip_dst); forwardedTo.v4 = ipHeader->ip_dst; BmfEncapsulationPacketReceived( --- 1191,1195 ---- *************** *** 1245,1249 **** } /* if (nBytes < 0) */ - //COPY_IP(&forwardedBy, &from.sin_addr.s_addr); forwardedBy.v4 = from.sin_addr; --- 1233,1236 ---- From (spam-protected) Thu Nov 29 19:20:47 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 18:20:47 +0000 Subject: [Olsr-cvs] olsrd-current/src/bsd net.c,1.41,1.42 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/bsd In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8852/src/bsd Modified Files: net.c Log Message: * more fixes fro MacOSX Index: net.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/net.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** net.c 29 Nov 2007 17:09:16 -0000 1.41 --- net.c 29 Nov 2007 18:20:45 -0000 1.42 *************** *** 98,102 **** static int gateway; ! static int set_sysctl_int(char *name, int new) { int old; --- 98,102 ---- static int gateway; ! static int set_sysctl_int(const char *name, int new) { int old; *************** *** 155,168 **** int enable_ip_forwarding(int version) { ! const char *name = version == AF_INET ! ? "net.inet.ip.forwarding" ! : "net.inet6.ip6.forwarding"; gateway = set_sysctl_int(name, 1); ! if (gateway < 0) ! { ! fprintf(stderr, "Cannot enable IP forwarding. Please enable IP forwarding manually. Continuing in 3 seconds...\n"); ! sleep(3); ! } return 1; --- 155,165 ---- int enable_ip_forwarding(int version) { ! const char *name = version == AF_INET ? "net.inet.ip.forwarding" : "net.inet6.ip6.forwarding"; gateway = set_sysctl_int(name, 1); ! if (gateway < 0) { ! fprintf(stderr, "Cannot enable IP forwarding. Please enable IP forwarding manually. Continuing in 3 seconds...\n"); ! sleep(3); ! } return 1; *************** *** 226,230 **** } ! int disable_redirects(const char *if_name, struct interface *iface, int version) { // this function gets called for each interface olsrd uses; however, --- 223,227 ---- } ! int disable_redirects(const char *if_name __attribute__((unused)), struct interface *iface __attribute__((unused)), int version __attribute__((unused))) { // this function gets called for each interface olsrd uses; however, *************** *** 235,239 **** } ! int deactivate_spoof(const char *if_name, struct interface *iface, int version) { return 1; --- 232,236 ---- } ! int deactivate_spoof(const char *if_name __attribute__((unused)), struct interface *iface __attribute__((unused)), int version __attribute__((unused))) { return 1; *************** *** 242,253 **** int restore_settings(int version) { - const char *name; - // reset IP forwarding ! ! if (version == AF_INET) ! name = "net.inet.ip.forwarding"; ! else ! name = "net.inet6.ip6.forwarding"; set_sysctl_int(name, gateway); --- 239,244 ---- int restore_settings(int version) { // reset IP forwarding ! const char *name = version == AF_INET ? "net.inet.ip.forwarding" : "net.inet6.ip6.forwarding"; set_sysctl_int(name, gateway); *************** *** 256,287 **** #ifdef __OpenBSD__ ! if (version == AF_INET) ! name = "net.inet.icmp.rediraccept"; ! else ! name = "net.inet6.icmp6.rediraccept"; ! #elif defined __FreeBSD__ || defined __MacOSX__ ! if (version == AF_INET) ! name = "net.inet.icmp.drop_redirect"; ! else ! name = "net.inet6.icmp6.rediraccept"; #else ! if (version == AF_INET) ! name = "net.inet.icmp.drop_redirect"; ! else ! name = "net.inet6.icmp6.drop_redirect"; #endif - set_sysctl_int(name, ignore_redir); // reset outgoing ICMP redirects ! ! if (version == AF_INET) ! name = "net.inet.ip.redirect"; ! else ! name = "net.inet6.ip6.redirect"; ! set_sysctl_int(name, send_redir); - return 1; } --- 247,261 ---- #ifdef __OpenBSD__ ! name = version == AF_INET ? "net.inet.icmp.rediraccept" : "net.inet6.icmp6.rediraccept"; #elif defined __FreeBSD__ || defined __MacOSX__ ! name = version == AF_INET ? "net.inet.icmp.drop_redirect" : "net.inet6.icmp6.rediraccept"; #else ! name = version == AF_INET ? "net.inet.icmp.drop_redirect" : "net.inet6.icmp6.drop_redirect"; #endif set_sysctl_int(name, ignore_redir); // reset outgoing ICMP redirects ! name = version == AF_INET ? "net.inet.ip.redirect" : "net.inet6.ip6.redirect"; set_sysctl_int(name, send_redir); return 1; } *************** *** 471,481 **** { /* See netinet6/in6.h */ ! struct ipv6_mreq mcastreq; ! mcastreq.ipv6mr_multiaddr=ifs->int6_multaddr.sin6_addr; mcastreq.ipv6mr_interface = ifs->if_index; ! OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string((union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr)); /* rfc 3493 */ --- 445,455 ---- { /* See netinet6/in6.h */ ! struct ipaddr_str addrstr; struct ipv6_mreq mcastreq; ! mcastreq.ipv6mr_multiaddr = ifs->int6_multaddr.sin6_addr; mcastreq.ipv6mr_interface = ifs->if_index; ! OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string(&addrstr, (union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr)); /* rfc 3493 */ *************** *** 778,786 **** sin6 = (struct sockaddr_in6 *)from; OLSR_PRINTF (4, "%d bytes from %s, socket associated %s really received on %s\n", ! count, ! (olsr_cnf->ip_version == AF_INET6) ? ! inet_ntop(AF_INET6, (char *)&sin6->sin6_addr, addrstr, ! INET6_ADDRSTRLEN): ! inet_ntoa (sin->sin_addr), ifc->int_name, iname); --- 752,757 ---- sin6 = (struct sockaddr_in6 *)from; OLSR_PRINTF (4, "%d bytes from %s, socket associated %s really received on %s\n", ! count, ! inet_ntop(olsr_cnf->ip_version, olsr_cnf->ip_version == AF_INET6 ? (char *)&sin6->sin6_addr : (char *)&sin->sin_addr, addrstr, sizeof(addrstr)): ifc->int_name, iname); From (spam-protected) Thu Nov 29 23:21:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 22:21:28 +0000 Subject: [Olsr-cvs] olsrd-current/src/win32 kernel_routes.c,1.25,1.26 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/win32 In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7724/src/win32 Modified Files: kernel_routes.c Log Message: "open_ipc" is only a boolean value containing "olsr_cnf->debug_level > 1". So I see no reason to keep that variable. Apart from the the attached patch makes the "#if" condition for the "rts" field identical to all other references to it. Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/win32/kernel_routes.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** kernel_routes.c 11 Nov 2007 23:10:22 -0000 1.25 --- kernel_routes.c 29 Nov 2007 22:21:26 -0000 1.26 *************** *** 117,121 **** * Send IPC route update message */ ! if(olsr_cnf->open_ipc) { ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, --- 117,121 ---- * Send IPC route update message */ ! if (olsr_cnf->ipc_connections > 0) { ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway, rt->rt_best->rtp_metric.hops, 1, *************** *** 186,190 **** * Send IPC route update message */ ! if(olsr_cnf->open_ipc) { ipc_route_send_rtentry(&rt->rt_dst.prefix, NULL, 0 , 0, NULL); } --- 186,190 ---- * Send IPC route update message */ ! if (olsr_cnf->ipc_connections > 0) { ipc_route_send_rtentry(&rt->rt_dst.prefix, NULL, 0 , 0, NULL); } From (spam-protected) Thu Nov 29 23:21:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 22:21:28 +0000 Subject: [Olsr-cvs] olsrd-current/src/cfgparser olsrd_conf.c, 1.63, 1.64 oparse.y, 1.40, 1.41 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/cfgparser In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7724/src/cfgparser Modified Files: olsrd_conf.c oparse.y Log Message: "open_ipc" is only a boolean value containing "olsr_cnf->debug_level > 1". So I see no reason to keep that variable. Apart from the the attached patch makes the "#if" condition for the "rts" field identical to all other references to it. Index: olsrd_conf.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/olsrd_conf.c,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** olsrd_conf.c 29 Nov 2007 00:49:40 -0000 1.63 --- olsrd_conf.c 29 Nov 2007 22:21:26 -0000 1.64 *************** *** 437,441 **** cnf->willingness_auto = DEF_WILL_AUTO; cnf->ipc_connections = DEF_IPC_CONNECTIONS; - cnf->open_ipc = cnf->ipc_connections ? OLSR_TRUE : OLSR_FALSE; cnf->use_hysteresis = DEF_USE_HYST; --- 437,440 ---- Index: oparse.y =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oparse.y,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** oparse.y 29 Nov 2007 00:49:40 -0000 1.40 --- oparse.y 29 Nov 2007 22:21:26 -0000 1.41 *************** *** 324,328 **** { olsr_cnf->ipc_connections = $2->integer; - olsr_cnf->open_ipc = olsr_cnf->ipc_connections ? OLSR_TRUE : OLSR_FALSE; free($2); } --- 324,327 ---- From (spam-protected) Thu Nov 29 23:21:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 22:21:28 +0000 Subject: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.32,1.33 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src/linux In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7724/src/linux Modified Files: kernel_routes.c Log Message: "open_ipc" is only a boolean value containing "olsr_cnf->debug_level > 1". So I see no reason to keep that variable. Apart from the the attached patch makes the "#if" condition for the "rts" field identical to all other references to it. Index: kernel_routes.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** kernel_routes.c 29 Nov 2007 18:10:17 -0000 1.32 --- kernel_routes.c 29 Nov 2007 22:21:26 -0000 1.33 *************** *** 152,156 **** } } ! if (0 <= ret && olsr_cnf->open_ipc) { ipc_route_send_rtentry( --- 152,156 ---- } } ! if (0 <= ret && olsr_cnf->ipc_connections > 0) { ipc_route_send_rtentry( From (spam-protected) Thu Nov 29 23:21:28 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 22:21:28 +0000 Subject: [Olsr-cvs] olsrd-current/src ipc_frontend.c, 1.42, 1.43 main.c, 1.106, 1.107 olsr_cfg.h, 1.41, 1.42 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7724/src Modified Files: ipc_frontend.c main.c olsr_cfg.h Log Message: "open_ipc" is only a boolean value containing "olsr_cnf->debug_level > 1". So I see no reason to keep that variable. Apart from the the attached patch makes the "#if" condition for the "rts" field identical to all other references to it. Index: olsr_cfg.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** olsr_cfg.h 29 Nov 2007 15:47:26 -0000 1.41 --- olsr_cfg.h 29 Nov 2007 22:21:26 -0000 1.42 *************** *** 193,197 **** olsr_bool willingness_auto; int ipc_connections; - olsr_bool open_ipc; olsr_bool use_hysteresis; struct hyst_param hysteresis_param; --- 193,196 ---- *************** *** 225,229 **** #if LINUX_POLICY_ROUTING int rtnl_s; /* Socket used for rtnetlink messages */ ! #else int rts; /* Socket used for route changes on BSDs */ #endif --- 224,230 ---- #if LINUX_POLICY_ROUTING int rtnl_s; /* Socket used for rtnetlink messages */ ! #endif ! ! #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__ int rts; /* Socket used for route changes on BSDs */ #endif Index: main.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** main.c 29 Nov 2007 00:49:38 -0000 1.106 --- main.c 29 Nov 2007 22:21:26 -0000 1.107 *************** *** 266,272 **** * Print configuration */ ! if(olsr_cnf->debug_level > 1) olsrd_print_cnf(olsr_cnf); ! #ifndef WIN32 /* Disable redirects globally */ --- 266,272 ---- * Print configuration */ ! if(olsr_cnf->debug_level > 1) { olsrd_print_cnf(olsr_cnf); ! } #ifndef WIN32 /* Disable redirects globally */ *************** *** 277,302 **** *socket for icotl calls */ ! if ((olsr_cnf->ioctl_s = socket(olsr_cnf->ip_version, SOCK_DGRAM, 0)) < 0) ! ! { ! olsr_syslog(OLSR_LOG_ERR, "ioctl socket: %m"); ! olsr_exit(__func__, 0); ! } #if LINUX_POLICY_ROUTING ! if ((olsr_cnf->rtnl_s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) ! { ! olsr_syslog(OLSR_LOG_ERR, "rtnetlink socket: %m"); ! olsr_exit(__func__, 0); ! } fcntl(olsr_cnf->rtnl_s, F_SETFL, O_NONBLOCK); #endif #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__ ! if ((olsr_cnf->rts = socket(PF_ROUTE, SOCK_RAW, 0)) < 0) ! { ! olsr_syslog(OLSR_LOG_ERR, "routing socket: %m"); ! olsr_exit(__func__, 0); ! } #endif --- 277,301 ---- *socket for icotl calls */ ! olsr_cnf->ioctl_s = socket(olsr_cnf->ip_version, SOCK_DGRAM, 0); ! if (olsr_cnf->ioctl_s < 0) { ! olsr_syslog(OLSR_LOG_ERR, "ioctl socket: %m"); ! olsr_exit(__func__, 0); ! } #if LINUX_POLICY_ROUTING ! olsr_cnf->rtnl_s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); ! if (olsr_cnf->rtnl_s < 0) { ! olsr_syslog(OLSR_LOG_ERR, "rtnetlink socket: %m"); ! olsr_exit(__func__, 0); ! } fcntl(olsr_cnf->rtnl_s, F_SETFL, O_NONBLOCK); #endif #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__ ! olsr_cnf->rts = socket(PF_ROUTE, SOCK_RAW, 0); ! if (olsr_cnf->rts < 0) { ! olsr_syslog(OLSR_LOG_ERR, "routing socket: %m"); ! olsr_exit(__func__, 0); ! } #endif *************** *** 373,379 **** /* Initialize the IPC socket */ ! if(olsr_cnf->open_ipc) ipc_init(); ! /* Initialisation of different tables to be used.*/ olsr_init_tables(); --- 372,378 ---- /* Initialize the IPC socket */ ! if (olsr_cnf->ipc_connections > 0) { ipc_init(); ! } /* Initialisation of different tables to be used.*/ olsr_init_tables(); *************** *** 486,491 **** /* front-end IPC socket */ ! if(olsr_cnf->open_ipc) shutdown_ipc(); /* OLSR sockets */ --- 485,491 ---- /* front-end IPC socket */ ! if (olsr_cnf->ipc_connections > 0) { shutdown_ipc(); + } /* OLSR sockets */ *************** *** 797,801 **** { cnf->ipc_connections = 1; - cnf->open_ipc = OLSR_TRUE; continue; } --- 797,800 ---- Index: ipc_frontend.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ipc_frontend.c 29 Nov 2007 18:10:12 -0000 1.42 --- ipc_frontend.c 29 Nov 2007 22:21:26 -0000 1.43 *************** *** 271,275 **** char *tmp; ! if (!olsr_cnf->open_ipc) { return -1; } --- 271,275 ---- char *tmp; ! if (olsr_cnf->ipc_connections <= 0) { return -1; } From (spam-protected) Thu Nov 29 23:40:13 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 22:40:13 +0000 Subject: [Olsr-cvs] olsrd-current CHANGELOG,1.120,1.121 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15753 Modified Files: CHANGELOG Log Message: * missed the changelog Index: CHANGELOG =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/CHANGELOG,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** CHANGELOG 29 Nov 2007 17:14:41 -0000 1.120 --- CHANGELOG 29 Nov 2007 22:40:11 -0000 1.121 *************** *** 151,154 **** --- 151,156 ---- (similar to thte IPv6 part). Manymore details on http://lists.olsr.org/pipermail/olsr-dev/2007-November/001464.html + - removed the superflous "open_ipc" field from the "struct olsrd_config" as + it contains only the equivalent of "olsr_cnf->debug_level > 1". 0.5.4 --------------------------------------------------------------------- From (spam-protected) Thu Nov 29 23:59:53 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 22:59:53 +0000 Subject: [Olsr-cvs] olsrd-current/src build_msg.c, 1.41, 1.42 duplicate_set.c, 1.21, 1.22 lq_packet.c, 1.34, 1.35 routing_table.c, 1.37, 1.38 tc_set.c, 1.39, 1.40 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23405/src Modified Files: build_msg.c duplicate_set.c lq_packet.c routing_table.c tc_set.c Log Message: * fixed warnings Index: duplicate_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/duplicate_set.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** duplicate_set.c 29 Nov 2007 18:10:11 -0000 1.21 --- duplicate_set.c 29 Nov 2007 22:59:50 -0000 1.22 *************** *** 64,68 **** * entries the timeoutfunction is only ran every 2 seconds */ ! olsr_register_scheduler_event_dijkstra(&olsr_time_out_duplicate_table, NULL, 2, 0, NULL); for(i = 0; i < HASHSIZE; i++) --- 64,68 ---- * entries the timeoutfunction is only ran every 2 seconds */ ! olsr_register_scheduler_event_dijkstra(&olsr_time_out_duplicate_table, NULL, 2.0, 0.0, NULL); for(i = 0; i < HASHSIZE; i++) Index: lq_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** lq_packet.c 29 Nov 2007 18:10:13 -0000 1.34 --- lq_packet.c 29 Nov 2007 22:59:50 -0000 1.35 *************** *** 580,584 **** hello->neighbors = NULL; ! limit = ser + size; while (curr < limit) { const struct lq_hello_info_header *info_head = (const struct lq_hello_info_header *)curr; --- 580,584 ---- hello->neighbors = NULL; ! limit = ((const unsigned char *)ser) + size; while (curr < limit) { const struct lq_hello_info_header *info_head = (const struct lq_hello_info_header *)curr; Index: tc_set.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tc_set.c 29 Nov 2007 18:10:17 -0000 1.39 --- tc_set.c 29 Nov 2007 22:59:51 -0000 1.40 *************** *** 754,758 **** * if the edge exists in order to avoid address validation. */ ! limit = (void *)msg + size; while (curr < limit) { if (olsr_tc_update_edge(tc, vtime_s, ansn, type, &curr)) { --- 754,758 ---- * if the edge exists in order to avoid address validation. */ ! limit = (unsigned char *)msg + size; while (curr < limit) { if (olsr_tc_update_edge(tc, vtime_s, ansn, type, &curr)) { Index: build_msg.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** build_msg.c 29 Nov 2007 18:10:11 -0000 1.41 --- build_msg.c 29 Nov 2007 22:59:50 -0000 1.42 *************** *** 61,64 **** --- 61,66 ---- #define OLSR_HNA_IPV6_HDRSIZE OLSR_IPV6_HDRSIZE + static void + check_buffspace(int msgsize, int buffsize, const char *type); /* All these functions share this buffer */ *************** *** 242,247 **** if(msgsize > buffsize) { ! OLSR_PRINTF(1, "%s build, outputbuffer to small(%d/%d)!\n", type, msgsize, buffsize); ! olsr_syslog(OLSR_LOG_ERR, "%s build, outputbuffer to small(%d/%d)!\n", type, msgsize, buffsize); olsr_exit(__func__, EXIT_FAILURE); } --- 244,249 ---- if(msgsize > buffsize) { ! OLSR_PRINTF(1, "%s build, outputbuffer to small(%d/%u)!\n", type, msgsize, buffsize); ! olsr_syslog(OLSR_LOG_ERR, "%s build, outputbuffer to small(%d/%u)!\n", type, msgsize, buffsize); olsr_exit(__func__, EXIT_FAILURE); } Index: routing_table.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** routing_table.c 29 Nov 2007 18:10:17 -0000 1.37 --- routing_table.c 29 Nov 2007 22:59:51 -0000 1.38 *************** *** 123,132 **** avl_comp_ipv6_prefix (const void *prefix1, const void *prefix2) { - int res; const struct olsr_ip_prefix *pfx1 = prefix1; const struct olsr_ip_prefix *pfx2 = prefix2; /* prefix */ ! res = memcmp(&pfx1->prefix.v6, &pfx2->prefix.v6, 16); if (res != 0) { return res; --- 123,131 ---- avl_comp_ipv6_prefix (const void *prefix1, const void *prefix2) { const struct olsr_ip_prefix *pfx1 = prefix1; const struct olsr_ip_prefix *pfx2 = prefix2; /* prefix */ ! int res = ip6cmp(&pfx1->prefix.v6, &pfx2->prefix.v6); if (res != 0) { return res; *************** *** 353,357 **** /* walk all remaining originator entries */ ! while ((node = avl_walk_next(node))) { struct rt_path *rtp = node->data; --- 352,356 ---- /* walk all remaining originator entries */ ! while ((node = avl_walk_next(node)) != NULL) { struct rt_path *rtp = node->data; From (spam-protected) Fri Nov 30 00:03:09 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 23:03:09 +0000 Subject: [Olsr-cvs] olsrd-current/src rebuild_packet.h, 1.10, 1.11 rebuild_packet.c, 1.27, 1.28 process_package.c, 1.48, 1.49 packet.h, 1.19, 1.20 packet.c, 1.28, 1.29 lq_packet.h, 1.10, 1.11 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23889/src Modified Files: rebuild_packet.h rebuild_packet.c process_package.c packet.h packet.c lq_packet.h Log Message: - killed hna_chgestruct to reduce malloc()/free() churn Index: lq_packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** lq_packet.h 16 Nov 2007 22:56:54 -0000 1.10 --- lq_packet.h 29 Nov 2007 23:03:07 -0000 1.11 *************** *** 46,49 **** --- 46,50 ---- #include "packet.h" #include "mantissa.h" + #include "ipcalc.h" #define LQ_HELLO_MESSAGE 201 *************** *** 142,154 **** }; ! static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(const olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(const olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(const olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(const olsr_8_t *)(*p); *p += sizeof(olsr_8_t); } ! static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(const olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); } ! static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(const olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); } ! static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (const double)**p / 255.0; *p += sizeof(olsr_u8_t); } static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); } --- 143,156 ---- }; ! static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(const olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(const olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(const olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(const olsr_8_t *)(*p); *p += sizeof(olsr_8_t); } ! static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(const olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); } ! static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(const olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); } ! static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_get_prefixlen(const olsr_u8_t **p, olsr_u8_t *var) { *var = netmask_to_prefix(*p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (const double)**p / 255.0; *p += sizeof(olsr_u8_t); } static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); } *************** *** 159,172 **** static INLINE void pkt_ignore_s32(const olsr_u8_t **p) { *p += sizeof(olsr_32_t); } static INLINE void pkt_ignore_ipaddress(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; } ! static INLINE void pkt_put_u8(olsr_u8_t **p, const olsr_u8_t var) { *(olsr_u8_t *)(*p) = var; *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_put_u16(olsr_u8_t **p, const olsr_u16_t var) { *(olsr_u16_t *)(*p) = htons(var); *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_put_u32(olsr_u8_t **p, const olsr_u32_t var) { *(olsr_u32_t *)(*p) = htonl(var); *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_put_s8(olsr_u8_t **p, const olsr_8_t var) { *(olsr_8_t *)(*p) = var; *p += sizeof(olsr_8_t); } ! static INLINE void pkt_put_s16(olsr_u8_t **p, const olsr_16_t var) { *(olsr_16_t *)(*p) = htons(var); *p += sizeof(olsr_16_t); } ! static INLINE void pkt_put_s32(olsr_u8_t **p, const olsr_32_t var) { *(olsr_32_t *)(*p) = htonl(var); *p += sizeof(olsr_32_t); } ! static INLINE void pkt_put_double(olsr_u8_t **p, const double var) { **p = double_to_me(var); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_put_ipaddress(olsr_u8_t **p, const union olsr_ip_addr var) { memcpy(*p, &var, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_put_lq(olsr_u8_t **p, const double var) { **p = var * 255.0; *p += sizeof(olsr_u8_t); } void olsr_output_lq_hello(void *para); --- 161,176 ---- static INLINE void pkt_ignore_s32(const olsr_u8_t **p) { *p += sizeof(olsr_32_t); } static INLINE void pkt_ignore_ipaddress(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; } + static INLINE void pkt_ignore_prefixlen(const olsr_u8_t **p) { *p += olsr_cnf->ipsize; } ! static INLINE void pkt_put_u8(olsr_u8_t **p, olsr_u8_t var) { *(olsr_u8_t *)(*p) = var; *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_put_u16(olsr_u8_t **p, olsr_u16_t var) { *(olsr_u16_t *)(*p) = htons(var); *p += sizeof(olsr_u16_t); } ! static INLINE void pkt_put_u32(olsr_u8_t **p, olsr_u32_t var) { *(olsr_u32_t *)(*p) = htonl(var); *p += sizeof(olsr_u32_t); } ! static INLINE void pkt_put_s8(olsr_u8_t **p, olsr_8_t var) { *(olsr_8_t *)(*p) = var; *p += sizeof(olsr_8_t); } ! static INLINE void pkt_put_s16(olsr_u8_t **p, olsr_16_t var) { *(olsr_16_t *)(*p) = htons(var); *p += sizeof(olsr_16_t); } ! static INLINE void pkt_put_s32(olsr_u8_t **p, olsr_32_t var) { *(olsr_32_t *)(*p) = htonl(var); *p += sizeof(olsr_32_t); } ! static INLINE void pkt_put_double(olsr_u8_t **p, double var) { **p = double_to_me(var); *p += sizeof(olsr_u8_t); } ! static INLINE void pkt_put_ipaddress(olsr_u8_t **p, const union olsr_ip_addr *var) { memcpy(*p, var, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_put_prefixlen(olsr_u8_t **p, olsr_u8_t var) { prefix_to_netmask(*p, olsr_cnf->ipsize, var); *p += olsr_cnf->ipsize; } ! static INLINE void pkt_put_lq(olsr_u8_t **p, double var) { **p = var * 255.0; *p += sizeof(olsr_u8_t); } void olsr_output_lq_hello(void *para); Index: packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/packet.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** packet.h 29 Nov 2007 00:49:39 -0000 1.19 --- packet.h 29 Nov 2007 23:03:07 -0000 1.20 *************** *** 91,121 **** /* - *HNA message format: - *NET - *NETMASK - *NET - *NETMASK - *...... - */ - - struct hna_net_addr - { - union olsr_ip_addr net; - olsr_u8_t prefixlen; - struct hna_net_addr *next; - }; - - - struct hna_message - { - double vtime; - union olsr_ip_addr originator; - olsr_u16_t packet_seq_number; - olsr_u8_t hop_count; - struct hna_net_addr *hna_net; - }; - - - /* *MID messages - format: * --- 91,94 ---- *************** *** 167,172 **** olsr_free_mid_packet(struct mid_message *); - void - olsr_free_hna_packet(struct hna_message *); - #endif --- 140,142 ---- Index: rebuild_packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** rebuild_packet.c 29 Nov 2007 18:10:17 -0000 1.27 --- rebuild_packet.c 29 Nov 2007 23:03:07 -0000 1.28 *************** *** 40,44 **** */ - #include "rebuild_packet.h" #include "ipcalc.h" --- 40,43 ---- *************** *** 50,165 **** /** - *Process/rebuild HNA message. Converts the OLSR - *packet to the internal hna_message format. - *@param hmsg the hna_message struct in wich infomation - *is to be put. - *@param m the entire OLSR message revieved. - *@return negative on error - */ - - void - hna_chgestruct(struct hna_message *hmsg, const union olsr_message *m) - { - struct hna_net_addr *hna_pairs, *tmp_pairs; - int no_pairs, i; - - /*Check if everyting is ok*/ - if ((!m) || (m->v4.olsr_msgtype != HNA_MESSAGE)) - return; - - - if(olsr_cnf->ip_version == AF_INET) - { - /* IPv4 */ - const struct hnapair *haddr = m->v4.message.hna.hna_net; - - /* - * How many HNA pairs? - * nextmsg contains size of - * the addresses + 12 bytes(nextmessage, from address and the header) - */ - no_pairs = (ntohs(m->v4.olsr_msgsize) - 12) / 8; - - hmsg->originator.v4.s_addr = m->v4.originator; - - hmsg->packet_seq_number = ntohs(m->v4.seqno); - hmsg->hop_count = m->v4.hopcnt; - - //printf("HNA from %s\n\n", olsr_ip_to_string(&buf, (union olsr_ip_addr *)&hmsg->originator)); - - /* Get vtime */ - hmsg->vtime = me_to_double(m->v4.olsr_vtime); - - tmp_pairs = NULL; - hna_pairs = NULL; - - for(i = 0; i < no_pairs; i++) { - hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct"); - - hna_pairs->net.v4.s_addr = haddr->addr; - hna_pairs->prefixlen = olsr_netmask4_to_prefix(&haddr->netmask); - - hna_pairs->next = tmp_pairs; - tmp_pairs = hna_pairs; - haddr++; - } - } - else - { - /* IPv6 */ - const struct hnapair6 *haddr6 = m->v6.message.hna.hna_net; - - /* - * How many HNA pairs? - * nextmsg contains size of - * the addresses + 12 bytes(nextmessage, from address and the header) - */ - no_pairs = (ntohs(m->v6.olsr_msgsize) - 24) / 32; /* NB 32 not 8 */ - - hmsg->originator.v6 = m->v6.originator; - hmsg->packet_seq_number = ntohs(m->v6.seqno); - hmsg->hop_count = m->v6.hopcnt; - - /* Get vtime */ - hmsg->vtime = me_to_double(m->v6.olsr_vtime); - - tmp_pairs = NULL; - hna_pairs = NULL; - - for(i = 0; i < no_pairs; i++) - { - - hna_pairs = olsr_malloc(sizeof(struct hna_net_addr), "HNA chgestruct 2"); - - hna_pairs->net.v6 = haddr6->addr; - hna_pairs->prefixlen = olsr_netmask6_to_prefix(&haddr6->netmask); - - hna_pairs->next = tmp_pairs; - - tmp_pairs = hna_pairs; - haddr6++; - } - } - - /* - tmp_pairs = hna_pairs; - - while(tmp_pairs) - { - printf("\t net: %s ", ip_to_string(&tmp_pairs->net)); - printf("\t mask: %s\n", ip_to_string(&tmp_pairs->netmask)); - tmp_pairs = tmp_pairs->next; - } - printf("\n"); - */ - - - - hmsg->hna_net = hna_pairs; - - } - - - /** *Process/rebuild MID message. Converts the OLSR *packet to the internal mid_message format. --- 49,52 ---- Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** process_package.c 29 Nov 2007 18:10:17 -0000 1.48 --- process_package.c 29 Nov 2007 23:03:07 -0000 1.49 *************** *** 56,59 **** --- 56,60 ---- #include "net_olsr.h" + #include static void process_message_neighbors(struct neighbor_entry *, const struct hello_message *); *************** *** 672,677 **** union olsr_ip_addr *from_addr) { ! struct hna_net_addr *hna_tmp; ! struct hna_message message; #ifdef DEBUG --- 673,687 ---- union olsr_ip_addr *from_addr) { ! ! olsr_u8_t olsr_msgtype; ! double vtime; ! olsr_u16_t olsr_msgsize; ! union olsr_ip_addr originator; ! //olsr_u8_t ttl; unused ! olsr_u8_t hop_count; ! olsr_u16_t packet_seq_number; ! ! int hnasize; ! const olsr_u8_t *curr, *curr_end; #ifdef DEBUG *************** *** 679,694 **** #endif ! hna_chgestruct(&message, m); ! if(!olsr_validate_address(&message.originator)) { ! olsr_free_hna_packet(&message); return; } ! if (olsr_check_dup_table_proc(&message.originator, ! message.packet_seq_number)) { ! hna_tmp = message.hna_net; /* * If the sender interface (NB: not originator) of this message --- 689,738 ---- #endif ! /* Check if everyting is ok */ ! if (!m) { ! return; ! } ! curr = (const olsr_u8_t *)m; ! /* olsr_msgtype */ ! pkt_get_u8(&curr, &olsr_msgtype); ! if (olsr_msgtype != HNA_MESSAGE) { ! OLSR_PRINTF(0, "not a HNA message!\n"); return; } + /* Get vtime */ + pkt_get_double(&curr, &vtime); ! /* olsr_msgsize */ ! pkt_get_u16(&curr, &olsr_msgsize); ! hnasize = olsr_msgsize - (olsr_cnf->ip_version == AF_INET ? offsetof(struct olsrmsg, message) : offsetof(struct olsrmsg6, message)); ! if (hnasize < 0) { ! OLSR_PRINTF(0, "message size %d too small (at least %d)!\n", olsr_msgsize, (olsr_cnf->ip_version == AF_INET ? offsetof(struct olsrmsg, message) : offsetof(struct olsrmsg6, message))); ! return; ! } ! if ((hnasize % (2 * olsr_cnf->ipsize)) != 0) { ! OLSR_PRINTF(0, "Illegal message size %d!\n", olsr_msgsize); ! return; ! } ! curr_end = (const olsr_u8_t *)m + olsr_msgsize; ! /* validate originator */ ! pkt_get_ipaddress(&curr, &originator); ! //printf("HNA from %s\n\n", olsr_ip_to_string(&buf, &originator)); ! if (!olsr_validate_address(&originator)) { ! OLSR_PRINTF(0, "invalid address!\n"); ! return; ! } ! ! /* ttl */ ! pkt_ignore_u8(&curr); ! ! /* hopcnt */ ! pkt_get_u8(&curr, &hop_count); ! ! /* seqno */ ! pkt_get_u16(&curr, &packet_seq_number); + if (olsr_check_dup_table_proc(&originator, packet_seq_number)) { /* * If the sender interface (NB: not originator) of this message *************** *** 696,723 **** * message MUST be discarded. */ ! if(check_neighbor_link(from_addr) != SYM_LINK) { #ifndef NODEBUG struct ipaddr_str buf; #endif OLSR_PRINTF(2, "Received HNA from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); - olsr_free_hna_packet(&message); return; } while (hna_tmp) { /* Don't add an HNA entry that we are advertising ourselves. */ if (!ip_prefix_list_find(olsr_cnf->hna_entries, &hna_tmp->net, hna_tmp->prefixlen)) { olsr_update_hna_entry(&message.originator, &hna_tmp->net, hna_tmp->prefixlen, message.vtime); } - - hna_tmp = hna_tmp->next; } } - olsr_forward_message(m, ! &message.originator, ! message.packet_seq_number, ! in_if, ! from_addr); ! olsr_free_hna_packet(&message); } --- 740,775 ---- * message MUST be discarded. */ ! if (check_neighbor_link(from_addr) != SYM_LINK) { #ifndef NODEBUG struct ipaddr_str buf; #endif OLSR_PRINTF(2, "Received HNA from NON SYM neighbor %s\n", olsr_ip_to_string(&buf, from_addr)); return; } + #if 1 + while (curr < curr_end) { + union olsr_ip_addr net; + olsr_u8_t prefixlen; + struct ip_prefix_list *entry; + pkt_get_ipaddress(&curr, &net); + pkt_get_prefixlen(&curr, &prefixlen); + entry = ip_prefix_list_find(olsr_cnf->hna_entries, &net, prefixlen); + if (entry == NULL) { + /* only update if it's not from us */ + olsr_update_hna_entry(&originator, &net, prefixlen, vtime); + #else while (hna_tmp) { /* Don't add an HNA entry that we are advertising ourselves. */ if (!ip_prefix_list_find(olsr_cnf->hna_entries, &hna_tmp->net, hna_tmp->prefixlen)) { olsr_update_hna_entry(&message.originator, &hna_tmp->net, hna_tmp->prefixlen, message.vtime); + #endif } } } olsr_forward_message(m, ! &originator, ! packet_seq_number, ! in_if, ! from_addr); } Index: rebuild_packet.h =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** rebuild_packet.h 16 Nov 2007 21:43:55 -0000 1.10 --- rebuild_packet.h 29 Nov 2007 23:03:07 -0000 1.11 *************** *** 50,56 **** void - hna_chgestruct(struct hna_message *, const union olsr_message *); - - void mid_chgestruct(struct mid_message *, const union olsr_message *); --- 50,53 ---- Index: packet.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/packet.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** packet.c 29 Nov 2007 18:10:16 -0000 1.28 --- packet.c 29 Nov 2007 23:03:07 -0000 1.29 *************** *** 439,468 **** } - - /** - *Free the memory allocated for a HNA packet. - * - *@param message the pointer to the packet to erase - * - *@return nada - */ - - void - olsr_free_hna_packet(struct hna_message *message) - { - struct hna_net_addr *hna_tmp, *hna_tmp2; - - hna_tmp = message->hna_net; - - while(hna_tmp) - { - hna_tmp2 = hna_tmp; - hna_tmp = hna_tmp->next; - free(hna_tmp2); - } - } - - - /** *Free the memory allocated for a MID packet. --- 439,442 ---- From (spam-protected) Fri Nov 30 00:03:53 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 23:03:53 +0000 Subject: [Olsr-cvs] olsrd-current Makefile.inc,1.46,1.47 Message-ID: Update of /cvsroot/olsrd/olsrd-current In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25075 Modified Files: Makefile.inc Log Message: * added more warnings Index: Makefile.inc =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** Makefile.inc 19 Nov 2007 14:35:10 -0000 1.46 --- Makefile.inc 29 Nov 2007 23:03:48 -0000 1.47 *************** *** 76,81 **** WARNINGS += -Wwrite-strings WARNINGS += -Wbad-function-cast ! #WARNINGS += -Wpointer-arith WARNINGS += -Wcast-qual #WARNINGS += -Wcast-align #WARNINGS += -Wconversion --- 76,84 ---- WARNINGS += -Wwrite-strings WARNINGS += -Wbad-function-cast ! WARNINGS += -Wpointer-arith WARNINGS += -Wcast-qual + # the following 5 do not work yet + #WARNINGS += -Wshadow + #WARNINGS += -Wpointer-arith #WARNINGS += -Wcast-align #WARNINGS += -Wconversion From (spam-protected) Fri Nov 30 00:40:10 2007 From: (spam-protected) (Bernd Petrovitsch) Date: Thu, 29 Nov 2007 23:40:10 +0000 Subject: [Olsr-cvs] olsrd-current/src process_package.c,1.49,1.50 Message-ID: Update of /cvsroot/olsrd/olsrd-current/src In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6895/src Modified Files: process_package.c Log Message: * fixed a warning on 64bit Index: process_package.c =================================================================== RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** process_package.c 29 Nov 2007 23:03:07 -0000 1.49 --- process_package.c 29 Nov 2007 23:40:08 -0000 1.50 *************** *** 708,712 **** hnasize = olsr_msgsize - (olsr_cnf->ip_version == AF_INET ? offsetof(struct olsrmsg, message) : offsetof(struct olsrmsg6, message)); if (hnasize < 0) { ! OLSR_PRINTF(0, "message size %d too small (at least %d)!\n", olsr_msgsize, (olsr_cnf->ip_version == AF_INET ? offsetof(struct olsrmsg, message) : offsetof(struct olsrmsg6, message))); return; } --- 708,712 ---- hnasize = olsr_msgsize - (olsr_cnf->ip_version == AF_INET ? offsetof(struct olsrmsg, message) : offsetof(struct olsrmsg6, message)); if (hnasize < 0) { ! OLSR_PRINTF(0, "message size %d too small (at least %lu)!\n", olsr_msgsize, (unsigned long)(olsr_cnf->ip_version == AF_INET ? offsetof(struct olsrmsg, message) : offsetof(struct olsrmsg6, message))); return; }