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
68da3363
Commit
68da3363
authored
Oct 02, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split handling of directed requests into its own function.
parent
6b9f349b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
message.c
message.c
+19
-4
No files found.
message.c
View file @
68da3363
...
@@ -58,6 +58,11 @@ struct buffered_update buffered_updates[MAX_BUFFERED_UPDATES];
...
@@ -58,6 +58,11 @@ struct buffered_update buffered_updates[MAX_BUFFERED_UPDATES];
struct
network
*
update_net
=
NULL
;
struct
network
*
update_net
=
NULL
;
int
updates
=
0
;
int
updates
=
0
;
static
void
handle_request
(
struct
neighbour
*
neigh
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
char
hop_count
,
unsigned
short
seqno
,
unsigned
short
router_hash
);
unsigned
short
unsigned
short
hash_id
(
const
unsigned
char
*
id
)
hash_id
(
const
unsigned
char
*
id
)
{
{
...
@@ -74,9 +79,8 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -74,9 +79,8 @@ parse_packet(const unsigned char *from, struct network *net,
{
{
int
i
,
j
;
int
i
,
j
;
const
unsigned
char
*
message
;
const
unsigned
char
*
message
;
unsigned
char
type
,
plen
;
unsigned
char
type
,
plen
,
hop_count
;
unsigned
short
seqno
;
unsigned
short
seqno
,
metric
;
unsigned
short
metric
;
const
unsigned
char
*
address
;
const
unsigned
char
*
address
;
struct
neighbour
*
neigh
;
struct
neighbour
*
neigh
;
int
have_current_source
=
0
;
int
have_current_source
=
0
;
...
@@ -112,6 +116,7 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -112,6 +116,7 @@ parse_packet(const unsigned char *from, struct network *net,
message
=
packet
+
8
+
24
*
i
;
message
=
packet
+
8
+
24
*
i
;
type
=
message
[
0
];
type
=
message
[
0
];
plen
=
message
[
1
];
plen
=
message
[
1
];
hop_count
=
message
[
3
];
seqno
=
ntohs
(
*
(
uint16_t
*
)(
message
+
4
));
seqno
=
ntohs
(
*
(
uint16_t
*
)(
message
+
4
));
metric
=
ntohs
(
*
(
uint16_t
*
)(
message
+
6
));
metric
=
ntohs
(
*
(
uint16_t
*
)(
message
+
6
));
address
=
message
+
8
;
address
=
message
+
8
;
...
@@ -162,7 +167,8 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -162,7 +167,8 @@ parse_packet(const unsigned char *from, struct network *net,
send_ihu
(
neigh
,
NULL
);
send_ihu
(
neigh
,
NULL
);
send_update
(
neigh
->
network
,
0
,
NULL
,
0
);
send_update
(
neigh
->
network
,
0
,
NULL
,
0
);
}
else
{
}
else
{
send_update
(
neigh
->
network
,
1
,
address
,
plen
);
handle_request
(
neigh
,
address
,
plen
,
hop_count
,
seqno
,
metric
);
}
}
}
else
if
(
type
==
3
)
{
}
else
if
(
type
==
3
)
{
if
(
plen
==
0xFF
)
if
(
plen
==
0xFF
)
...
@@ -214,6 +220,15 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -214,6 +220,15 @@ parse_packet(const unsigned char *from, struct network *net,
return
;
return
;
}
}
static
void
handle_request
(
struct
neighbour
*
neigh
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
char
hop_count
,
unsigned
short
seqno
,
unsigned
short
router_hash
)
{
send_update
(
neigh
->
network
,
1
,
prefix
,
plen
);
}
/* Under normal circumstances, there are enough moderation mechanisms
/* Under normal circumstances, there are enough moderation mechanisms
elsewhere in the protocol to make sure that this last-ditch check
elsewhere in the protocol to make sure that this last-ditch check
should never trigger. But I'm supersticious. */
should never trigger. But I'm supersticious. */
...
...
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