Ensure that HTTP resources can only be served to a client connected on
the specific service(s) that the resource was registered against using
the HTTP_RESOURCE_DEFINE macro.
This allows different resources to be registered to different services,
for example to make some resources only available via an HTTPS service
and not via unencrypted HTTP.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Passing HTTP upgrade request context to the user callback allows the
user to decide whether to accept or reject the websocket connection
based on the HTTP headers in the request. The primary reason for this is
to enable authentication of the websocket connection (e.g. via cookies
or Authorization header).
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
RFC6455 section 5.1 specifies that "A server MUST NOT mask any frames
that it sends to the client". Implement this for websocket write calls
via ZVFS, by storing in the websocket_context whether a socket is acting
in the client or server role, and using this to determine if sent data
should be masked.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
The DHCPv4 options always assigns the DNS address if the router
provides one through the DHCP callback. There are times a developer
may not always want to assign the server from the router, but only
manually assign them. Adding a Kconfig option for assigning the DNS
address and defaulting to true to not interfere with previously
expected functionality.
Signed-off-by: Kris Wolff <kwolff@wavelynx.com>
Latest supplicant uses 1K buffer size for sending control message via
socketpair, so reducing the NET_SOCKETPAIR_BUFFER_SIZE to save memory
footprint. There are 4 socketpairs for supplicant only case, and 6
socketpairs for hostapd case, update the heap size correspondingly.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
For waking up the poll() use eventfd() instead of socketpair()
so we save some buffer space and one file descriptor.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Previously added type casting was still causing coverity to complain.
This time casting multiplication before bitshift operation.
Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
Retreiving IP address from the networking interface assigned to
a PTP port could result in NULL dereference or undefined behaviour
when passing NULL to `memcpy()` function. Added check on addresses
returned from functions retreiving IP address from an interface.
Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
Use the net_icmp_send_echo_request_no_wait() when sending
ICMP Echo-Req so that we can avoid the warning message from
system workqueue handler.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Create a net_icmp_send_echo_request_no_wait() variant that will
not wait when allocating net_buf to be sent. This variant will avoid
a warning to be printed when sending Echo-Req from a system workqueue
because the work cannot sleep in this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If Ethernet based network device driver is advertizing
ETHERNET_EMBEDDED_LL_HEADER, then the L2 driver will can
return the proper L2 header size for the network interface.
This info is then used in TX to determine whether to have a
separate net_buf for the link level header, or to embed the
header to the same net_buf as the L2 payload.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow network device driver to configure the system so that
when a network packet is sent to it, the link layer header
is stored just before the L2 payload in the same packet.
Currently the link layer header is stored in a separate
net_buf that is linked in front of the L2 payload.
This option can typically save one net_buf when sending
a network packet. Note that if you are using variable data
size buffers (CONFIG_NET_BUF_VARIABLE_DATA_SIZE) then this
embedding is not needed because one can allocate just the
right size network buffers and not waste any memory.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If network interface goes operative down, then re-join user defined
IPv4 multicast groups that where joined earlier when the interface comes
up again. If user takes the network interface down manually (admin down),
then the user specific groups are not re-joined. This works now the same
way as IPv6 re-joining.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Extend the list of methods supported by dynamic resources with
PUT/PATCH/DELETE. The methods does not require any extra handling
from the server perspective, so the existing method handlers could be
reused.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There are currently four types of roaming, 11r roaming, 11v roaming, 11k
roaming and legacy roaming, The priority of the roaming mode is
11r-->11v-->11k-->legacy roaming. If the ap does not support 11r/11v/11k
roaming, we will use legacy roaming. legecy roaming needs to do
full channel scan, which is the same as the general scan connection
process, so the legacy roaming time will be longer.
Signed-off-by: Gaofeng Zhang <gaofeng.zhang@nxp.com>
The default exponent is 0, will cause twt setup quick failed,
set exponent value derived from twt interval to fix it.
Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
Add WIFI_SAP_IFACE_NO_IR state to keep same as hostapd_iface_state,
which is updated as the hostap upmerge.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
For CMD 'wifi ap status', removing HAPD related definition to make it
more commonly used for non-supplicant case.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Don't check 'HEAP_MEM_POOL_SIZE != 0', as HEAP_MEM_POOL_SIZE might be 0,
but HEAP_MEM_POOL_ADD_SIZE_xxx is defined, which means the actual heap
size is not zero. So check KERNEL_MEM_POOL instead.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Most users won't be interested in the per-channel rules but only in the
country code, so, add a verbose option to hiden per-channel rules which
are too verbose.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
In order to prepare for extending the options, convert to getopt long
for easier parsing of options.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This removes the deprecated CONFIG_NET_PKT_BUF_DATA_POOL_SIZE.
User should either use CONFIG_NET_PKT_BUF_RX_DATA_POOL_SIZE or
CONFIG_NET_PKT_BUF_TX_DATA_POOL_SIZE depending of net packet type.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Use CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT and
CONFIG_NET_TCP_RETRY_COUNT to control the total timeout at the TCP
level.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If a shell command does not have a sub command, then the 3rd parameter
to SHELL_SUBCMD_ADD() macro should be set to NULL so that the help
will only print information specific to that command and not all
wifi commands.
Fixes#82633
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When calling wifi_ap_disable() API specific WiFi driver implementation was
checked whether 'ap_enable' was provided, instead of 'ap_disable'. Fix
that copy-paste error.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
The asserts were not proper here, replace those by runtime
checks as the functions can be called from applications and
asserts are not meant for error checking.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add "bandwidth" parameter to "wifi ap enable" command.
Add "ht_capab" and "vht_capab" parameters to "wifi ap config" command.
Signed-off-by: Gang Li <gang.li_1@nxp.com>
Compilation errors in ptp library when using C++ compiler.
First error is due to 'class' keyword being reserved in C++
and 'class' is used as a variable name in ptp library.
Second error is due to a flexible array member in a struct
is not placed at the end.
Signed-off-by: Tomas Choat <trc@ixys.no>
The asserts always fail because the condition is inverted.
This patch fixes the condition to verify the socket
is lower than PTP_SOCKET_CNT.
Signed-off-by: Tomas Choat <trc@ixys.no>
When the offset is larger than 1 second, the time
adjustment should still be allowed to be bidirectional.
Casting the offset to an unsigned value after the
subtraction will allow the adjustment to be bidirectional.
Signed-off-by: Tomas Choat <trc@ixys.no>
When sending follow up messages, the pre send function
does not insert the correct time stamp in the message.
Issue is fixed by calling the pre send timestamp function.
Signed-off-by: Tomas Choat <trc@ixys.no>