Commit graph

18591 commits

Author SHA1 Message Date
Jukka Rissanen
d644eb8175 net: Add missing curly braces
Follow the style guide here.

Change-Id: Icd4053434f509aee4787bf2d5aae42cefb830a36
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
fdadfc95a7 net: uip: Reset the rxbuf if we run out of buffers
We need to reset the slip receive buffer pointers if we cannot
process the incoming message. If this is not done the rxbuf
will overflow and overwrite core kernel data.

Change-Id: If6a96177a3de57148268e48940fbc33d2e08b36a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
5ac5211093 net: uip: Free net_buf if it cannot be pushed to slip rx queue
This is a sanity check.

Change-Id: I1e747887b3f77203c6a2945810c8203243c41fe3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
90ca5ff779 net: Validate that net_buf allocation is correct
Add macros that check that we are not trying to use already
freed net_buf and vice versa.

Change-Id: Ifdb6a7e24cd6d7a0de46fa7b991c358ea8828d6f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
73fc66d86a net: Rework the includes so that they are inside include guard
Making sure we do not include anything unless they
are inside include guard.

Change-Id: Ie88cbc0ed6dbbf4033f3c8c310df7d084ab8b126
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
a64f6995bb net: tools: Simple echo client that sends data to echo server
This client sends pre-defined UDP data to server, reads back
the reply and verifies that the data is the same.
This test application is only usable when running in Linux
host and it is not meant to be run inside Zephyr.

Change-Id: I6df83f3a5b1ab92c724b4d3c245738eb5c56a91f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
c16d29ec0f net: apps: Simple echo server that sends back the data
The echo server is listening on port 4242 and when it receives
UDP packet, it will reverse the data and send it back to the
caller. This can be used to verify that the IP stack is doing
something useful.

Change-Id: Ibbc48c21f2513d59480c5a3bb34c775eb3df8170
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
3e4d890d72 net: slip: Add slip driver for testing purposes
This slip driver is needed for sending packets outside of qemu.

Change-Id: Ifc37181094ddebce08d97ae889f3a58c03d01ae1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
6421d6eba8 net: The UDP remote address was incorrectly set
We need to use correct IPv6 address when registering UDP
socket.

Change-Id: I38f55bc16f72a71cb8cd58d20b3288be2f4cd475
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
54ab6fad20 net: Add net_reply() function
The net_reply() can be used if the application wants to reply
something to peer right after receiving the data. The function
will reverse the source and destination addresses and ports,
and set the uIP internal structures in such a way that the
reply is possible. Using this function saves the application
from allocating a separate net_buf for just sending simple
message back.

Change-Id: Ia960c83b77a8f300222159ee085fed99e2b007c2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Szymon Janc
bdb7044f09 Bluetooth: SMP: Make bt_smp_init parameters explicit void
Change-Id: I307ebd13cf031af3359176a19d6a9d4c067cf0ec
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:34 -05:00
Mariusz Skamra
296c76c7a8 Bluetooth: Fix status returned by bt_stop_scanning and bt_start_scanning
If the Command Complete status is read, this status shall be returned.

Change-Id: Ic3fe102c16da4b01d002a2d39952fd401e9f832d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:34 -05:00
Luiz Augusto von Dentz
81546cfc0a Bluetooth: Add gatt-exchange-mtu command to btshell
This adds gatt-exchange-mtu which works as follow:

btshell> gatt-exchange-mtu <bdaddr> <bdaddr_type>
bt: bt_gatt_exchange_mtu (0x0010c138): Client MTU 65
Exchange pending
btshell> bt: bt_att_recv (0x0010e310): Received ATT code 0x03 len 3
bt: att_mtu_rsp (0x0010e310): Server MTU 517
Exchange successful

Change-Id: I7280fb9d9fafc0f4bd1ef0f2226c255a5acf2592
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:34 -05:00
Luiz Augusto von Dentz
96fbd6636c Bluetooth: Add bt_gatt_exchange_mtu
bt_gatt_exchange_mtu can be used to exchange MTU used by GATT, the MTU
is selected automatically based on the amount of data bt_buf can hold.

