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
22eea519
Commit
22eea519
authored
Jan 02, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nexthop field to struct route.
parent
b2115006
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
message.c
message.c
+4
-2
route.c
route.c
+11
-9
route.h
route.h
+4
-2
No files found.
message.c
View file @
22eea519
...
...
@@ -192,7 +192,8 @@ parse_packet(const unsigned char *from, struct network *net,
if
(
plen
<=
128
)
{
unsigned
char
prefix
[
16
];
mask_prefix
(
prefix
,
address
,
plen
);
update_route
(
address
,
prefix
,
plen
,
seqno
,
metric
,
neigh
);
update_route
(
address
,
prefix
,
plen
,
seqno
,
metric
,
neigh
,
neigh
->
address
);
}
}
else
if
(
type
==
4
)
{
unsigned
char
prefix
[
16
];
...
...
@@ -212,7 +213,8 @@ parse_packet(const unsigned char *from, struct network *net,
if
(
memcmp
(
current_source
,
myid
,
16
)
==
0
)
continue
;
mask_prefix
(
prefix
,
address
,
plen
);
update_route
(
current_source
,
prefix
,
plen
,
seqno
,
metric
,
neigh
);
update_route
(
current_source
,
prefix
,
plen
,
seqno
,
metric
,
neigh
,
neigh
->
address
);
}
else
{
debugf
(
"Received unknown packet type %d from %s (%s).
\n
"
,
type
,
format_address
(
neigh
->
id
),
format_address
(
from
));
...
...
route.c
View file @
22eea519
...
...
@@ -45,11 +45,12 @@ int route_gc_delay = 180;
struct
route
*
find_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
neighbour
*
neigh
)
struct
neighbour
*
neigh
,
const
unsigned
char
*
nexthop
)
{
int
i
;
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
{
if
(
routes
[
i
].
neigh
==
neigh
&&
memcmp
(
routes
[
i
].
nexthop
,
nexthop
,
16
)
==
0
&&
source_match
(
routes
[
i
].
src
,
prefix
,
plen
))
return
&
routes
[
i
];
}
...
...
@@ -130,7 +131,7 @@ install_route(struct route *route)
return
;
rc
=
kernel_route
(
ROUTE_ADD
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
ne
igh
->
address
,
route
->
ne
xthop
,
route
->
neigh
->
network
->
ifindex
,
metric_to_kernel
(
route
->
metric
),
NULL
,
0
,
0
);
if
(
rc
<
0
)
{
...
...
@@ -150,7 +151,7 @@ uninstall_route(struct route *route)
return
;
rc
=
kernel_route
(
ROUTE_FLUSH
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
ne
igh
->
address
,
route
->
ne
xthop
,
route
->
neigh
->
network
->
ifindex
,
metric_to_kernel
(
route
->
metric
),
NULL
,
0
,
0
);
if
(
rc
<
0
)
...
...
@@ -177,9 +178,9 @@ change_route(struct route *old, struct route *new)
return
;
rc
=
kernel_route
(
ROUTE_MODIFY
,
old
->
src
->
prefix
,
old
->
src
->
plen
,
old
->
ne
igh
->
address
,
old
->
neigh
->
network
->
ifindex
,
old
->
ne
xthop
,
old
->
neigh
->
network
->
ifindex
,
metric_to_kernel
(
old
->
metric
),
new
->
ne
igh
->
address
,
new
->
neigh
->
network
->
ifindex
,
new
->
ne
xthop
,
new
->
neigh
->
network
->
ifindex
,
metric_to_kernel
(
new
->
metric
));
if
(
rc
>=
0
)
{
old
->
installed
=
0
;
...
...
@@ -195,10 +196,10 @@ change_route_metric(struct route *route, int newmetric)
if
(
route
->
installed
)
{
rc
=
kernel_route
(
ROUTE_MODIFY
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
ne
igh
->
address
,
route
->
ne
xthop
,
route
->
neigh
->
network
->
ifindex
,
metric_to_kernel
(
route
->
metric
),
route
->
ne
igh
->
address
,
route
->
ne
xthop
,
route
->
neigh
->
network
->
ifindex
,
metric_to_kernel
(
newmetric
));
if
(
rc
<
0
)
{
...
...
@@ -307,7 +308,7 @@ update_neighbour_metric(struct neighbour *neigh)
struct
route
*
update_route
(
const
unsigned
char
*
a
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
refmetric
,
struct
neighbour
*
neigh
)
struct
neighbour
*
neigh
,
const
unsigned
char
*
nexthop
)
{
struct
route
*
route
;
struct
source
*
src
;
...
...
@@ -327,7 +328,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
return
NULL
;
feasible
=
update_feasible
(
a
,
p
,
plen
,
seqno
,
refmetric
);
route
=
find_route
(
p
,
plen
,
neigh
);
route
=
find_route
(
p
,
plen
,
neigh
,
nexthop
);
metric
=
MIN
((
int
)
refmetric
+
neighbour_cost
(
neigh
),
INFINITY
);
if
(
route
)
{
...
...
@@ -385,6 +386,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
route
->
seqno
=
seqno
;
route
->
metric
=
metric
;
route
->
neigh
=
neigh
;
memcpy
(
route
->
nexthop
,
nexthop
,
16
);
route
->
time
=
now
.
tv_sec
;
route
->
origtime
=
now
.
tv_sec
;
route
->
installed
=
0
;
...
...
route.h
View file @
22eea519
...
...
@@ -26,6 +26,7 @@ struct route {
unsigned
short
refmetric
;
unsigned
short
seqno
;
struct
neighbour
*
neigh
;
unsigned
char
nexthop
[
16
];
int
time
;
int
origtime
;
int
installed
;
...
...
@@ -38,7 +39,7 @@ extern int route_timeout_delay;
extern
int
route_gc_delay
;
struct
route
*
find_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
neighbour
*
neigh
);
struct
neighbour
*
neigh
,
const
unsigned
char
*
nexthop
);
struct
route
*
find_installed_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
void
flush_route
(
struct
route
*
route
);
...
...
@@ -60,7 +61,8 @@ void update_route_metric(struct route *route);
struct
route
*
update_route
(
const
unsigned
char
*
a
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
refmetric
,
struct
neighbour
*
neigh
);
struct
neighbour
*
neigh
,
const
unsigned
char
*
nexthop
);
void
consider_route
(
struct
route
*
route
);
void
send_triggered_update
(
struct
route
*
route
,
struct
source
*
oldsrc
,
int
oldmetric
);
...
...
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