|
|
|
|
@ -56,6 +56,45 @@
|
|
|
|
|
#include "lwip/stats.h" |
|
|
|
|
#include "arch/perf.h" |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The interface that provided the packet for the current callback |
|
|
|
|
* invocation. |
|
|
|
|
*/ |
|
|
|
|
static struct netif *current_netif; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Header of the input packet currently being processed. |
|
|
|
|
*/ |
|
|
|
|
static const struct ip_hdr *current_header; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the interface that received the current packet. |
|
|
|
|
* |
|
|
|
|
* This function must only be called from a receive callback (udp_recv, |
|
|
|
|
* raw_recv, tcp_accept). It will return NULL otherwise. |
|
|
|
|
* |
|
|
|
|
* @param pcb Pointer to the pcb receiving a packet. |
|
|
|
|
*/ |
|
|
|
|
struct netif * |
|
|
|
|
ip_current_netif() |
|
|
|
|
{ |
|
|
|
|
return current_netif; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the IP 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. |
|
|
|
|
* |
|
|
|
|
* @param pcb Pointer to the pcb receiving a packet. |
|
|
|
|
*/ |
|
|
|
|
const struct ip_hdr * |
|
|
|
|
ip_current_header() |
|
|
|
|
{ |
|
|
|
|
return current_header; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Finds the appropriate network interface for a given IP address. It |
|
|
|
|
* searches the list of network interfaces linearly. A match is found |
|
|
|
|
@ -388,6 +427,9 @@ ip_input(struct pbuf *p, struct netif *inp)
|
|
|
|
|
ip_debug_print(p); |
|
|
|
|
LWIP_DEBUGF(IP_DEBUG, ("ip_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len)); |
|
|
|
|
|
|
|
|
|
current_netif = inp; |
|
|
|
|
current_header = iphdr; |
|
|
|
|
|
|
|
|
|
#if LWIP_RAW |
|
|
|
|
/* raw input did not eat the packet? */ |
|
|
|
|
if (raw_input(p, inp) == 0) |
|
|
|
|
@ -440,6 +482,9 @@ ip_input(struct pbuf *p, struct netif *inp)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
current_netif = NULL; |
|
|
|
|
current_header = NULL; |
|
|
|
|
|
|
|
|
|
return ERR_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|