Commit Graph

401 Commits (b0153b7fc5aa9cf1f8ff901b6dc869470e56d67f)

Author SHA1 Message Date
Tony Wu 81d667e1f3 netsocket - Fix set_ip_bytes out-of-bound access
set_ip_bytes() does a 16-byte memcpy from the input buffer to
the local nsapi_addr_t despite the address version.

If the address version is ipv4, the input buffer may only be
4-byte in size. This causes a out-of-bound access on the input buffer.

Signed-off-by: Tony Wu <tonywu@realtek.com>
2016-11-18 12:18:25 +00:00
Tony Wu 82df0e1181 lwip - Fix lwip_mac_address buffer overflow
Sounds serious, but should be benign.

Signed-off-by: Tony Wu <tonywu@realtek.com>
2016-11-18 12:18:24 +00:00
Mahadevan Mahesh 0a134b851a K64F ENET: Update to remove unused variable. This is no longer available in the updated SDK ENET driver 2016-11-18 12:18:21 +00:00
Christopher Haster b724f0ca35 nsapi - Added test cases for gethostbyname
- test_dns_query
- test_dns_query_pref
- test_dns_literal
- test_dns_literal_pref
2016-11-18 12:18:07 +00:00
Christopher Haster eaff8047a5 nsapi - Fixed missing NSAPI_UNSPEC check in gethostbyname for ip literals 2016-11-18 12:18:06 +00:00
Bartek Szatkowski 1fa22a8fbc WiFi: Minor fixes to docs and includes 2016-11-18 12:18:04 +00:00
Christopher Haster 14b7ca78d1 Adopted MBED_STATIC_ASSERT where possible 2016-11-18 12:17:36 +00:00
andreas.larsson 10cfea3bd8 Added emac_stack_mem_copy. Needed by the u-blox ODIN-W2 driver. 2016-11-08 10:45:01 +00:00
Christopher Haster a49783c34f nsapi - Adopted standardized return types in the Nanostack interfaces 2016-11-08 10:44:59 +00:00
Christopher Haster e769c79ccc nsapi - Adopted standardized return types in lwip 2016-11-08 10:44:56 +00:00
Christopher Haster 67dcb9fc4e nsapi - Added standardized return types for size and errors
nsapi_error_t         - enum of errors or 0 for NSAPI_ERROR_OK
nsapi_size_t          - unsigned size of data that could be sent
nsapi_size_or_error_t - either a non-negative size or negative error
2016-11-08 10:44:55 +00:00
Mahadevan Mahesh dc7f0200dc Update tests to fix build failures. Also make the code similar to other tests
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2016-11-08 10:44:30 +00:00
Kevin Bracey 24016a1262 nsapi_dns: Provide 2 IPv6-hosted default servers
Replace Comodo and OpenDNS IPv4 servers with Google and DNS.WATCH IPv6
servers, so IPv6-only devices (eg 6LoWPAN) have a default.

3 IPv4 resolvers should be plenty - existing code doesn't remember which
one last worked, so if early list entries were unreachable performance
would be consistently bad anyway. Replacing two entries avoids
increasing image size and RAM consumption.

On an IPv6-only or IPv4-only system, the sendto() for the wrong type of
address should fail immediately - change loop to move on to the next
server for any sendto() error.
2016-11-08 10:44:15 +00:00
Kevin Bracey df07f61f58 NanostackInterface: Remove string round-trips
Older versions of SocketAddress required conversion via string - this is
no longer the case.
2016-11-08 10:44:14 +00:00
Kevin Bracey cef0a8f561 NanostackInterface: Allow binding to address
These days Nanostack does let you bind to an address - permit this.
(Remembering to check it is an IPv6 address).
2016-11-08 10:44:13 +00:00
Kevin Bracey 6582aa4e2a NanostackInterface: Check input address is IPv6
For the two calls that use the address - sendto and connect, check that it
actually is an IPv6 address.
2016-11-08 10:44:12 +00:00
Jeremy Brodt 9363f2bb00 Add wait for serial characters to transmit before deleting serial object. 2016-11-08 10:44:07 +00:00
Colin Hogben d484d573ab lwip: Expose principal socket limits as configuration parameters.
Allow the limits on numbers of sockets to be changed via the
configuration system.  The help texts show the RAM penalty from
increasing each value.
2016-11-08 10:44:02 +00:00
Colin Hogben 3eefc86cce lwip: Annotate with memory used by config parameters 2016-11-08 10:44:01 +00:00
Colin Hogben 9e25e1e07f lwip: Allow several configuration macros to be set externally.
Manually rebasing after the monster restructuring.
2016-11-08 10:43:59 +00:00
jeromecoutant f6ced8690c i2c_loop tests update for STM32 2016-11-08 10:43:54 +00:00
Christopher Haster 7657db4be9 nsapi - Added better heuristic for the default record of DNS queries
Takes advantage of the get_ip_address function to predict the IP
address version wanted by the underlying interface. The should avoid
the need for most IPv6 interfaces to overload gethostbyname.

