From e5627ec64934e016d4c701b1cc4600d1b07e7eab Mon Sep 17 00:00:00 2001 From: Oliver Hitz Date: Tue, 27 Oct 2020 11:02:02 +0100 Subject: [PATCH] tcp: make tcp_listen() inherit the netbuf_idx of the original pcb This simple patch causes tcp_listen() to inherit the netbuf_idx setting of the original pcb. Without this, it is not possible to restrict a socket to a specific interface using SO_BINDTODEVICE before listening. Signed-off-by: Simon Goldschmidt --- src/core/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index 11a51dac..371db2b6 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -890,7 +890,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) lpcb->state = LISTEN; lpcb->prio = pcb->prio; lpcb->so_options = pcb->so_options; - lpcb->netif_idx = NETIF_NO_INDEX; + lpcb->netif_idx = pcb->netif_idx; lpcb->ttl = pcb->ttl; lpcb->tos = pcb->tos; #if LWIP_IPV4 && LWIP_IPV6