63#ifndef LWIP_INLINE_IP_CHKSUM
64#define LWIP_INLINE_IP_CHKSUM 1
66#if LWIP_INLINE_IP_CHKSUM && CHECKSUM_GEN_IP
67#define CHECKSUM_GEN_IP_INLINE 1
69#define CHECKSUM_GEN_IP_INLINE 0
72#if LWIP_DHCP || defined(LWIP_IP_ACCEPT_UDP_PORT)
73#define IP_ACCEPT_LINK_LAYER_ADDRESSING 1
80#if LWIP_DHCP && defined(LWIP_IP_ACCEPT_UDP_PORT)
82#define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) (((port) == PP_NTOHS(DHCP_CLIENT_PORT)) \
83 || (LWIP_IP_ACCEPT_UDP_PORT(port)))
84#elif defined(LWIP_IP_ACCEPT_UDP_PORT)
86#define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) (LWIP_IP_ACCEPT_UDP_PORT(port))
89#define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) ((port) == PP_NTOHS(DHCP_CLIENT_PORT))
93#define IP_ACCEPT_LINK_LAYER_ADDRESSING 0
128#ifdef LWIP_HOOK_IP4_ROUTE
166ip_canforward(
struct pbuf *
p)
208 if (!ip_canforward(
p)) {
229#if !IP_FORWARD_ALLOW_TX_ON_RX_NETIF
311#if IP_ACCEPT_LINK_LAYER_ADDRESSING
319 iphdr = (
struct ip_hdr *)
p->payload;
330#ifdef LWIP_HOOK_IP4_INPUT
331 if (LWIP_HOOK_IP4_INPUT(
p, inp)) {
338 iphdr_hlen =
IPH_HL(iphdr);
345 if ((iphdr_hlen >
p->len) || (iphdr_len >
p->tot_len)) {
346 if (iphdr_hlen >
p->len) {
348 (
"IP header (len %"U16_F") does not fit in first pbuf (len %"U16_F"), IP packet dropped.\n",
349 iphdr_hlen,
p->len));
351 if (iphdr_len >
p->tot_len) {
353 (
"IP (len %"U16_F") is longer than pbuf (len %"U16_F"), IP packet dropped.\n",
354 iphdr_len,
p->tot_len));
369 (
"Checksum (0x%"X16_F") failed, IP packet dropped.\n",
inet_chksum(iphdr, iphdr_hlen)));
445#if IP_ACCEPT_LINK_LAYER_ADDRESSING
458 struct udp_hdr *
udphdr = (
struct udp_hdr *)((
u8_t *)iphdr + iphdr_hlen);
461 if (IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(
udphdr->dest)) {
471#if IP_ACCEPT_LINK_LAYER_ADDRESSING
517 iphdr = (
struct ip_hdr *)
p->payload;
530#if IP_OPTIONS_ALLOWED == 0
558 if (raw_input(
p, inp) == 0)
662#if CHECKSUM_GEN_IP_INLINE
676 u16_t optlen_aligned = 0;
678#if CHECKSUM_GEN_IP_INLINE
682 optlen_aligned = ((optlen + 3) & ~3);
683 ip_hlen += optlen_aligned;
691 MEMCPY(
p->payload, ip_options, optlen);
692 if (optlen < optlen_aligned) {
694 memset(((
char*)
p->payload) + optlen, 0, optlen_aligned - optlen);
696#if CHECKSUM_GEN_IP_INLINE
697 for (
i = 0;
i < optlen_aligned/2;
i++) {
698 chk_sum += ((
u16_t*)
p->payload)[
i];
712 iphdr = (
struct ip_hdr *)
p->payload;
713 LWIP_ASSERT(
"check that first pbuf can hold struct ip_hdr",
714 (
p->len >=
sizeof(
struct ip_hdr)));
718#if CHECKSUM_GEN_IP_INLINE
724#if CHECKSUM_GEN_IP_INLINE
731#if CHECKSUM_GEN_IP_INLINE
735#if CHECKSUM_GEN_IP_INLINE
736 chk_sum += iphdr->_len;
740#if CHECKSUM_GEN_IP_INLINE
741 chk_sum += iphdr->_id;
752#if CHECKSUM_GEN_IP_INLINE
755 chk_sum = (chk_sum >> 16) + (chk_sum & 0xFFFF);
756 chk_sum = (chk_sum >> 16) + chk_sum;
758 iphdr->_chksum = chk_sum;
767 iphdr = (
struct ip_hdr *)
p->payload;
837#if LWIP_NETIF_HWADDRHINT
#define LWIP_MAKE_U16(a, b)
static void ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
#define IPH_VHL_SET(hdr, v, hl)
#define IPH_LEN_SET(hdr, len)
#define IPH_ID_SET(hdr, id)
#define IPH_PROTO_SET(hdr, proto)
#define IPH_OFFSET_SET(hdr, off)
#define ip_debug_print(p)
#define ip_current_dest_addr()
#define IPH_TTL_SET(hdr, ttl)
#define IPH_CHKSUM_SET(hdr, chksum)
#define IPH_TOS_SET(hdr, tos)
#define LWIP_DBG_LEVEL_SERIOUS
#define LWIP_DEBUGF(debug, message)
#define LWIP_DBG_LEVEL_WARNING
#define LWIP_ASSERT(message, assertion)
#define snmp_inc_ipinhdrerrors()
#define snmp_inc_ipoutnoroutes()
#define snmp_inc_ipindelivers()
#define snmp_inc_ipindiscards()
#define snmp_inc_ipoutrequests()
#define snmp_inc_ipinaddrerrors()
#define snmp_inc_ipforwdatagrams()
#define snmp_inc_ipinunknownprotos()
#define snmp_inc_ipoutdiscards()
#define snmp_inc_ipinreceives()
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
u16_t inet_chksum(void *dataptr, u16_t len)
#define ip_addr_cmp(addr1, addr2)
#define ip_addr_isany(addr1)
#define ip4_addr1_16(ipaddr)
#define ip_addr_ismulticast(addr1)
#define ip_addr_netcmp(addr1, addr2, mask)
#define ip4_addr2_16(ipaddr)
#define ip_addr_islinklocal(addr1)
#define ip_addr_copy(dest, src)
typedefPACK_STRUCT_END struct ip_addr ip_addr_t
#define ip_addr_isbroadcast(ipaddr, netif)
#define ip_addr_set_any(ipaddr)
#define ip4_addr3_16(ipaddr)
#define IP_EXPERIMENTAL(a)
#define ip4_addr4_16(ipaddr)
#define ip4_addr_get_u32(src_ipaddr)
const struct ip_hdr * current_header
ip_addr_t current_iphdr_src
err_t ip_input(struct pbuf *p, struct netif *inp)
err_t ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif)
ip_addr_t current_iphdr_dest
struct netif * current_netif
err_t ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto)
struct netif * ip_route(ip_addr_t *dest)
#define MEMCPY(DST, SRC, BYTES)
struct netif * netif_list
struct netif * netif_default
#define netif_is_up(netif)
#define NETIF_SET_HWADDRHINT(netif, hint)
u8_t pbuf_header(struct pbuf *p, s16_t header_size_increment)
void pbuf_realloc(struct pbuf *p, u16_t new_len)
u8_t pbuf_free(struct pbuf *p)
#define PBUF_FLAG_LLBCAST
#define PBUF_FLAG_MCASTLOOP
#define PBUF_FLAG_LLMCAST