suggested by @kjbracey-arm
2016-11-08 10:43:52 +00:00
Christopher Haster 7efae2ebc9 lwip/nsapi - Cleaned up warnings in network code
- cc.h@57,1: "BYTE_ORDER" redefined
- lwip_inet_chksum.c@560,44: passing argument 1 of 'thumb2_checksum'
  discards 'const' qualifier from pointer target type
- lwip_pbuf.c@1172,9: variable 'err' set but not used
- SocketAddress.cpp@293,1: control reaches end of non-void function
2016-11-08 10:43:50 +00:00
Christopher Haster 5c97ea9254 lwip - Change k64f emac layer to drop frames on buffer exhaustion
Previously, exhausting hardware buffers would begin blocking the lwip
thread. This patch changes the emac layer to simply drop ethernet
frames, leaving recovery up to a higher level protocol.

This is consistent with the behaviour of the emac layer when unable
to allocate dynamic memory.
2016-11-08 10:43:42 +00:00
Christopher Haster 14f9518709 lwip - Fixed memory leak in k64f cyclic-buffer overflow
This was actually several bugs colluding together.

1. Confusion on the buffer-semaphore paradigm used led to misuse of the
tx semaphore and potential for odd behaviour.

2. Equality tests on tx_consume_index and tx_produce_index did not
handle overflow correctly. This would allow tx_consume_index to catch
up to tx_produce_index and trick the k64f_rx_reclaim function into
forgetting about a whole buffer of pbufs.

3. On top of all of that, the ENET_BUFFDESCRIPTOR_TX_READ_MASK was not
correctly read immediately after being set due to either a compiler
optimization or hardware delays. This caused k64f_low_level_output
to eagerly overrun existing buff-descriptors before they had been
completely sent. Adopting the counting-semaphore paradigm for 1 avoided
this concern.

As pointed out by @infinnovation, the overflow only occurs in the rare
case that the 120MHz CPU can actually generate packets faster than the
ENET hardware can transmit on a 100Mbps link.
2016-11-08 10:43:40 +00:00
Marcus Chang 4600de67cb Removed static declaration for the StorageVolumeManager in the CFStore because this componenent is shared across all users of the flash. Added define guards to the CFStore location and size so that these can be changed from the settings file. 2016-11-08 10:43:39 +00:00
Mahadevan Mahesh 81733d3388 FAT tests: Add support for KL43Z
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2016-11-08 10:43:35 +00:00
Mahadevan Mahesh 7cccf2edac Update USB driver for devices with Kinetis SDK support
1. Fix build issues with IAR and GCC toolchain
2. Update clock initialization code

Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2016-11-08 10:43:34 +00:00
Mika Leppänen 9e8195f436 Added support for 6lowpan PAN ID filter to mbed mesh api configuration 2016-11-08 10:43:27 +00:00
Brian Daniels 9e8f5bc564 Replacing getchar with RawSerial getc in greentea-client.
This change prevents the standard library from allocating a large buffer
on the heap. On GCC_ARM, this is a saving of 1K. On ARM, this is a saving
of 64 bytes.
2016-11-08 10:43:26 +00:00
jeromecoutant ad115672a2 digital_loop tests update for STM32 2016-11-08 10:42:58 +00:00
jeromecoutant c9ced221ef analog_loop tests update for STM32 2016-10-27 11:13:47 +01:00
Christopher Haster d36bda7d81 lwip - Added support for NSAPI_UNSPEC to lwip 2016-10-27 11:13:46 +01:00
Christopher Haster 1703ed38c9 nsapi - Standardized support of NSAPI_UNSPEC
- Reordered nsapi_version_t to make defaule nsapi_addr_t NSAPI_UNSPEC
- Added support to NSAPI_UNSPEC in SocketAddress
2016-10-27 11:13:44 +01:00
Steven Cooreman 88c9e07c53 Workaround for SDK5.0.0 and USB
Aliased a few macros that changed name from SDK4.x to SDK5.x. in order to make the USB library play nice with SDK5.0.0
2016-10-27 11:13:39 +01:00
Marc Moreno Berengue 21788eae8d Update BLE Cordio libraries
This patch updates the BLE Cordio libraries.

