From 48802024f2ffaaa8699bcfe36374530307a9c6dd Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 5 Jul 2018 13:58:24 +0300 Subject: [PATCH] net: icmpv4: Set the ICMPv4 header correctly The code did not check if the icmpv4 header struct is already pointing to net_buf or not. This meant that the code did not set the ICMPv4 options and types correctly. Signed-off-by: Jukka Rissanen --- subsys/net/ip/icmpv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/ip/icmpv4.c b/subsys/net/ip/icmpv4.c index b60dbc825ae..26b9b4bf80c 100644 --- a/subsys/net/ip/icmpv4.c +++ b/subsys/net/ip/icmpv4.c @@ -34,7 +34,7 @@ struct net_icmp_hdr *net_icmpv4_set_hdr(struct net_pkt *pkt, u16_t pos; icmp_hdr = net_pkt_icmp_data(pkt); - if (net_icmp_header_fits(pkt, icmp_hdr)) { + if (net_icmp_header_fits(pkt, icmp_hdr) && (hdr == icmp_hdr)) { return icmp_hdr; }