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
ecac798d
Commit
ecac798d
authored
Mar 16, 2009
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make add_network take a configuration parameter.
parent
787d2e65
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
babel.c
babel.c
+1
-1
network.c
network.c
+8
-2
network.h
network.h
+7
-1
No files found.
babel.c
View file @
ecac798d
...
@@ -357,7 +357,7 @@ main(int argc, char **argv)
...
@@ -357,7 +357,7 @@ main(int argc, char **argv)
while
(
*
arg
)
{
while
(
*
arg
)
{
debugf
(
"Adding network %s.
\n
"
,
*
arg
);
debugf
(
"Adding network %s.
\n
"
,
*
arg
);
vrc
=
add_network
(
*
arg
);
vrc
=
add_network
(
*
arg
,
NULL
);
if
(
vrc
==
NULL
)
if
(
vrc
==
NULL
)
goto
fail
;
goto
fail
;
SHIFT
();
SHIFT
();
...
...
network.c
View file @
ecac798d
...
@@ -55,17 +55,23 @@ last_network(void)
...
@@ -55,17 +55,23 @@ last_network(void)
}
}
struct
network
*
struct
network
*
add_network
(
char
*
ifname
)
add_network
(
char
*
ifname
,
struct
network_conf
*
conf
)
{
{
struct
network
*
net
;
struct
network
*
net
;
if
(
conf
)
{
if
(
strcmp
(
ifname
,
conf
->
ifname
)
!=
0
)
return
NULL
;
}
net
=
malloc
(
sizeof
(
struct
network
));
net
=
malloc
(
sizeof
(
struct
network
));
if
(
net
==
NULL
)
if
(
net
==
NULL
)
return
NULL
;
return
NULL
;
memset
(
net
,
0
,
sizeof
(
struct
network
));
memset
(
net
,
0
,
sizeof
(
struct
network
));
net
->
activity_time
=
now
.
tv_sec
;
strncpy
(
net
->
ifname
,
ifname
,
IF_NAMESIZE
);
strncpy
(
net
->
ifname
,
ifname
,
IF_NAMESIZE
);
net
->
conf
=
conf
;
net
->
activity_time
=
now
.
tv_sec
;
net
->
bucket_time
=
now
.
tv_sec
;
net
->
bucket_time
=
now
.
tv_sec
;
net
->
bucket
=
BUCKET_TOKENS_MAX
;
net
->
bucket
=
BUCKET_TOKENS_MAX
;
net
->
hello_seqno
=
(
random
()
&
0xFFFF
);
net
->
hello_seqno
=
(
random
()
&
0xFFFF
);
...
...
network.h
View file @
ecac798d
...
@@ -27,8 +27,14 @@ struct buffered_update {
...
@@ -27,8 +27,14 @@ struct buffered_update {
unsigned
char
pad
[
3
];
unsigned
char
pad
[
3
];
};
};
struct
network_conf
{
char
*
ifname
;
struct
network_conf
*
next
;
};
struct
network
{
struct
network
{
struct
network
*
next
;
struct
network
*
next
;
struct
network_conf
*
conf
;
char
up
;
char
up
;
char
wired
;
char
wired
;
unsigned
int
ifindex
;
unsigned
int
ifindex
;
...
@@ -68,7 +74,7 @@ extern int numnets;
...
@@ -68,7 +74,7 @@ extern int numnets;
#define FOR_ALL_NETS(_net) for(_net = networks; _net; _net = _net->next)
#define FOR_ALL_NETS(_net) for(_net = networks; _net; _net = _net->next)
struct
network
*
add_network
(
char
*
ifname
);
struct
network
*
add_network
(
char
*
ifname
,
struct
network_conf
*
conf
);
int
network_idle
(
struct
network
*
net
);
int
network_idle
(
struct
network
*
net
);
int
update_hello_interval
(
struct
network
*
net
);
int
update_hello_interval
(
struct
network
*
net
);
unsigned
jitter
(
struct
network
*
net
,
int
urgent
);
unsigned
jitter
(
struct
network
*
net
,
int
urgent
);
...
...
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