Patchbomb Day on olsr-cvs@
Yesterday was another patch bomb day after having various patches in various checked out CVS trees:
- I added a few bug fix patches and ennacements by Sven-Ola Tücke <mail2news@commando.de>. Thanks - especially for fixing bugs introduced by me;-)
- Together with helpful BSD and MacOSX people (G.Fischer@vt.TU-Berlin.DE, Patrick McCarty <mccartyp@gmail.com>, Aaron Kaplan <aaron@lo-res.org>) we got at one point the FreeBSD port compiling and fixed thus most of the code for all BSDs. BTW Aaron is working to get qemu instances of the various BSDs running.
- I fixed a few warnings and converted more files to UTF-8.
- I killed the netmasks for IPv4 (so it gets more similar to IPv6). Not 100% but all in the core and most ofthe rest. Another review doesn't hurt though.
- And I simplified the implementations around removing three more structs + code handling them.
- I removed the last comments with the (commented out) COPY_IP() and COMP_IP() macros. Since there was another instance of that macro in the olsr_switch, I cleand up there too a little bit, and removed duplicated functions etc.
- "open_ipc" is only a boolean value containing "olsr_cnf->debug_level > 1". So I saw no reason to keep that variable and killed it.
- And I killed the "hna_chgestruct" function (read: inlined it in the only callers place, replace the used struct with sequential pointer walking while checking and handling the data - no temporary allocated list any more) to reduce malloc()/free() churn. There area few more to go.
More Ongoing Work
Changes in the last days:
- Hannes almost nailed down a bug. And I gave him the finishing shot.
- I saved some run-time bytes with small reordering in various structs to reduce padding bytes. Much more could be saved it the "enum olsr_bool" is replaced by an "unsigned char" or bit fields.
- http://bernd.petrovitsch.priv.at/olsr-ng/kill-hna_chgestruct.patch kills superflous malloc()/free() calls. Actually all of the *_chgestruct() function should be (virtually) inlined at their only call site and resolved. This would save a lot of code and run-time performance and we loose only a useless abstraction layer.
- http://bernd.petrovitsch.priv.at/olsr-ng/kill-netmasks.patch:
- changes the internal behaviour to use the prefix_len also for IPv4 (similar to IPV6). This simplifies and reduces the code since IPv4 and IPv6 are now much more similar. It is not perfect but it works and the rest can be fixed later.
- And it has some other improvements here and there.
And as always: the CVS logs contain the full stories. And the olsr-dev@olsr.org mailing list is the right address to ask and comment on!
funkfeuer has a new 3D map
Markus Kittenberger (nord27) programmed a very cool new 3D map with a clever google earth map hack!
In this map you can easily see how much the fresnell zone is cut off. So this way you can plan links based on google earth's height map.
try it out yourself.
Congrats, Markus!
(aaron)
More Cleanups
I just committed more code cleanups:. To quote from the CVS commit messages:
- 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 for the avl tree comparison functions and use it!
- cleanup: compare tree->comp to NULL as it is a pointer
- killed superflous "return"s at the end of void functions
- const'ified ipc_route_send_rtentry()
- const'ified olsr_ioctl_{add,del}_route{,6}(). There are probably a few "const" missing for win32 and BSD.
- 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 for 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().
- 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.
Another major cleanup: Fixed the definiton of "v4" in olsr_ip_addr
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!