[v4,6/6] batman-adv: only add recordroute information to icmp request/reply

Message ID 1366879046-24507-7-git-send-email-siwu@hrz.tu-chemnitz.de (mailing list archive)
State Accepted, archived
Headers

Commit Message

Simon Wunderlich April 25, 2013, 8:37 a.m. UTC
  Adding host information for record route is only required for ICMP
requests and replys, and should not be added to just any (future?)
packet type.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
 routing.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Marek Lindner April 27, 2013, 5:54 a.m. UTC | #1
On Thursday, April 25, 2013 16:37:26 Simon Wunderlich wrote:
> Adding host information for record route is only required for ICMP
> requests and replys, and should not be added to just any (future?)
> packet type.
> 
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
>  routing.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied in revision 208b49c.

Thanks,
Marek
  

Patch

diff --git a/routing.c b/routing.c
index 3f5802c..7c372f1 100644
--- a/routing.c
+++ b/routing.c
@@ -379,7 +379,9 @@  int batadv_recv_icmp_packet(struct sk_buff *skb,
 	icmp_packet = (struct batadv_icmp_packet_rr *)skb->data;
 
 	/* add record route information if not full */
-	if ((hdr_size == sizeof(struct batadv_icmp_packet_rr)) &&
+	if ((icmp_packet->msg_type == BATADV_ECHO_REPLY ||
+	     icmp_packet->msg_type == BATADV_ECHO_REQUEST) &&
+	    (hdr_size == sizeof(struct batadv_icmp_packet_rr)) &&
 	    (icmp_packet->rr_cur < BATADV_RR_LEN)) {
 		memcpy(&(icmp_packet->rr[icmp_packet->rr_cur]),
 		       ethhdr->h_dest, ETH_ALEN);