Commit graph

43 commits

Author SHA1 Message Date
Robert Lubos 63a5d26877 samples: net: mdns_responder: Bump CONFIG_NET_SOCKETS_POLL_MAX
Socket service library threw an error, the configured value was too
low for it to work.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-24 12:42:16 -04:00
Jukka Rissanen 8363b8cfd9 samples: net: Increase CONFIG_NET_SOCKETS_POLL_MAX to pass checks
The number of suitable network IPv6/4 configurations in interfaces
affect the number of pollable sockets. So need to increase the value
from the default value of 3.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-03 09:49:01 +02:00
Jukka Rissanen d5cd41a0fe net: llmnr_responder: Convert LLMNR responder to use socket service API
Instead of using net_context API directly, the LLMNR responder is
changed to use the socket service API. This allows DNS access
for offloaded sockets and can lower overall memory consumption.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-20 14:25:44 +03:00
Jonathan Rico e3ff993000 Network: L2: remove IPSP
Remove IPSP support from the tree.

It has no maintainers, and is regularly broken. The fact that it's
nontrivial to set-up in linux makes it hard to fix reported issues.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-11 12:48:50 +02:00
Jukka Rissanen 793cd56678 samples: net: mdns_responder: Fix the VLAN support
The mdns-responder VLAN code needed updating so that correct
interfaces are in use.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen 5c3fa85bc8 samples: net: Change to use CONFIG_POSIX_API
Change the sample applications that use network socket API to
use the POSIX_API config because the NET_SOCKETS_POSIX_NAMES is
deprecated. Convert also the zsock_ API calls to plain BSD
socket API calls when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 3c0fe6b04b samples: net: Change samples to support new IPv4 netmask setting API
Make sure that the samples use the new IPv4 netmask setting API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-03 18:58:29 +01:00
Jukka Rissanen 9246d98a6a samples: net: mdns_responder: Add VLAN support
Add virtual LAN support to the sample so that it is easier to
test the multiple mDNS listener feature implemented in previous
commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-11-17 12:40:33 +01:00
Benjamin Cabé 994558ef8e samples: net: doc: Use new Sphinx extension to document networking samples
Use the new code-sample directive and roles to document the networking
samples so that they show up as "Related samples" when browsing the
various relevant networking APIs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-19 15:22:59 +01:00
Théo Battrel e9ee3e0af0 Bluetooth: Samples: Remove usage of BT_DEBUG_LOG
Remove usage of Kconfig symbol `CONFIG_BT_DEBUG_LOG` from samples. It
has been deprecated since this PR:
https://github.com/zephyrproject-rtos/zephyr/pull/56183

The Kconfig symbols has been replaced by `CONFIG_LOG=y` on most of the
cases. Or it has been removed when not needed anymore.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-07 13:56:55 -04:00
Chris Morgan 777f88939f samples: net: mdns_responder: Code in example is unrelated to mDNS
Clarify the comment in the code so people looking to use mDNS don't
think that interaction with Zephyr is necessary for mDNS support to
work, its in fact built into the networking stack when the mDNS
feature is enabled.

Signed-off-by: Chris Morgan <chmorgan@gmail.com>
2023-05-22 08:05:49 +00:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Anas Nashif ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-29 16:03:23 +01:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Kumar Gala 1ddcb3ab02 ethernet: remove defconfig/proj setting of ethernet drivers
Now that ethernet drivers are enabled based on devicetree we can
remove any cases of them getting enabled by proj.conf files.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-15 14:32:45 +02:00
Krzysztof Chruscinski 041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Gerard Marull-Paretas c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:

