Skip to content
Permalink
Browse files

net: ip: net_pkt: Add pkt_cursor_advance before contiguous check

When net_pkt_skip skips the entire data in a net buffer, the cursor
still points to this buffer on data that is off by one.
Calling pkt_cursor_advance in net_pkt_is_contiguous fixes this and
moves the cursor to the next buffer.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
  • Loading branch information...
alexanderwachter authored and jukkar committed Jun 19, 2019
1 parent 12e11b0 commit 0261ecdee480f3d94fed3a82f053d0df2e30c8cf
Showing with 2 additions and 0 deletions.
  1. +2 −0 subsys/net/ip/net_pkt.c
@@ -1827,6 +1827,8 @@ u16_t net_pkt_get_current_offset(struct net_pkt *pkt)

bool net_pkt_is_contiguous(struct net_pkt *pkt, size_t size)
{
pkt_cursor_advance(pkt, !net_pkt_is_being_overwritten(pkt));

if (pkt->cursor.buf && pkt->cursor.pos) {
size_t len;

0 comments on commit 0261ecd

Please sign in to comment.
You can’t perform that action at this time.