batman-adv: only add recordroute information to icmp request/reply
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Thu, 25 Apr 2013 08:37:26 +0000 (10:37 +0200)
committerAntonio Quartulli <antonio@meshcoding.com>
Sat, 12 Oct 2013 07:51:26 +0000 (09:51 +0200)
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>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
net/batman-adv/routing.c

index 457dfef9c5fcac4d7fc92d74e22c77054579c8bc..0dc1c0e84451bf74f4090b974d0251f561f355d6 100644 (file)
@@ -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);