From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Jonathan Haws <jhaws@sdl.usu.edu>, guohuizou2000@sina.com
Subject: Re: [B.A.T.M.A.N.] [PATCH v2] alfred: Request MAC resolution for IPv4 address not in ARP cache
Date: Thu, 25 Oct 2018 11:41:53 +0200 [thread overview]
Message-ID: <2365708.Am9coUDyuZ@bentobox> (raw)
In-Reply-To: <20181024192128.22531-1-jhaws@sdl.usu.edu>
[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]
On Mittwoch, 24. Oktober 2018 13:21:28 CEST Jonathan Haws wrote:
[...]
>
> + while (retries-- && !(arpreq.arp_flags & ATF_COM)) {
> + ipv4_request_mac_resolve(addr);
> + usleep(200000);
> +
> + if (ioctl(interface->netsock, SIOCGARP, &arpreq) < 0)
> + return -1;
> + }
> +
> if (arpreq.arp_flags & ATF_COM) {
> memcpy(mac, arpreq.arp_ha.sa_data, sizeof(*mac));
> } else {
According to gary [1], this doesn't work because the ioctl fails for him and
then the function returns immediately (before the while loop).
Please adjust your patch - but please don't use his code - it looks rather
ugly and also doesn't work for multiple retries. You most likely want to
drop the if-ioctl completely and then put everything in your while loop:
while (ioctl(interface->netsock, SIOCGARP, &arpreq) < 0 ||
!(arpreq.arp_flags & ATF_COM)) {
if (retries-- <= 0)
break;
ipv4_request_mac_resolve(addr);
usleep(200000);
}
But feel to propose a different (cleaner) approach.
Kind regards,
Sven
[1] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2018-October/018195.html
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-10-25 9:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 19:21 [B.A.T.M.A.N.] [PATCH v2] alfred: Request MAC resolution for IPv4 address not in ARP cache Jonathan Haws
2018-10-25 9:41 ` Sven Eckelmann [this message]
2018-10-25 13:42 ` Jonathan Haws
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=2365708.Am9coUDyuZ@bentobox \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=guohuizou2000@sina.com \
--cc=jhaws@sdl.usu.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.