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
2a8350a9
Commit
2a8350a9
authored
Feb 11, 2016
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement local_notify_interface.
parent
bda8e6d1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
12 deletions
+36
-12
local.c
local.c
+35
-12
local.h
local.h
+1
-0
No files found.
local.c
View file @
2a8350a9
...
...
@@ -92,6 +92,40 @@ local_kind(int kind)
}
}
static
void
local_notify_interface_1
(
struct
local_socket
*
s
,
struct
interface
*
ifp
,
int
kind
)
{
char
buf
[
512
];
int
rc
;
rc
=
snprintf
(
buf
,
512
,
"%s interface %s up %s
\n
"
,
local_kind
(
kind
),
ifp
->
name
,
if_up
(
ifp
)
?
"true"
:
"false"
);
if
(
rc
<
0
||
rc
>=
512
)
goto
fail
;
rc
=
write_timeout
(
s
->
fd
,
buf
,
rc
);
if
(
rc
<
0
)
goto
fail
;
return
;
fail:
shutdown
(
s
->
fd
,
1
);
return
;
}
void
local_notify_interface
(
struct
interface
*
ifp
,
int
kind
)
{
int
i
;
for
(
i
=
0
;
i
<
num_local_sockets
;
i
++
)
{
if
(
local_sockets
[
i
].
monitor
)
local_notify_interface_1
(
&
local_sockets
[
i
],
ifp
,
kind
);
}
}
static
void
local_notify_neighbour_1
(
struct
local_socket
*
s
,
struct
neighbour
*
neigh
,
int
kind
)
...
...
@@ -236,14 +270,7 @@ local_notify_all_1(struct local_socket *s)
struct
route_stream
*
routes
;
FOR_ALL_INTERFACES
(
ifp
)
{
char
buf
[
512
];
int
rc
;
rc
=
snprintf
(
buf
,
512
,
"add interface %s
\n
"
,
ifp
->
name
);
if
(
rc
<
0
||
rc
>=
512
)
goto
fail
;
rc
=
write_timeout
(
s
->
fd
,
buf
,
rc
);
if
(
rc
<
0
)
goto
fail
;
local_notify_interface_1
(
s
,
ifp
,
LOCAL_ADD
);
}
FOR_ALL_NEIGHBOURS
(
neigh
)
{
...
...
@@ -272,10 +299,6 @@ local_notify_all_1(struct local_socket *s)
route_stream_done
(
routes
);
}
return
;
fail:
shutdown
(
s
->
fd
,
1
);
return
;
}
int
...
...
local.h
View file @
2a8350a9
...
...
@@ -48,6 +48,7 @@ extern struct local_socket local_sockets[MAX_LOCAL_SOCKETS];
extern
int
num_local_sockets
;
extern
int
local_server_port
;
void
local_notify_interface
(
struct
interface
*
ifp
,
int
kind
);
void
local_notify_neighbour
(
struct
neighbour
*
neigh
,
int
kind
);
void
local_notify_xroute
(
struct
xroute
*
xroute
,
int
kind
);
void
local_notify_route
(
struct
babel_route
*
route
,
int
kind
);
...
...
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