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
dd29d40c
Commit
dd29d40c
authored
Jul 20, 2014
by
Matthieu Boutier
Committed by
Juliusz Chroboczek
Jul 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some guarded code to handle requests in a near future.
parent
196977c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
resend.c
resend.c
+23
-7
resend.h
resend.h
+2
-0
No files found.
resend.c
View file @
dd29d40c
...
...
@@ -38,10 +38,13 @@ struct resend *to_resend = NULL;
static
int
resend_match
(
struct
resend
*
resend
,
int
kind
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
int
kind
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
const
unsigned
char
*
src_prefix
,
unsigned
char
src_plen
)
{
return
(
resend
->
kind
==
kind
&&
resend
->
plen
==
plen
&&
memcmp
(
resend
->
prefix
,
prefix
,
16
)
==
0
);
resend
->
plen
==
plen
&&
memcmp
(
resend
->
prefix
,
prefix
,
16
)
==
0
&&
resend
->
src_plen
==
src_plen
&&
memcmp
(
resend
->
src_prefix
,
src_prefix
,
16
));
}
/* This is called by neigh.c when a neighbour is flushed */
...
...
@@ -54,14 +57,15 @@ flush_resends(struct neighbour *neigh)
static
struct
resend
*
find_resend
(
int
kind
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
resend
**
previous_return
)
const
unsigned
char
*
src_prefix
,
unsigned
char
src_plen
,
struct
resend
**
previous_return
)
{
struct
resend
*
current
,
*
previous
;
previous
=
NULL
;
current
=
to_resend
;
while
(
current
)
{
if
(
resend_match
(
current
,
kind
,
prefix
,
plen
))
{
if
(
resend_match
(
current
,
kind
,
prefix
,
plen
,
src_prefix
,
src_plen
))
{
if
(
previous_return
)
*
previous_return
=
previous
;
return
current
;
...
...
@@ -78,7 +82,10 @@ find_request(const unsigned char *prefix, unsigned char plen,
const
unsigned
char
*
src_prefix
,
unsigned
char
src_plen
,
struct
resend
**
previous_return
)
{
return
find_resend
(
RESEND_REQUEST
,
prefix
,
plen
,
previous_return
);
if
(
src_plen
!=
0
)
return
NULL
;
return
find_resend
(
RESEND_REQUEST
,
prefix
,
plen
,
src_prefix
,
src_plen
,
previous_return
);
}
int
...
...
@@ -90,6 +97,9 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
struct
resend
*
resend
;
unsigned
int
ifindex
=
ifp
?
ifp
->
ifindex
:
0
;
if
(
src_plen
!=
0
)
return
0
;
if
((
kind
==
RESEND_REQUEST
&&
input_filter
(
NULL
,
prefix
,
plen
,
NULL
,
0
,
NULL
,
ifindex
)
>=
INFINITY
)
||
...
...
@@ -101,7 +111,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
if
(
delay
>=
0xFFFF
)
delay
=
0xFFFF
;
resend
=
find_resend
(
kind
,
prefix
,
plen
,
NULL
);
resend
=
find_resend
(
kind
,
prefix
,
plen
,
src_prefix
,
src_plen
,
NULL
);
if
(
resend
)
{
if
(
resend
->
delay
&&
delay
)
resend
->
delay
=
MIN
(
resend
->
delay
,
delay
);
...
...
@@ -129,6 +139,8 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
resend
->
delay
=
delay
;
memcpy
(
resend
->
prefix
,
prefix
,
16
);
resend
->
plen
=
plen
;
memcpy
(
resend
->
src_prefix
,
src_prefix
,
16
);
resend
->
src_plen
=
src_plen
;
resend
->
seqno
=
seqno
;
if
(
id
)
memcpy
(
resend
->
id
,
id
,
8
);
...
...
@@ -215,6 +227,10 @@ satisfy_request(const unsigned char *prefix, unsigned char plen,
{
struct
resend
*
request
,
*
previous
;
/* TODO */
if
(
src_plen
!=
0
)
return
0
;
request
=
find_request
(
prefix
,
plen
,
zeroes
,
0
,
&
previous
);
if
(
request
==
NULL
)
return
0
;
...
...
@@ -303,7 +319,7 @@ do_resend()
case
RESEND_UPDATE
:
send_update
(
resend
->
ifp
,
1
,
resend
->
prefix
,
resend
->
plen
,
zeroes
,
0
);
resend
->
src_prefix
,
resend
->
src_plen
);
break
;
default:
abort
();
}
...
...
resend.h
View file @
dd29d40c
...
...
@@ -33,6 +33,8 @@ struct resend {
struct
timeval
time
;
unsigned
char
prefix
[
16
];
unsigned
char
plen
;
unsigned
char
src_prefix
[
16
];
unsigned
char
src_plen
;
unsigned
short
seqno
;
unsigned
char
id
[
8
];
struct
interface
*
ifp
;
...
...
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