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
a03c9ce2
Commit
a03c9ce2
authored
Aug 18, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make route switch atomic.
parent
c7440a51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
route.c
route.c
+29
-3
route.h
route.h
+1
-0
No files found.
route.c
View file @
a03c9ce2
...
@@ -157,6 +157,34 @@ uninstall_route(struct route *route)
...
@@ -157,6 +157,34 @@ uninstall_route(struct route *route)
route
->
installed
=
0
;
route
->
installed
=
0
;
}
}
/* This is equivalent to uninstall_route followed with install_route,
but without the race condition. The destination of both routes
must be the same. */
void
change_route
(
struct
route
*
old
,
struct
route
*
new
)
{
int
rc
;
if
(
!
old
)
{
install_route
(
new
);
return
;
}
if
(
!
old
->
installed
)
return
;
rc
=
kernel_route
(
ROUTE_MODIFY
,
old
->
src
->
prefix
,
old
->
src
->
plen
,
old
->
nexthop
->
address
,
old
->
nexthop
->
network
->
ifindex
,
metric_to_kernel
(
old
->
metric
),
new
->
nexthop
->
address
,
new
->
nexthop
->
network
->
ifindex
,
metric_to_kernel
(
new
->
metric
));
if
(
rc
>=
0
)
{
old
->
installed
=
0
;
new
->
installed
=
1
;
}
}
void
void
change_route_metric
(
struct
route
*
route
,
int
newmetric
)
change_route_metric
(
struct
route
*
route
,
int
newmetric
)
{
{
...
@@ -403,9 +431,7 @@ consider_route(struct route *route)
...
@@ -403,9 +431,7 @@ consider_route(struct route *route)
return
;
return
;
install:
install:
if
(
installed
)
change_route
(
installed
,
route
);
uninstall_route
(
installed
);
install_route
(
route
);
if
(
installed
&&
route
->
installed
)
if
(
installed
&&
route
->
installed
)
send_triggered_update
(
route
,
installed
->
src
,
installed
->
metric
);
send_triggered_update
(
route
,
installed
->
src
,
installed
->
metric
);
else
else
...
...
route.h
View file @
a03c9ce2
...
@@ -46,6 +46,7 @@ void flush_neighbour_routes(struct neighbour *neigh);
...
@@ -46,6 +46,7 @@ void flush_neighbour_routes(struct neighbour *neigh);
unsigned
int
metric_to_kernel
(
int
metric
);
unsigned
int
metric_to_kernel
(
int
metric
);
void
install_route
(
struct
route
*
route
);
void
install_route
(
struct
route
*
route
);
void
uninstall_route
(
struct
route
*
route
);
void
uninstall_route
(
struct
route
*
route
);
void
change_route
(
struct
route
*
old
,
struct
route
*
new
);
void
change_route_metric
(
struct
route
*
route
,
int
newmetric
);
void
change_route_metric
(
struct
route
*
route
,
int
newmetric
);
int
route_feasible
(
struct
route
*
route
);
int
route_feasible
(
struct
route
*
route
);
int
update_feasible
(
const
unsigned
char
*
a
,
int
update_feasible
(
const
unsigned
char
*
a
,
...
...
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