Permalink
Browse files

Merge pull request #624 "Babel"

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
  • Loading branch information...
eqvinox committed Jun 13, 2017
2 parents 5da670a + e763afa commit e885ed85bb0aa46ae41b554c772801387901f690
Showing with 9,805 additions and 13 deletions.
  1. +3 −2 Makefile.am
  2. +2 −1 SERVICES
  3. +7 −0 babeld/.gitignore
  4. +19 −0 babeld/LICENCE
  5. +29 −0 babeld/Makefile.am
  6. +113 −0 babeld/babel_filter.c
  7. +33 −0 babeld/babel_filter.h
  8. +1,439 −0 babeld/babel_interface.c
  9. +144 −0 babeld/babel_interface.h
  10. +401 −0 babeld/babel_main.c
  11. +46 −0 babeld/babel_main.h
  12. +30 −0 babeld/babel_memory.c
  13. +32 −0 babeld/babel_memory.h
  14. +403 −0 babeld/babel_zebra.c
  15. +34 −0 babeld/babel_zebra.h
  16. +759 −0 babeld/babeld.c
  17. +30 −0 babeld/babeld.conf.sample
  18. +129 −0 babeld/babeld.h
  19. +300 −0 babeld/kernel.c
  20. +47 −0 babeld/kernel.h
  21. +1,802 −0 babeld/message.c
  22. +101 −0 babeld/message.h
  23. +366 −0 babeld/neighbour.c
  24. +64 −0 babeld/neighbour.h
  25. +218 −0 babeld/net.c
  26. +33 −0 babeld/net.h
  27. +314 −0 babeld/resend.c
  28. +65 −0 babeld/resend.h
  29. +1,141 −0 babeld/route.c
  30. +126 −0 babeld/route.h
  31. +164 −0 babeld/source.c
  32. +51 −0 babeld/source.h
  33. +459 −0 babeld/util.c
  34. +164 −0 babeld/util.h
  35. +240 −0 babeld/xroute.c
  36. +52 −0 babeld/xroute.h
  37. +10 −0 configure.ac
  38. +1 −0 doc/Makefile.am
  39. +212 −0 doc/babeld.texi
  40. +1 −1 eigrpd/eigrp_const.h
  41. +2 −0 lib/command.c
  42. +1 −0 lib/command.h
  43. +4 −0 lib/log.c
  44. +3 −0 lib/route_types.txt
  45. +92 −0 lib/zclient.c
  46. +28 −0 lib/zclient.h
  47. +21 −3 redhat/frr.spec.in
  48. +1 −0 tools/etc/iproute2/rt_protos.d/frr.conf
  49. +6 −0 vtysh/Makefile.am
  50. +3 −3 vtysh/extract.pl.in
  51. +43 −0 vtysh/vtysh.c
  52. +3 −2 vtysh/vtysh.h
  53. +2 −0 vtysh/vtysh_config.c
  54. +4 −1 zebra/rt_netlink.c
  55. +3 −0 zebra/rt_netlink.h
  56. +1 −0 zebra/zebra_rib.c
  57. +4 −0 zebra/zebra_vty.c
