Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
928a970f
Commit
928a970f
authored
Mar 13, 2015
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify interface of input/output filter.
parent
0bffdbe3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
17 deletions
+13
-17
configuration.c
configuration.c
+6
-6
configuration.h
configuration.h
+2
-4
message.c
message.c
+1
-1
resend.c
resend.c
+2
-3
route.c
route.c
+2
-3
No files found.
configuration.c
View file @
928a970f
...
@@ -1005,6 +1005,7 @@ do_filter(struct filter *f, const unsigned char *id,
...
@@ -1005,6 +1005,7 @@ do_filter(struct filter *f, const unsigned char *id,
{
{
if
(
result
)
if
(
result
)
memset
(
result
,
0
,
sizeof
(
struct
filter_result
));
memset
(
result
,
0
,
sizeof
(
struct
filter_result
));
while
(
f
)
{
while
(
f
)
{
if
(
filter_match
(
f
,
id
,
prefix
,
plen
,
src_prefix
,
src_plen
,
if
(
filter_match
(
f
,
id
,
prefix
,
plen
,
src_prefix
,
src_plen
,
neigh
,
ifindex
,
proto
))
{
neigh
,
ifindex
,
proto
))
{
...
@@ -1014,6 +1015,7 @@ do_filter(struct filter *f, const unsigned char *id,
...
@@ -1014,6 +1015,7 @@ do_filter(struct filter *f, const unsigned char *id,
}
}
f
=
f
->
next
;
f
=
f
->
next
;
}
}
return
-
1
;
return
-
1
;
}
}
...
@@ -1021,12 +1023,11 @@ int
...
@@ -1021,12 +1023,11 @@ int
input_filter
(
const
unsigned
char
*
id
,
input_filter
(
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
const
unsigned
char
*
neigh
,
unsigned
int
ifindex
,
const
unsigned
char
*
neigh
,
unsigned
int
ifindex
)
struct
filter_result
*
result
)
{
{
int
res
;
int
res
;
res
=
do_filter
(
input_filters
,
id
,
prefix
,
plen
,
res
=
do_filter
(
input_filters
,
id
,
prefix
,
plen
,
src_prefix
,
src_plen
,
neigh
,
ifindex
,
0
,
result
);
src_prefix
,
src_plen
,
neigh
,
ifindex
,
0
,
NULL
);
if
(
res
<
0
)
if
(
res
<
0
)
res
=
0
;
res
=
0
;
return
res
;
return
res
;
...
@@ -1036,12 +1037,11 @@ int
...
@@ -1036,12 +1037,11 @@ int
output_filter
(
const
unsigned
char
*
id
,
output_filter
(
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
unsigned
int
ifindex
,
unsigned
int
ifindex
)
struct
filter_result
*
result
)
{
{
int
res
;
int
res
;
res
=
do_filter
(
output_filters
,
id
,
prefix
,
plen
,
res
=
do_filter
(
output_filters
,
id
,
prefix
,
plen
,
src_prefix
,
src_plen
,
NULL
,
ifindex
,
0
,
result
);
src_prefix
,
src_plen
,
NULL
,
ifindex
,
0
,
NULL
);
if
(
res
<
0
)
if
(
res
<
0
)
res
=
0
;
res
=
0
;
return
res
;
return
res
;
...
...
configuration.h
View file @
928a970f
...
@@ -52,13 +52,11 @@ void renumber_filters(void);
...
@@ -52,13 +52,11 @@ void renumber_filters(void);
int
input_filter
(
const
unsigned
char
*
id
,
int
input_filter
(
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
const
unsigned
char
*
neigh
,
unsigned
int
ifindex
,
const
unsigned
char
*
neigh
,
unsigned
int
ifindex
);
struct
filter_result
*
result
);
int
output_filter
(
const
unsigned
char
*
id
,
int
output_filter
(
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
unsigned
int
ifindex
,
unsigned
int
ifindex
);
struct
filter_result
*
result
);
int
redistribute_filter
(
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
int
redistribute_filter
(
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
const
unsigned
char
*
src_prefix
,
unsigned
short
src_plen
,
unsigned
int
ifindex
,
int
proto
,
unsigned
int
ifindex
,
int
proto
,
...
...
message.c
View file @
928a970f
...
@@ -1160,7 +1160,7 @@ really_send_update(struct interface *ifp,
...
@@ -1160,7 +1160,7 @@ really_send_update(struct interface *ifp,
return
;
return
;
add_metric
=
output_filter
(
id
,
prefix
,
plen
,
src_prefix
,
add_metric
=
output_filter
(
id
,
prefix
,
plen
,
src_prefix
,
src_plen
,
ifp
->
ifindex
,
NULL
);
src_plen
,
ifp
->
ifindex
);
if
(
add_metric
>=
INFINITY
)
if
(
add_metric
>=
INFINITY
)
return
;
return
;
...
...
resend.c
View file @
928a970f
...
@@ -97,11 +97,10 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
...
@@ -97,11 +97,10 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
if
((
kind
==
RESEND_REQUEST
&&
if
((
kind
==
RESEND_REQUEST
&&
input_filter
(
NULL
,
prefix
,
plen
,
src_prefix
,
src_plen
,
NULL
,
input_filter
(
NULL
,
prefix
,
plen
,
src_prefix
,
src_plen
,
NULL
,
ifindex
,
NULL
)
>=
ifindex
)
>=
INFINITY
)
||
INFINITY
)
||
(
kind
==
RESEND_UPDATE
&&
(
kind
==
RESEND_UPDATE
&&
output_filter
(
NULL
,
prefix
,
plen
,
src_prefix
,
src_plen
,
output_filter
(
NULL
,
prefix
,
plen
,
src_prefix
,
src_plen
,
ifindex
)
>=
ifindex
,
NULL
)
>=
INFINITY
))
INFINITY
))
return
0
;
return
0
;
...
...
route.c
View file @
928a970f
...
@@ -806,7 +806,7 @@ update_route_metric(struct babel_route *route)
...
@@ -806,7 +806,7 @@ update_route_metric(struct babel_route *route)
route
->
src
->
src_prefix
,
route
->
src
->
src_prefix
,
route
->
src
->
src_plen
,
route
->
src
->
src_plen
,
neigh
->
address
,
neigh
->
address
,
neigh
->
ifp
->
ifindex
,
NULL
);
neigh
->
ifp
->
ifindex
);
change_route_metric
(
route
,
route
->
refmetric
,
change_route_metric
(
route
,
route
->
refmetric
,
neighbour_cost
(
route
->
neigh
),
add_metric
);
neighbour_cost
(
route
->
neigh
),
add_metric
);
if
(
route_metric
(
route
)
!=
oldmetric
||
if
(
route_metric
(
route
)
!=
oldmetric
||
...
@@ -889,8 +889,7 @@ update_route(const unsigned char *id,
...
@@ -889,8 +889,7 @@ update_route(const unsigned char *id,
add_metric
=
input_filter
(
id
,
prefix
,
plen
,
src_prefix
,
src_plen
,
add_metric
=
input_filter
(
id
,
prefix
,
plen
,
src_prefix
,
src_plen
,
neigh
->
address
,
neigh
->
ifp
->
ifindex
,
neigh
->
address
,
neigh
->
ifp
->
ifindex
);
NULL
);
if
(
add_metric
>=
INFINITY
)
if
(
add_metric
>=
INFINITY
)
return
NULL
;
return
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment