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
c10cd1d8
Commit
c10cd1d8
authored
Aug 10, 2009
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flush routes when an interface goes down.
This avoids desynchronisation between Babel and the kernel.
parent
6a077f86
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
network.c
network.c
+4
-1
route.c
route.c
+16
-0
route.h
route.h
+1
-0
No files found.
network.c
View file @
c10cd1d8
...
@@ -162,6 +162,7 @@ check_network_ipv4(struct network *net)
...
@@ -162,6 +162,7 @@ check_network_ipv4(struct network *net)
if
(
rc
>
0
)
{
if
(
rc
>
0
)
{
if
(
!
net
->
ipv4
||
memcmp
(
ipv4
,
net
->
ipv4
,
4
)
!=
0
)
{
if
(
!
net
->
ipv4
||
memcmp
(
ipv4
,
net
->
ipv4
,
4
)
!=
0
)
{
debugf
(
"Noticed IPv4 change for %s.
\n
"
,
net
->
ifname
);
debugf
(
"Noticed IPv4 change for %s.
\n
"
,
net
->
ifname
);
flush_network_routes
(
net
,
0
);
if
(
!
net
->
ipv4
)
if
(
!
net
->
ipv4
)
net
->
ipv4
=
malloc
(
4
);
net
->
ipv4
=
malloc
(
4
);
if
(
net
->
ipv4
)
if
(
net
->
ipv4
)
...
@@ -169,8 +170,9 @@ check_network_ipv4(struct network *net)
...
@@ -169,8 +170,9 @@ check_network_ipv4(struct network *net)
return
1
;
return
1
;
}
}
}
else
{
}
else
{
debugf
(
"Noticed IPv4 change for %s.
\n
"
,
net
->
ifname
);
if
(
net
->
ipv4
)
{
if
(
net
->
ipv4
)
{
debugf
(
"Noticed IPv4 change for %s.
\n
"
,
net
->
ifname
);
flush_network_routes
(
net
,
0
);
free
(
net
->
ipv4
);
free
(
net
->
ipv4
);
net
->
ipv4
=
NULL
;
net
->
ipv4
=
NULL
;
return
1
;
return
1
;
...
@@ -335,6 +337,7 @@ network_up(struct network *net, int up)
...
@@ -335,6 +337,7 @@ network_up(struct network *net, int up)
send_hello
(
net
);
send_hello
(
net
);
send_request
(
net
,
NULL
,
0
);
send_request
(
net
,
NULL
,
0
);
}
else
{
}
else
{
flush_network_routes
(
net
,
0
);
net
->
buffered
=
0
;
net
->
buffered
=
0
;
net
->
bufsize
=
0
;
net
->
bufsize
=
0
;
free
(
net
->
sendbuf
);
free
(
net
->
sendbuf
);
...
...
route.c
View file @
c10cd1d8
...
@@ -128,6 +128,22 @@ flush_neighbour_routes(struct neighbour *neigh)
...
@@ -128,6 +128,22 @@ flush_neighbour_routes(struct neighbour *neigh)
}
}
}
}
void
flush_network_routes
(
struct
network
*
net
,
int
v4only
)
{
int
i
;
i
=
0
;
while
(
i
<
numroutes
)
{
if
(
routes
[
i
].
neigh
->
network
==
net
&&
(
!
v4only
||
v4mapped
(
routes
[
i
].
nexthop
)))
{
flush_route
(
&
routes
[
i
]);
continue
;
}
i
++
;
}
}
static
int
static
int
metric_to_kernel
(
int
metric
)
metric_to_kernel
(
int
metric
)
{
{
...
...
route.h
View file @
c10cd1d8
...
@@ -42,6 +42,7 @@ struct route *find_installed_route(const unsigned char *prefix,
...
@@ -42,6 +42,7 @@ struct route *find_installed_route(const unsigned char *prefix,
unsigned
char
plen
);
unsigned
char
plen
);
void
flush_route
(
struct
route
*
route
);
void
flush_route
(
struct
route
*
route
);
void
flush_neighbour_routes
(
struct
neighbour
*
neigh
);
void
flush_neighbour_routes
(
struct
neighbour
*
neigh
);
void
flush_network_routes
(
struct
network
*
net
,
int
v4only
);
void
install_route
(
struct
route
*
route
);
void
install_route
(
struct
route
*
route
);
void
uninstall_route
(
struct
route
*
route
);
void
uninstall_route
(
struct
route
*
route
);
void
switch_route
(
struct
route
*
old
,
struct
route
*
new
);
void
switch_route
(
struct
route
*
old
,
struct
route
*
new
);
...
...
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