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>
Ensure encoding of options with large deltas works as expected by using
an "experimental" option 65100.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
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>
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>
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>
Add test case verifying that offloaded DNS APIs are called as expected
and that enabling/disabling DNS offloading at runtime works.
Signed-off-by: Robert Lubos <robert.lubos@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>
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>
Fix issues reported by string validation which was added to strings
used in zassert macros.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Test case `test_set_bulk` and `test_get_set` test the LwM2m getter and
setter function by
- init a buffer with some value
- calling lwm2m_set_... with buffer as parameter
- calling lwm2_get_... by letting `get` write-back into the same
buffer(!)
- compare the buffer with the init value
That implementation can't recognize a no-operation getter function.
This change adds some C macro magic for both test cases where
an `out` buffer for setter and an `in` buffer for getter functions
exists. The buffers are checked before use for inequality to avoid
any unexpected pass.
Signed-off-by: Stefan Schwendeler <Stefan.Schwendeler@husqvarnagroup.com>
Extract server configuration, client configuration and test shutdown
into separate functions so that they're reusable in other tests.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
According to RFC793 chapter3.5 with the 'Reset Processing' part,
"In the SYN-SENT state (a RST received in response to an initial
SYN), the RST is acceptable if the ACK field acknowledges the SYN."
So, in the net_tcp_reply_rst() we should use 'ack++' if no ACK
flag but have SYN flag.
And, all the RST packet should use net_tcp_reply_rst() instead of
tcp_out().
Signed-off-by: Shrek Wang <inet_eman@outlook.com>
Currently, creating and killing openssl process was part of the test. In
result, if the test case failed for whatever reason, the openssl process
would remain open, causing disruptions in consecutive test executions.
Fix that by defining openssl server instance as a pytest fixture. That
way, openssl process will be terminated regardless of the test
result.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Turn the MBEDTLS_RSA_FULL selects into depends on.
This is how the other MBEDTLS_KEY_EXCHANGE_* Kconfig options are defined.
This is done to avoid circular dependencies.
At the same time update uses of the affected MBEDTLS_KEY_EXCHANGE_*
Kconfig options to enable/disable the dependencies which used to be
automatically handled.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Add netif dependency for the test suite, as in other networking tests
and adjust minimal RAM and FLASH values.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
According to RFC 2131 Request message Exchange ID should be the same as
the one received in the Offer message from the server. Modify test to
verify that.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add Pad option to the DHCP packets generated by the fake server, to
verify the client processes them correctly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
According to TCP Spec. RFC793, ACK flag should be always set
after sequences of both sides are sync-ed except for RST seg-
ment. It is not necessary to send FIN only packet in the
test case, using FIN | ACK instead.
Similarly, change the tcp_out(conn, FIN | ACK) in CLOSE_WAIT.
Signed-off-by: Shrek Wang <inet_eman@outlook.com>
In case the receiving packet socket is not bound to any specific
interface, or is explicitly bound to "any" interface (at index 0),
it should collect packets from all interfaces. Add test cases which
verify that.
Also, if a packet socket is bound to a specific interface, it should not
receive packets from others. Add a test case to verify that as well.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The recvfrom test case for DGRAM packet socket specified wrong socket
type, so RAW sockets were tested twice instead. Also, for the DGRAM
variant, the offset was not taken into account for the expected packet
length.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Test the case where the packet provided to `net_arp_prepare` is queued
for later transmission, instead of being replaced with an ARP query
or having ARP information populated.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Update `net_arp_prepare` to return a return code instead of a pointer,
so that the various results of the function can be differentiated.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Add more tests cases to the AF_PACKET sockets test suite, covering the
summary of the packet socket functionalities prepared from various
sources (mostly man pages).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The test case did not do what it said, it was supposed to receive data
on both RAW and DGRAM packet sockets, but instead it received on RAW
socket twice.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Test interface configuration doesn't change throught the test suite
execution, therefore there's no need to reiterate the interfaces to set
the interface pointers in each test case. Do it just once, when test
suite is setup.
Also remove the __test_packet_sockets() function which seemed no longer
useful with all those simplifications.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Packet socket tests used non-blocking sockets so in results the test
code was overly complicated with delays and loops scattered all across
the test code, making it difficult to read.
As packet sockets do support blocking operation with timeout,
reconfigure the sockets to use that and simplify the test code by
getting rid of unnecessary loops and delays.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Test suite prints a warning on boot about not enough IPv4 context
instances compared to the number of interfaces, therefore adjust the
config value to get rid of it.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make sure all sockets used in test are closed even in case of test
failure. Otherwise, a single test failure could derail other tests,
making the results obfuscated.
Remove redundant code related to socket creation.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When only changes are in the "hostap" module the wifi build tests should
be run. Add the module tag to fix that.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>