From patchwork Wed Jan 23 17:11:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 2750 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=5.9.180.86; helo=chaos.universe-factory.net; envelope-from=mschiffer@universe-factory.net; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from chaos.universe-factory.net (chaos.universe-factory.net [5.9.180.86]) by open-mesh.org (Postfix) with ESMTP id 0372F601B87 for ; Wed, 23 Jan 2013 18:19:32 +0100 (CET) Received: from avalon.wlan90.uni-luebeck.de (client002.wlan90.uni-luebeck.de [141.83.90.66]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by chaos.universe-factory.net (Postfix) with ESMTPSA id 3E220180FF2 for ; Wed, 23 Jan 2013 18:12:00 +0100 (CET) From: Matthias Schiffer To: b.a.t.m.a.n@lists.open-mesh.org Date: Wed, 23 Jan 2013 18:11:54 +0100 Message-Id: <4b41fb1f387acd24ecab6e4e47b2126b6dbddb5a.1358961079.git.mschiffer@universe-factory.net> X-Mailer: git-send-email 1.8.1.1 In-Reply-To: References: In-Reply-To: References: Subject: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: filter out invalid DAT entries X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2013 17:19:33 -0000 Due to duplicate address detection and other strange ARP packets, sometimes entries with broadcast MAC addresses or unspecified IP addresses would get into the Distributed ARP Table. This patch prevents these and some other kinds of invalid entries from getting into the DAT. Signed-off-by: Matthias Schiffer --- distributed-arp-table.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/distributed-arp-table.c b/distributed-arp-table.c index 9f4cff3..e28be57 100644 --- a/distributed-arp-table.c +++ b/distributed-arp-table.c @@ -274,6 +274,18 @@ static void batadv_dat_entry_add(struct batadv_priv *bat_priv, __be32 ip, struct batadv_dat_entry *dat_entry; int hash_added; + /* filter invalid MAC addresses that are sometimes used as + * destinations of ARP replies + */ + if (is_zero_ether_addr(mac_addr) || is_multicast_ether_addr(mac_addr)) + return; + + /* ARP requests with unspecified source address are used for + * duplicate address detection, we don't want those in the DAT either + */ + if (!ip) + return; + dat_entry = batadv_dat_entry_hash_find(bat_priv, ip); /* if this entry is already known, just update it */ if (dat_entry) {