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
3223774e
Commit
3223774e
authored
Feb 11, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow simultaneous le and ge in single rule.
parent
25385b66
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
20 deletions
+12
-20
filter.c
filter.c
+11
-14
filter.h
filter.h
+1
-6
No files found.
filter.c
View file @
3223774e
...
...
@@ -158,6 +158,7 @@ parse_filter(gnc_t gnc, void *closure)
filter
=
calloc
(
1
,
sizeof
(
struct
filter
));
if
(
filter
==
NULL
)
goto
error
;
filter
->
plen_le
=
128
;
c
=
gnc
(
closure
);
if
(
c
<
-
1
)
...
...
@@ -183,22 +184,20 @@ parse_filter(gnc_t gnc, void *closure)
c
=
getint
(
c
,
&
p
,
gnc
,
closure
);
if
(
c
<
-
1
)
goto
error
;
filter
->
plen_
type
=
FILTER_PLEN_EQ
;
filter
->
filter_plen
=
p
;
filter
->
plen_
ge
=
MAX
(
filter
->
plen_ge
,
p
)
;
filter
->
plen_le
=
MIN
(
filter
->
plen_le
,
p
)
;
}
else
if
(
strcmp
(
token
,
"le"
)
==
0
)
{
int
p
;
c
=
getint
(
c
,
&
p
,
gnc
,
closure
);
if
(
c
<
-
1
)
goto
error
;
filter
->
plen_type
=
FILTER_PLEN_LE
;
filter
->
filter_plen
=
p
;
filter
->
plen_le
=
MIN
(
filter
->
plen_le
,
p
);
}
else
if
(
strcmp
(
token
,
"ge"
)
==
0
)
{
int
p
;
c
=
getint
(
c
,
&
p
,
gnc
,
closure
);
if
(
c
<
-
1
)
goto
error
;
filter
->
plen_type
=
FILTER_PLEN_GE
;
filter
->
filter_plen
=
p
;
filter
->
plen_ge
=
MAX
(
filter
->
plen_ge
,
p
);
}
else
if
(
strcmp
(
token
,
"neigh"
)
==
0
)
{
unsigned
char
*
neigh
;
c
=
getip
(
c
,
&
neigh
,
NULL
,
gnc
,
closure
);
...
...
@@ -242,11 +241,11 @@ parse_filter(gnc_t gnc, void *closure)
free
(
token
);
}
if
(
filter
->
af
==
0
)
{
if
(
filter
->
plen_
type
)
if
(
filter
->
plen_
le
<
128
||
filter
->
plen_ge
>
0
)
filter
->
af
=
AF_INET6
;
}
else
if
(
filter
->
af
==
AF_INET
)
{
if
(
filter
->
plen_type
)
filter
->
filter_plen
+=
96
;
filter
->
plen_le
+=
96
;
filter
->
plen_ge
+=
96
;
}
return
filter
;
error:
...
...
@@ -381,14 +380,12 @@ filter_match(struct filter *f, const unsigned char *id,
if
(
!
prefix
||
plen
<
f
->
plen
||
!
in_prefix
(
prefix
,
f
->
prefix
,
f
->
plen
))
return
0
;
}
if
(
f
->
plen_
type
)
{
if
(
f
->
plen_
ge
>
0
||
f
->
plen_le
<
128
)
{
if
(
!
prefix
)
return
0
;
if
(
f
->
plen_type
==
FILTER_PLEN_EQ
&&
plen
!=
f
->
filter_plen
)
if
(
plen
>
f
->
plen_le
)
return
0
;
if
(
f
->
plen_type
==
FILTER_PLEN_LE
&&
plen
>
f
->
filter_plen
)
return
0
;
if
(
f
->
plen_type
==
FILTER_PLEN_GE
&&
plen
<
f
->
filter_plen
)
if
(
plen
<
f
->
plen_ge
)
return
0
;
}
if
(
f
->
neigh
)
{
...
...
filter.h
View file @
3223774e
...
...
@@ -20,10 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#define FILTER_PLEN_EQ 1
#define FILTER_PLEN_LE 2
#define FILTER_PLEN_GE 3
#define METRIC_INHERIT (INFINITY + 1)
struct
filter
{
...
...
@@ -32,8 +28,7 @@ struct filter {
unsigned
char
*
id
;
unsigned
char
*
prefix
;
unsigned
char
plen
;
unsigned
char
filter_plen
;
unsigned
char
plen_type
;
unsigned
char
plen_ge
,
plen_le
;
unsigned
char
*
neigh
;
int
proto
;
unsigned
int
result
;
...
...
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