[Olsr-cvs] olsrd-current/lib/quagga/src olsrd_plugin.c, 1.8, 1.9 quagga.c, 1.9, 1.10
Bernd Petrovitsch
(spam-protected)
Thu Nov 8 23:47:42 CET 2007
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;
More information about the Olsr-cvs
mailing list