This process handle by handle instead of first parsing the full PDU
storing the result in another variable to only then process the handles.
Change-Id: I5b6d5d7db4a78a03b34bc1c7e5217bbcd7f4c96b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Check conn->att context at bt_att_recv and log an error.
Change-Id: Id49e941bdf55529b517b6962fe0d401bd9295c38
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds bt_gatt_discover_characteristic which can used to discover all
characteristics in the given range.
Change-Id: Ia7ddb93dfdb0f979409e133c902a1cbd9ae9fe71
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds function handler for Read By Type Response PDU which call the
request callback:
> ACL Data TX: Handle 3585 flags 0x00 dlen 11
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0010-0x0011
Attribute type: Characteristic (0x2803)
> ACL Data RX: Handle 3585 flags 0x02 dlen 13
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0010
Value: 081100392a
< ACL Data TX: Handle 3585 flags 0x00 dlen 11
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0011-0x0011
Attribute type: Characteristic (0x2803)
> ACL Data RX: Handle 3585 flags 0x02 dlen 9
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0011
Error: Attribute Not Found (0x0a)
Change-Id: Ieba837f603b7d76a4adf95cd637b8423061246f7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If the function callback returns BT_GATT_ITER_STOP it should cause
the destroy callback to be called to indicate the discover is no longer
active.
Change-Id: Ifc35c375633e38483b2b4bace2c26bab7f02dcb6
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Instead of aaaa::/64 address space which is part of global
IPv6 address space, use the 2001:db8::/32 which is meant
for documentation purposes and is not routable.
Change-Id: I56db34da852f8c313379c764bdf75a19151c45bd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
To limit the device_found function calls, passive scanning can
take advantage of Filter_Duplicates feature. For now, the stack
will be informed only if some new device will be found.
This solution requires a check if scan filter is used while adding
new address to connect to (bt_connect_le). If filter duplicates
is used (by active scan or passive scan), the scan should be
restarted to refresh scan results.
Change-Id: Ibf539e648288fdcd7a8119ec364cff2c97e4aab8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
The IPv4 support is activated automatically if the IP address
parameter is a real IPv4 address.
Change-Id: Ief7b2a216a143416b5eec095cd6f813729a40b92
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The tunslip program will setup the tun device for IPv4 traffic.
Change-Id: I1192a704f691e17016e187167dfca09df00b974f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The uip.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.
This commit fixes the IPv4 branch, the IPv6 branch was already
fixed by commit 07a5959c2ae9ffce27092c2a0a6161111facdb6c
Change-Id: I5c31176190e0f063b72d6742c4a9c23b433026ad
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Enabling IPv4 support and modifying code so that it compiles ok.
Change-Id: I605cd94adfda7675be2f2cf798588c69eb1f152e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The declarations in this header file are already provided by
other header files so this file can be removed.
Change-Id: I63cd99ed201af7bebb14943bf965dafd11be14fe
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This fix prevents from sending dummy buffer to kill tx fiber
if this fiber didn't started.
Tx fiber is started during transition from BT_CONN_CONNECT state
(for outgoing connections) or BT_CONN_DISCONNECTED (incoming)
to BT_CONN_CONNECTED state.
So the only states that have tx fiber running are BT_CONN_CONNECTED
and BT_CONN_DISCONNECT and only transitions from these states
should be taken into account.
Change-Id: I558c937812368b0bd305f6c9935cced565c70606
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
bt_gatt_discover can be used to discover primary GATT service by UUID in
a selected handle range, after it attribute found the function callback
is called so the user can interact the attribute found and decide to
continue to the next or stop.
Change-Id: I37514f00c82ce5520d7a14757a6ff12ee34f0736
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds function handler for Find By Type Response PDU which call the
request callback:
< ACL Data TX: Handle 3585 flags 0x00 dlen 13
ATT: Find By Type Value Request (0x06) len 8
Handle range: 0x000a-0xffff
Attribute type: Primary Service (0x2800)
UUID: Heart Rate (0x180d)
> ACL Data RX: Handle 3585 flags 0x02 dlen 9
ATT: Find By Type Value Response (0x07) len 4
Handle range: 0x000a-0x0011
< ACL Data TX: Handle 3585 flags 0x00 dlen 13
ATT: Find By Type Value Request (0x06) len 8
Handle range: 0x0011-0xffff
Attribute type: Primary Service (0x2800)
UUID: Heart Rate (0x180d)
> ACL Data RX: Handle 3585 flags 0x02 dlen 9
ATT: Error Response (0x01) len 4
Find By Type Value Request (0x06)
Handle: 0x0011
Error: Attribute Not Found (0x0a)
Change-Id: Ib5799d0530c8de40b7c7170f1b32312a42456484
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This check is already made in bt_start_scanning and is valid only
when task wants to enable active scanning when it's already enabled.
Change-Id: Ic8843d51d4c91a533250d8ddb4139814015f7aa4
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
bt_hci_start_scanning is called from API's bt_start_scanning to enable
active scanning and from trigger_scan to enable passive/active scan.
bt_start_scanning have already this check, it stops passive scanning
if enabled and then starts active scan.
So "if (dev.scan_enable)" check can be moved to trigger_scan to avoid
unnecessary checks.
Change-Id: I5eaa4bb5c611418b8519b0dda680f59a3a9332fc
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Part of General Connection Establishment Procedure.
Active scanning is enabled by task and has higher priority than
passive scan. If passive scan is running and task wants to enable
scan (active) scanning will be restarted in active mode. Passive
scan is enabled implitly while app calls bt_connect_le.
Instead of directly call hci_le_create_conn, it is called from
device_found if addr obtained from advertisement matches address
we want to connect. App calling bt_stop_scanning can only stop
active scan.
Change-Id: I01805c51f3d821bbd827af75e5d1d4350169241d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
Move bt_hci_start_scanning, bt_hci_stop_scanning and hci_le_create_conn.
It's needed to avoid a forward declaration in a subsequent patch.
Change-Id: I0ee048ca6e8add6a481ac4fdc8a8e2cbdf4f007c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This state will be used for connection establishment during passive scan.
This additional state is necessary, because only one connection can be
in BT_CONN_CONNECT state (LE Create Connection has been sent).
It's because the LE Create Connection Cancel looks for connection in this
state (we cannot look by address, if some controllers respond with
LE Create Connection with address set to 00:00:00:00:00:00).
If connection is BT_CONN_CONNECT_SCAN state it means that we wait for
an advertisement from remote to send LE Create Connection and then we
can change the bt_conn state to BT_CONN_CONNECT.
Change-Id: I48b0352fe08e438f7bfbb1dd12de3d1719f994d8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
uip_lladdr is global variable which is used to generate link
local address based on mac address. Right now it is empty.
Change-Id: I89bf7ac4c7770858044ef0c4f3d667e9316c4269
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
If HC1 or HC06 compression fails then send uncompressed ipv6 packet
by adding IPv6 dispatch header infront of the header.
Change-Id: Ie15fb9d61def45066fb606417ba4f46ae6c628b1
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Fix IPv6 packet lenght in header. packetbuf_copyfom clears all
pointers which is causing an issue, so assign uip_packetbuf_ptr
after packetbuf_copyfom.
Change-Id: I943273bb0a079d3ac86da0761c3f32043a280a87
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
UIP_CONF_LL_802154: 802.15.4 support in uIP, default compression
is none(SICSLOWPAN_COMPRESSION_IPV6: just add IPV6 dispatch infront
of header, enable HC06 or HC1 depends upon requirement).
Change-Id: I5c298652783a560d227b77c293c3d13844647f56
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Add infrastructure and checks to validate the net_mbuf during
its lifecycle.
Change-Id: Id4b638fff991325d2247b1f24152552038888915
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The code used wrong IPv6 address pointer for UDP registration.
This caused the packet sending to fail because the generated
IPv6 address was bogus and not routable.
Change-Id: I933d6920c6455b271e775f5cbe15afdaa948abae
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We cannot use stack variable for local address as the address
needs to point to static memory. So change the type of the laddr
to be static. This is not a problem here as there is only one
local address defined anyway in the system.
Change-Id: Ie8763f761eea08997f0984394984050be946ae18
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
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>
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>
This slip driver is needed for sending packets outside of qemu.
Change-Id: Ifc37181094ddebce08d97ae889f3a58c03d01ae1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We need to use correct IPv6 address when registering UDP
socket.
Change-Id: I38f55bc16f72a71cb8cd58d20b3288be2f4cd475
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
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>
If the Command Complete status is read, this status shall be returned.
Change-Id: Ic3fe102c16da4b01d002a2d39952fd401e9f832d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
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>
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>