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
74c1ff37
Commit
74c1ff37
authored
Oct 06, 2011
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the xroute table private to xroute.c.
parent
a08dde85
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
19 deletions
+38
-19
babeld.c
babeld.c
+10
-6
local.c
local.c
+8
-3
message.c
message.c
+8
-4
xroute.c
xroute.c
+11
-3
xroute.h
xroute.h
+1
-3
No files found.
babeld.c
View file @
74c1ff37
...
@@ -962,11 +962,19 @@ dump_route_callback(struct route *route, void *closure)
...
@@ -962,11 +962,19 @@ dump_route_callback(struct route *route, void *closure)
route_feasible
(
route
)
?
" (feasible)"
:
""
);
route_feasible
(
route
)
?
" (feasible)"
:
""
);
}
}
static
void
dump_xroute_callback
(
struct
xroute
*
xroute
,
void
*
closure
)
{
FILE
*
out
=
(
FILE
*
)
closure
;
fprintf
(
out
,
"%s metric %d (exported)
\n
"
,
format_prefix
(
xroute
->
prefix
,
xroute
->
plen
),
xroute
->
metric
);
}
static
void
static
void
dump_tables
(
FILE
*
out
)
dump_tables
(
FILE
*
out
)
{
{
struct
neighbour
*
neigh
;
struct
neighbour
*
neigh
;
int
i
;
fprintf
(
out
,
"
\n
"
);
fprintf
(
out
,
"
\n
"
);
...
@@ -982,11 +990,7 @@ dump_tables(FILE *out)
...
@@ -982,11 +990,7 @@ dump_tables(FILE *out)
neigh
->
ifp
->
channel
,
neigh
->
ifp
->
channel
,
if_up
(
neigh
->
ifp
)
?
""
:
" (down)"
);
if_up
(
neigh
->
ifp
)
?
""
:
" (down)"
);
}
}
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
{
for_all_xroutes
(
dump_xroute_callback
,
out
);
fprintf
(
out
,
"%s metric %d (exported)
\n
"
,
format_prefix
(
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
),
xroutes
[
i
].
metric
);
}
for_all_routes
(
dump_route_callback
,
out
);
for_all_routes
(
dump_route_callback
,
out
);
fflush
(
out
);
fflush
(
out
);
}
}
...
...
local.c
View file @
74c1ff37
...
@@ -222,6 +222,12 @@ local_notify_route(struct route *route, int kind)
...
@@ -222,6 +222,12 @@ local_notify_route(struct route *route, int kind)
return
;
return
;
}
}
static
void
local_notify_xroute_callback
(
struct
xroute
*
xroute
,
void
*
closure
)
{
local_notify_xroute
(
xroute
,
LOCAL_ADD
);
}
static
void
static
void
local_notify_route_callback
(
struct
route
*
route
,
void
*
closure
)
local_notify_route_callback
(
struct
route
*
route
,
void
*
closure
)
{
{
...
@@ -231,7 +237,7 @@ local_notify_route_callback(struct route *route, void *closure)
...
@@ -231,7 +237,7 @@ local_notify_route_callback(struct route *route, void *closure)
void
void
local_notify_all
()
local_notify_all
()
{
{
int
i
,
rc
;
int
rc
;
struct
neighbour
*
neigh
;
struct
neighbour
*
neigh
;
const
char
*
header
=
"BABEL 0.0
\n
"
;
const
char
*
header
=
"BABEL 0.0
\n
"
;
...
@@ -246,8 +252,7 @@ local_notify_all()
...
@@ -246,8 +252,7 @@ local_notify_all()
FOR_ALL_NEIGHBOURS
(
neigh
)
{
FOR_ALL_NEIGHBOURS
(
neigh
)
{
local_notify_neighbour
(
neigh
,
LOCAL_ADD
);
local_notify_neighbour
(
neigh
,
LOCAL_ADD
);
}
}
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
for_all_xroutes
(
local_notify_xroute_callback
,
NULL
);
local_notify_xroute
(
&
xroutes
[
i
],
LOCAL_ADD
);
for_all_routes
(
local_notify_route_callback
,
NULL
);
for_all_routes
(
local_notify_route_callback
,
NULL
);
return
;
return
;
...
...
message.c
View file @
74c1ff37
...
@@ -1181,11 +1181,16 @@ update_myseqno()
...
@@ -1181,11 +1181,16 @@ update_myseqno()
seqno_time
=
now
;
seqno_time
=
now
;
}
}
static
void
send_xroute_update_callback
(
struct
xroute
*
xroute
,
void
*
closure
)
{
struct
interface
*
ifp
=
(
struct
interface
*
)
closure
;
send_update
(
ifp
,
0
,
xroute
->
prefix
,
xroute
->
plen
);
}
void
void
send_self_update
(
struct
interface
*
ifp
)
send_self_update
(
struct
interface
*
ifp
)
{
{
int
i
;
if
(
ifp
==
NULL
)
{
if
(
ifp
==
NULL
)
{
struct
interface
*
ifp_aux
;
struct
interface
*
ifp_aux
;
FOR_ALL_INTERFACES
(
ifp_aux
)
{
FOR_ALL_INTERFACES
(
ifp_aux
)
{
...
@@ -1198,8 +1203,7 @@ send_self_update(struct interface *ifp)
...
@@ -1198,8 +1203,7 @@ send_self_update(struct interface *ifp)
if
(
!
interface_idle
(
ifp
))
{
if
(
!
interface_idle
(
ifp
))
{
debugf
(
"Sending self update to %s.
\n
"
,
ifp
->
name
);
debugf
(
"Sending self update to %s.
\n
"
,
ifp
->
name
);
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
for_all_xroutes
(
send_xroute_update_callback
,
ifp
);
send_update
(
ifp
,
0
,
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
);
}
}
}
}
...
...
xroute.c
View file @
74c1ff37
...
@@ -39,9 +39,8 @@ THE SOFTWARE.
...
@@ -39,9 +39,8 @@ THE SOFTWARE.
#include "interface.h"
#include "interface.h"
#include "local.h"
#include "local.h"
struct
xroute
*
xroutes
;
static
struct
xroute
*
xroutes
;
int
numxroutes
=
0
;
static
int
numxroutes
=
0
,
maxxroutes
=
0
;
int
maxxroutes
=
0
;
struct
xroute
*
struct
xroute
*
find_xroute
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
find_xroute
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
...
@@ -120,6 +119,15 @@ add_xroute(unsigned char prefix[16], unsigned char plen,
...
@@ -120,6 +119,15 @@ add_xroute(unsigned char prefix[16], unsigned char plen,
return
1
;
return
1
;
}
}
void
for_all_xroutes
(
void
(
*
f
)(
struct
xroute
*
,
void
*
),
void
*
closure
)
{
int
i
;
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
(
*
f
)(
&
xroutes
[
i
],
closure
);
}
int
int
check_xroutes
(
int
send_updates
)
check_xroutes
(
int
send_updates
)
{
{
...
...
xroute.h
View file @
74c1ff37
...
@@ -28,11 +28,9 @@ struct xroute {
...
@@ -28,11 +28,9 @@ struct xroute {
int
proto
;
int
proto
;
};
};
extern
struct
xroute
*
xroutes
;
extern
int
numxroutes
;
struct
xroute
*
find_xroute
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
struct
xroute
*
find_xroute
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
void
flush_xroute
(
struct
xroute
*
xroute
);
void
flush_xroute
(
struct
xroute
*
xroute
);
int
add_xroute
(
unsigned
char
prefix
[
16
],
unsigned
char
plen
,
int
add_xroute
(
unsigned
char
prefix
[
16
],
unsigned
char
plen
,
unsigned
short
metric
,
unsigned
int
ifindex
,
int
proto
);
unsigned
short
metric
,
unsigned
int
ifindex
,
int
proto
);
void
for_all_xroutes
(
void
(
*
f
)(
struct
xroute
*
,
void
*
),
void
*
closure
);
int
check_xroutes
(
int
send_updates
);
int
check_xroutes
(
int
send_updates
);
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