public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@open-mesh.com>
Subject: Re: [B.A.T.M.A.N.] [PATCH 1/2] alfred: Handle EPERM on every sendto
Date: Fri, 2 May 2014 13:06:43 +0200	[thread overview]
Message-ID: <201405021306.43493.sw@simonwunderlich.de> (raw)
In-Reply-To: <1397733571-1531-1-git-send-email-sven@open-mesh.com>

> The announcements are currently only sent by alfred instances in master
> mode. Slave instances don't announce themself and thus don't detect the
> broken socket. To also catch such problems, it is useful to handle the
> detection of EPERM during the send in send_alfred_packet which is always
> called when a link-local UDP packet is send over the network.
> 
> Signed-off-by: Sven Eckelmann <sven@open-mesh.com>

Sorry, I forgot to reply:

Both patches have been merged:

839cfd5 alfred: Check for changed interface properties
fcd4b0a alfred: Handle EPERM on every sendto

Thank you!!
   Simon

> ---
>  send.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/send.c b/send.c
> index 89e9c07..dc0e428 100644
> --- a/send.c
> +++ b/send.c
> @@ -32,7 +32,6 @@
> 
>  int announce_master(struct globals *globals)
>  {
> -	ssize_t ret;
>  	struct alfred_announce_master_v0 announcement;
> 
>  	if (globals->netsock < 0)
> @@ -42,14 +41,8 @@ int announce_master(struct globals *globals)
>  	announcement.header.version = ALFRED_VERSION;
>  	announcement.header.length = htons(0);
> 
> -	ret = send_alfred_packet(globals, &in6addr_localmcast, &announcement,
> -				 sizeof(announcement));
> -	if (ret == -EPERM) {
> -		fprintf(stderr, "Error during announcement\n");
> -		netsock_close(globals->netsock);
> -		globals->netsock = -1;
> -	}
> -
> +	send_alfred_packet(globals, &in6addr_localmcast, &announcement,
> +			   sizeof(announcement));
> 
>  	return 0;
>  }
> @@ -176,6 +169,11 @@ ssize_t send_alfred_packet(struct globals *globals,
> const struct in6_addr *dest, ret = sendto(globals->netsock, buf, length,
> 0,
>  		     (struct sockaddr *)&dest_addr,
>  		     sizeof(struct sockaddr_in6));
> +	if (ret == -EPERM) {
> +		fprintf(stderr, "Error during sent\n");
> +		netsock_close(globals->netsock);
> +		globals->netsock = -1;
> +	}
> 
>  	return ret;
>  }

      parent reply	other threads:[~2014-05-02 11:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17 11:19 [B.A.T.M.A.N.] [PATCH 1/2] alfred: Handle EPERM on every sendto Sven Eckelmann
2014-04-17 11:19 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: Check for changed interface properties Sven Eckelmann
2014-05-02 11:06 ` Simon Wunderlich [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=201405021306.43493.sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sven@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