Signed-off-by: Marc Moreno <marc.morenoberengue@arm.com>
2016-10-27 11:13:09 +01:00
Bruno Monteiro Pires aa6fbb676f Fixed tab spacing from 0e8ba85
* Removed missplaced tabs

Signed-off-by: Bruno Monteiro Pires <brunomonteiropires@gmail.com>
2016-10-27 11:13:05 +01:00
Bruno Monteiro Pires 8b3ae981df Enable / Disable serial debug.
+ Added ``void debug(bool dbg)`` method to allow enabling/disabling
  serial debug at runtime.
+ Replaced calls to ``debug`` with ``debug_if`` to prevent messges
  from being thrown via serial when debug is disabled.

Signed-off-by: Bruno Monteiro Pires <brunomonteiropires@gmail.com>
2016-10-27 11:13:04 +01:00
Christopher Haster 20e97b0312 nsapi - Fixed unaligned writes from <word-sized scanf calls 2016-10-27 11:12:58 +01:00
Christopher Haster 8dcbf63bb6 nsapi - Fixed leftover bytes from suffix during ipv6 parsing
Thanks to @EduardPon for hunting this down
2016-10-27 11:12:55 +01:00
Andrzej Puzdrowski 8339f9c294 Fix - Remove unwanted changes to the legacy nrf51822 target (caused by rebase). ad applied them to to regular targets. Fix a typo and polish nordic's code. 2016-10-27 11:12:44 +01:00
Andrzej Puzdrowski 647bdcd3e2 nRF5x Add registering bluetooth's IRQn vector by NVIC_SetVector. 2016-10-27 11:12:42 +01:00
Andres AG 1d875083b7 Add checks for NULL_ENTROPY and SSL_TLS in mbed OS 2016-10-20 14:53:57 -05:00
Hasnain Virk c23146bd59 ONME-2822 Binary build script mod
* Binary build script is modified to follow currebt mbedOS baseline structure
* License files are moved to the correct location.
* Contribution.md is also moved to the correct location.
2016-10-19 17:24:23 -05:00
Mika Leppänen 2794b48c38 Corrected lwip TCP socket accept ipv6 address conversion 2016-10-19 17:24:13 -05:00
Andres AG 97265afc5e Update feature/mbedtls to version 2.4.0 2016-10-19 17:24:12 -05:00
Russ Butler 87e1b379ea CFSTORE - Fix test failures due to fragmentation
In the config store create test in test case #5 the amount of available
memory is determined by fully allocating the heap. This is done
multiple times to determine if there is a memory leak. This causes
problems when even slight fragmentation occurs in the heap, since
the size that can be allocated is decreased slightly, which the test
flags as a memory leak.

This patch makes memory leak detection more robust by using metrics
provided by mbed_stats_heap_get. These metrics are an exact
measurement of memory allocated is not changed by fragmentation.
This allows the memory leak test to report correct values regardless of
fragmentation.
2016-10-19 17:24:11 -05:00
Russ Butler a37ccd1133 CFSTORE - Delete handle even if key ref non zero
When closing a file handle remove the handle from the handle list
regardless of what the reference count of the key it is pointing to is.
This prevents config store from keeping a handle to file handles that
have gone out of scope.
2016-10-19 17:24:10 -05:00
Russ Butler 5a5dbc2b31 CFSTORE - fix handling of realloc fail on delete
The function cfstore_delete_ex is written under the assumption that
CFSTORE_REALLOC will never fail if the size is decreasing. Regardless
of the status of CFSTORE_REALLOC the entry is removed from the config
store and zeroed. This works correctly if CFSTORE_REALLOC correctly
updates area_0_tail, but can lead to crashes in the case area_0_tail is
left unchanged. The crash is because when iterating over the config
store data, cfstore_get_next_hkvt is unable to determine the end of
valid data.

This patch fixes this problem by handling the realloc failure case by
updating area_0_tail even if CFSTORE_REALLOC returns NULL. This
patch also adds an assert to check for out of bound entries in when
calling cfstore_get_next_hkvt. This allows an assert to be triggered
if this bug is re-introduced, rather than a crash.
2016-10-19 17:24:09 -05:00
Russ Butler 9368766cb0 CFSTORE - Fix crashed due to uninit data
When the config store is powered down area_0_head is freed, but
area_0_len is not set to 0. This causes when cfstore_realloc_ex is
called, since on the first allocation it appears that the config store
size is decreasing, and therefore the data is not initialized.

Since the data is uninitiated various fields such as the reference
can have invalid values. On GCC_ARM built with heap stats enabled
this manifests as a crash due to an invalid reference count.

This patch fixes this problem by setting area_0_len to 0 when the data
is freed.
2016-10-19 17:24:08 -05:00