diff --git a/src/include/lwip/ip.h b/src/include/lwip/ip.h index 6d4fbe3b..e2b090e1 100644 --- a/src/include/lwip/ip.h +++ b/src/include/lwip/ip.h @@ -116,7 +116,7 @@ struct ip_globals #endif /* LWIP_IPV4 */ #if LWIP_IPV6 /** Header of the input IPv6 packet currently being processed. */ - const struct ip6_hdr *current_ip6_header; + struct ip6_hdr *current_ip6_header; #endif /* LWIP_IPV6 */ /** Total header length of current_ip4/6_header (i.e. after this, the UDP/TCP header starts) */ u16_t current_ip_header_tot_len; @@ -152,7 +152,7 @@ extern struct ip_globals ip_data; /** Get the IPv6 header of the current packet. * This function must only be called from a receive callback (udp_recv, * raw_recv, tcp_accept). It will return NULL otherwise. */ -#define ip6_current_header() ip_data.current_ip6_header +#define ip6_current_header() ((const struct ip6_hdr*)(ip_data.current_ip6_header)) /** Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4 */ #define ip_current_is_v6() (ip6_current_header() != NULL) /** Source IPv6 address of current_header */ @@ -194,13 +194,13 @@ extern struct ip_globals ip_data; /** Get the IPv6 header of the current packet. * This function must only be called from a receive callback (udp_recv, * raw_recv, tcp_accept). It will return NULL otherwise. */ -#define ip6_current_header() ip_data.current_ip6_header +#define ip6_current_header() ((const struct ip6_hdr*)(ip_data.current_ip6_header)) /** Always returns TRUE when only supporting IPv6 only */ #define ip_current_is_v6() 1 /** Get the transport layer protocol */ #define ip_current_header_proto() IP6H_NEXTH(ip6_current_header()) /** Get the transport layer header */ -#define ip_next_header_ptr() ((const void*)((const u8_t*)ip6_current_header())) +#define ip_next_header_ptr() ((const void*)(((const u8_t*)ip6_current_header()) + ip_current_header_tot_len())) /** Source IP6 address of current_header */ #define ip6_current_src_addr() (&ip_data.current_iphdr_src) /** Destination IP6 address of current_header */ diff --git a/src/include/lwip/ip6_frag.h b/src/include/lwip/ip6_frag.h index 1a666a8c..87e0e86a 100644 --- a/src/include/lwip/ip6_frag.h +++ b/src/include/lwip/ip6_frag.h @@ -90,7 +90,7 @@ extern "C" { struct ip6_reassdata { struct ip6_reassdata *next; struct pbuf *p; - const struct ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */ + struct ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */ #if IPV6_FRAG_COPYHEADER ip6_addr_p_t src; /* copy of the source address in the IP header */ ip6_addr_p_t dest; /* copy of the destination address in the IP header */