public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: Alexander Sarmanow <asarmanow@gmail.com>
Cc: b.a.t.m.a.n@lists.open-mesh.org,
	Alexander Sarmanow <asarmanow@gmail.com>
Subject: Re: [PATCH v2 2/2] batctl: Add JSON debug commands
Date: Fri, 07 May 2021 21:08:11 +0200	[thread overview]
Message-ID: <3428725.5OVnchzC0Q@sven-l14> (raw)
In-Reply-To: <20210507171435.370648-1-asarmanow@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2139 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2021-05-07 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 17:14 [PATCH v2 2/2] batctl: Add JSON debug commands Alexander Sarmanow
2021-05-07 18:58 ` Sven Eckelmann
2021-05-10  7:58   ` asarmanow
2021-05-10 10:14     ` Sven Eckelmann
2021-05-10 14:22       ` Sven Eckelmann
2021-05-07 19:08 ` Sven Eckelmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3428725.5OVnchzC0Q@sven-l14 \
    --to=sven@narfation.org \
    --cc=asarmanow@gmail.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox