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
e45908c3
Commit
e45908c3
authored
Feb 02, 2011
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parse route channels.
parent
6773e462
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
1 deletion
+53
-1
message.c
message.c
+53
-1
No files found.
message.c
View file @
e45908c3
...
@@ -113,6 +113,40 @@ network_prefix(int ae, int plen, unsigned int omitted,
...
@@ -113,6 +113,40 @@ network_prefix(int ae, int plen, unsigned int omitted,
return
1
;
return
1
;
}
}
static
void
parse_route_attributes
(
const
unsigned
char
*
a
,
int
alen
,
unsigned
char
*
channels
)
{
int
type
,
len
,
i
=
0
;
while
(
i
<
alen
)
{
type
=
a
[
i
];
if
(
type
==
0
)
{
i
++
;
continue
;
}
if
(
i
+
1
>
alen
)
{
fprintf
(
stderr
,
"Received truncated attributes.
\n
"
);
return
;
}
len
=
a
[
i
+
1
];
if
(
i
+
len
>
alen
)
{
fprintf
(
stderr
,
"Received truncated attributes.
\n
"
);
return
;
}
if
(
type
==
1
)
{
}
else
if
(
type
==
2
)
{
memset
(
channels
,
0
,
DIVERSITY_HOPS
);
memcpy
(
channels
,
a
+
i
+
2
,
MIN
(
len
,
DIVERSITY_HOPS
));
}
else
{
fprintf
(
stderr
,
"Received unknown route attribute %d.
\n
"
,
type
);
}
i
+=
len
+
2
;
}
}
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
)
...
@@ -277,6 +311,7 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -277,6 +311,7 @@ parse_packet(const unsigned char *from, struct network *net,
}
else
if
(
type
==
MESSAGE_UPDATE
)
{
}
else
if
(
type
==
MESSAGE_UPDATE
)
{
unsigned
char
prefix
[
16
],
*
nh
;
unsigned
char
prefix
[
16
],
*
nh
;
unsigned
char
plen
;
unsigned
char
plen
;
unsigned
char
channels
[
DIVERSITY_HOPS
];
unsigned
short
interval
,
seqno
,
metric
;
unsigned
short
interval
,
seqno
,
metric
;
int
rc
;
int
rc
;
if
(
len
<
10
)
{
if
(
len
<
10
)
{
...
@@ -354,8 +389,25 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -354,8 +389,25 @@ parse_packet(const unsigned char *from, struct network *net,
goto
done
;
goto
done
;
}
}
if
((
net
->
flags
&
NET_FARAWAY
))
{
channels
[
0
]
=
0
;
}
else
{
int
l
=
10
+
(
message
[
4
]
+
7
)
/
8
-
message
[
5
];
/* If the peer doesn't send diversity information,
assume that routes with a zero metric are non-interfering. */
if
(
metric
==
0
)
{
channels
[
0
]
=
0
;
}
else
{
channels
[
0
]
=
NET_CHANNEL_INTERFERING
;
channels
[
1
]
=
0
;
}
if
(
l
<
len
)
parse_route_attributes
(
message
+
2
+
l
,
len
-
l
,
channels
);
}
update_route
(
router_id
,
prefix
,
plen
,
seqno
,
metric
,
interval
,
update_route
(
router_id
,
prefix
,
plen
,
seqno
,
metric
,
interval
,
neigh
,
nh
,
NULL
,
0
);
neigh
,
nh
,
channels
,
strnlen
((
char
*
)
channels
,
DIVERSITY_HOPS
));
}
else
if
(
type
==
MESSAGE_REQUEST
)
{
}
else
if
(
type
==
MESSAGE_REQUEST
)
{
unsigned
char
prefix
[
16
],
plen
;
unsigned
char
prefix
[
16
],
plen
;
int
rc
;
int
rc
;
...
...
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