summaryrefslogtreecommitdiff
path: root/subsys
AgeCommit message (Collapse)Author
2017-04-28kconfig: Move debugging-related options from misc/ to subsys/debug/HEADmasterLeandro Pereira
This should fix the grouping for debugging options appearing in the main "menuconfig" menu. Change-Id: I7ddf3a6f3d025bf82ba63099b30e47a40d7c3187 Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-04-28usb: cdc_acm: Use 2 instead of 4 for IN BULK endpointChrister Weinigel
The highest endpoint number supported by the STM32F4xx USB device controller is 3. Change the cdc_acm driver to use endpoint 2 instead of endpoint 4 so that it will work with this platform. Change-Id: I4a3cd08f546a7fe01558528de0990156f642d93b Signed-off-by: Christer Weinigel <christer@weinigel.se>
2017-04-28net/mqtt: return error codes from net_context_sendMichael Scott
Instead of returning EIO let's bubble the error from net_context_send back up to the caller in the following functions: mqtt_tx_connect() mqtt_tx_disconnect() mqtt_tx_pub_msgs() mqtt_tx_publish() mqtt_tx_pingreq() mqtt_tx_subscribe() mqtt_tx_unsubscribe() Change-Id: I9bb4396b227b8902ac1195a97bc37eb1959b643e Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28net/mqtt: cleanup TX function unref handlingMichael Scott
With CONFIG_NET_DEBUG_NET_PKT enabled, the log messages are full of errors regarding NULL parameters passed into net_pkt_unref in almost every TX function for handling MQTT messages: mqtt_tx_connect() mqtt_tx_disconnect() mqtt_tx_pub_msgs() mqtt_tx_publish() mqtt_tx_pingreq() mqtt_tx_subscribe() mqtt_tx_unsubscribe() mqtt_parser() Let's clean up the unref handling so that our debug log isn't quite so full of error spam (as opposed to the normal amount of spam from the net buf log). Change-Id: Ib49d1192f51abe4329e6dc9da3c51a4a36290082 Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28net/mqtt: use rlen to calculate # of QoS items in SUBACK packetMichael Scott
The data->len of an inbound netbuf can be larger than a single MQTT packet. For instance when a PINGRESP is also included in the same netbuf. For this reason we should not be using the data->len to determine how large the rest of the MQTT data is. Specific Example: we've seen in testing that PINGRESP packets can be included with a SUBACK packet in the same netbuf. Under this case the current code uses the data->len incorrectly and tries to find 3 QoS elements for the SUBACK packet when there is only 1 (the rest of the data is for PINGRESP). NOTE: A larger patch to iterate through the netbuf data parsing individual MQTT packets will be needed to fix the MQTT subsys. This patch only corrects the SUBACK parsing. Change-Id: I7f6cebaaed9570b778d466de84331cf8c5060755 Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28net/mqtt: combine mqtt_parser for PUBLISHER and SUBSCRIBERMichael Scott
Currently, app type MQTT_APP_PUBLISHER_SUBSCRIBER is not supported. mqtt_init() will return EINVAL because the context rcv function is either mqtt_publisher_parser or mqtt_subscriber_parser (not both). Let's combine these functions into mqtt_parser and remove the app type check from mqtt_init(). Change-Id: I60460e011395864706e293c997e9f8a65681b368 Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-04-28net/mqtt: fix race condition in mqtt_init()Marti Bolivar
We need to set the mqtt context recv function prior to calling net_context_recv which installs the mqtt_recv callback. If not, we risk a race condition where an unprotected reference to mqtt->rcv(mqtt, buf) is made in mqtt_recv(). Change-Id: If90ee58f4ea6f7879ef7c12b969ba27647426acc Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-28net: shell: Make shell commands non-static to allow reuse.Paul Sokolovsky
Some applications may want to reuse implementations of these commands for debugging/diagnostics purpose even if they don't use net shell per se, or implement an alternative shell. Jira: ZEP-2064 Change-Id: I48cb66ccc41bd41a75a4eb8eb3c366316ec5a096 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28net: rpl: Fix invalid usage of router addition apiRavi kumar Veeramally
net_if_ipv6_router_add() will return router pointer on success. This information must be cached in RPL instance, otherwise RPL instance doesn't know about default route. Change-Id: Ic6d80ebfa95c9a64df9adf2621ae2631d9bdb990 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28net: rpl: Fix router when it's timer expiresRavi kumar Veeramally
When router or default router timer expired, interface will remove router from the list. In this case RPL does not know about this. When RPL node receives DIO messages it only verifies whether parent exists or not. This extra checks will verify whether router really in "used" state or not. Jira: ZEP-2080 Change-Id: I4b36b3a2d495e76a38caddd058451daff08fab0c Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28net: ipv6: Use correct API to remove routerRavi kumar Veeramally
net_if_ipv6_router_rm() is the correct API to remove IPv6 router from the interface as it also cancels the timer and raises a mgmt event. The net_if_router_rm() only sets router as unused and nothing else. Change-Id: I55114288c9ae748520b67b206edcd4f5e420b1af Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28net: zoap: Add block wise support for well-known responseRavi kumar Veeramally
If the ./well-known/core response is bigger than L2 MTU then response will be sent in multiple fragments. In mesh kind of networks getting response from farthest node might loose packets. So better to send response in a block wise fashion. Block size is configurable. Change-Id: Id421c66597fe448c12a7215f04f63f4a284c14ab Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28net: zoap: Remove unused struct definitionRavi kumar Veeramally
Change-Id: I1b57972386b0def02eb125b6ae4825f11268f6ce Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28net: zoap: Minor comment style fixesRavi kumar Veeramally
Change-Id: I8f63781a39263e110aec2e6f1e14d72650ce4e30 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28net: zoap: Remove magic numberRavi kumar Veeramally
Value 0xFF represents End Of Options marker in CoAP message. Use #define than magic numbers in code. Change-Id: I3bef21ea827987f7c2e670447ee20574cb6288ae Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28net: zoap: Add timeout while requesting packetsRavi kumar Veeramally
Add timeout for packet and buffer requests. If there are no buffers available gracefully drop the request. Change-Id: I56fe2b606556149c83751aadc1c5eee7828a84a8 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-28net: bt: Fix leaking TX packetsLuiz Augusto von Dentz
Bluetooth only cares about the actual payload so net_pkt can be unref as soon as the data fragments are detached. Jira: ZEP-2070 Change-Id: Id528d5440f42903378883f5e696b3f663bbfa313 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-28net: net_pkt_append: Refactor to return length of data actually addedPaul Sokolovsky
For stream-based protocols (TCP), adding less data than requested ("short write") is generally not a problem - the rest of data can be sent in the next packet. So, make net_pkt_append() return length of written data instead of just bool flag, which makes it closer to the behavior of POSIX send()/write() calls. There're many users of older net_pkt_append() in the codebase however, so net_pkt_append_all() convenience function is added which keeps returning a boolean flag. All current users were converted to this function, except for two: samples/net/http_server/src/ssl_utils.c samples/net/mbedtls_sslclient/src/tcp.c Both are related to TLS and implement mbedTLS "tx callback", which follows POSIX short-write semantics. Both cases also had a code to workaround previous boolean-only behavior of net_pkt_append() - after calling it, they measured length of the actual data added (but only in case of successful return of net_pkt_append(), so that didn't really help). So, these 2 cases are already improved. Jira: ZEP-1984 Change-Id: Ibaf7c029b15e91b516d73dab3612eed190ee982b Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28net: rpl: Do not crash if DIO message contains garbageJukka Rissanen
Instead of just plain assert, check that the packet we receive is ok before passing it to processing function. Jira: ZEP-2057 Change-Id: I5754c82d16e1522d8fcee561eea280eadeec31ee Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28net: tcp: Fix TCP trace value debugJukka Rissanen
The TCP trace values were not printed because of incorrect config option used. Print also seq and ack values in decimal in order to make it easier to correlate the values in other prints in tcp.c. Change-Id: I44d1535a84dcba8c6c937d348516ba801193ca23 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-28net: security: Use sys_put_be32() relevantlyAndrei Emeltchenko
Use ready-made utility function which can take care of endianness Change-Id: I1edd0b2ce1a086dd637e97308145f9b434e48a1f Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-04-28net: l2: Clear arp cache when disable interface.june li
When connect to diffrent router with the same gateway ip address, need to clear arp cache when disable interface, or it will use the wrong gateway mac address. Call net_arp_clear_cache function replace to set arp_table 0. Change-Id: Ib403a0c0030832ba48824db4d2d3fcb8add63d16 Signed-off-by: june li <junelizh@foxmail.com>
2017-04-25kernel: event_logger: convert to using newly introduced integer sized typesKumar Gala
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99 integer types. Change-Id: I9ccb7c01a7d8c4ad8b1e55a1b45622aad2a57e57 Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-25kernel: Add thread events to kernel event loggerLeandro Pereira
This adds a new event type to the kernel event logger that tracks thread-related events: being added to the ready queue, pending a thread, and exiting a thread. It's the only event type that contains "subevents" and thus has a non-void parameter in their respective _sys_k_event_logger_*() function. Luckily, as isn't the case with other events (such as IRQs and thread switching), these functions are called from platform-agnostic places, so there's no need to worry about changing the assembly guts. This is the first patch in a series adding support for better real-time profiling of Zephyr applications. Jira: ZEP-1463 Change-Id: I6d63607ba347f7a9cac3d016fef8f5a0a830e267 Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-04-22spell: Kconfig help typos: /kernel /misc /subsysDavid B. Kinder
Fix misspellings in Kconfig help text Change-Id: I6eda081c7b6f38287ace8c0a741e65df92d6817b Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21subsys: convert to using newly introduced integer sized typesKumar Gala
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99 integer types. Jira: ZEP-2051 Change-Id: Icbf9e542b23208890a3a32358447d44cdc274ef1 Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21net: convert to using newly introduced integer sized typesKumar Gala
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99 integer types. Jira: ZEP-2051 Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837 Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21net: shell: Fix compiler error when printing conn handlersJukka Rissanen
There was compiler error if CONFIG_NET_DEBUG_CONN was set. Change-Id: Ibb6721c55dd2c56cd0097359a53563c6221859ea Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net: context: Connect callback was set too lateJukka Rissanen
We need to set the connect_cb for the context before sending SYN packet. This is required if we have a loopback connection in which case everything is happening more or less synchronously and the connect_cb would not be called in this case because its value would still be null. For remote network connections this patch makes no difference. Change-Id: Id7f837cd9e81cd79c4666c98cae84f6cb1a77af0 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net: tcp: Make sure ACK timer is not run if cancelledJukka Rissanen
We must not let ACK timer to run if we have already cancelled it. So keep track that the timer is cancelled and refuse to run it if it was indeed cancelled. The reason why the timer might be run in this case is because the timer might be scheduled to be triggered after which one cannot cancel it. Change-Id: I1c8b8cee72bc7a644e02db154d9d009b8d98ade2 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net: context: Set the local port correctly in acceptJukka Rissanen
The local port was set to 0 for IPv6 when registering the connection handler. For IPv4, the code was not setting the port in local_addr struct. Change-Id: I82f0c08641a94d75d255ac306eca7bec6c332fba Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net: Print debug info if packet is loopback back to usJukka Rissanen
Without this info it is a bit difficult to notice what is going on in loopback case. Change-Id: I8f61330c01d025e41f00d663bd26947b8cafb5c0 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net: conn: Utility to print connection handlersJukka Rissanen
Add support to print connection handler information in net-shell. There exists one connection handler for each UDP/TCP port that we are listening. These prints are only available if CONFIG_NET_DEBUG_CONN is enabled because the net_context has the same information. Thus the connection handler info is only printed if debugging is active in order to verify that handler information is proper. Change-Id: I0be39a5adb89b2cdbd85524c5d943e4a562b0fde Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net: pkt: Make the debug print eye friendlyJukka Rissanen
Print "pkt" instead of "Pkt" when printing network packet pointer value. Change-Id: Id4225be9c55807def3d892d372cdfc5c79c871fc Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net: tcp: Avoid unused variable compiler warningJukka Rissanen
If TCP debugging is enabled but if the loglevel is set to lower than 4, then compiler prints warning about unused flags variable in net_tcp_trace(). Change-Id: I2e663644b50fe97b75088202e21b286aa010953e Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net_pkt: Let's make all IPv6 related attributes prefixed with ipv6_Tomasz Bursztyka
Only 2 attributes lacked this prefix, which makes sense to have, so applying it accordingly and changing the helpers as well. Change-Id: I095b2729f977f8fb1624eff8801a4a4e21416693 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21net: Rename all *_BUF() macros to *_HDR()Tomasz Bursztyka
Most of these macros are not exactly exposing a buffer, but a specific header pointer (ipv6, ivp4, ethernet and so on), so it relevant to rename them accordingly. Change-Id: I66e32f7c3f2bc75994befb28d823e24299a53f5c Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21net_pkt: Externalize ext_bitmap handlingTomasz Bursztyka
IPv6 next headers are processed in a way so it is not required to store which header has been already seen in the net_pkt, as the processing loop can store internally which one it has seen already. Change-Id: I266ba8a3a0081a162318cdafb474a0fc44a3185e Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21net_pkt: Removing legacy net_dirTomasz Bursztyka
This is actually useless as there is only 1 RX memory slab, and thus can be removed to reduce net_pkt structure size. Change-Id: I62d716515120e7356ee1e2d75bbe1ec32e22c35d Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21net/net_pkt: Fully separate struct net_pkt from struct net_bufTomasz Bursztyka
- net_pkt becomes a stand-alone structure with network packet meta information. - network packet data is still managed through net_buf, mostly named 'frag'. - net_pkt memory management is done through k_mem_slab - function got introduced or relevantly renamed to target eithe net_pkt or net_buf fragments. - net_buf's sent_list ends up in net_pkt now, and thus helps to save memory when TCP is enabled. Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21net: Renaming net nbuf API to net pkt APITomasz Bursztyka
There have been long lasting confusion between net_buf and net_nbuf. While the first is actually a buffer, the second one is not. It's a network buffer descriptor. More precisely it provides meta data about a network packet, and holds the chain of buffer fragments made of net_buf. Thus renaming net_nbuf to net_pkt and all names around it as well (function, Kconfig option, ..). Though net_pkt if the new name, it still inherit its logic from net_buf. ' This patch is the first of a serie that will separate completely net_pkt from net_buf. Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21net: shell: Correct print format specifierAndrei Emeltchenko
Fix warning using incorrect format specifier Change-Id: Ib6800c40b2cd769612ae6f107e41a941926d8e66 Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-04-21net: tcp: Do buf ref when resending a segmentjune li
We need to check whether buf_sent was true when resending the TCP segment, and do a buf ref if needed. If this is not done, the buf will be unref after send, which will cause unpredictable results. Change-Id: Ibd4490305de88ac6ffd04ec42bba196e57da5c10 Signed-off-by: june li <junelizh@foxmail.com>
2017-04-21net: ipv6: Make sure not to access null pointerJukka Rissanen
While very unlikely it might happen that fragment pointer is NULL when going through fragment list. Coverity-CID: 167148 Change-Id: Ic3dbed7ee29c7b864d4830d726f65d7f62dcea84 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21net: zoap: Prepare and send error response separatelyRavi kumar Veeramally
If error occurs while preparing response to .well-known/core request, do not send partly filled payload by simply changing code part only. It's better to unref the partly filled reponse and prepare a new error response and send. Change-Id: I28013a4e331cfc6f01de873e80af48f765e49494 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21net: zoap: Remove unused helper functionRavi kumar Veeramally
Commit "net: zoap: Fix memory overflow issue" fixed and implemented ./well-known/core response in a different way, so this api is not needed anymore. Change-Id: I8f945fb5842028be50ecfdef95cbe5da3189a538 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21net: zoap: Fix memory overflow issueRavi kumar Veeramally
If CoAP .well-known/core services list is bigger than single fragment then current helper functions overwrites beyond fragment space. Which corrupted whole stack. Right now sending response in multiple fragments but preferred way is send response in block by block. This should overcome packet loss across mesh scenarios. Recommended feature will be supported with later patches. Change-Id: I30ca55bde2516d80b3583731241ad295799c6614 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21net: zoap: Refactor zoap utilitiesRavi kumar Veeramally
Most of the zoap utilities deal with first fragment of buffer chain. So accessing of buf->frags directly make less usage of stack than delcaring another variable for frag and its data. Due to code refactoring couple of lines removed and in between those lines coverity complained two issues, which is not valid now. Coverity-CID: 157597 Coverity-CID: 157598 Change-Id: I3035c0625a131d49a4f0250ff0052875d3382544 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21net: rpl: Fix rpl header updateRavi kumar Veeramally
When net_ipv6_finalize_raw() inserts RPL(HBH) header after IPv6 header, it updates IPv6 next header as HBH and HBH next header as original IPv6 next header. Then net_ipv6_prepare_for_send() will update RPL HBH header if it exists. But net_rpl_update_header() is comparing HBH option and IPv6 next header, which is wrong. Wrong comparion does not update RPL instance id and sender rank. Peer nodes drops all the packets due to invalid instance ID and sender rank. Change-Id: I91c1870a09c60f8e1ebc73e434dcc208caf6299a Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-04-21net: context: Fixing bug in net context put flowMitul Shah
Following flow does not work: net_context_get net_context_bind .. .. net_context_put net_context_get net_context_bind At instance of call to net_context_bind, conn_handler is not NULL and returns with EISCONN. This patch sets conn_handler to NULL in net_context_unref Change-Id: I56a50839101b22161644b3cd7c5f510fa1abae3e Signed-off-by: Mitul Shah <mitul.a.shah@intel.com>