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
77a68bb9
Commit
77a68bb9
authored
Mar 24, 2016
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move initialisation of channel information into parse_update_subtlv.
parent
90b61797
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
48 deletions
+34
-48
message.c
message.c
+34
-48
No files found.
message.c
View file @
77a68bb9
...
...
@@ -120,11 +120,26 @@ network_prefix(int ae, int plen, unsigned int omitted,
}
static
void
parse_update_subtlv
(
const
unsigned
char
*
a
,
int
alen
,
parse_update_subtlv
(
struct
interface
*
ifp
,
int
metric
,
const
unsigned
char
*
a
,
int
alen
,
unsigned
char
*
channels
)
{
int
type
,
len
,
i
=
0
;
if
((
ifp
->
flags
&
IF_FARAWAY
))
{
channels
[
0
]
=
0
;
}
else
{
/* This will be overwritten if there's a DIVERSITY_HOPS sub-TLV. */
if
(
metric
<
256
)
{
/* Assume non-interfering (wired) link. */
channels
[
0
]
=
0
;
}
else
{
/* Assume interfering. */
channels
[
0
]
=
IF_CHANNEL_INTERFERING
;
channels
[
1
]
=
0
;
}
}
while
(
i
<
alen
)
{
type
=
a
[
i
];
if
(
type
==
SUBTLV_PAD1
)
{
...
...
@@ -145,19 +160,21 @@ parse_update_subtlv(const unsigned char *a, int alen,
if
(
type
==
SUBTLV_PADN
)
{
/* Nothing. */
}
else
if
(
type
==
SUBTLV_DIVERSITY
)
{
if
(
len
>
DIVERSITY_HOPS
)
{
fprintf
(
stderr
,
"Received overlong channel information (%d > %d).
\n
"
,
len
,
DIVERSITY_HOPS
);
len
=
DIVERSITY_HOPS
;
}
if
(
memchr
(
a
+
i
+
2
,
0
,
len
)
!=
NULL
)
{
/* 0 is reserved. */
fprintf
(
stderr
,
"Channel information contains 0!"
);
return
;
if
(
!
(
ifp
->
flags
&
IF_FARAWAY
))
{
if
(
len
>
DIVERSITY_HOPS
)
{
fprintf
(
stderr
,
"Received overlong channel information (%d > %d).
\n
"
,
len
,
DIVERSITY_HOPS
);
len
=
DIVERSITY_HOPS
;
}
if
(
memchr
(
a
+
i
+
2
,
0
,
len
)
!=
NULL
)
{
/* 0 is reserved. */
fprintf
(
stderr
,
"Channel information contains 0!"
);
return
;
}
memset
(
channels
,
0
,
DIVERSITY_HOPS
);
memcpy
(
channels
,
a
+
i
+
2
,
len
);
}
memset
(
channels
,
0
,
DIVERSITY_HOPS
);
memcpy
(
channels
,
a
+
i
+
2
,
len
);
}
else
{
debugf
(
"Received unknown update sub-TLV %d.
\n
"
,
type
);
}
...
...
@@ -523,24 +540,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
goto
done
;
}
if
((
ifp
->
flags
&
IF_FARAWAY
))
{
channels
[
0
]
=
0
;
}
else
{
/* This will be overwritten by parse_update_subtlv below. */
if
(
metric
<
256
)
{
/* Assume non-interfering (wired) link. */
channels
[
0
]
=
0
;
}
else
{
/* Assume interfering. */
channels
[
0
]
=
IF_CHANNEL_INTERFERING
;
channels
[
1
]
=
0
;
}
if
(
parsed_len
<
len
)
parse_update_subtlv
(
message
+
2
+
parsed_len
,
len
-
parsed_len
,
channels
);
}
parse_update_subtlv
(
ifp
,
metric
,
message
+
2
+
parsed_len
,
len
-
parsed_len
,
channels
);
update_route
(
router_id
,
prefix
,
plen
,
zeroes
,
0
,
seqno
,
metric
,
interval
,
neigh
,
nh
,
channels
,
channels_len
(
channels
));
...
...
@@ -652,23 +653,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
goto
done
;
}
if
((
ifp
->
flags
&
IF_FARAWAY
))
{
channels
[
0
]
=
0
;
}
else
{
/* This will be overwritten by parse_update_subtlv below. */
if
(
metric
<
256
)
{
/* Assume non-interfering (wired) link. */
channels
[
0
]
=
0
;
}
else
{
/* Assume interfering. */
channels
[
0
]
=
IF_CHANNEL_INTERFERING
;
channels
[
1
]
=
0
;
}
if
(
parsed_len
<
len
)
parse_update_subtlv
(
message
+
2
+
parsed_len
,
len
-
parsed_len
,
channels
);
}
parse_update_subtlv
(
ifp
,
metric
,
message
+
2
+
parsed_len
,
len
-
parsed_len
,
channels
);
update_route
(
router_id
,
prefix
,
plen
,
src_prefix
,
src_plen
,
seqno
,
metric
,
interval
,
neigh
,
nh
,
...
...
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