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
c7c5578c
Commit
c7c5578c
authored
Sep 03, 2013
by
Baptiste Jonglez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parse timestamps on incoming IHU messages
parent
311aa83c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
message.c
message.c
+51
-0
No files found.
message.c
View file @
c7c5578c
...
@@ -208,6 +208,51 @@ parse_hello_subtlv(const unsigned char *a, int alen, struct neighbour *neigh)
...
@@ -208,6 +208,51 @@ parse_hello_subtlv(const unsigned char *a, int alen, struct neighbour *neigh)
return
ret
;
return
ret
;
}
}
static
int
parse_ihu_subtlv
(
const
unsigned
char
*
a
,
int
alen
,
unsigned
int
*
hello_send_us
,
unsigned
int
*
hello_rtt_receive_time
)
{
int
type
,
len
,
i
=
0
,
ret
=
0
;
while
(
i
<
alen
)
{
type
=
a
[
0
];
if
(
type
==
SUBTLV_PAD1
)
{
i
++
;
continue
;
}
if
(
i
+
1
>
alen
)
{
fprintf
(
stderr
,
"Received truncated sub-TLV on IHU message.
\n
"
);
return
-
1
;
}
len
=
a
[
i
+
1
];
if
(
i
+
len
>
alen
)
{
fprintf
(
stderr
,
"Received truncated sub-TLV on IHU message.
\n
"
);
return
-
1
;
}
if
(
type
==
SUBTLV_PADN
)
{
/* Nothing to do. */
}
else
if
(
type
==
SUBTLV_TIMESTAMP
)
{
if
(
len
>=
8
)
{
DO_NTOHL
(
*
hello_send_us
,
a
+
i
+
2
);
DO_NTOHL
(
*
hello_rtt_receive_time
,
a
+
i
+
6
);
ret
=
1
;
}
else
{
fprintf
(
stderr
,
"Received incorrect RTT sub-TLV on IHU message.
\n
"
);
}
}
else
{
fprintf
(
stderr
,
"Received unknown IHU sub-TLV type %d.
\n
"
,
type
);
}
i
+=
len
+
2
;
}
return
ret
;
}
static
int
static
int
network_address
(
int
ae
,
const
unsigned
char
*
a
,
unsigned
int
len
,
network_address
(
int
ae
,
const
unsigned
char
*
a
,
unsigned
int
len
,
unsigned
char
*
a_r
)
unsigned
char
*
a_r
)
...
@@ -235,6 +280,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -235,6 +280,8 @@ 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
];
/* Content of the RTT sub-TLV on IHU messages. */
unsigned
int
hello_send_us
=
0
,
hello_rtt_receive_time
=
0
;
/* We want to track exactly when we received this packet. */
/* We want to track exactly when we received this packet. */
gettime
(
&
now
);
gettime
(
&
now
);
...
@@ -346,6 +393,10 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -346,6 +393,10 @@ parse_packet(const unsigned char *from, struct interface *ifp,
if
(
interval
>
0
)
if
(
interval
>
0
)
/* Multiply by 3/2 to allow neighbours to expire. */
/* Multiply by 3/2 to allow neighbours to expire. */
schedule_neighbours_check
(
interval
*
45
,
0
);
schedule_neighbours_check
(
interval
*
45
,
0
);
/* RTT sub-TLV. */
if
(
len
>
10
+
rc
)
parse_ihu_subtlv
(
message
+
8
+
rc
,
len
-
6
-
rc
,
&
hello_send_us
,
&
hello_rtt_receive_time
);
}
}
}
else
if
(
type
==
MESSAGE_ROUTER_ID
)
{
}
else
if
(
type
==
MESSAGE_ROUTER_ID
)
{
if
(
len
<
10
)
{
if
(
len
<
10
)
{
...
...
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