[v2,1/2] batman-adv: check for more types of invalid IP addresses in DAT

Message ID a6ad84c212e89c411dab6b40ac613a61c8b9621c.1359047612.git.mschiffer@universe-factory.net (mailing list archive)
State Accepted, archived
Headers

Commit Message

Matthias Schiffer Jan. 24, 2013, 5:18 p.m. UTC
  There are more types of IP addresses that may appear in ARP packets that we
don't want to process. While some of these should never appear in sane ARP
packets, a 0.0.0.0 source is used for duplicate address detection and thus seen
quite often.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
---
 distributed-arp-table.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Antonio Quartulli Jan. 25, 2013, 1:27 p.m. UTC | #1
On Thu, Jan 24, 2013 at 06:18:26PM +0100, Matthias Schiffer wrote:
> There are more types of IP addresses that may appear in ARP packets that we
> don't want to process. While some of these should never appear in sane ARP
> packets, a 0.0.0.0 source is used for duplicate address detection and thus seen
> quite often.
> 
> Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>

Acked-by: Antonio Quartulli <ordex@autistici.org>


Please merge into maint.

Cheers,
  
Marek Lindner Jan. 27, 2013, 12:34 a.m. UTC | #2
On Friday, January 25, 2013 21:27:07 Antonio Quartulli wrote:
>   On Thu, Jan 24, 2013 at 06:18:26PM +0100, Matthias Schiffer wrote:
> > There are more types of IP addresses that may appear in ARP packets that
> > we don't want to process. While some of these should never appear in
> > sane ARP packets, a 0.0.0.0 source is used for duplicate address
> > detection and thus seen quite often.
> >
> > Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
> 
> Acked-by: Antonio Quartulli <ordex@autistici.org>

Applied in revision 3b24193.

Thanks,
Marek
  
Marek Lindner Jan. 27, 2013, 12:38 a.m. UTC | #3
On Friday, January 25, 2013 21:28:49 Antonio Quartulli wrote:
> On Thu, Jan 24, 2013 at 06:18:27PM +0100, Matthias Schiffer wrote:
> > We never want multicast MAC addresses in the Distributed ARP Table, so
> > it's best to completely ignore ARP packets containing them where we
> > expect unicast addresses.
> >
> > Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
> 
> Acked-by: Antonio Quartulli <ordex@autistici.org>

Applied in revision ab361a9.

Thanks,
Marek
  

Patch

diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index 9f4cff3..a35466a 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -777,7 +777,9 @@  static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv,
 	ip_src = batadv_arp_ip_src(skb, hdr_size);
 	ip_dst = batadv_arp_ip_dst(skb, hdr_size);
 	if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) ||
-	    ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst))
+	    ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) ||
+	    ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) ||
+	    ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst))
 		goto out;
 
 	type = ntohs(arphdr->ar_op);