Change-Id: Id49a506663d922132e81c0a753a983b93579ffd0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:34 -05:00
Luiz Augusto von Dentz
92477f7f65 Bluetooth: Handle ATT Exchange MTU Respose PDU
This adds function handler for Exchange MTU PDU which parses MTU received
and call the request callback:

< ACL Data TX: Handle 3585 flags 0x00 dlen 7
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 65
> ACL Data RX: Handle 3585 flags 0x02 dlen 7
      ATT: Exchange MTU Response (0x03) len 2
        Server RX MTU: 517

Change-Id: I8daf0e32c1e1b838c45dc488fdef68a01451d55d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:34 -05:00
Mariusz Skamra
a663540af6 Bluetooth: Factor out active scanning dependent code
API remains the same, only adds helpers for common code which will be
used by active and passive scanning.

Change-Id: I3ef7845af766ba1634fe959f0a93d74601c6711c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:34 -05:00
Luiz Augusto von Dentz
18f2299f24 Bluetooth: Handle ATT Error Response PDU
This adds function handler for Error Response PDU which parses the
error code and call the request callback:

< ACL Data TX: Handle 3585 flags 0x00 dlen 5
      ATT: Exchange MTU Request (0x02) len 0
        invalid size
> ACL Data RX: Handle 3585 flags 0x02 dlen 9
      ATT: Error Response (0x01) len 4
        Exchange MTU Request (0x02)
        Handle: 0x0000
        Error: Invalid PDU (0x04)

Change-Id: I149dc20421690e63250d3e2ec388407a5600e089
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:34 -05:00
Szymon Janc
668e161e4a Bluetooth: SMP: Add support for Pairing Failed PDU
If remote sends Pairing Failed any subsequent pairing procedure should
be restarted from Feature Exchange phase.

Change-Id: Ieccb4e64525e82092b8b0928bd3715f46eded9a2
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
cefc8ea55c net: tools: Removing tunslip6 binary
This binary file should not be here so removing it.

Change-Id: I00d4b2de353f1b7ed75e9480252ea5f3f4b0c3a4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Szymon Janc
4cd3cbf16a Bluetooth: SMP: Add strict checks for allowed PDUs
Specification clearly defines when each PDU is allowed to be send.
With this patch unexpected PDUs are rejected. This allows for better
resilience when remote device misbehaves. Another benefit is that
PDUs handlers doesn't have to do additional checks for unexpected
sequence or missing PDUs.

Specification is not clear on reject policy though. It could be
responding with Pairing Failed, disconnect link or just drop unexpected
data. This patch implements last option. Dropping unexpected data is
also present in other widely used implementations and proved to be
sufficient.

Change-Id: I9a28a0b7bea71775e656300f71172e60b2df3d9c
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:34 -05:00
Szymon Janc
5f36dbf0bb Bluetooth: SMP: Distribute keys in correct order when master
Master should distribute keys only after slave distributed own keys.

Change-Id: Ibd339bd18699fe054bf2443103a4dc5785f494ab
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:34 -05:00
Szymon Janc
bf8bcbdb01 Bluetooth: SMP: Factor out key distribution
This is in preparation for distributing keys in correct order when
acting as a master.

Change-Id: I3054f167dfd5c7514ab1efaecab7854a24d8f11a
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:34 -05:00
Mariusz Skamra
7ba400c321 Bluetooth: Fix bt_conn_lookup_state
If address stored in conn structure is BT_ADDR_LE_ANY, it means
that this slot has been already freed up, and the data is invalid.
bt_addr_le_cmp(peer, &conns[i].dst) returns True if both arguments
are BT_ADDR_LE_ANY, so invalid conn with address BT_ADDR_LE_ANY
can be returned.

Change-Id: I78ecafe0f9d6e1bbca4c7bf2c44eaec858787247
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:34 -05:00
Szymon Janc
50d9860509 Bluetooth: SMP: Fix key distribution for master
In Pairing Response is locally distributed keys are Initiator
Key Distribution.

Change-Id: Ic1032d0d08c4d88fd8b133d0d087935f065912d1
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:34 -05:00
Arkadiusz Lichwa
71252551e3 Bluetooth: Tweak cancelling LE connection
Some LE controllers returns in LE event connection complete zeroed
LE address on action cancelling pending outgoing connection.
To catch up such case don't transit state to DISCONNECT in cancel LE
connection HCI command routine and then based on lookup by state
routine for CONNECT state instead of lookup by address, filter out
such case in LE connection complete handler.
Lookup by state when sets to pickup connection object in CONNECT state
in LE connection complete handler doesn't breaks normal outgoing and
incoming connections handling.

Change-Id: I225b5f4786192309a28b886df6ee151ab27e8a24
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:34 -05:00
Szymon Janc
e8eec7c3d4 Bluetooth: Allow to pass address type in braces in shell app
This makes it easier to use shell since one can copy full address
from console output. Both variants with and without braces are
accepted.

btshell> connect 7C:2F:80:94:97:39 (public)
Connection pending
btshell> Connected: 7C:2F:80:94:97:39 (public)
btshell> disconnect 7C:2F:80:94:97:39 public
btshell> Disconnected: 7C:2F:80:94:97:39 (public)

Change-Id: Ic10386ee054ade1900e5f010857c0f85e5cb364a
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
98cd803dd9 net: uip: Disable duplicate IPv6 address detection
This will disable DAD for now in order to simplify the
IPv6 address assignment. This needs to be re-enabled
at some point.

Change-Id: I9d0ba58ef27df5fb8202863ccf6e33c5e29b6e14
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:34 -05:00
Jukka Rissanen
10c0a16776 net: uip: Comment out neighbor discovery support when needed
If UIP_ND6_SEND_NA is not defined, then input_na() and input_ns()
functions are not needed and should be commented out.

Change-Id: I6849c7a7dba1a4cf60b8b26806df871b5f7801bf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:33 -05:00
Jukka Rissanen
d1f320c3ca net: uip: Allow UDP packet sender to know the sending status
Return the send status (sent ok or sending failed) to the caller.
Needed so that the caller can figure out whether it needs to
release the net_buf or not.

Change-Id: I7a0617cbb625d6ffcaf503dffc55d474b8f337a7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:33 -05:00
Jukka Rissanen
4a21035141 net: uip: Traverse only through valid UDP connections
The uip6.c:uip_process() was not checking the upper bound of
the UDP connection list when traversing the connection list.
Now the code checks the upper bound of the array (UIP_UDP_CONNS)
and will not go beyond the max number of items in the array.

Change-Id: I417ffd2bbb54922ae071f2f382f7e9470516ce55
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:33 -05:00
Jukka Rissanen
682eee9306 net: uip: Set the proper link address length
We need to be able to configure link address length (6 or 8 bytes)
depending on what kind of transport we are using.

Change-Id: I9677e40a76f22e4656bcae7c9a667c0e76b0d996
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:33 -05:00
Jukka Rissanen
62852f0ea7 net: Allow 6 byte link addresses
Need to define link address length for ethernet MAC addresses.
This is needed when connecting to host from qemu using slip
and when bluetooth connectivity will be used (in the future).

Change-Id: I3881e970cec52017fd4120a48ff7a99cc5559a0a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:33 -05:00
Rodrigo Caballero
e494bd71e6 Doc: Add information regarding application development.
General information regarding the development of microkernel
applications is included. A step by step process is included but 
still in development. Cross-references are added and updated as needed.

Change-Id: Ib7442883016c92c660d03d806009a0bd1932fce7
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:14:33 -05:00
Rodrigo Caballero
cfb5bdc202 Doc: Add license guidelines with the acceptable code licenses.
The license guidelines list which code licenses are acceptable and what
licenses can be problematic. It also includes the IANAL disclaimer. The
collaboration.rst was changed to include the new content.

Change-Id: I92081a13575453c68b2492129126be4b4cee9766
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:14:33 -05:00
Carol Lee
9f8ce095b8 Quark Platform Configuration documentation
Adds new Quark platform configuration documentation to support the Galileo board.

Change-Id: I00ccc01ee75dbd54721d2d36583e9c7626e237d8
Signed-off-by: Carol Lee <carol.lee@windriver.com>
2016-02-05 20:14:33 -05:00
Carol Lee
a74b4fa277 doc: Initial platform configuration guides
Adds infrastructure for platform configuration guides,
starting with the fsl_frdm_k64f platform configuration.

