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>
The net_arp_init() was not properly declared if IPv4 was
not active.
Change-Id: I479b93f67c4536bcf9a081c36a6bc82dc5605c4c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Include stdio.h so that the snprintf() and friends are found.
Change-Id: I54935ab3921b2984dd30106e2b35b09feb5d2199
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Print statistics with INFO log level.
Change-Id: I333b81a17869398a5e982a431a73141044a50f28
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Use SYS_LOG instead of directly printing using printk()
Change-Id: I61cff11cf8424f726f24ea00b447f2f4827f2c9c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The net_core.h accidentally overwrote SYS_LOG_DOMAIN with "net".
This must be done only for network related log domain.
Change-Id: I1050e430e8b649126e527f28c61d191ff34bbf2f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Setting NET_DEBUG in nbuf.h will confuse the net_core.h
so it should not be done here. The NET_DEBUG can only be
set in .c file.
Change-Id: Ia95996147bf119c4ddf9f45a9fd635f8d2b405cb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Easier to see buffer leaks using this variant.
Change-Id: Ibdc8d73133cab4822451104fcd5742e4f1e20e42
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
There is no need to check if the sub-system is initialized
because net_init() is the only place that will call these
functions.
Change-Id: Icd54d2adf2924431cedd7c47124a3410842aeca3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If the net_if_send_data() returns NET_DROP then we must handle
that separately as the net_send_data() should return 0 if
everything went ok and <0 if there was an error in which case
the caller should unref the net_buf.
Change-Id: Ibf97aba65641463248e1616a09d050e8a95a0fa6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The network L2 recv handler needs to set the initial value for
IP protocol type (IPv4 or IPv6). Otherwise the recv data check
in net_core.c:process_data() will not work properly if IPv4
is enabled.
Change-Id: I5684cd10e5d79e13a977406729ea68313e689c9b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This is the framework that neighbor discovery uses. The ND
is coming in later commits.
Change-Id: Iaaa67c80c0b6b8a3adb9217413b906e0a22d3920
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Various utilities for IPv6 address manipulation in network
interface.
Change-Id: I270f0935288abd77d64c0f64f56b549fb6c4feb9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The IPv4 comparer was a macro but making it now a inline
function.
Change-Id: I315c52d812996e352e9b392627296ba229530ae0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Adding a variant for net_linkaddr that can actually store
a link layer address. The normal net_linkaddr struct just
uses pointer to a ll address. The storage version is used
when we have a lladdr cache for neighbors.
Change-Id: I57421047f66090caf09595981c81d386144edce3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Print more debugging information about available DATA buffers
when allocating and de-allocating a net_buf.
Change-Id: Id4aa4c46b5dc70e683029ccc525abed5b6cfbefb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The network stack initialization will need to make sure
that RX side is ready before TX side is started. So in
order to do that the TX init is called from RX fiber.
This is needed so that we can start to send network packets
already during the net_init(), like IPv6 neighbor solicitation
messages during duplicate address detection process.
Change-Id: I12fde3d388d9aab41daa93b1edc02f25b8c5511d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The helper macro NET_ARP_BUF() needs to be used from other
files so arp.h is proper place for it.
Change-Id: Ief7bbb385d9c180213ecd7cb08023f13999f5270
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It is then clear what logic to expect once such verdict has been given.
Change-Id: Id64ff00e65ffe2dad45673d1eca4eb76ae3ae1f6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Instead of runtime checks, let's use NET_ASSERT() to verify that net if
API is properly set.
Change-Id: I8e5c769b8383aa9aec5a5e9600c07e05ca96d517
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
As there is a L2 in the middle, there is no need for
net_if to provide such information.
Change-Id: I58a35d4d124cd8a67026f32e71713ef06f43b7c5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
ARP and its related Kconfig options now belong to l2.
Change-Id: Ie21ed3cc39a7c7c76d823587ec33fdd22b439fcd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Net core then does not know anything about l2 related logic.
For instance ARP is used in ethernet l2 API and nowhere else.
This will be helpful when adding different technologies altogether.
Currently, only SLIP driver is enabled to use relevant l2 layer.
Change-Id: I03c93326321028d04222733ca4083e3c6b785202
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
net_core.h is the ground brick of the IP stack, and thus should not
include other headers that might include net_core.h also: this would
create circular dependencies.
Change-Id: I70c17b736788528e4e0b4b5b2c478098b049c9b1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Makes code cleaner so it won't be necessary to access the net_if
internal queue directly.
Change-Id: I119a54e0639843093fa0da6f11e590e8990525d8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2 warnings happens when CONFIG_SLIP_DEBUG is set, thus fixing it.
Change-Id: I032d7481942e86911764da35cdd6f7b8e05cdeaa
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This is meant to stay in 80 chars line length limit.
Change-Id: Ib3b3b1cf5e05fec2407e470ae3600ff5a4c6a505
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Up to the core to initialize what's required to get all things working.
Introducing a NET_ARP configuration option, in future this one will be
set if only some hardware requires it along IPv4.
In order to differentiate ARP and actualy hardware drivers supporting
ethernet frames, adding a NET_ETHERNET config option. Which option, if
enabled along NET_SLIP, will be used later on to fully simulate ethernet
over slip TAP driver. Such option will also be used to unlock ethernet
hardware devices in drivers in future.
Change-Id: I10ed151b96256ea3f265c3926bf9a35e49692e1e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
__packed is an alias for __attribute__(packed) and is declared in
toochain's headers.
Change-Id: Ib9d136a1a2dd401194988d6573bf7778f07dbfb6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
No need to recreate an convenient context wise wrapper since one already
exists.
Change-Id: Ie1bfc0e203281485acb36e0e844b2bad384c2af6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This allows to test things between qemu and host when
using slip.
Change-Id: I27e17de9f0d8c2c8406f0afdd66c295e827f87a0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Catch ARP messages when processing incoming messages and call
ARP input for parsing.
Change-Id: I88ea4699dfb8e7e35d3cecbce32d50aa485c307c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>