- Add test cases of ipv4/ipv6 sendto() and recvfrom()
- Set the main stack size to 2048 to enable both ipv4 and ipv6 on
qemu_x86.
- Use net app for network setup.
Signed-off-by: Aska Wu <aska.wu@linaro.org>
sendto() and recvfrom() are often used with datagram socket.
sendto() is based on net_context_sendto() and recvfrom() is based on
zsock_recv() with parsing source address from the packet header.
Signed-off-by: Aska Wu <aska.wu@linaro.org>
This patch makes net_context_sendto() work independently without calling
net_context_connect() first. It will bind default address and port if
necessary.
Also, since receive callback should be provided before sending data in
order to receive the response, bind default address and port to prevent
providing an unbound address and port to net_conn_register().
Signed-off-by: Aska Wu <aska.wu@linaro.org>
Introduce net_pkt_get_src_addr() as a helper function to get the source
address and port from the packet header.
Signed-off-by: Aska Wu <aska.wu@linaro.org>
This is pulled from commit a8c964eacb21288b2dbfa9d80cee5968a3b8fb21 of
the Linux kernel with local zephyr related modifications.
Fixes#4135.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The PA/LNA feature is not functional on nRF51x series due to added
interrupt latency. Disable this feature unconditionally for those ICs to
avoid unexpected behavior.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Other parts of the networking subsystem may use net_pkt_ip_hdr_len() on
a packet that has been encrypted for use with DTLS. Let's restore that
value here so those areas don't receive an erroneous 0 value.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
When default "n" is selected (as it is by default) this sets:
CONFIG_MBEDTLS_DEBUG="n"
When checked by the existing logic (example shown below) will always
be true and debug will be enabled all the time:
//#if defined(CONFIG_MBEDTLS_DEBUG)
Instead, let's change the config type to "bool" which will be
undefined when set to "n" (by default). The existing #if defined()
checks will work correctly.
NOTE: This fix saves a lot of binary space when MBEDTLS is enabled
due to the amount debug output being compiled in.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
When a configuration file fragment ends in a line that is not
terminated by a \n, it will mange the pasting of the following
fragment. For example, in file1.prj:
CONFIG_SETTING_A=34
CONFIG_SETTING_B=12
and file2.prj:
CONFIG_SETTING_C=56
would become:
CONFIG_SETTING_A=34
CONFIG_SETTING_B=12CONFIG_SETTING_C=56
because there was no \n at the end of CONFIG_SETTING_B=12. This makes
the kconfig parser to reject CONFIG_SETTING_B and to loose
CONFIG_SETTING_C, which then has random consequences.
So, to avoid that problem, always add a newline after a config fragment.
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
patch fix the issue of unable to read from adc by setting
appropriate sampling delay.
The sampling delay should be set to resolution of adc + 2.
In adc qmsi driver the sampling delay received form application
is subtracted from resolution of adc + 2 , if the resultant value
is less than zero then zero is set as sampling delay. So in the
adc_simple application when 12 is passed as sampling delay driver
sets it as zero. So 26 is the minimum sampling delay should be
set in application for a adc with resolution of 12. The reason
to choose 30 was to maintain same value of sampling
delay between adc_simple and adc_api application.
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
ztest framework doesn't do anything privileged, it interacts with the
kernel using system calls like other application code and should be
considered runtime logic.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
If we were trying to send max MTU size data, then the temporary
frame_buf was overflowing because it only allocated 1500 bytes
for the buffer but then copied 1514 bytes into it (max mtu +
ethernet header).
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add the following application-facing memory domain APIs:
k_mem_domain_init() - to initialize a memory domain
k_mem_domain_destroy() - to destroy a memory domain
k_mem_domain_add_partition() - to add a partition into a domain
k_mem_domain_remove_partition() - to remove a partition from a domain
k_mem_domain_add_thread() - to add a thread into a domain
k_mem_domain_remove_thread() - to remove a thread from a domain
A memory domain would contain some number of memory partitions.
A memory partition is a memory region (might be RAM, peripheral
registers, flash...) with specific attributes (access permission,
e.g. privileged read/write, unprivileged read-only, execute never...).
Memory partitions would be defined by set of MPU regions or MMU tables
underneath.
A thread could only belong to a single memory domain any point in time
but a memory domain could contain multiple threads.
Threads in the same memory domain would have the same access permission
to the memory partitions belong to the memory domain.
The memory domain APIs are used by unprivileged threads to share data
to the threads in the same memory and protect sensitive data from
threads outside their domain. It is not only for improving the security
but also useful for debugging (unexpected access would cause exception).
Jira: ZEP-2281
Signed-off-by: Chunlin Han <chunlin.han@linaro.org>
Building off the success of PR #4119, add more attributes to the sphinx
processing list (as encountered in PR #4123) plus others from
include/toolchain/gcc.h that looked safe to add.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Everything get passed to handlers as u32_t, make it simpler to check
something that is known to be a pointer, like we already do with
_SYSCALL_IS_OBJ().
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The compiler was complaining about impossible constraints since register
constraint was provided, but there are no general purpose registers left
available.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Device drivers need to be treated like other kernel objects, with
thread-level permissions and validation of struct device pointers passed
in from userspace when making API calls.
However it's not sufficient to identify an object as a driver, we need
to know what subsystem it belongs to (if any) so that userspace cannot,
for example, make Ethernet driver API calls using a UART driver object.
Upon encountering a variable representing a device struct, we look at
the value of its driver_api member. If that corresponds to an instance
of a driver API struct belonging to a known subsystem, the proper
K_OBJ_DRIVER_* enumeration type will be associated with this device in
the generated gperf table.
If there is no API struct or it doesn't correspond to a known subsystem,
the device is omitted from the table; it's presumably used internally
by the kernel or is a singleton with specific APIs for it that do not
take a struct device parameter.
The list of kobjects and subsystems in the script is simplified since
the enumeration type name is strongly derived from the name of the data
structure.
A device object is marked as initialized after its init function has
been run at boot.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
To define a system call, it's now sufficient to simply tag the inline
prototype with "__syscall" or "__syscall_inline" and include a special
generated header at the end of the header file.
The system call dispatch table and enumeration of system call IDs is now
automatically generated.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The doxygen/sphinx/breathe processing for API documentation has some
known issues and we've been using a post-processing filter to eliminate
"expected" warnings. Sphinx/Breathe 5.0 was updated to support
identifying attributes causing these warnings, so this PR adds a
starting list to get around warnings recently introduced with __syscall
and __syscall_inline (PR #4103).
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Issuing HCI reset command while having connections sometimes
hung the controller.
ll_reset supplied invalid stop ticker id to role_disable
when trying to stop all connections. Connection role does
not utilize stop ticker. The invalid ticker id supplied
referenced memory outside the pool of tickers and based on
what the content is in RAM there, the controller would hang
trying to stop connections.
Fixed by not calling the ticker_stop interface with invalid
ticker ids.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update the versions of tools used to generate documentation locally and
include a description of the message filtering now included in the doc
build Makefile (formerlly only done in the CI scripts).
Also, include the documentation docs in the developer guides to help
folks that want to contribute and generate docs locally.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
The IPv6 address parameters in net_ipv6_send_na() can be const
as the function will not modify them. This avoids compile warning
about parameter constness.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It is useful to return the neighbors in net_ipv6_nbr_foreach()
groupped by network interface. This way the caller has them
already in proper order and does not need to re-group them.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Proxy configuration messages are allowed (in fact required) to use
unassigned addresses, so they should be exempt from this check.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The test failure may be e.g. because of an unknown company id, and in
that case the spec expects us to ignore the message.
With this patch it should be possible to pass MESH/SR/HM/RFS/BI-01-C.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
A previous patch which moved dispatching the health publish callback
to a later moment introduced a regression where the period divider
does not get updated when it should. In fact, having the divider as
part of the Health Server context is redundant, since the same
information is already stored generically in the model publication
context. Switching to using the model publication context makes things
simpler and ensures that the value is always up-to-date.
With this patch it is possible to pass MESH/SR/HM/CFS/BV-02-C.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We should ignore invalid addresses (helps pass
MESH/NODE/CFG/LPNPT/BI-01-C). Also fix a copy-paste issue in an error
log.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The values all need to be zeroed when heartbeat subscription is
disabled. This makes it possible to pass MESH/NODE/CFG/HBS/BV-01-C.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
These tests test the IPv4 multicast address add, lookup and
removal functions found for network interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
There was no handler functions for adding, removing and looking up
IPv4 multicast addresses in the network interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If the user tried to bind to IPv4 multicast address, then the
operation failed and returned error.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The IPv4 address in struct in_addr is in big endian so check
the multicast address value correctly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If the network interface does not support IPv4 like IEEE 802.15.4
or Bluetooth, then do not print IPv4 information for those interfaces.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>