Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
ffbs-gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
darkbit
ffbs-gluon
Commits
e909d45a
Commit
e909d45a
authored
6 years ago
by
Jan-Philipp Litza
Committed by
Andreas Ziegler
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gluon-radv-filterd: Invalidate originators cache after some time (#1343)
parent
603912dd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-radv-filterd/src/gluon-radv-filterd.c
+23
-0
23 additions, 0 deletions
package/gluon-radv-filterd/src/gluon-radv-filterd.c
with
23 additions
and
0 deletions
package/gluon-radv-filterd/src/gluon-radv-filterd.c
+
23
−
0
View file @
e909d45a
...
...
@@ -67,6 +67,10 @@
// Also, the first update will take at least this long
#define MIN_INTERVAL 15
// Remember the originator of a router for at most this period of time (in
// seconds). Re-read it from the transtable afterwards.
#define ORIGINATOR_CACHE_TTL 300
// max execution time of a single ebtables call in nanoseconds
#define EBTABLES_TIMEOUT 500000000 // 500ms
...
...
@@ -727,6 +731,14 @@ static void update_ebtables(void) {
error_message
(
0
,
0
,
"warning: adding new rule to ebtables chain %s failed"
,
G
.
chain
);
}
static
void
invalidate_originators
(
void
)
{
struct
router
*
router
;
foreach
(
router
,
G
.
routers
)
{
memset
(
&
router
->
originator
,
0
,
sizeof
(
router
->
originator
));
}
}
static
void
sighandler
(
int
sig
__attribute__
((
unused
)))
{
G
.
stop_daemon
=
1
;
...
...
@@ -737,12 +749,16 @@ int main(int argc, char *argv[]) {
fd_set
rfds
;
struct
timeval
tv
;
struct
timespec
next_update
;
struct
timespec
next_invalidation
;
struct
timespec
now
;
struct
timespec
diff
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
next_update
);
next_update
.
tv_sec
+=
MIN_INTERVAL
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
next_invalidation
);
next_invalidation
.
tv_sec
+=
MIN_INTERVAL
;
G
.
sock
=
-
1
;
parse_cmdline
(
argc
,
argv
);
...
...
@@ -782,6 +798,13 @@ int main(int argc, char *argv[]) {
// all routers could have expired, check again
if
(
G
.
routers
!=
NULL
)
{
if
(
timespec_diff
(
&
now
,
&
next_invalidation
,
&
diff
))
{
invalidate_originators
();
next_invalidation
=
now
;
next_invalidation
.
tv_sec
+=
ORIGINATOR_CACHE_TTL
;
}
update_tqs
();
update_ebtables
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment