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
643c839c
Commit
643c839c
authored
Jul 20, 2017
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maintain unicast Hello history.
parent
917ea3ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
14 deletions
+24
-14
babeld.c
babeld.c
+3
-2
local.c
local.c
+3
-1
message.c
message.c
+6
-5
neighbour.c
neighbour.c
+10
-5
neighbour.h
neighbour.h
+2
-1
No files found.
babeld.c
View file @
643c839c
...
...
@@ -1113,11 +1113,12 @@ dump_tables(FILE *out)
fprintf
(
out
,
"My id %s seqno %d
\n
"
,
format_eui64
(
myid
),
myseqno
);
FOR_ALL_NEIGHBOURS
(
neigh
)
{
fprintf
(
out
,
"Neighbour %s dev %s reach %04x
rxcost %d txcost %d
"
"rtt %s rttcost %d chan %d%s.
\n
"
,
fprintf
(
out
,
"Neighbour %s dev %s reach %04x
ureach %04x
"
"r
xcost %d txcost %d r
tt %s rttcost %d chan %d%s.
\n
"
,
format_address
(
neigh
->
address
),
neigh
->
ifp
->
name
,
neigh
->
hello
.
reach
,
neigh
->
uhello
.
reach
,
neighbour_rxcost
(
neigh
),
neigh
->
txcost
,
format_thousands
(
neigh
->
rtt
),
...
...
local.c
View file @
643c839c
...
...
@@ -153,7 +153,8 @@ local_notify_neighbour_1(struct local_socket *s,
rc
=
snprintf
(
buf
,
512
,
"%s neighbour %lx address %s "
"if %s reach %04x rxcost %d txcost %d%s cost %d
\n
"
,
"if %s reach %04x ureach %04x "
"rxcost %d txcost %d%s cost %d
\n
"
,
local_kind
(
kind
),
/* Neighbours never move around in memory , so we can use the
address as a unique identifier. */
...
...
@@ -161,6 +162,7 @@ local_notify_neighbour_1(struct local_socket *s,
format_address
(
neigh
->
address
),
neigh
->
ifp
->
name
,
neigh
->
hello
.
reach
,
neigh
->
uhello
.
reach
,
neighbour_rxcost
(
neigh
),
neighbour_txcost
(
neigh
),
rttbuf
,
...
...
message.c
View file @
643c839c
...
...
@@ -425,9 +425,10 @@ parse_packet(const unsigned char *from, struct interface *ifp,
/* Nothing right now */
}
else
if
(
type
==
MESSAGE_HELLO
)
{
unsigned
short
seqno
,
interval
;
int
changed
,
have_timestamp
,
rc
;
int
unicast
,
changed
,
have_timestamp
,
rc
;
unsigned
int
timestamp
;
if
(
len
<
6
)
goto
fail
;
unicast
=
!!
(
message
[
2
]
&
0x80
);
DO_NTOHS
(
seqno
,
message
+
4
);
DO_NTOHS
(
interval
,
message
+
6
);
debugf
(
"Received hello %d (%d) from %s on %s.
\n
"
,
...
...
@@ -438,10 +439,10 @@ parse_packet(const unsigned char *from, struct interface *ifp,
&
timestamp
,
&
have_timestamp
);
if
(
rc
<
0
)
goto
done
;
if
(
message
[
2
]
&
0x80
)
/* Unicast, ignored for now. */
goto
done
;
changed
=
update_neighbour
(
neigh
,
&
neigh
->
hello
,
seqno
,
interval
);
changed
=
update_neighbour
(
neigh
,
unicast
?
&
neigh
->
uhello
:
&
neigh
->
hello
,
unicast
,
seqno
,
interval
);
update_neighbour_metric
(
neigh
,
changed
);
if
(
interval
>
0
)
/* Multiply by 3/2 to allow hellos to expire. */
...
...
neighbour.c
View file @
643c839c
...
...
@@ -90,11 +90,11 @@ find_neighbour(const unsigned char *address, struct interface *ifp)
return
NULL
;
}
neigh
->
hello
.
seqno
=
-
1
;
neigh
->
hello
.
seqno
=
neigh
->
uhello
.
seqno
=
-
1
;
memcpy
(
neigh
->
address
,
address
,
16
);
neigh
->
txcost
=
INFINITY
;
neigh
->
ihu_time
=
now
;
neigh
->
hello
.
time
=
zero
;
neigh
->
hello
.
time
=
neigh
->
uhello
.
time
=
zero
;
neigh
->
hello_rtt_receive_time
=
zero
;
neigh
->
rtt_time
=
zero
;
neigh
->
ifp
=
ifp
;
...
...
@@ -109,7 +109,7 @@ find_neighbour(const unsigned char *address, struct interface *ifp)
This does not call local_notify_neighbour, see update_neighbour_metric. */
int
update_neighbour
(
struct
neighbour
*
neigh
,
struct
hello_history
*
hist
,
int
hello
,
int
hello_interval
)
int
unicast
,
int
hello
,
int
hello_interval
)
{
int
missed_hellos
;
int
rc
=
0
;
...
...
@@ -163,6 +163,9 @@ update_neighbour(struct neighbour *neigh, struct hello_history *hist,
rc
=
1
;
}
if
(
unicast
)
return
rc
;
/* Make sure to give neighbours some feedback early after association */
if
((
hist
->
reach
&
0xBF00
)
==
0x8000
)
{
/* A new neighbour */
...
...
@@ -218,14 +221,16 @@ unsigned
check_neighbours
()
{
struct
neighbour
*
neigh
;
int
changed
,
rc
;
unsigned
msecs
=
50000
;
debugf
(
"Checking neighbours.
\n
"
);
neigh
=
neighs
;
while
(
neigh
)
{
changed
=
update_neighbour
(
neigh
,
&
neigh
->
hello
,
-
1
,
0
);
int
changed
,
rc
;
changed
=
update_neighbour
(
neigh
,
&
neigh
->
hello
,
0
,
-
1
,
0
);
rc
=
update_neighbour
(
neigh
,
&
neigh
->
uhello
,
1
,
-
1
,
0
);
changed
=
changed
||
rc
;
if
(
neigh
->
hello
.
reach
==
0
||
neigh
->
hello
.
time
.
tv_sec
>
now
.
tv_sec
||
/* clock stepped */
...
...
neighbour.h
View file @
643c839c
...
...
@@ -32,6 +32,7 @@ struct neighbour {
/* This is -1 when unknown, so don't make it unsigned */
unsigned
char
address
[
16
];
struct
hello_history
hello
;
struct
hello_history
uhello
;
/* for Unicast hellos */
unsigned
short
txcost
;
struct
timeval
ihu_time
;
unsigned
short
ihu_interval
;
/* in centiseconds */
...
...
@@ -55,7 +56,7 @@ void flush_neighbour(struct neighbour *neigh);
struct
neighbour
*
find_neighbour
(
const
unsigned
char
*
address
,
struct
interface
*
ifp
);
int
update_neighbour
(
struct
neighbour
*
neigh
,
struct
hello_history
*
hist
,
int
hello
,
int
hello_interval
);
int
unicast
,
int
hello
,
int
hello_interval
);
unsigned
check_neighbours
(
void
);
unsigned
neighbour_txcost
(
struct
neighbour
*
neigh
);
unsigned
neighbour_rxcost
(
struct
neighbour
*
neigh
);
...
...
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