Merge net branch into master

Main changes:

- Refactoring net_nbuf usage.
- Fix null pointer access in IPv6.
- Fix compiler warnings.
- TCP ACK timer and retransmit fixes.
- Print enhancements in net-shell.
- RPL fixes.
- ZoAP fixes.

----------------------------------------------------------------
Andrei Emeltchenko (1):
      net: shell: Correct print format specifier

Jukka Rissanen (10):
      net: ipv6: Make sure not to access null pointer
      net: tcp: Avoid unused variable compiler warning
      net: pkt: Make the debug print eye friendly
      net: conn: Utility to print connection handlers
      net: Print debug info if packet is loopback back to us
      net: context: Set the local port correctly in accept
      net: tcp: Make sure ACK timer is not run if cancelled
      Bluetooth: ipsp: Fix compile error in sample app
      net: context: Connect callback was set too late
      net: shell: Fix compiler error when printing conn handlers

Mitul Shah (1):
      net: context: Fixing bug in net context put flow

Paul Sokolovsky (1):
      net: shell: conn: Dump local/remote ports for contexts.

Ravi kumar Veeramally (5):
      net: rpl: Fix rpl header update
      net: zoap: Refactor zoap utilities
      net: zoap: Fix memory overflow issue
      net: zoap: Remove unused helper function
      net: zoap: Prepare and send error response separately

Tomasz Bursztyka (7):
      net: Renaming net nbuf API to net pkt API
      net/net_pkt: Fully separate struct net_pkt from struct net_buf
      net_pkt: Removing legacy net_dir
      net_pkt: Externalize ext_bitmap handling
      net_pkt: Reordering the attributes for better alignment
      net: Rename all *_BUF() macros to *_HDR()
      net_pkt: Let's make all IPv6 related attributes prefixed with ipv6_

