Add "net dns service <dns-service-name>" which can resolve
service names like "_http._tcp.dns-sd.org" described in DNS-SD
RFC 6763.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If the default max. answer length of 512 bytes is not enough,
user can specify it by setting CONFIG_DNS_RESOLVER_MAX_ANSWER_SIZE
to suitable value.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We cannot use the network management event number directly as
a socket option value because the management value is uint64_t
and that cannot be mapped directly to 32 bit integer.
So have an intermediate socket option that is mapped to actual
network management request number in getsockopt() and setsockopt().
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of using 32 bit enum values for event numbers, convert
the code to use 64 bit long bit fields. This means that the
user API is changed to use 64 bit event values instead of 32
bit event values.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Fix usage of the wrong variable in insert_be16 which could cause
insertion at the wrong offset.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
SYS_PORT_TRACING_OBJ_FUNC_* are for when the function being
traced is a method of an object. Use SYS_PORT_TRACING_FUNC_* instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add argument to the TLS credential `cred buf` command that enables
a shell bypass to write the TLS credential directly to the credential
buffer.
This is useful for writing load credentials that cannot fit in a single
`cred buf` command and would otherwise have to be split into multiple
cred buf commands.
Sending multiple in succession like that from a script for example very
easily causes the shell RX buffer to get full, resulting in multiple
`RX ring buffer full.` warnings.
This is very difficult for a script to handle.
Using a bypass has much better performance and can easily avoid the
RX ring buffer full condition without increasing the RX ring buffer
to much.
It is also easier for a script to use.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
The "net conn" command printed AF_PACKET socket as AF_UNK(3).
Fix this by printing "AF_PACKET" in this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure we cleanup only those DNS servers that belong to
certain network interface when the interface goes down.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Bind the network interface to the network interface we
have received the DNS servers from. This is now the default.
The previous behavior can be restored by disabling the
CONFIG_NET_DHCPV6_DNS_SERVER_VIA_INTERFACE option.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Bind the network interface to the network interface we
have received the DNS servers from. This is now the default.
The previous behavior can be restored by disabling the
CONFIG_NET_DHCPV4_DNS_SERVER_VIA_INTERFACE option.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow user to specify which network interfaces to bind the
server to when reconfiguring the DNS system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add option in enum phy_link_speed to disable auto-negotiation.
This allows PHY drivers to support disabling auto-negotiation.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
SUBALIGN forces alignment to the specified value, even if the object
requires stricter alignment. This causes mis-aligned access when accessing
the resulting value.
Signed-off-by: Keith Packard <keithp@keithp.com>
Drop this redundant check that was likely meant to be checking that Z
field is zero but in the case of reception the RFC says it MUST be
ignored anyway.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
add timestamping on Tx to packets marked for timestamping
add timestamping on Rx to all packets for later use
fix race condidition on adding timestamp when sending delay_req
Signed-off-by: Adib Taraben <theadib@gmail.com>
According to RFC 793, the seqnum test includes 4 cases when STATE >
TCP_SYN_SENT:
Seg-len Recv-win Test
------- -------- ---------------------------------------
0 0 SEG.SEQ = RCV.NXT
0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
>0 0 not acceptable
>0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
or RCV.NXT =< SEG.SEQ+SEG.LEN-1 <RCV.NXT+RCV.WND
After the seq validation, the 'send duplicated ACK' code in FIN_WAIT1/
2/CLOSING/TIMEWAIT state processing is duplicated, so remove them.
Added TEST_CLIENT_SEQ_VALIDATION ztest case in tests/net/tcp.
Signed-off-by: Shrek Wang <inet_eman@outlook.com>
Allow network shell DNS module to verify that the DNS SD
record is a valid one. Currently this is not exposed to
applications.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
In high throughput tests it's fairly easy to overflow the current 32-bit
byte counters in net statistics (it's just over 4 GB of data).
Therefore, make the byte counters 64-bit to prevent overflows.
Rearrange some fields to avoid padding.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
net_stats_t type is an unsigned type, therefore %u should be used
instead of %d when printing values of this type, otherwise negative
values will be printer if INT32_MAX is exceeded.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
For 'wifi connect' or 'wifi ap enable' CMD, there is 'invalid option'
error log when input '-i' parameter. Parsing '-i' can fix this issue.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Add new socket offloading functions, allowing to enable/disable
offloaded DNS implementation at runtime. This may be useful if there is
a mix of offloaded/native network interfaces in the system, so the
application can choose which DNS backend to use.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add a new "if_name" pointer to the transport configuration structure,
allowing the application to bind MQTT client to a specific network
interface.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When the network interface goes down, we call
net_ipv4_autoconf_reset() which removes the autoaddress
from the network interface.
The net_ipv4_autoconf_reset() is also called when ACD is started
in which case we could see this error message
<dbg> net_if_start_acd: Starting ACD for iface 2
<err> net_if: iface 2 addr 169.254.174.230 (net_if_ipv4_addr_rm():4625)
<dbg> net_if_ipv4_addr_rm: Address 169.254.174.230 not found (-22)
This error is superfluous and not needed. So before trying to
remove the address, check if the interface already has it set and
only then remove it.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When adding IPv4 address to the network interface, there is no
need to start ACD procedure for localhost or point-to-point links.
The ACD start function would mark the IP address like 127.0.0.1 as
tentative and never make it preferred which would then cause issues
when selecting the network address for sending.
As the ACD start is also called when the network interface comes up,
add the localhost and point-to-point link check to ACD start function
so that we will avoid ACD checks in this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
remove phy related configs from eth config.
phy related configs chould go directly into the phy.
Most ethernet drivers didn't support the now removed
functions yet. Users should instead use `phy_configure_link()`
together with the `net_eth_get_phy()` function.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Add this to set link speed through net_shell.
Current zephyr version doesn't have user interface to change
speed, hence adding this to accomodate it. Full duplex will
be set by default for each link speed.
Able to change link speed using command below:
net iface set_link <iface idx> <speed> <optional:h(half)/f(full)>
eg: net iface set_link 1 100 h
net iface set_link 1 10 f
net iface set_link 1 1000
Able to set multiple link speed like below:
net iface set_link <iface idx> <speed1> <speed2> <optional:h/f>
eg: net iface set_link 1 10 100 h
net iface set_link 1 1000 f 10
Signed-off-by: Ling Pei Lee <pei.lee.ling@intel.com>
The help message for the wifi mode -s command indicates it sets
the Wi-Fi mode to station. However, the Zephyr Wi-Fi shell subsystem
was incorrectly using a get operation instead of set.
This commit corrects the behavior to properly set the Wi-Fi mode,
aligning the implementation with the help message.
Signed-off-by: Arunmani Alagarsamy <arunmani.a@silabs.com>
Soft ap supports WIFI_BTWT_AGREEMENT_MAX BTWT sessions.
The BTWT parameters for each session can be different.
The current usage can only set one set of parameters.
All sessions follow this set of parameters.
Add enhance code to support setting different
BTWT parameters for every sessions.
Usage:
wifi twt btwt_setup <sta_wait> <offset>
<twtli> <session_num>
<id0> <mantissa0> <exponent0> <nominal_wake0>
<id1> <mantissa1> <exponent1> <nominal_wake1>
<idx> <mantissax> <exponentx> <nominal_wakex>
The total number of '0, 1, ..., x' is session_num
For example:
wifi twt btwt_setup 0 0 0 2 0 112 10 128 1 32 10 64
Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
htonl() and htons() take uint32_t/uint16_t as argument. Add the 'u' suffix
to constants to ensure the correct unsigned type is used and to avoid
undefined behavior if these functions are implemented as macros using
bit shifts.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Also allow `gethostname` to be compiled in, even when the socket offloading
option is selected.
Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
Add support for skipping UDP upload server report, useful in test TX
only with loopback (packets are dropped, so, no report).
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
The send_queue was used as SYN/FIN packet retransmission. Before
the SYN/FIN being ACKed and dequeue-ed, the following packets in
the send_queue cannot be sent out. That's why Zephyr had to send
a FIN+ACK instead of a duplicated ACK-only in FINWAIT1, CLOSING.
In fact, we can take SYN/FIN as kind of data and use the same
send_data_timer for retransmission, like other OSes do. This way,
the send_queue is simply used for local traffics.
Benefits (in theory):
1. The code is easier,
2. TxPkt performance is better after skipping enq/deq send_queue,
3. The struct tcp{} node is a few bytes smaller, saving memory.
Signed-off-by: Shrek Wang <inet_eman@outlook.com>
If we're parsing a CoAP request with an observe option of '1', but there is
no matching observer, return an error instead of returning a zero.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
TCP implementation provided the parent net_context pointer to the
accept callback instead of the user_data pointer registered with
net_tcp_accept(). This worked fine with the socket integration, as
sockets explicitly registered parent context as user_data, however it
shouldn't be hardcoded like this at the TCP level.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Based on TCP Spec., the outgoing TCP packets shoud use SND.NXT as
the seqnum. In Zephyr, the conn->seq works as the SND.UNA and the
conn->seq + conn->unacked_len works as the SND.NXT. Currently, it
uses SND.UNA in tcp_out() as the seqnum, which might get dropped
as old packets and could not deliver the message to the peer.
A few exceptions use SND.NXT - 1 as the seqnum are: keepalive,
zero-window-probe, FIN/SYN retransmissions. And, for closing a
connection, Zephyr won't send out FIN until all the data has been
ACKed, so the conn->unacked_len is 0 and it is ok to use conn->seq
as the SND.NXT.
Signed-off-by: Shrek Wang <inet_eman@outlook.com>
Verify if CONFIG_NET_SOCKETS_PACKET_DGRAM is enabled when creating a
datagram packet socket. Otherwise, it's possible to create
non-functional AF_PACKET/SOCK_DGRAM socket w/o an error.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
It is possible to manually set link address length past 6 at runtime
and trying to generate IPv6 IID address that way. This should fail
as we could read two bytes past the address buffer. There is no issues
in the copying as the target buffer has plenty of space.
Coverity-CID: 516232
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Added network type check to fix the system crash caused by non-wifi
network card calling wifi api interface
Company:BSH Crop
Signed-off-by: Chen Tao <ct05342@163.com>