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
11fbc1bf
Commit
11fbc1bf
authored
Jun 19, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement hello moderation on idle interfaces.
parent
3337e1f5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
17 deletions
+35
-17
babel.c
babel.c
+29
-17
babel.h
babel.h
+3
-0
message.c
message.c
+3
-0
No files found.
babel.c
View file @
11fbc1bf
...
@@ -58,8 +58,11 @@ static int maxmtu;
...
@@ -58,8 +58,11 @@ static int maxmtu;
int
reboot_time
;
int
reboot_time
;
int
idle_time
=
320
;
int
wireless_hello_interval
=
-
1
;
int
wireless_hello_interval
=
-
1
;
int
wired_hello_interval
=
-
1
;
int
wired_hello_interval
=
-
1
;
int
idle_hello_interval
=
-
1
;
int
update_interval
=
-
1
;
int
update_interval
=
-
1
;
struct
network
nets
[
MAXNETS
];
struct
network
nets
[
MAXNETS
];
...
@@ -157,6 +160,9 @@ main(int argc, char **argv)
...
@@ -157,6 +160,9 @@ main(int argc, char **argv)
}
else
if
(
strcmp
(
*
arg
,
"-H"
)
==
0
)
{
}
else
if
(
strcmp
(
*
arg
,
"-H"
)
==
0
)
{
SHIFTE
();
SHIFTE
();
wired_hello_interval
=
atoi
(
*
arg
);
wired_hello_interval
=
atoi
(
*
arg
);
}
else
if
(
strcmp
(
*
arg
,
"-i"
)
==
0
)
{
SHIFTE
();
idle_hello_interval
=
atoi
(
*
arg
);
}
else
if
(
strcmp
(
*
arg
,
"-u"
)
==
0
)
{
}
else
if
(
strcmp
(
*
arg
,
"-u"
)
==
0
)
{
SHIFTE
();
SHIFTE
();
update_interval
=
atoi
(
*
arg
);
update_interval
=
atoi
(
*
arg
);
...
@@ -194,6 +200,10 @@ main(int argc, char **argv)
...
@@ -194,6 +200,10 @@ main(int argc, char **argv)
if
(
wired_hello_interval
<=
0
)
if
(
wired_hello_interval
<=
0
)
wired_hello_interval
=
30
;
wired_hello_interval
=
30
;
if
(
idle_hello_interval
<=
0
)
idle_hello_interval
=
MIN
(
wireless_hello_interval
*
5
,
wired_hello_interval
);
if
(
update_interval
<=
0
)
if
(
update_interval
<=
0
)
update_interval
=
update_interval
=
MIN
(
MAX
(
wireless_hello_interval
*
5
,
wired_hello_interval
),
MIN
(
MAX
(
wireless_hello_interval
*
5
,
wired_hello_interval
),
...
@@ -532,9 +542,9 @@ main(int argc, char **argv)
...
@@ -532,9 +542,9 @@ main(int argc, char **argv)
"Syntax: %s "
"Syntax: %s "
"[-m multicast_address] [-p port] [-S state-file]
\n
"
"[-m multicast_address] [-p port] [-S state-file]
\n
"
" "
" "
"[-h hello
_interval] [-H wired_hello_interval
]
\n
"
"[-h hello
] [-H wired_hello] [i idle_hello
]
\n
"
" "
" "
"[-u update
_interval
] [-k metric] [-s] [-P] [-c cost]
\n
"
"[-u update] [-k metric] [-s] [-P] [-c cost]
\n
"
" "
" "
"[-d level] [-x net cost] [-X net cost]... address interface...
\n
"
,
"[-d level] [-x net cost] [-X net cost]... address interface...
\n
"
,
argv
[
0
]);
argv
[
0
]);
...
@@ -659,17 +669,6 @@ kernel_routes_callback(void *closure)
...
@@ -659,17 +669,6 @@ kernel_routes_callback(void *closure)
return
1
;
return
1
;
}
}
void
set_hello_interval
(
struct
network
*
net
,
int
hello_interval
)
{
if
(
hello_interval
>=
0
)
net
->
hello_interval
=
hello_interval
;
else
if
(
net
->
wired
)
net
->
hello_interval
=
wired_hello_interval
;
else
net
->
hello_interval
=
wireless_hello_interval
;
}
struct
network
*
struct
network
*
add_network
(
char
*
ifname
,
int
ifindex
,
int
mtu
,
int
wired
,
unsigned
int
cost
)
add_network
(
char
*
ifname
,
int
ifindex
,
int
mtu
,
int
wired
,
unsigned
int
cost
)
{
{
...
@@ -684,10 +683,8 @@ add_network(char *ifname, int ifindex, int mtu, int wired, unsigned int cost)
...
@@ -684,10 +683,8 @@ add_network(char *ifname, int ifindex, int mtu, int wired, unsigned int cost)
nets
[
numnets
].
ifindex
=
ifindex
;
nets
[
numnets
].
ifindex
=
ifindex
;
nets
[
numnets
].
wired
=
wired
;
nets
[
numnets
].
wired
=
wired
;
nets
[
numnets
].
cost
=
cost
;
nets
[
numnets
].
cost
=
cost
;
set_hello_interval
(
&
nets
[
numnets
],
-
1
);
nets
[
numnets
].
activity_time
=
now
.
tv_sec
;
nets
[
numnets
].
self_update_interval
=
update_hello_interval
(
&
nets
[
numnets
]);
MAX
(
15
+
nets
[
numnets
].
hello_interval
/
2
,
nets
[
numnets
].
hello_interval
);
nets
[
numnets
].
txcost_interval
=
MIN
(
42
,
2
*
nets
[
numnets
].
hello_interval
);
nets
[
numnets
].
txcost_interval
=
MIN
(
42
,
2
*
nets
[
numnets
].
hello_interval
);
nets
[
numnets
].
bufsize
=
mtu
-
sizeof
(
packet_header
);
nets
[
numnets
].
bufsize
=
mtu
-
sizeof
(
packet_header
);
nets
[
numnets
].
flush_time
=
tv_zero
;
nets
[
numnets
].
flush_time
=
tv_zero
;
...
@@ -706,6 +703,21 @@ add_network(char *ifname, int ifindex, int mtu, int wired, unsigned int cost)
...
@@ -706,6 +703,21 @@ add_network(char *ifname, int ifindex, int mtu, int wired, unsigned int cost)
return
&
nets
[
numnets
-
1
];
return
&
nets
[
numnets
-
1
];
}
}
void
update_hello_interval
(
struct
network
*
net
)
{
if
(
net
->
activity_time
<
now
.
tv_sec
-
idle_time
)
net
->
hello_interval
=
idle_hello_interval
;
else
if
(
net
->
wired
)
net
->
hello_interval
=
wired_hello_interval
;
else
net
->
hello_interval
=
wireless_hello_interval
;
net
->
self_update_interval
=
MAX
(
15
+
nets
[
numnets
].
hello_interval
/
2
,
nets
[
numnets
].
hello_interval
);
}
void
void
expire_routes
(
void
)
expire_routes
(
void
)
{
{
...
...
babel.h
View file @
11fbc1bf
...
@@ -76,6 +76,7 @@ struct network {
...
@@ -76,6 +76,7 @@ struct network {
unsigned
char
*
sendbuf
;
unsigned
char
*
sendbuf
;
int
bucket_time
;
int
bucket_time
;
unsigned
int
bucket
;
unsigned
int
bucket
;
int
activity_time
;
unsigned
char
hello_seqno
;
unsigned
char
hello_seqno
;
unsigned
int
hello_interval
;
unsigned
int
hello_interval
;
unsigned
int
self_update_interval
;
unsigned
int
self_update_interval
;
...
@@ -95,3 +96,5 @@ extern int protocol_port;
...
@@ -95,3 +96,5 @@ extern int protocol_port;
extern
unsigned
char
protocol_group
[
16
];
extern
unsigned
char
protocol_group
[
16
];
extern
int
protocol_socket
;
extern
int
protocol_socket
;
extern
int
kernel_socket
;
extern
int
kernel_socket
;
void
update_hello_interval
(
struct
network
*
net
);
message.c
View file @
11fbc1bf
...
@@ -91,6 +91,7 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -91,6 +91,7 @@ parse_packet(const unsigned char *from, struct network *net,
net
->
ifname
,
net
->
ifname
,
format_address
(
message
+
4
),
format_address
(
message
+
4
),
format_address
(
from
));
format_address
(
from
));
net
->
activity_time
=
now
.
tv_sec
;
neigh
=
add_neighbour
(
message
+
4
,
from
,
net
);
neigh
=
add_neighbour
(
message
+
4
,
from
,
net
);
update_neighbour
(
neigh
,
message
[
1
],
(
message
[
2
]
<<
8
|
message
[
3
]));
update_neighbour
(
neigh
,
message
[
1
],
(
message
[
2
]
<<
8
|
message
[
3
]));
update_neighbour_metric
(
neigh
);
update_neighbour_metric
(
neigh
);
...
@@ -98,6 +99,7 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -98,6 +99,7 @@ parse_packet(const unsigned char *from, struct network *net,
neigh
=
find_neighbour
(
from
,
net
);
neigh
=
find_neighbour
(
from
,
net
);
if
(
neigh
==
NULL
)
if
(
neigh
==
NULL
)
continue
;
continue
;
net
->
activity_time
=
now
.
tv_sec
;
if
(
message
[
0
]
==
1
)
{
if
(
message
[
0
]
==
1
)
{
debugf
(
"Received request on %s from %s (%s) for %s.
\n
"
,
debugf
(
"Received request on %s from %s (%s) for %s.
\n
"
,
net
->
ifname
,
net
->
ifname
,
...
@@ -276,6 +278,7 @@ void
...
@@ -276,6 +278,7 @@ void
send_hello
(
struct
network
*
net
)
send_hello
(
struct
network
*
net
)
{
{
debugf
(
"Sending hello to %s.
\n
"
,
net
->
ifname
);
debugf
(
"Sending hello to %s.
\n
"
,
net
->
ifname
);
update_hello_interval
(
net
);
start_message
(
net
,
20
);
start_message
(
net
,
20
);
accumulate_byte
(
net
,
0
);
accumulate_byte
(
net
,
0
);
net
->
hello_seqno
=
((
net
->
hello_seqno
+
1
)
&
0xFF
);
net
->
hello_seqno
=
((
net
->
hello_seqno
+
1
)
&
0xFF
);
...
...
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