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
77f37559
Commit
77f37559
authored
Jan 29, 2018
by
Juliusz Chroboczek
Committed by
Juliusz Chroboczek
Oct 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate buffering from message sending.
parent
e38993d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
34 deletions
+50
-34
message.c
message.c
+50
-34
No files found.
message.c
View file @
77f37559
...
...
@@ -1502,6 +1502,23 @@ send_update_resend(struct interface *ifp,
0
,
NULL
,
NULL
,
resend_delay
);
}
void
buffer_wildcard_retraction
(
struct
buffered
*
buf
)
{
start_message
(
buf
,
MESSAGE_UPDATE
,
10
);
accumulate_byte
(
buf
,
0
);
accumulate_byte
(
buf
,
0
);
accumulate_byte
(
buf
,
0
);
accumulate_byte
(
buf
,
0
);
accumulate_short
(
buf
,
0xFFFF
);
accumulate_short
(
buf
,
myseqno
);
accumulate_short
(
buf
,
0xFFFF
);
end_message
(
buf
,
MESSAGE_UPDATE
,
10
);
buf
->
have_id
=
0
;
}
void
send_wildcard_retraction
(
struct
interface
*
ifp
)
{
...
...
@@ -1515,17 +1532,7 @@ send_wildcard_retraction(struct interface *ifp)
if
(
!
if_up
(
ifp
))
return
;
start_message
(
&
ifp
->
buf
,
MESSAGE_UPDATE
,
10
);
accumulate_byte
(
&
ifp
->
buf
,
0
);
accumulate_byte
(
&
ifp
->
buf
,
0
);
accumulate_byte
(
&
ifp
->
buf
,
0
);
accumulate_byte
(
&
ifp
->
buf
,
0
);
accumulate_short
(
&
ifp
->
buf
,
0xFFFF
);
accumulate_short
(
&
ifp
->
buf
,
myseqno
);
accumulate_short
(
&
ifp
->
buf
,
0xFFFF
);
end_message
(
&
ifp
->
buf
,
MESSAGE_UPDATE
,
10
);
ifp
->
buf
.
have_id
=
0
;
buffer_wildcard_retraction
(
&
ifp
->
buf
);
}
void
...
...
@@ -1564,13 +1571,40 @@ send_self_update(struct interface *ifp)
}
}
void
buffer_ihu
(
struct
buffered
*
buf
,
unsigned
short
rxcost
,
unsigned
short
interval
,
const
unsigned
char
*
address
,
int
rtt_data
,
unsigned
int
t1
,
unsigned
int
t2
)
{
int
msglen
,
ll
;
ll
=
linklocal
(
address
);
msglen
=
(
ll
?
14
:
200
)
+
(
rtt_data
?
10
:
0
);
start_message
(
buf
,
MESSAGE_IHU
,
msglen
);
accumulate_byte
(
buf
,
ll
?
3
:
2
);
accumulate_byte
(
buf
,
0
);
accumulate_short
(
buf
,
rxcost
);
accumulate_short
(
buf
,
interval
);
if
(
ll
)
accumulate_bytes
(
buf
,
address
+
8
,
8
);
else
accumulate_bytes
(
buf
,
address
,
16
);
if
(
rtt_data
)
{
accumulate_byte
(
buf
,
SUBTLV_TIMESTAMP
);
accumulate_byte
(
buf
,
8
);
accumulate_int
(
buf
,
t1
);
accumulate_int
(
buf
,
t2
);
}
end_message
(
buf
,
MESSAGE_IHU
,
msglen
);
}
void
send_ihu
(
struct
neighbour
*
neigh
,
struct
interface
*
ifp
)
{
int
rxcost
,
interval
;
int
ll
;
int
send_rtt_data
;
int
msglen
;
if
(
neigh
==
NULL
&&
ifp
==
NULL
)
{
struct
interface
*
ifp_aux
;
...
...
@@ -1606,8 +1640,6 @@ send_ihu(struct neighbour *neigh, struct interface *ifp)
neigh
->
ifp
->
name
,
format_address
(
neigh
->
address
));
ll
=
linklocal
(
neigh
->
address
);
if
(
ifp
->
buf
.
enable_timestamps
&&
neigh
->
hello_send_us
&&
/* Checks whether the RTT data is not too old to be sent. */
timeval_minus_msec
(
&
now
,
&
neigh
->
hello_rtt_receive_time
)
<
1000000
)
{
...
...
@@ -1617,26 +1649,10 @@ send_ihu(struct neighbour *neigh, struct interface *ifp)
send_rtt_data
=
0
;
}
/* The length depends on the format of the address, and then an
optional 10-bytes sub-TLV for timestamps (used to compute a RTT). */
msglen
=
(
ll
?
14
:
22
)
+
(
send_rtt_data
?
10
:
0
);
buffer_ihu
(
&
ifp
->
buf
,
rxcost
,
interval
,
neigh
->
address
,
send_rtt_data
,
neigh
->
hello_send_us
,
time_us
(
neigh
->
hello_rtt_receive_time
)
);
start_message
(
&
ifp
->
buf
,
MESSAGE_IHU
,
msglen
);
accumulate_byte
(
&
ifp
->
buf
,
ll
?
3
:
2
);
accumulate_byte
(
&
ifp
->
buf
,
0
);
accumulate_short
(
&
ifp
->
buf
,
rxcost
);
accumulate_short
(
&
ifp
->
buf
,
interval
);
if
(
ll
)
accumulate_bytes
(
&
ifp
->
buf
,
neigh
->
address
+
8
,
8
);
else
accumulate_bytes
(
&
ifp
->
buf
,
neigh
->
address
,
16
);
if
(
send_rtt_data
)
{
accumulate_byte
(
&
ifp
->
buf
,
SUBTLV_TIMESTAMP
);
accumulate_byte
(
&
ifp
->
buf
,
8
);
accumulate_int
(
&
ifp
->
buf
,
neigh
->
hello_send_us
);
accumulate_int
(
&
ifp
->
buf
,
time_us
(
neigh
->
hello_rtt_receive_time
));
}
end_message
(
&
ifp
->
buf
,
MESSAGE_IHU
,
msglen
);
}
/* Send IHUs to all marginal neighbours */
...
...
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