!824 [sync] PR-817: update lwip to 2.2.0
From: @openeuler-sync-bot Reviewed-by: @jiangheng12 Signed-off-by: @jiangheng12
This commit is contained in:
commit
bb4853f62c
File diff suppressed because it is too large
Load Diff
@ -8,12 +8,12 @@ Subject: [PATCH] [Huawei]gazelle: fix lwip_accept memcpy sockaddr larger than
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index eccc7f9..e640945 100644
|
||||
index 7ccac78..1c3d4a3 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -860,6 +860,8 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
if (*addrlen > tempaddr.sa.sa_len) {
|
||||
*addrlen = tempaddr.sa.sa_len;
|
||||
@@ -899,6 +899,8 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
if (*addrlen > IPADDR_SOCKADDR_GET_LEN(&tempaddr)) {
|
||||
*addrlen = IPADDR_SOCKADDR_GET_LEN(&tempaddr);
|
||||
}
|
||||
+#else
|
||||
+ *addrlen = LWIP_MIN(*addrlen, sizeof(tempaddr));
|
||||
|
||||
@ -9,21 +9,21 @@ Subject: [PATCH] fix stack-buffer-overflow in lwip_sock_make_addr and
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index e640945..7ce9378 100644
|
||||
index 1c3d4a3..3a8a74c 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -1319,6 +1319,8 @@ lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port,
|
||||
} else if (*fromlen > saddr.sa.sa_len) {
|
||||
*fromlen = saddr.sa.sa_len;
|
||||
@@ -1323,6 +1323,8 @@ lwip_recv_tcp_done:
|
||||
add_epoll_event(sock->conn, EPOLLIN);
|
||||
}
|
||||
}
|
||||
+#else
|
||||
+ *fromlen = LWIP_MIN(*fromlen, sizeof(saddr));
|
||||
#endif
|
||||
MEMCPY(from, &saddr, *fromlen);
|
||||
return truncated;
|
||||
@@ -3133,6 +3135,8 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
|
||||
if (*namelen > saddr.sa.sa_len) {
|
||||
*namelen = saddr.sa.sa_len;
|
||||
set_errno(0);
|
||||
return recvd;
|
||||
@@ -3179,6 +3181,8 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
|
||||
if (*namelen > IPADDR_SOCKADDR_GET_LEN(&saddr)) {
|
||||
*namelen = IPADDR_SOCKADDR_GET_LEN(&saddr);
|
||||
}
|
||||
+#else
|
||||
+ *namelen = LWIP_MIN(*namelen, sizeof(saddr));
|
||||
|
||||
@ -18,10 +18,10 @@ Subject: [PATCH] lstack support mysql mode
|
||||
11 files changed, 85 insertions(+), 370 deletions(-)
|
||||
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index d5a738f..3072dd9 100644
|
||||
index d8d6339..0f3a5b6 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -342,6 +342,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
@@ -345,6 +345,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
#endif /* LWIP_SO_RCVBUF */
|
||||
/* Register event with callback */
|
||||
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
|
||||
@ -34,7 +34,7 @@ index d5a738f..3072dd9 100644
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
@@ -457,14 +463,6 @@ err_tcp(void *arg, err_t err)
|
||||
@@ -460,14 +466,6 @@ err_tcp(void *arg, err_t err)
|
||||
old_state = conn->state;
|
||||
conn->state = NETCONN_NONE;
|
||||
|
||||
@ -49,7 +49,7 @@ index d5a738f..3072dd9 100644
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
|
||||
/* Notify the user layer about a connection error. Used to signal select. */
|
||||
@@ -479,6 +477,12 @@ err_tcp(void *arg, err_t err)
|
||||
@@ -482,6 +480,12 @@ err_tcp(void *arg, err_t err)
|
||||
if (NETCONN_MBOX_VALID(conn, &conn->recvmbox)) {
|
||||
/* use trypost to prevent deadlock */
|
||||
sys_mbox_trypost(&conn->recvmbox, mbox_msg);
|
||||
@ -62,7 +62,7 @@ index d5a738f..3072dd9 100644
|
||||
}
|
||||
/* pass error message to acceptmbox to wake up pending accept */
|
||||
if (NETCONN_MBOX_VALID(conn, &conn->acceptmbox)) {
|
||||
@@ -1344,11 +1348,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
@@ -1345,11 +1349,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
int s = conn->socket;
|
||||
struct lwip_sock *sock = get_socket_without_errno(s);
|
||||
|
||||
@ -94,12 +94,12 @@ index a917cea..eff9f46 100644
|
||||
|
||||
err_out:
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index f44c34f..b032ce9 100644
|
||||
index 31dd51c..fe19d7d 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -90,14 +90,6 @@
|
||||
#define API_SELECT_CB_VAR_ALLOC(name, retblock) API_VAR_ALLOC_EXT(struct lwip_select_cb, MEMP_SELECT_CB, name, retblock)
|
||||
#define API_SELECT_CB_VAR_FREE(name) API_VAR_FREE(MEMP_SELECT_CB, name)
|
||||
@@ -69,14 +69,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
-#if USE_LIBOS
|
||||
-enum KERNEL_LWIP_PATH {
|
||||
@ -109,10 +109,10 @@ index f44c34f..b032ce9 100644
|
||||
-};
|
||||
-#endif
|
||||
-
|
||||
#if LWIP_IPV4
|
||||
#if USE_LIBOS
|
||||
#define IP4ADDR_PORT_TO_SOCKADDR(sin, ipaddr, port) do { \
|
||||
@@ -604,8 +596,6 @@ alloc_socket(struct netconn *newconn, int accepted)
|
||||
#ifdef LWIP_HOOK_FILENAME
|
||||
#include LWIP_HOOK_FILENAME
|
||||
#endif
|
||||
@@ -644,8 +636,6 @@ alloc_socket(struct netconn *newconn, int accepted)
|
||||
* (unless it has been created by accept()). */
|
||||
sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1);
|
||||
sockets[i].errevent = 0;
|
||||
@ -121,7 +121,7 @@ index f44c34f..b032ce9 100644
|
||||
return i + LWIP_SOCKET_OFFSET;
|
||||
}
|
||||
|
||||
@@ -714,13 +704,6 @@ free_socket(struct lwip_sock *sock, int is_tcp)
|
||||
@@ -754,13 +744,6 @@ free_socket(struct lwip_sock *sock, int is_tcp)
|
||||
/* Protect socket array */
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
|
||||
@ -135,7 +135,7 @@ index f44c34f..b032ce9 100644
|
||||
freed = free_socket_locked(sock, is_tcp, &conn, &lastdata);
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
/* don't use 'sock' after this line, as another task might have allocated it */
|
||||
@@ -749,34 +732,11 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
@@ -789,34 +772,10 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
|
||||
@ -162,7 +162,6 @@ index f44c34f..b032ce9 100644
|
||||
- }
|
||||
- sys_errno = errno;
|
||||
-#else
|
||||
+
|
||||
sock = get_socket(s);
|
||||
if (!sock) {
|
||||
return -1;
|
||||
@ -171,8 +170,8 @@ index f44c34f..b032ce9 100644
|
||||
|
||||
/* wait for a new connection */
|
||||
err = netconn_accept(sock->conn, &newconn);
|
||||
@@ -790,9 +750,6 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
sock_set_errno(sock, err_to_errno(err));
|
||||
@@ -830,9 +789,6 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
set_errno(err_to_errno(err));
|
||||
}
|
||||
done_socket(sock);
|
||||
-#if USE_LIBOS
|
||||
@ -181,7 +180,7 @@ index f44c34f..b032ce9 100644
|
||||
return -1;
|
||||
}
|
||||
LWIP_ASSERT("newconn != NULL", newconn != NULL);
|
||||
@@ -875,24 +832,11 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
@@ -915,24 +871,10 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
ip_addr_t local_addr;
|
||||
u16_t local_port;
|
||||
err_t err;
|
||||
@ -198,7 +197,6 @@ index f44c34f..b032ce9 100644
|
||||
- return -1;
|
||||
- }
|
||||
-#else
|
||||
+
|
||||
sock = get_socket(s);
|
||||
if (!sock) {
|
||||
return -1;
|
||||
@ -207,7 +205,7 @@ index f44c34f..b032ce9 100644
|
||||
|
||||
if (!SOCK_ADDR_TYPE_MATCH(name, sock)) {
|
||||
/* sockaddr does not match socket type (IPv4/IPv6) */
|
||||
@@ -912,18 +856,6 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
@@ -952,18 +894,6 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
ip_addr_debug_print_val(SOCKETS_DEBUG, local_addr);
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", local_port));
|
||||
|
||||
@ -226,14 +224,14 @@ index f44c34f..b032ce9 100644
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
/* Dual-stack: Unmap IPv4 mapped IPv6 addresses */
|
||||
if (IP_IS_V6_VAL(local_addr) && ip6_addr_isipv4mappedipv6(ip_2_ip6(&local_addr))) {
|
||||
@@ -953,32 +885,13 @@ lwip_close(int s)
|
||||
@@ -993,32 +923,12 @@ lwip_close(int s)
|
||||
struct lwip_sock *sock;
|
||||
int is_tcp = 0;
|
||||
err_t err;
|
||||
- int ret = 0;
|
||||
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s));
|
||||
|
||||
-
|
||||
-#if USE_LIBOS
|
||||
- if (posix_api->is_epfd(s)) {
|
||||
- return posix_api->epoll_close_fn(s);
|
||||
@ -259,7 +257,7 @@ index f44c34f..b032ce9 100644
|
||||
|
||||
if (sock->conn != NULL) {
|
||||
is_tcp = NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP;
|
||||
@@ -1004,7 +917,7 @@ lwip_close(int s)
|
||||
@@ -1044,7 +954,7 @@ lwip_close(int s)
|
||||
|
||||
free_socket(sock, is_tcp);
|
||||
set_errno(0);
|
||||
@ -268,7 +266,7 @@ index f44c34f..b032ce9 100644
|
||||
}
|
||||
|
||||
int
|
||||
@@ -1013,28 +926,10 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
@@ -1053,28 +963,10 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
struct lwip_sock *sock;
|
||||
err_t err;
|
||||
|
||||
@ -297,7 +295,7 @@ index f44c34f..b032ce9 100644
|
||||
|
||||
if (!SOCK_ADDR_TYPE_MATCH_OR_UNSPEC(name, sock)) {
|
||||
/* sockaddr does not match socket type (IPv4/IPv6) */
|
||||
@@ -1106,29 +1001,10 @@ lwip_listen(int s, int backlog)
|
||||
@@ -1146,29 +1038,10 @@ lwip_listen(int s, int backlog)
|
||||
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d, backlog=%d)\n", s, backlog));
|
||||
|
||||
@ -327,7 +325,7 @@ index f44c34f..b032ce9 100644
|
||||
|
||||
/* limit the "backlog" parameter to fit in an u8_t */
|
||||
backlog = LWIP_MIN(LWIP_MAX(backlog, 0), 0xff);
|
||||
@@ -1160,11 +1036,12 @@ static ssize_t
|
||||
@@ -1200,11 +1073,12 @@ static ssize_t
|
||||
lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
{
|
||||
u8_t apiflags = NETCONN_NOAUTORCVD;
|
||||
@ -342,7 +340,7 @@ index f44c34f..b032ce9 100644
|
||||
|
||||
LWIP_ASSERT("no socket given", sock != NULL);
|
||||
LWIP_ASSERT("this should be checked internally", NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP);
|
||||
@@ -1173,6 +1050,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
@@ -1213,6 +1087,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
apiflags |= NETCONN_DONTBLOCK;
|
||||
}
|
||||
|
||||
@ -350,7 +348,7 @@ index f44c34f..b032ce9 100644
|
||||
do {
|
||||
struct pbuf *p;
|
||||
err_t err;
|
||||
@@ -1182,13 +1060,6 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
@@ -1222,13 +1097,6 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
/* Check if there is data left from the last recv operation. */
|
||||
if (sock->lastdata.pbuf) {
|
||||
p = sock->lastdata.pbuf;
|
||||
@ -364,11 +362,9 @@ index f44c34f..b032ce9 100644
|
||||
} else {
|
||||
/* No data was left from the previous operation, so we try to get
|
||||
some from the network. */
|
||||
@@ -1258,23 +1129,21 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
apiflags |= NETCONN_DONTBLOCK | NETCONN_NOFIN;
|
||||
@@ -1299,24 +1167,18 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
/* @todo: do we need to support peeking more than one pbuf? */
|
||||
} while ((recv_left > 0) && !(flags & MSG_PEEK));
|
||||
+
|
||||
lwip_recv_tcp_done:
|
||||
-#if USE_LIBOS
|
||||
- if (apiflags & NETCONN_NOAUTORCVD)
|
||||
@ -392,12 +388,13 @@ index f44c34f..b032ce9 100644
|
||||
- add_epoll_event(sock->conn, EPOLLIN);
|
||||
- }
|
||||
- }
|
||||
-#else
|
||||
- *fromlen = LWIP_MIN(*fromlen, sizeof(saddr));
|
||||
-#endif
|
||||
+
|
||||
sock_set_errno(sock, 0);
|
||||
set_errno(0);
|
||||
return recvd;
|
||||
}
|
||||
@@ -1461,37 +1330,6 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
@@ -1501,37 +1363,6 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@ -435,7 +432,7 @@ index f44c34f..b032ce9 100644
|
||||
ssize_t
|
||||
lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
struct sockaddr *from, socklen_t *fromlen)
|
||||
@@ -1499,15 +1337,6 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
@@ -1539,15 +1370,6 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
struct lwip_sock *sock;
|
||||
ssize_t ret;
|
||||
|
||||
@ -451,7 +448,7 @@ index f44c34f..b032ce9 100644
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d, %p, %"SZT_F", 0x%x, ..)\n", s, mem, len, flags));
|
||||
sock = get_socket(s);
|
||||
if (!sock) {
|
||||
@@ -1557,14 +1386,6 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
@@ -1597,14 +1419,6 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
ssize_t
|
||||
lwip_read(int s, void *mem, size_t len)
|
||||
{
|
||||
@ -466,8 +463,8 @@ index f44c34f..b032ce9 100644
|
||||
return lwip_recvfrom(s, mem, len, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -1598,15 +1419,6 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
|
||||
int i;
|
||||
@@ -1638,15 +1452,6 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
|
||||
msg_iovlen_t i;
|
||||
ssize_t buflen;
|
||||
|
||||
-#if USE_LIBOS
|
||||
@ -482,7 +479,7 @@ index f44c34f..b032ce9 100644
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvmsg(%d, message=%p, flags=0x%x)\n", s, (void *)message, flags));
|
||||
LWIP_ERROR("lwip_recvmsg: invalid message pointer", message != NULL, return ERR_ARG;);
|
||||
LWIP_ERROR("lwip_recvmsg: unsupported flags", (flags & ~(MSG_PEEK|MSG_DONTWAIT)) == 0,
|
||||
@@ -1751,15 +1563,6 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
||||
@@ -1791,15 +1596,6 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
||||
#endif
|
||||
err_t err = ERR_OK;
|
||||
|
||||
@ -498,7 +495,7 @@ index f44c34f..b032ce9 100644
|
||||
sock = get_socket(s);
|
||||
if (!sock) {
|
||||
return -1;
|
||||
@@ -1923,15 +1726,6 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
|
||||
@@ -1963,15 +1759,6 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
|
||||
u16_t remote_port;
|
||||
struct netbuf buf;
|
||||
|
||||
@ -514,7 +511,7 @@ index f44c34f..b032ce9 100644
|
||||
sock = get_socket(s);
|
||||
if (!sock) {
|
||||
return -1;
|
||||
@@ -2030,11 +1824,6 @@ lwip_socket(int domain, int type, int protocol)
|
||||
@@ -2070,11 +1857,6 @@ lwip_socket(int domain, int type, int protocol)
|
||||
|
||||
LWIP_UNUSED_ARG(domain); /* @todo: check this */
|
||||
|
||||
@ -526,7 +523,7 @@ index f44c34f..b032ce9 100644
|
||||
/* create a netconn */
|
||||
switch (type) {
|
||||
case SOCK_RAW:
|
||||
@@ -2091,14 +1880,6 @@ lwip_socket(int domain, int type, int protocol)
|
||||
@@ -2131,14 +1913,6 @@ lwip_socket(int domain, int type, int protocol)
|
||||
ssize_t
|
||||
lwip_write(int s, const void *data, size_t size)
|
||||
{
|
||||
@ -541,7 +538,7 @@ index f44c34f..b032ce9 100644
|
||||
return lwip_send(s, data, size, 0);
|
||||
}
|
||||
|
||||
@@ -2884,20 +2665,16 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
@@ -2924,20 +2698,16 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
check_waiters = 0;
|
||||
}
|
||||
#if USE_LIBOS
|
||||
@ -566,7 +563,7 @@ index f44c34f..b032ce9 100644
|
||||
break;
|
||||
case NETCONN_EVT_SENDPLUS:
|
||||
if (sock->sendevent) {
|
||||
@@ -2905,27 +2682,16 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
@@ -2945,27 +2715,16 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
}
|
||||
sock->sendevent = 1;
|
||||
#if USE_LIBOS
|
||||
@ -594,7 +591,7 @@ index f44c34f..b032ce9 100644
|
||||
add_epoll_event(conn, EPOLLERR);
|
||||
#endif
|
||||
break;
|
||||
@@ -3139,41 +2905,12 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
|
||||
@@ -3179,41 +2938,12 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
|
||||
int
|
||||
lwip_getpeername(int s, struct sockaddr *name, socklen_t *namelen)
|
||||
{
|
||||
@ -636,7 +633,7 @@ index f44c34f..b032ce9 100644
|
||||
return lwip_getaddrname(s, name, namelen, 1);
|
||||
}
|
||||
|
||||
@@ -3186,23 +2923,11 @@ lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
|
||||
@@ -3226,23 +2956,11 @@ lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
|
||||
LWIP_SETGETSOCKOPT_DATA_VAR_DECLARE(data);
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
@ -659,8 +656,8 @@ index f44c34f..b032ce9 100644
|
||||
-#endif /* USE_LIBOS */
|
||||
|
||||
if ((NULL == optval) || (NULL == optlen)) {
|
||||
sock_set_errno(sock, EFAULT);
|
||||
@@ -3645,25 +3370,11 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
|
||||
set_errno(EFAULT);
|
||||
@@ -3685,25 +3403,11 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
|
||||
LWIP_SETGETSOCKOPT_DATA_VAR_DECLARE(data);
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
@ -685,8 +682,8 @@ index f44c34f..b032ce9 100644
|
||||
-#endif /* USE_LIBOS */
|
||||
|
||||
if (NULL == optval) {
|
||||
sock_set_errno(sock, EFAULT);
|
||||
@@ -4308,26 +4019,6 @@ lwip_ioctl(int s, long cmd, void *argp)
|
||||
set_errno(EFAULT);
|
||||
@@ -4348,26 +4052,6 @@ lwip_ioctl(int s, long cmd, void *argp)
|
||||
* the flag O_NONBLOCK is implemented for F_SETFL.
|
||||
*/
|
||||
int
|
||||
@ -713,7 +710,7 @@ index f44c34f..b032ce9 100644
|
||||
lwip_fcntl(int s, int cmd, int val)
|
||||
{
|
||||
struct lwip_sock *sock = get_socket(s);
|
||||
@@ -4337,7 +4028,6 @@ lwip_fcntl(int s, int cmd, int val)
|
||||
@@ -4377,7 +4061,6 @@ lwip_fcntl(int s, int cmd, int val)
|
||||
if (!sock) {
|
||||
return -1;
|
||||
}
|
||||
@ -752,10 +749,10 @@ index 55561b1..9a92143 100644
|
||||
|
||||
uint32_t sys_now(void)
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index dac498e..b99974d 100644
|
||||
index 74b22b0..1164c56 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -472,6 +472,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -475,6 +475,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
* pos records progress as data is segmented.
|
||||
*/
|
||||
|
||||
@ -763,7 +760,7 @@ index dac498e..b99974d 100644
|
||||
/* Find the tail of the unsent queue. */
|
||||
if (pcb->unsent != NULL) {
|
||||
u16_t space;
|
||||
@@ -587,6 +588,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -590,6 +591,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
pcb->unsent_oversize == 0);
|
||||
#endif /* TCP_OVERSIZE */
|
||||
}
|
||||
@ -777,7 +774,7 @@ index dac498e..b99974d 100644
|
||||
|
||||
/*
|
||||
* Phase 3: Create new segments.
|
||||
@@ -604,6 +612,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -607,6 +615,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
u8_t chksum_swapped = 0;
|
||||
#endif /* TCP_CHECKSUM_ON_COPY */
|
||||
|
||||
@ -785,7 +782,7 @@ index dac498e..b99974d 100644
|
||||
if (apiflags & TCP_WRITE_FLAG_COPY) {
|
||||
/* If copy is set, memory should be allocated and data copied
|
||||
* into pbuf */
|
||||
@@ -650,6 +659,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -653,6 +662,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
/* Concatenate the headers and data pbufs together. */
|
||||
pbuf_cat(p/*header*/, p2/*data*/);
|
||||
}
|
||||
@ -813,10 +810,10 @@ index f525bc2..aacc1d2 100644
|
||||
|
||||
#endif /* __EVENTPOLL_H__ */
|
||||
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
|
||||
index f771725..83208bf 100644
|
||||
index f666f8f..783acf5 100644
|
||||
--- a/src/include/lwip/priv/tcp_priv.h
|
||||
+++ b/src/include/lwip/priv/tcp_priv.h
|
||||
@@ -349,7 +349,7 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
|
||||
@@ -346,7 +346,7 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
|
||||
{
|
||||
LWIP_ASSERT("Invalid parameter", pcb != NULL);
|
||||
|
||||
@ -826,10 +823,10 @@ index f771725..83208bf 100644
|
||||
qtuple.src_ip = pcb->local_ip.addr;
|
||||
qtuple.src_port = lwip_htons(pcb->local_port);
|
||||
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
|
||||
index 345e26c..4e7e671 100644
|
||||
index c8f0fab..1d63e8f 100644
|
||||
--- a/src/include/lwip/sockets.h
|
||||
+++ b/src/include/lwip/sockets.h
|
||||
@@ -647,7 +647,7 @@ int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
@@ -666,7 +666,7 @@ int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
|
||||
#if USE_LIBOS
|
||||
int lwip_ioctl(int s, long cmd, ...);
|
||||
|
||||
@ -22,7 +22,7 @@ Subject: [PATCH] refactor event and add HW checksum offload
|
||||
create mode 100644 src/include/dpdk_cksum.h
|
||||
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index 3072dd9..672f022 100644
|
||||
index 0f3a5b6..8f20577 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -57,6 +57,7 @@
|
||||
@ -33,7 +33,7 @@ index 3072dd9..672f022 100644
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
@@ -1758,7 +1759,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
|
||||
@@ -1759,7 +1760,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
|
||||
} else {
|
||||
write_more = 0;
|
||||
}
|
||||
@ -70,7 +70,7 @@ index bce07f5..3f85bad 100644
|
||||
{
|
||||
/* the symbol we use here won't be NULL, so we don't need dlerror()
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 21de5d9..3d94454 100644
|
||||
index f041776..4216986 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -65,6 +65,7 @@
|
||||
@ -81,7 +81,7 @@ index 21de5d9..3d94454 100644
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
@@ -2682,9 +2683,6 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
@@ -2724,9 +2725,6 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
check_waiters = 0;
|
||||
}
|
||||
sock->sendevent = 1;
|
||||
@ -92,7 +92,7 @@ index 21de5d9..3d94454 100644
|
||||
case NETCONN_EVT_SENDMINUS:
|
||||
sock->sendevent = 0;
|
||||
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
|
||||
index 59b493a..c58ae25 100644
|
||||
index 9a82a67..0404608 100644
|
||||
--- a/src/core/ipv4/icmp.c
|
||||
+++ b/src/core/ipv4/icmp.c
|
||||
@@ -51,6 +51,10 @@
|
||||
@ -124,7 +124,7 @@ index 59b493a..c58ae25 100644
|
||||
#endif /* CHECKSUM_GEN_IP */
|
||||
|
||||
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
|
||||
index c83afbe..1334cdc 100644
|
||||
index ef7771f..4623096 100644
|
||||
--- a/src/core/ipv4/ip4.c
|
||||
+++ b/src/core/ipv4/ip4.c
|
||||
@@ -59,6 +59,10 @@
|
||||
@ -138,7 +138,7 @@ index c83afbe..1334cdc 100644
|
||||
#ifdef LWIP_HOOK_FILENAME
|
||||
#include LWIP_HOOK_FILENAME
|
||||
#endif
|
||||
@@ -503,8 +507,17 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
@@ -537,8 +541,17 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
/* verify checksum */
|
||||
#if CHECKSUM_CHECK_IP
|
||||
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) {
|
||||
@ -157,7 +157,7 @@ index c83afbe..1334cdc 100644
|
||||
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
||||
("Checksum (0x%"X16_F") failed, IP packet dropped.\n", inet_chksum(iphdr, iphdr_hlen)));
|
||||
ip4_debug_print(p);
|
||||
@@ -972,7 +985,16 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
@@ -1006,7 +1019,16 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
IPH_CHKSUM_SET(iphdr, 0);
|
||||
#if CHECKSUM_GEN_IP
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
|
||||
@ -175,7 +175,7 @@ index c83afbe..1334cdc 100644
|
||||
#endif /* CHECKSUM_GEN_IP */
|
||||
#endif /* CHECKSUM_GEN_IP_INLINE */
|
||||
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
|
||||
index a445530..17a4ccd 100644
|
||||
index 5303144..15b61ee 100644
|
||||
--- a/src/core/ipv4/ip4_frag.c
|
||||
+++ b/src/core/ipv4/ip4_frag.c
|
||||
@@ -51,6 +51,10 @@
|
||||
@ -227,7 +227,7 @@ index a445530..17a4ccd 100644
|
||||
|
||||
/* No need for separate header pbuf - we allowed room for it in rambuf
|
||||
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
|
||||
index cd6b558..247681d 100644
|
||||
index 9d4e1c8..69a52b6 100644
|
||||
--- a/src/core/pbuf.c
|
||||
+++ b/src/core/pbuf.c
|
||||
@@ -282,7 +282,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
@ -239,9 +239,9 @@ index cd6b558..247681d 100644
|
||||
p = lwip_alloc_pbuf(layer, length, type);
|
||||
#else
|
||||
p = (struct pbuf *)mem_malloc(alloc_len);
|
||||
@@ -1019,6 +1019,13 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_
|
||||
@@ -1016,6 +1016,13 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_
|
||||
/* current p_from does not fit into current p_to */
|
||||
len_calc = p_to->len - offset_to;
|
||||
len = p_to->len - offset_to;
|
||||
}
|
||||
+
|
||||
+#if USE_LIBOS && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW)
|
||||
@ -250,11 +250,11 @@ index cd6b558..247681d 100644
|
||||
+ p_to->ol_flags = p_from->ol_flags;
|
||||
+#endif
|
||||
+
|
||||
len = (u16_t)LWIP_MIN(copy_len, len_calc);
|
||||
len = LWIP_MIN(copy_len, len);
|
||||
MEMCPY((u8_t *)p_to->payload + offset_to, (u8_t *)p_from->payload + offset_from, len);
|
||||
offset_to += len;
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 0d3a2f1..b1bbe00 100644
|
||||
index 1dd0ed6..fa574ff 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -64,6 +64,10 @@
|
||||
@ -294,7 +294,7 @@ index 0d3a2f1..b1bbe00 100644
|
||||
TCP_STATS_INC(tcp.chkerr);
|
||||
goto dropped;
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index b99974d..1b0af8d 100644
|
||||
index 1164c56..df26e53 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -80,6 +80,13 @@
|
||||
@ -311,7 +311,7 @@ index b99974d..1b0af8d 100644
|
||||
#ifdef LWIP_HOOK_FILENAME
|
||||
#include LWIP_HOOK_FILENAME
|
||||
#endif
|
||||
@@ -660,8 +667,11 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -663,8 +670,11 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
pbuf_cat(p/*header*/, p2/*data*/);
|
||||
}
|
||||
#else /* USE_LIBOS */
|
||||
@ -325,7 +325,7 @@ index b99974d..1b0af8d 100644
|
||||
#endif /* USE_LIBOS */
|
||||
|
||||
queuelen += pbuf_clen(p);
|
||||
@@ -789,8 +799,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -792,8 +802,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
/*
|
||||
* Finally update the pcb state.
|
||||
*/
|
||||
@ -339,7 +339,7 @@ index b99974d..1b0af8d 100644
|
||||
pcb->snd_queuelen = queuelen;
|
||||
|
||||
LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_write: %"S16_F" (after enqueued)\n",
|
||||
@@ -1584,6 +1599,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
@@ -1587,6 +1602,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
|
||||
#if CHECKSUM_GEN_TCP
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
@ -351,7 +351,7 @@ index b99974d..1b0af8d 100644
|
||||
#if TCP_CHECKSUM_ON_COPY
|
||||
u32_t acc;
|
||||
#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK
|
||||
@@ -1618,6 +1638,44 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
@@ -1621,6 +1641,44 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
seg->tcphdr->chksum = ip_chksum_pseudo(seg->p, IP_PROTO_TCP,
|
||||
seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip);
|
||||
#endif /* TCP_CHECKSUM_ON_COPY */
|
||||
@ -396,10 +396,10 @@ index b99974d..1b0af8d 100644
|
||||
}
|
||||
#endif /* CHECKSUM_GEN_TCP */
|
||||
TCP_STATS_INC(tcp.xmit);
|
||||
@@ -1959,8 +2017,18 @@ tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p,
|
||||
@@ -1979,8 +2037,18 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
|
||||
#if CHECKSUM_GEN_TCP
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
+#if CHECKSUM_GEN_TCP_HW
|
||||
+ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) {
|
||||
+ tcph_cksum_set(p, TCP_HLEN);
|
||||
@ -409,12 +409,12 @@ index b99974d..1b0af8d 100644
|
||||
+ src, dst);
|
||||
+ }
|
||||
+#else
|
||||
tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
|
||||
src, dst);
|
||||
tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
|
||||
src, dst);
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (pcb != NULL) {
|
||||
if (pcb != NULL) {
|
||||
diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h
|
||||
new file mode 100644
|
||||
index 0000000..e57be4d
|
||||
@ -529,7 +529,7 @@ index 0000000..e57be4d
|
||||
+#endif /* USE_LIBOS */
|
||||
+#endif /* __DPDK_CKSUM_H__ */
|
||||
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
|
||||
index 3894574..87cd960 100644
|
||||
index b539ad6..fea7be9 100644
|
||||
--- a/src/include/lwip/pbuf.h
|
||||
+++ b/src/include/lwip/pbuf.h
|
||||
@@ -220,6 +220,15 @@ struct pbuf {
|
||||
@ -669,7 +669,7 @@ index 36bcaed..eec4e8e 100644
|
||||
extern void gazelle_init_sock(int32_t fd);
|
||||
#endif /* USE_LIBOS */
|
||||
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
|
||||
index dd171e2..ab976a8 100644
|
||||
index db5c514..0f21ad3 100644
|
||||
--- a/src/netif/ethernet.c
|
||||
+++ b/src/netif/ethernet.c
|
||||
@@ -56,6 +56,10 @@
|
||||
@ -683,7 +683,7 @@ index dd171e2..ab976a8 100644
|
||||
#ifdef LWIP_HOOK_FILENAME
|
||||
#include LWIP_HOOK_FILENAME
|
||||
#endif
|
||||
@@ -308,6 +312,10 @@ ethernet_output(struct netif * netif, struct pbuf * p,
|
||||
@@ -316,6 +320,10 @@ ethernet_output(struct netif * netif, struct pbuf * p,
|
||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE,
|
||||
("ethernet_output: sending packet %p\n", (void *)p));
|
||||
|
||||
|
||||
@ -15,10 +15,10 @@ Subject: [PATCH] refactor pkt read/send
|
||||
8 files changed, 75 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index 672f022..7839526 100644
|
||||
index 8f20577..ab3cfc1 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -341,13 +341,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
@@ -344,13 +344,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
#if LWIP_SO_RCVBUF
|
||||
SYS_ARCH_INC(conn->recv_avail, len);
|
||||
#endif /* LWIP_SO_RCVBUF */
|
||||
@ -36,7 +36,7 @@ index 672f022..7839526 100644
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -479,10 +478,7 @@ err_tcp(void *arg, err_t err)
|
||||
@@ -482,10 +481,7 @@ err_tcp(void *arg, err_t err)
|
||||
/* use trypost to prevent deadlock */
|
||||
sys_mbox_trypost(&conn->recvmbox, mbox_msg);
|
||||
#if USE_LIBOS
|
||||
@ -48,7 +48,7 @@ index 672f022..7839526 100644
|
||||
#endif
|
||||
}
|
||||
/* pass error message to acceptmbox to wake up pending accept */
|
||||
@@ -1356,6 +1352,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
@@ -1357,6 +1353,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
}
|
||||
}
|
||||
SET_CONN_TYPE_LIBOS(conn);
|
||||
@ -79,10 +79,10 @@ index 3f85bad..6afb9c6 100644
|
||||
|
||||
err_out:
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 3d94454..4d4cea1 100644
|
||||
index 4216986..7cdb9d8 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -1039,11 +1039,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
@@ -1076,11 +1076,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
{
|
||||
u8_t apiflags = NETCONN_NOAUTORCVD;
|
||||
ssize_t recvd = 0;
|
||||
@ -94,15 +94,15 @@ index 3d94454..4d4cea1 100644
|
||||
|
||||
LWIP_ASSERT("no socket given", sock != NULL);
|
||||
LWIP_ASSERT("this should be checked internally", NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP);
|
||||
@@ -1134,6 +1130,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
|
||||
@@ -1170,6 +1166,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
} while ((recv_left > 0) && !(flags & MSG_PEEK));
|
||||
lwip_recv_tcp_done:
|
||||
#else /* USE_LIBOS */
|
||||
+ LWIP_UNUSED_ARG(recv_left);
|
||||
recvd = read_lwip_data(sock, flags, apiflags);
|
||||
if (recvd <= 0) {
|
||||
return recvd;
|
||||
@@ -2667,10 +2664,8 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
@@ -2709,10 +2706,8 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
check_waiters = 0;
|
||||
}
|
||||
#if USE_LIBOS
|
||||
|
||||
@ -12,7 +12,7 @@ Signed-off-by: Honggang LI <honggangli@163.com>
|
||||
2 files changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/include/arch/cc.h b/src/include/arch/cc.h
|
||||
index 222b0c9..aa18573 100644
|
||||
index 222b0c9..10d667b 100644
|
||||
--- a/src/include/arch/cc.h
|
||||
+++ b/src/include/arch/cc.h
|
||||
@@ -62,7 +62,7 @@ void alloc_memp_##name##_base(void) \
|
||||
|
||||
@ -23,10 +23,10 @@ index 6afb9c6..e721381 100644
|
||||
CHECK_DLSYM_RET_RETURN(posix_api->epoll_wait_fn = dlsym(handle, "epoll_wait"));
|
||||
CHECK_DLSYM_RET_RETURN(posix_api->fork_fn = dlsym(handle, "fork"));
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 4d4cea1..c939899 100644
|
||||
index 129f7cc..39376a5 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -543,10 +543,11 @@ get_socket_by_fd(int fd)
|
||||
@@ -583,10 +583,11 @@ get_socket_by_fd(int fd)
|
||||
* @param newconn the netconn for which to allocate a socket
|
||||
* @param accepted 1 if socket has been created by accept(),
|
||||
* 0 if socket has been created by socket()
|
||||
@ -39,7 +39,7 @@ index 4d4cea1..c939899 100644
|
||||
{
|
||||
int i;
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
@@ -570,12 +571,19 @@ alloc_socket(struct netconn *newconn, int accepted)
|
||||
@@ -610,12 +611,19 @@ alloc_socket(struct netconn *newconn, int accepted)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ index 4d4cea1..c939899 100644
|
||||
if ((i < LWIP_SOCKET_OFFSET) || (i >= sockets_num + LWIP_SOCKET_OFFSET)) {
|
||||
goto err;
|
||||
}
|
||||
@@ -721,7 +729,7 @@ free_socket(struct lwip_sock *sock, int is_tcp)
|
||||
@@ -764,7 +772,7 @@ free_socket(struct lwip_sock *sock, int is_tcp)
|
||||
*/
|
||||
|
||||
int
|
||||
@ -68,7 +68,7 @@ index 4d4cea1..c939899 100644
|
||||
{
|
||||
struct lwip_sock *sock, *nsock;
|
||||
struct netconn *newconn;
|
||||
@@ -755,7 +763,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
@@ -797,7 +805,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
}
|
||||
LWIP_ASSERT("newconn != NULL", newconn != NULL);
|
||||
|
||||
@ -76,8 +76,8 @@ index 4d4cea1..c939899 100644
|
||||
+ newsock = alloc_socket(newconn, 1, flags);
|
||||
if (newsock == -1) {
|
||||
netconn_delete(newconn);
|
||||
sock_set_errno(sock, ENFILE);
|
||||
@@ -827,6 +835,12 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
set_errno(ENFILE);
|
||||
@@ -869,6 +877,12 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||
return newsock;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ index 4d4cea1..c939899 100644
|
||||
int
|
||||
lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
|
||||
{
|
||||
@@ -1823,6 +1837,10 @@ lwip_socket(int domain, int type, int protocol)
|
||||
@@ -1868,6 +1882,10 @@ lwip_socket(int domain, int type, int protocol)
|
||||
|
||||
LWIP_UNUSED_ARG(domain); /* @todo: check this */
|
||||
|
||||
@ -101,7 +101,7 @@ index 4d4cea1..c939899 100644
|
||||
/* create a netconn */
|
||||
switch (type) {
|
||||
case SOCK_RAW:
|
||||
@@ -1862,7 +1880,15 @@ lwip_socket(int domain, int type, int protocol)
|
||||
@@ -1907,7 +1925,15 @@ lwip_socket(int domain, int type, int protocol)
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -119,10 +119,10 @@ index 4d4cea1..c939899 100644
|
||||
if (i == -1) {
|
||||
netconn_delete(conn);
|
||||
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
|
||||
index 4e7e671..3c5b87b 100644
|
||||
index 1d63e8f..ca5bf6e 100644
|
||||
--- a/src/include/lwip/sockets.h
|
||||
+++ b/src/include/lwip/sockets.h
|
||||
@@ -573,6 +573,7 @@ void lwip_socket_thread_cleanup(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: destro
|
||||
@@ -592,6 +592,7 @@ void lwip_socket_thread_cleanup(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: destro
|
||||
#if LWIP_COMPAT_SOCKETS == 2
|
||||
/* This helps code parsers/code completion by not having the COMPAT functions as defines */
|
||||
#define lwip_accept accept
|
||||
@ -130,7 +130,7 @@ index 4e7e671..3c5b87b 100644
|
||||
#define lwip_bind bind
|
||||
#define lwip_shutdown shutdown
|
||||
#define lwip_getpeername getpeername
|
||||
@@ -614,7 +615,25 @@ int fcntl(int s, int cmd, ...);
|
||||
@@ -633,7 +634,25 @@ int fcntl(int s, int cmd, ...);
|
||||
#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */
|
||||
#endif /* LWIP_COMPAT_SOCKETS == 2 */
|
||||
|
||||
@ -156,7 +156,7 @@ index 4e7e671..3c5b87b 100644
|
||||
int lwip_bind(int s, const struct sockaddr *name, socklen_t namelen);
|
||||
int lwip_shutdown(int s, int how);
|
||||
int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen);
|
||||
@@ -661,6 +680,8 @@ int lwip_inet_pton(int af, const char *src, void *dst);
|
||||
@@ -680,6 +699,8 @@ int lwip_inet_pton(int af, const char *src, void *dst);
|
||||
/** @ingroup socket */
|
||||
#define accept(s,addr,addrlen) lwip_accept(s,addr,addrlen)
|
||||
/** @ingroup socket */
|
||||
|
||||
@ -1,19 +1,34 @@
|
||||
diff -Nur lwip-2.1.3-org/src/core/init.c lwip-2.1.3/src/core/init.c
|
||||
--- lwip-2.1.3-org/src/core/init.c 2022-12-06 14:40:45.280000000 +0000
|
||||
+++ lwip-2.1.3/src/core/init.c 2022-12-06 14:41:01.452000000 +0000
|
||||
@@ -306,7 +306,7 @@
|
||||
#if TCP_SNDLOWAT >= TCP_SND_BUF
|
||||
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||
From d9e656c6ca48367fdc174b00c64d6f3fb0584a38 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 15:09:14 +0800
|
||||
Subject: [PATCH] add huge snd_buf
|
||||
|
||||
---
|
||||
src/core/init.c | 2 +-
|
||||
src/core/pbuf.c | 9 ++++++---
|
||||
src/include/lwip/opt.h | 2 +-
|
||||
src/include/lwip/pbuf.h | 2 +-
|
||||
src/include/lwipopts.h | 2 +-
|
||||
5 files changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/core/init.c b/src/core/init.c
|
||||
index 5b60ed8..6841857 100644
|
||||
--- a/src/core/init.c
|
||||
+++ b/src/core/init.c
|
||||
@@ -312,7 +312,7 @@ PACK_STRUCT_END
|
||||
#if TCP_MSS >= ((16 * 1024) - 1)
|
||||
#error "lwip_sanity_check: WARNING: TCP_MSS must be <= 16382 to prevent u16_t underflow in TCP_SNDLOWAT calculation!"
|
||||
#endif
|
||||
-#if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS))
|
||||
+#if TCP_SNDLOWAT >= (0xFFFFFFFF - (4 * TCP_MSS))
|
||||
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must at least be 4*MSS below u16_t overflow!"
|
||||
#endif
|
||||
#if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN
|
||||
diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c
|
||||
--- lwip-2.1.3-org/src/core/pbuf.c 2022-12-06 14:40:45.280000000 +0000
|
||||
+++ lwip-2.1.3/src/core/pbuf.c 2022-12-06 14:46:04.860000000 +0000
|
||||
@@ -869,13 +869,13 @@
|
||||
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
|
||||
index 69a52b6..bea0e81 100644
|
||||
--- a/src/core/pbuf.c
|
||||
+++ b/src/core/pbuf.c
|
||||
@@ -871,13 +871,13 @@ pbuf_cat(struct pbuf *h, struct pbuf *t)
|
||||
/* proceed to last pbuf of chain */
|
||||
for (p = h; p->next != NULL; p = p->next) {
|
||||
/* add total length of second chain to all totals of first chain */
|
||||
@ -29,7 +44,7 @@ diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c
|
||||
/* chain last pbuf of head (p) with first of tail (t) */
|
||||
p->next = t;
|
||||
/* p->next now references t, but the caller will drop its reference to t,
|
||||
@@ -1181,7 +1181,7 @@
|
||||
@@ -1178,7 +1178,7 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest)
|
||||
if (r != NULL) {
|
||||
/* Update the tot_len field in the first part */
|
||||
for (i = p; i != NULL; i = i->next) {
|
||||
@ -38,7 +53,7 @@ diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c
|
||||
LWIP_ASSERT("tot_len/len mismatch in last pbuf",
|
||||
(i->next != NULL) || (i->tot_len == i->len));
|
||||
}
|
||||
@@ -1192,6 +1192,9 @@
|
||||
@@ -1189,6 +1189,9 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest)
|
||||
/* tot_len field in rest does not need modifications */
|
||||
/* reference counters do not need modifications */
|
||||
*rest = r;
|
||||
@ -48,10 +63,11 @@ diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c
|
||||
}
|
||||
}
|
||||
}
|
||||
diff -Nur lwip-2.1.3-org/src/include/lwip/opt.h lwip-2.1.3/src/include/lwip/opt.h
|
||||
--- lwip-2.1.3-org/src/include/lwip/opt.h 2022-12-06 14:40:45.292000000 +0000
|
||||
+++ lwip-2.1.3/src/include/lwip/opt.h 2022-12-06 14:41:01.456000000 +0000
|
||||
@@ -1482,7 +1482,7 @@
|
||||
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
|
||||
index b738460..570d2de 100644
|
||||
--- a/src/include/lwip/opt.h
|
||||
+++ b/src/include/lwip/opt.h
|
||||
@@ -1533,7 +1533,7 @@
|
||||
* send window while having a small receive window only.
|
||||
*/
|
||||
#if !defined LWIP_WND_SCALE || defined __DOXYGEN__
|
||||
@ -60,10 +76,11 @@ diff -Nur lwip-2.1.3-org/src/include/lwip/opt.h lwip-2.1.3/src/include/lwip/opt.
|
||||
#define TCP_RCV_SCALE 0
|
||||
#endif
|
||||
|
||||
diff -Nur lwip-2.1.3-org/src/include/lwip/pbuf.h lwip-2.1.3/src/include/lwip/pbuf.h
|
||||
--- lwip-2.1.3-org/src/include/lwip/pbuf.h 2022-12-06 14:40:45.284000000 +0000
|
||||
+++ lwip-2.1.3/src/include/lwip/pbuf.h 2022-12-06 14:46:36.720000000 +0000
|
||||
@@ -197,7 +197,7 @@
|
||||
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
|
||||
index b362007..60d8d1a 100644
|
||||
--- a/src/include/lwip/pbuf.h
|
||||
+++ b/src/include/lwip/pbuf.h
|
||||
@@ -197,7 +197,7 @@ struct pbuf {
|
||||
* For non-queue packet chains this is the invariant:
|
||||
* p->tot_len == p->len + (p->next? p->next->tot_len: 0)
|
||||
*/
|
||||
@ -72,9 +89,10 @@ diff -Nur lwip-2.1.3-org/src/include/lwip/pbuf.h lwip-2.1.3/src/include/lwip/pbu
|
||||
|
||||
/** length of this buffer */
|
||||
u16_t len;
|
||||
diff -Nur lwip-2.1.3-org/src/include/lwipopts.h lwip-2.1.3/src/include/lwipopts.h
|
||||
--- lwip-2.1.3-org/src/include/lwipopts.h 2022-12-06 14:40:45.292000000 +0000
|
||||
+++ lwip-2.1.3/src/include/lwipopts.h 2022-12-06 14:41:01.456000000 +0000
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 7c819d0..d7b9635 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
#define TCP_WND (40 * TCP_MSS)
|
||||
@ -84,3 +102,6 @@ diff -Nur lwip-2.1.3-org/src/include/lwipopts.h lwip-2.1.3/src/include/lwipopts.
|
||||
|
||||
#define TCP_SND_QUEUELEN (8191)
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -13,10 +13,10 @@ Subject: [PATCH] optimite pcb-list limit , send size and ack now
|
||||
6 files changed, 83 insertions(+), 43 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index 51ada38..cb08f95 100644
|
||||
index 699dda4..54d9ded 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -2297,6 +2297,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||
@@ -2303,6 +2303,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||
tcp_segs_free(pcb->unsent);
|
||||
tcp_segs_free(pcb->unacked);
|
||||
pcb->unacked = pcb->unsent = NULL;
|
||||
@ -25,10 +25,10 @@ index 51ada38..cb08f95 100644
|
||||
pcb->unsent_oversize = 0;
|
||||
#endif /* TCP_OVERSIZE */
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 2d6cb6a..78954bd 100644
|
||||
index fa574ff..ef95238 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -976,8 +976,14 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
@@ -979,8 +979,14 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
rseg = pcb->unsent;
|
||||
LWIP_ASSERT("no segment to free", rseg != NULL);
|
||||
pcb->unsent = rseg->next;
|
||||
@ -43,7 +43,7 @@ index 2d6cb6a..78954bd 100644
|
||||
}
|
||||
tcp_seg_free(rseg);
|
||||
|
||||
@@ -1393,6 +1399,8 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
@@ -1389,6 +1395,8 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
/* Remove segment from the unacknowledged list if the incoming
|
||||
ACK acknowledges them. */
|
||||
pcb->unacked = tcp_free_acked_segments(pcb, pcb->unacked, "unacked", pcb->unsent);
|
||||
@ -52,7 +52,7 @@ index 2d6cb6a..78954bd 100644
|
||||
/* We go through the ->unsent list to see if any of the segments
|
||||
on the list are acknowledged by the ACK. This may seem
|
||||
strange since an "unsent" segment shouldn't be acked. The
|
||||
@@ -1400,6 +1408,8 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
@@ -1396,6 +1404,8 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
->unsent list after a retransmission, so these segments may
|
||||
in fact have been sent once. */
|
||||
pcb->unsent = tcp_free_acked_segments(pcb, pcb->unsent, "unsent", pcb->unacked);
|
||||
@ -61,7 +61,7 @@ index 2d6cb6a..78954bd 100644
|
||||
|
||||
/* If there's nothing left to acknowledge, stop the retransmit
|
||||
timer, otherwise reset it to start again */
|
||||
@@ -1736,7 +1746,11 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
@@ -1732,7 +1742,11 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
|
||||
|
||||
/* Acknowledge the segment(s). */
|
||||
@ -75,10 +75,10 @@ index 2d6cb6a..78954bd 100644
|
||||
#if LWIP_TCP_SACK_OUT
|
||||
if (LWIP_TCP_SACK_VALID(pcb, 0)) {
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index f53750b..55053d8 100644
|
||||
index b1d9f23..342f4aa 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -631,11 +631,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -634,11 +634,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
#endif /* TCP_OVERSIZE */
|
||||
}
|
||||
#else /* USE_LIBOS */
|
||||
@ -91,7 +91,7 @@ index f53750b..55053d8 100644
|
||||
#endif /* USE_LIBOS */
|
||||
|
||||
/*
|
||||
@@ -851,6 +847,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -854,6 +850,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
* Finally update the pcb state.
|
||||
*/
|
||||
#if USE_LIBOS
|
||||
@ -101,7 +101,7 @@ index f53750b..55053d8 100644
|
||||
pcb->snd_lbb += pos;
|
||||
pcb->snd_buf -= pos;
|
||||
#else
|
||||
@@ -1050,6 +1049,8 @@ tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split)
|
||||
@@ -1053,6 +1052,8 @@ tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split)
|
||||
/* Finally insert remainder into queue after split (which stays head) */
|
||||
seg->next = useg->next;
|
||||
useg->next = seg;
|
||||
@ -110,7 +110,7 @@ index f53750b..55053d8 100644
|
||||
|
||||
#if TCP_OVERSIZE
|
||||
/* If remainder is last segment on the unsent, ensure we clear the oversize amount
|
||||
@@ -1086,9 +1087,7 @@ tcp_send_fin(struct tcp_pcb *pcb)
|
||||
@@ -1089,9 +1090,7 @@ tcp_send_fin(struct tcp_pcb *pcb)
|
||||
|
||||
/* first, try to add the fin to the last unsent segment */
|
||||
if (pcb->unsent != NULL) {
|
||||
@ -121,7 +121,7 @@ index f53750b..55053d8 100644
|
||||
|
||||
if ((TCPH_FLAGS(last_unsent->tcphdr) & (TCP_SYN | TCP_FIN | TCP_RST)) == 0) {
|
||||
/* no SYN/FIN/RST flag in the header, we can add the FIN flag */
|
||||
@@ -1182,10 +1181,10 @@ tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)
|
||||
@@ -1185,10 +1184,10 @@ tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)
|
||||
if (pcb->unsent == NULL) {
|
||||
pcb->unsent = seg;
|
||||
} else {
|
||||
@ -134,7 +134,7 @@ index f53750b..55053d8 100644
|
||||
#if TCP_OVERSIZE
|
||||
/* The new unsent tail has no space */
|
||||
pcb->unsent_oversize = 0;
|
||||
@@ -1314,6 +1313,7 @@ static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg,
|
||||
@@ -1317,6 +1316,7 @@ static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg,
|
||||
seg->next = NULL;
|
||||
if (useg == NULL) {
|
||||
pcb->unacked = seg;
|
||||
@ -142,7 +142,7 @@ index f53750b..55053d8 100644
|
||||
useg = seg;
|
||||
} else {
|
||||
if (TCP_SEQ_LT(lwip_ntohl(seg->tcphdr->seqno), lwip_ntohl(useg->tcphdr->seqno))) {
|
||||
@@ -1329,6 +1329,7 @@ static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg,
|
||||
@@ -1332,6 +1332,7 @@ static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg,
|
||||
/* add segment to tail of unacked list */
|
||||
useg->next = seg;
|
||||
useg = seg;
|
||||
@ -150,7 +150,7 @@ index f53750b..55053d8 100644
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1460,15 +1461,14 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1463,15 +1464,14 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
pcb->persist_backoff = 0;
|
||||
|
||||
/* useg should point to last segment on unacked queue */
|
||||
@ -170,7 +170,7 @@ index f53750b..55053d8 100644
|
||||
/**
|
||||
* 1)遍历unsent队列,找到所有的待发送seg. 将seg的buf串起来
|
||||
* 2) 生成新的seg, 调用tcp_output_segment, 新的seg释放掉
|
||||
@@ -1510,6 +1510,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1513,6 +1513,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
pre_pbuf->next = seg->p;
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ index f53750b..55053d8 100644
|
||||
pre_pbuf = seg->p;
|
||||
next_seqno = seg_seqno + TCP_TCPLEN(seg);
|
||||
seg = seg->next;
|
||||
@@ -1519,8 +1520,11 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1522,8 +1523,11 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
|
||||
if (first_pbuf == NULL) {
|
||||
err = tcp_output_seg(pcb, seg, netif, next_seqno + seg->len);
|
||||
@ -191,7 +191,7 @@ index f53750b..55053d8 100644
|
||||
pcb->unsent = seg->next;
|
||||
useg = tcp_output_over(pcb, seg, useg);
|
||||
seg = pcb->unsent;
|
||||
@@ -1545,7 +1549,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1548,7 +1552,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@ -200,7 +200,7 @@ index f53750b..55053d8 100644
|
||||
lwip_ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) {
|
||||
LWIP_ASSERT("RST not expected here!",
|
||||
(TCPH_FLAGS(seg->tcphdr) & TCP_RST) == 0);
|
||||
@@ -1560,6 +1564,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1563,6 +1567,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
((pcb->flags & (TF_NAGLEMEMERR | TF_FIN)) == 0)) {
|
||||
break;
|
||||
}
|
||||
@ -208,7 +208,7 @@ index f53750b..55053d8 100644
|
||||
#if TCP_CWND_DEBUG
|
||||
LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"TCPWNDSIZE_F", cwnd %"TCPWNDSIZE_F", wnd %"U32_F", effwnd %"U32_F", seq %"U32_F", ack %"U32_F", i %"S16_F"\n",
|
||||
pcb->snd_wnd, pcb->cwnd, wnd,
|
||||
@@ -1577,6 +1582,8 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1580,6 +1585,8 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
if (err != ERR_OK) {
|
||||
/* segment could not be sent, for whatever reason */
|
||||
tcp_set_flags(pcb, TF_NAGLEMEMERR);
|
||||
@ -217,7 +217,7 @@ index f53750b..55053d8 100644
|
||||
return err;
|
||||
}
|
||||
#if TCP_OVERSIZE_DBGCHECK
|
||||
@@ -1596,6 +1603,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1599,6 +1606,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
/* unacked list is empty? */
|
||||
if (pcb->unacked == NULL) {
|
||||
pcb->unacked = seg;
|
||||
@ -225,7 +225,7 @@ index f53750b..55053d8 100644
|
||||
useg = seg;
|
||||
/* unacked list is not empty? */
|
||||
} else {
|
||||
@@ -1615,6 +1623,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1618,6 +1626,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
/* add segment to tail of unacked list */
|
||||
useg->next = seg;
|
||||
useg = useg->next;
|
||||
@ -233,7 +233,7 @@ index f53750b..55053d8 100644
|
||||
}
|
||||
}
|
||||
/* do not queue empty segments on the unacked list */
|
||||
@@ -1632,6 +1641,8 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1635,6 +1644,8 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
#endif /* TCP_OVERSIZE */
|
||||
|
||||
output_done:
|
||||
@ -242,7 +242,7 @@ index f53750b..55053d8 100644
|
||||
tcp_clear_flags(pcb, TF_NAGLEMEMERR);
|
||||
return ERR_OK;
|
||||
}
|
||||
@@ -1932,9 +1943,13 @@ tcp_rexmit_rto_prepare(struct tcp_pcb *pcb)
|
||||
@@ -1935,9 +1946,13 @@ tcp_rexmit_rto_prepare(struct tcp_pcb *pcb)
|
||||
}
|
||||
#endif /* TCP_OVERSIZE_DBGCHECK */
|
||||
/* unsent queue is the concatenated queue (of unacked, unsent) */
|
||||
@ -256,7 +256,7 @@ index f53750b..55053d8 100644
|
||||
|
||||
/* Mark RTO in-progress */
|
||||
tcp_set_flags(pcb, TF_RTO);
|
||||
@@ -2004,32 +2019,42 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
@@ -2007,32 +2022,42 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
}
|
||||
|
||||
seg = pcb->unacked;
|
||||
@ -320,8 +320,8 @@ index f53750b..55053d8 100644
|
||||
if (pcb->nrtx < 0xFF) {
|
||||
++pcb->nrtx;
|
||||
}
|
||||
@@ -2207,7 +2232,7 @@ tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p,
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
@@ -2227,7 +2252,7 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
#if CHECKSUM_GEN_TCP_HW
|
||||
if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) {
|
||||
- tcph_cksum_set(p, TCP_HLEN);
|
||||
@ -330,10 +330,10 @@ index f53750b..55053d8 100644
|
||||
} else {
|
||||
tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
|
||||
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
|
||||
index 8294cdd..83e7e93 100644
|
||||
index 570d2de..39fd224 100644
|
||||
--- a/src/include/lwip/opt.h
|
||||
+++ b/src/include/lwip/opt.h
|
||||
@@ -1281,7 +1281,7 @@
|
||||
@@ -1323,7 +1323,7 @@
|
||||
* LWIP_TCP_SACK_OUT==1: TCP will support sending selective acknowledgements (SACKs).
|
||||
*/
|
||||
#if !defined LWIP_TCP_SACK_OUT || defined __DOXYGEN__
|
||||
@ -343,7 +343,7 @@ index 8294cdd..83e7e93 100644
|
||||
|
||||
/**
|
||||
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
|
||||
index b36bf33..b0ae02c 100644
|
||||
index a19fb0e..9ebdbf2 100644
|
||||
--- a/src/include/lwip/tcp.h
|
||||
+++ b/src/include/lwip/tcp.h
|
||||
@@ -356,7 +356,9 @@ struct tcp_pcb {
|
||||
|
||||
@ -11,10 +11,10 @@ Subject: [PATCH] skip unnecessary tcp_route
|
||||
4 files changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index 252f27f..abfcc00 100644
|
||||
index 54d9ded..b2bee67 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -2294,6 +2294,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||
@@ -2304,6 +2304,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||
tcp_segs_free(pcb->unacked);
|
||||
pcb->unacked = pcb->unsent = NULL;
|
||||
pcb->last_unacked = pcb->last_unsent = NULL;
|
||||
@ -23,10 +23,10 @@ index 252f27f..abfcc00 100644
|
||||
pcb->unsent_oversize = 0;
|
||||
#endif /* TCP_OVERSIZE */
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index 25aeb23..1c5734b 100644
|
||||
index e862f9e..99f8e66 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -1425,7 +1425,12 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1428,7 +1428,12 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
lwip_ntohl(seg->tcphdr->seqno), pcb->lastack));
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ index 25aeb23..1c5734b 100644
|
||||
if (netif == NULL) {
|
||||
return ERR_RTE;
|
||||
}
|
||||
@@ -2220,7 +2225,7 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags
|
||||
@@ -2223,14 +2228,21 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags
|
||||
* header checksum and calling ip_output_if while handling netif hints and stats.
|
||||
*/
|
||||
static err_t
|
||||
@ -48,8 +48,7 @@ index 25aeb23..1c5734b 100644
|
||||
+tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
|
||||
const ip_addr_t *src, const ip_addr_t *dst)
|
||||
{
|
||||
err_t err;
|
||||
@@ -2228,7 +2233,14 @@ tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p,
|
||||
struct netif *netif;
|
||||
|
||||
LWIP_ASSERT("tcp_output_control_segment: invalid pbuf", p != NULL);
|
||||
|
||||
@ -63,19 +62,10 @@ index 25aeb23..1c5734b 100644
|
||||
+ netif = pcb->pcb_if;
|
||||
+ }
|
||||
if (netif == NULL) {
|
||||
err = ERR_RTE;
|
||||
} else {
|
||||
@@ -2318,7 +2330,7 @@ tcp_rst(const struct tcp_pcb *pcb, u32_t seqno, u32_t ackno,
|
||||
|
||||
MIB2_STATS_INC(mib2.tcpoutrsts);
|
||||
|
||||
- tcp_output_control_segment(pcb, p, local_ip, remote_ip);
|
||||
+ tcp_output_control_segment((struct tcp_pcb*)pcb, p, local_ip, remote_ip);
|
||||
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %"U32_F" ackno %"U32_F".\n", seqno, ackno));
|
||||
}
|
||||
|
||||
pbuf_free(p);
|
||||
return ERR_RTE;
|
||||
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
|
||||
index b0ae02c..2a61776 100644
|
||||
index 9ebdbf2..07b7dc0 100644
|
||||
--- a/src/include/lwip/tcp.h
|
||||
+++ b/src/include/lwip/tcp.h
|
||||
@@ -408,6 +408,7 @@ struct tcp_pcb {
|
||||
@ -87,10 +77,10 @@ index b0ae02c..2a61776 100644
|
||||
|
||||
#if TCP_PCB_HASH
|
||||
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
|
||||
index 62e5bf1..ec4d78c 100644
|
||||
index bf0d753..3cf0062 100644
|
||||
--- a/src/include/lwipsock.h
|
||||
+++ b/src/include/lwipsock.h
|
||||
@@ -111,6 +111,7 @@ struct lwip_sock {
|
||||
@@ -110,6 +110,7 @@ struct lwip_sock {
|
||||
/* stack thread all use */
|
||||
struct list_node recv_list;
|
||||
struct list_node send_list;
|
||||
|
||||
@ -1,91 +0,0 @@
|
||||
From 1aa27395a4c4b73b6db472c4ae75ed91637a11bf Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Wed, 21 Dec 2022 17:50:50 +0800
|
||||
Subject: [PATCH] add dataack when recv too many acks with data
|
||||
|
||||
---
|
||||
src/core/tcp_in.c | 22 ++++++++++++++++++++++
|
||||
src/include/lwip/tcp.h | 1 +
|
||||
src/include/lwipopts.h | 2 ++
|
||||
3 files changed, 25 insertions(+)
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 78954bd..35ec6d9 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -1260,6 +1260,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
s16_t m;
|
||||
u32_t right_wnd_edge;
|
||||
int found_dupack = 0;
|
||||
+ int found_dataack = 0;
|
||||
|
||||
LWIP_ASSERT("tcp_receive: invalid pcb", pcb != NULL);
|
||||
LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED);
|
||||
@@ -1337,11 +1338,31 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
}
|
||||
}
|
||||
}
|
||||
+ /* fast rexmit when receive too many acks with data */
|
||||
+ if (TCP_SEQ_LT(ackno + 1, pcb->snd_nxt)) {
|
||||
+ if (pcb->snd_wl2 + pcb->snd_wnd == right_wnd_edge) {
|
||||
+ if (pcb->rtime >= 0) {
|
||||
+ if (pcb->lastack == ackno) {
|
||||
+ found_dataack = 1;
|
||||
+ ++pcb->dataacks;
|
||||
+ if (pcb->dataacks > MAX_DATA_ACK_NUM) {
|
||||
+ if (tcp_rexmit(pcb) == ERR_OK) {
|
||||
+ pcb->rtime = 0;
|
||||
+ pcb->dataacks = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
/* If Clause (1) or more is true, but not a duplicate ack, reset
|
||||
* count of consecutive duplicate acks */
|
||||
if (!found_dupack) {
|
||||
pcb->dupacks = 0;
|
||||
}
|
||||
+ if (!found_dataack) {
|
||||
+ pcb->dataacks = 0;
|
||||
+ }
|
||||
} else if (TCP_SEQ_BETWEEN(ackno, pcb->lastack + 1, pcb->snd_nxt)) {
|
||||
/* We come here when the ACK acknowledges new data. */
|
||||
tcpwnd_size_t acked;
|
||||
@@ -1367,6 +1388,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
/* Reset the fast retransmit variables. */
|
||||
pcb->dupacks = 0;
|
||||
pcb->lastack = ackno;
|
||||
+ pcb->dataacks = 0;
|
||||
|
||||
/* Update the congestion control variables (cwnd and
|
||||
ssthresh). */
|
||||
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
|
||||
index 2a61776..97cb882 100644
|
||||
--- a/src/include/lwip/tcp.h
|
||||
+++ b/src/include/lwip/tcp.h
|
||||
@@ -326,6 +326,7 @@ struct tcp_pcb {
|
||||
|
||||
/* fast retransmit/recovery */
|
||||
u8_t dupacks;
|
||||
+ u32_t dataacks;
|
||||
u32_t lastack; /* Highest acknowledged seqno. */
|
||||
|
||||
/* congestion avoidance/control variables */
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 907c630..405cf11 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -177,6 +177,8 @@
|
||||
|
||||
#define MIN_TSO_SEG_LEN 256
|
||||
|
||||
+#define MAX_DATA_ACK_NUM 256
|
||||
+
|
||||
/* ---------------------------------------
|
||||
* ------- NIC offloads --------
|
||||
* ---------------------------------------
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -13,7 +13,7 @@ Subject: [PATCH] lwip reuse ip port
|
||||
6 files changed, 104 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index f75d214..3171c5e 100644
|
||||
index b2bee67..2cc1174 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -111,6 +111,7 @@
|
||||
@ -85,10 +85,10 @@ index f75d214..3171c5e 100644
|
||||
+ lpcb->master_lpcb = conn->is_master_fd;
|
||||
+#endif
|
||||
+
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
IP_SET_TYPE_VAL(lpcb->remote_ip, pcb->local_ip.type);
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
@@ -979,7 +1005,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
|
||||
#if LWIP_VLAN_PCP
|
||||
lpcb->netif_hints.tci = pcb->netif_hints.tci;
|
||||
#endif /* LWIP_VLAN_PCP */
|
||||
@@ -982,7 +1008,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
|
||||
lpcb->accepts_pending = 0;
|
||||
tcp_backlog_set(lpcb, backlog);
|
||||
#endif /* TCP_LISTEN_BACKLOG */
|
||||
@ -106,7 +106,7 @@ index f75d214..3171c5e 100644
|
||||
done:
|
||||
if (err != NULL) {
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 35ec6d9..9f5c34a 100644
|
||||
index ef95238..77dd235 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -356,6 +356,9 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -121,7 +121,7 @@ index 35ec6d9..9f5c34a 100644
|
||||
prev = NULL;
|
||||
@@ -379,6 +382,30 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
} else if (IP_ADDR_PCB_VERSION_MATCH_EXACT(lpcb, ip_current_dest_addr())) {
|
||||
if (ip_addr_cmp(&lpcb->local_ip, ip_current_dest_addr())) {
|
||||
if (ip_addr_eq(&lpcb->local_ip, ip_current_dest_addr())) {
|
||||
/* found an exact match */
|
||||
+#if REUSE_IPPORT
|
||||
+ // check master fd
|
||||
@ -164,7 +164,7 @@ index 35ec6d9..9f5c34a 100644
|
||||
pbuf_free(p);
|
||||
return;
|
||||
diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h
|
||||
index 6dec8c0..430a7a0 100644
|
||||
index 55fc413..d12312c 100644
|
||||
--- a/src/include/lwip/api.h
|
||||
+++ b/src/include/lwip/api.h
|
||||
@@ -318,6 +318,10 @@ struct netconn {
|
||||
@ -179,7 +179,7 @@ index 6dec8c0..430a7a0 100644
|
||||
|
||||
/** This vector type is passed to @ref netconn_write_vectors_partly to send
|
||||
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
|
||||
index b242428..97f799e 100644
|
||||
index 783acf5..02481da 100644
|
||||
--- a/src/include/lwip/priv/tcp_priv.h
|
||||
+++ b/src/include/lwip/priv/tcp_priv.h
|
||||
@@ -353,6 +353,15 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
|
||||
@ -216,7 +216,7 @@ index b242428..97f799e 100644
|
||||
do { \
|
||||
hlist_del_init(&(npcb)->tcp_node); \
|
||||
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
|
||||
index 0b65b01..312320b 100644
|
||||
index 9ebdbf2..c5e4654 100644
|
||||
--- a/src/include/lwip/tcp.h
|
||||
+++ b/src/include/lwip/tcp.h
|
||||
@@ -252,6 +252,14 @@ struct tcp_pcb_listen {
|
||||
@ -235,7 +235,7 @@ index 0b65b01..312320b 100644
|
||||
|
||||
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index fedded9..be58ec3 100644
|
||||
index 97e96ab..f8b3294 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -143,6 +143,10 @@
|
||||
|
||||
@ -9,18 +9,18 @@ Subject: [PATCH] lwip_cnctl only support F_SETFL,F_GETFL, other opt return 0
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 9b3f514..2cb6f22 100644
|
||||
index 39376a5..e99bba7 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -4107,7 +4107,12 @@ lwip_fcntl(int s, int cmd, int val)
|
||||
@@ -4149,7 +4149,12 @@ lwip_fcntl(int s, int cmd, int val)
|
||||
break;
|
||||
default:
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val));
|
||||
+#if USE_LIBOS
|
||||
+ sock_set_errno(sock, 0); /* not yet implemented, but we return 0 for compatilbe with app */
|
||||
+ sock_errno(sock, 0); /* not yet implemented, but we return 0 for compatilbe with app */
|
||||
+ ret = 0;
|
||||
+#else
|
||||
sock_set_errno(sock, ENOSYS); /* not yet implemented */
|
||||
set_errno(ENOSYS); /* not yet implemented */
|
||||
+#endif
|
||||
break;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -9,10 +9,10 @@ Subject: [PATCH] fix tso small packet drop in kernel server
|
||||
2 files changed, 130 insertions(+), 126 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index 8a0d653..b1c317d 100644
|
||||
index 240148b..17e495d 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -1312,60 +1312,33 @@ tcp_build_wnd_scale_option(u32_t *opts)
|
||||
@@ -1311,60 +1311,33 @@ tcp_build_wnd_scale_option(u32_t *opts)
|
||||
#endif
|
||||
|
||||
#if GAZELLE_ENABLE
|
||||
@ -100,7 +100,7 @@ index 8a0d653..b1c317d 100644
|
||||
#endif
|
||||
/**
|
||||
* @ingroup tcp_raw
|
||||
@@ -1471,97 +1444,127 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1470,97 +1443,127 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
pcb->persist_backoff = 0;
|
||||
|
||||
/* useg should point to last segment on unacked queue */
|
||||
@ -299,7 +299,7 @@ index 8a0d653..b1c317d 100644
|
||||
lwip_ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) {
|
||||
LWIP_ASSERT("RST not expected here!",
|
||||
(TCPH_FLAGS(seg->tcphdr) & TCP_RST) == 0);
|
||||
@@ -1576,7 +1579,6 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1575,7 +1578,6 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
((pcb->flags & (TF_NAGLEMEMERR | TF_FIN)) == 0)) {
|
||||
break;
|
||||
}
|
||||
@ -308,11 +308,11 @@ index 8a0d653..b1c317d 100644
|
||||
LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"TCPWNDSIZE_F", cwnd %"TCPWNDSIZE_F", wnd %"U32_F", effwnd %"U32_F", seq %"U32_F", ack %"U32_F", i %"S16_F"\n",
|
||||
pcb->snd_wnd, pcb->cwnd, wnd,
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 742b4a9..0d2a6d9 100644
|
||||
index 326edc1..9f8c923 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -55,6 +55,8 @@
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
#define GAZELLE_TCP_MAX_DATA_ACK_NUM 256
|
||||
#define GAZELLE_TCP_MAX_PBUF_CHAIN_LEN 40
|
||||
|
||||
+#define GAZELLE_TCP_MIN_TSO_SEG_LEN 256
|
||||
|
||||
@ -18,10 +18,10 @@ Subject: [PATCH] same node & gazellectl -a
|
||||
11 files changed, 148 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 356e345..7a5da26 100644
|
||||
index 8ef89ab..7b5606f 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -605,6 +605,10 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
@@ -645,6 +645,10 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
* (unless it has been created by accept()). */
|
||||
sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1);
|
||||
sockets[i].errevent = 0;
|
||||
@ -32,7 +32,7 @@ index 356e345..7a5da26 100644
|
||||
return i + LWIP_SOCKET_OFFSET;
|
||||
} else {
|
||||
lwip_close(i);
|
||||
@@ -716,6 +720,11 @@ free_socket(struct lwip_sock *sock, int is_tcp)
|
||||
@@ -756,6 +760,11 @@ free_socket(struct lwip_sock *sock, int is_tcp)
|
||||
/* Protect socket array */
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
|
||||
@ -44,7 +44,7 @@ index 356e345..7a5da26 100644
|
||||
freed = free_socket_locked(sock, is_tcp, &conn, &lastdata);
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
/* don't use 'sock' after this line, as another task might have allocated it */
|
||||
@@ -780,6 +789,18 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
@@ -819,6 +828,18 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
LWIP_ASSERT("invalid socket index", (newsock >= LWIP_SOCKET_OFFSET) && (newsock < NUM_SOCKETS + LWIP_SOCKET_OFFSET));
|
||||
#endif /* GAZELLE_ENABLE */
|
||||
nsock = &sockets[newsock - LWIP_SOCKET_OFFSET];
|
||||
@ -64,7 +64,7 @@ index 356e345..7a5da26 100644
|
||||
/* See event_callback: If data comes in right away after an accept, even
|
||||
* though the server task might not have created a new socket yet.
|
||||
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
|
||||
index f15b798..e01ea51 100644
|
||||
index dadf395..b2462d2 100644
|
||||
--- a/src/core/ipv4/ip4_frag.c
|
||||
+++ b/src/core/ipv4/ip4_frag.c
|
||||
@@ -729,6 +729,7 @@ ip_frag_free_pbuf_custom_ref(struct pbuf_custom_ref *p)
|
||||
@ -94,10 +94,10 @@ index f15b798..e01ea51 100644
|
||||
/* Add it to end of rambuf's chain, but using pbuf_cat, not pbuf_chain
|
||||
* so that it is removed when pbuf_dechain is later called on rambuf.
|
||||
diff --git a/src/core/netif.c b/src/core/netif.c
|
||||
index 70392cb..86b74a0 100644
|
||||
index ded3561..db3c718 100644
|
||||
--- a/src/core/netif.c
|
||||
+++ b/src/core/netif.c
|
||||
@@ -1065,7 +1065,7 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb
|
||||
@@ -1101,7 +1101,7 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb
|
||||
}
|
||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
||||
|
||||
@ -106,7 +106,7 @@ index 70392cb..86b74a0 100644
|
||||
/**
|
||||
* @ingroup netif
|
||||
* Send an IP packet to be received on the same netif (loopif-like).
|
||||
@@ -1184,6 +1184,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p)
|
||||
@@ -1220,6 +1220,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p)
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
@ -114,7 +114,7 @@ index 70392cb..86b74a0 100644
|
||||
|
||||
#if LWIP_HAVE_LOOPIF
|
||||
#if LWIP_IPV4
|
||||
@@ -1205,7 +1206,7 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ad
|
||||
@@ -1241,7 +1242,7 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ad
|
||||
#endif /* LWIP_IPV6 */
|
||||
#endif /* LWIP_HAVE_LOOPIF */
|
||||
|
||||
@ -123,7 +123,7 @@ index 70392cb..86b74a0 100644
|
||||
/**
|
||||
* Call netif_poll() in the main loop of your application. This is to prevent
|
||||
* reentering non-reentrant functions like tcp_input(). Packets passed to
|
||||
@@ -1277,6 +1278,7 @@ netif_poll(struct netif *netif)
|
||||
@@ -1313,6 +1314,7 @@ netif_poll(struct netif *netif)
|
||||
}
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
}
|
||||
@ -131,7 +131,7 @@ index 70392cb..86b74a0 100644
|
||||
|
||||
#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
|
||||
/**
|
||||
@@ -1292,7 +1294,6 @@ netif_poll_all(void)
|
||||
@@ -1328,7 +1330,6 @@ netif_poll_all(void)
|
||||
}
|
||||
}
|
||||
#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
|
||||
@ -140,7 +140,7 @@ index 70392cb..86b74a0 100644
|
||||
#if LWIP_NUM_NETIF_CLIENT_DATA > 0
|
||||
/**
|
||||
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
|
||||
index dd71519..2385e57 100644
|
||||
index 112baeb..ab1edff 100644
|
||||
--- a/src/core/pbuf.c
|
||||
+++ b/src/core/pbuf.c
|
||||
@@ -69,6 +69,7 @@
|
||||
@ -159,7 +159,7 @@ index dd71519..2385e57 100644
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -777,9 +779,13 @@ pbuf_free(struct pbuf *p)
|
||||
@@ -779,9 +781,13 @@ pbuf_free(struct pbuf *p)
|
||||
#if LWIP_SUPPORT_CUSTOM_PBUF
|
||||
/* is this a custom pbuf? */
|
||||
if ((p->flags & PBUF_FLAG_IS_CUSTOM) != 0) {
|
||||
@ -174,7 +174,7 @@ index dd71519..2385e57 100644
|
||||
#endif /* LWIP_SUPPORT_CUSTOM_PBUF */
|
||||
{
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index 69a39f6..538a664 100644
|
||||
index 9023dde..34e99df 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -116,6 +116,8 @@
|
||||
@ -205,7 +205,7 @@ index 69a39f6..538a664 100644
|
||||
vdev_unreg_done(pcb);
|
||||
release_port(pcb->local_port);
|
||||
#endif
|
||||
@@ -996,6 +1010,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
|
||||
@@ -999,6 +1013,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
|
||||
/* pcb transfer to lpcb and reg into tcp_listen_pcbs. freeing pcb shouldn't release sock table in here.
|
||||
* local_port=0 avoid to release sock table in tcp_free */
|
||||
pcb->local_port = 0;
|
||||
@ -221,7 +221,7 @@ index 69a39f6..538a664 100644
|
||||
#endif
|
||||
tcp_free(pcb);
|
||||
#if LWIP_CALLBACK_API
|
||||
@@ -1262,6 +1285,16 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
|
||||
@@ -1265,6 +1288,16 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
|
||||
#endif /* SO_REUSE */
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ index 69a39f6..538a664 100644
|
||||
iss = tcp_next_iss(pcb);
|
||||
pcb->rcv_nxt = 0;
|
||||
pcb->snd_nxt = iss;
|
||||
@@ -2090,7 +2123,13 @@ tcp_alloc(u8_t prio)
|
||||
@@ -2095,6 +2128,11 @@ tcp_alloc(u8_t prio)
|
||||
pcb->keep_intvl = TCP_KEEPINTVL_DEFAULT;
|
||||
pcb->keep_cnt = TCP_KEEPCNT_DEFAULT;
|
||||
#endif /* LWIP_TCP_KEEPALIVE */
|
||||
@ -247,13 +247,11 @@ index 69a39f6..538a664 100644
|
||||
+ pcb->client_tx_ring = NULL;
|
||||
+ pcb->free_ring = 0;
|
||||
+#endif
|
||||
pcb_tci_init(pcb);
|
||||
}
|
||||
+
|
||||
return pcb;
|
||||
}
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index dd83260..719cf04 100644
|
||||
index 7126eed..a952903 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -42,6 +42,7 @@
|
||||
@ -264,7 +262,7 @@ index dd83260..719cf04 100644
|
||||
|
||||
#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
@@ -806,6 +807,11 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
@@ -809,6 +810,11 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
|
||||
#if GAZELLE_ENABLE
|
||||
vdev_reg_done(REG_RING_TCP_CONNECT, npcb);
|
||||
@ -277,10 +275,10 @@ index dd83260..719cf04 100644
|
||||
|
||||
/* Parse any options in the SYN. */
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index 8100e18..b1c317d 100644
|
||||
index 17e495d..7aad1b8 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -725,6 +725,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -728,6 +728,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
goto memerr;
|
||||
}
|
||||
|
||||
@ -291,7 +289,7 @@ index 8100e18..b1c317d 100644
|
||||
if ((seg = tcp_create_segment(pcb, p, 0, pcb->snd_lbb + pos, optflags)) == NULL) {
|
||||
#if GAZELLE_ENABLE
|
||||
if (pos > 0) {
|
||||
@@ -1705,6 +1709,10 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
@@ -1708,6 +1712,10 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
int seg_chksum_was_swapped = 0;
|
||||
#endif
|
||||
|
||||
@ -302,7 +300,7 @@ index 8100e18..b1c317d 100644
|
||||
LWIP_ASSERT("tcp_output_segment: invalid seg", seg != NULL);
|
||||
LWIP_ASSERT("tcp_output_segment: invalid pcb", pcb != NULL);
|
||||
LWIP_ASSERT("tcp_output_segment: invalid netif", netif != NULL);
|
||||
@@ -1899,6 +1907,8 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
@@ -1902,6 +1910,8 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
PERF_START(PERF_LAYER_IP, PERF_POINT_IP_SEND);
|
||||
|
||||
NETIF_SET_HINTS(netif, &(pcb->netif_hints));
|
||||
@ -311,8 +309,8 @@ index 8100e18..b1c317d 100644
|
||||
err = ip_output_if(seg->p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl,
|
||||
pcb->tos, IP_PROTO_TCP, netif);
|
||||
NETIF_RESET_HINTS(netif);
|
||||
@@ -2236,6 +2246,7 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
|
||||
err_t err;
|
||||
@@ -2238,6 +2248,7 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
|
||||
{
|
||||
struct netif *netif;
|
||||
|
||||
+ p->pcb = pcb;
|
||||
@ -320,7 +318,7 @@ index 8100e18..b1c317d 100644
|
||||
|
||||
if (pcb == NULL || pcb->pcb_if == NULL) {
|
||||
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
|
||||
index 6c4ca44..9321afc 100644
|
||||
index ae8e5e7..46ff26a 100644
|
||||
--- a/src/include/lwip/pbuf.h
|
||||
+++ b/src/include/lwip/pbuf.h
|
||||
@@ -235,6 +235,7 @@ struct pbuf {
|
||||
@ -342,7 +340,7 @@ index 6c4ca44..9321afc 100644
|
||||
#endif /* LWIP_SUPPORT_CUSTOM_PBUF */
|
||||
|
||||
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
|
||||
index b822f40..e13099c 100644
|
||||
index edfdb68..f968441 100644
|
||||
--- a/src/include/lwip/tcp.h
|
||||
+++ b/src/include/lwip/tcp.h
|
||||
@@ -260,6 +260,9 @@ struct tcp_pcb_listen {
|
||||
@ -355,7 +353,7 @@ index b822f40..e13099c 100644
|
||||
};
|
||||
|
||||
|
||||
@@ -418,6 +421,13 @@ struct tcp_pcb {
|
||||
@@ -417,6 +420,13 @@ struct tcp_pcb {
|
||||
u8_t rcv_scale;
|
||||
#endif
|
||||
|
||||
@ -370,10 +368,10 @@ index b822f40..e13099c 100644
|
||||
};
|
||||
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 414ead4..0d2a6d9 100644
|
||||
index 9f8c923..5b6bf6e 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -235,4 +235,11 @@
|
||||
@@ -227,4 +227,11 @@
|
||||
|
||||
#define SIOCSHIWAT 1
|
||||
|
||||
|
||||
@ -8,47 +8,11 @@ Subject: [PATCH] fix last_unsent/last_unacked
|
||||
src/core/tcp_out.c | 18 +++++++++++++-----
|
||||
2 files changed, 26 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 719cf04..7e7d70a 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -1375,18 +1375,19 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
}
|
||||
}
|
||||
}
|
||||
- }
|
||||
- /* fast rexmit when receive too many acks with data */
|
||||
- if (TCP_SEQ_LT(ackno + 1, pcb->snd_nxt)) {
|
||||
- if (pcb->snd_wl2 + pcb->snd_wnd == right_wnd_edge) {
|
||||
- if (pcb->rtime >= 0) {
|
||||
- if (pcb->lastack == ackno) {
|
||||
- found_dataack = 1;
|
||||
- ++pcb->dataacks;
|
||||
- if (pcb->dataacks > GAZELLE_TCP_MAX_DATA_ACK_NUM) {
|
||||
- if (tcp_rexmit(pcb) == ERR_OK) {
|
||||
- pcb->rtime = 0;
|
||||
- pcb->dataacks = 0;
|
||||
+ } else {
|
||||
+ /* fast rexmit when receive too many acks with data */
|
||||
+ if (TCP_SEQ_LT(ackno + 1, pcb->snd_nxt)) {
|
||||
+ if (pcb->snd_wl2 + pcb->snd_wnd == right_wnd_edge) {
|
||||
+ if (pcb->rtime >= 0) {
|
||||
+ if (pcb->lastack == ackno) {
|
||||
+ found_dataack = 1;
|
||||
+ ++pcb->dataacks;
|
||||
+ if ((pcb->dataacks > GAZELLE_TCP_MAX_DATA_ACK_NUM) && (pcb->nrtx < (TCP_MAXRTX / 2))) {
|
||||
+ if (tcp_rexmit(pcb) == ERR_OK) {
|
||||
+ pcb->rtime = 0;
|
||||
+ pcb->dataacks = 0;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index b1c317d..6250e6b 100644
|
||||
index 7aad1b8..f6ec4f8 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -1444,10 +1444,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1447,10 +1447,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
pcb->persist_backoff = 0;
|
||||
|
||||
/* useg should point to last segment on unacked queue */
|
||||
@ -60,7 +24,7 @@ index b1c317d..6250e6b 100644
|
||||
|
||||
/* data available and window allows it to be sent? */
|
||||
#if GAZELLE_ENABLE
|
||||
@@ -1515,7 +1512,11 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1518,7 +1515,11 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -72,7 +36,7 @@ index b1c317d..6250e6b 100644
|
||||
if (pcb->state != SYN_SENT) {
|
||||
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
|
||||
}
|
||||
@@ -1535,6 +1536,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1538,6 +1539,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
if (TCP_TCPLEN(tmp_seg) > 0) {
|
||||
tmp_seg->next = NULL;
|
||||
if (pcb->unacked == NULL) {
|
||||
@ -80,7 +44,7 @@ index b1c317d..6250e6b 100644
|
||||
pcb->unacked = tmp_seg;
|
||||
useg = tmp_seg;
|
||||
} else {
|
||||
@@ -1550,6 +1552,9 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1553,6 +1555,9 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
} else {
|
||||
/* add segment to tail of unacked list */
|
||||
useg->next = tmp_seg;
|
||||
@ -90,7 +54,7 @@ index b1c317d..6250e6b 100644
|
||||
useg = useg->next;
|
||||
}
|
||||
}
|
||||
@@ -1603,6 +1608,9 @@ end_loop:
|
||||
@@ -1606,6 +1611,9 @@ end_loop:
|
||||
#if TCP_OVERSIZE_DBGCHECK
|
||||
seg->oversize_left = 0;
|
||||
#endif /* TCP_OVERSIZE_DBGCHECK */
|
||||
@ -100,7 +64,7 @@ index b1c317d..6250e6b 100644
|
||||
pcb->unsent = seg->next;
|
||||
if (pcb->state != SYN_SENT) {
|
||||
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
|
||||
@@ -1709,7 +1717,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
@@ -1712,7 +1720,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
int seg_chksum_was_swapped = 0;
|
||||
#endif
|
||||
|
||||
|
||||
@ -16,10 +16,10 @@ Subject: [PATCH] add udp multicast in support
|
||||
9 files changed, 78 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index 1840c9d..0287c06 100644
|
||||
index 5a2e689..98537b8 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -282,8 +282,13 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
@@ -285,8 +285,13 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
#if LWIP_SO_RCVBUF
|
||||
SYS_ARCH_INC(conn->recv_avail, len);
|
||||
#endif /* LWIP_SO_RCVBUF */
|
||||
@ -34,7 +34,7 @@ index 1840c9d..0287c06 100644
|
||||
}
|
||||
#endif /* LWIP_UDP */
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 7a5da26..a0f9d50 100644
|
||||
index 7b5606f..bedb86b 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -54,6 +54,7 @@
|
||||
@ -45,7 +45,7 @@ index 7a5da26..a0f9d50 100644
|
||||
#if LWIP_CHECKSUM_ON_COPY
|
||||
#include "lwip/inet_chksum.h"
|
||||
#endif
|
||||
@@ -1187,7 +1188,7 @@ lwip_recv_tcp_done:
|
||||
@@ -1222,7 +1223,7 @@ lwip_recv_tcp_done:
|
||||
#endif
|
||||
|
||||
/* Convert a netbuf's address data to struct sockaddr */
|
||||
@ -54,7 +54,7 @@ index 7a5da26..a0f9d50 100644
|
||||
lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port,
|
||||
struct sockaddr *from, socklen_t *fromlen)
|
||||
{
|
||||
@@ -1274,6 +1275,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
@@ -1307,6 +1308,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
apiflags = 0;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ index 7a5da26..a0f9d50 100644
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom_udp_raw[UDP/RAW]: top sock->lastdata=%p\n", (void *)sock->lastdata.netbuf));
|
||||
/* Check if there is data left from the last recv operation. */
|
||||
buf = sock->lastdata.netbuf;
|
||||
@@ -1361,6 +1363,18 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
@@ -1394,6 +1396,18 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
sock->lastdata.netbuf = NULL;
|
||||
netbuf_delete(buf);
|
||||
}
|
||||
@ -81,7 +81,7 @@ index 7a5da26..a0f9d50 100644
|
||||
if (datagram_len) {
|
||||
*datagram_len = buflen;
|
||||
}
|
||||
@@ -1409,6 +1423,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
@@ -1451,6 +1465,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
|
||||
done_socket(sock);
|
||||
return -1;
|
||||
}
|
||||
@ -89,7 +89,7 @@ index 7a5da26..a0f9d50 100644
|
||||
ret = (ssize_t)LWIP_MIN(LWIP_MIN(len, datagram_len), SSIZE_MAX);
|
||||
if (fromlen) {
|
||||
*fromlen = msg.msg_namelen;
|
||||
@@ -3956,6 +3971,10 @@ lwip_ioctl(int s, long cmd, ...)
|
||||
@@ -3998,6 +4013,10 @@ lwip_ioctl(int s, long cmd, ...)
|
||||
struct lwip_sock *sock = posix_api->get_socket(s);
|
||||
u8_t val;
|
||||
|
||||
@ -113,7 +113,7 @@ index ebc01a5..57a9670 100644
|
||||
|
||||
$(eval $(call register_dir, core, $(SRC)))
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index a5f76b9..1398537 100644
|
||||
index 24fc174..8a01c76 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -65,6 +65,12 @@
|
||||
@ -207,7 +207,7 @@ index df2e2a5..e41644b 100644
|
||||
const ip_addr_t *src, const ip_addr_t *dst)
|
||||
{
|
||||
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
|
||||
index 0376f60..38c6e9b 100644
|
||||
index 527f2d7..e61b3f1 100644
|
||||
--- a/src/include/lwip/opt.h
|
||||
+++ b/src/include/lwip/opt.h
|
||||
@@ -133,6 +133,7 @@
|
||||
@ -218,7 +218,7 @@ index 0376f60..38c6e9b 100644
|
||||
#if !defined MEMCPY || defined __DOXYGEN__
|
||||
#define MEMCPY(dst,src,len) memcpy(dst,src,len)
|
||||
#endif
|
||||
@@ -1083,7 +1084,7 @@
|
||||
@@ -1123,7 +1124,7 @@
|
||||
* LWIP_IGMP==1: Turn on IGMP module.
|
||||
*/
|
||||
#if !defined LWIP_IGMP || defined __DOXYGEN__
|
||||
@ -227,7 +227,7 @@ index 0376f60..38c6e9b 100644
|
||||
#endif
|
||||
#if !LWIP_IPV4
|
||||
#undef LWIP_IGMP
|
||||
@@ -2030,7 +2031,7 @@
|
||||
@@ -2092,7 +2093,7 @@
|
||||
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
|
||||
*/
|
||||
#if !defined LWIP_SO_RCVBUF || defined __DOXYGEN__
|
||||
@ -237,7 +237,7 @@ index 0376f60..38c6e9b 100644
|
||||
|
||||
/**
|
||||
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
|
||||
index 9321afc..fb21134 100644
|
||||
index 46ff26a..e08d4fa 100644
|
||||
--- a/src/include/lwip/pbuf.h
|
||||
+++ b/src/include/lwip/pbuf.h
|
||||
@@ -40,6 +40,8 @@
|
||||
@ -259,10 +259,10 @@ index 9321afc..fb21134 100644
|
||||
|
||||
/** In case the user needs to store data custom data on a pbuf */
|
||||
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
|
||||
index 58acf0f..36a47eb 100644
|
||||
index 8e41155..a7cec29 100644
|
||||
--- a/src/include/lwip/sockets.h
|
||||
+++ b/src/include/lwip/sockets.h
|
||||
@@ -48,6 +48,7 @@
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/inet.h"
|
||||
#include "lwip/errno.h"
|
||||
@ -270,7 +270,7 @@ index 58acf0f..36a47eb 100644
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -323,20 +324,31 @@ struct linger {
|
||||
@@ -332,20 +333,31 @@ struct linger {
|
||||
|
||||
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
@ -302,7 +302,7 @@ index 58acf0f..36a47eb 100644
|
||||
|
||||
typedef struct ip_mreq {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
@@ -656,6 +668,7 @@ ssize_t lwip_sendto(int s, const void *dataptr, size_t size, int flags,
|
||||
@@ -675,6 +687,7 @@ ssize_t lwip_sendto(int s, const void *dataptr, size_t size, int flags,
|
||||
int lwip_socket(int domain, int type, int protocol);
|
||||
ssize_t lwip_write(int s, const void *dataptr, size_t size);
|
||||
ssize_t lwip_writev(int s, const struct iovec *iov, int iovcnt);
|
||||
@ -310,7 +310,7 @@ index 58acf0f..36a47eb 100644
|
||||
#if LWIP_SOCKET_SELECT
|
||||
int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
||||
struct timeval *timeout);
|
||||
@@ -667,6 +680,8 @@ int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
@@ -686,6 +699,8 @@ int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
||||
#if GAZELLE_ENABLE
|
||||
int lwip_ioctl(int s, long cmd, ...);
|
||||
int lwip_fcntl(int s, int cmd, int val);
|
||||
@ -320,18 +320,18 @@ index 58acf0f..36a47eb 100644
|
||||
int lwip_ioctl(int s, long cmd, void *argp);
|
||||
int lwip_fcntl(int s, int cmd, int val);
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 0d2a6d9..bcb0879 100644
|
||||
index 5b6bf6e..abc3f15 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -175,7 +175,7 @@
|
||||
@@ -169,7 +169,7 @@
|
||||
---------- UDP options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
-#define LWIP_UDP 0
|
||||
+#define LWIP_UDP 1
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ Subject: [PATCH] fix pbuf leak in udp connection
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index 1398537..9c3cdaa 100644
|
||||
index 8a01c76..6261c86 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -933,8 +933,11 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
|
||||
|
||||
@ -15,7 +15,7 @@ Subject: [PATCH] drop-netbuf-in-recv_udp-to-fix-mem-overflow
|
||||
8 files changed, 52 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/api/api_lib.c b/src/api/api_lib.c
|
||||
index ffa14d6..afdfc11 100644
|
||||
index 4cdb965..b22b987 100644
|
||||
--- a/src/api/api_lib.c
|
||||
+++ b/src/api/api_lib.c
|
||||
@@ -655,7 +655,11 @@ netconn_recv_data(struct netconn *conn, void **new_buf, u8_t apiflags)
|
||||
@ -48,10 +48,18 @@ index ffa14d6..afdfc11 100644
|
||||
* Receive data (in form of a netbuf) from a UDP or RAW netconn
|
||||
*
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index 30929be..b82ebf2 100644
|
||||
index 98537b8..35207cc 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -253,6 +253,14 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
@@ -227,7 +227,6 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
struct netbuf *buf;
|
||||
struct netconn *conn;
|
||||
u16_t len;
|
||||
- err_t err;
|
||||
#if LWIP_SO_RCVBUF
|
||||
int recv_avail;
|
||||
#endif /* LWIP_SO_RCVBUF */
|
||||
@@ -255,6 +254,15 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
return;
|
||||
}
|
||||
|
||||
@ -63,12 +71,13 @@ index 30929be..b82ebf2 100644
|
||||
+ if (sys_mbox_trypost(&conn->recvmbox, p) != ERR_OK) {
|
||||
+ return;
|
||||
+#else /* GAZELLE_UDP_ENABLE */
|
||||
+ err_t err;
|
||||
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
|
||||
if (buf == NULL) {
|
||||
pbuf_free(p);
|
||||
@@ -277,17 +285,18 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) {
|
||||
@@ -281,17 +289,18 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
netbuf_delete(buf);
|
||||
LWIP_DEBUGF(API_MSG_DEBUG, ("recv_udp: sys_mbox_trypost failed, err=%d\n", err));
|
||||
return;
|
||||
+#endif /* GAZELLE_UDP_ENABLE */
|
||||
} else {
|
||||
@ -89,10 +98,10 @@ index 30929be..b82ebf2 100644
|
||||
}
|
||||
#endif /* LWIP_UDP */
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index dee9230..17691f7 100644
|
||||
index bedb86b..a731453 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -1179,7 +1179,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
@@ -1308,7 +1308,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
apiflags = 0;
|
||||
}
|
||||
|
||||
@ -101,7 +110,7 @@ index dee9230..17691f7 100644
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom_udp_raw[UDP/RAW]: top sock->lastdata=%p\n", (void *)sock->lastdata.netbuf));
|
||||
/* Check if there is data left from the last recv operation. */
|
||||
buf = sock->lastdata.netbuf;
|
||||
@@ -1267,7 +1267,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
@@ -1396,7 +1396,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
sock->lastdata.netbuf = NULL;
|
||||
netbuf_delete(buf);
|
||||
}
|
||||
@ -110,7 +119,7 @@ index dee9230..17691f7 100644
|
||||
LWIP_UNUSED_ARG(copylen);
|
||||
LWIP_UNUSED_ARG(buf);
|
||||
LWIP_UNUSED_ARG(err);
|
||||
@@ -1278,7 +1278,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
@@ -1407,7 +1407,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
return ERR_BUF;
|
||||
}
|
||||
|
||||
@ -120,10 +129,10 @@ index dee9230..17691f7 100644
|
||||
*datagram_len = buflen;
|
||||
}
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index 170c911..1eb459d 100644
|
||||
index 6261c86..5514295 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -599,6 +599,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
||||
@@ -614,6 +614,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
||||
UDP_STATS_INC(udp.rterr);
|
||||
return ERR_RTE;
|
||||
}
|
||||
@ -131,7 +140,7 @@ index 170c911..1eb459d 100644
|
||||
uint8_t apiflags = 0;
|
||||
|
||||
struct pbuf *udp_pbuf = write_lwip_data((struct lwip_sock *)(p->payload), p->tot_len, &apiflags);
|
||||
@@ -611,14 +612,21 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
||||
@@ -626,14 +627,21 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
||||
}
|
||||
|
||||
if (p->port) {
|
||||
@ -154,10 +163,10 @@ index 170c911..1eb459d 100644
|
||||
|
||||
/**
|
||||
diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h
|
||||
index d3c4f02..6090cab 100644
|
||||
index 6bf8b6a..6e6e52d 100644
|
||||
--- a/src/include/lwip/api.h
|
||||
+++ b/src/include/lwip/api.h
|
||||
@@ -338,6 +338,9 @@ err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
|
||||
@@ -373,6 +373,9 @@ err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
|
||||
err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf);
|
||||
err_t netconn_recv_udp_raw_netbuf(struct netconn *conn, struct netbuf **new_buf);
|
||||
err_t netconn_recv_udp_raw_netbuf_flags(struct netconn *conn, struct netbuf **new_buf, u8_t apiflags);
|
||||
@ -168,7 +177,7 @@ index d3c4f02..6090cab 100644
|
||||
err_t netconn_recv_tcp_pbuf_flags(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags);
|
||||
err_t netconn_tcp_recvd(struct netconn *conn, size_t len);
|
||||
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
|
||||
index 728c5e4..4747f39 100644
|
||||
index e08d4fa..9ce3500 100644
|
||||
--- a/src/include/lwip/pbuf.h
|
||||
+++ b/src/include/lwip/pbuf.h
|
||||
@@ -40,8 +40,10 @@
|
||||
@ -194,10 +203,10 @@ index 728c5e4..4747f39 100644
|
||||
|
||||
/** In case the user needs to store data custom data on a pbuf */
|
||||
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
|
||||
index 643093a..2b6e6be 100644
|
||||
index a7cec29..a50c691 100644
|
||||
--- a/src/include/lwip/sockets.h
|
||||
+++ b/src/include/lwip/sockets.h
|
||||
@@ -330,7 +330,7 @@ struct linger {
|
||||
@@ -333,7 +333,7 @@ struct linger {
|
||||
|
||||
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
@ -206,7 +215,7 @@ index 643093a..2b6e6be 100644
|
||||
#define IP_MULTICAST_IF 32
|
||||
#define IP_MULTICAST_TTL 33
|
||||
#define IP_MULTICAST_LOOP 34
|
||||
@@ -341,11 +341,11 @@ struct linger {
|
||||
@@ -344,11 +344,11 @@ struct linger {
|
||||
#define IP_MULTICAST_TTL 5
|
||||
#define IP_MULTICAST_IF 6
|
||||
#define IP_MULTICAST_LOOP 7
|
||||
@ -220,7 +229,7 @@ index 643093a..2b6e6be 100644
|
||||
#define IP_ADD_MEMBERSHIP 35
|
||||
#define IP_DROP_MEMBERSHIP 36
|
||||
#else
|
||||
@@ -354,7 +354,7 @@ struct linger {
|
||||
@@ -357,7 +357,7 @@ struct linger {
|
||||
*/
|
||||
#define IP_ADD_MEMBERSHIP 3
|
||||
#define IP_DROP_MEMBERSHIP 4
|
||||
@ -230,10 +239,10 @@ index 643093a..2b6e6be 100644
|
||||
typedef struct ip_mreq {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 6b5a2d1..9804aed 100644
|
||||
index abc3f15..50220e8 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -63,6 +63,10 @@
|
||||
@@ -56,6 +56,10 @@
|
||||
|
||||
#define GAZELLE_TCP_MIN_TSO_SEG_LEN 256
|
||||
|
||||
|
||||
@ -9,10 +9,10 @@ Signed-off-by: Lemmy Huang <huangliming5@huawei.com>
|
||||
1 file changed, 1 insertion(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 7e7d70ab..0abee303 100644
|
||||
index a952903..59e854c 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -1807,11 +1807,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
@@ -1780,11 +1780,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
|
||||
|
||||
/* Acknowledge the segment(s). */
|
||||
|
||||
@ -8,17 +8,17 @@ Subject: [PATCH] fix udp recvmbox size not set
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 6b5c769..f0df0e3 100644
|
||||
index 50220e8..1c27051 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -180,6 +180,7 @@
|
||||
@@ -174,6 +174,7 @@
|
||||
---------------------------------
|
||||
*/
|
||||
#define LWIP_UDP 1
|
||||
+#define DEFAULT_UDP_RECVMBOX_SIZE 4096
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ Subject: [PATCH] fix null pointer when all zero address listen
|
||||
1 file changed, 35 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 0abee30..c20c9b5 100644
|
||||
index 59e854c..d151a96 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -114,6 +114,36 @@ static void tcp_remove_sacks_gt(struct tcp_pcb *pcb, u32_t seq);
|
||||
@ -49,7 +49,7 @@ index 0abee30..c20c9b5 100644
|
||||
* The initial input processing of TCP. It verifies the TCP header, demultiplexes
|
||||
* the segment between the PCBs and passes it on to tcp_process(), which implements
|
||||
@@ -384,33 +414,15 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
if (ip_addr_cmp(&lpcb->local_ip, ip_current_dest_addr())) {
|
||||
if (ip_addr_eq(&lpcb->local_ip, ip_current_dest_addr())) {
|
||||
/* found an exact match */
|
||||
#if GAZELLE_TCP_REUSE_IPPORT
|
||||
- // check master fd
|
||||
|
||||
@ -21,10 +21,10 @@ index b48c926..2c5b31e 100644
|
||||
|
||||
static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len,
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index f0df0e3..2ba1e4c 100644
|
||||
index 1c27051..f44b541 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -180,6 +180,12 @@
|
||||
@@ -174,6 +174,12 @@
|
||||
---------------------------------
|
||||
*/
|
||||
#define LWIP_UDP 1
|
||||
@ -36,7 +36,7 @@ index f0df0e3..2ba1e4c 100644
|
||||
+
|
||||
#define DEFAULT_UDP_RECVMBOX_SIZE 4096
|
||||
|
||||
|
||||
/*
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ Subject: [PATCH] add CHECKSUM_UDP when not support OFFLOAD_UDP_CHECKSUM
|
||||
5 files changed, 43 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 62a6511..5014a21 100644
|
||||
index d151a96..c906082 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -210,7 +210,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -25,7 +25,7 @@ index 62a6511..5014a21 100644
|
||||
ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
|
||||
ip_current_src_addr(), ip_current_dest_addr());
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index 0b1fa65..d9db535 100644
|
||||
index 59e157d..06e21aa 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -412,9 +412,21 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -81,7 +81,7 @@ index 0b1fa65..d9db535 100644
|
||||
NETIF_RESET_HINTS(netif);
|
||||
|
||||
diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h
|
||||
index 2c5b31e..d092a1d 100644
|
||||
index 2c5b31e..5b1b6f6 100644
|
||||
--- a/src/include/dpdk_cksum.h
|
||||
+++ b/src/include/dpdk_cksum.h
|
||||
@@ -54,12 +54,12 @@ static inline u64_t is_cksum_ipbad(struct pbuf *p) {
|
||||
@ -147,10 +147,10 @@ index 43b254a..c90ddb8 100644
|
||||
#endif /* DPDK_VERSION_1911 */
|
||||
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 2ba1e4c..5ba123f 100644
|
||||
index f44b541..d2ad30b 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -71,18 +71,22 @@
|
||||
@@ -70,18 +70,22 @@
|
||||
// rx cksum
|
||||
#define CHECKSUM_CHECK_IP 1 /* master switch */
|
||||
#define CHECKSUM_CHECK_TCP 1 /* master switch */
|
||||
@ -173,8 +173,8 @@ index 2ba1e4c..5ba123f 100644
|
||||
-#define CHECKSUM_OFFLOAD_ALL (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW || CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW)
|
||||
+#define CHECKSUM_OFFLOAD_ALL (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW || CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW || CHECKSUM_CHECK_UDP_HW || CHECKSUM_GEN_UDP_HW)
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
From 28922406bbe13f9442a16e4b1ccc19f42e8ebb9b Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 17:26:46 +0800
|
||||
Subject: add O_NONBLOCK and FIONBIO when not defined
|
||||
|
||||
---
|
||||
src/include/lwipopts.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 5ba123f..baf739e 100644
|
||||
index d2ad30b..fbdcbf4 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -244,9 +244,13 @@
|
||||
@@ -236,9 +236,13 @@
|
||||
|
||||
#define SO_REUSE 1
|
||||
|
||||
@ -16,3 +25,6 @@ index 5ba123f..baf739e 100644
|
||||
|
||||
#define SIOCSHIWAT 1
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ Subject: [PATCH] gazelle offloads are registered to lwip
|
||||
9 files changed, 52 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
|
||||
index 402ba69..c3a877c 100644
|
||||
index 0a3b1c3..2984d24 100644
|
||||
--- a/src/core/ipv4/icmp.c
|
||||
+++ b/src/core/ipv4/icmp.c
|
||||
@@ -241,7 +241,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -29,10 +29,10 @@ index 402ba69..c3a877c 100644
|
||||
} else {
|
||||
iph_cksum_set(p, hlen, 0);
|
||||
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
|
||||
index 1b70bb5..1e3690f 100644
|
||||
index 42f4bd5..4335423 100644
|
||||
--- a/src/core/ipv4/ip4.c
|
||||
+++ b/src/core/ipv4/ip4.c
|
||||
@@ -509,7 +509,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
@@ -543,7 +543,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) {
|
||||
#if CHECKSUM_CHECK_IP_HW
|
||||
u64_t ret;
|
||||
@ -41,7 +41,7 @@ index 1b70bb5..1e3690f 100644
|
||||
ret = is_cksum_ipbad(p);
|
||||
} else {
|
||||
ret = (u64_t)inet_chksum(iphdr, iphdr_hlen);
|
||||
@@ -986,7 +986,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
@@ -1020,7 +1020,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
#if CHECKSUM_GEN_IP
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
|
||||
#if CHECKSUM_GEN_IP_HW
|
||||
@ -50,7 +50,7 @@ index 1b70bb5..1e3690f 100644
|
||||
iph_cksum_set(p, ip_hlen, 1);
|
||||
} else {
|
||||
iph_cksum_set(p, ip_hlen, 0);
|
||||
@@ -1035,7 +1035,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
@@ -1069,7 +1069,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
#if IP_FRAG
|
||||
/* don't fragment if interface has mtu set to 0 [loopif] */
|
||||
#if GAZELLE_ENABLE
|
||||
@ -60,7 +60,7 @@ index 1b70bb5..1e3690f 100644
|
||||
if (netif->mtu && (p->tot_len > netif->mtu)) {
|
||||
return ip4_frag(p, netif, dest);
|
||||
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
|
||||
index e01ea51..f63a99e 100644
|
||||
index b2462d2..b594f29 100644
|
||||
--- a/src/core/ipv4/ip4_frag.c
|
||||
+++ b/src/core/ipv4/ip4_frag.c
|
||||
@@ -642,7 +642,7 @@ ip4_reass(struct pbuf *p)
|
||||
@ -82,10 +82,10 @@ index e01ea51..f63a99e 100644
|
||||
} else {
|
||||
iph_cksum_set(p, IP_HLEN, 0);
|
||||
diff --git a/src/core/netif.c b/src/core/netif.c
|
||||
index 86b74a0..eb59fbc 100644
|
||||
index db3c718..8a1ccec 100644
|
||||
--- a/src/core/netif.c
|
||||
+++ b/src/core/netif.c
|
||||
@@ -1049,6 +1049,26 @@ netif_set_link_down(struct netif *netif)
|
||||
@@ -1085,6 +1085,26 @@ netif_set_link_down(struct netif *netif)
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ index 86b74a0..eb59fbc 100644
|
||||
/**
|
||||
* @ingroup netif
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 736845c..07203e5 100644
|
||||
index c906082..dcfb2b5 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -209,7 +209,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -126,10 +126,10 @@ index 736845c..07203e5 100644
|
||||
} else {
|
||||
ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index 547d01e..e2c9d63 100644
|
||||
index 65511ac..4bf3bfd 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -1448,7 +1448,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1451,7 +1451,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
|
||||
/* data available and window allows it to be sent? */
|
||||
#if GAZELLE_ENABLE
|
||||
@ -138,7 +138,7 @@ index 547d01e..e2c9d63 100644
|
||||
uint16_t send_pkt = 0;
|
||||
|
||||
do {
|
||||
@@ -1831,7 +1831,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
@@ -1834,7 +1834,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
#if CHECKSUM_GEN_TCP
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
#if CHECKSUM_GEN_TCP_HW
|
||||
@ -147,9 +147,9 @@ index 547d01e..e2c9d63 100644
|
||||
tcph_cksum_set(seg->p, TCPH_HDRLEN_BYTES(seg->tcphdr));
|
||||
seg->tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP,seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip);
|
||||
} else {
|
||||
@@ -2273,7 +2273,7 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
@@ -2293,7 +2293,7 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
#if CHECKSUM_GEN_TCP_HW
|
||||
- if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) {
|
||||
+ if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_CKSUM) {
|
||||
@ -157,7 +157,7 @@ index 547d01e..e2c9d63 100644
|
||||
tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP, p->tot_len, src, dst);
|
||||
} else {
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index 5c6dadb..937a045 100644
|
||||
index bac011a..ff20ced 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -414,7 +414,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -192,7 +192,7 @@ index 5b1b6f6..b8056f9 100644
|
||||
// for ip4_input
|
||||
static inline u64_t is_cksum_ipbad(struct pbuf *p) {
|
||||
diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h
|
||||
index 057c51f..75f8d50 100644
|
||||
index 1e6dc46..502a151 100644
|
||||
--- a/src/include/lwip/netif.h
|
||||
+++ b/src/include/lwip/netif.h
|
||||
@@ -106,6 +106,11 @@ extern "C" {
|
||||
@ -207,7 +207,7 @@ index 057c51f..75f8d50 100644
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -343,6 +348,10 @@ struct netif {
|
||||
@@ -352,6 +357,10 @@ struct netif {
|
||||
u8_t hwaddr_len;
|
||||
/** flags (@see @ref netif_flags) */
|
||||
u8_t flags;
|
||||
@ -217,8 +217,8 @@ index 057c51f..75f8d50 100644
|
||||
+#endif
|
||||
/** descriptive abbreviation */
|
||||
char name[2];
|
||||
/** number of this interface. Used for @ref if_api and @ref netifapi_netif,
|
||||
@@ -464,6 +473,17 @@ void netif_set_down(struct netif *netif);
|
||||
/** number of this interface. Used for @ref if_api and @ref netifapi_netif,
|
||||
@@ -478,6 +487,17 @@ void netif_set_down(struct netif *netif);
|
||||
*/
|
||||
#define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
|
||||
|
||||
|
||||
@ -15,10 +15,10 @@ Subject: [PATCH] adapt read/write for rtc mode
|
||||
8 files changed, 174 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index 3e982ab..d8b99ee 100644
|
||||
index 0f26119..2556901 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -1753,11 +1753,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
|
||||
@@ -1754,11 +1754,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
|
||||
write_more = 0;
|
||||
}
|
||||
#if GAZELLE_ENABLE
|
||||
@ -40,10 +40,10 @@ index 3e982ab..d8b99ee 100644
|
||||
#else
|
||||
err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags);
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 8d573aa..e374f96 100644
|
||||
index 833b27f..a07fb59 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -1087,7 +1087,15 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
@@ -1124,7 +1124,15 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
apiflags |= NETCONN_DONTBLOCK;
|
||||
}
|
||||
|
||||
@ -60,11 +60,10 @@ index 8d573aa..e374f96 100644
|
||||
do {
|
||||
struct pbuf *p;
|
||||
err_t err;
|
||||
@@ -1166,15 +1174,10 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
@@ -1203,14 +1211,10 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
apiflags |= NETCONN_DONTBLOCK | NETCONN_NOFIN;
|
||||
/* @todo: do we need to support peeking more than one pbuf? */
|
||||
} while ((recv_left > 0) && !(flags & MSG_PEEK));
|
||||
-
|
||||
-lwip_recv_tcp_done:
|
||||
-#else /* GAZELLE_ENABLE */
|
||||
- LWIP_UNUSED_ARG(recv_left);
|
||||
@ -73,19 +72,18 @@ index 8d573aa..e374f96 100644
|
||||
- return recvd;
|
||||
+#if GAZELLE_ENABLE
|
||||
}
|
||||
-#endif /* GAZELLE_ENABLE */
|
||||
+#endif
|
||||
#endif /* GAZELLE_ENABLE */
|
||||
+lwip_recv_tcp_done:
|
||||
if (apiflags & NETCONN_NOAUTORCVD) {
|
||||
if ((recvd > 0) && !(flags & MSG_PEEK)) {
|
||||
/* ensure window update after copying all data */
|
||||
diff --git a/src/core/init.c b/src/core/init.c
|
||||
index 7b6214f..60e1c68 100644
|
||||
index 6841857..5b60ed8 100644
|
||||
--- a/src/core/init.c
|
||||
+++ b/src/core/init.c
|
||||
@@ -306,7 +306,7 @@ PACK_STRUCT_END
|
||||
#if TCP_SNDLOWAT >= TCP_SND_BUF
|
||||
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
|
||||
@@ -312,7 +312,7 @@ PACK_STRUCT_END
|
||||
#if TCP_MSS >= ((16 * 1024) - 1)
|
||||
#error "lwip_sanity_check: WARNING: TCP_MSS must be <= 16382 to prevent u16_t underflow in TCP_SNDLOWAT calculation!"
|
||||
#endif
|
||||
-#if TCP_SNDLOWAT >= (0xFFFFFFFF - (4 * TCP_MSS))
|
||||
+#if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS))
|
||||
@ -93,7 +91,7 @@ index 7b6214f..60e1c68 100644
|
||||
#endif
|
||||
#if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN
|
||||
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
|
||||
index 975e240..61690ff 100644
|
||||
index 3c04281..8386c90 100644
|
||||
--- a/src/core/pbuf.c
|
||||
+++ b/src/core/pbuf.c
|
||||
@@ -117,6 +117,7 @@ pbuf_skip_const(const struct pbuf *in, u16_t in_offset, u16_t *out_offset);
|
||||
@ -132,10 +130,10 @@ index 975e240..61690ff 100644
|
||||
}
|
||||
case PBUF_RAM: {
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index e2c9d63..073d989 100644
|
||||
index 4bf3bfd..4e7aac0 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -515,15 +515,18 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -518,15 +518,18 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
* pos records progress as data is segmented.
|
||||
*/
|
||||
|
||||
@ -155,7 +153,7 @@ index e2c9d63..073d989 100644
|
||||
|
||||
/* Usable space at the end of the last unsent segment */
|
||||
unsent_optlen = LWIP_TCP_OPT_LENGTH_SEGMENT(last_unsent->flags, pcb);
|
||||
@@ -631,9 +634,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -634,9 +637,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
pcb->unsent_oversize == 0);
|
||||
#endif /* TCP_OVERSIZE */
|
||||
}
|
||||
@ -165,7 +163,7 @@ index e2c9d63..073d989 100644
|
||||
|
||||
/*
|
||||
* Phase 3: Create new segments.
|
||||
@@ -651,7 +651,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -654,7 +654,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
u8_t chksum_swapped = 0;
|
||||
#endif /* TCP_CHECKSUM_ON_COPY */
|
||||
|
||||
@ -173,7 +171,7 @@ index e2c9d63..073d989 100644
|
||||
if (apiflags & TCP_WRITE_FLAG_COPY) {
|
||||
/* If copy is set, memory should be allocated and data copied
|
||||
* into pbuf */
|
||||
@@ -698,13 +697,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -701,13 +700,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
/* Concatenate the headers and data pbufs together. */
|
||||
pbuf_cat(p/*header*/, p2/*data*/);
|
||||
}
|
||||
@ -187,7 +185,7 @@ index e2c9d63..073d989 100644
|
||||
|
||||
queuelen += pbuf_clen(p);
|
||||
|
||||
@@ -714,14 +706,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -717,14 +709,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
if (queuelen > LWIP_MIN(TCP_SND_QUEUELEN, TCP_SNDQUEUELEN_OVERFLOW)) {
|
||||
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write: queue too long %"U16_F" (%d)\n",
|
||||
queuelen, (int)TCP_SND_QUEUELEN));
|
||||
@ -202,7 +200,7 @@ index e2c9d63..073d989 100644
|
||||
goto memerr;
|
||||
}
|
||||
|
||||
@@ -730,12 +715,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -733,12 +718,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
#endif
|
||||
|
||||
if ((seg = tcp_create_segment(pcb, p, 0, pcb->snd_lbb + pos, optflags)) == NULL) {
|
||||
@ -215,7 +213,7 @@ index e2c9d63..073d989 100644
|
||||
goto memerr;
|
||||
}
|
||||
#if TCP_OVERSIZE_DBGCHECK
|
||||
@@ -763,9 +742,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -766,9 +745,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
lwip_ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg)));
|
||||
|
||||
pos += seglen;
|
||||
@ -225,7 +223,7 @@ index e2c9d63..073d989 100644
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -855,12 +831,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
@@ -858,12 +834,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
||||
if (queue) {
|
||||
pcb->last_unsent = prev_seg;
|
||||
}
|
||||
@ -239,7 +237,7 @@ index e2c9d63..073d989 100644
|
||||
pcb->snd_queuelen = queuelen;
|
||||
|
||||
LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_write: %"S16_F" (after enqueued)\n",
|
||||
@@ -880,14 +853,12 @@ memerr:
|
||||
@@ -883,14 +856,12 @@ memerr:
|
||||
tcp_set_flags(pcb, TF_NAGLEMEMERR);
|
||||
TCP_STATS_INC(tcp.memerr);
|
||||
|
||||
@ -254,7 +252,7 @@ index e2c9d63..073d989 100644
|
||||
if (pcb->snd_queuelen != 0) {
|
||||
LWIP_ASSERT("tcp_write: valid queue length", pcb->unacked != NULL ||
|
||||
pcb->unsent != NULL);
|
||||
@@ -896,6 +867,137 @@ memerr:
|
||||
@@ -899,6 +870,137 @@ memerr:
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
@ -392,7 +390,7 @@ index e2c9d63..073d989 100644
|
||||
/**
|
||||
* Split segment on the head of the unsent queue. If return is not
|
||||
* ERR_OK, existing head remains intact
|
||||
@@ -2095,6 +2197,7 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
@@ -2098,6 +2200,7 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
|
||||
/* Don't take any rtt measurements after retransmitting. */
|
||||
pcb->rttest = 0;
|
||||
@ -401,7 +399,7 @@ index e2c9d63..073d989 100644
|
||||
/* Do the actual retransmission. */
|
||||
MIB2_STATS_INC(mib2.tcpretranssegs);
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index 937a045..828a489 100644
|
||||
index ff20ced..f38619b 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -414,7 +414,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -414,10 +412,10 @@ index 937a045..828a489 100644
|
||||
} else {
|
||||
ret = ip_chksum_pseudo(p, IP_PROTO_UDP, p->tot_len,
|
||||
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
|
||||
index e13099c..959df3e 100644
|
||||
index f968441..460df21 100644
|
||||
--- a/src/include/lwip/tcp.h
|
||||
+++ b/src/include/lwip/tcp.h
|
||||
@@ -567,6 +567,10 @@ err_t tcp_shutdown(struct tcp_pcb *pcb, int shut_rx, int shut_tx);
|
||||
@@ -566,6 +566,10 @@ err_t tcp_shutdown(struct tcp_pcb *pcb, int shut_rx, int shut_tx);
|
||||
|
||||
err_t tcp_write (struct tcp_pcb *pcb, const void *dataptr, u16_t len,
|
||||
u8_t apiflags);
|
||||
@ -429,10 +427,10 @@ index e13099c..959df3e 100644
|
||||
void tcp_setprio (struct tcp_pcb *pcb, u8_t prio);
|
||||
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index baf739e..fdd4f87 100644
|
||||
index fbdcbf4..4ae37f5 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -208,8 +208,8 @@
|
||||
@@ -201,8 +201,8 @@
|
||||
#define TCP_LISTEN_BACKLOG 1
|
||||
#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
|
||||
|
||||
@ -443,7 +441,7 @@ index baf739e..fdd4f87 100644
|
||||
|
||||
#define TCP_MSS (FRAME_MTU - IP_HLEN - TCP_HLEN)
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
@@ -212,7 +212,7 @@
|
||||
|
||||
#define TCP_SND_QUEUELEN (8191)
|
||||
|
||||
|
||||
@ -8,10 +8,10 @@ Subject: [PATCH 76/77] fix recvmsg return EINVAL
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index b6c7b05..1d71427 100644
|
||||
index a07fb59..575e298 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -1492,9 +1492,21 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
|
||||
@@ -1535,9 +1535,21 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
|
||||
/* check for valid vectors */
|
||||
buflen = 0;
|
||||
for (i = 0; i < message->msg_iovlen; i++) {
|
||||
@ -30,7 +30,7 @@ index b6c7b05..1d71427 100644
|
||||
+#else
|
||||
((ssize_t)(buflen + (ssize_t)message->msg_iov[i].iov_len) <= 0)) {
|
||||
+#endif
|
||||
sock_set_errno(sock, err_to_errno(ERR_VAL));
|
||||
set_errno(err_to_errno(ERR_VAL));
|
||||
done_socket(sock);
|
||||
return -1;
|
||||
--
|
||||
|
||||
@ -23,10 +23,10 @@ Subject: [PATCH] enable ipv6
|
||||
16 files changed, 107 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 6cff4cb..62052f2 100644
|
||||
index c4be6a8..6a9946a 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -113,6 +113,14 @@
|
||||
@@ -158,6 +158,14 @@
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
#if LWIP_IPV6
|
||||
@ -39,9 +39,9 @@ index 6cff4cb..62052f2 100644
|
||||
+ (sin6)->sin6_scope_id = ip6_addr_zone(ipaddr); }while(0)
|
||||
+#else
|
||||
#define IP6ADDR_PORT_TO_SOCKADDR(sin6, ipaddr, port) do { \
|
||||
(sin6)->sin6_len = sizeof(struct sockaddr_in6); \
|
||||
IP6ADDR_SOCKADDR_SET_LEN(sin6); \
|
||||
(sin6)->sin6_family = AF_INET6; \
|
||||
@@ -120,6 +128,7 @@
|
||||
@@ -165,6 +173,7 @@
|
||||
(sin6)->sin6_flowinfo = 0; \
|
||||
inet6_addr_from_ip6addr(&(sin6)->sin6_addr, ipaddr); \
|
||||
(sin6)->sin6_scope_id = ip6_addr_zone(ipaddr); }while(0)
|
||||
@ -49,7 +49,7 @@ index 6cff4cb..62052f2 100644
|
||||
#define SOCKADDR6_TO_IP6ADDR_PORT(sin6, ipaddr, port) do { \
|
||||
inet6_addr_to_ip6addr(ip_2_ip6(ipaddr), &((sin6)->sin6_addr)); \
|
||||
if (ip6_addr_has_scope(ip_2_ip6(ipaddr), IP6_UNKNOWN)) { \
|
||||
@@ -555,7 +564,8 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
@@ -595,7 +604,8 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
LWIP_UNUSED_ARG(accepted);
|
||||
|
||||
#if GAZELLE_ENABLE
|
||||
@ -74,10 +74,10 @@ index 57a9670..69b43d1 100644
|
||||
|
||||
$(eval $(call register_dir, core, $(SRC)))
|
||||
diff --git a/src/core/init.c b/src/core/init.c
|
||||
index 60e1c68..6880fd3 100644
|
||||
index 5b60ed8..36d7093 100644
|
||||
--- a/src/core/init.c
|
||||
+++ b/src/core/init.c
|
||||
@@ -347,7 +347,9 @@ lwip_init(void)
|
||||
@@ -353,7 +353,9 @@ lwip_init(void)
|
||||
mem_init();
|
||||
memp_init();
|
||||
pbuf_init();
|
||||
@ -88,7 +88,7 @@ index 60e1c68..6880fd3 100644
|
||||
ip_init();
|
||||
#if LWIP_ARP
|
||||
diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c
|
||||
index 9d904ec..101e599 100644
|
||||
index fad4f40..09b2f80 100644
|
||||
--- a/src/core/ipv6/ip6.c
|
||||
+++ b/src/core/ipv6/ip6.c
|
||||
@@ -60,6 +60,10 @@
|
||||
@ -132,7 +132,7 @@ index 9d904ec..101e599 100644
|
||||
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("netif->output_ip6()\n"));
|
||||
diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c
|
||||
index 8b352f5..67e36bf 100644
|
||||
index 16bcf95..5ff6724 100644
|
||||
--- a/src/core/ipv6/ip6_frag.c
|
||||
+++ b/src/core/ipv6/ip6_frag.c
|
||||
@@ -689,6 +689,7 @@ ip6_frag_free_pbuf_custom_ref(struct pbuf_custom_ref* p)
|
||||
@ -162,7 +162,7 @@ index 8b352f5..67e36bf 100644
|
||||
/* Add it to end of rambuf's chain, but using pbuf_cat, not pbuf_chain
|
||||
* so that it is removed when pbuf_dechain is later called on rambuf.
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index c44664e..963b8a4 100644
|
||||
index 34e99df..1d02574 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -1155,7 +1155,7 @@ tcp_new_port(void)
|
||||
@ -175,7 +175,7 @@ index c44664e..963b8a4 100644
|
||||
__atomic_store_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE);
|
||||
break;
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index ecbd616..7154659 100644
|
||||
index dcfb2b5..9b1ec9c 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -309,8 +309,8 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -190,10 +190,10 @@ index ecbd616..7154659 100644
|
||||
head = &tcp_active_htable->array[idx].chain;
|
||||
tcppcb_hlist_for_each(pcb, node, head) {
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index 073d989..137e3cf 100644
|
||||
index 4e7aac0..a2d72b3 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -139,7 +139,9 @@ static err_t tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct
|
||||
@@ -142,7 +142,9 @@ static err_t tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct
|
||||
static struct netif *
|
||||
tcp_route(const struct tcp_pcb *pcb, const ip_addr_t *src, const ip_addr_t *dst)
|
||||
{
|
||||
@ -204,7 +204,7 @@ index 073d989..137e3cf 100644
|
||||
if ((pcb != NULL) && (pcb->netif_idx != NETIF_NO_INDEX)) {
|
||||
return netif_get_by_index(pcb->netif_idx);
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index 828a489..727a705 100644
|
||||
index f38619b..02ffe36 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -132,7 +132,7 @@ udp_new_port(struct udp_pcb *dst_pcb)
|
||||
@ -264,7 +264,7 @@ index c90ddb8..e61d0b3 100644
|
||||
#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
|
||||
#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG
|
||||
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
|
||||
index ddae3fd..9b1341c 100644
|
||||
index 537683f..75c67ee 100644
|
||||
--- a/src/include/lwip/priv/tcp_priv.h
|
||||
+++ b/src/include/lwip/priv/tcp_priv.h
|
||||
@@ -347,11 +347,24 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
|
||||
@ -309,10 +309,10 @@ index ddae3fd..9b1341c 100644
|
||||
hd = &htb->array[idx].chain; \
|
||||
hlist_add_head(&(npcb)->tcp_node, hd); \
|
||||
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
|
||||
index cfec6a5..5715df4 100644
|
||||
index a50c691..89b6eb5 100644
|
||||
--- a/src/include/lwip/sockets.h
|
||||
+++ b/src/include/lwip/sockets.h
|
||||
@@ -88,7 +88,9 @@ struct sockaddr_in {
|
||||
@@ -95,7 +95,9 @@ struct sockaddr_in {
|
||||
|
||||
#if LWIP_IPV6
|
||||
struct sockaddr_in6 {
|
||||
@ -323,10 +323,10 @@ index cfec6a5..5715df4 100644
|
||||
in_port_t sin6_port; /* Transport layer port # */
|
||||
u32_t sin6_flowinfo; /* IPv6 flow information */
|
||||
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
|
||||
index 959df3e..91a86c9 100644
|
||||
index 460df21..bde17ec 100644
|
||||
--- a/src/include/lwip/tcp.h
|
||||
+++ b/src/include/lwip/tcp.h
|
||||
@@ -476,7 +476,26 @@ static inline unsigned int jhash_3words(unsigned int a, unsigned int b, unsigned
|
||||
@@ -475,7 +475,26 @@ static inline unsigned int jhash_3words(unsigned int a, unsigned int b, unsigned
|
||||
return c;
|
||||
}
|
||||
|
||||
@ -355,12 +355,12 @@ index 959df3e..91a86c9 100644
|
||||
#define tcppcb_hlist_for_each(tcppcb, node, list) \
|
||||
hlist_for_each_entry(tcppcb, node, list, tcp_node)
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index a18179e..9ab5cde 100644
|
||||
index 985e13e..0c87c44 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -178,6 +178,14 @@
|
||||
#define IP_HLEN 20
|
||||
@@ -172,6 +172,14 @@
|
||||
|
||||
#define IP_HLEN 20
|
||||
|
||||
+/*
|
||||
+ -------------------------------------
|
||||
@ -373,7 +373,7 @@ index a18179e..9ab5cde 100644
|
||||
/*
|
||||
---------------------------------
|
||||
---------- UDP options ----------
|
||||
@@ -211,7 +219,7 @@
|
||||
@@ -204,7 +212,7 @@
|
||||
#define TCP_OVERSIZE TCP_MSS
|
||||
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
||||
|
||||
@ -382,7 +382,7 @@ index a18179e..9ab5cde 100644
|
||||
|
||||
#define TCP_WND (2500 * TCP_MSS)
|
||||
|
||||
@@ -263,5 +271,6 @@
|
||||
@@ -255,5 +263,6 @@
|
||||
|
||||
#define ETHARP_SUPPORT_VLAN 1
|
||||
#define LWIP_VLAN_PCP 1
|
||||
|
||||
@ -1,7 +1,25 @@
|
||||
diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
--- lwip-ipv6/src/core/ipv6/ip6.c 2023-11-15 19:48:02.864481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/core/ipv6/ip6.c 2023-11-15 20:05:30.388481010 +0800
|
||||
@@ -367,7 +367,7 @@
|
||||
From 1a746c8c1c04d6ac39aa7b02d420cb0368baf08f Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 17:34:46 +0800
|
||||
Subject: ip6 hdr
|
||||
|
||||
---
|
||||
src/core/ipv6/ip6.c | 28 ++++++++++++++--------------
|
||||
src/core/ipv6/ip6_frag.c | 16 ++++++++--------
|
||||
src/core/ipv6/nd6.c | 10 +++++-----
|
||||
src/core/raw.c | 2 +-
|
||||
src/include/lwip/ip.h | 6 +++---
|
||||
src/include/lwip/ip6_frag.h | 2 +-
|
||||
src/include/lwip/prot/ip6.h | 2 +-
|
||||
src/netif/lowpan6.c | 4 ++--
|
||||
src/netif/lowpan6_common.c | 8 ++++----
|
||||
9 files changed, 39 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c
|
||||
index 09b2f80..5f16cd0 100644
|
||||
--- a/src/core/ipv6/ip6.c
|
||||
+++ b/src/core/ipv6/ip6.c
|
||||
@@ -367,7 +367,7 @@ ip6_select_source_address(struct netif *netif, const ip6_addr_t *dest)
|
||||
* @param inp the netif on which this packet was received
|
||||
*/
|
||||
static void
|
||||
@ -10,7 +28,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
{
|
||||
struct netif *netif;
|
||||
|
||||
@@ -512,7 +512,7 @@
|
||||
@@ -512,7 +512,7 @@ ip6_input_accept(struct netif *netif)
|
||||
err_t
|
||||
ip6_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
@ -19,7 +37,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
struct netif *netif;
|
||||
const u8_t *nexth;
|
||||
u16_t hlen, hlen_tot; /* the current header length */
|
||||
@@ -531,7 +531,7 @@
|
||||
@@ -531,7 +531,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
||||
IP6_STATS_INC(ip6.recv);
|
||||
|
||||
/* identify the IP header */
|
||||
@ -28,7 +46,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
if (IP6H_V(ip6hdr) != 6) {
|
||||
LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_WARNING, ("IPv6 packet dropped due to bad version number %"U32_F"\n",
|
||||
IP6H_V(ip6hdr)));
|
||||
@@ -1015,7 +1015,7 @@
|
||||
@@ -1019,7 +1019,7 @@ netif_found:
|
||||
|
||||
/* Returned p point to IPv6 header.
|
||||
* Update all our variables and pointers and continue. */
|
||||
@ -37,7 +55,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
nexth = &IP6H_NEXTH(ip6hdr);
|
||||
hlen = hlen_tot = IP6_HLEN;
|
||||
pbuf_remove_header(p, IP6_HLEN);
|
||||
@@ -1188,7 +1188,7 @@
|
||||
@@ -1188,7 +1188,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
u8_t hl, u8_t tc,
|
||||
u8_t nexth, struct netif *netif)
|
||||
{
|
||||
@ -46,7 +64,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
ip6_addr_t dest_addr;
|
||||
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
@@ -1217,9 +1217,9 @@
|
||||
@@ -1217,9 +1217,9 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
return ERR_BUF;
|
||||
}
|
||||
|
||||
@ -59,7 +77,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
|
||||
IP6H_HOPLIM_SET(ip6hdr, hl);
|
||||
IP6H_NEXTH_SET(ip6hdr, nexth);
|
||||
@@ -1242,7 +1242,7 @@
|
||||
@@ -1242,7 +1242,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
|
||||
} else {
|
||||
/* IP header already included in p */
|
||||
@ -68,7 +86,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
|
||||
ip6_addr_assign_zone(&dest_addr, IP6_UNKNOWN, netif);
|
||||
dest = &dest_addr;
|
||||
@@ -1316,7 +1316,7 @@
|
||||
@@ -1316,7 +1316,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
u8_t hl, u8_t tc, u8_t nexth)
|
||||
{
|
||||
struct netif *netif;
|
||||
@ -77,7 +95,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
ip6_addr_t src_addr, dest_addr;
|
||||
|
||||
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
|
||||
@@ -1325,7 +1325,7 @@
|
||||
@@ -1325,7 +1325,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
netif = ip6_route(src, dest);
|
||||
} else {
|
||||
/* IP header included in p, read addresses. */
|
||||
@ -86,7 +104,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
ip6_addr_copy_from_packed(src_addr, ip6hdr->src);
|
||||
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
|
||||
netif = ip6_route(&src_addr, &dest_addr);
|
||||
@@ -1375,7 +1375,7 @@
|
||||
@@ -1375,7 +1375,7 @@ ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
u8_t hl, u8_t tc, u8_t nexth, struct netif_hint *netif_hint)
|
||||
{
|
||||
struct netif *netif;
|
||||
@ -95,7 +113,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
ip6_addr_t src_addr, dest_addr;
|
||||
err_t err;
|
||||
|
||||
@@ -1385,7 +1385,7 @@
|
||||
@@ -1385,7 +1385,7 @@ ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
netif = ip6_route(src, dest);
|
||||
} else {
|
||||
/* IP header included in p, read addresses. */
|
||||
@ -104,7 +122,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
ip6_addr_copy_from_packed(src_addr, ip6hdr->src);
|
||||
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
|
||||
netif = ip6_route(&src_addr, &dest_addr);
|
||||
@@ -1476,7 +1476,7 @@
|
||||
@@ -1476,7 +1476,7 @@ ip6_options_add_hbh_ra(struct pbuf *p, u8_t nexth, u8_t value)
|
||||
void
|
||||
ip6_debug_print(struct pbuf *p)
|
||||
{
|
||||
@ -113,10 +131,11 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
|
||||
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("IPv6 header:\n"));
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("+-------------------------------+\n"));
|
||||
diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_frag.c
|
||||
--- lwip-ipv6/src/core/ipv6/ip6_frag.c 2023-11-15 19:48:02.864481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/core/ipv6/ip6_frag.c 2023-11-15 20:01:41.668481010 +0800
|
||||
@@ -551,7 +551,7 @@
|
||||
diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c
|
||||
index 5ff6724..78bcb2a 100644
|
||||
--- a/src/core/ipv6/ip6_frag.c
|
||||
+++ b/src/core/ipv6/ip6_frag.c
|
||||
@@ -551,7 +551,7 @@ ip6_reass(struct pbuf *p)
|
||||
|
||||
if (valid) {
|
||||
/* All fragments have been received */
|
||||
@ -125,7 +144,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
|
||||
|
||||
/* chain together the pbufs contained within the ip6_reassdata list. */
|
||||
iprh = (struct ip6_reass_helper*) ipr->p->payload;
|
||||
@@ -565,7 +565,7 @@
|
||||
@@ -565,7 +565,7 @@ ip6_reass(struct pbuf *p)
|
||||
pbuf_remove_header(next_pbuf, IP6_FRAG_HLEN);
|
||||
#if IPV6_FRAG_COPYHEADER
|
||||
if (IPV6_FRAG_REQROOM > 0) {
|
||||
@ -134,7 +153,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
|
||||
u8_t hdrerr = pbuf_remove_header(next_pbuf, IPV6_FRAG_REQROOM);
|
||||
LWIP_UNUSED_ARG(hdrerr); /* in case of LWIP_NOASSERT */
|
||||
LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == 0);
|
||||
@@ -610,7 +610,7 @@
|
||||
@@ -610,7 +610,7 @@ ip6_reass(struct pbuf *p)
|
||||
(size_t)((u8_t*)p->payload - (u8_t*)ipr->iphdr));
|
||||
|
||||
/* This is where the IPv6 header is now. */
|
||||
@ -143,7 +162,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
|
||||
sizeof(struct ip6_frag_hdr));
|
||||
|
||||
/* Adjust datagram length by adding header lengths. */
|
||||
@@ -721,8 +721,8 @@
|
||||
@@ -721,8 +721,8 @@ ip6_frag_free_pbuf_custom(struct pbuf *p)
|
||||
err_t
|
||||
ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
|
||||
{
|
||||
@ -154,7 +173,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
|
||||
struct ip6_frag_hdr *frag_hdr;
|
||||
struct pbuf *rambuf;
|
||||
#if !LWIP_NETIF_TX_SINGLE_PBUF
|
||||
@@ -740,7 +740,7 @@
|
||||
@@ -740,7 +740,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
|
||||
|
||||
identification++;
|
||||
|
||||
@ -163,7 +182,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
|
||||
|
||||
/* @todo we assume there are no options in the unfragmentable part (IPv6 header). */
|
||||
LWIP_ASSERT("p->tot_len >= IP6_HLEN", p->tot_len >= IP6_HLEN);
|
||||
@@ -769,7 +769,7 @@
|
||||
@@ -769,7 +769,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
|
||||
}
|
||||
/* fill in the IP header */
|
||||
SMEMCPY(rambuf->payload, original_ip6hdr, IP6_HLEN);
|
||||
@ -172,7 +191,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
|
||||
frag_hdr = (struct ip6_frag_hdr *)((u8_t*)rambuf->payload + IP6_HLEN);
|
||||
#else
|
||||
/* When not using a static buffer, create a chain of pbufs.
|
||||
@@ -785,7 +785,7 @@
|
||||
@@ -785,7 +785,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
|
||||
LWIP_ASSERT("this needs a pbuf in one piece!",
|
||||
(rambuf->len >= (IP6_HLEN)));
|
||||
SMEMCPY(rambuf->payload, original_ip6hdr, IP6_HLEN);
|
||||
@ -181,10 +200,11 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
|
||||
frag_hdr = (struct ip6_frag_hdr *)((u8_t*)rambuf->payload + IP6_HLEN);
|
||||
|
||||
/* Can just adjust p directly for needed offset. */
|
||||
diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
|
||||
--- lwip-ipv6/src/core/ipv6/nd6.c 2023-11-15 19:48:02.864481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/core/ipv6/nd6.c 2023-11-15 20:06:47.036481010 +0800
|
||||
@@ -895,7 +895,7 @@
|
||||
diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c
|
||||
index 3b13c21..970ce40 100644
|
||||
--- a/src/core/ipv6/nd6.c
|
||||
+++ b/src/core/ipv6/nd6.c
|
||||
@@ -910,7 +910,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
case ICMP6_TYPE_PTB: /* Packet too big */
|
||||
{
|
||||
struct icmp6_hdr *icmp6hdr; /* Packet too big message */
|
||||
@ -193,7 +213,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
|
||||
u32_t pmtu;
|
||||
ip6_addr_t destination_address;
|
||||
|
||||
@@ -909,7 +909,7 @@
|
||||
@@ -924,7 +924,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
||||
}
|
||||
|
||||
icmp6hdr = (struct icmp6_hdr *)p->payload;
|
||||
@ -202,7 +222,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
|
||||
|
||||
/* Create an aligned, zoned copy of the destination address. */
|
||||
ip6_addr_copy_from_packed(destination_address, ip6hdr->dest);
|
||||
@@ -2187,7 +2187,7 @@
|
||||
@@ -2212,7 +2212,7 @@ nd6_free_q(struct nd6_q_entry *q)
|
||||
static void
|
||||
nd6_send_q(s8_t i)
|
||||
{
|
||||
@ -211,7 +231,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
|
||||
ip6_addr_t dest;
|
||||
#if LWIP_ND6_QUEUEING
|
||||
struct nd6_q_entry *q;
|
||||
@@ -2204,7 +2204,7 @@
|
||||
@@ -2229,7 +2229,7 @@ nd6_send_q(s8_t i)
|
||||
/* pop first item off the queue */
|
||||
neighbor_cache[i].q = q->next;
|
||||
/* Get ipv6 header. */
|
||||
@ -220,7 +240,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
|
||||
/* Create an aligned copy. */
|
||||
ip6_addr_copy_from_packed(dest, ip6hdr->dest);
|
||||
/* Restore the zone, if applicable. */
|
||||
@@ -2219,7 +2219,7 @@
|
||||
@@ -2245,7 +2245,7 @@ nd6_send_q(s8_t i)
|
||||
#else /* LWIP_ND6_QUEUEING */
|
||||
if (neighbor_cache[i].q != NULL) {
|
||||
/* Get ipv6 header. */
|
||||
@ -229,10 +249,11 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
|
||||
/* Create an aligned copy. */
|
||||
ip6_addr_copy_from_packed(dest, ip6hdr->dest);
|
||||
/* Restore the zone, if applicable. */
|
||||
diff -Nur lwip-ipv6/src/core/raw.c lwip-ipv6-hdr/src/core/raw.c
|
||||
--- lwip-ipv6/src/core/raw.c 2023-11-15 19:48:02.860481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/core/raw.c 2023-11-15 19:49:53.468481010 +0800
|
||||
@@ -146,7 +146,7 @@
|
||||
diff --git a/src/core/raw.c b/src/core/raw.c
|
||||
index d85aaec..27f990d 100644
|
||||
--- a/src/core/raw.c
|
||||
+++ b/src/core/raw.c
|
||||
@@ -146,7 +146,7 @@ raw_input(struct pbuf *p, struct netif *inp)
|
||||
if (IP_HDR_GET_VERSION(p->payload) == 6)
|
||||
#endif /* LWIP_IPV4 */
|
||||
{
|
||||
@ -241,22 +262,11 @@ diff -Nur lwip-ipv6/src/core/raw.c lwip-ipv6-hdr/src/core/raw.c
|
||||
proto = IP6H_NEXTH(ip6hdr);
|
||||
}
|
||||
#if LWIP_IPV4
|
||||
diff -Nur lwip-ipv6/src/include/lwip/ip6_frag.h lwip-ipv6-hdr/src/include/lwip/ip6_frag.h
|
||||
--- lwip-ipv6/src/include/lwip/ip6_frag.h 2023-11-15 19:48:02.864481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/include/lwip/ip6_frag.h 2023-11-15 20:13:40.008481010 +0800
|
||||
@@ -90,7 +90,7 @@
|
||||
struct ip6_reassdata {
|
||||
struct ip6_reassdata *next;
|
||||
struct pbuf *p;
|
||||
- struct ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */
|
||||
+ struct ip6hdr *iphdr; /* pointer to the first (original) IPv6 header */
|
||||
#if IPV6_FRAG_COPYHEADER
|
||||
ip6_addr_p_t src; /* copy of the source address in the IP header */
|
||||
ip6_addr_p_t dest; /* copy of the destination address in the IP header */
|
||||
diff -Nur lwip-ipv6/src/include/lwip/ip.h lwip-ipv6-hdr/src/include/lwip/ip.h
|
||||
--- lwip-ipv6/src/include/lwip/ip.h 2023-11-15 19:48:02.864481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/include/lwip/ip.h 2023-11-15 20:12:42.796481010 +0800
|
||||
@@ -123,7 +123,7 @@
|
||||
diff --git a/src/include/lwip/ip.h b/src/include/lwip/ip.h
|
||||
index b6ab031..dd25ce6 100644
|
||||
--- a/src/include/lwip/ip.h
|
||||
+++ b/src/include/lwip/ip.h
|
||||
@@ -134,7 +134,7 @@ struct ip_globals
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
/** Header of the input IPv6 packet currently being processed. */
|
||||
@ -265,7 +275,7 @@ diff -Nur lwip-ipv6/src/include/lwip/ip.h lwip-ipv6-hdr/src/include/lwip/ip.h
|
||||
#endif /* LWIP_IPV6 */
|
||||
/** Total header length of current_ip4/6_header (i.e. after this, the UDP/TCP header starts) */
|
||||
u16_t current_ip_header_tot_len;
|
||||
@@ -159,7 +159,7 @@
|
||||
@@ -170,7 +170,7 @@ extern PER_THREAD struct ip_globals ip_data;
|
||||
/** Get the IPv6 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. */
|
||||
@ -274,7 +284,7 @@ diff -Nur lwip-ipv6/src/include/lwip/ip.h lwip-ipv6-hdr/src/include/lwip/ip.h
|
||||
/** Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4 */
|
||||
#define ip_current_is_v6() (ip6_current_header() != NULL)
|
||||
/** Source IPv6 address of current_header */
|
||||
@@ -201,7 +201,7 @@
|
||||
@@ -212,7 +212,7 @@ extern PER_THREAD struct ip_globals ip_data;
|
||||
/** Get the IPv6 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. */
|
||||
@ -283,10 +293,24 @@ diff -Nur lwip-ipv6/src/include/lwip/ip.h lwip-ipv6-hdr/src/include/lwip/ip.h
|
||||
/** Always returns TRUE when only supporting IPv6 only */
|
||||
#define ip_current_is_v6() 1
|
||||
/** Get the transport layer protocol */
|
||||
diff -Nur lwip-ipv6/src/include/lwip/prot/ip6.h lwip-ipv6-hdr/src/include/lwip/prot/ip6.h
|
||||
--- lwip-ipv6/src/include/lwip/prot/ip6.h 2023-11-15 19:48:02.868481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/include/lwip/prot/ip6.h 2023-11-17 13:24:56.832481010 +0800
|
||||
@@ -79,7 +79,7 @@
|
||||
diff --git a/src/include/lwip/ip6_frag.h b/src/include/lwip/ip6_frag.h
|
||||
index 87e0e86..6ea6052 100644
|
||||
--- a/src/include/lwip/ip6_frag.h
|
||||
+++ b/src/include/lwip/ip6_frag.h
|
||||
@@ -90,7 +90,7 @@ extern "C" {
|
||||
struct ip6_reassdata {
|
||||
struct ip6_reassdata *next;
|
||||
struct pbuf *p;
|
||||
- struct ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */
|
||||
+ struct ip6hdr *iphdr; /* pointer to the first (original) IPv6 header */
|
||||
#if IPV6_FRAG_COPYHEADER
|
||||
ip6_addr_p_t src; /* copy of the source address in the IP header */
|
||||
ip6_addr_p_t dest; /* copy of the destination address in the IP header */
|
||||
diff --git a/src/include/lwip/prot/ip6.h b/src/include/lwip/prot/ip6.h
|
||||
index 7df81ed..40f270b 100644
|
||||
--- a/src/include/lwip/prot/ip6.h
|
||||
+++ b/src/include/lwip/prot/ip6.h
|
||||
@@ -79,7 +79,7 @@ typedef struct ip6_addr_packed ip6_addr_p_t;
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
@ -295,10 +319,11 @@ diff -Nur lwip-ipv6/src/include/lwip/prot/ip6.h lwip-ipv6-hdr/src/include/lwip/p
|
||||
/** version / traffic class / flow label */
|
||||
PACK_STRUCT_FIELD(u32_t _v_tc_fl);
|
||||
/** payload length */
|
||||
diff -Nur lwip-ipv6/src/netif/lowpan6.c lwip-ipv6-hdr/src/netif/lowpan6.c
|
||||
--- lwip-ipv6/src/netif/lowpan6.c 2023-11-15 19:48:02.868481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/netif/lowpan6.c 2023-11-15 20:16:23.836481010 +0800
|
||||
@@ -570,12 +570,12 @@
|
||||
diff --git a/src/netif/lowpan6.c b/src/netif/lowpan6.c
|
||||
index 8eb751c..037ac6d 100644
|
||||
--- a/src/netif/lowpan6.c
|
||||
+++ b/src/netif/lowpan6.c
|
||||
@@ -571,12 +571,12 @@ lowpan6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr)
|
||||
struct lowpan6_link_addr src, dest;
|
||||
#if LWIP_6LOWPAN_INFER_SHORT_ADDRESS
|
||||
ip6_addr_t ip6_src;
|
||||
@ -313,10 +338,11 @@ diff -Nur lwip-ipv6/src/netif/lowpan6.c lwip-ipv6-hdr/src/netif/lowpan6.c
|
||||
ip6_addr_copy_from_packed(ip6_src, ip6_hdr->src);
|
||||
ip6_addr_assign_zone(&ip6_src, IP6_UNICAST, netif);
|
||||
if (lowpan6_get_address_mode(&ip6_src, &short_mac_addr) == 3) {
|
||||
diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_common.c
|
||||
--- lwip-ipv6/src/netif/lowpan6_common.c 2023-11-15 19:48:02.868481010 +0800
|
||||
+++ lwip-ipv6-hdr/src/netif/lowpan6_common.c 2023-11-15 20:15:44.460481010 +0800
|
||||
@@ -137,7 +137,7 @@
|
||||
diff --git a/src/netif/lowpan6_common.c b/src/netif/lowpan6_common.c
|
||||
index 9f50658..7b9f834 100644
|
||||
--- a/src/netif/lowpan6_common.c
|
||||
+++ b/src/netif/lowpan6_common.c
|
||||
@@ -137,7 +137,7 @@ lowpan6_compress_headers(struct netif *netif, u8_t *inbuf, size_t inbuf_size, u8
|
||||
u8_t lowpan6_header_len;
|
||||
u8_t hidden_header_len = 0;
|
||||
s8_t i;
|
||||
@ -325,7 +351,7 @@ diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_c
|
||||
ip_addr_t ip6src, ip6dst;
|
||||
|
||||
LWIP_ASSERT("netif != NULL", netif != NULL);
|
||||
@@ -160,7 +160,7 @@
|
||||
@@ -160,7 +160,7 @@ lowpan6_compress_headers(struct netif *netif, u8_t *inbuf, size_t inbuf_size, u8
|
||||
}
|
||||
|
||||
/* Point to ip6 header and align copies of src/dest addresses. */
|
||||
@ -334,7 +360,7 @@ diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_c
|
||||
ip_addr_copy_from_ip6_packed(ip6dst, ip6hdr->dest);
|
||||
ip6_addr_assign_zone(ip_2_ip6(&ip6dst), IP6_UNKNOWN, netif);
|
||||
ip_addr_copy_from_ip6_packed(ip6src, ip6hdr->src);
|
||||
@@ -396,7 +396,7 @@
|
||||
@@ -396,7 +396,7 @@ lowpan6_decompress_hdr(u8_t *lowpan6_buffer, size_t lowpan6_bufsize,
|
||||
struct lowpan6_link_addr *src, struct lowpan6_link_addr *dest)
|
||||
{
|
||||
u16_t lowpan6_offset;
|
||||
@ -343,7 +369,7 @@ diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_c
|
||||
s8_t i;
|
||||
u32_t header_temp;
|
||||
u16_t ip6_offset = IP6_HLEN;
|
||||
@@ -408,7 +408,7 @@
|
||||
@@ -408,7 +408,7 @@ lowpan6_decompress_hdr(u8_t *lowpan6_buffer, size_t lowpan6_bufsize,
|
||||
LWIP_ASSERT("hdr_size_comp != NULL", hdr_size_comp != NULL);
|
||||
LWIP_ASSERT("dehdr_size_decompst != NULL", hdr_size_decomp != NULL);
|
||||
|
||||
@ -352,3 +378,6 @@ diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_c
|
||||
if (decomp_bufsize < IP6_HLEN) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -1,9 +1,23 @@
|
||||
diff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c
|
||||
--- lwip-org/src/core/netif.c 2023-11-24 17:38:29.428481010 +0800
|
||||
+++ lwip-vlan/src/core/netif.c 2023-11-27 18:35:00.172481010 +0800
|
||||
@@ -355,6 +355,11 @@
|
||||
netif->input = input;
|
||||
|
||||
From 95f00d7a735b20cf352f6712529547b3720614cb Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 17:35:32 +0800
|
||||
Subject: add vlanid in netif
|
||||
|
||||
---
|
||||
src/core/netif.c | 14 ++++++++++++++
|
||||
src/core/tcp.c | 2 ++
|
||||
src/core/tcp_in.c | 2 ++
|
||||
src/include/lwip/netif.h | 9 +++++++++
|
||||
src/netif/ethernet.c | 6 ++++++
|
||||
5 files changed, 33 insertions(+)
|
||||
|
||||
diff --git a/src/core/netif.c b/src/core/netif.c
|
||||
index 8a1ccec..eff3cae 100644
|
||||
--- a/src/core/netif.c
|
||||
+++ b/src/core/netif.c
|
||||
@@ -369,6 +369,11 @@ netif_add(struct netif *netif,
|
||||
netif->acd_list = NULL;
|
||||
#endif /* LWIP_ACD */
|
||||
NETIF_RESET_HINTS(netif);
|
||||
+
|
||||
+#if GAZELLE_ENABLE
|
||||
@ -13,7 +27,7 @@ diff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c
|
||||
#if ENABLE_LOOPBACK
|
||||
netif->loop_first = NULL;
|
||||
netif->loop_last = NULL;
|
||||
@@ -441,6 +446,15 @@
|
||||
@@ -455,6 +460,15 @@ netif_add(struct netif *netif,
|
||||
return netif;
|
||||
}
|
||||
|
||||
@ -29,23 +43,25 @@ diff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c
|
||||
static void
|
||||
netif_do_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
|
||||
{
|
||||
diff -Nur lwip-org/src/core/tcp.c lwip-vlan/src/core/tcp.c
|
||||
--- lwip-org/src/core/tcp.c 2023-11-24 17:38:29.448481010 +0800
|
||||
+++ lwip-vlan/src/core/tcp.c 2023-11-27 10:42:33.228481010 +0800
|
||||
@@ -987,7 +987,9 @@
|
||||
lpcb->tos = pcb->tos;
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index 1d02574..b889a4e 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -996,7 +996,9 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
|
||||
#endif
|
||||
|
||||
#if LWIP_VLAN_PCP
|
||||
+#if !GAZELLE_ENABLE
|
||||
lpcb->netif_hints.tci = pcb->netif_hints.tci;
|
||||
+#endif
|
||||
#endif /* LWIP_VLAN_PCP */
|
||||
#if GAZELLE_TCP_REUSE_IPPORT
|
||||
lpcb->connect_num = 0;
|
||||
diff -Nur lwip-org/src/core/tcp_in.c lwip-vlan/src/core/tcp_in.c
|
||||
--- lwip-org/src/core/tcp_in.c 2023-11-24 17:38:29.448481010 +0800
|
||||
+++ lwip-vlan/src/core/tcp_in.c 2023-11-27 10:42:33.228481010 +0800
|
||||
@@ -808,7 +808,9 @@
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
IP_SET_TYPE_VAL(lpcb->remote_ip, pcb->local_ip.type);
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 9b1ec9c..10f8a14 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -808,7 +808,9 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
npcb->listener = pcb;
|
||||
#endif /* LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG */
|
||||
#if LWIP_VLAN_PCP
|
||||
@ -55,9 +71,10 @@ diff -Nur lwip-org/src/core/tcp_in.c lwip-vlan/src/core/tcp_in.c
|
||||
#endif /* LWIP_VLAN_PCP */
|
||||
/* inherit socket options */
|
||||
npcb->so_options = pcb->so_options & SOF_INHERITED;
|
||||
diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
|
||||
--- lwip-org/src/include/lwip/netif.h 2023-11-24 17:38:29.440481010 +0800
|
||||
+++ lwip-vlan/src/include/lwip/netif.h 2023-11-27 18:33:07.936481010 +0800
|
||||
diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h
|
||||
index 502a151..368b89a 100644
|
||||
--- a/src/include/lwip/netif.h
|
||||
+++ b/src/include/lwip/netif.h
|
||||
@@ -45,6 +45,10 @@
|
||||
|
||||
#include "lwip/ip_addr.h"
|
||||
@ -69,7 +86,7 @@ diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/stats.h"
|
||||
@@ -357,6 +361,10 @@
|
||||
@@ -360,6 +364,10 @@ struct netif {
|
||||
#if GAZELLE_ENABLE
|
||||
u64_t rxol_flags;
|
||||
u64_t txol_flags;
|
||||
@ -80,7 +97,7 @@ diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
|
||||
#endif
|
||||
/** descriptive abbreviation */
|
||||
char name[2];
|
||||
@@ -484,6 +492,7 @@
|
||||
@@ -492,6 +500,7 @@ void netif_set_down(struct netif *netif);
|
||||
#define netif_get_rxol_flags(netif) ((netif)->rxol_flags)
|
||||
#define netif_get_txol_flags(netif) ((netif)->txol_flags)
|
||||
|
||||
@ -88,10 +105,11 @@ diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
|
||||
void netif_set_rtc_mode(struct netif *netif);
|
||||
void netif_set_rxol_flags(struct netif *netif, u64_t flags);
|
||||
void netif_set_txol_flags(struct netif *netif, u64_t flags);
|
||||
diff -Nur lwip-org/src/netif/ethernet.c lwip-vlan/src/netif/ethernet.c
|
||||
--- lwip-org/src/netif/ethernet.c 2023-11-24 17:38:29.444481010 +0800
|
||||
+++ lwip-vlan/src/netif/ethernet.c 2023-11-27 11:07:48.464481010 +0800
|
||||
@@ -283,9 +283,15 @@
|
||||
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
|
||||
index dc89566..af4cffc 100644
|
||||
--- a/src/netif/ethernet.c
|
||||
+++ b/src/netif/ethernet.c
|
||||
@@ -283,9 +283,15 @@ ethernet_output(struct netif * netif, struct pbuf * p,
|
||||
vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
|
||||
#elif LWIP_VLAN_PCP
|
||||
vlan_prio_vid = -1;
|
||||
@ -107,3 +125,5 @@ diff -Nur lwip-org/src/netif/ethernet.c lwip-vlan/src/netif/ethernet.c
|
||||
#endif
|
||||
if (vlan_prio_vid >= 0) {
|
||||
struct eth_vlan_hdr *vlanhdr;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -10,7 +10,7 @@ Subject: [PATCH] add lwip log: tcp_rst & tcp_abandon & tcp_abort
|
||||
3 files changed, 35 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index 963b8a4..a4f82a3 100644
|
||||
index f6c4cf1..73d1d1e 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -415,6 +415,9 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
|
||||
@ -33,7 +33,7 @@ index 963b8a4..a4f82a3 100644
|
||||
tcp_rst(pcb, seqno, ackno, &pcb->local_ip, &pcb->remote_ip, local_port, pcb->remote_port);
|
||||
}
|
||||
last_state = pcb->state;
|
||||
@@ -1574,6 +1578,9 @@ tcp_slowtmr_start:
|
||||
@@ -1577,6 +1581,9 @@ tcp_slowtmr_start:
|
||||
#endif
|
||||
|
||||
if (pcb_reset) {
|
||||
@ -43,7 +43,7 @@ index 963b8a4..a4f82a3 100644
|
||||
tcp_rst(pcb, pcb->snd_nxt, pcb->rcv_nxt, &pcb->local_ip, &pcb->remote_ip,
|
||||
pcb->local_port, pcb->remote_port);
|
||||
}
|
||||
@@ -1941,8 +1948,8 @@ tcp_kill_prio(u8_t prio)
|
||||
@@ -1947,8 +1954,8 @@ tcp_kill_prio(u8_t prio)
|
||||
}
|
||||
}
|
||||
if (inactive != NULL) {
|
||||
@ -54,7 +54,7 @@ index 963b8a4..a4f82a3 100644
|
||||
tcp_abort(inactive);
|
||||
}
|
||||
}
|
||||
@@ -1972,8 +1979,8 @@ tcp_kill_state(enum tcp_state state)
|
||||
@@ -1978,8 +1985,8 @@ tcp_kill_state(enum tcp_state state)
|
||||
}
|
||||
}
|
||||
if (inactive != NULL) {
|
||||
@ -65,7 +65,7 @@ index 963b8a4..a4f82a3 100644
|
||||
/* Don't send a RST, since no data is lost. */
|
||||
tcp_abandon(inactive, 0);
|
||||
}
|
||||
@@ -1999,8 +2006,8 @@ tcp_kill_timewait(void)
|
||||
@@ -2005,8 +2012,8 @@ tcp_kill_timewait(void)
|
||||
}
|
||||
}
|
||||
if (inactive != NULL) {
|
||||
@ -76,7 +76,7 @@ index 963b8a4..a4f82a3 100644
|
||||
tcp_abort(inactive);
|
||||
}
|
||||
}
|
||||
@@ -2540,7 +2547,8 @@ tcp_netif_ip_addr_changed_pcblist(const ip_addr_t *old_addr, struct tcp_pcb *pcb
|
||||
@@ -2548,7 +2555,8 @@ tcp_netif_ip_addr_changed_pcblist(const ip_addr_t *old_addr, struct tcp_pcb *pcb
|
||||
) {
|
||||
/* this connection must be aborted */
|
||||
struct tcp_pcb *next = pcb->next;
|
||||
@ -87,7 +87,7 @@ index 963b8a4..a4f82a3 100644
|
||||
pcb = next;
|
||||
} else {
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 7154659..700a64c 100644
|
||||
index 10f8a14..4755ab5 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -592,6 +592,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -109,7 +109,7 @@ index 7154659..700a64c 100644
|
||||
+ LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS,
|
||||
+ ("tcp_input: no PCB match found, send RST, dest port=%d, src port=%d\n",
|
||||
+ lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src)));
|
||||
tcp_rst(NULL, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
}
|
||||
@@ -761,7 +764,9 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
@ -120,10 +120,10 @@ index 7154659..700a64c 100644
|
||||
+ LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS,
|
||||
+ ("tcp_listen_input: ACK in LISTEN, send reset, dest port=%d, src port=%d\n",
|
||||
+ lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src)));
|
||||
tcp_rst((const struct tcp_pcb *)pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
} else if (flags & TCP_SYN) {
|
||||
@@ -852,6 +857,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
@@ -854,6 +859,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
/* Send a SYN|ACK together with the MSS option. */
|
||||
rc = tcp_enqueue_flags(npcb, TCP_SYN | TCP_ACK);
|
||||
if (rc != ERR_OK) {
|
||||
@ -131,7 +131,7 @@ index 7154659..700a64c 100644
|
||||
tcp_abandon(npcb, 0);
|
||||
PERF_RESUME(PERF_LAYER_TCP, PERF_POINT_TCP_SYN_RECV);
|
||||
return;
|
||||
@@ -892,6 +898,9 @@ tcp_timewait_input(struct tcp_pcb *pcb)
|
||||
@@ -894,6 +900,9 @@ tcp_timewait_input(struct tcp_pcb *pcb)
|
||||
should be sent in reply */
|
||||
if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd)) {
|
||||
/* If the SYN is in the window it is an error, send a reset */
|
||||
@ -141,7 +141,7 @@ index 7154659..700a64c 100644
|
||||
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
return;
|
||||
@@ -1060,6 +1069,8 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
@@ -1062,6 +1071,8 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
/* received ACK? possibly a half-open connection */
|
||||
else if (flags & TCP_ACK) {
|
||||
/* send a RST to bring the other side in a non-synchronized state. */
|
||||
@ -150,7 +150,7 @@ index 7154659..700a64c 100644
|
||||
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
/* Resend SYN immediately (don't wait for rto timeout) to establish
|
||||
@@ -1102,6 +1113,7 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
@@ -1104,6 +1115,7 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
* the connection. */
|
||||
/* Already aborted? */
|
||||
if (err != ERR_ABRT) {
|
||||
@ -158,7 +158,7 @@ index 7154659..700a64c 100644
|
||||
tcp_abort(pcb);
|
||||
}
|
||||
return ERR_ABRT;
|
||||
@@ -1129,6 +1141,9 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
@@ -1131,6 +1143,9 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
}
|
||||
} else {
|
||||
/* incorrect ACK number, send RST */
|
||||
@ -169,7 +169,7 @@ index 7154659..700a64c 100644
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
}
|
||||
diff --git a/src/include/lwip/debug.h b/src/include/lwip/debug.h
|
||||
index f47cbfe..6abed9f 100644
|
||||
index 4986973..c2de064 100644
|
||||
--- a/src/include/lwip/debug.h
|
||||
+++ b/src/include/lwip/debug.h
|
||||
@@ -56,12 +56,12 @@
|
||||
@ -189,4 +189,3 @@ index f47cbfe..6abed9f 100644
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@ -1,18 +1,31 @@
|
||||
diff -Nur lwip-82/src/include/dpdk_version.h lwip-offload/src/include/dpdk_version.h
|
||||
--- lwip-82/src/include/dpdk_version.h 2023-11-28 14:17:02.432481010 +0800
|
||||
+++ lwip-offload/src/include/dpdk_version.h 2023-11-28 14:34:21.208481010 +0800
|
||||
From c2c63406f804550db5670715c1afa6e743d1f675 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 17:38:06 +0800
|
||||
Subject: support vlan offload
|
||||
|
||||
---
|
||||
src/include/dpdk_version.h | 1 +
|
||||
src/include/lwip/pbuf.h | 1 +
|
||||
src/netif/ethernet.c | 17 +++++++++++------
|
||||
3 files changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h
|
||||
index e61d0b3..5efaa39 100644
|
||||
--- a/src/include/dpdk_version.h
|
||||
+++ b/src/include/dpdk_version.h
|
||||
@@ -48,6 +48,7 @@
|
||||
#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
|
||||
#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG
|
||||
#define RTE_MBUF_F_TX_UDP_CKSUM PKT_TX_UDP_CKSUM
|
||||
+#define RTE_MBUF_F_TX_VLAN PKT_TX_VLAN_PKT
|
||||
|
||||
|
||||
#endif /* DPDK_VERSION_1911 */
|
||||
|
||||
diff -Nur lwip-82/src/include/lwip/pbuf.h lwip-offload/src/include/lwip/pbuf.h
|
||||
--- lwip-82/src/include/lwip/pbuf.h 2023-11-28 14:17:02.408481010 +0800
|
||||
+++ lwip-offload/src/include/lwip/pbuf.h 2023-11-28 14:41:31.580481010 +0800
|
||||
@@ -240,6 +240,7 @@
|
||||
|
||||
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
|
||||
index 7fad719..bc29372 100644
|
||||
--- a/src/include/lwip/pbuf.h
|
||||
+++ b/src/include/lwip/pbuf.h
|
||||
@@ -240,6 +240,7 @@ struct pbuf {
|
||||
struct pbuf *last;
|
||||
pthread_spinlock_t pbuf_lock;
|
||||
struct tcp_pcb *pcb;
|
||||
@ -20,10 +33,11 @@ diff -Nur lwip-82/src/include/lwip/pbuf.h lwip-offload/src/include/lwip/pbuf.h
|
||||
#if GAZELLE_UDP_ENABLE
|
||||
ip_addr_t addr;
|
||||
u16_t port;
|
||||
diff -Nur lwip-82/src/netif/ethernet.c lwip-offload/src/netif/ethernet.c
|
||||
--- lwip-82/src/netif/ethernet.c 2023-11-28 14:17:02.440481010 +0800
|
||||
+++ lwip-offload/src/netif/ethernet.c 2023-11-28 16:35:36.536481010 +0800
|
||||
@@ -289,7 +289,12 @@
|
||||
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
|
||||
index af4cffc..d2960b5 100644
|
||||
--- a/src/netif/ethernet.c
|
||||
+++ b/src/netif/ethernet.c
|
||||
@@ -289,7 +289,12 @@ ethernet_output(struct netif * netif, struct pbuf * p,
|
||||
}
|
||||
#else
|
||||
if (netif->vlan_enable) {
|
||||
@ -37,9 +51,9 @@ diff -Nur lwip-82/src/netif/ethernet.c lwip-offload/src/netif/ethernet.c
|
||||
}
|
||||
#endif /* GAZELLE_ENABLE */
|
||||
#endif
|
||||
@@ -327,11 +332,11 @@
|
||||
@@ -327,11 +332,11 @@ ethernet_output(struct netif * netif, struct pbuf * p,
|
||||
("ethernet_output: sending packet %p\n", (void *)p));
|
||||
|
||||
|
||||
#if CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW
|
||||
-#if LWIP_VLAN_PCP
|
||||
- ethh_cksum_set(p, sizeof(*ethhdr)+SIZEOF_VLAN_HDR);
|
||||
@ -52,5 +66,7 @@ diff -Nur lwip-82/src/netif/ethernet.c lwip-offload/src/netif/ethernet.c
|
||||
+ ethh_cksum_set(p, sizeof(*ethhdr));
|
||||
+ }
|
||||
#endif
|
||||
|
||||
|
||||
/* send the packet */
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,7 +1,20 @@
|
||||
diff -Nur lwip-org/src/core/tcp.c lwip-gz-addr/src/core/tcp.c
|
||||
--- lwip-org/src/core/tcp.c 2023-12-04 14:10:25.364481010 +0800
|
||||
+++ lwip-gz-addr/src/core/tcp.c 2023-12-04 14:33:31.712481010 +0800
|
||||
@@ -1161,7 +1161,7 @@
|
||||
From f5df6b241f38a5830920038c05d41ed4444efe63 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 17:41:16 +0800
|
||||
Subject: add struct gz addr
|
||||
|
||||
---
|
||||
src/core/tcp.c | 2 +-
|
||||
src/core/udp.c | 2 +-
|
||||
src/include/lwipopts.h | 1 +
|
||||
src/include/reg_sock.h | 36 +++++++++++++++++++++++++++++++++---
|
||||
4 files changed, 36 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index 17f922e..9f240b8 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -1161,7 +1161,7 @@ tcp_new_port(void)
|
||||
|
||||
if (__atomic_load_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], __ATOMIC_ACQUIRE) == 0) {
|
||||
#if GAZELLE_ENABLE
|
||||
@ -10,10 +23,11 @@ diff -Nur lwip-org/src/core/tcp.c lwip-gz-addr/src/core/tcp.c
|
||||
tmp_port = tcp_port;
|
||||
__atomic_store_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE);
|
||||
break;
|
||||
diff -Nur lwip-org/src/core/udp.c lwip-gz-addr/src/core/udp.c
|
||||
--- lwip-org/src/core/udp.c 2023-12-04 14:10:25.364481010 +0800
|
||||
+++ lwip-gz-addr/src/core/udp.c 2023-12-04 14:19:58.832481010 +0800
|
||||
@@ -132,7 +132,7 @@
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index 02ffe36..ca82e51 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -132,7 +132,7 @@ udp_new_port(struct udp_pcb *dst_pcb)
|
||||
}
|
||||
|
||||
if (__atomic_load_n(&port_state[udp_port - UDP_LOCAL_PORT_RANGE_START], __ATOMIC_ACQUIRE) == 0) {
|
||||
@ -22,10 +36,11 @@ diff -Nur lwip-org/src/core/udp.c lwip-gz-addr/src/core/udp.c
|
||||
tmp_port = udp_port;
|
||||
__atomic_store_n(&port_state[udp_port - UDP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE);
|
||||
break;
|
||||
diff -Nur lwip-org/src/include/lwipopts.h lwip-gz-addr/src/include/lwipopts.h
|
||||
--- lwip-org/src/include/lwipopts.h 2023-12-04 14:10:25.368481010 +0800
|
||||
+++ lwip-gz-addr/src/include/lwipopts.h 2023-12-06 19:29:24.520481010 +0800
|
||||
@@ -184,6 +184,7 @@
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 11bc65a..4cd2d7a 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -178,6 +178,7 @@
|
||||
*/
|
||||
#define LWIP_IPV6 1
|
||||
#define IP6_HLEN 40
|
||||
@ -33,9 +48,10 @@ diff -Nur lwip-org/src/include/lwipopts.h lwip-gz-addr/src/include/lwipopts.h
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
diff -Nur lwip-org/src/include/reg_sock.h lwip-gz-addr/src/include/reg_sock.h
|
||||
--- lwip-org/src/include/reg_sock.h 2023-12-04 14:10:25.368481010 +0800
|
||||
+++ lwip-gz-addr/src/include/reg_sock.h 2023-12-06 19:41:19.792481010 +0800
|
||||
diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h
|
||||
index 5a5e971..a11102e 100644
|
||||
--- a/src/include/reg_sock.h
|
||||
+++ b/src/include/reg_sock.h
|
||||
@@ -34,7 +34,35 @@
|
||||
#define __REG_SOCK_H__
|
||||
|
||||
@ -73,7 +89,7 @@ diff -Nur lwip-org/src/include/reg_sock.h lwip-gz-addr/src/include/reg_sock.h
|
||||
|
||||
enum reg_ring_type {
|
||||
REG_RING_TCP_LISTEN = 0,
|
||||
@@ -45,10 +73,12 @@
|
||||
@@ -45,10 +73,12 @@ enum reg_ring_type {
|
||||
};
|
||||
|
||||
struct gazelle_quintuple {
|
||||
@ -87,7 +103,7 @@ diff -Nur lwip-org/src/include/reg_sock.h lwip-gz-addr/src/include/reg_sock.h
|
||||
uint32_t src_ip;
|
||||
uint32_t dst_ip;
|
||||
#if LWIP_IPV6
|
||||
@@ -65,6 +95,6 @@
|
||||
@@ -65,6 +95,6 @@ struct reg_ring_msg {
|
||||
};
|
||||
|
||||
extern int vdev_reg_xmit(enum reg_ring_type type, struct gazelle_quintuple *qtuple);
|
||||
@ -95,3 +111,6 @@ diff -Nur lwip-org/src/include/reg_sock.h lwip-gz-addr/src/include/reg_sock.h
|
||||
+extern bool port_in_stack_queue(gz_addr_t *src_ip, gz_addr_t *dst_ip, uint16_t src_port, uint16_t dst_port);
|
||||
|
||||
#endif /* __REG_SOCK_H__ */
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -9,10 +9,10 @@ Subject: [PATCH] add fd log info and fix wrong port log info
|
||||
2 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 65c69d4..d488b5b 100644
|
||||
index 7978504..459299a 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -2797,7 +2797,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
@@ -2840,7 +2840,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
#endif
|
||||
break;
|
||||
case NETCONN_EVT_ERROR:
|
||||
@ -22,7 +22,7 @@ index 65c69d4..d488b5b 100644
|
||||
#if GAZELLE_ENABLE
|
||||
if (netif_is_rtc_mode(netif_default)) {
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 8ed91b5..24706c1 100644
|
||||
index 6e84df4..8fb9482 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -688,8 +688,8 @@ aborted:
|
||||
@ -33,7 +33,7 @@ index 8ed91b5..24706c1 100644
|
||||
- lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src)));
|
||||
+ ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
|
||||
+ tcphdr->src, tcphdr->dest));
|
||||
tcp_rst(NULL, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
}
|
||||
@@ -765,8 +765,8 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
@ -44,7 +44,7 @@ index 8ed91b5..24706c1 100644
|
||||
- lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src)));
|
||||
+ ("tcp_listen_input: ACK in LISTEN, send reset, local_port=%d, remote_port=%d\n",
|
||||
+ tcphdr->src, tcphdr->dest));
|
||||
tcp_rst((const struct tcp_pcb *)pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
} else if (flags & TCP_SYN) {
|
||||
@@ -902,8 +902,8 @@ tcp_timewait_input(struct tcp_pcb *pcb)
|
||||
|
||||
@ -8,7 +8,7 @@ Subject: [PATCH] lwip log: fix reversed port in tcp_input
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 24706c1..c76c114 100644
|
||||
index 8fb9482..92ea748 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -689,7 +689,7 @@ aborted:
|
||||
@ -17,7 +17,7 @@ index 24706c1..c76c114 100644
|
||||
("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
|
||||
- tcphdr->src, tcphdr->dest));
|
||||
+ tcphdr->dest, tcphdr->src));
|
||||
tcp_rst(NULL, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
}
|
||||
@@ -766,7 +766,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
@ -26,7 +26,7 @@ index 24706c1..c76c114 100644
|
||||
("tcp_listen_input: ACK in LISTEN, send reset, local_port=%d, remote_port=%d\n",
|
||||
- tcphdr->src, tcphdr->dest));
|
||||
+ tcphdr->dest, tcphdr->src));
|
||||
tcp_rst((const struct tcp_pcb *)pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
} else if (flags & TCP_SYN) {
|
||||
@@ -903,7 +903,7 @@ tcp_timewait_input(struct tcp_pcb *pcb)
|
||||
|
||||
@ -19,7 +19,7 @@ Subject: [PATCH] Mod the issue that 2w connection unable to establish in
|
||||
11 files changed, 28 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/src/api/api_lib.c b/src/api/api_lib.c
|
||||
index e73b81e..30e3422 100644
|
||||
index b22b987..1721d49 100644
|
||||
--- a/src/api/api_lib.c
|
||||
+++ b/src/api/api_lib.c
|
||||
@@ -431,7 +431,7 @@ netconn_disconnect(struct netconn *conn)
|
||||
@ -32,10 +32,10 @@ index e73b81e..30e3422 100644
|
||||
#if LWIP_TCP
|
||||
API_MSG_VAR_DECLARE(msg);
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index 531da40..91b8590 100644
|
||||
index 3fda788..b06be0a 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -1499,7 +1499,7 @@ lwip_netconn_do_listen(void *m)
|
||||
@@ -1500,7 +1500,7 @@ lwip_netconn_do_listen(void *m)
|
||||
/* connection is not closed, cannot listen */
|
||||
err = ERR_VAL;
|
||||
} else {
|
||||
@ -45,10 +45,10 @@ index 531da40..91b8590 100644
|
||||
backlog = msg->msg.lb.backlog;
|
||||
#else /* TCP_LISTEN_BACKLOG */
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index f5b8ea6..b7ee304 100644
|
||||
index d1e1615..ced0c37 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -447,7 +447,7 @@ tryget_socket_unconn_nouse(int fd)
|
||||
@@ -487,7 +487,7 @@ tryget_socket_unconn_nouse(int fd)
|
||||
if ((s < 0) || (s >= NUM_SOCKETS))
|
||||
#endif /* GAZELLE_ENABLE */
|
||||
{
|
||||
@ -57,7 +57,7 @@ index f5b8ea6..b7ee304 100644
|
||||
return NULL;
|
||||
}
|
||||
return &sockets[s];
|
||||
@@ -521,7 +521,7 @@ get_socket(int fd)
|
||||
@@ -561,7 +561,7 @@ get_socket(int fd)
|
||||
struct lwip_sock *sock = tryget_socket(fd);
|
||||
if (!sock) {
|
||||
if ((fd < LWIP_SOCKET_OFFSET) || (fd >= (LWIP_SOCKET_OFFSET + NUM_SOCKETS))) {
|
||||
@ -66,7 +66,7 @@ index f5b8ea6..b7ee304 100644
|
||||
}
|
||||
set_errno(EBADF);
|
||||
return NULL;
|
||||
@@ -588,6 +588,7 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
@@ -628,6 +628,7 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
i = posix_api->socket_fn(domain, type, protocol);
|
||||
if (i == -1) {
|
||||
@ -74,7 +74,7 @@ index f5b8ea6..b7ee304 100644
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -596,6 +597,7 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
@@ -636,6 +637,7 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
}
|
||||
|
||||
if ((i < LWIP_SOCKET_OFFSET) || (i >= sockets_num + LWIP_SOCKET_OFFSET)) {
|
||||
@ -82,8 +82,8 @@ index f5b8ea6..b7ee304 100644
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -767,13 +769,14 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
|
||||
@@ -806,13 +808,14 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
|
||||
sock = get_socket(s);
|
||||
if (!sock) {
|
||||
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("get_socket sock is null\n"));
|
||||
@ -96,17 +96,17 @@ index f5b8ea6..b7ee304 100644
|
||||
- LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
|
||||
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
|
||||
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP) {
|
||||
sock_set_errno(sock, EOPNOTSUPP);
|
||||
set_errno(EOPNOTSUPP);
|
||||
} else if (err == ERR_CLSD) {
|
||||
@@ -788,6 +791,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
@@ -827,6 +830,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
|
||||
newsock = alloc_socket(newconn, 1, flags);
|
||||
if (newsock == -1) {
|
||||
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("alloc_socket fail newsock is -1\n"));
|
||||
netconn_delete(newconn);
|
||||
sock_set_errno(sock, ENFILE);
|
||||
set_errno(ENFILE);
|
||||
done_socket(sock);
|
||||
@@ -807,6 +811,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
@@ -846,6 +850,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
ret = find_same_node_memzone(pcb, nsock);
|
||||
}
|
||||
if (pcb == NULL || ret != 0) {
|
||||
@ -114,16 +114,16 @@ index f5b8ea6..b7ee304 100644
|
||||
netconn_delete(newconn);
|
||||
free_socket(nsock, 1);
|
||||
sock_set_errno(sock, ENOTCONN);
|
||||
@@ -842,7 +847,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
@@ -881,7 +886,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
/* get the IP address and port of the remote host */
|
||||
err = netconn_peer(newconn, &naddr, &port);
|
||||
if (err != ERR_OK) {
|
||||
- LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
|
||||
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
|
||||
free_socket(nsock, 1);
|
||||
sock_set_errno(sock, err_to_errno(err));
|
||||
set_errno(err_to_errno(err));
|
||||
done_socket(sock);
|
||||
@@ -1059,10 +1064,10 @@ lwip_listen(int s, int backlog)
|
||||
@@ -1096,10 +1101,10 @@ lwip_listen(int s, int backlog)
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ index f5b8ea6..b7ee304 100644
|
||||
if (err != ERR_OK) {
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d) failed, err=%d\n", s, err));
|
||||
diff --git a/src/core/init.c b/src/core/init.c
|
||||
index 6880fd3..8c59a7c 100644
|
||||
index 36d7093..c0aaf45 100644
|
||||
--- a/src/core/init.c
|
||||
+++ b/src/core/init.c
|
||||
@@ -160,8 +160,8 @@ PACK_STRUCT_END
|
||||
@ -153,7 +153,7 @@ index 6880fd3..8c59a7c 100644
|
||||
#if (LWIP_TCP && LWIP_TCP_SACK_OUT && !TCP_QUEUE_OOSEQ)
|
||||
#error "To use LWIP_TCP_SACK_OUT, TCP_QUEUE_OOSEQ needs to be enabled"
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index ca70a85..76f0ffd 100644
|
||||
index 9f240b8..a9a6513 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -903,7 +903,7 @@ tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
@ -175,7 +175,7 @@ index ca70a85..76f0ffd 100644
|
||||
struct tcp_pcb_listen *lpcb = NULL;
|
||||
err_t res;
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index c76c114..e9ab96f 100644
|
||||
index 92ea748..5e081f9 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -785,7 +785,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
@ -188,7 +188,7 @@ index c76c114..e9ab96f 100644
|
||||
TCP_EVENT_ACCEPT(pcb, NULL, pcb->callback_arg, ERR_MEM, err);
|
||||
LWIP_UNUSED_ARG(err); /* err not useful here */
|
||||
diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h
|
||||
index ed237c7..a986cd4 100644
|
||||
index 6e6e52d..5d03c24 100644
|
||||
--- a/src/include/lwip/api.h
|
||||
+++ b/src/include/lwip/api.h
|
||||
@@ -366,7 +366,7 @@ err_t netconn_bind(struct netconn *conn, const ip_addr_t *addr, u16_t port);
|
||||
@ -201,10 +201,10 @@ index ed237c7..a986cd4 100644
|
||||
#define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)
|
||||
err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
|
||||
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
|
||||
index 57a1a53..6332d51 100644
|
||||
index e61b3f1..53b1946 100644
|
||||
--- a/src/include/lwip/opt.h
|
||||
+++ b/src/include/lwip/opt.h
|
||||
@@ -1428,7 +1428,7 @@
|
||||
@@ -1467,7 +1467,7 @@
|
||||
* 0xff is the maximum (u8_t).
|
||||
*/
|
||||
#if !defined TCP_DEFAULT_LISTEN_BACKLOG || defined __DOXYGEN__
|
||||
@ -227,7 +227,7 @@ index 9e8ffc9..b36f00a 100644
|
||||
#endif /* TCP_LISTEN_BACKLOG */
|
||||
} msg;
|
||||
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
|
||||
index 91a86c9..741e58f 100644
|
||||
index bde17ec..5097179 100644
|
||||
--- a/src/include/lwip/tcp.h
|
||||
+++ b/src/include/lwip/tcp.h
|
||||
@@ -249,8 +249,8 @@ struct tcp_pcb_listen {
|
||||
@ -241,7 +241,7 @@ index 91a86c9..741e58f 100644
|
||||
#endif /* TCP_LISTEN_BACKLOG */
|
||||
|
||||
#if GAZELLE_TCP_REUSE_IPPORT
|
||||
@@ -575,8 +575,8 @@ void tcp_bind_netif(struct tcp_pcb *pcb, const struct netif *netif);
|
||||
@@ -574,8 +574,8 @@ void tcp_bind_netif(struct tcp_pcb *pcb, const struct netif *netif);
|
||||
err_t tcp_connect (struct tcp_pcb *pcb, const ip_addr_t *ipaddr,
|
||||
u16_t port, tcp_connected_fn connected);
|
||||
|
||||
@ -253,10 +253,10 @@ index 91a86c9..741e58f 100644
|
||||
#define tcp_listen(pcb) tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG)
|
||||
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 82cf881..44ed80f 100644
|
||||
index 4cd2d7a..d54ff1e 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -210,11 +210,11 @@
|
||||
@@ -203,11 +203,11 @@
|
||||
|
||||
#define TCP_HLEN 20
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ Subject: [PATCH] remove duplicate log
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index e9ab96f..69dcd26 100644
|
||||
index 5e081f9..118210a 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -764,7 +764,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
@ -19,7 +19,7 @@ index e9ab96f..69dcd26 100644
|
||||
+ LWIP_DEBUGF(TCP_RST_DEBUG,
|
||||
("tcp_listen_input: ACK in LISTEN, send reset, local_port=%d, remote_port=%d\n",
|
||||
tcphdr->dest, tcphdr->src));
|
||||
tcp_rst((const struct tcp_pcb *)pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
--
|
||||
2.27.0
|
||||
|
||||
|
||||
@ -1,7 +1,18 @@
|
||||
diff -Nur lwip-gz-addr/src/include/lwip/priv/tcp_priv.h lwip-qtuple/src/include/lwip/priv/tcp_priv.h
|
||||
--- lwip-gz-addr/src/include/lwip/priv/tcp_priv.h 2023-12-04 14:08:00.672481010 +0800
|
||||
+++ lwip-qtuple/src/include/lwip/priv/tcp_priv.h 2023-12-11 11:19:34.552481010 +0800
|
||||
@@ -347,24 +347,12 @@
|
||||
From 430469b1fa14ed689781eeed14dc8ce7cadd22a3 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 19:16:07 +0800
|
||||
Subject: replace qtuple addr with gz_addr_t
|
||||
|
||||
---
|
||||
src/include/lwip/priv/tcp_priv.h | 24 ++++++------------------
|
||||
src/include/reg_sock.h | 19 ++++++++++++-------
|
||||
2 files changed, 18 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
|
||||
index 75c67ee..8d7b9df 100644
|
||||
--- a/src/include/lwip/priv/tcp_priv.h
|
||||
+++ b/src/include/lwip/priv/tcp_priv.h
|
||||
@@ -347,24 +347,12 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
|
||||
LWIP_ASSERT("Invalid parameter", pcb != NULL);
|
||||
|
||||
struct gazelle_quintuple qtuple;
|
||||
@ -16,13 +27,14 @@ diff -Nur lwip-gz-addr/src/include/lwip/priv/tcp_priv.h lwip-qtuple/src/include/
|
||||
- qtuple.protocol = 1;
|
||||
- qtuple.src_port = lwip_htons(pcb->local_port);
|
||||
- qtuple.dst_port = lwip_htons(pcb->remote_port);
|
||||
|
||||
-
|
||||
- for (int i = 0; i < 4; i++) {
|
||||
- qtuple.src_ip6[i] = pcb->local_ip.u_addr.ip6.addr[i];
|
||||
- qtuple.dst_ip6[i] = pcb->remote_ip.u_addr.ip6.addr[i];
|
||||
- }
|
||||
-#endif
|
||||
- }
|
||||
+
|
||||
+ qtuple.protocol = IP_IS_V4_VAL(pcb->local_ip) ? GZ_ADDR_TYPE_V4 : GZ_ADDR_TYPE_V6;
|
||||
+ qtuple.src_ip = *((gz_addr_t *)&pcb->local_ip);
|
||||
+ qtuple.src_port = lwip_htons(pcb->local_port);
|
||||
@ -31,9 +43,10 @@ diff -Nur lwip-gz-addr/src/include/lwip/priv/tcp_priv.h lwip-qtuple/src/include/
|
||||
|
||||
#if GAZELLE_TCP_REUSE_IPPORT
|
||||
if (reg_type == REG_RING_TCP_CONNECT_CLOSE) {
|
||||
diff -Nur lwip-gz-addr/src/include/reg_sock.h lwip-qtuple/src/include/reg_sock.h
|
||||
--- lwip-gz-addr/src/include/reg_sock.h 2023-12-06 19:41:19.792481010 +0800
|
||||
+++ lwip-qtuple/src/include/reg_sock.h 2023-12-11 16:17:59.860481010 +0800
|
||||
diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h
|
||||
index a11102e..466a2c2 100644
|
||||
--- a/src/include/reg_sock.h
|
||||
+++ b/src/include/reg_sock.h
|
||||
@@ -37,6 +37,16 @@
|
||||
|
||||
#include "lwipopts.h"
|
||||
@ -51,7 +64,7 @@ diff -Nur lwip-gz-addr/src/include/reg_sock.h lwip-qtuple/src/include/reg_sock.h
|
||||
/* compatible with ip4_addr_t */
|
||||
struct gz_ip4 {
|
||||
uint32_t addr;
|
||||
@@ -78,13 +88,8 @@
|
||||
@@ -78,13 +88,8 @@ struct gazelle_quintuple {
|
||||
uint16_t src_port;
|
||||
uint16_t dst_port;
|
||||
|
||||
@ -67,3 +80,6 @@ diff -Nur lwip-gz-addr/src/include/reg_sock.h lwip-qtuple/src/include/reg_sock.h
|
||||
};
|
||||
|
||||
struct reg_ring_msg {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
From d926ce84920e03b150c60d842f8cd4c4cea671f5 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 19:16:37 +0800
|
||||
Subject: fix wrong namelen in getaddrname
|
||||
|
||||
---
|
||||
src/api/sockets.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 15053b3..c987a2b 100644
|
||||
index f3b8f8c..250c424 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -3020,7 +3020,8 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
|
||||
*namelen = saddr.sa.sa_len;
|
||||
@@ -3063,7 +3063,8 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
|
||||
*namelen = IPADDR_SOCKADDR_GET_LEN(&saddr);
|
||||
}
|
||||
#else
|
||||
- *namelen = LWIP_MIN(*namelen, sizeof(saddr));
|
||||
@ -15,3 +21,6 @@ index 15053b3..c987a2b 100644
|
||||
#endif
|
||||
MEMCPY(name, &saddr, *namelen);
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ Subject: [PATCH] dfx: add tcp_in empty ack cnt and del rst invalid log
|
||||
2 files changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index 69dcd26..40b87fc 100644
|
||||
index 118210a..d6f54b6 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -523,6 +523,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -28,9 +28,9 @@ index 69dcd26..40b87fc 100644
|
||||
- ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
|
||||
+ LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
|
||||
tcphdr->dest, tcphdr->src));
|
||||
tcp_rst(NULL, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
@@ -1547,6 +1547,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
@@ -1517,6 +1517,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
/* End of ACK for new data processing. */
|
||||
} else {
|
||||
/* Out of sequence ACK, didn't really ack anything */
|
||||
@ -38,7 +38,7 @@ index 69dcd26..40b87fc 100644
|
||||
tcp_send_empty_ack(pcb);
|
||||
}
|
||||
|
||||
@@ -1848,6 +1849,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
@@ -1818,6 +1819,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
but lwIP currently does not support including SACKs in data packets. So we force
|
||||
it to respond with an empty ACK packet (only if there is at least one SACK to be sent).
|
||||
NOTE: tcp_send_empty_ack() on success clears the ACK flags (set by tcp_ack()) */
|
||||
@ -46,7 +46,7 @@ index 69dcd26..40b87fc 100644
|
||||
tcp_send_empty_ack(pcb);
|
||||
}
|
||||
#endif /* LWIP_TCP_SACK_OUT */
|
||||
@@ -2088,10 +2090,12 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
@@ -2058,10 +2060,12 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
|
||||
/* We send the ACK packet after we've (potentially) dealt with SACKs,
|
||||
so they can be included in the acknowledgment. */
|
||||
|
||||
@ -45,7 +45,7 @@ index 480470f..ce059e1 100644
|
||||
SRCS =
|
||||
DIRS = api core netif
|
||||
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
|
||||
index c3a877c..6bab368 100644
|
||||
index 2984d24..a3de92d 100644
|
||||
--- a/src/core/ipv4/icmp.c
|
||||
+++ b/src/core/ipv4/icmp.c
|
||||
@@ -241,7 +241,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -58,10 +58,10 @@ index c3a877c..6bab368 100644
|
||||
} else {
|
||||
iph_cksum_set(p, hlen, 0);
|
||||
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
|
||||
index 1e3690f..9e962eb 100644
|
||||
index 4335423..907a2f0 100644
|
||||
--- a/src/core/ipv4/ip4.c
|
||||
+++ b/src/core/ipv4/ip4.c
|
||||
@@ -509,7 +509,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
@@ -543,7 +543,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
||||
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) {
|
||||
#if CHECKSUM_CHECK_IP_HW
|
||||
u64_t ret;
|
||||
@ -70,7 +70,7 @@ index 1e3690f..9e962eb 100644
|
||||
ret = is_cksum_ipbad(p);
|
||||
} else {
|
||||
ret = (u64_t)inet_chksum(iphdr, iphdr_hlen);
|
||||
@@ -986,7 +986,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
@@ -1020,7 +1020,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
#if CHECKSUM_GEN_IP
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
|
||||
#if CHECKSUM_GEN_IP_HW
|
||||
@ -79,7 +79,7 @@ index 1e3690f..9e962eb 100644
|
||||
iph_cksum_set(p, ip_hlen, 1);
|
||||
} else {
|
||||
iph_cksum_set(p, ip_hlen, 0);
|
||||
@@ -1035,7 +1035,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
@@ -1069,7 +1069,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
||||
#if IP_FRAG
|
||||
/* don't fragment if interface has mtu set to 0 [loopif] */
|
||||
#if GAZELLE_ENABLE
|
||||
@ -89,7 +89,7 @@ index 1e3690f..9e962eb 100644
|
||||
if (netif->mtu && (p->tot_len > netif->mtu)) {
|
||||
return ip4_frag(p, netif, dest);
|
||||
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
|
||||
index 3f2521c..98d8b56 100644
|
||||
index 01e3d60..d9bf5cc 100644
|
||||
--- a/src/core/ipv4/ip4_frag.c
|
||||
+++ b/src/core/ipv4/ip4_frag.c
|
||||
@@ -642,7 +642,7 @@ ip4_reass(struct pbuf *p)
|
||||
@ -111,7 +111,7 @@ index 3f2521c..98d8b56 100644
|
||||
} else {
|
||||
iph_cksum_set(p, IP_HLEN, 0);
|
||||
diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c
|
||||
index 7f74f31..1f0e0f6 100644
|
||||
index 5f16cd0..9017d87 100644
|
||||
--- a/src/core/ipv6/ip6.c
|
||||
+++ b/src/core/ipv6/ip6.c
|
||||
@@ -1279,7 +1279,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
@ -124,7 +124,7 @@ index 7f74f31..1f0e0f6 100644
|
||||
if (netif_mtu6(netif) && (p->tot_len > nd6_get_destination_mtu(dest, netif))) {
|
||||
return ip6_frag(p, netif, dest);
|
||||
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
|
||||
index b86232b..ec1905f 100644
|
||||
index d6f54b6..bdd9a04 100644
|
||||
--- a/src/core/tcp_in.c
|
||||
+++ b/src/core/tcp_in.c
|
||||
@@ -209,7 +209,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -137,10 +137,10 @@ index b86232b..ec1905f 100644
|
||||
} else {
|
||||
ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index e5c407e..7b6a1f6 100644
|
||||
index c5c81ae..30cd215 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -1552,7 +1552,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1555,7 +1555,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
|
||||
/* data available and window allows it to be sent? */
|
||||
#if GAZELLE_ENABLE
|
||||
@ -149,7 +149,7 @@ index e5c407e..7b6a1f6 100644
|
||||
uint16_t send_pkt = 0;
|
||||
|
||||
do {
|
||||
@@ -1935,7 +1935,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
@@ -1938,7 +1938,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
#if CHECKSUM_GEN_TCP
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
#if CHECKSUM_GEN_TCP_HW
|
||||
@ -158,9 +158,9 @@ index e5c407e..7b6a1f6 100644
|
||||
tcph_cksum_set(seg->p, TCPH_HDRLEN_BYTES(seg->tcphdr));
|
||||
seg->tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP,seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip);
|
||||
} else {
|
||||
@@ -2378,7 +2378,7 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
@@ -2398,7 +2398,7 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
#if CHECKSUM_GEN_TCP_HW
|
||||
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_CKSUM) {
|
||||
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
|
||||
@ -168,7 +168,7 @@ index e5c407e..7b6a1f6 100644
|
||||
tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP, p->tot_len, src, dst);
|
||||
} else {
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index c150b38..718f9f4 100644
|
||||
index ca82e51..461ec2d 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -414,7 +414,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
@ -254,7 +254,7 @@ index 5efaa39..df3adb5 100644
|
||||
|
||||
#endif /* __DPDK_VERSION_H__ */
|
||||
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
|
||||
index 0be1289..afd13ad 100644
|
||||
index d2960b5..e049cdf 100644
|
||||
--- a/src/netif/ethernet.c
|
||||
+++ b/src/netif/ethernet.c
|
||||
@@ -289,7 +289,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
|
||||
|
||||
@ -1,11 +1,17 @@
|
||||
From d491c37cce3796ddce32b30be7ad23d52937479e Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 19:18:52 +0800
|
||||
Subject: optimize enqueue for unacked and unsent queue
|
||||
|
||||
---
|
||||
src/core/tcp_out.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index e5c407e..f1d501b 100644
|
||||
index 30cd215..1ab5cfb 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -1633,6 +1633,10 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1636,6 +1636,10 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
pbuf_remove_header(new_seg.p, new_seg.p->tot_len - new_seg.len - TCP_HLEN);
|
||||
new_seg.p->tot_len = new_seg.p->len;
|
||||
|
||||
@ -16,7 +22,7 @@ index e5c407e..f1d501b 100644
|
||||
for (int start = pbuf_chain_len; start > 0; start--) {
|
||||
struct tcp_seg *tmp_seg = start_seg;
|
||||
start_seg = start_seg->next;
|
||||
@@ -1643,10 +1647,10 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -1646,10 +1650,10 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
pcb->last_unacked = tmp_seg;
|
||||
pcb->unacked = tmp_seg;
|
||||
useg = tmp_seg;
|
||||
@ -28,7 +34,7 @@ index e5c407e..f1d501b 100644
|
||||
while (*cur_seg &&
|
||||
TCP_SEQ_LT(lwip_ntohl((*cur_seg)->tcphdr->seqno), lwip_ntohl(tmp_seg->tcphdr->seqno))) {
|
||||
cur_seg = &((*cur_seg)->next );
|
||||
@@ -2157,7 +2161,10 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
@@ -2160,7 +2164,10 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
}
|
||||
|
||||
seg = pcb->unacked;
|
||||
@ -39,7 +45,7 @@ index e5c407e..f1d501b 100644
|
||||
/* Give up if the segment is still referenced by the netif driver
|
||||
due to deferred transmission. */
|
||||
if (tcp_output_segment_busy(seg)) {
|
||||
@@ -2174,7 +2181,9 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
@@ -2177,7 +2184,9 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
pcb->last_unacked = pcb->unacked->next;
|
||||
pcb->unacked = pcb->unacked->next;
|
||||
|
||||
@ -49,7 +55,7 @@ index e5c407e..f1d501b 100644
|
||||
while (*cur_seg &&
|
||||
TCP_SEQ_LT(lwip_ntohl((*cur_seg)->tcphdr->seqno), lwip_ntohl(seg->tcphdr->seqno))) {
|
||||
cur_seg = &((*cur_seg)->next);
|
||||
@@ -2190,8 +2199,10 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
@@ -2193,8 +2202,10 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
}
|
||||
#endif /* TCP_OVERSIZE */
|
||||
|
||||
@ -60,3 +66,6 @@ index e5c407e..f1d501b 100644
|
||||
|
||||
if (pcb->nrtx < 0xFF) {
|
||||
++pcb->nrtx;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
||||
@ -8,10 +8,10 @@ Subject: [PATCH] delete redundant logs in lwip
|
||||
1 file changed, 4 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index 15053b3..ce79bb3 100644
|
||||
index 250c424..082ae14 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -447,7 +447,7 @@ tryget_socket_unconn_nouse(int fd)
|
||||
@@ -487,7 +487,7 @@ tryget_socket_unconn_nouse(int fd)
|
||||
if ((s < 0) || (s >= NUM_SOCKETS))
|
||||
#endif /* GAZELLE_ENABLE */
|
||||
{
|
||||
@ -20,7 +20,7 @@ index 15053b3..ce79bb3 100644
|
||||
return NULL;
|
||||
}
|
||||
return &sockets[s];
|
||||
@@ -521,7 +521,7 @@ get_socket(int fd)
|
||||
@@ -561,7 +561,7 @@ get_socket(int fd)
|
||||
struct lwip_sock *sock = tryget_socket(fd);
|
||||
if (!sock) {
|
||||
if ((fd < LWIP_SOCKET_OFFSET) || (fd >= (LWIP_SOCKET_OFFSET + NUM_SOCKETS))) {
|
||||
@ -29,7 +29,7 @@ index 15053b3..ce79bb3 100644
|
||||
}
|
||||
set_errno(EBADF);
|
||||
return NULL;
|
||||
@@ -588,7 +588,6 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
@@ -628,7 +628,6 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
i = posix_api->socket_fn(domain, type, protocol);
|
||||
if (i == -1) {
|
||||
@ -37,7 +37,7 @@ index 15053b3..ce79bb3 100644
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -597,7 +596,6 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
@@ -637,7 +636,6 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
|
||||
}
|
||||
|
||||
if ((i < LWIP_SOCKET_OFFSET) || (i >= sockets_num + LWIP_SOCKET_OFFSET)) {
|
||||
@ -45,8 +45,8 @@ index 15053b3..ce79bb3 100644
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -769,14 +767,13 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
|
||||
@@ -808,14 +806,13 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
|
||||
sock = get_socket(s);
|
||||
if (!sock) {
|
||||
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("get_socket sock is null\n"));
|
||||
@ -59,17 +59,17 @@ index 15053b3..ce79bb3 100644
|
||||
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
|
||||
+ LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
|
||||
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP) {
|
||||
sock_set_errno(sock, EOPNOTSUPP);
|
||||
set_errno(EOPNOTSUPP);
|
||||
} else if (err == ERR_CLSD) {
|
||||
@@ -791,7 +788,6 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
@@ -830,7 +827,6 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
|
||||
newsock = alloc_socket(newconn, 1, flags);
|
||||
if (newsock == -1) {
|
||||
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("alloc_socket fail newsock is -1\n"));
|
||||
netconn_delete(newconn);
|
||||
sock_set_errno(sock, ENFILE);
|
||||
set_errno(ENFILE);
|
||||
done_socket(sock);
|
||||
@@ -811,7 +807,6 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
@@ -850,7 +846,6 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
ret = find_same_node_memzone(pcb, nsock);
|
||||
}
|
||||
if (pcb == NULL || ret != 0) {
|
||||
@ -77,14 +77,14 @@ index 15053b3..ce79bb3 100644
|
||||
netconn_delete(newconn);
|
||||
free_socket(nsock, 1);
|
||||
sock_set_errno(sock, ENOTCONN);
|
||||
@@ -847,7 +842,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
@@ -886,7 +881,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
/* get the IP address and port of the remote host */
|
||||
err = netconn_peer(newconn, &naddr, &port);
|
||||
if (err != ERR_OK) {
|
||||
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
|
||||
+ LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
|
||||
free_socket(nsock, 1);
|
||||
sock_set_errno(sock, err_to_errno(err));
|
||||
set_errno(err_to_errno(err));
|
||||
done_socket(sock);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -13,7 +13,7 @@ Subject: [PATCH] remove unnecessary variables in struct pbuf
|
||||
6 files changed, 36 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
|
||||
index 61690ff..cb5003a 100644
|
||||
index 8386c90..b0a63b4 100644
|
||||
--- a/src/core/pbuf.c
|
||||
+++ b/src/core/pbuf.c
|
||||
@@ -86,6 +86,7 @@
|
||||
@ -24,7 +24,7 @@ index 61690ff..cb5003a 100644
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
@@ -1041,9 +1042,7 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_
|
||||
@@ -1038,9 +1039,7 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_
|
||||
}
|
||||
|
||||
#if GAZELLE_ENABLE && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW)
|
||||
@ -34,12 +34,12 @@ index 61690ff..cb5003a 100644
|
||||
+ pbuf_offload_copy(p_to, p_from);
|
||||
#endif
|
||||
|
||||
len = (u16_t)LWIP_MIN(copy_len, len_calc);
|
||||
len = LWIP_MIN(copy_len, len);
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index bb03aae..f5e1968 100644
|
||||
index 1ab5cfb..70c4242 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -1941,7 +1941,6 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
@@ -1944,7 +1944,6 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
||||
#if CHECKSUM_GEN_TCP_HW
|
||||
if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
|
||||
tcph_cksum_set(seg->p, TCPH_HDRLEN_BYTES(seg->tcphdr));
|
||||
@ -47,10 +47,10 @@ index bb03aae..f5e1968 100644
|
||||
} else {
|
||||
#if TCP_CHECKSUM_ON_COPY
|
||||
u32_t acc;
|
||||
@@ -2388,10 +2387,10 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
|
||||
@@ -2408,10 +2407,10 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
|
||||
#if CHECKSUM_GEN_TCP
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
|
||||
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||
+ tcphdr->chksum = 0;
|
||||
#if CHECKSUM_GEN_TCP_HW
|
||||
if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
|
||||
@ -60,7 +60,7 @@ index bb03aae..f5e1968 100644
|
||||
tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
|
||||
src, dst);
|
||||
diff --git a/src/core/udp.c b/src/core/udp.c
|
||||
index 718f9f4..99bdac1 100644
|
||||
index 461ec2d..440f909 100644
|
||||
--- a/src/core/udp.c
|
||||
+++ b/src/core/udp.c
|
||||
@@ -985,7 +985,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
|
||||
@ -183,7 +183,7 @@ index 38cfb96..115155d 100644
|
||||
|
||||
#endif /* GAZELLE_ENABLE */
|
||||
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
|
||||
index ffdc9fe..99a259c 100644
|
||||
index bc29372..012df23 100644
|
||||
--- a/src/include/lwip/pbuf.h
|
||||
+++ b/src/include/lwip/pbuf.h
|
||||
@@ -225,22 +225,10 @@ struct pbuf {
|
||||
@ -210,7 +210,7 @@ index ffdc9fe..99a259c 100644
|
||||
ip_addr_t addr;
|
||||
u16_t port;
|
||||
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
|
||||
index afd13ad..9fb9357 100644
|
||||
index e049cdf..0d8652b 100644
|
||||
--- a/src/netif/ethernet.c
|
||||
+++ b/src/netif/ethernet.c
|
||||
@@ -290,8 +290,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
|
||||
|
||||
126
0110-adapt-lwip-2.2.0.patch
Normal file
126
0110-adapt-lwip-2.2.0.patch
Normal file
@ -0,0 +1,126 @@
|
||||
From d0251f285bb997cdc0dc1e7ab28ba431bce9c544 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Mon, 5 Feb 2024 19:56:58 +0800
|
||||
Subject: [PATCH] adapt lwip 2.2.0
|
||||
|
||||
---
|
||||
src/api/api_msg.c | 8 ++++----
|
||||
src/api/sockets.c | 23 +++++++----------------
|
||||
src/core/tcp.c | 4 ++--
|
||||
src/core/tcp_out.c | 2 +-
|
||||
src/include/lwipopts.h | 2 +-
|
||||
5 files changed, 15 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index adfdd40..a0baaae 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -295,7 +295,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
SYS_ARCH_INC(conn->recv_avail, len);
|
||||
#endif /* LWIP_SO_RCVBUF */
|
||||
#if GAZELLE_UDP_ENABLE
|
||||
- do_lwip_add_recvlist(conn->socket);
|
||||
+ do_lwip_add_recvlist(conn->callback_arg.socket);
|
||||
#endif /* GAZELLE_UDP_ENABLE */
|
||||
/* Register event with callback */
|
||||
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
|
||||
@@ -357,7 +357,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
SYS_ARCH_INC(conn->recv_avail, len);
|
||||
#endif /* LWIP_SO_RCVBUF */
|
||||
#if GAZELLE_ENABLE
|
||||
- do_lwip_add_recvlist(conn->socket);
|
||||
+ do_lwip_add_recvlist(conn->callback_arg.socket);
|
||||
#endif
|
||||
/* Register event with callback */
|
||||
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
|
||||
@@ -491,7 +491,7 @@ err_tcp(void *arg, err_t err)
|
||||
/* use trypost to prevent deadlock */
|
||||
sys_mbox_trypost(&conn->recvmbox, mbox_msg);
|
||||
#if GAZELLE_ENABLE
|
||||
- do_lwip_add_recvlist(conn->socket);
|
||||
+ do_lwip_add_recvlist(conn->callback_arg.socket);
|
||||
#endif
|
||||
}
|
||||
/* pass error message to acceptmbox to wake up pending accept */
|
||||
diff --git a/src/api/sockets.c b/src/api/sockets.c
|
||||
index e6868a1..923518c 100644
|
||||
--- a/src/api/sockets.c
|
||||
+++ b/src/api/sockets.c
|
||||
@@ -848,7 +848,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
if (pcb == NULL || ret != 0) {
|
||||
netconn_delete(newconn);
|
||||
free_socket(nsock, 1);
|
||||
- sock_set_errno(sock, ENOTCONN);
|
||||
+ set_errno(ENOTCONN);
|
||||
done_socket(sock);
|
||||
return -1;
|
||||
}
|
||||
@@ -2840,7 +2840,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
||||
break;
|
||||
case NETCONN_EVT_ERROR:
|
||||
if ((conn->pending_err != ERR_OK) && (conn->pending_err != ERR_RST)) {
|
||||
- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->socket));
|
||||
+ LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->callback_arg.socket));
|
||||
}
|
||||
sock->errevent = 1;
|
||||
#if GAZELLE_ENABLE
|
||||
@@ -4246,7 +4246,7 @@ lwip_fcntl(int s, int cmd, int val)
|
||||
default:
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val));
|
||||
#if GAZELLE_ENABLE
|
||||
- sock_errno(sock, 0); /* not yet implemented, but we return 0 for compatilbe with app */
|
||||
+ set_errno(0); /* not yet implemented, but we return 0 for compatilbe with app */
|
||||
ret = 0;
|
||||
#else
|
||||
set_errno(ENOSYS); /* not yet implemented */
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index a9a6513..69f6953 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -258,7 +258,7 @@ tcp_free(struct tcp_pcb *pcb)
|
||||
rte_ring_free(pcb->client_rx_ring);
|
||||
rte_ring_free(pcb->client_tx_ring);
|
||||
netconn = (struct netconn *)pcb->callback_arg;
|
||||
- sock = get_socket(netconn->socket);
|
||||
+ sock = get_socket(netconn->callback_arg.socket);
|
||||
rte_memzone_free(sock->same_node_rx_ring->mz);
|
||||
rte_memzone_free(sock->same_node_rx_ring_mz);
|
||||
rte_memzone_free(sock->same_node_tx_ring->mz);
|
||||
@@ -995,7 +995,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u16_t backlog, err_t *err)
|
||||
lpcb->next_same_port_pcb = NULL;
|
||||
|
||||
struct netconn* conn = pcb->callback_arg;
|
||||
- lpcb->socket_fd = conn->socket;
|
||||
+ lpcb->socket_fd = conn->callback_arg.socket;
|
||||
lpcb->master_lpcb = conn->is_master_fd;
|
||||
#endif
|
||||
|
||||
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
|
||||
index 70c4242..1632a66 100644
|
||||
--- a/src/core/tcp_out.c
|
||||
+++ b/src/core/tcp_out.c
|
||||
@@ -2501,7 +2501,7 @@ tcp_rst(const struct tcp_pcb *pcb, u32_t seqno, u32_t ackno,
|
||||
|
||||
p = tcp_rst_common(pcb, seqno, ackno, local_ip, remote_ip, local_port, remote_port);
|
||||
if (p != NULL) {
|
||||
- tcp_output_control_segment(pcb, p, local_ip, remote_ip);
|
||||
+ tcp_output_control_segment((struct tcp_pcb *)pcb, p, local_ip, remote_ip);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index d54ff1e..28b8aca 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
#define LWIP_TIMERS 1
|
||||
|
||||
-#define TCP_SND_BUF (2500 * TCP_MSS)
|
||||
+#define LWIP_TIMEVAL_PRIVATE 0
|
||||
|
||||
/*
|
||||
------------------------------------------------
|
||||
--
|
||||
2.33.0
|
||||
|
||||
BIN
lwip-2.1.3.zip
BIN
lwip-2.1.3.zip
Binary file not shown.
BIN
lwip-2.2.0.zip
Normal file
BIN
lwip-2.2.0.zip
Normal file
Binary file not shown.
17
lwip.spec
17
lwip.spec
@ -3,15 +3,12 @@
|
||||
|
||||
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
|
||||
Name: lwip
|
||||
Version: 2.1.3
|
||||
Release: 116
|
||||
Version: 2.2.0
|
||||
Release: 1
|
||||
License: BSD
|
||||
URL: http://savannah.nongnu.org/projects/lwip/
|
||||
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
|
||||
|
||||
Patch6001: backport-tcp-fix-sequence-number-comparison.patch
|
||||
Patch6002: backport-tcp-tighten-up-checks-for-received-SYN.patch
|
||||
|
||||
Patch9000: 0001-add-makefile.patch
|
||||
Patch9001: 0002-adapt-lstack.patch
|
||||
Patch9002: 0003-fix-the-occasional-coredump-when-the-lwip-exits.patch
|
||||
@ -57,7 +54,7 @@ Patch9041: 0042-expand-recv-win.patch
|
||||
Patch9042: 0043-add-prefetch.patch
|
||||
Patch9043: 0044-skip-unnecessary-tcp_route.patch
|
||||
Patch9044: 0045-add-variable-in-struct-sock.patch
|
||||
Patch9045: 0046-add-dataack-when-recv-too-many-acks-with-data.patch
|
||||
|
||||
Patch9046: 0047-reduce-struct-pbuf-size.patch
|
||||
Patch9047: 0048-listen-pcb-also-use-pcb_if.patch
|
||||
Patch9048: 0049-expand-recv-mbox-size.patch
|
||||
@ -90,8 +87,7 @@ Patch9074: 0075-adapt-read-write-for-rtc-mode.patch
|
||||
Patch9075: 0076-fix-recvmsg-return-EINVAL.patch
|
||||
Patch9076: 0077-adpat-event-for-rtc-mode.patch
|
||||
Patch9077: 0078-posix_api-support-select.patch
|
||||
Patch6003: backport-Add-outgoing-VLAN-PCP-support.patch
|
||||
Patch6004: backport-fix-compiling-ETHARP_SUPPORT_VLAN.patch
|
||||
|
||||
Patch9078: 0079-enable-vlan-define.patch
|
||||
Patch9079: 0080-enable-ipv6.patch
|
||||
Patch9080: 0081-ip6-hdr.patch
|
||||
@ -117,7 +113,6 @@ Patch9099: 0100-replace-qtuple-addr-with-gz_addr_t.patch
|
||||
Patch9100: 0101-fix-wrong-namelen-in-getaddrname.patch
|
||||
Patch9101: 0102-dfx-add-tcp_in-empty-ack-cnt-and-del-rst-invalid-log.patch
|
||||
|
||||
Patch6005: backport-tcp_in-fix-ooseq-update-error.patch
|
||||
|
||||
Patch9102: 0103-adapt-for-dpdk-23.11.patch
|
||||
Patch9103: 0104-optimize-enqueue-for-unacked-and-unsent-queue.patch
|
||||
@ -126,6 +121,7 @@ Patch9105: 0106-remove-unnecessary-variables-in-struct-pbuf.patch
|
||||
Patch9106: 0107-fix-move-lpcb-to-the-front-of-list-error.patch
|
||||
Patch9107: 0108-fix-receive-fin-packet-process-error.patch
|
||||
Patch9108: 0109-support-udp-recv-zero-packets.patch
|
||||
Patch9109: 0110-adapt-lwip-2.2.0.patch
|
||||
|
||||
BuildRequires: gcc-c++ dos2unix dpdk-devel
|
||||
|
||||
@ -155,6 +151,9 @@ cd %{_builddir}/%{name}-%{version}/src
|
||||
%{_libdir}/liblwip.a
|
||||
|
||||
%changelog
|
||||
* Mon Feb 05 2024 jiangheng <jiangheng14@huawei.com> - 2.2.0-1
|
||||
- update to lwip-2.2.0
|
||||
|
||||
* Fri Feb 2 2024 shafeipaozi <sunbo.oerv@isrc.iscas.ac.cn> - 2.1.3-116
|
||||
- add support riscv
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user