Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
b32ed384
Commit
b32ed384
authored
8 years ago
by
Matthias Schiffer
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gluon-mesh-batman-adv-core: respondd: correctly detect lower interface types (#954)
Fixes #941
parent
1f3e7894
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-mesh-batman-adv-core/src/respondd.c
+24
-2
24 additions, 2 deletions
package/gluon-mesh-batman-adv-core/src/respondd.c
with
24 additions
and
2 deletions
package/gluon-mesh-batman-adv-core/src/respondd.c
+
24
−
2
View file @
b32ed384
...
@@ -121,9 +121,31 @@ static void mesh_add_subif(const char *ifname, struct json_object *wireless,
...
@@ -121,9 +121,31 @@ static void mesh_add_subif(const char *ifname, struct json_object *wireless,
struct
json_object
*
tunnel
,
struct
json_object
*
other
)
{
struct
json_object
*
tunnel
,
struct
json_object
*
other
)
{
struct
json_object
*
address
=
gluonutil_wrap_and_free_string
(
gluonutil_get_interface_address
(
ifname
));
struct
json_object
*
address
=
gluonutil_wrap_and_free_string
(
gluonutil_get_interface_address
(
ifname
));
if
(
interface_file_exists
(
ifname
,
"wireless"
))
char
lowername
[
IFNAMSIZ
];
strncpy
(
lowername
,
ifname
,
sizeof
(
lowername
)
-
1
);
lowername
[
sizeof
(
lowername
)
-
1
]
=
0
;
const
char
*
format
=
"/sys/class/net/%s/lower_*"
;
char
pattern
[
strlen
(
format
)
+
IFNAMSIZ
];
/* In case of VLAN and bridge interfaces, we want the lower interface
* to determine the interface type (but not for the interface address) */
while
(
true
)
{
snprintf
(
pattern
,
sizeof
(
pattern
),
format
,
lowername
);
size_t
pattern_len
=
strlen
(
pattern
);
glob_t
lower
;
if
(
glob
(
pattern
,
GLOB_NOSORT
,
NULL
,
&
lower
))
break
;
strncpy
(
lowername
,
lower
.
gl_pathv
[
0
]
+
pattern_len
-
1
,
sizeof
(
lowername
)
-
1
);
globfree
(
&
lower
);
}
if
(
interface_file_exists
(
lowername
,
"wireless"
))
json_object_array_add
(
wireless
,
address
);
json_object_array_add
(
wireless
,
address
);
else
if
(
interface_file_exists
(
if
name
,
"tun_flags"
))
else
if
(
interface_file_exists
(
lower
name
,
"tun_flags"
))
json_object_array_add
(
tunnel
,
address
);
json_object_array_add
(
tunnel
,
address
);
else
else
json_object_array_add
(
other
,
address
);
json_object_array_add
(
other
,
address
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment