@@ -289,6 +289,19 @@ u32 get_stats_flag(struct nl_context *nlctx, unsigned int nlcmd,
return nlctx->ops_info[nlcmd].hdr_flags & ETHTOOL_FLAG_STATS;
}
+u32 get_legacy_flag(struct nl_context *nlctx, unsigned int nlcmd,
+ unsigned int hdrattr)
+{
+ if (nlcmd > ETHTOOL_MSG_USER_MAX ||
+ !(nlctx->ops_info[nlcmd].op_flags & GENL_CMD_CAP_HASPOL))
+ return 0;
+
+ if (read_flags_policy(nlctx, nlctx->ethnl_socket, nlcmd, hdrattr) < 0)
+ return 0;
+
+ return nlctx->ops_info[nlcmd].hdr_flags & ETHTOOL_FLAG_LEGACY;
+}
+
/* initialization */
static int genl_read_ops(struct nl_context *nlctx,
@@ -74,6 +74,8 @@ const char *get_dev_name(const struct nlattr *nest);
int get_dev_info(const struct nlattr *nest, int *ifindex, char *ifname);
u32 get_stats_flag(struct nl_context *nlctx, unsigned int nlcmd,
unsigned int hdrattr);
+u32 get_legacy_flag(struct nl_context *nlctx, unsigned int nlcmd,
+ unsigned int hdrattr);
int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data);
int linkinfo_reply_cb(const struct nlmsghdr *nlhdr, void *data);
@@ -996,6 +996,7 @@ int nl_parser(struct nl_context *nlctx, const struct param_parser *params,
for (parser = params; parser->arg; parser++) {
struct nl_msg_buff *msgbuff;
struct nlattr *nest;
+ u32 flags;
n_params++;
if (group_style == PARSER_GROUP_NONE || !parser->group)
@@ -1018,9 +1019,11 @@ int nl_parser(struct nl_context *nlctx, const struct param_parser *params,
goto out_free_buffs;
break;
case PARSER_GROUP_MSG:
+ flags = get_legacy_flag(nlctx, parser->group,
+ ETHTOOL_A_LINKINFO_HEADER);
if (ethnla_fill_header(msgbuff,
ETHTOOL_A_LINKINFO_HEADER,
- nlctx->devname, 0))
+ nlctx->devname, flags))
goto out_free_buffs;
break;
default: