Microchip® Advanced Software Framework

ethip6.c File Reference

Ethernet output for IPv6.

Uses ND tables for link-layer addressing.

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

Data Structures

struct  eth_addr
 The ethernet address. More...
 
struct  eth_hdr
 Ethernet header. More...
 

Macros

#define ETHTYPE_IPV6   0x86DD
 
#define SIZEOF_ETH_HDR   (14 + ETH_PAD_SIZE)
 

Functions

err_t ethip6_output (struct netif *netif, struct pbuf *q, ip6_addr_t *ip6addr)
 Resolve and fill-in Ethernet address header for outgoing IPv6 packet. More...
 
static err_t ethip6_send (struct netif *netif, struct pbuf *p, struct eth_addr *src, struct eth_addr *dst)
 Send an IPv6 packet on the network using netif->linkoutput The ethernet header is filled in before sending. More...
 

Variables

PACK_STRUCT_BEGIN struct eth_addr PACK_STRUCT_STRUCT
 

#define ETHTYPE_IPV6   0x86DD

Referenced by ethernet_input(), and ethip6_send().

#define SIZEOF_ETH_HDR   (14 + ETH_PAD_SIZE)

err_t ethip6_output ( struct netif netif,
struct pbuf q,
ip6_addr_t ip6addr 
)

Resolve and fill-in Ethernet address header for outgoing IPv6 packet.

For IPv6 multicast, corresponding Ethernet addresses are selected and the packet is transmitted on the link.

For unicast addresses, ...

anycast addresses

Parameters
netifThe lwIP network interface which the IP packet will be sent on.
qThe pbuf(s) containing the IP packet to be sent.
ip6addrThe IP address of the packet destination.
Returns

References nd6_neighbor_cache_entry::counter, nd6_neighbor_cache_entry::delay_time, ERR_BUF, ERR_MEM, ETHARP_DEBUG, ethip6_send(), netif::hwaddr, ip6_addr_ismulticast, nd6_neighbor_cache_entry::lladdr, LWIP_DBG_LEVEL_SERIOUS, LWIP_DBG_TRACE, LWIP_DEBUGF, ND6_DELAY, nd6_get_next_hop_entry(), ND6_PROBE, nd6_queue_packet(), ND6_REACHABLE, ND6_STALE, neighbor_cache, pbuf_header(), SIZEOF_ETH_HDR, and nd6_neighbor_cache_entry::state.

Referenced by winc_netif_init().

static err_t ethip6_send ( struct netif netif,
struct pbuf p,
struct eth_addr src,
struct eth_addr dst 
)
static

Send an IPv6 packet on the network using netif->linkoutput The ethernet header is filled in before sending.

netif the lwIP network interface on which to send the packet p the packet to send, p->payload pointing to the (uninitialized) ethernet header src the source MAC address to be copied into the ethernet header dst the destination MAC address to be copied into the ethernet header

Returns
ERR_OK if the packet was sent, any other err_t on failure

References ETHARP_DEBUG, ETHTYPE_IPV6, netif::hwaddr_len, netif::linkoutput, LWIP_ASSERT, LWIP_DBG_TRACE, LWIP_DEBUGF, pbuf::payload, and PP_HTONS.

Referenced by ethip6_output().

PACK_STRUCT_END PACK_STRUCT_BEGIN struct eth_hdr PACK_STRUCT_STRUCT