[PATCH 305/368] Staging: batman-adv: avoid having the same error message more than once

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg KH
Date: Thursday, March 4, 2010 - 1:08 pm

From: Marek Lindner <lindner_marek@yahoo.de>

The routing code has 2 sections which warn about ttl exceeded. The
corresponding warnings were identical which makes it hard to debug. In
addition, batman-adv does not need to warn about ttl exceeded in case
we encountered an echo request as this is commonly used to generate
traceroute graphs.

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/batman-adv/routing.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c
index 09917e5..8abaa61 100644
--- a/drivers/staging/batman-adv/routing.c
+++ b/drivers/staging/batman-adv/routing.c
@@ -655,14 +655,15 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb)
 	unsigned long flags;
 	uint8_t dstaddr[ETH_ALEN];
 
-	icmp_packet = (struct icmp_packet *) skb->data;
-	ethhdr = (struct ethhdr *) skb_mac_header(skb);
-
-	printk(KERN_WARNING "batman-adv:Warning - can't send packet from %pM to %pM: ttl exceeded\n", icmp_packet->orig, icmp_packet->dst);
+	icmp_packet = (struct icmp_packet *)skb->data;
+	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* send TTL exceeded if packet is an echo request (traceroute) */
-	if (icmp_packet->msg_type != ECHO_REQUEST)
+	if (icmp_packet->msg_type != ECHO_REQUEST) {
+		printk(KERN_WARNING "batman-adv:Warning - can't forward icmp packet from %pM to %pM: ttl exceeded\n",
+			icmp_packet->orig, icmp_packet->dst);
 		return NET_RX_DROP;
+	}
 
 	/* get routing information */
 	spin_lock_irqsave(&orig_hash_lock, flags);
@@ -825,7 +826,8 @@ int recv_unicast_packet(struct sk_buff *skb)
 
 	/* TTL exceeded */
 	if (unicast_packet->ttl < 2) {
-		printk(KERN_WARNING "batman-adv:Warning - can't send packet from %pM to %pM: ttl exceeded\n", ethhdr->h_source, unicast_packet->dest);
+		printk(KERN_WARNING "batman-adv:Warning - can't forward unicast packet from %pM to %pM: ttl exceeded\n",
+		       ethhdr->h_source, unicast_packet->dest);
 		return NET_RX_DROP;
 	}
 
-- 
1.7.0.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 043/368] Staging: add dt3155 driver, Greg KH, (Thu Mar 4, 1:03 pm)
[PATCH 045/368] Staging: dt3155: add TODO file, Greg KH, (Thu Mar 4, 1:03 pm)
[GIT PATCH] STAGING patches for 2.6.33-git, Greg KH, (Thu Mar 4, 1:04 pm)
[PATCH 190/368] Staging: et131x: kill EXP_ROM, Greg KH, (Thu Mar 4, 1:06 pm)
[PATCH 222/368] Staging: otus: fix memory leak, Greg KH, (Thu Mar 4, 1:06 pm)
[PATCH 264/368] staging: dream: Codestyle fix, Greg KH, (Thu Mar 4, 1:07 pm)
[PATCH 305/368] Staging: batman-adv: avoid having the same ..., Greg KH, (Thu Mar 4, 1:08 pm)
Re: [PATCH 264/368] staging: dream: Codestyle fix, Pavel Machek, (Fri Mar 5, 12:08 am)