Commit Graph

1520 Commits

Author SHA1 Message Date
Sebastien Griffoul fb8d7625d1 net: ipv6: Fix net_set_mac function
The ethernet driver calls net_set_mac before net_init is
called (ie before the uip stack has been fully initialized).
Unfortunately net_set_mac calls the function uip_ds6_set_lladdr.
Therefore this function is called before uip_ds6_init: this is an
issue as uip_ds6_set_lladdr is setting some static data which are
going to be erased by uip_ds6_init. In some case it could even lead
to a system hang due to a timer set twice.

To fix this issue net_set_mac should check whether net_init has been
already called. If not net_set_mac should simply copies the mac
address into uip_lladdr. Indeed uip_ds6_init automatically calls
uip_ds6_set_lladdr for the address stored into uip_lladdr.

Change-Id: Ifbcb07e7cd493b6284a85d70f2439d434cebbb00
Signed-off-by: Sebastien Griffoul <sebastien.griffoul@intel.com>
2016-05-26 12:24:43 +00:00
Sebastien Griffoul 57cd9939d6 net: ipv6: Fix lladdr state set to a wrong value
The line below is wrong and useless:
	lladdr->state = ADDR_AUTOCONF;

Indeed the three possible values for the state attribute are:
ADDR_TENTATIVE, ADDR_PREFERRED or ADDR_DEPRECATED. ADDR_AUTOCONF
is one possible value for the type attribute.

Moreover uip_ds6_set_lladdr already set the type attribute to
ADDR_AUTOCONF (this done through the call to the function
uip_ds6_addr_add).

Therefore this issue has been simply fixed by removing the line.

Change-Id: I432b7bb6a6a858264bb634f2e4d253f55acbbd5b
Signed-off-by: Sebastien Griffoul <sebastien.griffoul@intel.com>
2016-05-26 12:24:12 +00:00
Kumar Gala 9ec2f3be80 Cleanup whitespace in Kconfig files
Convert leading whitespace into tabs in Kconfig files.  Also replaced
double spaces between config and <prompt>.

Change-Id: I341c718ecf4143529b477c239bbde88e18f37062
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-05-25 13:28:07 -05:00
Johan Hedberg 942bbadbf6 Bluetooth: Increase HCI_LE_Rand delay for Arduino 101
20ms doesn't seem to always be enough.

Change-Id: If5ff255d3f043e50e6e1d9ff481607dc17c604d1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-25 11:32:31 +03:00
Szymon Janc 7a82d7f661 Bluetooth: Offload bt_recv to fiber if run from task
Task can be preempted and bt_recv is expected to be atomic. Since
on microkernel with TinyCrypt ECC enabled this can be called from
task context we need to make it run in critical section.

Change-Id: I24414e8d98b0dfe8affc18058eb164ba0cba7b17
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-25 09:52:08 +02:00
Szymon Janc 684ffd1e23 Bluetooth: Offload ECC calculations to task
If TinyCrypt ECC is used for LE SC calculations need to be done
in task to avoid hogging CPU from non-preemptible fiber. To keep
upper layers of stack independent of crypto used (TinyCrypt or
controller) this patch adds HCI ECC emulation.

If ECC emulation is enabled it is always used regardless of ECC
support being present in controller.

Change-Id: I7c5ca873a18c10237e1c0b2f09e6da2a75fb334e
Origin: Original
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-25 09:52:08 +02:00
Jukka Rissanen 6509f657ea net: Clear the connection pointer when net_buf is allocated
This fixes "No matching connection found" error when a packet
is received.

Change-Id: I9f9bba73f9858a9a3a45de26abd378d7c48aa9a7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-24 04:51:58 +00:00
Jukka Rissanen 8bd355c49f net: tcp: Fix the TCP client not sending multiple SYN
TCP client only sent one SYN and if that was lost, the connection
was not initiated correctly.

Change-Id: Iebb0b719a3d01d2e4f56ed911b3ed94643e53941
Jira: ZEP-385
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-20 12:59:08 +03:00
Arkadiusz Lichwa ade99e7e79 Bluetooth: L2CAP: Handle disconnection request from peer
Adds functionality to clean and release allocated BR/EDR CoC channel
after remote requests to disconnect.

Change-Id: Ie6657b8e72b2958ec79e9a5637f0dddf4bb98a5e
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-20 06:54:10 +00:00
Ravi kumar Veeramally 5e99b14ad4 net: 6lowpan: Fix 6lowpan fragmentation
IP packet passing through 6lowpan compression and 802.15.4
fragmentation has an issue. (RFC 6282 and 4944) RFC4944, 5.3
says "fragment header's datagram_size and datagram_offset
values as the size and offset of the IPv6 datagram before
compression".

