net: pkt: Fix net_pkt_split()
The net_pkt_split() was incorrectly checking fragA pointer even before it was allocated. The unit test is fixed and converted to ztest. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
096a9984b2
commit
72567677e7
4 changed files with 187 additions and 368 deletions
|
@ -1588,12 +1588,6 @@ int net_pkt_split(struct net_pkt *pkt, struct net_buf *orig_frag,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len > net_buf_tailroom(*fragA)) {
|
|
||||||
NET_DBG("Length %u is larger than fragment size %zd",
|
|
||||||
len, net_buf_tailroom(*fragA));
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len > orig_frag->len) {
|
if (len > orig_frag->len) {
|
||||||
*fragA = net_pkt_get_frag(pkt, timeout);
|
*fragA = net_pkt_get_frag(pkt, timeout);
|
||||||
if (!*fragA) {
|
if (!*fragA) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ CONFIG_NET_BUF_DATA_SIZE=100
|
||||||
CONFIG_NET_LOG=y
|
CONFIG_NET_LOG=y
|
||||||
CONFIG_SYS_LOG_NET_LEVEL=1
|
CONFIG_SYS_LOG_NET_LEVEL=1
|
||||||
CONFIG_SYS_LOG_SHOW_COLOR=y
|
CONFIG_SYS_LOG_SHOW_COLOR=y
|
||||||
CONFIG_NET_DEBUG_NET_PKT=y
|
#CONFIG_NET_DEBUG_NET_PKT=y
|
||||||
CONFIG_RANDOM_GENERATOR=y
|
CONFIG_RANDOM_GENERATOR=y
|
||||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||||
|
CONFIG_ZTEST=y
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
obj-y = main.o
|
obj-y = main.o
|
||||||
ccflags-y += -I${ZEPHYR_BASE}/subsys/net/ip
|
ccflags-y += -I${ZEPHYR_BASE}/subsys/net/ip
|
||||||
ccflags-y += -I${ZEPHYR_BASE}/tests/include
|
|
||||||
|
include $(ZEPHYR_BASE)/tests/Makefile.test
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue