Commit Graph

24 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
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 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
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
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 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
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
Martin Kojtal 3a33de6577 lwip-interface: fix issue #2993
DEVICE_ are passed as command line -D, thus no inclusion is required.
``platform.h`` is C++ header file, should not be pulled in C files
2016-10-14 16:15:36 -05:00
Bartek Szatkowski ac0caaba9a DNS: Rework DNS query
Don't ask multiple DNS servers in case of successful connection, even if
the response is negative. Make sure the return value is correct.
2016-10-14 16:15:33 -05:00
Bartek Szatkowski 18286a8d7f DNS: Fix return value for successful name resolutions 2016-10-10 17:25:14 +01:00
Jimmy Brisson 9071e2b347 Add tags to our code 2016-10-10 17:24:07 +01:00
Christopher Haster 4f1ededb58 Renamed NSAPI_SECURITY_UNSUPPORTED -> NSAPI_SECURITY_UNKNOWN
Returning a wifi access point without information regarding the
security type is only valid if the security type is unknown (from
the perspective of the network-socket API). For clarity in situations
in which scan may return an unsupported, but known security type,
type name has been changed to NSAPI_SECURITY_UNKNOWN.
2016-10-04 14:23:36 -05:00
Bartek Szatkowski febc341672 Fix spelling error: NSAPI_SECURITY_UNSUPPORTED 2016-10-04 17:34:58 +01:00
andreas.larsson e87f013c4d Fixed missing public 2016-10-04 15:52:56 +02:00
andreas.larsson 8ea46eae17 Fixed missing abstract connect method 2016-10-04 15:52:55 +02:00
andreas.larsson b418fce8ac Added function for increasing ref count. 2016-10-04 15:52:55 +02:00
Christopher Haster 5cd2d7869e Merge remote-tracking branch 'upstream/master' into feature_wifi_ublox_merge 2016-10-02 07:29:07 -05:00
Christopher Haster c2d9fc29ff restructure - Fixed include paths damaged by the restructure 2016-09-30 19:18:09 -05:00
Christopher Haster ba99a1f31d restructure - Restructured features/net directory
features/net/network-socket -> features/netsocket
features/net/FEATURE_IPV4 -> features/FEATURE_LWIP
features/net/nanostack-binaries -> features/nanostack
features/net/FEATURE_NANOSTACK -> features/nanostack/FEATURE_NANOSTACK
2016-09-30 19:18:09 -05:00