```python
from pathlib import Path
import re

EXTENSIONS = ("c", "h", "cpp", "rst")

for p in Path(".").glob("samples/**/*"):
    if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
        continue

    content = ""
    with open(p) as f:
        for line in f:
            m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
            if (m and
                not m.group(2).startswith("zephyr/") and
                (Path(".") / "include" / "zephyr" / m.group(2)).exists()):
                content += (
                    m.group(1) +
                    "#include <zephyr/" + m.group(2) +">" +
                    m.group(3) + "\n"
                )
            else:
                content += line

    with open(p, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 11:29:59 +02:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Guðni Már Gilbert 6c3674cd4a samples: net: mdns_responder: Fix coverity resource leak issue
Avoid resource leak by closing socket when there is an error.

Coverity-CID: 215381
Fixes #33094

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2021-03-09 13:10:48 +02:00
Guðni Már Gilbert 7713d347a2 samples: net: mdns_responder: Fix coverity issue
Check return value if sendto() fails.

Coverity-CID: 215391
Fixes #33093

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2021-03-09 13:10:48 +02:00
Christopher Friedt 0fc80cf79f net: dns: enable dns service discovery for mdns responder
This change enables support for DNS service discovery
(RFC 6763) in the mdns_responder service and sample app.

Fixes #29429

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 16:15:02 -08:00
Jukka Rissanen d8b0c28072 samples: net: mdns_responder: Add IPv4 gateway setting
IPv4 packets might not get routed out if IPv4 gateway is missing
so add it here.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-28 17:43:36 +02:00
Jukka Rissanen 781da8d540 samples: net: mdns_responder: Add readme file
A readme file describing the usage was missing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-28 17:43:36 +02:00
Anas Nashif dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
Marc Herbert 2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Anas Nashif da5f185e06 samples: add test identifier
Add unique identifier instead of just 'test' for samples.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Anas Nashif 5060ca6a30 cmake: increase minimal required version to 3.13.1
Move to latest cmake version with many bug fixes and enhancements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-03 11:51:29 -05:00
Jukka Rissanen cd4eb946c4 samples: net: Convert to use generic logging macros
Use generic logging macros LOG_*() instead of NET_*() as the
latter are mostly meant for internal networking stack use.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 12:00:04 +02:00
Jukka Rissanen 86689030e8 net: Clarify logging in networking code
Remove network specific default and max log level setting
and start to use the zephyr logging values for those.

Remove LOG_MODULE_REGISTER() from net_core.h and place the
calls into .c files. This is done in order to avoid weird
compiler errors in some cases and to make the code look similar
as other subsystems.

Fixes #11343
Fixes #11659

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 12:00:04 +02:00
Reto Schneider 7eabab2f5d samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming every project "NONE"
defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
2018-10-27 21:31:25 -04:00
Jukka Rissanen d38694af80 samples: net: mdns_responder: Convert to new logging system
Use new logging system with support for network log level.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-04 14:13:57 +03:00
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.

Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.

To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.

This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.

The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-15 04:06:50 -07:00
Paul Sokolovsky 028aae1ec9 net: config: Rename Kconfig options to correspond to library name
This finishes refactor of splitting off net_config library name from
net_app library, started in c60df1311, c89a06dbc. This commit makes
sure that Kconfig options are prefixed with CONFIG_NET_CONFIG_
instead of CONFIG_NET_APP_, and propagates these changes thru the
app configs in the tree.

Also, minor dependency, etc. tweaks are made.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-13 18:42:31 -07:00
Anas Nashif b5b8095749 samples: bluetooth and net samples need test setup
remove build_only and make them depend on test harness (bluetooth)

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 23f81eeb42 tests/samples: fixed yaml syntax
Use a map directory, avoid the list which makes parsing a bit
cumbersome.

Fixes #5109

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-11 14:47:08 -05:00
Jukka Rissanen 3c0a0053fa samples: net: Remove QEMU_NET_STACK setting from CMakeLists.txt
The QEMU_NET_STACK is enabled automatically if building
a networking application to QEMU so no need to do it for
each networking sample.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-11-10 14:52:53 +02:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Leandro Pereira da9b0ddf5b drivers: Rename random to entropy
This should clear up some of the confusion with random number
generators and drivers that obtain entropy from the hardware.  Also,
many hardware number generators have limited bandwidth, so it's natural
for their output to be only used for seeding a random number generator.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-01 08:26:29 -04:00
Jukka Rissanen e5958d3a8d sample: net: mdns: Add mDNS responder application
This application does not do anything itself, it just waits
mDNS queries and responds to them.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-17 08:36:39 -04:00