Axel Lin
6f28a874b8
pbuf: Simplify pbuf_alloc a bit
...
No need to have additional if statement for PBUF_REF/PBUF_ROM.
It can be merged to the existing swtich(type) cases.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-07-10 09:37:07 +02:00
goldsimon
debf34ff9c
work on -Wconversion...
2017-07-04 21:26:30 +02:00
goldsimon
2b2fa0ed71
Ensure SACKs are deleted when pbuf_free_ooseq() frees ooseq pbufs (because of memory shortage)
2017-07-04 20:10:23 +02:00
goldsimon
c636072362
pbuf.c: work on -Wconversion...
2017-06-29 22:49:39 +02:00
Dirk Ziegelmeier
d02a73c285
Replace usages of tcpip_callback_with_block(foo, bar, 0) with tcpip_try_callback()
2017-06-22 08:14:02 +02:00
goldsimon
79d69ce526
Slightly optimize pbuf_alloc: encode 'header offset' in 'enum pbuf_layer' instead of switch/case (which was duplicated in pbuf_alloc and pbuf_alloced_custom)
2017-06-21 13:37:05 +02:00
goldsimon
67d1970059
pbuf_alloced_custom(): less code duplication, please :-)
2017-06-14 21:39:53 +02:00
Dirk Ziegelmeier
d5cdb91611
Fix compile of Axel Lin's patch
2017-06-14 12:30:55 +02:00
Axel Lin
6b4cc984ad
pbuf: Allow pass flags to pbuf_init_alloced_pbuf()
...
Then we can reuse pbuf_init_alloced_pbuf() in pbuf_alloced_custom().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-14 12:28:29 +02:00
Axel Lin
3aca7885a7
pbuf: Init pbuf if_idx to NETIF_NO_INDEX in pbuf_alloced_custom
...
Otherwise the p->pbuf.if_idx is uninitialized.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-05-31 19:10:00 +02:00
Axel Lin
cbbfb1356c
pbuf: Make pbuf_init_alloced_pbuf take pbuf_type instead of u8_t for type parameter
...
All callers pass pbuf_type to pbuf_init_alloced_pbuf(), so make it take
pbuf_type instead of u8_t.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-24 12:19:32 +02:00
goldsimon
356da76cc8
Work on bug #3031/task #7896 : change pbuf->type/enum pbuf_type to be more generic (see UPGRADING)
2017-05-22 22:30:55 +02:00
goldsimon
7defe372b9
fixed compiling pbuf.c with LWIP_TCP==0
2017-05-03 09:02:06 +02:00
Axel Lin
c144e5b1ec
pbuf_coalesce: Replace pbuf_alloc+pbuf_copy with pbuf_clone
...
Avoid duplicate the same implementation.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-02 20:36:00 +02:00
Dirk Ziegelmeier
20fed63297
Add custom pbuf usage example to pbuf_alloced_custom() docs
2017-04-28 13:19:32 +02:00
Dirk Ziegelmeier
a09a8e4a06
Some documentation updates and fixes
...
Dedicated Zero-copy RX page
Fix doxygen warnings
2017-04-27 12:41:08 +02:00
Axel Lin
4c9b316e6b
pbuf: Fix allocate zero length pbuf
...
Current code fails to allocate zero length pbuf (e.g. for PBUF_RAW PBUF_POOL),
fix it.
Fixes: eb269e61b5
("First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-26 20:15:22 +02:00
goldsimon
eb269e61b5
First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator
2017-04-25 23:04:12 +02:00
goldsimon
e57552d401
pbuf_alloc_copy -> pbuf_clone
2017-04-25 22:02:07 +02:00
goldsimon
dcb2cb99a1
Added 'pbuf_alloc_copy' e.g. as a single function for use with non scatter-gather drivers
2017-04-25 10:08:31 +02:00
goldsimon
3aa854409a
pbuf_copy_partial: remove double-check of 'buf' and 'dataptr'
2017-03-30 21:29:53 +02:00
goldsimon
49414826af
pbuf: added new function pbuf_free_header() to gradually hide bytes and free pbufs from the front of a pbuf chain
2017-03-06 21:53:48 +01:00
Dirk Ziegelmeier
01f9a04e4a
Add pbuf_get_contiguous() to doxygen docs
2017-02-26 09:44:16 +01:00
Dirk Ziegelmeier
08931b33c1
Fix documentation on pbuf_get_contiguous()
2017-02-25 17:03:14 +01:00
goldsimon
0da9cf70ea
Added pbuf_get_contiguous() to get data in one piece (either zero copy from pbuf or memcpied into a supplied buffer)
2017-02-24 21:36:49 +01:00
goldsimon
76763c9bcd
pbuf_ref: assert-check for 'ref' overflow
2017-02-23 20:16:51 +01:00
Dirk Ziegelmeier
2cf3bbddd4
pbuf_free: Use correct type LWIP_PBUF_REF_T for local variable
2017-02-23 18:08:26 +01:00
Dirk Ziegelmeier
0f6d8ccd90
Revert "Improve pbuf refcount underflow check by checking the local variable on the stack that was assigned in a protected region"
...
This reverts commit 62c44138da
.
Didn't notice due to local changes the ASSERTION was already inside the locks...
2017-02-23 18:04:30 +01:00
Dirk Ziegelmeier
62c44138da
Improve pbuf refcount underflow check by checking the local variable on the stack that was assigned in a protected region
...
The old code was vulnerable to race conditions since it checked ref to be >0 without locks
2017-02-23 16:55:14 +01:00
Dirk Ziegelmeier
0eeb10d4bb
Preparation for task #14369 : Define ways to work with a netif having multiple ports
...
Add if_idx member to struct pbuf
2017-02-23 16:34:28 +01:00
David van Moolenbroek
03f47e58a3
udp/raw: prevent packet length overflows
...
Previously, on netifs with unrestricted MTUs (typically loopback
interfaces), it was possible to give a packet to the UDP/RAW API
calls that is so large that when prepending headers, the pbuf's
tot_len field would overflow. This could easily result in
undesirable behavior at lower layers, e.g. a crash when copying
the packet for later delivery.
This patch models such overflows as memory allocation errors, thus
resulting in clean failures. Checks have to be added in multiple
places to cover (hopefully) all cases.
2017-02-08 22:19:46 +01:00
Dirk Ziegelmeier
9898d406bc
Fix bug #50040 : pbuf_alloc(..., 65534, PBUF_RAM) succeeds
...
Check for integer overflow when calculating memory allocation size
2017-01-15 17:36:33 +01:00
Dirk Ziegelmeier
e94c9ffa70
Fix warning about bad cast in pbuf_skip()
2017-01-05 08:14:39 +01:00
Dirk Ziegelmeier
dd96c71253
Fix a few -Wconversion warnings (there are many more to do)
2016-12-20 14:22:51 +01:00
Dirk Ziegelmeier
e0c0ba7e1b
Fix compile with LWIP_NOASSERT
...
Pointed out by Nirav Desai
2016-12-19 10:11:23 +01:00
Dirk Ziegelmeier
f2a5aa2866
Fix bug #49827 : wrong cast to size_t on 16-bit x86 architecture
...
I hope I caught all of them.
TODO: Same for casts to get rid of alignment warnings, these are also casts via size_t
2016-12-12 10:07:00 +01:00
Dirk Ziegelmeier
801f26ee0c
Minor documentation update
2016-10-16 19:07:55 +02:00
goldsimon
6edde498e3
pbuf_copy: try to fix GCC const warning
2016-10-11 09:52:44 +02:00
goldsimon
697be5c2c3
Make some pbuf functions take const pbuf pointers
2016-10-11 09:23:45 +02:00
Dirk Ziegelmeier
eb77c839fc
Minor: comment in pbuf.c
2016-10-03 09:45:59 +02:00
Dirk Ziegelmeier
149701b347
Fix bug #49218 : pbuf_clen() overflow as a result of tcp_write concatenation
...
Let pbuf_clen() return u16_t
2016-09-30 09:04:36 +02:00
Dirk Ziegelmeier
c25de8f317
Update comment in MDNS and pbuf.c
2016-09-21 12:37:31 +02:00
Dirk Ziegelmeier
eb3a08308d
Improve my last docs
2016-09-20 09:14:32 +02:00
Dirk Ziegelmeier
470dae613e
Documentation: Add example for zero-copy RX using custom PBUF
2016-09-20 09:03:49 +02:00
Dirk Ziegelmeier
ac6b64cf66
Implement a more readable fix for pbuf_memcmp than my last fix
2016-08-31 20:24:37 +02:00
Dirk Ziegelmeier
4325aca0f7
Fix pbuf_memcmp() implementation by using pbuf_try_get_at() instead of pbuf_get_at(). Payload out-of-bounds access was not handled correctly.
2016-08-31 10:35:42 +02:00
sg
a08ed9148d
added pbuf_try_get_at() (much like pbuf_get_at() but can return out-of-pbuf error)
2016-08-30 21:35:37 +02:00
Dirk Ziegelmeier
aef3d2cb87
Minor coding style fix in pbuf.c
2016-08-30 21:09:24 +02:00
Axel Lin
1c5c96a50a
pbuf: Use SYS_ARCH_INC in pbuf_ref()
...
Use SYS_ARCH_INC to simplify the code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-08-23 08:59:10 +02:00
Dirk Ziegelmeier
6b524367a3
Documentation review with Simon, minor changes
2016-07-27 08:05:38 +02:00