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
0ddb7103
Commit
0ddb7103
authored
Nov 19, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic filtering infrastructure.
parent
6dc2fe8b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
11 deletions
+87
-11
Makefile
Makefile
+2
-2
filter.c
filter.c
+37
-0
filter.h
filter.h
+27
-0
message.c
message.c
+12
-9
request.c
request.c
+5
-0
route.c
route.c
+4
-0
No files found.
Makefile
View file @
0ddb7103
...
...
@@ -7,10 +7,10 @@ DEFINES = $(PLATFORM_DEFINES)
CFLAGS
=
$(CDEBUGFLAGS)
$(DEFINES)
$(EXTRA_DEFINES)
SRCS
=
babel.c net.c kernel.c util.c source.c neighbour.c
\
route.c xroute.c message.c request.c
route.c xroute.c message.c request.c
filter.c
OBJS
=
babel.o net.o kernel.o util.o source.o neighbour.o
\
route.o xroute.o message.o request.o
route.o xroute.o message.o request.o
filter.o
babel
:
$(OBJS)
$(CC)
$(CFLAGS)
$(LDFLAGS)
-o
babel
$(OBJS)
$(LDLIBS)
...
...
filter.c
0 → 100644
View file @
0ddb7103
/*
Copyright (c) 2007 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.
*/
int
import_filter
(
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
nexthop
)
{
return
0
;
}
int
export_filter
(
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
)
{
return
0
;
}
filter.h
0 → 100644
View file @
0ddb7103
/*
Copyright (c) 2007 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.
*/
int
import_filter
(
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
,
const
unsigned
char
*
nexthop
);
int
export_filter
(
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
short
plen
);
message.c
View file @
0ddb7103
...
...
@@ -36,6 +36,7 @@ THE SOFTWARE.
#include "xroute.h"
#include "request.h"
#include "message.h"
#include "filter.h"
struct
timeval
update_flush_time
=
{
0
,
0
};
...
...
@@ -522,15 +523,17 @@ really_send_update(struct network *net,
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
metric
)
{
if
(
in_prefix
(
address
,
prefix
,
plen
))
{
send_message
(
net
,
3
,
plen
,
0
,
seqno
,
metric
,
address
);
}
else
{
unsigned
const
char
*
sid
;
start_message
(
net
,
48
);
sid
=
message_source_id
(
net
);
if
(
sid
==
NULL
||
memcmp
(
address
,
sid
,
16
)
!=
0
)
send_message
(
net
,
3
,
0xFF
,
0
,
0
,
0xFFFF
,
address
);
send_message
(
net
,
4
,
plen
,
0
,
seqno
,
metric
,
prefix
);
if
(
!
export_filter
(
address
,
prefix
,
plen
))
{
if
(
in_prefix
(
address
,
prefix
,
plen
))
{
send_message
(
net
,
3
,
plen
,
0
,
seqno
,
metric
,
address
);
}
else
{
unsigned
const
char
*
sid
;
start_message
(
net
,
48
);
sid
=
message_source_id
(
net
);
if
(
sid
==
NULL
||
memcmp
(
address
,
sid
,
16
)
!=
0
)
send_message
(
net
,
3
,
0xFF
,
0
,
0
,
0xFFFF
,
address
);
send_message
(
net
,
4
,
plen
,
0
,
seqno
,
metric
,
prefix
);
}
}
satisfy_request
(
prefix
,
plen
,
seqno
,
hash_id
(
address
),
net
);
}
...
...
request.c
View file @
0ddb7103
...
...
@@ -30,6 +30,7 @@ THE SOFTWARE.
#include "neighbour.h"
#include "request.h"
#include "message.h"
#include "filter.h"
int
request_resend_time
=
0
;
struct
request
*
recorded_requests
=
NULL
;
...
...
@@ -69,6 +70,10 @@ record_request(const unsigned char *prefix, unsigned char plen,
{
struct
request
*
request
;
if
(
import_filter
(
NULL
,
prefix
,
plen
,
NULL
)
||
export_filter
(
NULL
,
prefix
,
plen
))
return
0
;
request
=
find_request
(
prefix
,
plen
,
NULL
);
if
(
request
)
{
if
(
request
->
resend
&&
resend
)
...
...
route.c
View file @
0ddb7103
...
...
@@ -35,6 +35,7 @@ THE SOFTWARE.
#include "xroute.h"
#include "message.h"
#include "request.h"
#include "filter.h"
struct
route
routes
[
MAXROUTES
];
int
numroutes
=
0
;
...
...
@@ -318,6 +319,9 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
return
NULL
;
}
if
(
import_filter
(
a
,
p
,
plen
,
nexthop
->
id
))
return
NULL
;
src
=
find_source
(
a
,
p
,
plen
,
1
,
seqno
);
if
(
src
==
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