bug #33634 ip_forward() have a faulty behaviour: Added pbuf flags to mark incoming packets as link-layer broadcast/multicast. Also added code to allow ip_forward() to forward non-broadcast packets to the input netif (set IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1).

This commit is contained in:
Simon Goldschmidt
2011-07-21 21:47:25 +02:00
parent 860072aaaf
commit 78ac382fdf
5 changed files with 127 additions and 4 deletions

View File

@@ -593,6 +593,17 @@
#define IP_SOF_BROADCAST_RECV 0
#endif
/**
* IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1: allow ip_forward() to send packets back
* out on the netif where it was received. This should only be used for
* wireless networks.
* ATTENTION: When this is 1, make sure your netif driver correctly marks incoming
* link-layer-broadcast/multicast packets as such using the corresponding pbuf flags!
*/
#ifndef IP_FORWARD_ALLOW_TX_ON_RX_NETIF
#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
#endif
/*
----------------------------------
---------- ICMP options ----------
@@ -2056,6 +2067,34 @@
#define LWIP_IPV6_DHCP6 0
#endif
/*
---------------------------------------
---------- Hook options ---------------
---------------------------------------
*/
/* Hooks are undefined by default, define them to a function if you need them. */
/**
* LWIP_HOOK_IP4_INPUT(pbuf, input_netif):
* - called from ip_input() (IPv4)
* - pbuf: received struct pbuf passed to ip_input()
* - input_netif: struct netif on which the packet has been received
* Return values:
* - 0: Hook has not consumed the packet, packet is processed as normal
* - != 0: Hook has consumed the packet.
* If the hook consumed the packet, 'pbuf' is in the responsibility of the hook
* (i.e. free it when done).
*/
/**
* LWIP_HOOK_IP4_ROUTE(dest):
* - called from ip_route() (IPv4)
* - dest: destination IPv4 address
* Returns the destination netif or NULL if no destination netif is found. In
* that case, ip_route() continues as normal.
*/
/*
---------------------------------------
---------- Debugging options ----------

View File

@@ -76,6 +76,10 @@ typedef enum {
#define PBUF_FLAG_IS_CUSTOM 0x02U
/** indicates this pbuf is UDP multicast to be looped back */
#define PBUF_FLAG_MCASTLOOP 0x04U
/** indicates this pbuf was received as link-level broadcast */
#define PBUF_FLAG_LLBCAST 0x08U
/** indicates this pbuf was received as link-level multicast */
#define PBUF_FLAG_LLMCAST 0x10U
struct pbuf {
/** next pbuf in singly linked pbuf chain */