From 5734509c0545ebd95a5b8e3f22a911c1a39ffa1b Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Sun, 25 Dec 2011 17:52:09 +0100 Subject: babeld: Initial import, for Babel routing protocol. * Initial import of the Babel routing protocol, ported to Quagga. * LICENCE: Update the original LICENCE file to include all known potentially applicable copyright claims. Ask that any future contributors to babeld/ grant MIT/X11 licence to their work. * *.{c,h}: Add GPL headers, in according with the SFLC guidance on dealing with potentially mixed GPL/other licensed work, at: https://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html --- lib/command.c | 2 ++ lib/command.h | 1 + lib/distribute.c | 37 ++++++++++++++++++++----------------- lib/distribute.h | 3 +++ lib/log.c | 1 + lib/log.h | 3 ++- lib/memory.c | 11 +++++++++++ lib/memtypes.c | 7 +++++++ lib/route_types.txt | 2 ++ lib/routemap.h | 1 + lib/thread.h | 2 ++ lib/vty.c | 2 ++ lib/zclient.h | 3 +++ 13 files changed, 57 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/command.c b/lib/command.c index 4f6d184d..e62a7a7e 100644 --- a/lib/command.c +++ b/lib/command.c @@ -2400,6 +2400,7 @@ DEFUN (config_exit, case BGP_NODE: case RIP_NODE: case RIPNG_NODE: + case BABEL_NODE: case OSPF_NODE: case OSPF6_NODE: case ISIS_NODE: @@ -2449,6 +2450,7 @@ DEFUN (config_end, case ZEBRA_NODE: case RIP_NODE: case RIPNG_NODE: + case BABEL_NODE: case BGP_NODE: case BGP_VPNV4_NODE: case BGP_IPV4_NODE: diff --git a/lib/command.h b/lib/command.h index 1275efee..2d708d8e 100644 --- a/lib/command.h +++ b/lib/command.h @@ -78,6 +78,7 @@ enum node_type TABLE_NODE, /* rtm_table selection node. */ RIP_NODE, /* RIP protocol mode node. */ RIPNG_NODE, /* RIPng protocol mode node. */ + BABEL_NODE, /* Babel protocol mode node. */ BGP_NODE, /* BGP protocol mode which includes BGP4+ */ BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */ BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */ diff --git a/lib/distribute.c b/lib/distribute.c index 04889030..8d6f6377 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -758,22 +758,25 @@ distribute_list_init (int node) (int (*) (const void *, const void *)) distribute_cmp); if(node==RIP_NODE) { - install_element (RIP_NODE, &distribute_list_all_cmd); - install_element (RIP_NODE, &no_distribute_list_all_cmd); - install_element (RIP_NODE, &distribute_list_cmd); - install_element (RIP_NODE, &no_distribute_list_cmd); - install_element (RIP_NODE, &distribute_list_prefix_all_cmd); - install_element (RIP_NODE, &no_distribute_list_prefix_all_cmd); - install_element (RIP_NODE, &distribute_list_prefix_cmd); - install_element (RIP_NODE, &no_distribute_list_prefix_cmd); - } else { - install_element (RIPNG_NODE, &ipv6_distribute_list_all_cmd); - install_element (RIPNG_NODE, &no_ipv6_distribute_list_all_cmd); - install_element (RIPNG_NODE, &ipv6_distribute_list_cmd); - install_element (RIPNG_NODE, &no_ipv6_distribute_list_cmd); - install_element (RIPNG_NODE, &ipv6_distribute_list_prefix_all_cmd); - install_element (RIPNG_NODE, &no_ipv6_distribute_list_prefix_all_cmd); - install_element (RIPNG_NODE, &ipv6_distribute_list_prefix_cmd); - install_element (RIPNG_NODE, &no_ipv6_distribute_list_prefix_cmd); + install_element (node, &distribute_list_all_cmd); + install_element (node, &no_distribute_list_all_cmd); + install_element (node, &distribute_list_cmd); + install_element (node, &no_distribute_list_cmd); + install_element (node, &distribute_list_prefix_all_cmd); + install_element (node, &no_distribute_list_prefix_all_cmd); + install_element (node, &distribute_list_prefix_cmd); + install_element (node, &no_distribute_list_prefix_cmd); + } else if (node == RIPNG_NODE || node == BABEL_NODE) { + /* WARNING: two identical commands installed do a crash, so be worry with + aliases. For this reason, and because all these commands are aliases, Babel + is not set with RIP. */ + install_element (node, &ipv6_distribute_list_all_cmd); + install_element (node, &no_ipv6_distribute_list_all_cmd); + install_element (node, &ipv6_distribute_list_cmd); + install_element (node, &no_ipv6_distribute_list_cmd); + install_element (node, &ipv6_distribute_list_prefix_all_cmd); + install_element (node, &no_ipv6_distribute_list_prefix_all_cmd); + install_element (node, &ipv6_distribute_list_prefix_cmd); + install_element (node, &no_ipv6_distribute_list_prefix_cmd); } } diff --git a/lib/distribute.h b/lib/distribute.h index a1bec03a..5072016f 100644 --- a/lib/distribute.h +++ b/lib/distribute.h @@ -22,6 +22,9 @@ #ifndef _ZEBRA_DISTRIBUTE_H #define _ZEBRA_DISTRIBUTE_H +#include +#include "if.h" + /* Disctirubte list types. */ enum distribute_type { diff --git a/lib/log.c b/lib/log.c index 3d905f4f..91efe573 100644 --- a/lib/log.c +++ b/lib/log.c @@ -48,6 +48,7 @@ const char *zlog_proto_names[] = "BGP", "OSPF", "RIPNG", + "BABEL", "OSPF6", "ISIS", "MASC", diff --git a/lib/log.h b/lib/log.h index ee34a4ad..27f21b31 100644 --- a/lib/log.h +++ b/lib/log.h @@ -49,7 +49,8 @@ typedef enum ZLOG_RIP, ZLOG_BGP, ZLOG_OSPF, - ZLOG_RIPNG, + ZLOG_RIPNG, + ZLOG_BABEL, ZLOG_OSPF6, ZLOG_ISIS, ZLOG_MASC diff --git a/lib/memory.c b/lib/memory.c index 4090fd90..63ec6b54 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -466,6 +466,17 @@ DEFUN (show_memory_ripng, return CMD_SUCCESS; } +DEFUN (show_memory_babel, + show_memory_babel_cmd, + "show memory babel", + SHOW_STR + "Memory statistics\n" + "Babel memory\n") +{ + show_memory_vty (vty, memory_list_babel); + return CMD_SUCCESS; +} + DEFUN (show_memory_bgp, show_memory_bgp_cmd, "show memory bgp", diff --git a/lib/memtypes.c b/lib/memtypes.c index d2bc1c62..cd39c996 100644 --- a/lib/memtypes.c +++ b/lib/memtypes.c @@ -174,6 +174,13 @@ struct memory_list memory_list_ripng[] = { -1, NULL } }; +struct memory_list memory_list_babel[] = +{ + { MTYPE_BABEL, "Babel structure" }, + { MTYPE_BABEL_IF, "Babel interface" }, + { -1, NULL } +}; + struct memory_list memory_list_ospf[] = { { MTYPE_OSPF_TOP, "OSPF top" }, diff --git a/lib/route_types.txt b/lib/route_types.txt index fde0bc8d..cebf01fc 100644 --- a/lib/route_types.txt +++ b/lib/route_types.txt @@ -58,6 +58,7 @@ ZEBRA_ROUTE_BGP, bgp, bgpd, 'B', 1, 1, "BGP" # possible). ZEBRA_ROUTE_HSLS, hsls, hslsd, 'H', 0, 0, "HSLS" ZEBRA_ROUTE_OLSR, olsr, olsrd, 'o', 0, 0, "OLSR" +ZEBRA_ROUTE_BABEL, babel, babeld, 'A', 1, 1, "Babel" ## help strings ZEBRA_ROUTE_SYSTEM, "Reserved route type, for internal use only" @@ -72,3 +73,4 @@ ZEBRA_ROUTE_ISIS, "Intermediate System to Intermediate System (IS-IS)" ZEBRA_ROUTE_BGP, "Border Gateway Protocol (BGP)" ZEBRA_ROUTE_HSLS, "Hazy-Sighted Link State Protocol (HSLS)" ZEBRA_ROUTE_OLSR, "Optimised Link State Routing (OLSR)" +ZEBRA_ROUTE_BABEL, "Babel routing protocol (Babel)" diff --git a/lib/routemap.h b/lib/routemap.h index 1402f5c8..ba64553f 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -43,6 +43,7 @@ typedef enum { RMAP_RIP, RMAP_RIPNG, + RMAP_BABEL, RMAP_OSPF, RMAP_OSPF6, RMAP_BGP, diff --git a/lib/thread.h b/lib/thread.h index 69bb8d6c..dfc51e28 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -23,6 +23,8 @@ #ifndef _ZEBRA_THREAD_H #define _ZEBRA_THREAD_H +#include + struct rusage_t { #ifdef HAVE_RUSAGE diff --git a/lib/vty.c b/lib/vty.c index 83bd6785..9a4efe64 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -699,6 +699,7 @@ vty_end_config (struct vty *vty) case ZEBRA_NODE: case RIP_NODE: case RIPNG_NODE: + case BABEL_NODE: case BGP_NODE: case BGP_VPNV4_NODE: case BGP_IPV4_NODE: @@ -1107,6 +1108,7 @@ vty_stop_input (struct vty *vty) case ZEBRA_NODE: case RIP_NODE: case RIPNG_NODE: + case BABEL_NODE: case BGP_NODE: case RMAP_NODE: case OSPF_NODE: diff --git a/lib/zclient.h b/lib/zclient.h index 73389ecd..a7d7b548 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -22,6 +22,9 @@ #ifndef _ZEBRA_ZCLIENT_H #define _ZEBRA_ZCLIENT_H +/* For struct zapi_ipv{4,6}. */ +#include "prefix.h" + /* For struct interface and struct connected. */ #include "if.h" -- cgit v1.2.1 From f8a246d6df0556fb897e1785d1c2ea81caf8956d Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Wed, 11 Jan 2012 18:18:56 +0400 Subject: lib: update proto_redistnum() for Babel --- lib/log.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/log.c b/lib/log.c index 91efe573..cbc935b6 100644 --- a/lib/log.c +++ b/lib/log.c @@ -933,8 +933,10 @@ proto_redistnum(int afi, const char *s) return ZEBRA_ROUTE_OSPF; else if (strncmp (s, "i", 1) == 0) return ZEBRA_ROUTE_ISIS; - else if (strncmp (s, "b", 1) == 0) + else if (strncmp (s, "bg", 2) == 0) return ZEBRA_ROUTE_BGP; + else if (strncmp (s, "ba", 2) == 0) + return ZEBRA_ROUTE_BABEL; } if (afi == AFI_IP6) { @@ -950,8 +952,10 @@ proto_redistnum(int afi, const char *s) return ZEBRA_ROUTE_OSPF6; else if (strncmp (s, "i", 1) == 0) return ZEBRA_ROUTE_ISIS; - else if (strncmp (s, "b", 1) == 0) + else if (strncmp (s, "bg", 2) == 0) return ZEBRA_ROUTE_BGP; + else if (strncmp (s, "ba", 2) == 0) + return ZEBRA_ROUTE_BABEL; } return -1; } -- cgit v1.2.1 From 2236df03898f82e627f865e11157a5e08dd2e4ba Mon Sep 17 00:00:00 2001 From: Matthieu Boutier Date: Thu, 19 Jan 2012 22:37:38 +0100 Subject: memory: install babel memory informations. --- lib/memory.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/memory.c b/lib/memory.c index 63ec6b54..684ebcff 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -529,6 +529,7 @@ memory_init (void) install_element (RESTRICTED_NODE, &show_memory_lib_cmd); install_element (RESTRICTED_NODE, &show_memory_rip_cmd); install_element (RESTRICTED_NODE, &show_memory_ripng_cmd); + install_element (RESTRICTED_NODE, &show_memory_babel_cmd); install_element (RESTRICTED_NODE, &show_memory_bgp_cmd); install_element (RESTRICTED_NODE, &show_memory_ospf_cmd); install_element (RESTRICTED_NODE, &show_memory_ospf6_cmd); @@ -539,6 +540,7 @@ memory_init (void) install_element (VIEW_NODE, &show_memory_lib_cmd); install_element (VIEW_NODE, &show_memory_rip_cmd); install_element (VIEW_NODE, &show_memory_ripng_cmd); + install_element (VIEW_NODE, &show_memory_babel_cmd); install_element (VIEW_NODE, &show_memory_bgp_cmd); install_element (VIEW_NODE, &show_memory_ospf_cmd); install_element (VIEW_NODE, &show_memory_ospf6_cmd); @@ -550,6 +552,7 @@ memory_init (void) install_element (ENABLE_NODE, &show_memory_zebra_cmd); install_element (ENABLE_NODE, &show_memory_rip_cmd); install_element (ENABLE_NODE, &show_memory_ripng_cmd); + install_element (ENABLE_NODE, &show_memory_babel_cmd); install_element (ENABLE_NODE, &show_memory_bgp_cmd); install_element (ENABLE_NODE, &show_memory_ospf_cmd); install_element (ENABLE_NODE, &show_memory_ospf6_cmd); -- cgit v1.2.1