batmand_0.3~r875 debian packages available
Subsystems (2)
Hi,
yesterday night I've uploaded 0.3 svn r875 packages to Debian experimental, they are also available at http://layer-acht.org/batmand/ for etch and sid.
Feedback welcome!
regards,
Holger
Hello,
the URL is broken, i guess the right URL is
http://layer-acht.org/batman/
?
Best regards,
Simon
Quoted 17 lines · Holger Levsen
Hi,
yesterday night I've uploaded 0.3 svn r875 packages to Debian experimental, they are also available at http://layer-acht.org/batmand/ for etch and sid.
Feedback welcome!
regards,
Holger_______________________________________________
B.A.T.M.A.N mailing list
[email protected]
https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n
Hi,
Quoted 2 lines · Simon Wunderlich
the URL is broken, i guess the right URL is
http://layer-acht.org/batman/
well yes, and no :-) It's batmand now (as the package name). Thanks for noticing!
regards,
Holger
[B.A.T.M.A.N.] Quagga zebra API client for BATMAN
In reply to Simon WunderlichHello ppl,
I've added support to send BATMAN routes to zebra daemon and redistribute them to other Quagga protocols. The interface is through zebra UNIX socket. A new option -q followed by the UNIX socket path is added (see batmand --help) to enable route export. I've also implemented a metric for BATMAN routes based on TTL value which is essential when using BATMAN as IGP to BGP Confederations.
I hope that you find it useful.
The attached patches are against latest stable BATMAN release (revsion 502) and Quagga 0.98.6.
Regards,
Vasilis
batman.c +10 -3
@@ -3,6 +3,9 @@* Thomas Lopatic, Corinna 'Elektra' Aichele, Axel Neumann, * Felix Fietkau, Marek Lindner * +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -83,6 +86,7 @@*/ uint8_t routing_class =0 ; +uint8_t quagga_export =0 ;int16_t orginator_interval =1000 ;/* orginator message interval in miliseconds */
@@ -131,6 +135,7 @@fprintf ( stderr," -H verbose help\n" );fprintf ( stderr," -o orginator interval in ms\n" );fprintf ( stderr," -p preferred gateway\n" ); +fprintf ( stderr," -q quagga unix socket\n" );fprintf ( stderr," -r routing class\n" );fprintf ( stderr," -s visualisation server\n" );fprintf ( stderr," -v print version\n" );
@@ -171,6 +176,8 @@fprintf ( stderr," default: 1000, allowed values: >0\n\n" );fprintf ( stderr," -p preferred gateway\n" );fprintf ( stderr," default: none, allowed values: IP\n\n" ); +fprintf ( stderr," -q quagga unix socket\n" ); +fprintf ( stderr," default: none, allowed values: Socket Path\n\n" );fprintf ( stderr," -r routing class (only needed if gateway class = 0)\n" );fprintf ( stderr," default: 0 -> set no default route\n" );fprintf ( stderr," allowed values: 1 -> use fast internet connection\n" );
@@ -196,7 +203,7 @@ netmask = (uint32_t )orig_node->hna_buff[ ( hna_buff_count *5 ) +4 ];if ( ( netmask >0 ) && ( netmask <33 ) ) -add_del_route ( hna, netmask, orig_node->router->addr, del, orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); +add_del_route ( hna, netmask, orig_node->router->addr, orig_node->metric, del, orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); hna_buff_count++;
@@ -373,7 +380,7 @@if ( orig_node->hna_buff_len >0 )add_del_hna ( orig_node,1 ); -add_del_route ( orig_node->orig,32 , orig_node->router->addr,1 , orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); +add_del_route ( orig_node->orig,32 , orig_node->router->addr, orig_node->metric,1 , orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); }
@@ -386,7 +393,7 @@debug_output (4 ,"Route changed \n" ); } -add_del_route ( orig_node->orig,32 , neigh_node->addr,0 , neigh_node->if_incoming->dev, neigh_node->if_incoming->udp_send_sock ); +add_del_route ( orig_node->orig,32 , neigh_node->addr, orig_node->metric,0 , neigh_node->if_incoming->dev, neigh_node->if_incoming->udp_send_sock ); orig_node->batman_if = neigh_node->if_incoming; orig_node->router = neigh_node;
batman.h +8 -1
@@ -1,6 +1,10 @@/* * Copyright (C) 2006 B.A.T.M.A.N. contributors: * Thomas Lopatic, Corinna 'Elektra' Aichele, Axel Neumann, Marek Lindner +* +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -32,6 +36,7 @@#include "hash.h" #include "allocate.h" #include "profile.h" +#include "quagga.h"
@@ -62,7 +67,7 @@#define JITTER 100#define TTL 50/* Time To Live of broadcast messages */ #define BIDIRECT_TIMEOUT 2 -#define PURGE_TIMEOUT 200000/* purge originators after time in ms if no valid packet comes in -> TODO: check influence on SEQ_RANGE */ +#define PURGE_TIMEOUT 20000/* purge originators after time in ms if no valid packet comes in -> TODO: check influence on SEQ_RANGE */ #define SEQ_RANGE 128/* sliding packet range of received orginator messages in squence numbers (should be a multiple of our word size) */
@@ -78,6 +83,7 @@extern uint8_t num_hna;extern int16_t orginator_interval;extern uint32_t pref_gateway; +extern uint8_t quagga_export;extern unsigned char *hna_buff;
@@ -125,6 +131,7 @@int16_t hna_buff_len;uint16_t last_seqno;/* last and best known squence number */ struct list_head neigh_list; +uint16_t metric; };struct neigh_node
linux-specific.c +7 -3
@@ -1,6 +1,10 @@/* * Copyright (C) 2006 BATMAN contributors: * Thomas Lopatic +* +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -43,7 +47,7 @@#include "batman-specific.h" -void add_del_route (uint32_t dest,uint16_t netmask,uint32_t router,int8_t del,char *dev,int32_t sock ) { +void add_del_route (uint32_t dest,uint16_t netmask,uint32_t router,uint16_t metric,int8_t del,char *dev,int32_t sock ) {struct rtentry route;char str1[16 ], str2[16 ];
@@ -65,7 +69,7 @@ addr->sin_addr.s_addr = ( netmask ==32 ?0xffffffff :htonl ( ~ (0xffffffff >> netmask ) ) ); route.rt_flags = ( netmask ==32 ? (RTF_HOST |RTF_UP ) :RTF_UP ); - route.rt_metric =1 ; + route.rt_metric = metric;if ( ( dest != router ) || ( ( dest ==0 ) && ( router ==0 ) ) ) {
@@ -99,7 +103,7 @@ route.rt_dev = dev; -if (ioctl ( sock, del ?SIOCDELRT :SIOCADDRT , &route ) <0 ) +if ( (quagga_export ?zebra_add_del_route ( &route, del ) :ioctl ( sock, del ?SIOCDELRT :SIOCADDRT , &route )) <0 )debug_output (0 ,"Error - can't %s route to %s/%i via %s: %s\n" , del ?"delete" :"add" , str1, netmask, str2,strerror (errno) ); }
Makefile +5 -2
@@ -1,6 +1,9 @@ # # Copyright (C) 2006 BATMAN contributors # +# This file was modified from the original on 30/12/2007 +# by Vasilis Tsiligiannis <[email protected]> +# # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License as published by the Free Software Foundation.
@@ -45,8 +48,8 @@ LOG_BRANCH= branches/batman-0.2.x -LINUX_SRC_C= batman.c originator.c schedule.c posix-specific.c posix.c allocate.c bitarray.c hash.c profile.c $(OS_C) -LINUX_SRC_H= batman.h originator.h schedule.h batman-specific.h list.h os.h allocate.h bitarray.h hash.h profile.h +LINUX_SRC_C= batman.c originator.c schedule.c posix-specific.c posix.c allocate.c bitarray.c hash.c profile.c quagga.c $(OS_C) +LINUX_SRC_H= batman.h originator.h schedule.h batman-specific.h list.h os.h allocate.h bitarray.h hash.h profile.h quagga.h BINARY_NAME= batmand SOURCE_VERSION_HEADER= batman.h
originator.c +4 -1
@@ -88,6 +88,7 @@ orig_node->orig = addr; orig_node->router =NULL ; orig_node->batman_if =NULL ; + orig_node->metric =TTL ; orig_node->bidirect_link =debugMalloc ( found_ifs *sizeof (uint16_t ),402 );memset ( orig_node->bidirect_link,0 , found_ifs *sizeof (uint16_t ) );
@@ -196,6 +197,8 @@ } + orig_node->metric =TTL +1 - in->ttl; +/* update routing table and check for changed hna announcements */ update_routes ( orig_node, best_neigh_node, hna_recv_buff, hna_buff_len );
@@ -296,7 +299,7 @@if ( orig_node->hna_buff_len >0 )add_del_hna ( orig_node,1 ); -add_del_route ( orig_node->orig,32 , orig_node->router->addr,1 , orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); +add_del_route ( orig_node->orig,32 , orig_node->router->addr, orig_node->metric,1 , orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); orig_node->router =NULL ;
originator.h +3 -0
@@ -1,6 +1,9 @@/* Copyright (C) 2006 B.A.T.M.A.N. contributors: * Simon Wunderlich, Marek Lindner * +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
os.h +5 -1
@@ -1,6 +1,10 @@/* * Copyright (C) 2006 BATMAN contributors: * Thomas Lopatic, Marek Lindner +* +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -41,7 +45,7 @@void set_send_redirects (int32_t state,char * dev );int32_t get_send_redirects (char *dev ); -void add_del_route (uint32_t dest,uint16_t netmask,uint32_t router,int8_t del,char *dev,int32_t sock ); +void add_del_route (uint32_t dest,uint16_t netmask,uint32_t router,uint16_t metric,int8_t del,char *dev,int32_t sock );void add_del_hna (struct orig_node *orig_node,int8_t del );int8_t is_aborted ();void handler (int32_t sig );
posix-specific.c +21 -3
@@ -1,6 +1,10 @@/* * Copyright (C) 2006 BATMAN contributors: * Thomas Lopatic, Marek Lindner +* +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -437,6 +441,7 @@struct hna_node *hna_node;struct debug_level_info *debug_level_info;uint8_t found_args =1 , batch_mode =0 ; +char *zebra_sock_path =NULL ;uint16_t netmask;int8_t res;
@@ -449,7 +454,7 @@ stop =0 ; -while ( ( optchar =getopt ( argc, argv,"a:bcd:hHo:g:p:r:s:vV" ) ) !=-1 ) { +while ( ( optchar =getopt ( argc, argv,"a:bcd:hHo:g:p:r:s:vVq:" ) ) !=-1 ) {switch ( optchar ) {
@@ -624,6 +629,16 @@exit (EXIT_SUCCESS ); +case 'q' : + + errno =0 ; + + quagga_export++; + zebra_sock_path = optarg; + + found_args +=2 ; +break ; +case 'h' :default :usage ();
@@ -899,6 +914,9 @@ } +if ( ( quagga_export !=0 ) && ( !zebra_init (zebra_sock_path) ) ) +exit (EXIT_FAILURE ); + }
@@ -1159,7 +1177,7 @@if (add_dev_tun ( curr_gw_data->batman_if, curr_gw_data->batman_if->addr.sin_addr.s_addr, curr_gateway_tun_if,sizeof (curr_gateway_tun_if), &curr_gateway_tun_fd ) >0 ) { -add_del_route (0 ,0 ,0 ,0 , curr_gateway_tun_if, curr_gw_data->batman_if->udp_send_sock ); +add_del_route (0 ,0 ,0 ,0 ,0 , curr_gateway_tun_if, curr_gw_data->batman_if->udp_send_sock ); }else {
@@ -1298,7 +1316,7 @@ }/* cleanup */ -add_del_route (0 ,0 ,0 ,1 , curr_gateway_tun_if, curr_gw_data->batman_if->udp_send_sock ); +add_del_route (0 ,0 ,0 ,0 ,1 , curr_gateway_tun_if, curr_gw_data->batman_if->udp_send_sock );close ( curr_gateway_tcp_sock );close ( curr_gateway_tun_sock );
quagga.c +239 -0
239 lines not on this page · raw message
quagga.h +110 -0
110 lines not on this page · raw message
bgpd/bgp_vty.c +82 -27
373 lines not on this page · raw message
lib/zebra.h +6 -1
@@ -3,6 +3,9 @@ This file is part of GNU Zebra. +This file was modified from the original on 30/12/2007 +by Vasilis Tsiligiannis <[email protected]> + GNU Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any
@@ -378,7 +381,9 @@#define ZEBRA_ROUTE_ISIS 8#define ZEBRA_ROUTE_BGP 9#define ZEBRA_ROUTE_HSLS 10 -#define ZEBRA_ROUTE_MAX 11 +#define ZEBRA_ROUTE_OLSR 11 +#define ZEBRA_ROUTE_BATMAN 12 +#define ZEBRA_ROUTE_MAX 13/* Zebra's family types. */ #define ZEBRA_FAMILY_IPV4 1
ospfd/ospf_vty.c +58 -20
249 lines not on this page · raw message
zebra/redistribute.c +7 -0
@@ -3,6 +3,9 @@* * This file is part of GNU Zebra. * +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * GNU Zebra is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any
@@ -253,6 +256,8 @@case ZEBRA_ROUTE_OSPF :case ZEBRA_ROUTE_OSPF6 :case ZEBRA_ROUTE_BGP : +case ZEBRA_ROUTE_OLSR : +case ZEBRA_ROUTE_BATMAN :if (! client->redist[type]) { client->redist[type] =1 ;
@@ -281,6 +286,8 @@case ZEBRA_ROUTE_OSPF :case ZEBRA_ROUTE_OSPF6 :case ZEBRA_ROUTE_BGP : +case ZEBRA_ROUTE_OLSR : +case ZEBRA_ROUTE_BATMAN : client->redist[type] =0 ;break ;default :
zebra/zebra_vty.c +31 -9
@@ -53,6 +53,10 @@return "isis" ;case ZEBRA_ROUTE_BGP :return "bgp" ; +case ZEBRA_ROUTE_OLSR : +return "olsr" ; +case ZEBRA_ROUTE_BATMAN : +return "batman" ;default :return "unknown" ; }
@@ -84,6 +88,12 @@return 'I' ;case ZEBRA_ROUTE_BGP :return 'B' ; +case ZEBRA_ROUTE_HSLS : +return 'H' ; +case ZEBRA_ROUTE_OLSR : +return 'L' ; +case ZEBRA_ROUTE_BATMAN : +return 'M' ;default :return '?' ; }
@@ -755,8 +765,8 @@ }#define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ - "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \ - "> - selected route, * - FIB route%s%s" + "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, H - HSLS, " \ + "L - OLSR, M - BATMAN, > - selected route, * - FIB route%s%s" DEFUN (show_ip_route, show_ip_route_cmd,
@@ -874,7 +884,7 @@DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, -"show ip route (bgp|connected|isis|kernel|ospf|rip|static)" , +"show ip route (bgp|connected|isis|kernel|ospf|rip|olsr|batman|static)" ,SHOW_STR IP_STR "IP routing table\n"
@@ -884,6 +894,8 @@ "Kernel\n" "Open Shortest Path First (OSPF)\n" "Routing Information Protocol (RIP)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Static routes\n") {int type;
@@ -892,13 +904,13 @@struct rib *rib;int first =1 ; -if (strncmp (argv[0 ],"b" ,1 ) ==0 ) +if (strncmp (argv[0 ],"bg" ,2 ) ==0 ) type =ZEBRA_ROUTE_BGP ;else if (strncmp (argv[0 ],"c" ,1 ) ==0 ) type =ZEBRA_ROUTE_CONNECT ;else if (strncmp (argv[0 ],"k" ,1 ) ==0 ) type =ZEBRA_ROUTE_KERNEL ; -else if (strncmp (argv[0 ],"o" ,1 ) ==0 ) +else if (strncmp (argv[0 ],"os" ,2 ) ==0 ) type =ZEBRA_ROUTE_OSPF ;else if (strncmp (argv[0 ],"i" ,1 ) ==0 ) type =ZEBRA_ROUTE_ISIS ;
@@ -906,6 +918,10 @@ type =ZEBRA_ROUTE_RIP ; else if (strncmp (argv[0], "s", 1) == 0) type =ZEBRA_ROUTE_STATIC ; + else if (strncmp (argv[0], "ol", 2) == 0) + type =ZEBRA_ROUTE_OLSR ; + else if (strncmp (argv[0], "ba", 2) == 0) + type =ZEBRA_ROUTE_BATMAN ; else {vty_out (vty,"Unknown route type%s" ,VTY_NEWLINE );
@@ -1732,7 +1748,7 @@DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, -"show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)" , +"show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|olsr|batman|static)" ,SHOW_STR IP_STR "IP routing table\n"
@@ -1742,6 +1758,8 @@ "Kernel\n" "Open Shortest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" + "Optimized Link State Routing (OLSR)\n" + "Better Approach to Mobile Ad-Hoc Networking (BATMAN)\n" "Static routes\n") {int type;
@@ -1750,13 +1768,13 @@struct rib *rib;int first =1 ; -if (strncmp (argv[0 ],"b" ,1 ) ==0 ) +if (strncmp (argv[0 ],"bg" ,2 ) ==0 ) type =ZEBRA_ROUTE_BGP ;else if (strncmp (argv[0 ],"c" ,1 ) ==0 ) type =ZEBRA_ROUTE_CONNECT ;else if (strncmp (argv[0 ],"k" ,1 ) ==0 ) type =ZEBRA_ROUTE_KERNEL ; -else if (strncmp (argv[0 ],"o" ,1 ) ==0 ) +else if (strncmp (argv[0 ],"os" ,2 ) ==0 ) type =ZEBRA_ROUTE_OSPF6 ;else if (strncmp (argv[0 ],"i" ,1 ) ==0 ) type =ZEBRA_ROUTE_ISIS ;
@@ -1764,7 +1782,11 @@ type =ZEBRA_ROUTE_RIPNG ; else if (strncmp (argv[0], "s", 1) == 0) type =ZEBRA_ROUTE_STATIC ; - else + else if (strncmp (argv[0], "ol", 2) == 0) + type =ZEBRA_ROUTE_OLSR ; + else if (strncmp (argv[0], "ba", 2) == 0) + type =ZEBRA_ROUTE_BATMAN ; + else {vty_out (vty,"Unknown route type%s" ,VTY_NEWLINE );return CMD_WARNING ;
Re: [B.A.T.M.A.N.] Quagga zebra API client for BATMAN
Hi,
Quoted 6 lines
I've added support to send BATMAN routes to zebra daemon and redistribute them to other Quagga protocols. The interface is through zebra UNIX socket. A new option -q followed by the UNIX socket path is added (see batmand --help) to enable route export. I've also implemented a metric for BATMAN routes based on TTL value which is essential when using BATMAN as IGP to BGP Confederations.
thanks for submitting your work. I published it on our website so that others can find it: https://www.open-mesh.net/batman/patches
By the way: Using the TTL as basis for a hop metric is ambiguous and may lead to errors. By doing so you assume that every host uses the same start TTL and every hop decreases it in the same way. The B.A.T.M.A.N. protocol does not demand or enforce this behaviour.
On the other hand the hop count does not reflect the quality of a path. May be it would be a better approach to calculate the link quality into the metric so that hop based protocols can do a better decission.
Regards,
Marek
Re: [B.A.T.M.A.N.] Quagga zebra API client for BATMAN
Hello,
Στις Wednesday 02 January 2008 17:14:21 ο/η Marek Lindner έγραψε:
Quoted 4 lines
Hi,
thanks for submitting your work. I published it on our website so that others can find it: https://www.open-mesh.net/batman/patches
Thank you Marek. :)
Quoted 8 lines
By the way: Using the TTL as basis for a hop metric is ambiguous and may lead to errors. By doing so you assume that every host uses the same start TTL and every hop decreases it in the same way. The B.A.T.M.A.N. protocol does not demand or enforce this behaviour.
On the other hand the hop count does not reflect the quality of a path. May be it would be a better approach to calculate the link quality into the metric so that hop based protocols can do a better decission.
Yes, I have noticed the potential problem with TTL. At this moment, TTL setting must be the same throughout the whole network for zebra metrics to be calculated correctly. I will try to implement a more appropriate metric calculation based on actual link quality as soon as I feel familiarized enough with the BATMAN protocol.
Regards,
Vasilis
Re: [B.A.T.M.A.N.] Quagga zebra API client for BATMAN
In reply to AcinonyxΣτις Monday 31 December 2007 02:01:49 ο/η Acinonyx έγραψε:
Quoted 10 lines
Hello ppl,
I've added support to send BATMAN routes to zebra daemon and redistribute them to other Quagga protocols. The interface is through zebra UNIX socket. A new option -q followed by the UNIX socket path is added (see batmand --help) to enable route export. I've also implemented a metric for BATMAN routes based on TTL value which is essential when using BATMAN as IGP to BGP
Confederations.
Hello again,
I've fixed a bug in zebra client route update which tried to delete routes with the new metric instead of the previously installed.
I've also tried to calculate a metric based on link quality. Unfortunately, I wasn't able to find a way to compare latency between two different originators. Originators could only be compared based on packet loss which isn't what we want because it would lead to having the same metric (1) for all nodes if there isn't some packet loss present. So, we are staying for the moment with the TTL approach with some adjustment to make it safer with different TTL settings.
I also want to point out an issue with batmand host routes and Quagga. Although Quagga succesfully installs host routes, it doesn't treat them as valid gateways if the associated interface isn't flaged as P-t-P. I don't know if this is a bug or a feature but it renders all batmand second level routes inactive. I added a workaround in zebra client which disables host route installation. This means that you can use quagga zebra client only if you have standard broadcast subnets.
The attached patch is against latest stable BATMAN release (revsion 502).
Regards,
Vasilis
batman.c +13 -3
@@ -3,6 +3,9 @@* Thomas Lopatic, Corinna 'Elektra' Aichele, Axel Neumann, * Felix Fietkau, Marek Lindner * +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -113,6 +116,7 @@struct vis_if vis_if;struct unix_if unix_if;struct debug_clients debug_clients; +struct zebra zebra;unsigned char *vis_packet =NULL ;uint16_t vis_packet_size =0 ;
@@ -131,6 +135,7 @@fprintf ( stderr," -H verbose help\n" );fprintf ( stderr," -o orginator interval in ms\n" );fprintf ( stderr," -p preferred gateway\n" ); +fprintf ( stderr," -q quagga unix socket\n" );fprintf ( stderr," -r routing class\n" );fprintf ( stderr," -s visualisation server\n" );fprintf ( stderr," -v print version\n" );
@@ -171,6 +176,8 @@fprintf ( stderr," default: 1000, allowed values: >0\n\n" );fprintf ( stderr," -p preferred gateway\n" );fprintf ( stderr," default: none, allowed values: IP\n\n" ); +fprintf ( stderr," -q quagga unix socket\n" ); +fprintf ( stderr," default: none, allowed values: Socket Path\n\n" );fprintf ( stderr," -r routing class (only needed if gateway class = 0)\n" );fprintf ( stderr," default: 0 -> set no default route\n" );fprintf ( stderr," allowed values: 1 -> use fast internet connection\n" );
@@ -196,7 +203,7 @@ netmask = (uint32_t )orig_node->hna_buff[ ( hna_buff_count *5 ) +4 ];if ( ( netmask >0 ) && ( netmask <33 ) ) -add_del_route ( hna, netmask, orig_node->router->addr, del, orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); +add_del_route ( hna, netmask, orig_node->router->addr, orig_node->metric, del, orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); hna_buff_count++;
@@ -347,6 +354,7 @@prof_start ( PROF_update_routes );static char orig_str[ADDR_STR_LEN ], next_str[ADDR_STR_LEN ]; +uint16_t metric;debug_output (4 ,"update_routes() \n" );
@@ -373,7 +381,7 @@if ( orig_node->hna_buff_len >0 )add_del_hna ( orig_node,1 ); -add_del_route ( orig_node->orig,32 , orig_node->router->addr,1 , orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); +add_del_route ( orig_node->orig,32 , orig_node->router->addr, orig_node->metric,1 , orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); }
@@ -386,10 +394,12 @@debug_output (4 ,"Route changed \n" ); } -add_del_route ( orig_node->orig,32 , neigh_node->addr,0 , neigh_node->if_incoming->dev, neigh_node->if_incoming->udp_send_sock ); + metric =255 - neigh_node->last_ttl; +add_del_route ( orig_node->orig,32 , neigh_node->addr, metric,0 , neigh_node->if_incoming->dev, neigh_node->if_incoming->udp_send_sock ); orig_node->batman_if = neigh_node->if_incoming; orig_node->router = neigh_node; + orig_node->metric = metric;/* add new announced network(s) */ if ( hna_buff_len >0 ) {
batman.h +15 -1
@@ -1,6 +1,10 @@/* * Copyright (C) 2006 B.A.T.M.A.N. contributors: * Thomas Lopatic, Corinna 'Elektra' Aichele, Axel Neumann, Marek Lindner +* +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -32,6 +36,7 @@#include "hash.h" #include "allocate.h" #include "profile.h" +#include "quagga.h"
@@ -62,7 +67,7 @@#define JITTER 100#define TTL 50/* Time To Live of broadcast messages */ #define BIDIRECT_TIMEOUT 2 -#define PURGE_TIMEOUT 200000/* purge originators after time in ms if no valid packet comes in -> TODO: check influence on SEQ_RANGE */ +#define PURGE_TIMEOUT 20000/* purge originators after time in ms if no valid packet comes in -> TODO: check influence on SEQ_RANGE */ #define SEQ_RANGE 128/* sliding packet range of received orginator messages in squence numbers (should be a multiple of our word size) */
@@ -100,6 +105,7 @@extern struct vis_if vis_if;extern struct unix_if unix_if;extern struct debug_clients debug_clients; +extern struct zebra zebra;extern char *gw2string[];
@@ -125,6 +131,7 @@int16_t hna_buff_len;uint16_t last_seqno;/* last and best known squence number */ struct list_head neigh_list; +uint16_t metric; };struct neigh_node
@@ -226,6 +233,13 @@struct batman_if *batman_if; }; +struct zebra +{ +uint8_t enabled; +char *unix_path; +int32_t unix_sock; +}; +int8_t batman (void );void usage (void );
linux-specific.c +7 -3
@@ -1,6 +1,10 @@/* * Copyright (C) 2006 BATMAN contributors: * Thomas Lopatic +* +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -43,7 +47,7 @@#include "batman-specific.h" -void add_del_route (uint32_t dest,uint16_t netmask,uint32_t router,int8_t del,char *dev,int32_t sock ) { +void add_del_route (uint32_t dest,uint16_t netmask,uint32_t router,uint16_t metric,int8_t del,char *dev,int32_t sock ) {struct rtentry route;char str1[16 ], str2[16 ];
@@ -65,7 +69,7 @@ addr->sin_addr.s_addr = ( netmask ==32 ?0xffffffff :htonl ( ~ (0xffffffff >> netmask ) ) ); route.rt_flags = ( netmask ==32 ? (RTF_HOST |RTF_UP ) :RTF_UP ); - route.rt_metric =1 ; + route.rt_metric = metric;if ( ( dest != router ) || ( ( dest ==0 ) && ( router ==0 ) ) ) {
@@ -99,7 +103,7 @@ route.rt_dev = dev; -if (ioctl ( sock, del ?SIOCDELRT :SIOCADDRT , &route ) <0 ) +if ( (zebra.enabled ?zebra_add_del_route ( &route, del ) :ioctl ( sock, del ?SIOCDELRT :SIOCADDRT , &route )) <0 )debug_output (0 ,"Error - can't %s route to %s/%i via %s: %s\n" , del ?"delete" :"add" , str1, netmask, str2,strerror (errno) ); }
Makefile +5 -2
@@ -1,6 +1,9 @@ # # Copyright (C) 2006 BATMAN contributors # +# This file was modified from the original on 30/12/2007 +# by Vasilis Tsiligiannis <[email protected]> +# # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License as published by the Free Software Foundation.
@@ -45,8 +48,8 @@ LOG_BRANCH= branches/batman-0.2.x -LINUX_SRC_C= batman.c originator.c schedule.c posix-specific.c posix.c allocate.c bitarray.c hash.c profile.c $(OS_C) -LINUX_SRC_H= batman.h originator.h schedule.h batman-specific.h list.h os.h allocate.h bitarray.h hash.h profile.h +LINUX_SRC_C= batman.c originator.c schedule.c posix-specific.c posix.c allocate.c bitarray.c hash.c profile.c quagga.c $(OS_C) +LINUX_SRC_H= batman.h originator.h schedule.h batman-specific.h list.h os.h allocate.h bitarray.h hash.h profile.h quagga.h BINARY_NAME= batmand SOURCE_VERSION_HEADER= batman.h
originator.c +2 -1
@@ -88,6 +88,7 @@ orig_node->orig = addr; orig_node->router =NULL ; orig_node->batman_if =NULL ; + orig_node->metric =255 ; orig_node->bidirect_link =debugMalloc ( found_ifs *sizeof (uint16_t ),402 );memset ( orig_node->bidirect_link,0 , found_ifs *sizeof (uint16_t ) );
@@ -296,7 +297,7 @@if ( orig_node->hna_buff_len >0 )add_del_hna ( orig_node,1 ); -add_del_route ( orig_node->orig,32 , orig_node->router->addr,1 , orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); +add_del_route ( orig_node->orig,32 , orig_node->router->addr, orig_node->metric,1 , orig_node->batman_if->dev, orig_node->batman_if->udp_send_sock ); orig_node->router =NULL ;
os.h +5 -1
@@ -1,6 +1,10 @@/* * Copyright (C) 2006 BATMAN contributors: * Thomas Lopatic, Marek Lindner +* +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -41,7 +45,7 @@void set_send_redirects (int32_t state,char * dev );int32_t get_send_redirects (char *dev ); -void add_del_route (uint32_t dest,uint16_t netmask,uint32_t router,int8_t del,char *dev,int32_t sock ); +void add_del_route (uint32_t dest,uint16_t netmask,uint32_t router,uint16_t metric,int8_t del,char *dev,int32_t sock );void add_del_hna (struct orig_node *orig_node,int8_t del );int8_t is_aborted ();void handler (int32_t sig );
posix-specific.c +24 -3
@@ -1,6 +1,10 @@/* * Copyright (C) 2006 BATMAN contributors: * Thomas Lopatic, Marek Lindner +* +* This file was modified from the original on 30/12/2007 +* by Vasilis Tsiligiannis <[email protected]> +* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation.
@@ -445,11 +449,12 @@uint32_t vis_server =0 ; +memset (&zebra,0 ,sizeof (zebra));memset ( &tmp_ip_holder,0 ,sizeof (struct in_addr ) ); stop =0 ; -while ( ( optchar =getopt ( argc, argv,"a:bcd:hHo:g:p:r:s:vV" ) ) !=-1 ) { +while ( ( optchar =getopt ( argc, argv,"a:bcd:hHo:g:p:r:s:vVq:" ) ) !=-1 ) {switch ( optchar ) {
@@ -624,6 +629,16 @@exit (EXIT_SUCCESS ); +case 'q' : + + errno =0 ; + + zebra.enabled++; + zebra.unix_path = optarg; + + found_args +=2 ; +break ; +case 'h' :default :usage ();
@@ -899,6 +914,9 @@ } +if ( ( zebra.enabled !=0 ) && ( !zebra_init (zebra.unix_path) ) ) +exit (EXIT_FAILURE ); + }
@@ -1159,7 +1177,7 @@if (add_dev_tun ( curr_gw_data->batman_if, curr_gw_data->batman_if->addr.sin_addr.s_addr, curr_gateway_tun_if,sizeof (curr_gateway_tun_if), &curr_gateway_tun_fd ) >0 ) { -add_del_route (0 ,0 ,0 ,0 , curr_gateway_tun_if, curr_gw_data->batman_if->udp_send_sock ); +add_del_route (0 ,0 ,0 ,0 ,0 , curr_gateway_tun_if, curr_gw_data->batman_if->udp_send_sock ); }else {
@@ -1298,7 +1316,7 @@ }/* cleanup */ -add_del_route (0 ,0 ,0 ,1 , curr_gateway_tun_if, curr_gw_data->batman_if->udp_send_sock ); +add_del_route (0 ,0 ,0 ,0 ,1 , curr_gateway_tun_if, curr_gw_data->batman_if->udp_send_sock );close ( curr_gateway_tcp_sock );close ( curr_gateway_tun_sock );
@@ -1385,6 +1403,9 @@if ( unix_if.unix_sock )close ( unix_if.unix_sock ); +if ( zebra.unix_sock >0 ) +close ( zebra.unix_sock ); +if ( unix_if.listen_thread_id !=0 )pthread_join ( unix_if.listen_thread_id,NULL );
quagga.c +247 -0
247 lines not on this page · raw message
quagga.h +110 -0
110 lines not on this page · raw message
Re: [B.A.T.M.A.N.] Quagga zebra API client for BATMAN
Hello Vasilis,
cool work.
I have some questions:
Quoted 3 lines
I've also tried to calculate a metric based on link quality. Unfortunately, I wasn't able to find a way to compare latency between two different originators.
Assuming information about the latency is available. I guess you would like to use it as a secondary input when calculating the metric. Do you know (or have any feeling) how problematic it can become if the indicated latency for a given route is changing very frequently (definitely much more often than the best next hop and related TTL).
Quoted 5 lines
Originators could only be compared based on packet loss which isn't what we want because it would lead to having the same metric (1) for all nodes if there isn't some packet loss present. So, we are staying for the moment with the TTL approach with some adjustment to make it safer with different TTL settings.
I am not familiar with quagga. Why is it problematic to have several routes with the same metric. Or asked another way: There could also be several routes (to the same destination) with the same TTL. Why does this problem not exist in this case?
Quoted 8 lines
I also want to point out an issue with batmand host routes and Quagga. Although Quagga succesfully installs host routes, it doesn't treat them as valid gateways if the associated interface isn't flaged as P-t-P. I don't know if this is a bug or a feature but it renders all batmand second level routes inactive. I added a workaround in zebra client which disables host route installation. This means that you can use quagga zebra client only if you have standard broadcast subnets.
what is your definition of a standard broadcast subnet ? is it "POINTOPOINT,MULTICAST,NOARP,..." and /32 ?
Quoted 2 lines
The attached patch is against latest stable BATMAN release (revsion 502).
copied to http://downloads.open-mesh.net/batman/patches/quagga/
Quoted 3 lines
Regards,
Vasilis
ciao,
axel
Re: [B.A.T.M.A.N.] Quagga zebra API client for BATMAN
Στις Sunday 20 January 2008 09:52:41 ο/η Axel Neumann έγραψε:
Hello Axel,
Quoted 5 lines
Assuming information about the latency is available. I guess you would like to use it as a secondary input when calculating the metric. Do you know (or have any feeling) how problematic it can become if the indicated latency for a given route is changing very frequently (definitely much more often than the best next hop and related TTL).
I would like to use it as primary input for metric calculation. The reason I wrote quagga zebra client is to be able to use B.A.T.M.A.N. as IGP in a BGP Confederation. BGP minimum route advertisement interval is by default 30 seconds and updating route metric more frequently than that isn't necessery. I haven't given this step much thought since I realised that there is no way to compare latency between different originators but I think I could calculate the average latency from an originator and update metrics every x seconds interval (30 secs in my case).
Quoted 5 lines
I am not familiar with quagga. Why is it problematic to have several routes with the same metric. Or asked another way: There could also be several routes (to the same destination) with the same TTL. Why does this problem not exist in this case?
In a BGP Confederation, best path selection is based on IGP metric since all the other criteria are always equal. If IGP metrics are also equal, then path selection falls to the rule: 'Prefer the route that comes from the BGP router with the lowest router ID'. This creates a major problem when all metrics are equal because it always favors the selection of paths that come from one specific BGP router.
Quoted 2 lines
what is your definition of a standard broadcast subnet ? is it "POINTOPOINT,MULTICAST,NOARP,..." and /32 ?
A subnet on an interface flaged as BROADCAST with a prefix length < /32
Best Regards,
Vasilis
Hi Holger,
is it also possible to package a current batmand-exp revision (current or rv 892), as it is used a lot on 24c3.
Are your there? Maybe we can meet at the freifunk corner (first floor).
ciao,
axel
Quoted 10 lines · Holger Levsen
Hi,
yesterday night I've uploaded 0.3 svn r875 packages to Debian experimental, they are also available at http://layer-acht.org/batmand/ for etch and sid.
Feedback welcome!
regards,
Holger