At the moment datagram size and offset values are after
compression. Due to multiple bearer (15.4 and bluetooth) support
and multiple incoming buffers support functionality is divided
to compression and fragmentation parts. And datagram size and
offset values for BT are after compression. Small packet (which
doesn't need fragmentation) doesn't go through this. So cacheing
compressed and uncompressed header lengths and with hdr difference
preparing fragments as per original buffer (total buf size and offset).

Change-Id: I9d3b0433e64964c68519d7c007cc06ec6035b573
Jira: ZEP-208
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-05-19 14:18:38 +00:00
Jukka Rissanen 0506cc1fd7 net: Verify that MAC address is not NULL
Add additional check which verifies that MAC address is given
and return -EINVAL if it is not set.

Change-Id: I90d415670c4b35d092ba057329f998df3a72018e
Jira: ZEP-213
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:29 +03:00
Jukka Rissanen 133aa5c026 net: tcp: Supporting TCP client functionality when using IPv4
The application can initiate TCP connection when using IPv4.

Change-Id: I264270d013f567dd0c429783c47506d9c38f0509
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:29 +03:00
Jukka Rissanen 61edc68c9e net: tcp: Supporting TCP client functionality when using IPv6
The application can initiate TCP connection when using IPv6.

Change-Id: I632fa2559d5deb40d71288762bd13fbc2aac9cc7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:28 +03:00
Jukka Rissanen d01bee8783 net: Print more detail if TCP packet is not sent properly
Change-Id: I8b43e6ddfe5da3019893bf028acb6fb29e51bd5a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:28 +03:00
Jukka Rissanen 2881cb122b net: Add support for re-sending initial TCP SYN
If we are initiating a TCP connection, then make sure that
we try to re-send initial SYN packet (max 8 times) if it is lost.

Change-Id: I9fbc39bdaef3a535c480eb5433eb7ef3ad60d604
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:28 +03:00
Jukka Rissanen 276d066cd5 net: Add utility func to re-send TCP SYN packet
This will be used in following commit.

Change-Id: Ie4fccd72471c285b68a6df6970babe562e5e6258
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:28 +03:00
Jukka Rissanen 3b7208db84 net: Do not wait forever when sending TCP data
If application calls net_send(), set the retry count to some
low number (currently 5) so that we do not wait forever but
eventually we try to send the data properly.

Change-Id: I8103246ac9227a0cf70b56aecab6ed8307877e19
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:28 +03:00
Jukka Rissanen a1716c4760 net: Enable Zephyr to initiate a TCP connection
These changes are needed so that Zephyr host can initiate
a TCP connection to another host.

Change-Id: I46b92bf978e2dd04993951f2215d179a5cf1bd55
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:28 +03:00
Jukka Rissanen 662ce340be net: Add functions to return connection status needed in TCP
These are internal functions needed when initiating a TCP
connection.

Change-Id: Ide5d59ac9854ec8bdea3baa97b3cde3ffa6a5e0f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:28 +03:00
Jukka Rissanen f499624f7c net: tcp: Enable active connection support by default
Application can by default do a connection request. If this is
not needed (app is only working in server role i.e., only
listening connection attempts), then some memory can be saved
by disabling client role support.

Change-Id: I33ed95ad0cf099a70563465beff555ec4adab958
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-05-17 09:57:28 +03:00
Arkadiusz Lichwa a5d96e3f84 Bluetooth: L2CAP: Refactor l2cap_chan_get() in l2cap.c
Simplify l2cap_chan_get() in l2cap.c file by removing
CONFIG_BLUETOOTH_BREDR preproprocessor check. Now function serves
only getting channel on LE transport.

Change-Id: I20b72f352ad9d5998cc812b28cb3d6951f91f212
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-16 17:00:11 +02:00
Arkadiusz Lichwa 2145907d84 Bluetooth: L2CAP: Handle information response command on BR/EDR
Adds support getting L2CAP information about remote features. To get
the response local stack gets call information request about 'extended
features supported mask' after ACL link is established. Then in
response if 'fixed channels' bits are enabled, next information
request is sent to get details about 'fixed channels'.

Change-Id: I4980c61b12e83fef914e97dea296b0a848d59034
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-16 17:00:11 +02:00
Ravi kumar Veeramally 77a807cdf7 net: 6lowpan: Fix include header files path in null_compression
Change-Id: Ia6fa191e59cb632a4a960d2838357237149b8713
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-05-16 14:51:55 +00:00
Arkadiusz Lichwa 343789b3a8 Bluetooth: L2CAP: Rename context type bt_l2cap to br_l2cap_br
Let's keep BR/EDR L2CAP channel context type naming aligned to
naming convention applied in l2cap_br.c file.

Change-Id: I2c67e3525ade37a57cf96b0e3841fbd1cb9b783c
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-16 16:11:14 +02:00
Arkadiusz Lichwa e59773bb48 net: buf: Add net_buf_pull_le32() helper API
The function gets 32bit-wide data from net buffer and converts the
value from little endian to host order.

Change-Id: I2d2454951b3ac39686a25454678ce92d8a1a0f3d
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-15 19:39:14 +00:00
Arkadiusz Lichwa cffb92bc63 Bluetooth: L2CAP: Handle information request command on BR/EDR
Adds support to handle incoming L2CAP information request from
remote to get local information about 'extended features' and 'fixed
channels'. For now local stack ensures support for L2CAP BR/EDR
signalling channel.

Change-Id: If8c9c9dd041b45a79db5e560394dcd2778176f55
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-13 09:07:50 +00:00
Arkadiusz Lichwa fcb6e03021 net: buf: Add net_buf_add_le32() helper API
The function gets 32bits wide data, converts host order to little
endian and then puts the data on protocol stack to be send.

Change-Id: I29e4040b302a16b551a0922133c327ff694fec5d
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-13 07:55:39 +00:00
Johan Hedberg 3258ecad80 Bluetooth: SMP: Minor coding style fixes
Use appropriate scope for 'random' and remove unnecessary empty lines.

Change-Id: Idb8d527fa0a88ca738e91887b56a123a5a8831ce
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-12 10:05:55 +00:00
Arkadiusz Lichwa 742c71a186 Bluetooth: L2CAP: Enable handle BR/EDR signal channel traffic
Separates LE and BR/EDR L2CAP signal channel context and starts accept
incoming PDU traffic on BR/EDR signal channel. For now all valid L2CAP
commands are send back as rejected on BR/EDR signal channel.

Change-Id: If4392b2d3ccbe157cb7eeafcaa0804e90f44e2be
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-12 09:16:04 +00:00
Szymon Janc 32da5e6748 Bluetooth: Add comment clarifying condition check in bt_le_adv_start
It is valid to call set_ad with NULL data as long as length is 0.
Improve code comment for unusual condition check explaning why it
is correct.

Change-Id: I29440fb04747f6df06dc4df466eb43e160ff3be4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-12 09:11:29 +00:00
Arkadiusz Lichwa bc6a2cd7d6 Bluetooth: L2CAP: Implement bt_l2cap_br_connected() notifier
Adds implementation of the BR/EDR connection L2CAP notifier. It makes,
for each registered BR/EDR fixed channel, basic validation and channel
initialization using two local helper functions.

Change-Id: I6393a43b25ff0d9f23deaf93562add08861ea1d2
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-12 06:38:10 +00:00
Arkadiusz Lichwa c071b3e770 Bluetooth: L2CAP: Move bt_l2cap_br_fixed_chan_register() to l2cap_br.c
Moves, specific for BR/EDR transport, register fixed channel handler
to l2cap_br.c file and make it local. Then using it register BR/EDR
signal channel (CID 1) context during channel layer initialization
in 'bt_l2cap_br_init'.

Change-Id: I5e23fc5d43ae3d7838ecb44ad4fa631eccc8cb4c
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-12 06:37:01 +00:00
Arkadiusz Lichwa 51044bf5f8 Bluetooth: L2CAP: Introduce internal BR/EDR connection L2CAP notifier API
Adds dedicated function informing L2CAP layer about established BR/EDR
connection. Existing 'bt_l2cap_connected()' connection notifier is
refactored to use new API 'bt_l2cap_br_connected()' which is implemented
in l2cap_br.c file.
Currently the new handler is just stub since proper internals of
BR/EDR L2CAP signal channel management are not yet implemented
in l2cap_br.c file.

Change-Id: Idef9be63338c6bb4b3315ec0452d84f2431fbaa2
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-12 06:36:11 +00:00
Arkadiusz Lichwa bc1423f441 Bluetooth: L2CAP: Move init BR/EDR pool signal buffers to l2cap_br.c
Moves initialization of signal buffer for BR/EDR transport to
l2cap_br.c unit and removes existing references to signal buffer in
l2cap.c file to prevent compiler complains.

Change-Id: I784b926df814e632944f3a12b0b6d03d144d2438
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-12 06:34:52 +00:00
Flavio Santes feb131fd6c net/ip: Fix Makefile typo
Change "Zypher" by "Zephyr".

Change-Id: Ifc10da5cb0de7904096a5c231b200cb3d495c587
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-05-11 21:18:56 +00:00
Szymon Janc 1fefa34e08 Bluetooth: SMP: Fix ecc_make_key return code check
This function returns TC_FAIL and not negative value on failure.

Change-Id: I36e51e39aca07264339fc6c10a9c2b8db61b580d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-11 17:19:12 +00:00
Luiz Augusto von Dentz 1157a8f26f Bluetooth: GATT: Remove authorization permission
The application can return BT_ATT_ERR_AUTHORIZATION on the callback
already so there is no reason to have it as a permission as once set
it always fails.

Change-Id: Ia634e3f313993dd36c06bff48f36d4ddf1264376
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-11 15:18:09 +00:00
Luiz Augusto von Dentz 777033f710 Bluetooth: GATT: Make bt_gatt_write take a struct
This makes bt_gatt_write similar to bt_gatt_read where the parameters are
stored in a struct which can be used to store intermediate values while
the operation is in progress.

Change-Id: I3c62af137b99985690cf88dcc37a977a0be891f5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-10 17:55:06 +00:00
Szymon Janc 232e934351 Bluetooth: SMP: Reduce stack usage when generating ECDH keys
Only 8 random uint32_t digits are required by ecc_make_key function.

Change-Id: Ib0b4d6923b339828281e13b2a1d960d3bb72e65a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-10 16:49:44 +00:00
Luiz Augusto von Dentz 8171965f75 Bluetooth: GATT: Fix coding style
Code shall not have more than 80 columns.

Change-Id: I2ba53c971be1d6936b5092d86c1e2196c100339e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-10 15:48:29 +03:00
Flavio Santes ac594f1da0 net/loopback: add missing license
Add the license to the loopback driver header

Change-Id: I9cb2d93c8de6fe490912684fc3dfb20526be812d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-05-10 05:16:20 +00:00
jgarcia 5b6175d00c net: configure TCP receive window size
Tweak TCP receive window size from Kconfig.

Change-Id: I0d43809d5f36727a86d68b45a38ec136ca0b69cf
Signed-off-by: jgarcia <jeremie.garcia@intel.com>
2016-05-10 05:15:23 +00:00
Arkadiusz Lichwa bc5497f239 Bluetooth: BR/EDR: Reset pairing context when needed
When pairing procedure ends regardless of the status, reset flags
strictly related to pairing phase and reset security level.
Thanks that next authentication will get known initial pairing 'context'.

Change-Id: Ie3108c6e28e136ea929e564a6820675cc770cb95
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-09 16:54:14 +00:00
Johan Hedberg c1ae16adc5 Bluetooth: Use bt_hci_cmd_send_sync in set_ad to catch errors
Using send_sync lets us return an immediate error to the application
if the HCI command fails. This also reduces the pressure on available
buffers since we don't allocate multiple command buffers before
starting to process the command queue.

Change-Id: I5613e4e9dd8dcc0db45bad051d7c4980b49e428d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-09 13:44:41 +03:00
Szymon Janc a5b6daaee3 Bluetooht: Don't mix ssize_t and int error codes
struct bt_storage callbacks return ssize_t while other functions in
set_static_addr return int.

Change-Id: Ic09db711ccf5e85b3118739abb0d5e50ed49d20f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-09 11:49:41 +02:00
Szymon Janc 2471d506b2 Bluetooth: Use set_random_address for setting Static Random address
There is no need to open code this as we have helper for this.

Change-Id: I77ab39206d0c5b10f30624e90e864192b9519d0c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-09 11:48:20 +02:00
Szymon Janc 838206f603 Bluetooth: Fix using NRPA for creating connection
If adapter is using Static Random address as Identity Address and
privacy is disabled we need to restore correct random address (ID)
before creating connection. Otherwise NRPA used for active scan
could be used resulting in SMP confirmation failed due to invalid
initiator address being used.

Change-Id: I7201890ab9475ade3a825f9ea791a30af6b657a5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-09 11:41:14 +02:00
Szymon Janc c3d71b5414 Bluetooth: Don't update responder for master role connection
Both initiator and responder addresses are already set during
connection creation so there is no need to set responder address
again.

Change-Id: Id477a9e6dd2244c57126d1f985aa41cd1b04650b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-05 14:30:15 +02:00
Szymon Janc e3013e8ced Bluetooth: Add new conn on LE Connection Complete only for slave
New connection needs to be added only for slave role. For master
connection object is created when LE Create Connection is send.

Change-Id: I24dbfc4b3a647ea230b199fbec09940f486b983f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-05 14:30:15 +02:00
Johan Hedberg 251f1cbc28 Bluetooth: monitor: Add 32-bit timestamp support
Add support for the 32-bit timestamp (1/10th ms units) extended
header.

Change-Id: I67f481a35be6878605b8c2256f6e4bfb6afe55c8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-04 21:19:49 +03:00