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
36fa3423
Commit
36fa3423
authored
Feb 10, 2016
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement flush_interface.
parent
336de763
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
1 deletion
+57
-1
configuration.c
configuration.c
+21
-0
configuration.h
configuration.h
+2
-0
interface.c
interface.c
+33
-1
interface.h
interface.h
+1
-0
No files found.
configuration.c
View file @
36fa3423
...
...
@@ -675,6 +675,27 @@ add_ifconf(struct interface_conf *if_conf, struct interface_conf **if_confs)
}
}
void
flush_ifconf
(
struct
interface_conf
*
if_conf
)
{
if
(
if_conf
==
interface_confs
)
{
interface_confs
=
if_conf
->
next
;
free
(
if_conf
);
return
;
}
else
{
struct
interface_conf
*
prev
=
interface_confs
;
while
(
prev
)
{
if
(
prev
->
next
==
if_conf
)
{
prev
->
next
=
if_conf
->
next
;
free
(
if_conf
);
return
;
}
prev
=
prev
->
next
;
}
}
fprintf
(
stderr
,
"Warning: attempting to free nonexistent ifconf.
\n
"
);
}
static
int
parse_option
(
int
c
,
gnc_t
gnc
,
void
*
closure
,
char
*
token
)
{
...
...
configuration.h
View file @
36fa3423
...
...
@@ -54,6 +54,8 @@ struct filter {
extern
struct
interface_conf
*
default_interface_conf
;
void
flush_ifconf
(
struct
interface_conf
*
if_conf
);
int
parse_config_from_file
(
const
char
*
filename
,
int
*
line_return
);
int
parse_config_from_string
(
char
*
string
,
int
n
);
void
renumber_filters
(
void
);
...
...
interface.c
View file @
36fa3423
...
...
@@ -65,7 +65,10 @@ add_interface(char *ifname, struct interface_conf *if_conf)
FOR_ALL_INTERFACES
(
ifp
)
{
if
(
strcmp
(
ifp
->
name
,
ifname
)
==
0
)
{
assert
(
if_conf
==
NULL
);
if
(
if_conf
)
fprintf
(
stderr
,
"Warning: attempting to add existing interface, "
"new configuration ignored.
\n
"
);
return
ifp
;
}
}
...
...
@@ -89,6 +92,35 @@ add_interface(char *ifname, struct interface_conf *if_conf)
return
ifp
;
}
void
flush_interface
(
char
*
ifname
)
{
struct
interface
*
ifp
,
*
prev
;
prev
=
NULL
;
ifp
=
interfaces
;
while
(
ifp
)
{
if
(
strcmp
(
ifp
->
name
,
ifname
)
==
0
)
break
;
prev
=
ifp
;
ifp
=
ifp
->
next
;
}
if
(
ifp
==
NULL
)
{
fprintf
(
stderr
,
"Warning: attempting to flush nonexistent interface.
\n
"
);
return
;
}
interface_up
(
ifp
,
0
);
if
(
prev
)
prev
->
next
=
ifp
->
next
;
else
interfaces
=
ifp
->
next
;
if
(
ifp
->
conf
!=
NULL
&&
ifp
->
conf
!=
default_interface_conf
)
flush_ifconf
(
ifp
->
conf
);
free
(
ifp
);
}
/* This should be no more than half the hello interval, so that hellos
aren't sent late. The result is in milliseconds. */
unsigned
...
...
interface.h
View file @
36fa3423
...
...
@@ -123,6 +123,7 @@ if_up(struct interface *ifp)
}
struct
interface
*
add_interface
(
char
*
ifname
,
struct
interface_conf
*
if_conf
);
void
flush_interface
(
char
*
ifname
);
unsigned
jitter
(
struct
interface
*
ifp
,
int
urgent
);
unsigned
update_jitter
(
struct
interface
*
ifp
,
int
urgent
);
void
set_timeout
(
struct
timeval
*
timeout
,
int
msecs
);
...
...
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