Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite885ed8

Browse files
committed
Merge pull request#624 "Babel"
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 parents5da670a +e763afa commite885ed8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+9805
-13
lines changed

‎Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@\
44
@BGPD@ @RIPD@ @RIPNGD@ @OSPFD@ @OSPF6D@ @LDPD@\
5-
@ISISD@ @PIMD@ @NHRPD@ @EIGRPD@\
5+
@ISISD@ @PIMD@ @NHRPD@ @EIGRPD@@BABELD@\
66
@WATCHFRR@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@\
77
redhat @SOLARIS@ tests tools snapcraft
88

99
DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd\
1010
isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests\
11-
solaris pimd nhrpd eigrpd @LIBRFP@ @RFPTEST@ tools snapcraft
11+
solaris pimd nhrpd eigrpd @LIBRFP@ @RFPTEST@ tools snapcraft\
12+
babeld
1213

1314
EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS\
1415
update-autotools\

‎SERVICES

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ bgpd2605/tcp
1717
ospf6d2606/tcp
1818
ospfapi2607/tcp
1919
isisd2608/tcp
20-
#babeld2609/tcp
20+
babeld2609/tcp
2121
nhrpd2610/tcp
2222
pimd2611/tcp
2323
ldpd2612/tcp
24+
eigrpd2613/tcp

‎babeld/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*
2+
!*.c
3+
!*.h
4+
!LICENCE
5+
!Makefile.am
6+
!babeld.conf.sample
7+
!.gitignore

‎babeld/LICENCE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2007, 2008 by Juliusz Chroboczek
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

‎babeld/Makefile.am

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Process this file with automake to produce Makefile.in.
2+
3+
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
4+
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
5+
INSTALL_SDATA=@INSTALL@ -m 600
6+
7+
AM_CFLAGS =$(PICFLAGS)$(WERROR)
8+
AM_LDFLAGS =$(PILDFLAGS)
9+
10+
noinst_LIBRARIES = libbabel.a
11+
sbin_PROGRAMS = babeld
12+
13+
libbabel_a_SOURCES =\
14+
babel_zebra.c net.c kernel.c util.c source.c neighbour.c\
15+
route.c xroute.c message.c resend.c babel_interface.c babeld.c\
16+
babel_filter.c babel_memory.c
17+
18+
noinst_HEADERS =\
19+
babel_zebra.h net.h kernel.h util.h source.h neighbour.h\
20+
route.h xroute.h message.h resend.h babel_interface.h babeld.h\
21+
babel_filter.h babel_main.h babel_memory.h
22+
23+
babeld_SOURCES =\
24+
babel_main.c$(libbabel_a_SOURCES)
25+
26+
babeld_LDADD = ../lib/libfrr.la @LIBCAP@
27+
28+
examplesdir =$(exampledir)
29+
dist_examples_DATA = babeld.conf.sample

‎babeld/babel_filter.c

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.
21+
*/
22+
23+
#include"babel_filter.h"
24+
#include"vty.h"
25+
#include"filter.h"
26+
#include"log.h"
27+
#include"plist.h"
28+
#include"distribute.h"
29+
#include"util.h"
30+
31+
int
32+
babel_filter(intoutput,constunsignedchar*prefix,unsigned shortplen,
33+
unsignedintifindex)
34+
{
35+
structinterface*ifp=if_lookup_by_index(ifindex,VRF_DEFAULT);
36+
babel_interface_nfo*babel_ifp=ifp ?babel_get_if_nfo(ifp) :NULL;
37+
structprefixp;
38+
structdistribute*dist;
39+
structaccess_list*alist;
40+
structprefix_list*plist;
41+
intdistribute;
42+
43+
p.family=v4mapped(prefix) ?AF_INET :AF_INET6;
44+
p.prefixlen=v4mapped(prefix) ?plen-96 :plen;
45+
if (p.family==AF_INET) {
46+
uchar_to_inaddr(&p.u.prefix4,prefix);
47+
distribute=output ?DISTRIBUTE_V4_OUT :DISTRIBUTE_V4_IN;
48+
}else {
49+
uchar_to_in6addr(&p.u.prefix6,prefix);
50+
distribute=output ?DISTRIBUTE_V6_OUT :DISTRIBUTE_V6_IN;
51+
}
52+
53+
if (babel_ifp!=NULL&&babel_ifp->list[distribute]) {
54+
if (access_list_apply (babel_ifp->list[distribute],&p)
55+
==FILTER_DENY) {
56+
debugf(BABEL_DEBUG_FILTER,
57+
"%s/%d filtered by distribute %s",
58+
p.family==AF_INET ?
59+
inet_ntoa(p.u.prefix4) :
60+
inet6_ntoa (p.u.prefix6),
61+
p.prefixlen,
62+
output ?"out" :"in");
63+
returnINFINITY;
64+
}
65+
}
66+
if (babel_ifp!=NULL&&babel_ifp->prefix[distribute]) {
67+
if (prefix_list_apply (babel_ifp->prefix[distribute],&p)
68+
==PREFIX_DENY) {
69+
debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s",
70+
p.family==AF_INET ?
71+
inet_ntoa(p.u.prefix4) :
72+
inet6_ntoa (p.u.prefix6),
73+
p.prefixlen,
74+
output ?"out" :"in");
75+
returnINFINITY;
76+
}
77+
}
78+
79+
/* All interface filter check. */
80+
dist=distribute_lookup (NULL);
81+
if (dist) {
82+
if (dist->list[distribute]) {
83+
alist=access_list_lookup (p.family,dist->list[distribute]);
84+
85+
if (alist) {
86+
if (access_list_apply (alist,&p)==FILTER_DENY) {
87+
debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s",
88+
p.family==AF_INET ?
89+
inet_ntoa(p.u.prefix4) :
90+
inet6_ntoa (p.u.prefix6),
91+
p.prefixlen,
92+
output ?"out" :"in");
93+
returnINFINITY;
94+
}
95+
}
96+
}
97+
if (dist->prefix[distribute]) {
98+
plist=prefix_list_lookup (p.family,dist->prefix[distribute]);
99+
if (plist) {
100+
if (prefix_list_apply (plist,&p)==PREFIX_DENY) {
101+
debugf(BABEL_DEBUG_FILTER,"%s/%d filtered by distribute %s",
102+
p.family==AF_INET ?
103+
inet_ntoa(p.u.prefix4) :
104+
inet6_ntoa (p.u.prefix6),
105+
p.prefixlen,
106+
output ?"out" :"in");
107+
returnINFINITY;
108+
}
109+
}
110+
}
111+
}
112+
return0;
113+
}

‎babeld/babel_filter.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.
21+
*/
22+
23+
#ifndefBABELD_BABEL_FILTER_H
24+
#defineBABELD_BABEL_FILTER_H
25+
26+
#include<zebra.h>
27+
#include"prefix.h"
28+
#include"babel_interface.h"
29+
30+
intbabel_filter(intoutput,constunsignedchar*prefix,unsigned shortplen,
31+
unsignedintindex);
32+
33+
#endif/* BABELD_BABEL_FILTER_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp