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>
If the machine is heavily loaded with network data, it is
a good idea to let the other fibers to run after each packet
received or sent. Otherwise the system might overflow the
kserver command stack due to e.g. unprocessed tick events
there.
Change-Id: I5edef2459195d3d9cfcfc38b99c54c66d17334b6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the broadcast address is needed in both arp.c and ethernet.c
it is useful to create a utility function for returning that.
Change-Id: I26e75e325f7ee6dcd703a92b3349bd8d388e157e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Because of commit 7720f6ed1c ("net: buf: Introduce support
for fragmentation") the net_buf should be placed into queue by
calling net_buf_put() when using fragmented data.
Change-Id: I5c3dae92596e9cb0d0ba166bc3de2da9f4fc24b7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Because these are not used in dummy driver, just clear the
values so that upper IP stack will not use them.
Change-Id: I8f2919191cfefe54c47eea3f2b8e6e343e7844e2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Caller can figure out what is the link layer header size
for a given link layer. There is a callback that can return
a dynamic header size if needed.
Change-Id: I59ea2319eb6cb53a0ba5c6aa9e7eecc4b38c94d3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The code was using NET_DBG() which is not really available
for the slip/tap driver.
Change-Id: I64cedd5fbfb54fdb80d606cf3199312c8871246f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We need to set the ethernet source and destination addresses
correctly when sending packet.
Change-Id: Ica1e3fac6299612f0ad1baea7da79143e8944d15
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Set the proper next protocol type when sending ethernet frame.
Change-Id: Ie042b3fab0741c9ca51453b0b0ecf6189adf2fe7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When packet is received, we set the pointers to ethernet
source and destination addresses.
Change-Id: Ia8795849d8be30e8230e27b1a8d95dd7f334427a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We need to know where the L2 protocol source and destination
addresses are so save that information in nbuf.
Change-Id: I08677a0421effb0c997c6a68cfc02ccfa67e7e1e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add helper to check Ethernet broadcast and multicast address.
Change-Id: Icfe5508a4d3ab2364209a50150a4f8fe239ebc93
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we have a pending ARP request and a new request needs to be
send, try to re-send it instead of giving up.
Change-Id: I47a3978fd9c595a419df9485ea35be4d417f987a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of calling net_buf_get() with reserve_head > 0, we now
call it with reserve_head = 0. The reason for this is that the
reserve space is not meant for protocol data. So instead the
ll header space is allocated using net_buf_add() followed by
net_buf_pull() which will have the same effect and set the
buf->data pointer to point to start of the L3 layer.
Change-Id: Ia07c599e4d5aa95262f30605861f6a0a92b36d71
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The IP and ll address are now declared const. This will
avoid warnings and is anyway right thing to do.
Change-Id: Ieb2aa4ae89f158dddd6a4a1f5fe5e3b253002be8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>