Microchip® Advanced Software Framework

icmp6.c File Reference

IPv6 version of ICMP, as per RFC 4443.

#include "lwip/opt.h"
#include "lwip/icmp6.h"
#include "lwip/ip6.h"
#include "lwip/ip6_addr.h"
#include "lwip/inet_chksum.h"
#include "lwip/pbuf.h"
#include "lwip/netif.h"
#include "lwip/nd6.h"
#include "lwip/mld6.h"
#include "lwip/ip.h"
#include "lwip/stats.h"
#include <string.h>

Functions

void icmp6_dest_unreach (struct pbuf *p, enum icmp6_dur_code c)
 Send an icmpv6 'destination unreachable' packet. More...
 
void icmp6_input (struct pbuf *p, struct netif *inp)
 Process an input ICMPv6 message. More...
 
void icmp6_packet_too_big (struct pbuf *p, u32_t mtu)
 Send an icmpv6 'packet too big' packet. More...
 
void icmp6_param_problem (struct pbuf *p, enum icmp6_pp_code c, u32_t pointer)
 Send an icmpv6 'parameter problem' packet. More...
 
static void icmp6_send_response (struct pbuf *p, u8_t code, u32_t data, u8_t type)
 Send an ICMPv6 packet in response to an incoming packet. More...
 
void icmp6_time_exceeded (struct pbuf *p, enum icmp6_te_code c)
 Send an icmpv6 'time exceeded' packet. More...
 

void icmp6_dest_unreach ( struct pbuf p,
enum icmp6_dur_code  c 
)

Send an icmpv6 'destination unreachable' packet.

Parameters
pthe input packet for which the 'unreachable' should be sent, p->payload pointing to the IPv6 header
cICMPv6 code for the unreachable type

References icmp6_send_response(), and ICMP6_TYPE_DUR.

void icmp6_input ( struct pbuf p,
struct netif inp 
)

Process an input ICMPv6 message.

Called by ip6_input.

Will generate a reply for echo requests. Other messages are forwarded to nd6_input, or mld6_input.

Parameters
pthe mld packet, p->payload pointing to the icmpv6 header
inpthe netif on which this packet was received

References ERR_OK, ICMP6_STATS_INC, ICMP6_TYPE_EREP, ICMP6_TYPE_EREQ, ICMP6_TYPE_MLD, ICMP6_TYPE_MLQ, ICMP6_TYPE_MLR, ICMP6_TYPE_NA, ICMP6_TYPE_NS, ICMP6_TYPE_PTB, ICMP6_TYPE_RA, ICMP6_TYPE_RD, ICMP6_TYPE_RS, if(), ip6_addr_ismulticast, ip6_chksum_pseudo(), ip6_current_dest_addr, ip6_current_src_addr, IP6_NEXTH_ICMP6, ip6_output_if(), ip6_select_source_address(), pbuf::len, mld6_input(), nd6_input(), NULL, pbuf::payload, pbuf_alloc(), pbuf_copy(), pbuf_free(), PBUF_IP, PBUF_RAM, and pbuf::tot_len.

Referenced by ip6_input().

void icmp6_packet_too_big ( struct pbuf p,
u32_t  mtu 
)

Send an icmpv6 'packet too big' packet.

Parameters
pthe input packet for which the 'packet too big' should be sent, p->payload pointing to the IPv6 header
mtuthe maximum mtu that we can accept

References icmp6_send_response(), and ICMP6_TYPE_PTB.

void icmp6_param_problem ( struct pbuf p,
enum icmp6_pp_code  c,
u32_t  pointer 
)

Send an icmpv6 'parameter problem' packet.

Parameters
pthe input packet for which the 'param problem' should be sent, p->payload pointing to the IP header
cICMPv6 code for the param problem type
pointerthe pointer to the byte where the parameter is found

References icmp6_send_response(), and ICMP6_TYPE_PP.

Referenced by ip6_input().

static void icmp6_send_response ( struct pbuf p,
u8_t  code,
u32_t  data,
u8_t  type 
)
static

Send an ICMPv6 packet in response to an incoming packet.

Parameters
pthe input packet for which the response should be sent, p->payload pointing to the IPv6 header
codeCode of the ICMPv6 header
dataAdditional 32-bit parameter in the ICMPv6 header
typeType of the ICMPv6 header

References ICMP6_STATS_INC, ICMP6_TE_FRAG, ICMP6_TYPE_TE, ICMP_DEBUG, ip6_addr_copy, ip6_chksum_pseudo(), ip6_current_src_addr, IP6_HLEN, IP6_NEXTH_ICMP6, ip6_output_if(), ip6_route(), ip6_select_source_address(), ip_current_netif, pbuf::len, LWIP_ASSERT, LWIP_DEBUGF, NULL, pbuf::payload, pbuf_alloc(), pbuf_free(), PBUF_IP, PBUF_RAM, and pbuf::tot_len.

Referenced by icmp6_dest_unreach(), icmp6_packet_too_big(), icmp6_param_problem(), and icmp6_time_exceeded().

void icmp6_time_exceeded ( struct pbuf p,
enum icmp6_te_code  c 
)

Send an icmpv6 'time exceeded' packet.

Parameters
pthe input packet for which the 'unreachable' should be sent, p->payload pointing to the IPv6 header
cICMPv6 code for the time exceeded type

References icmp6_send_response(), and ICMP6_TYPE_TE.

Referenced by ip6_reass_free_complete_datagram().