fixed bug #36403 "ip4_input() and ip6_input() always pass inp to higher layers": now the accepting netif is passed up, but the input netif is available through ip_current_input_netif() if required.

This commit is contained in:
sg
2015-02-12 22:04:10 +01:00
parent 81d4e201bb
commit 80b62df0a9
4 changed files with 18 additions and 3 deletions

View File

@@ -116,8 +116,10 @@ struct ip_pcb {
/* Global variables of this module, kept in a struct for efficient access using base+index. */
struct ip_globals
{
/** The interface that provided the packet for the current callback invocation. */
/** The interface that accepted the packet for the current callback invocation. */
struct netif *current_netif;
/** The interface that received the packet for the current callback invocation. */
struct netif *current_input_netif;
/** Header of the input packet currently being processed. */
const struct ip_hdr *current_ip4_header;
#if LWIP_IPV6
@@ -134,10 +136,15 @@ struct ip_globals
extern struct ip_globals ip_data;
/** Get the interface that received the current packet.
/** Get the interface that accepted the current packet.
* This may or may not be the receiving netif, depending on your netif/network setup.
* This function must only be called from a receive callback (udp_recv,
* raw_recv, tcp_accept). It will return NULL otherwise. */
#define ip_current_netif() (ip_data.current_netif)
/** 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. */
#define ip_current_input_netif() (ip_data.current_input_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. */