mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-19 06:36:51 +08:00
bug #52937: raw_input() must tell ip4/6_input() if protocol has been received
This also moves "raw_input" and "raw_netif_ip_addr_changed" to a new file raw_priv.h
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/icmp.h"
|
||||
#include "lwip/igmp.h"
|
||||
#include "lwip/raw.h"
|
||||
#include "lwip/priv/raw_priv.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/priv/tcp_priv.h"
|
||||
#include "lwip/autoip.h"
|
||||
@@ -423,6 +423,9 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
#if IP_ACCEPT_LINK_LAYER_ADDRESSING || LWIP_IGMP
|
||||
int check_ip_src = 1;
|
||||
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING || LWIP_IGMP */
|
||||
#if LWIP_RAW
|
||||
raw_input_state_t raw_status;
|
||||
#endif /* LWIP_RAW */
|
||||
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
|
||||
@@ -675,7 +678,8 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
#if LWIP_RAW
|
||||
/* raw input did not eat the packet? */
|
||||
if (raw_input(p, inp) == 0)
|
||||
raw_status = raw_input(p, inp);
|
||||
if (raw_status != RAW_INPUT_EATEN)
|
||||
#endif /* LWIP_RAW */
|
||||
{
|
||||
pbuf_remove_header(p, iphdr_hlen); /* Move to payload, no check necessary. */
|
||||
@@ -708,21 +712,29 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
break;
|
||||
#endif /* LWIP_IGMP */
|
||||
default:
|
||||
#if LWIP_RAW
|
||||
if (raw_status == RAW_INPUT_DELIVERED) {
|
||||
MIB2_STATS_INC(mib2.ipindelivers);
|
||||
} else
|
||||
#endif /* LWIP_RAW */
|
||||
{
|
||||
#if LWIP_ICMP
|
||||
/* send ICMP destination protocol unreachable unless is was a broadcast */
|
||||
if (!ip4_addr_isbroadcast(ip4_current_dest_addr(), netif) &&
|
||||
!ip4_addr_ismulticast(ip4_current_dest_addr())) {
|
||||
pbuf_header_force(p, (s16_t)iphdr_hlen); /* Move to ip header, no check necessary. */
|
||||
icmp_dest_unreach(p, ICMP_DUR_PROTO);
|
||||
}
|
||||
/* send ICMP destination protocol unreachable unless is was a broadcast */
|
||||
if (!ip4_addr_isbroadcast(ip4_current_dest_addr(), netif) &&
|
||||
!ip4_addr_ismulticast(ip4_current_dest_addr())) {
|
||||
pbuf_header_force(p, (s16_t)iphdr_hlen); /* Move to ip header, no check necessary. */
|
||||
icmp_dest_unreach(p, ICMP_DUR_PROTO);
|
||||
}
|
||||
#endif /* LWIP_ICMP */
|
||||
|
||||
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("Unsupported transport protocol %"U16_F"\n", (u16_t)IPH_PROTO(iphdr)));
|
||||
|
||||
IP_STATS_INC(ip.proterr);
|
||||
IP_STATS_INC(ip.drop);
|
||||
MIB2_STATS_INC(mib2.ipinunknownprotos);
|
||||
}
|
||||
pbuf_free(p);
|
||||
|
||||
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("Unsupported transport protocol %"U16_F"\n", (u16_t)IPH_PROTO(iphdr)));
|
||||
|
||||
IP_STATS_INC(ip.proterr);
|
||||
IP_STATS_INC(ip.drop);
|
||||
MIB2_STATS_INC(mib2.ipinunknownprotos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user