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
adeaef55
Commit
adeaef55
authored
Feb 02, 2011
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate calls to strnlen in message.c.
parent
e1a6ed48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
message.c
message.c
+11
-4
No files found.
message.c
View file @
adeaef55
...
...
@@ -20,6 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
...
...
@@ -154,6 +155,12 @@ network_address(int ae, const unsigned char *a, unsigned int len,
return
network_prefix
(
ae
,
-
1
,
0
,
a
,
NULL
,
len
,
a_r
);
}
static
int
channels_len
(
unsigned
char
*
channels
)
{
return
strnlen
((
char
*
)
channels
,
DIVERSITY_HOPS
);
}
void
parse_packet
(
const
unsigned
char
*
from
,
struct
network
*
net
,
const
unsigned
char
*
packet
,
int
packetlen
)
...
...
@@ -407,7 +414,7 @@ parse_packet(const unsigned char *from, struct network *net,
update_route
(
router_id
,
prefix
,
plen
,
seqno
,
metric
,
interval
,
neigh
,
nh
,
channels
,
strnlen
((
char
*
)
channels
,
DIVERSITY_HOPS
));
channels
,
channels_len
(
channels
));
}
else
if
(
type
==
MESSAGE_REQUEST
)
{
unsigned
char
prefix
[
16
],
plen
;
int
rc
;
...
...
@@ -954,7 +961,7 @@ flushupdates(struct network *net)
last_plen
=
xroute
->
plen
;
}
else
if
(
route
)
{
unsigned
char
channels
[
DIVERSITY_HOPS
];
int
ch
annels_
len
;
int
chlen
;
seqno
=
route
->
seqno
;
metric
=
route_metric
(
route
);
if
(
metric
<
INFINITY
)
...
...
@@ -982,12 +989,12 @@ flushupdates(struct network *net)
memcpy
(
channels
+
1
,
route
->
channels
,
DIVERSITY_HOPS
-
1
);
}
ch
annels_len
=
strnlen
((
char
*
)
channels
,
DIVERSITY_HOPS
);
ch
len
=
channels_len
(
channels
);
really_send_update
(
net
,
route
->
src
->
id
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
seqno
,
metric
,
channels
,
ch
annels_
len
);
channels
,
chlen
);
update_source
(
route
->
src
,
seqno
,
metric
);
last_prefix
=
route
->
src
->
prefix
;
last_plen
=
route
->
src
->
plen
;
...
...
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