Using macros does not let the compiler verifying about the type we are
providing, which usually give an error easier to understand.
Also, this will let the compiler deciding how to actually optimize
(inline or not) the code.
Change-Id: Iba49590b620ef0a1bd0ed5621453524fcfea747c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This make sure we will found all relevant headers in the right location.
Change-Id: I37fe978ed2af09d921c48df6986a8df9041ddc3f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
NET_BUF might be used alone. Also Bluetooth does not necessarily needs
an IP stack to run. Changing titles names for better understanding.
Change-Id: Iabfd7bf0689e79d27cc7897856a528f0dc5740f7
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
net_context.h is missing and one variable had a wrong name.
Change-Id: I4aac2f5c12cea39553fb86d1bd497c88f0ef1963
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Without these, test case will fail miserably.
Change-Id: Ib46d167b8782c33362ac6edb9d8c50abc25908c0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Debug function that will print individual fragments and their sizes.
Change-Id: I84ce144230fb099bb44ed383075564ebf377998f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Disable IPv6 DAD and ND for IP address test as there is
no need to do neighbor discovery in the test. We also
would like to see network interface debugging and use
dummy L2 driver instead of ethernet one.
Change-Id: Ia9f218c8d4c13afa1482302691d2ef72af4a7b13
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The driver_api pointer was set to NULL and send() pointer
was missing which caused a crash in TX fiber.
Change-Id: I7204c975691476dd9ab2c61bfd11b7664343e47c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The earlier Kconfig entries for IPv6 DAD and ND were confusing.
This commit will clarify this so DAD is activated by
CONFIG_NET_IPV6_DAD and ND is activated by CONFIG_NET_IPV6_ND.
These are settings are enabled by default.
Change-Id: If6245e3425489bc454a0d75113770c4f797a4017
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
ARP is IPv4 only so no need to have IPv6 functionality.
Change-Id: Ie70242f5763ba4945c311898643414851f7e8660
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
These tests will verify that we can successfully insert
some space in front of the net_buf fragment chain.
Change-Id: Idf52ed56c52d66268783fb4fecd44b70fc852734
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Provide an utility function that pushes data down in the fragment
chain which means that there would be some free space before the
first fragment.
Change-Id: I491ac4e8cbf633f86f2351cad48d683e829bda63
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Provide a function that checks if there is any free space
in the individual fragment and remove such slack. If there
are fragments that would become empty, then those fragments
are removed from the fragment list and freed to the fragment
pool.
Change-Id: Ieb1c953a1458622c4552c23ef38e330873cd27c3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The driver_api pointer was set to NULL which will cause
a crash in TX fiber.
Change-Id: If1c9a1e44904970f3a0019741eaaad4bf62d2c73
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Catch UDP network traffic and call the corresponding handler when
UDP network packet is received. If there is no handler for such
a traffic then ICMP error message is sent to network peer.
Change-Id: I71721deb9ca0f8d3bdb00db43e5555e5b96ae2d2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Create a handler for catching UDP network traffic. This commit
is only providing infrastructure for UDP management.
Change-Id: Ia6f8de62773a85f7b637b73bfe3c89197cc2abb1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The connection handling will provide an API where caller can
register a callback which is called when desired UDP or TCP
network packet is received.
Change-Id: I9a80e8b30e92c4f2e9238ff58c24ac4648aad8ea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Provide an API to send ICMPv4 error message. This can be used
for example in UDP and TCP to inform peer that there is no one
listening a certain port.
Change-Id: I915139be402892a9148e28f9c0883f7da8eb5b80
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Provide an API to send ICMPv6 error message. This can be used
for example in UDP and TCP to inform peer that there is no one
listening a certain port.
Change-Id: Ied682901f7fc406ba383293cb7c338ea21114b0d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Added define for minimum IPv6 MTU value (1280 bytes)
Change-Id: Ia81d8b3df079a2bb9bfb0a05e297d94423ba0fc5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Changed the net_is_ipv6_addr_unspecified() and
net_is_ipv6_addr_solicited_node() to use const IPv6 address
as those function do not change the address.
Change-Id: I1222bf946c371433a8468fa71054b93346e2ae4e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
User can set the initial value for time-to-live option in Kconfig.
The TTL option is only used in IPv4.
Change-Id: I57677e65a2adee4aa4dc16d1504f848d1218c6c1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The tests will make sure net_nbuf_copy() works as expected.
Change-Id: I48dc3b794c70ec4d6436feb76508952c88bbf09b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This function will copy desired amount of bytes from one
fragment list to another. Caller can specify amount of
bytes reserved in front of the new fragment list.
Change-Id: Ie3344b285a47c79f116fbcff500d383a99d28bf9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This helps also to split uIP and native stacks properly.
Next thing that should be done will be to isolate debug
options for native stack out of uIP tree.
Change-Id: I4ff856b5a4bb57f3773e1852f84f658baf26858f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
It is possible to turn of IPv6 neighbor discovery if it is
not used in order to save some memory.
Change-Id: I20159dd452b7bac6962532a91e844c33f3da2dfb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If the MTU is bigger than fragment size, we must leave the
fragment link layer header empty so that the received data
count does not get wrong.
Change-Id: I0ed562f39bfbfb559885baa6d774c0383b2228b2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
There is no harm for doing so but debug prints will look
weird in this case.
Change-Id: I48b6953d07a58bc952fe961cf1db846740dadc50
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We should start to send data only after network device
drivers are up and running.
Change-Id: I03a2fa21d1bed4badb521f2041e4642111efc078
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
There will be a crash if network device sends data to network
stack before it is ready to receive such data.
Change-Id: I1a32485faba2972909262c4305fb465b6cb87f07
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If ethernet destination address is not set, then check if
IPv6 packet is multicast one and set the ethernet destination
address using multicast MAC address prefix.
Change-Id: Iade43e9ebcd0939346d89422f74ee547d6908866
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The ARP unit test is not able to pass packets between fiber
and task. Because of this the test is run from fiber.
Change-Id: I1825a0abdc1b04a78de76d58425f4d2a2ce26ab7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The ARP packet header contained ethernet header. This is very
confusing so separate the link layer header. Fixed also the
unit tests to run properly.
Change-Id: I8b00bde280ad9f49494766370acb2a8e9cade033
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It is possible that net_buf_get() will return NULL
as the allocator can be called in ISR context.
In this case we much return and not overwrite kernel
memory.
Change-Id: Id2fdcad2ef0878d93c5364ffb81cd6a0932d908e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We need to build the ethernet header when sending data
fragments so that this does not need to be done in
ethernet device driver.
Change-Id: I0347b1abf0c124978fae3fa4b80bb4ee0d544e41
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>