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
675dc627
Commit
675dc627
authored
Sep 03, 2013
by
Baptiste Jonglez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute the RTT to a neighbour
To do this, we use the timestamps piggybacked on Hello and IHU messages.
parent
c7c5578c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
message.c
message.c
+23
-2
No files found.
message.c
View file @
675dc627
...
@@ -280,6 +280,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -280,6 +280,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
have_v4_nh
=
0
,
have_v6_nh
=
0
;
have_v4_nh
=
0
,
have_v6_nh
=
0
;
unsigned
char
router_id
[
8
],
v4_prefix
[
16
],
v6_prefix
[
16
],
unsigned
char
router_id
[
8
],
v4_prefix
[
16
],
v6_prefix
[
16
],
v4_nh
[
16
],
v6_nh
[
16
];
v4_nh
[
16
],
v6_nh
[
16
];
int
have_hello_rtt
=
0
;
/* Content of the RTT sub-TLV on IHU messages. */
/* Content of the RTT sub-TLV on IHU messages. */
unsigned
int
hello_send_us
=
0
,
hello_rtt_receive_time
=
0
;
unsigned
int
hello_send_us
=
0
,
hello_rtt_receive_time
=
0
;
...
@@ -369,8 +370,10 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -369,8 +370,10 @@ parse_packet(const unsigned char *from, struct interface *ifp,
/* Multiply by 3/2 to allow hellos to expire. */
/* Multiply by 3/2 to allow hellos to expire. */
schedule_neighbours_check
(
interval
*
15
,
0
);
schedule_neighbours_check
(
interval
*
15
,
0
);
/* Sub-TLV handling. */
/* Sub-TLV handling. */
if
(
len
>
8
)
if
(
len
>
8
)
{
parse_hello_subtlv
(
message
+
8
,
len
-
6
,
neigh
);
if
(
parse_hello_subtlv
(
message
+
8
,
len
-
6
,
neigh
)
>
0
)
have_hello_rtt
=
1
;
}
}
else
if
(
type
==
MESSAGE_IHU
)
{
}
else
if
(
type
==
MESSAGE_IHU
)
{
unsigned
short
txcost
,
interval
;
unsigned
short
txcost
,
interval
;
unsigned
char
address
[
16
];
unsigned
char
address
[
16
];
...
@@ -590,6 +593,24 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -590,6 +593,24 @@ parse_packet(const unsigned char *from, struct interface *ifp,
message
[
0
],
message
[
1
],
format_address
(
from
),
ifp
->
name
);
message
[
0
],
message
[
1
],
format_address
(
from
),
ifp
->
name
);
goto
done
;
goto
done
;
}
}
/* We can calculate the RTT to this neighbour. */
if
(
have_hello_rtt
&&
hello_send_us
&&
hello_rtt_receive_time
)
{
int
remote_waiting_us
,
local_waiting_us
;
int
rtt
;
remote_waiting_us
=
neigh
->
hello_send_us
-
hello_rtt_receive_time
;
local_waiting_us
=
time_us
(
neigh
->
hello_rtt_receive_time
)
-
hello_send_us
;
/* Sanity checks (validity window of 10 minutes). */
if
(
remote_waiting_us
<
0
||
local_waiting_us
<
0
||
remote_waiting_us
>
600000000
||
local_waiting_us
>
600000000
)
return
;
rtt
=
local_waiting_us
-
remote_waiting_us
;
debugf
(
"RTT to %s on %s sample result: %d us.
\n
"
,
format_address
(
from
),
ifp
->
name
,
rtt
);
}
return
;
return
;
}
}
...
...
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