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
Package registry
Model registry
Operate
Terraform modules
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
Patrick
FFS Gluon
Commits
ab260278
Commit
ab260278
authored
5 years ago
by
nrbffs
Browse files
Options
Downloads
Patches
Plain Diff
radv-filter: print gateway list
parent
47edaab4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-radv-filterd/src/gluon-radv-filterd.c
+55
-0
55 additions, 0 deletions
package/gluon-radv-filterd/src/gluon-radv-filterd.c
with
55 additions
and
0 deletions
package/gluon-radv-filterd/src/gluon-radv-filterd.c
+
55
−
0
View file @
ab260278
...
...
@@ -403,6 +403,54 @@ static void expire_routers(void) {
}
}
static
int
parse_gws_global
(
struct
nl_msg
*
msg
,
void
*
arg
__attribute__
((
unused
)))
{
static
const
enum
batadv_nl_attrs
mandatory
[]
=
{
BATADV_ATTR_ORIG_ADDRESS
,
BATADV_ATTR_FLAG_BEST
,
};
struct
nlattr
*
attrs
[
BATADV_ATTR_MAX
+
1
];
struct
nlmsghdr
*
nlh
=
nlmsg_hdr
(
msg
);
struct
ether_addr
mac_a
,
mac_b
;
struct
genlmsghdr
*
ghdr
;
struct
router
*
router
;
uint8_t
*
addr
;
uint8_t
*
best
;
// parse netlink entry
if
(
!
genlmsg_valid_hdr
(
nlh
,
0
))
return
NL_OK
;
ghdr
=
nlmsg_data
(
nlh
);
if
(
ghdr
->
cmd
!=
BATADV_CMD_GET_GATEWAYS
)
{
DEBUG_MSG
(
"cmd is not BATADV_CMD_GET_GATEWAYS but %d"
,
ghdr
->
cmd
);
return
NL_OK
;
}
if
(
nla_parse
(
attrs
,
BATADV_ATTR_MAX
,
genlmsg_attrdata
(
ghdr
,
0
),
genlmsg_len
(
ghdr
),
batadv_genl_policy
))
{
DEBUG_MSG
(
"parsing failed"
);
return
NL_OK
;
}
if
(
batadv_genl_missing_attrs
(
attrs
,
mandatory
,
ARRAY_SIZE
(
mandatory
)))
{
DEBUG_MSG
(
"missing attrs in netlink response"
);
return
NL_OK
;
}
orig
=
nla_data
(
attrs
[
BATADV_ATTR_ORIG_ADDRESS
]);
best
=
nla_data
(
attrs
[
BATADV_ATTR_FLAG_BEST
]);
MAC2ETHER
(
mac_a
,
addr
);
DEBUG_MSG
(
"Found gateway "
F_MAC
" (best=%d)"
F_MAC_VAR
(
mac_a
),
*
best
);
return
NL_OK
;
}
static
int
parse_tt_global
(
struct
nl_msg
*
msg
,
void
*
arg
__attribute__
((
unused
)))
{
...
...
@@ -573,6 +621,13 @@ static void update_tqs(void) {
update_originators
=
true
;
}
opts
.
err
=
0
;
ret
=
batadv_genl_query
(
G
.
mesh_iface
,
BATADV_CMD_GET_GATEWAYS
,
parse_gws_global
,
NLM_F_DUMP
,
&
opts
);
if
(
ret
<
0
)
fprintf
(
stderr
,
"Parsing of gateways failed
\n
"
);
// translate all router's MAC addresses to originators simultaneously
if
(
update_originators
)
{
opts
.
err
=
0
;
...
...
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