mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-10 09:33:44 +08:00
tcp: add LWIP_HOOK_TCP_INPACKET_PCB
This hook is called from tcp_input() for all kinds of input pcbs when selected to receive a pbuf (LISTEN, TIME_WAIT, rest). I can parse or drop an rx pbuf. Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
@@ -61,6 +61,10 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef LWIP_HOOK_FILENAME
|
||||
#include LWIP_HOOK_FILENAME
|
||||
#endif
|
||||
|
||||
/** Initial CWND calculation as defined RFC 2581 */
|
||||
#define LWIP_TCP_CALC_INITIAL_CWND(mss) ((tcpwnd_size_t)LWIP_MIN((4U * (mss)), LWIP_MAX((2U * (mss)), 4380U)))
|
||||
|
||||
@@ -295,7 +299,13 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
of the list since we are not very likely to receive that
|
||||
many segments for connections in TIME-WAIT. */
|
||||
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for TIME_WAITing connection.\n"));
|
||||
tcp_timewait_input(pcb);
|
||||
#ifdef LWIP_HOOK_TCP_INPACKET_PCB
|
||||
if (LWIP_HOOK_TCP_INPACKET_PCB(pcb, tcphdr, tcphdr_optlen, tcphdr_opt1len,
|
||||
tcphdr_opt2, p) == ERR_OK)
|
||||
#endif
|
||||
{
|
||||
tcp_timewait_input(pcb);
|
||||
}
|
||||
pbuf_free(p);
|
||||
return;
|
||||
}
|
||||
@@ -361,7 +371,13 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
}
|
||||
|
||||
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n"));
|
||||
tcp_listen_input(lpcb);
|
||||
#ifdef LWIP_HOOK_TCP_INPACKET_PCB
|
||||
if (LWIP_HOOK_TCP_INPACKET_PCB((struct tcp_pcb *)lpcb, tcphdr, tcphdr_optlen,
|
||||
tcphdr_opt1len, tcphdr_opt2, p) == ERR_OK)
|
||||
#endif
|
||||
{
|
||||
tcp_listen_input(lpcb);
|
||||
}
|
||||
pbuf_free(p);
|
||||
return;
|
||||
}
|
||||
@@ -374,6 +390,13 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
#endif /* TCP_INPUT_DEBUG */
|
||||
|
||||
|
||||
#ifdef LWIP_HOOK_TCP_INPACKET_PCB
|
||||
if ((pcb != NULL) && LWIP_HOOK_TCP_INPACKET_PCB(pcb, tcphdr, tcphdr_optlen,
|
||||
tcphdr_opt1len, tcphdr_opt2, p) != ERR_OK) {
|
||||
pbuf_free(p);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (pcb != NULL) {
|
||||
/* The incoming segment belongs to a connection. */
|
||||
#if TCP_INPUT_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user