View
@@ -2,13 +2,14 @@
SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \
@BGPD@ @RIPD@ @RIPNGD@ @OSPFD@ @OSPF6D@ @LDPD@ \
@ISISD@ @PIMD@ @NHRPD@ @EIGRPD@ \
@ISISD@ @PIMD@ @NHRPD@ @EIGRPD@ @BABELD@ \
@WATCHFRR@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@ \
redhat @SOLARIS@ tests tools snapcraft
DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \
isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \
solaris pimd nhrpd eigrpd @LIBRFP@ @RFPTEST@ tools snapcraft
solaris pimd nhrpd eigrpd @LIBRFP@ @RFPTEST@ tools snapcraft \
babeld
EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \
update-autotools \
View
@@ -17,7 +17,8 @@ bgpd 2605/tcp
ospf6d 2606/tcp
ospfapi 2607/tcp
isisd 2608/tcp
# babeld 2609/tcp
babeld 2609/tcp
nhrpd 2610/tcp
pimd 2611/tcp
ldpd 2612/tcp
eigrpd 2613/tcp
View
@@ -0,0 +1,7 @@
*
!*.c
!*.h
!LICENCE
!Makefile.am
!babeld.conf.sample
!.gitignore
View
@@ -0,0 +1,19 @@
Copyright (c) 2007, 2008 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
View
@@ -0,0 +1,29 @@
## Process this file with automake to produce Makefile.in.
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
AM_CFLAGS = $(PICFLAGS) $(WERROR)
AM_LDFLAGS = $(PILDFLAGS)
noinst_LIBRARIES = libbabel.a
sbin_PROGRAMS = babeld
libbabel_a_SOURCES = \
babel_zebra.c net.c kernel.c util.c source.c neighbour.c \
route.c xroute.c message.c resend.c babel_interface.c babeld.c \
babel_filter.c babel_memory.c
noinst_HEADERS = \
babel_zebra.h net.h kernel.h util.h source.h neighbour.h \
route.h xroute.h message.h resend.h babel_interface.h babeld.h \
babel_filter.h babel_main.h babel_memory.h
babeld_SOURCES = \
babel_main.c $(libbabel_a_SOURCES)
babeld_LDADD = ../lib/libfrr.la @LIBCAP@
examplesdir = $(exampledir)
dist_examples_DATA = babeld.conf.sample
View
@@ -0,0 +1,113 @@
/*
Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "babel_filter.h"
#include "vty.h"
#include "filter.h"
#include "log.h"
#include "plist.h"
#include "distribute.h"
#include "util.h"
int
babel_filter(int output, const unsigned char *prefix, unsigned short plen,
unsigned int ifindex)
{
struct interface *ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
babel_interface_nfo *babel_ifp = ifp ? babel_get_if_nfo(ifp) : NULL;
struct prefix p;
struct distribute *dist;
struct access_list *alist;
struct prefix_list *plist;
int distribute;
p.family = v4mapped(prefix) ? AF_INET : AF_INET6;
p.prefixlen = v4mapped(prefix) ? plen - 96 : plen;
if (p.family == AF_INET) {
uchar_to_inaddr(&p.u.prefix4, prefix);
distribute = output ? DISTRIBUTE_V4_OUT : DISTRIBUTE_V4_IN;
} else {
uchar_to_in6addr(&p.u.prefix6, prefix);
distribute = output ? DISTRIBUTE_V6_OUT : DISTRIBUTE_V6_IN;
}
if (babel_ifp != NULL && babel_ifp->list[distribute]) {
if (access_list_apply (babel_ifp->list[distribute], &p)
== FILTER_DENY) {
debugf(BABEL_DEBUG_FILTER,
"%s/%d filtered by distribute %s",
p.family == AF_INET ?
inet_ntoa(p.u.prefix4) :
inet6_ntoa (p.u.prefix6),
p.prefixlen,
output ? "out" : "in");
return INFINITY;
}
}
if (babel_ifp != NULL && babel_ifp->prefix[distribute]) {
if (prefix_list_apply (babel_ifp->prefix[distribute], &p)
== PREFIX_DENY) {
debugf(BABEL_DEBUG_FILTER, "%s/%d filtered by distribute %s",
p.family == AF_INET ?
inet_ntoa(p.u.prefix4) :
inet6_ntoa (p.u.prefix6),
p.prefixlen,
output ? "out" : "in");
return INFINITY;
}
}
/* All interface filter check. */
dist = distribute_lookup (NULL);
if (dist) {
if (dist->list[distribute]) {
alist = access_list_lookup (p.family, dist->list[distribute]);
if (alist) {
if (access_list_apply (alist, &p) == FILTER_DENY) {
debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s",
p.family == AF_INET ?
inet_ntoa(p.u.prefix4) :
inet6_ntoa (p.u.prefix6),
p.prefixlen,
output ? "out" : "in");
return INFINITY;
}
}
}
if (dist->prefix[distribute]) {
plist = prefix_list_lookup (p.family, dist->prefix[distribute]);
if (plist) {
if (prefix_list_apply (plist, &p) == PREFIX_DENY) {
debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s",
p.family == AF_INET ?
inet_ntoa(p.u.prefix4) :
inet6_ntoa (p.u.prefix6),
p.prefixlen,
output ? "out" : "in");
return INFINITY;
}
}
}
}
return 0;
}
View
@@ -0,0 +1,33 @@
/*
Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef BABELD_BABEL_FILTER_H
#define BABELD_BABEL_FILTER_H
#include <zebra.h>
#include "prefix.h"
#include "babel_interface.h"
int babel_filter(int output, const unsigned char *prefix, unsigned short plen,
unsigned int index);
#endif /* BABELD_BABEL_FILTER_H */
Oops, something went wrong.

0 comments on commit e885ed8

Please sign in to comment.