Typo when calculating new value for local_time_n.low, the calculation
was just a constant expression and the value was not modified.
Coverity-CID: 188759
Fixes#10568
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The connection index was printed incorrectly in debug print.
Coverity-CID: 188742
Coverity-CID: 188753
Fixes#10583#10574
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This patch fixes the compile error when CONFIG_NET_PKT_LOG_LEVEL
is LOG_LEVEL_DBG.
> subsys/net/ip/net_shell.c: In function ‘context_info’:
> subsys/net/ip/net_shell.c:2893:106: error: ‘struct net_buf_pool’
> has no member named ‘avail_count’
> subsys/net/ip/net_shell.c:2893:125: error: ‘struct net_buf_pool’
> has no member named ‘name’
In struct net_buf_pool, 'avail_count' and 'name' are depends on
CONFIG_NET_BUF_POOL_USAGE.
Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
Check for NULL IPv6 addr values from net_if_ipv6_get_ll() in rpl.c
If NULL, print out an error statement stating that no proper IPv6
address was found
Coverity-CID: 188169
Fixes#10094.
Signed-off-by: Satya Bhattacharya <satyacube@gmail.com>
This flag is an indication to the timer driver that the OS doesn't
care about rollover conditions of the tick count while idling, so the
system doesn't need to wake up once per counter flip[1]. Obviously in
that circumstance values returned from k_uptime_get_32() are going to
be wrong, so the implementation had an assert to check for misuse.
But no one understood that from the docs, so the only place these APIs
were used in practice were as "guards" around code that needed to call
k_uptime_get_32(), even though that's 100% wrong per docs!
Clarify the docs. Remove the incorrect guards. Change the flag to
initialize to true so that uptime isn't broken-by-default in tickless
mode. Also move the implemenations of the functions out of the
header, as there's no good reason for these to need to be inlined.
[1] Which can be significant. A 100MHz ARM using the 24 bit SysTick
counter rolls over at about 6 Hz, and if it had to come out of
idle at that rate it would be a significant power issue that would
swamp the gains from tickless. Obviously systems with slow
counters like nRF or 64 bit ones like RISC-V or x86's TSC aren't
as affected.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Recently, the wifi net offload driver has been asserting
as init_iface() was checking for api->send != NULL, even in
the case of NET_OFFLOAD
This patch suggests a fix to handle the NET_OFFLOAD case.
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
Also, defines one LOG_MODULE_NAME for the simplelink WiFi driver, and
uses the same name for all files in this driver (module).
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
If we receive a valid gratuitous ARP request, then update ARP
cache accordingly. This feature is optional and by default
it is enabled, but can be turned off if needed.
This is similar to a feature available in Linux, and is enabled
by default in many distros.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The wifi mgmt does only support TCP/IP offload wifi chip,
while non-offload wifi chip can not scan/connect to AP.
Signed-off-by: Dong Xiang <dong.xiang@unisoc.com>
Placing it at sys/fcntl.h was due to mimicking internal newlib's
layout, but what we need is this file at the standard location,
for reuse.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit fixes the issue that if a thread is waiting on recv for
data and the user closes the socket, the waiting thread is not
unblocked.
Signed-off-by: Léonard Bise <leonard.bise@gmail.com>
The wifi management interface was still using one SYS_LOG_DBG
macro call, replacing that with NET_DBG.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Adding spaces around "=" when definining Kconfig template so
that is more consistent with overall style of these template
variables.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the debugging print calls are async, all the strings that might
be overwritten must use log_strdup() which will create a copy
of the printable string.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The code was trying to print peer IP address string but that
pointer could contain garbage. There is actually no need to print
anything in this case, the error code return is enough.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Currently logging subsystem supports quite small number of function
parameters. So split some long functions into smaller pieces.
Hopefully this is just a temporary patch and we can support more
parameters to logging macros.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of one global log level option and one on/off boolean
config option / module, this commit creates one log level option
for each module. This simplifies the logging as it is now possible
to enable different level of debugging output for each network
module individually.
The commit also converts the code to use the new logger
instead of the old sys_log.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The last parameter is 'period', we should not pass duration twice.
Doing so makes zephyr hang with current mainline when it is chosen to be
the Grand Master.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
Completely remove the last_sync_receipt_timeout time. It is not part of
the standard (see 802.1AS-2011, 10.2.11 for the complete list of
variables for this state machine). Additionally this extra variable was
never really initialized so the calculated duration made no sense.
Just start the timer based on the regular sync receipt timeout time
interval from the port data set.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
This commits adds a possibility to select PTP clock accuracy through
KConfig.
The chosen accuracy should reflect the capabilities of the used
hardware.
See IEEE 1588-2008, chapter 7.6.2.5 for more details.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
Implements GMCAP-1, GMCAP-2, and GMCAP-3 and their dependencies from
802.1AS-2011. See Annex A.10 for more details.
The Grand Master Capability can be turned on and off through KConfig.
Note: the correction field in FUP packets is not yet properly
calculated. There is a TODO left in the code, near which some parameters
are zeroed to make the correction field be set to 0. This mimics the
behavior of openAvnu (a Linux gPTP client). For full compliance the
field should be calculated and set properly.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
Optimize memory usage of enums that are used within structs.
Reorganize the affected structs to avoid holes.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
SyncReceiptTime should use an ExtendedTimestamp (with fractional
nanoseconds precision). Add a struct with the definition of the needed
type and convert that variable.
The struct representing the ExtendedTimestamp is named
net_ptp_extended_time to keep consistency with the existing net_ptp_time
which is used for regular PTP timestamps.
See 802.1AS-2011 chapters 10.2.3.4 and 6.3.3.5 for more reference.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
There are other ClockMasterSync state-machines (to be implemented).
Current name would either cause conflicts or be too ambiguous.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
In coap_option_value_to_int function, when coap option length is 4,
option->value[3] should be shifted by 0 rather than option->value[2].
This doesn't affect the behavior of function but needs to be fixed.
In coap_append_option_int function, when the value is between 0xffff
and 0xffffff(when option length is 3), bit shift operation is wrong.
For example, if the value is 0xABCDEF, by sys_put_be16(val, data)
data[0]=0xCD, data[1]=0xEF, by val >> 16, data[2]=0xAB. So the result
becomes 0xCDEFAB not 0xABCDEF. So, to sys_put_be16 function hand
&data[1] over instead of handing data over and val >> 16 needs to be
set to data[0], not data[2].
Signed-off-by: Taehwa Kang <hegrecomm@gmail.com>
Under GNU C, sizeof(void) = 1. This commit merely makes it explicit u8.
Pointer arithmetics over void types is:
* A GNU C extension
* Not supported by Clang
* Illegal across all ISO C standards
See also: https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html
Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
pkt properties should be set prior to routing.
If packet routing is turned on and the packet is
forwarded to an interface, the pkt properties like
ipv6_ext_len or ip_hdr_len will not be initialized.
If a UDP packet is forwarded to an 6lo interface,
it leads to incorrect calculation of UDP header
during UDP header compression (net_udp_get_hdr).
Fixes#10204
Signed-off-by: Johann Fischer <j.fischer@phytec.de>