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
a5ef363d
Commit
a5ef363d
authored
Mar 16, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add valid field to struct source.
parent
c2704e82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
source.c
source.c
+5
-0
source.h
source.h
+1
-0
No files found.
source.c
View file @
a5ef363d
...
@@ -37,6 +37,8 @@ find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
...
@@ -37,6 +37,8 @@ find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
numsrcs
;
i
++
)
{
for
(
i
=
0
;
i
<
numsrcs
;
i
++
)
{
if
(
!
srcs
[
i
].
valid
)
continue
;
/* This should really be a hash table. For now, check the
/* This should really be a hash table. For now, check the
last byte first. */
last byte first. */
if
(
srcs
[
i
].
address
[
15
]
!=
a
[
15
])
if
(
srcs
[
i
].
address
[
15
]
!=
a
[
15
])
...
@@ -54,6 +56,7 @@ find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
...
@@ -54,6 +56,7 @@ find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
fprintf
(
stderr
,
"Too many sources.
\n
"
);
fprintf
(
stderr
,
"Too many sources.
\n
"
);
return
NULL
;
return
NULL
;
}
}
srcs
[
numsrcs
].
valid
=
1
;
memcpy
(
srcs
[
numsrcs
].
address
,
a
,
16
);
memcpy
(
srcs
[
numsrcs
].
address
,
a
,
16
);
memcpy
(
srcs
[
numsrcs
].
prefix
,
p
,
16
);
memcpy
(
srcs
[
numsrcs
].
prefix
,
p
,
16
);
srcs
[
numsrcs
].
plen
=
plen
;
srcs
[
numsrcs
].
plen
=
plen
;
...
@@ -70,6 +73,8 @@ find_recent_source(const unsigned char *p, unsigned char plen)
...
@@ -70,6 +73,8 @@ find_recent_source(const unsigned char *p, unsigned char plen)
struct
source
*
src
=
NULL
;
struct
source
*
src
=
NULL
;
for
(
i
=
0
;
i
<
numsrcs
;
i
++
)
{
for
(
i
=
0
;
i
<
numsrcs
;
i
++
)
{
if
(
!
srcs
[
i
].
valid
)
continue
;
if
(
!
source_match
(
&
srcs
[
i
],
p
,
plen
))
if
(
!
source_match
(
&
srcs
[
i
],
p
,
plen
))
continue
;
continue
;
if
(
!
src
||
src
->
time
<
srcs
[
i
].
time
)
if
(
!
src
||
src
->
time
<
srcs
[
i
].
time
)
...
...
source.h
View file @
a5ef363d
...
@@ -26,6 +26,7 @@ struct source {
...
@@ -26,6 +26,7 @@ struct source {
unsigned
char
address
[
16
];
unsigned
char
address
[
16
];
unsigned
char
prefix
[
16
];
unsigned
char
prefix
[
16
];
unsigned
char
plen
;
unsigned
char
plen
;
unsigned
char
valid
;
unsigned
short
seqno
;
unsigned
short
seqno
;
unsigned
short
metric
;
unsigned
short
metric
;
time_t
time
;
time_t
time
;
...
...
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