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
9d84a093
Commit
9d84a093
authored
Nov 07, 2009
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement -A.
parent
752dc5cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
20 deletions
+35
-20
babeld.c
babeld.c
+12
-2
message.c
message.c
+12
-13
route.c
route.c
+5
-2
route.h
route.h
+1
-1
xroute.c
xroute.c
+5
-2
No files found.
babeld.c
View file @
9d84a093
...
...
@@ -171,6 +171,11 @@ main(int argc, char **argv)
if
(
kernel_metric
<
0
||
kernel_metric
>
0xFFFF
)
goto
usage
;
break
;
case
'A'
:
allow_duplicates
=
atoi
(
optarg
);
if
(
allow_duplicates
<
0
||
allow_duplicates
>
0xFFFF
)
goto
usage
;
break
;
case
'P'
:
parasitic
=
1
;
break
;
...
...
@@ -231,7 +236,6 @@ main(int argc, char **argv)
}
}
if
(
!
config_file
)
{
if
(
access
(
"/etc/babeld.conf"
,
F_OK
)
>=
0
)
config_file
=
"/etc/babeld.conf"
;
...
...
@@ -258,6 +262,12 @@ main(int argc, char **argv)
wired_hello_interval
=
20000
;
wired_hello_interval
=
MAX
(
wired_hello_interval
,
5
);
if
(
parasitic
&&
allow_duplicates
>=
0
)
{
/* Too difficult to get right. */
fprintf
(
stderr
,
"Sorry, -P and -A are incompatible.
\n
"
);
exit
(
1
);
}
if
(
do_daemonise
)
{
if
(
logfile
==
NULL
)
logfile
=
"/var/log/babeld.log"
;
...
...
@@ -776,7 +786,7 @@ main(int argc, char **argv)
" "
"[-h hello] [-H wired_hello] [-i idle_hello]
\n
"
" "
"[-k metric] [-s] [-P] [-l] [-w] [-d level] [-g port]
\n
"
"[-k metric] [-
A metric] [-
s] [-P] [-l] [-w] [-d level] [-g port]
\n
"
" "
"[-t table] [-T table] [-c file] [-C statement]
\n
"
" "
...
...
message.c
View file @
9d84a093
...
...
@@ -878,16 +878,15 @@ flushupdates(struct network *net)
}
xroute
=
find_xroute
(
b
[
i
].
prefix
,
b
[
i
].
plen
);
if
(
xroute
)
{
route
=
find_installed_route
(
b
[
i
].
prefix
,
b
[
i
].
plen
);
if
(
xroute
&&
(
!
route
||
xroute
->
metric
<=
kernel_metric
))
{
really_send_update
(
net
,
myid
,
xroute
->
prefix
,
xroute
->
plen
,
myseqno
,
xroute
->
metric
);
last_prefix
=
xroute
->
prefix
;
last_plen
=
xroute
->
plen
;
continue
;
}
route
=
find_installed_route
(
b
[
i
].
prefix
,
b
[
i
].
plen
);
if
(
route
)
{
}
else
if
(
route
)
{
seqno
=
route
->
seqno
;
metric
=
route
->
metric
;
if
(
metric
<
INFINITY
)
...
...
@@ -903,13 +902,12 @@ flushupdates(struct network *net)
update_source
(
route
->
src
,
seqno
,
metric
);
last_prefix
=
route
->
src
->
prefix
;
last_plen
=
route
->
src
->
plen
;
continue
;
}
else
{
/* There's no route for this prefix. This can happen shortly
after an xroute has been retracted, so send a retraction. */
really_send_update
(
net
,
myid
,
b
[
i
].
prefix
,
b
[
i
].
plen
,
myseqno
,
INFINITY
);
}
/* If we reach this point, there's no route for this prefix.
This can happen after an xroute has been retracted, so send
a retraction. */
really_send_update
(
net
,
myid
,
b
[
i
].
prefix
,
b
[
i
].
plen
,
myseqno
,
INFINITY
);
}
schedule_flush_now
(
net
);
done:
...
...
@@ -1348,7 +1346,9 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
struct
neighbour
*
successor
=
NULL
;
xroute
=
find_xroute
(
prefix
,
plen
);
if
(
xroute
)
{
route
=
find_installed_route
(
prefix
,
plen
);
if
(
xroute
&&
(
!
route
||
xroute
->
metric
<=
kernel_metric
))
{
if
(
hop_count
>
0
&&
memcmp
(
id
,
myid
,
8
)
==
0
)
{
if
(
seqno_compare
(
seqno
,
myseqno
)
>
0
)
{
if
(
seqno_minus
(
seqno
,
myseqno
)
>
100
)
{
...
...
@@ -1362,7 +1362,6 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
return
;
}
route
=
find_installed_route
(
prefix
,
plen
);
if
(
route
&&
(
memcmp
(
id
,
route
->
src
->
id
,
8
)
!=
0
||
seqno_compare
(
seqno
,
route
->
seqno
)
<=
0
))
{
...
...
route.c
View file @
9d84a093
...
...
@@ -42,6 +42,7 @@ THE SOFTWARE.
struct
route
*
routes
=
NULL
;
int
numroutes
=
0
,
maxroutes
=
0
;
int
kernel_metric
=
0
;
int
allow_duplicates
=
-
1
;
struct
route
*
find_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
...
...
@@ -512,6 +513,7 @@ void
consider_route
(
struct
route
*
route
)
{
struct
route
*
installed
;
struct
xroute
*
xroute
;
if
(
route
->
installed
)
return
;
...
...
@@ -519,8 +521,9 @@ consider_route(struct route *route)
if
(
!
route_feasible
(
route
))
return
;
if
(
find_xroute
(
route
->
src
->
prefix
,
route
->
src
->
plen
))
return
;
xroute
=
find_xroute
(
route
->
src
->
prefix
,
route
->
src
->
plen
);
if
(
xroute
&&
(
allow_duplicates
<
0
||
xroute
->
metric
>=
allow_duplicates
))
return
;
installed
=
find_installed_route
(
route
->
src
->
prefix
,
route
->
src
->
plen
);
...
...
route.h
View file @
9d84a093
...
...
@@ -34,7 +34,7 @@ struct route {
extern
struct
route
*
routes
;
extern
int
numroutes
,
maxroutes
;
extern
int
kernel_metric
;
extern
int
kernel_metric
,
allow_duplicates
;
struct
route
*
find_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
neighbour
*
neigh
,
const
unsigned
char
*
nexthop
);
...
...
xroute.c
View file @
9d84a093
...
...
@@ -208,8 +208,11 @@ check_xroutes(int send_updates)
if
(
rc
)
{
struct
route
*
route
;
route
=
find_installed_route
(
routes
[
i
].
prefix
,
routes
[
i
].
plen
);
if
(
route
)
uninstall_route
(
route
);
if
(
route
)
{
if
(
allow_duplicates
<
0
||
routes
[
i
].
metric
<
allow_duplicates
)
uninstall_route
(
route
);
}
change
=
1
;
if
(
send_updates
)
send_update
(
NULL
,
0
,
routes
[
i
].
prefix
,
routes
[
i
].
plen
);
...
...
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