june li (1):
      net: tcp: Do buf ref when resending a segment

 .../networking/connectivity-example-app.c          |   22 +-
 .../networking/ip-stack-architecture.rst           |    2 +-
 doc/subsystems/networking/l2-and-drivers.rst       |   14 +-
 drivers/console/telnet_console.c                   |   54 +-
 drivers/ethernet/Kconfig.sam_gmac                  |   12 +-
 drivers/ethernet/eth_enc28j60.c                    |   40 +-
 drivers/ethernet/eth_mcux.c                        |   38 +-
 drivers/ethernet/eth_sam_gmac.c                    |  106 +-
 drivers/ethernet/eth_sam_gmac_priv.h               |    6 +-
 drivers/ieee802154/ieee802154_cc2520.c             |   60 +-
 drivers/ieee802154/ieee802154_mcr20a.c             |   46 +-
 drivers/ieee802154/ieee802154_nrf5.c               |   42 +-
 drivers/ieee802154/ieee802154_uart_pipe.c          |   36 +-
 drivers/slip/slip.c                                |   53 +-
 include/net/arp.h                                  |    6 +-
 include/net/buf.h                                  |    5 -
 include/net/ethernet.h                             |    4 +-
 include/net/ieee802154_radio.h                     |   12 +-
 include/net/mqtt.h                                 |    2 +-
 include/net/nbuf.h                                 | 1314 ----------------
 include/net/net_context.h                          |   59 +-
 include/net/net_core.h                             |   11 +-
 include/net/net_if.h                               |   25 +-
 include/net/net_l2.h                               |   10 +-
 include/net/net_offload.h                          |   34 +-
 include/net/net_pkt.h                              | 1297 ++++++++++++++++
 include/net/zoap.h                                 |  124 +-
 samples/bluetooth/ipsp/prj.conf                    |    8 +-
 samples/bluetooth/ipsp/src/main.c                  |   75 +-
 samples/net/coaps_client/prj_qemu_x86.conf         |    8 +-
 samples/net/coaps_client/src/coaps_client.c        |   37 +-
 samples/net/coaps_client/src/udp.c                 |   32 +-
 samples/net/coaps_client/src/udp.h                 |    2 +-
 samples/net/coaps_server/prj_arduino_101.conf      |    8 +-
 samples/net/coaps_server/prj_qemu_x86.conf         |    8 +-
 samples/net/coaps_server/src/coaps_server.c        |   64 +-
 samples/net/coaps_server/src/udp.c                 |   47 +-
 samples/net/coaps_server/src/udp.h                 |    2 +-
 samples/net/dhcpv4_client/prj_arduino_101.conf     |    8 +-
 samples/net/dhcpv4_client/prj_frdm_k64f.conf       |    8 +-
 samples/net/dhcpv4_client/prj_qemu_x86.conf        |    8 +-
 samples/net/dhcpv4_client/src/main.c               |    1 -
 samples/net/dns_resolve/prj_qemu_x86.conf          |   10 +-
 samples/net/echo_client/prj_arduino_101.conf       |    8 +-
 .../net/echo_client/prj_arduino_101_cc2520.conf    |   10 +-
 samples/net/echo_client/prj_bt.conf                |    8 +-
 samples/net/echo_client/prj_cc2520.conf            |   10 +-
 samples/net/echo_client/prj_frdm_k64f.conf         |    8 +-
 samples/net/echo_client/prj_frdm_k64f_cc2520.conf  |   10 +-
 samples/net/echo_client/prj_frdm_k64f_mcr20a.conf  |   10 +-
 samples/net/echo_client/prj_nrf5.conf              |   10 +-
 samples/net/echo_client/prj_qemu_802154.conf       |   10 +-
 samples/net/echo_client/prj_qemu_cortex_m3.conf    |    8 +-
 samples/net/echo_client/prj_qemu_x86.conf          |    8 +-
 samples/net/echo_client/prj_sam_e70_xplained.conf  |    8 +-
 samples/net/echo_client/src/echo-client.c          |  131 +-
 samples/net/echo_server/prj_arduino_101.conf       |    8 +-
 .../net/echo_server/prj_arduino_101_cc2520.conf    |   10 +-
 samples/net/echo_server/prj_bt.conf                |    8 +-
 samples/net/echo_server/prj_cc2520.conf            |   10 +-
 samples/net/echo_server/prj_frdm_k64f.conf         |    8 +-
 samples/net/echo_server/prj_frdm_k64f_cc2520.conf  |   10 +-
 samples/net/echo_server/prj_frdm_k64f_mcr20a.conf  |   10 +-
 samples/net/echo_server/prj_nrf5.conf              |   10 +-
 samples/net/echo_server/prj_qemu_802154.conf       |   10 +-
 samples/net/echo_server/prj_qemu_cortex_m3.conf    |    8 +-
 samples/net/echo_server/prj_qemu_x86.conf          |    8 +-
 samples/net/echo_server/prj_sam_e70_xplained.conf  |    8 +-
 samples/net/echo_server/src/echo-server.c          |  111 +-
 samples/net/http_client/prj_frdm_k64f.conf         |   10 +-
 samples/net/http_client/prj_qemu_x86.conf          |    8 +-
 samples/net/http_client/src/config.h               |    6 +-
 samples/net/http_client/src/http_client.c          |    1 -
 samples/net/http_client/src/http_client_rcv.c      |   34 +-
 samples/net/http_client/src/http_client_rcv.h      |    2 +-
 samples/net/http_client/src/tcp_client.c           |   10 +-
 samples/net/http_client/src/tcp_client.h           |    2 +-
 samples/net/http_server/README.rst                 |    2 +-
 samples/net/http_server/prj_arduino_101.conf       |    8 +-
 samples/net/http_server/prj_bt.conf                |    8 +-
 samples/net/http_server/prj_frdm_k64f.conf         |    8 +-
 samples/net/http_server/prj_qemu_x86.conf          |    8 +-
 samples/net/http_server/src/http_server.c          |   14 +-
 samples/net/http_server/src/http_server.h          |    4 +-
 samples/net/http_server/src/http_write_utils.c     |    1 -
 samples/net/http_server/src/ssl_utils.c            |   30 +-
 samples/net/http_server/src/ssl_utils.h            |    2 +-
 samples/net/ieee802154/hw/prj_cc2520_1.conf        |   10 +-
 samples/net/ieee802154/hw/prj_cc2520_2.conf        |   10 +-
 samples/net/ieee802154/hw/prj_mcr20a.conf          |   10 +-
 samples/net/ieee802154/hw/prj_nrf5.conf            |   10 +-
 samples/net/ieee802154/qemu/prj.conf               |   10 +-
 samples/net/ieee802154/qemu/prj_client.conf        |   10 +-
 samples/net/ieee802154/qemu/prj_server.conf        |   10 +-
 samples/net/irc_bot/prj_frdm_k64f.conf             |    8 +-
 samples/net/irc_bot/prj_qemu_x86.conf              |    8 +-
 samples/net/irc_bot/src/irc-bot.c                  |   28 +-
 samples/net/leds_demo/src/leds-demo.c              |   86 +-
 .../net/mbedtls_dtlsclient/prj_arduino_101.conf    |    8 +-
 samples/net/mbedtls_dtlsclient/src/udp.c           |   38 +-
 samples/net/mbedtls_dtlsclient/src/udp.h           |    2 +-
 samples/net/mbedtls_dtlsserver/src/udp.c           |   32 +-
 samples/net/mbedtls_dtlsserver/src/udp.h           |    2 +-
 samples/net/mbedtls_sslclient/prj_arduino_101.conf |    8 +-
 samples/net/mbedtls_sslclient/src/tcp.c            |   36 +-
 samples/net/mbedtls_sslclient/src/tcp.h            |    4 +-
 samples/net/mqtt_publisher/prj_96b_nitrogen.conf   |   10 +-
 samples/net/mqtt_publisher/prj_frdm_k64f.conf      |   12 +-
 samples/net/mqtt_publisher/prj_qemu_x86.conf       |   10 +-
 samples/net/mqtt_publisher/src/main.c              |    1 -
 samples/net/nats/prj_qemu_x86.conf                 |    5 +-
 samples/net/nats/src/main.c                        |    1 -
 samples/net/nats/src/nats.c                        |   36 +-
 samples/net/telnet/prj_frdm_k64f.conf              |    8 +-
 samples/net/telnet/prj_qemu_x86.conf               |    8 +-
 samples/net/telnet/prj_qemu_x86_iamcu.conf         |    8 +-
 samples/net/wpan_serial/prj.conf                   |    6 +-
 samples/net/wpan_serial/src/main.c                 |   77 +-
 samples/net/wpanusb/prj.conf                       |    4 +-
 samples/net/wpanusb/src/wpanusb.c                  |   52 +-
 samples/net/zoap_client/src/zoap-client.c          |   37 +-
 samples/net/zoap_server/src/zoap-server.c          |  188 +--
 samples/net/zperf/prj_bt.conf                      |   10 +-
 samples/net/zperf/prj_frdm_k64f.conf               |   10 +-
 samples/net/zperf/prj_frdm_k64f_prof.conf          |   10 +-
 samples/net/zperf/prj_qemu_x86.conf                |   10 +-
 samples/net/zperf/prj_quark_se_c1000_devboard.conf |    8 +-
 samples/net/zperf/src/zperf_session.c              |   28 +-
 samples/net/zperf/src/zperf_session.h              |    2 +-
 samples/net/zperf/src/zperf_tcp_receiver.c         |   16 +-
 samples/net/zperf/src/zperf_tcp_uploader.c         |   27 +-
 samples/net/zperf/src/zperf_udp_receiver.c         |  109 +-
 samples/net/zperf/src/zperf_udp_uploader.c         |  104 +-
 subsys/net/Makefile                                |    2 +-
 subsys/net/ip/6lo.c                                |  196 ++-
 subsys/net/ip/6lo.h                                |   12 +-
 subsys/net/ip/6lo_private.h                        |    4 +-
 subsys/net/ip/Kconfig                              |   34 +-
 subsys/net/ip/Kconfig.debug                        |   16 +-
 subsys/net/ip/Makefile                             |    2 +-
 subsys/net/ip/connection.c                         |  113 +-
 subsys/net/ip/connection.h                         |   29 +-
 subsys/net/ip/dhcpv4.c                             |  173 ++-
 subsys/net/ip/icmpv4.c                             |  176 +--
 subsys/net/ip/icmpv4.h                             |   16 +-
 subsys/net/ip/icmpv6.c                             |  255 +--
 subsys/net/ip/icmpv6.h                             |   32 +-
 subsys/net/ip/ipv4.c                               |   92 +-
 subsys/net/ip/ipv4.h                               |   28 +-
 subsys/net/ip/ipv6.c                               | 1271 +++++++--------
 subsys/net/ip/ipv6.h                               |   71 +-
 subsys/net/ip/l2/arp.c                             |  197 +--
 subsys/net/ip/l2/bluetooth.c                       |   50 +-
 subsys/net/ip/l2/dummy.c                           |   20 +-
 subsys/net/ip/l2/ethernet.c                        |  146 +-
 subsys/net/ip/l2/ieee802154/ieee802154.c           |  117 +-
 subsys/net/ip/l2/ieee802154/ieee802154_fragment.c  |  150 +-
 subsys/net/ip/l2/ieee802154/ieee802154_fragment.h  |   10 +-
 subsys/net/ip/l2/ieee802154/ieee802154_frame.c     |   43 +-
 subsys/net/ip/l2/ieee802154/ieee802154_frame.h     |   16 +-
 subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c      |   42 +-
 .../net/ip/l2/ieee802154/ieee802154_radio_aloha.c  |   16 +-
 .../ip/l2/ieee802154/ieee802154_radio_csma_ca.c    |   16 +-
 .../net/ip/l2/ieee802154/ieee802154_radio_utils.h  |   20 +-
 subsys/net/ip/nbuf.c                               | 1611 -------------------
 subsys/net/ip/net_context.c                        |  358 +++--
 subsys/net/ip/net_core.c                           |  127 +-
 subsys/net/ip/net_if.c                             |   58 +-
 subsys/net/ip/net_pkt.c                            | 1627 ++++++++++++++++++++
 subsys/net/ip/net_private.h                        |   42 +-
 subsys/net/ip/net_shell.c                          |  258 +++-
 subsys/net/ip/route.c                              |   24 +-
 subsys/net/ip/route.h                              |    4 +-
 subsys/net/ip/rpl-mrhof.c                          |    1 -
 subsys/net/ip/rpl-of0.c                            |    1 -
 subsys/net/ip/rpl.c                                |  688 ++++-----
 subsys/net/ip/rpl.h                                |   16 +-
 subsys/net/ip/tcp.c                                |  223 +--
 subsys/net/ip/tcp.h                                |   31 +-
 subsys/net/ip/udp.h                                |   42 +-
 subsys/net/ip/utils.c                              |   41 +-
 subsys/net/lib/dns/resolve.c                       |   32 +-
 subsys/net/lib/http/http_client.c                  |   54 +-
 subsys/net/lib/http/http_server.c                  |   23 +-
 subsys/net/lib/mqtt/mqtt.c                         |  118 +-
 subsys/net/lib/zoap/zoap.c                         |  280 ++--
 subsys/net/lib/zoap/zoap_link_format.c             |  105 +-
 tests/net/6lo/prj.conf                             |   13 +-
 tests/net/6lo/src/main.c                           |   83 +-
 tests/net/arp/prj.conf                             |   10 +-
 tests/net/arp/src/main.c                           |  232 +--
 tests/net/context/prj.conf                         |   10 +-
 tests/net/context/src/main.c                       |  116 +-
 tests/net/dhcpv4/prj.conf                          |    8 +-
 tests/net/dhcpv4/src/main.c                        |  134 +-
 tests/net/icmpv6/prj.conf                          |    8 +-
 tests/net/icmpv6/src/main.c                        |   41 +-
 tests/net/ieee802154/crypto/prj.conf               |    7 +-
 tests/net/ieee802154/fragment/prj.conf             |   10 +-
 tests/net/ieee802154/fragment/src/main.c           |   86 +-
 tests/net/ieee802154/l2/prj.conf                   |    8 +-
 .../net/ieee802154/l2/src/ieee802154_fake_driver.c |   24 +-
 tests/net/ieee802154/l2/src/ieee802154_test.c      |   47 +-
 tests/net/iface/prj.conf                           |    8 +-
 tests/net/iface/src/main.c                         |   22 +-
 tests/net/ip-addr/prj.conf                         |    8 +-
 tests/net/ip-addr/src/main.c                       |    6 +-
 tests/net/ipv6/prj.conf                            |   10 +-
 tests/net/ipv6/src/main.c                          |  119 +-
 tests/net/lib/dns_resolve/src/main.c               |   10 +-
 .../net/lib/mqtt_publisher/src/test_mqtt_publish.c |    2 +-
 .../lib/mqtt_subscriber/src/test_mqtt_subscribe.c  |    2 +-
 tests/net/lib/zoap/prj.conf                        |    4 +-
 tests/net/lib/zoap/src/main.c                      |  318 ++--
 tests/net/mgmt/prj.conf                            |    8 +-
 tests/net/mgmt/src/mgmt.c                          |    6 +-
 tests/net/mld/prj.conf                             |    6 +-
 tests/net/mld/src/main.c                           |   66 +-
 tests/net/neighbor/prj.conf                        |   10 +-
 tests/net/neighbor/src/main.c                      |    1 -
 tests/net/{nbuf => net_pkt}/Makefile               |    0
 tests/net/{nbuf => net_pkt}/prj.conf               |   17 +-
 tests/net/{nbuf => net_pkt}/src/Makefile           |    0
 tests/net/{nbuf => net_pkt}/src/main.c             |  663 ++++----
 tests/net/{nbuf => net_pkt}/testcase.ini           |    0
 tests/net/route/prj.conf                           |    8 +-
 tests/net/route/src/main.c                         |   61 +-
 tests/net/rpl/prj.conf                             |   10 +-
 tests/net/rpl/src/main.c                           |   49 +-
 tests/net/tcp/prj.conf                             |   10 +-
 tests/net/tcp/src/main.c                           |  314 ++--
 tests/net/trickle/prj.conf                         |    8 +-
 tests/net/udp/prj.conf                             |   10 +-
 tests/net/udp/src/main.c                           |  106 +-
 tests/net/utils/prj.conf                           |    8 +-
 tests/net/utils/src/main.c                         |  139 +-
 236 files changed, 8793 insertions(+), 8685 deletions(-)
 delete mode 100644 include/net/nbuf.h
 create mode 100644 include/net/net_pkt.h
 delete mode 100644 subsys/net/ip/nbuf.c
 create mode 100644 subsys/net/ip/net_pkt.c
 rename tests/net/{nbuf => net_pkt}/Makefile (100%)
 rename tests/net/{nbuf => net_pkt}/prj.conf (53%)
 rename tests/net/{nbuf => net_pkt}/src/Makefile (100%)
 rename tests/net/{nbuf => net_pkt}/src/main.c (61%)
 rename tests/net/{nbuf => net_pkt}/testcase.ini (100%)

Change-Id: I7ce3d65b6e92d12a2f6536cd41ce1281bcdf9a7a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>