diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index a9cf3b66..941031ee 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -83,7 +83,7 @@ icmp_input(struct pbuf *p, struct netif *inp) const struct ip_hdr *iphdr_in; struct ip_hdr *iphdr; s16_t hlen; - ip4_addr_t* src; + const ip4_addr_t* src; ICMP_STATS_INC(icmp.recv); MIB2_STATS_INC(mib2.icmpinmsgs); @@ -110,7 +110,7 @@ icmp_input(struct pbuf *p, struct netif *inp) if (ip_addr_ismulticast(ip_current_dest_addr())) { #if LWIP_MULTICAST_PING /* For multicast, use address of receiving interface as source address */ - src = &inp->ip_addr; + src = netif_ip4_addr(inp); #else /* LWIP_MULTICAST_PING */ LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: Not echoing to multicast pings\n")); goto icmperr; diff --git a/src/core/ipv6/icmp6.c b/src/core/ipv6/icmp6.c index d2c40f15..ecc4b520 100644 --- a/src/core/ipv6/icmp6.c +++ b/src/core/ipv6/icmp6.c @@ -81,7 +81,7 @@ icmp6_input(struct pbuf *p, struct netif *inp) { struct icmp6_hdr *icmp6hdr; struct pbuf * r; - ip6_addr_t * reply_src; + const ip6_addr_t * reply_src; ICMP6_STATS_INC(icmp6.recv); @@ -272,7 +272,8 @@ icmp6_send_response(struct pbuf *p, u8_t code, u32_t data, u8_t type) { struct pbuf *q; struct icmp6_hdr *icmp6hdr; - ip6_addr_t *reply_src, *reply_dest; + const ip6_addr_t *reply_src; + ip6_addr_t *reply_dest; ip6_addr_t reply_src_local, reply_dest_local; struct ip6_hdr *ip6hdr; struct netif *netif; diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index eca72cde..61971589 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -206,10 +206,10 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest) * @return the most suitable source address to use, or NULL if no suitable * source address is found */ -ip6_addr_t * +const ip6_addr_t * ip6_select_source_address(struct netif *netif, const ip6_addr_t * dest) { - ip6_addr_t * src = NULL; + const ip6_addr_t *src = NULL; u8_t i; /* If dest is link-local, choose a link-local source. */ diff --git a/src/include/lwip/ip6.h b/src/include/lwip/ip6.h index dcb3270a..012302ef 100644 --- a/src/include/lwip/ip6.h +++ b/src/include/lwip/ip6.h @@ -162,7 +162,7 @@ PACK_STRUCT_END struct netif *ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest); -ip6_addr_t *ip6_select_source_address(struct netif *netif, const ip6_addr_t * dest); +const ip6_addr_t *ip6_select_source_address(struct netif *netif, const ip6_addr_t * dest); err_t ip6_input(struct pbuf *p, struct netif *inp); err_t ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest, u8_t hl, u8_t tc, u8_t nexth);