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
99202246
Commit
99202246
authored
Apr 14, 2009
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace KERNEL_METRIC with a function.
parent
53e06455
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
route.c
route.c
+11
-8
No files found.
route.c
View file @
99202246
...
@@ -128,8 +128,11 @@ flush_neighbour_routes(struct neighbour *neigh)
...
@@ -128,8 +128,11 @@ flush_neighbour_routes(struct neighbour *neigh)
}
}
}
}
#define KERNEL_METRIC(_metric) \
static
int
((_metric) < INFINITY ? kernel_metric : KERNEL_INFINITY)
metric_to_kernel
(
int
metric
)
{
return
metric
<
INFINITY
?
kernel_metric
:
KERNEL_INFINITY
;
}
void
void
install_route
(
struct
route
*
route
)
install_route
(
struct
route
*
route
)
...
@@ -142,7 +145,7 @@ install_route(struct route *route)
...
@@ -142,7 +145,7 @@ install_route(struct route *route)
rc
=
kernel_route
(
ROUTE_ADD
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
rc
=
kernel_route
(
ROUTE_ADD
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
nexthop
,
route
->
nexthop
,
route
->
neigh
->
network
->
ifindex
,
route
->
neigh
->
network
->
ifindex
,
KERNEL_METRIC
(
route
->
metric
),
NULL
,
0
,
0
);
metric_to_kernel
(
route
->
metric
),
NULL
,
0
,
0
);
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
int
save
=
errno
;
int
save
=
errno
;
perror
(
"kernel_route(ADD)"
);
perror
(
"kernel_route(ADD)"
);
...
@@ -164,7 +167,7 @@ uninstall_route(struct route *route)
...
@@ -164,7 +167,7 @@ uninstall_route(struct route *route)
rc
=
kernel_route
(
ROUTE_FLUSH
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
rc
=
kernel_route
(
ROUTE_FLUSH
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
nexthop
,
route
->
nexthop
,
route
->
neigh
->
network
->
ifindex
,
route
->
neigh
->
network
->
ifindex
,
KERNEL_METRIC
(
route
->
metric
),
NULL
,
0
,
0
);
metric_to_kernel
(
route
->
metric
),
NULL
,
0
,
0
);
if
(
rc
<
0
)
if
(
rc
<
0
)
perror
(
"kernel_route(FLUSH)"
);
perror
(
"kernel_route(FLUSH)"
);
...
@@ -191,9 +194,9 @@ switch_routes(struct route *old, struct route *new)
...
@@ -191,9 +194,9 @@ switch_routes(struct route *old, struct route *new)
rc
=
kernel_route
(
ROUTE_MODIFY
,
old
->
src
->
prefix
,
old
->
src
->
plen
,
rc
=
kernel_route
(
ROUTE_MODIFY
,
old
->
src
->
prefix
,
old
->
src
->
plen
,
old
->
nexthop
,
old
->
neigh
->
network
->
ifindex
,
old
->
nexthop
,
old
->
neigh
->
network
->
ifindex
,
KERNEL_METRIC
(
old
->
metric
),
metric_to_kernel
(
old
->
metric
),
new
->
nexthop
,
new
->
neigh
->
network
->
ifindex
,
new
->
nexthop
,
new
->
neigh
->
network
->
ifindex
,
KERNEL_METRIC
(
new
->
metric
));
metric_to_kernel
(
new
->
metric
));
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
perror
(
"kernel_route(MODIFY)"
);
perror
(
"kernel_route(MODIFY)"
);
return
;
return
;
...
@@ -214,8 +217,8 @@ change_route_metric(struct route *route, unsigned newmetric)
...
@@ -214,8 +217,8 @@ change_route_metric(struct route *route, unsigned newmetric)
if
(
route
->
metric
==
newmetric
)
if
(
route
->
metric
==
newmetric
)
return
;
return
;
old
=
KERNEL_METRIC
(
route
->
metric
);
old
=
metric_to_kernel
(
route
->
metric
);
new
=
KERNEL_METRIC
(
newmetric
);
new
=
metric_to_kernel
(
newmetric
);
if
(
route
->
installed
&&
old
!=
new
)
{
if
(
route
->
installed
&&
old
!=
new
)
{
int
rc
;
int
rc
;
...
...
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