We must discard the received Discard-Request silently.
See RFC 1661 chapter 5.9 for details.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Currently only net-shell calls net_ppp_ping() command, so make
it return the amount of time that it took to receive Echo-Reply
so the net-shell can print the round trip time value.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If the network interface is point-to-point one which does
not need IP address etc, then no need to start DAD etc for
those interfaces.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we receive a protocol that we do not currently handle, then
return Protocol-Reject to peer.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
By default PPP is started immediately when the network interface
goes up. This can be problematic especially when debugging the beast
so allow user to delay the startup.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This patch tries to avoid memmoves and buffer allocations when there
is enough space in the original buffer. Headers are still contiguous
but not in the same buffer.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This is a rework of the 6lo IPHC uncompression.
The uncompression now tries to work in place on the original buffer
instead of allocation a new one. If there is not enough tail-room,
a new buffer is allocated and filled with the IP and maybe UDP header.
The compressed header is pulled from the original buffer and the
buffer is preserved.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
When net_pkt_skip skips the entire data in a net buffer, the cursor
still points to this buffer on data that is off by one.
Calling pkt_cursor_advance in net_pkt_is_contiguous fixes this and
moves the cursor to the next buffer.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This is a rework of the 6lo IPHC. The compression now works inline
on the original buffer instead of allocation a new one.
Additionally DAM_11 (Destination address fully elided) has precedence
over DAM_10 (16 bit compressible) now.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Move CMake ExternalProject integration of OpenThread to the
CMakeLists.txt file within the OpenThread fork.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The SO_TXTIME socket option can be used by the application to
tell the network device driver the exact moment when the
network packet should be sent.
This feature is also implemented in Linux.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add BSD socket sendmsg() API that can be used to send data to peer
and also pass ancillary data to lower level of the network stack.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User could have set something to optval in getsockopt() and we
need to copy the data to kernel optval so that the socket family
code can use the value for something.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If the allocated net_pkt is larger than the network interface MTU,
then check if the IPv6 fragmentation is enabled and allow larger
net_pkt length as the IPv6 fragmentation will split the packet into
suitable parts.
Fixes#16354
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The net_pkt_pull() needs to move all the remaining data in the
net_buf instead of just the pull amount.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Certain Thread implementations (notably ARMs) require a DHCPv6
implementation.
Allow the usage of the relevant OpenThread configuration parameters in
Zephyr.
Signed-off-by: Markus Becker <markus.becker@tridonic.com>
Bluetooth address parsing has been duplicated across the different
sub-shell files. Also missing parsing of identity/resolved addresses.
Move parsing of string close to parsing to string for a symmetrical API
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Move duplicate hex2bin and add bin2hex function so that application can
use the functions and avoid code duplication.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
It currently only listens to relevant events about network interface to
decide whether raising connected or disconnected event.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Current implementation of LwM2M engine doesn't allow users a way
of overriding TLS credential load with custom function. This
would be needed by an offloaded TLS stack where we don't want
to use standard Zephyr functions.
Let's add a load_credential function pointer to the LwM2M client
context which will be called when it's available.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/17408
Signed-off-by: Michael Scott <mike@foundries.io>
Let's remove depends on NET_LLDP from all the options. It avoids this:
# CONFIG_NET_LLDP is not set
# CONFIG_NET_LLDP_LOG_LEVEL_OFF is not set
# CONFIG_NET_LLDP_LOG_LEVEL_ERR is not set
# CONFIG_NET_LLDP_LOG_LEVEL_WRN is not set
# CONFIG_NET_LLDP_LOG_LEVEL_INF is not set
# CONFIG_NET_LLDP_LOG_LEVEL_DBG is not set
CONFIG_NET_LLDP_LOG_LEVEL_DEFAULT=y
CONFIG_NET_LLDP_LOG_LEVEL=3
CONFIG_NET_LLDP_CHASSIS_ID="CHASSIS_ID_PLACEHOLDER"
CONFIG_NET_LLDP_PORT_ID="PORT_ID_PLACEHOLDER"
And instead it will generate this:
# CONFIG_NET_LLDP is not set
Make the menu as an enablement config option as well.
Adapting lldp header file relevantly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
ARP, LLDP and GPTP functions have dummies in case of being disabled so
let's use IS_ENABLED() accordingly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
If we receive IPv6 packet where source address is unspecified
(all zeros), then we need to drop it.
Fixes#17450
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When performing OTA using the LwM2M subsys, several logging errors
regarding log_strdup were noted. Let's fix these.
Signed-off-by: Michael Scott <mike@foundries.io>
If a sample wants to use the Zephyr implementation of mbedtls, it
enables CONFIG_MBEDTLS and sets any needed Zephyr-specific mbedtls
options.
Currently, the LwM2M subsystem selects MBEDTLS automatically when
LWM2M_DTLS_SUPPORT is enabled. Let's remove this and let the
LwM2M client sample enable mbedtls and it's options.
This mimics the behavior of several other network-related samples
and removes conflicts when selecting alternate implementations of
MBEDTLS.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/17399
Signed-off-by: Michael Scott <mike@foundries.io>
CONFIG_NET_IPV* checks are not needed in lwm2m_parse_peerinfo().
The functions used are always available. Worse, having these checks
forces the need to enable CONFIG_NET_IPV4 or IPV6 when it's not really
needed (LwM2M could be using an offloaded IP stack).
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/17401
Signed-off-by: Michael Scott <mike@foundries.io>
CONFIG_NET_IPV* checks are not needed in lwm2m_sprint_ip_addr(). The
functions used are always available. Worse, having these checks
forces the need to enable CONFIG_NET_IPV4 or IPV6 when it's not really
needed (LwM2M could be using an offloaded IP stack).
NOTE: Also fixes an issue where a NULL is returned when the IP address
is unknown. This usually ends up with a crash/abort in the logging
code.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/17401
Signed-off-by: Michael Scott <mike@foundries.io>
If we receive IPv4 packet where source address is unspecified
(all zeros), then we need to drop it.
Fixes#17427
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If DNS server(s) are added or removed e.g., as part of DHCP
processing, send newly defined net-mgmt events so that
a user application may get this information.
Fixes#16924
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Removing an IPv4 router was missing, as well as finding the default
router for an IPv4 address.
Note howevere that IPv4 router features are not used anywhere yet. But
at least the API is there and is a 1:1 to IPv6, if that matters.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
- router lifetime is always a u16_t so fixing
net_if_ipv6_router_update_lifetime() signature.
- Coalescing router timers into one: this reduces the net_if_router
structure by 22 bytes
- refactor IPv6 and IPv4 router code so it's handled in generic
functions, to avoid duplicating 90% of the code for each family. This
also fixes the lifetime support for IPv4 which was missing.
Note however that IPv4 routing support seems to be missing as none of
the relevant functions are used anywhere yet.
Fixes#8728
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This reduces the size of struct net_if_ipv6 by 24 bytes by moving
the k_delayed_work attribute into net_if core code.
Then each net_if_ipv6 can be added to the timer handler via a slist.
This does not make much gain if the system has only 1 network interface
It starts to be interesting if it has 2+ network interfaces then.
Fixes#8728
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This reduces the size of struct net_if_addr by 24 bytes by moving
the k_delayed_work attribute into net_if core code.
Then each net_if_addr can be added to the timer handler via a slist.
This does not make much gain if the system has only 1 unicast IPv6
address. It's a nice memory improvment once it has 2+ unicast IPv6
address. Note that having IPv4 enabled along with IPv6 will also see
memory improvements since both IPv6 and IPv4 use the same struct
net_if_addr.
Fixes#8728
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Let's regroup all the IPv4 related function into one ifdef. There is no
need to implement a dummy function for each: if IPv4 is not enabled,
these functions are unused in the core.
Fixes#8728
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Let's regroup all the IPv6 related function into one ifdef. There is no
need to implement a dummy function for each: if IPv6 is not enabled,
these functions are unused in the core.
Fixes#8728
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The hostname needs to have log_strdup() when printing it.
Also it is useful to print information if the sending fails.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>