On Friday, 7 May 2021 19:14:35 CEST Alexander Sarmanow wrote:
--- a/netlink.c +++ b/netlink.c @@ -363,17 +363,21 @@ static int info_callback(struct nl_msg *msg, void *arg) else extra_header = "";
ret = asprintf(&opts->remaining_header,
"[B.A.T.M.A.N. adv %s, MainIF/MAC: %s/%02x:%02x:%02x:%02x:%02x:%02x (%s/%02x:%02x:%02x:%02x:%02x:%02x %s)%s]\n%s",
version, primary_if,
primary_mac[0], primary_mac[1], primary_mac[2],
primary_mac[3], primary_mac[4], primary_mac[5],
mesh_name,
mesh_mac[0], mesh_mac[1], mesh_mac[2],
mesh_mac[3], mesh_mac[4], mesh_mac[5],
algo_name, extra_info, extra_header);
if (ret < 0)
opts->remaining_header = NULL;
if (!opts->is_json) {
ret = asprintf(&opts->remaining_header,
"[B.A.T.M.A.N. adv %s, MainIF/MAC: %s/%02x:%02x:%02x:%02x:%02x:%02x (%s/%02x:%02x:%02x:%02x:%02x:%02x %s)%s]\n%s",
version, primary_if,
primary_mac[0], primary_mac[1],
primary_mac[2], primary_mac[3],
primary_mac[4], primary_mac[5],
mesh_name,
mesh_mac[0], mesh_mac[1], mesh_mac[2],
mesh_mac[3], mesh_mac[4], mesh_mac[5],
algo_name, extra_info, extra_header);
if (ret < 0)
opts->remaining_header = NULL;
}
This is rather bad. You've already queried stuff before. Just make sure that you set the SKIP_HEADER flag and get rid of this is_json.
Kind regards, Sven