public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio.quartulli@open-mesh.com>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Cc: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Subject: Re: [B.A.T.M.A.N.] [PATCH v2 3/3] batman-adv: throughput meter implementation
Date: Tue, 3 May 2016 01:28:28 +0800	[thread overview]
Message-ID: <20160502172828.GZ11201@prodigo.lan> (raw)
In-Reply-To: <1459508076-29674-3-git-send-email-sven@open-mesh.com>

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

Sven,

a comment is inline.

On Fri, Apr 01, 2016 at 12:54:36PM +0200, Sven Eckelmann wrote:

[...]

> +/**
> + * batadv_tp_send - main sending thread of a tp meter session
> + * @arg: address of the related tp_vars
> + *
> + * Return: nothing, this function never returns
> + */
> +static int batadv_tp_send(void *arg)
> +{
> +	struct batadv_tp_vars *tp_vars = arg;
> +	struct batadv_priv *bat_priv = tp_vars->bat_priv;
> +	struct batadv_hard_iface *primary_if = NULL;
> +	struct batadv_orig_node *orig_node = NULL;
> +	size_t payload_len, packet_len;
> +	int err = 0;
> +
> +	if (unlikely(tp_vars->role != BATADV_TP_SENDER)) {
> +		err = BATADV_TP_DST_UNREACHABLE;
> +		goto out;
> +	}
> +
> +	orig_node = batadv_orig_hash_find(bat_priv, tp_vars->other_end);
> +	if (unlikely(!orig_node)) {
> +		err = BATADV_TP_DST_UNREACHABLE;
> +		goto out;
> +	}
> +
> +	primary_if = batadv_primary_if_get_selected(bat_priv);
> +	if (unlikely(!primary_if)) {
> +		err = BATADV_TP_DST_UNREACHABLE;
> +		goto out;
> +	}

in case of error we modify err and then we jump to out, but:

[...]

> +out:
> +	if (likely(primary_if))
> +		batadv_hardif_put(primary_if);
> +	if (likely(orig_node))
> +		batadv_orig_node_put(orig_node);
> +
> +	batadv_tp_sender_end(bat_priv, tp_vars);
> +	batadv_tp_sender_cleanup(bat_priv, tp_vars);
> +
> +	batadv_tp_vars_put(tp_vars);
> +
> +	do_exit(0);
> +}

shouldn't we propagate the value saved in err to tp_vars->reason ?

We found this error while using the tp_meter, because we tried to run it
against a non-existing originator and batctl crashed.


Cheers,

-- 
Antonio Quartulli

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-05-02 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 10:54 [B.A.T.M.A.N.] [PATCH v2 1/3] batman-adv: return netdev status in the TX path Sven Eckelmann
2016-04-01 10:54 ` [B.A.T.M.A.N.] [PATCH v2 2/3] batman-adv: use another ICMP packet when sending command from userspace Sven Eckelmann
2016-04-01 10:54 ` [B.A.T.M.A.N.] [PATCH v2 3/3] batman-adv: throughput meter implementation Sven Eckelmann
2016-05-02 17:28   ` Antonio Quartulli [this message]
2016-05-03  8:18     ` Sven Eckelmann
2016-05-03 12:21       ` Antonio Quartulli
2016-05-02 17:53   ` Antonio Quartulli

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=20160502172828.GZ11201@prodigo.lan \
    --to=antonio.quartulli@open-mesh.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sven.eckelmann@open-mesh.com \
    /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