From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH v7] batman-adv: Snoop DHCPACKs for DAT
Date: Sun, 30 Dec 2018 15:51:33 +0100 [thread overview]
Message-ID: <20181230145133.GA4150@otheros> (raw)
In-Reply-To: <1976755.cJCZaRukfj@sven-edge>
On Sun, Dec 30, 2018 at 02:51:12PM +0100, Sven Eckelmann wrote:
> On Saturday, 29 December 2018 04.10.40 CET Linus Lüssing wrote:
> > +#define BATADV_DHCP_YIADDR_LEN sizeof(((struct batadv_dhcp_packet *)0)->chaddr)
> > +#define BATADV_DHCP_CHADDR_LEN sizeof(((struct batadv_dhcp_packet *)0)->chaddr)
>
> Why do you use chaddr to calculate the size of yiaddr? yiaddr is only 4 byte
> and chaddr is 16 byte. Looks to me like you have a potential stack overflow in
> batadv_dat_dhcp_get_yiaddr because of that.
Urgh... three memory issues fixed, one new one introduced, yaiy...
thanks!
> And you have a lot of code which calls skb_header_pointer again and again + a
> lot of offset calculations. So it has to potentially traverse all the
> fragments again and again. I have seen:
>
> * op
> * htype
> * hlen
> * magic
> * TLV options parts
> * yiaddr
> * chaddr
>
> Do you see any potential in combining some of them in batadv_dat_check_dhcp
> (e.g. op, htype, hlen)?
Good question. The advantage of the current approach is that the
extra buffers _op, _htype and _hlen actually would not be used because a
single byte itself has no fragmentation or alignment issues. So no
copying needed, we should always get a pointer right into the
skb data/fragments.
On the other hand, a few copying instructions is probably less
overhead than traversing fragments multiple times. I'll change that.
[...]
> There seems to be a missing "*" in the line before the line "Caller needs to
> ensure that the skb network header"
ok
>
>
> Missing header in distributed-arp-table.c:
>
> * asm/unaligned.h
ok
>
> > --- a/net/batman-adv/distributed-arp-table.c
> > +++ b/net/batman-adv/distributed-arp-table.c
> [...]
> > @@ -42,9 +43,11 @@
> > #include <linux/spinlock.h>
> > #include <linux/stddef.h>
> > #include <linux/string.h>
> > +#include <linux/udp.h>
> > #include <linux/workqueue.h>
> > #include <net/arp.h>
> > #include <net/genetlink.h>
> > +#include <net/ip.h>
> > #include <net/netlink.h>
> > #include <net/sock.h>
> > #include <uapi/linux/batman_adv.h>
>
> And "net/ip.h" also doesn't seem to be used in distributed-arp-table.c
Right, not needed anymore after replacing ip_hdrlen(skb) with
iphdr->ihl * 4 in v7.
>
>
>
> But the biggest problem is that it doesn't build:
>
> /usr/bin/make -C /home/build_test/build_env/linux-build/linux-4.9.148 M=/home/build_test/build_env/tmp.9CjwRXIj4f PWD=/home/build_test/build_env/tmp.9CjwRXIj4f REVISION= CONFIG_BATMAN_ADV=m CONFIG_BATMAN_ADV_DEBUG=n CONFIG_BATMAN_ADV_DEBUGFS=y CONFIG_BATMAN_ADV_BLA=n CONFIG_BATMAN_ADV_DAT=n CONFIG_BATMAN_ADV_NC=y CONFIG_BATMAN_ADV_MCAST=y CONFIG_BATMAN_ADV_TRACING=y CONFIG_BATMAN_ADV_BATMAN_V=y INSTALL_MOD_DIR=updates/ modules
> [...]
> /home/build_test/build_env/tmp.9CjwRXIj4f/net/batman-adv/routing.c:1046:17: error: undefined identifier 'batadv_dat_snoop_incoming_dhcp_ack'
> /home/build_test/build_env/tmp.9CjwRXIj4f/net/batman-adv/routing.c:1283:9: error: undefined identifier 'batadv_dat_snoop_incoming_dhcp_ack'
> /home/build_test/build_env/tmp.9CjwRXIj4f/net/batman-adv/routing.c: In function ‘batadv_recv_unicast_packet’:
> /home/build_test/build_env/tmp.9CjwRXIj4f/net/batman-adv/routing.c:1046:3: error: implicit declaration of function ‘batadv_dat_snoop_incoming_dhcp_ack’ [-Werror=implicit-function-declaration]
> batadv_dat_snoop_incoming_dhcp_ack(bat_priv, skb, hdr_size);
>
> Looks like distributed-arp-table.h is missing a stub function for
> batadv_dat_snoop_incoming_dhcp_ack when CONFIG_BATMAN_ADV_DAT is not set.
ok
prev parent reply other threads:[~2018-12-30 14:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-29 3:10 [B.A.T.M.A.N.] [PATCH v7] batman-adv: Snoop DHCPACKs for DAT Linus Lüssing
2018-12-30 13:51 ` Sven Eckelmann
2018-12-30 14:51 ` Linus Lüssing [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=20181230145133.GA4150@otheros \
--to=linus.luessing@c0d3.blue \
--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 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.