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
f311f9f6
Commit
f311f9f6
authored
Feb 16, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move wireless detection to network_up.
parent
dfe63a08
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
20 deletions
+24
-20
babel.c
babel.c
+2
-15
network.c
network.c
+21
-4
network.h
network.h
+1
-1
No files found.
babel.c
View file @
f311f9f6
...
@@ -392,21 +392,8 @@ main(int argc, char **argv)
...
@@ -392,21 +392,8 @@ main(int argc, char **argv)
/* 40 for IPv6 header, 8 for UDP header, 12 for good luck. */
/* 40 for IPv6 header, 8 for UDP header, 12 for good luck. */
mtu
-=
60
;
mtu
-=
60
;
if
(
all_wireless
)
{
debugf
(
"Adding network %s.
\n
"
,
*
arg
);
rc
=
1
;
vrc
=
add_network
(
*
arg
);
}
else
{
rc
=
kernel_interface_wireless
(
*
arg
,
ifindex
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"Warning: couldn't determine whether %s "
"is a wireless interface.
\n
"
,
*
arg
);
rc
=
1
;
}
}
debugf
(
"Adding %s network %s (%d).
\n
"
,
rc
?
"wireless"
:
"wired"
,
*
arg
,
ifindex
);
vrc
=
add_network
(
*
arg
,
!
rc
,
rc
?
256
:
128
);
if
(
vrc
==
NULL
)
if
(
vrc
==
NULL
)
goto
fail
;
goto
fail
;
SHIFT
();
SHIFT
();
...
...
network.c
View file @
f311f9f6
...
@@ -37,7 +37,7 @@ struct network nets[MAXNETS];
...
@@ -37,7 +37,7 @@ struct network nets[MAXNETS];
int
numnets
=
0
;
int
numnets
=
0
;
struct
network
*
struct
network
*
add_network
(
char
*
ifname
,
int
wired
,
unsigned
int
cost
)
add_network
(
char
*
ifname
)
{
{
if
(
numnets
>=
MAXNETS
)
{
if
(
numnets
>=
MAXNETS
)
{
fprintf
(
stderr
,
"Too many networks.
\n
"
);
fprintf
(
stderr
,
"Too many networks.
\n
"
);
...
@@ -48,8 +48,6 @@ add_network(char *ifname, int wired, unsigned int cost)
...
@@ -48,8 +48,6 @@ add_network(char *ifname, int wired, unsigned int cost)
nets
[
numnets
].
up
=
0
;
nets
[
numnets
].
up
=
0
;
nets
[
numnets
].
ifindex
=
0
;
nets
[
numnets
].
ifindex
=
0
;
nets
[
numnets
].
ipv4
=
NULL
;
nets
[
numnets
].
ipv4
=
NULL
;
nets
[
numnets
].
wired
=
wired
;
nets
[
numnets
].
cost
=
cost
;
nets
[
numnets
].
activity_time
=
now
.
tv_sec
;
nets
[
numnets
].
activity_time
=
now
.
tv_sec
;
nets
[
numnets
].
bufsize
=
0
;
nets
[
numnets
].
bufsize
=
0
;
strncpy
(
nets
[
numnets
].
ifname
,
ifname
,
IF_NAMESIZE
);
strncpy
(
nets
[
numnets
].
ifname
,
ifname
,
IF_NAMESIZE
);
...
@@ -127,7 +125,7 @@ update_jitter(struct network *net, int urgent)
...
@@ -127,7 +125,7 @@ update_jitter(struct network *net, int urgent)
static
int
static
int
network_up
(
struct
network
*
net
,
int
up
)
network_up
(
struct
network
*
net
,
int
up
)
{
{
int
mtu
;
int
mtu
,
rc
,
wired
;
if
(
up
==
net
->
up
)
if
(
up
==
net
->
up
)
return
0
;
return
0
;
...
@@ -153,6 +151,25 @@ network_up(struct network *net, int up)
...
@@ -153,6 +151,25 @@ network_up(struct network *net, int up)
net
->
bufsize
=
0
;
net
->
bufsize
=
0
;
return
network_up
(
net
,
0
);
return
network_up
(
net
,
0
);
}
}
if
(
all_wireless
)
{
wired
=
1
;
}
else
{
rc
=
kernel_interface_wireless
(
net
->
ifname
,
net
->
ifindex
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"Warning: couldn't determine whether %s (%d) "
"is a wireless interface.
\n
"
,
net
->
ifname
,
net
->
ifindex
);
wired
=
0
;
}
else
{
wired
=
!
rc
;
}
}
net
->
wired
=
wired
;
net
->
cost
=
wired
?
128
:
256
;
update_hello_interval
(
net
);
update_hello_interval
(
net
);
}
else
{
}
else
{
net
->
buffered
=
0
;
net
->
buffered
=
0
;
...
...
network.h
View file @
f311f9f6
...
@@ -47,7 +47,7 @@ struct network {
...
@@ -47,7 +47,7 @@ struct network {
extern
struct
network
nets
[
MAXNETS
];
extern
struct
network
nets
[
MAXNETS
];
extern
int
numnets
;
extern
int
numnets
;
struct
network
*
add_network
(
char
*
ifname
,
int
wired
,
unsigned
int
cost
);
struct
network
*
add_network
(
char
*
ifname
);
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
int
jitter
(
struct
network
*
net
);
unsigned
int
jitter
(
struct
network
*
net
);
...
...
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