Incorporates inline sphynx tags except :guilabel:
which does not bold gui labels, a feature needed
for scanning a procedure for key info.

Change-Id: I4f5154dae896449fb709842501c69d8757deca3e
Signed-off-by: Carol Lee <carol.lee@windriver.com>
2016-02-05 20:14:33 -05:00
Anas Nashif
d89bcd300c doxygen: change comment style to match javadoc
Change-Id: I5266caff9ef2ee26c556f6e144eca020ae9169bd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:33 -05:00
Anas Nashif
1b1905e2ef doc: change documentation style to javadoc
Change-Id: I313ebeda3028a7aa1b355561d0bf1dec41cd25fa
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:33 -05:00
Anas Nashif
db404bbdf9 Do not check for DO_CONSOLE_INIT, use Kconfig variables instead
This commit removes 2 levels of checking and checks directly against
define Kconfig variables. Also reduce the code to one block and check
only once instead of twice.

This is a cosmetic change.

Change-Id: Ia427d9f15a9d09ea59d0230913168060d752ae99
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:33 -05:00
Allan Stephens
098e9dc68f SysGen: remove support for USERDRIVER
The USERDRIVER line is currently unused, and recent driver
initialization enhancements have rendered it obsolete.

Change-Id: If14089a52871a8891223156fde99b3fc9b650b10
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:33 -05:00
Peter Mitsis
b2744f396c SysGen: remove processing of TIMERDRIVER
The TIMERDRIVER line is no longer used.

Change-Id: Ibe068793fe644be39916e508d26e0c0a98cff739
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:33 -05:00
Peter Mitsis
f620ac1e2a Remove config1p.mdef files
Not only does the build system need the config1p.mdef files any longer, those
files do not contain any useful data.

Change-Id: Ide9122af26c7a8338512c6cf7cd848e41a2a5dfd
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:33 -05:00
Peter Mitsis
8efb4b570b Remove config1p.mdef references from build system
Since SysGen generates the code to invoke _sys_clock_driver_init(), the build
system no longer needs anything from the config1p.mdef files.

Change-Id: Id22615ff137c9d146ccc5c3777a75b2d3bfee73a
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:33 -05:00
Peter Mitsis
95b6f7509b Hoist _sys_clock_driver_init out of config1p.mdef
SysGen generates code to invoke _sys_clock_driver_init() when
CONFIG_SYS_CLOCK_EXISTS is defined thereby reducing the number
items the user must remember to configure.

Change-Id: I6f6909378c8a865a6ef50a99179800d58be5dd68
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:33 -05:00
Peter Mitsis
1bafa75ef1 Rename timer_driver() to _sys_clock_driver_init()
The revised name conforms to Zephyr OS naming conventions.

Change-Id: I5bcdaf1df7da9d8ce5787a08b29ead91dd8f24ce
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:33 -05:00
Peter Mitsis
136bef3c5d timer_driver() no longer takes a parameter
Removing the parameter to timer_driver() as it is not used.

Change-Id: I09275287eeb541be0dd315056b4f2bc6cbc2573c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:33 -05:00
Oleg Zhurakivskyy
72fc864282 Fix SOURCE_DIR after moving to samples/microkernel
Change-Id: Ibf38229ce1eb6728f9024fbeb9d7931948ecd8e7
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2016-02-05 20:14:33 -05:00
Anas Nashif
f367f071b6 doxygen: add @brief and capitalize
Remove function name from comment and add @brief instead.
Also capitilize first letter.

Change-Id: Ib708b49bf02e5bc89b0066637a55874e659637e0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:33 -05:00
Anas Nashif
1362e3c162 doxygen: RETURNS: -> @return
Previous comment style used RETRURNS:, use @return to comply
with javadoc style.

Change-Id: Ib1dffd92da1d97d60063ec5309b08049828f6661
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:32 -05:00
Anas Nashif
44f8b3a54b doxygen: \param -> @param
Some comments have \param, convert them to javadoc style.

Change-Id: I6abcdab91f4f616632392292600f4b0081b2a842
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:32 -05:00