Instead of swapping the ll address set the source and
destination addresses if they are not set.
Change-Id: Icdded06df2edb27f71894e29e9bc22a8f0313fae
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The IPv6 and ll address of the neighbor was not properly updated
and set in the neighbor cache. Symptoms were that packets were
discarded even thou the cache contained proper ll address.
Change-Id: I2acfb1b03d2eb69eddcf7ad5e25e8a7ce2ce3bb5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The L2 layer sender should actually set the link layer addresses
properly.
Change-Id: I9dd2f9ca269384dff0bef12e570317173f6a5f02
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Initial value for nbuf variables need to be set as they
might contain garbage from previous allocation.
Change-Id: I1d16e72387dbda86355ac01aabc1ba617bba0d50
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The packet sending function returns either NET_OK or NET_DROP
instead of <0 value. Make sure we check the value correctly.
Change-Id: Iab5b5c07ca548e9c2ccb31542a7633ecc0de2bc9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The send callback in net_context is called after packet has been
successfully sent or dropped. The callback is not called if the
packet is pending and waiting for example IPv6 ND to finish.
Change-Id: I28e77c6333974705a0e31862bb913eedace0b3f9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The send callback should be called after the packet has been
sent so setup things allowing that.
Change-Id: Icb82f9896667dcb1e400376c0fca6df380509090
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The token is used by net_context.c when sending packet. User
can set the token and get it back when data has been sent.
This can be used to know what specific packet was sent if
there are multiple packets going at the same time.
Change-Id: Iaaf730faaa55a712ae22d903e612e44deb683b8f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Additional checks to make sure the received IPv6 neighbor
solicitation, neighbor advertisement and router advertisement
messages are not corrupted.
Change-Id: Ic34a92eaac14dc9e2e6ed305fc7b2b6dcab9c29c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
In order to be consistent with naming, this commit renames
ip_protocol enum that is found in net_ip.h to net_ip_protocol.
Change-Id: Ie6caf059279b819794a13494468de789450e2bd8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Echo-server no longer reverses the data as doing it
when we have a fragment chain is quite challenging.
Change-Id: I298669f3ddba67000672320e7b3b14f72e9f12d4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Invalid values were used when filling reserve, context and
network interface in nbuf private data area.
Change-Id: Id063fa3a415cd281d50148c10e7b838d56878894
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We must use the link layer header length derived from the
actual interface when sending IPv6 neighbor solicitation msg.
Change-Id: I1836743ffed50254c89341fbdade039741e62f33
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we do not know link layer address when sending ethernet frame,
then initiate IPv6 neighbor discovery process.
Change-Id: Id9c55646895a12ea3693cdca330e730bc80d83dc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Resolve the ll address so that IPv6 packet can be sent.
This means that the IPv6 neighbor discovery needs to be done.
The original packet will be sent after neighbor advertisement
is received.
Change-Id: If54cdbd1468ca802f59e206996ea3addab16d5b8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Pending variable needs to be init so that we do not use
some old value when cache entry is reused.
Change-Id: Id6af61981d4fc7628992b4a018d84a4e5c8a16f6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The IP address was not printed properly when registering a handler.
Change-Id: Iadb02997a43f1440932d224e0113b6f45c4f0aed
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
No need to partition the data if MTU is large enough and
data can be sent in one frame.
Change-Id: I8ba0f5030ed1e2c1341c7e2dd409ba636b1a9a4c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When allocating net_buf via a net_context, set the network
interface and protocol family to net_nbuf.
Change-Id: I0df876e0c8ba66bac42f3aa7fd17c5bf9a935985
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The sending functions net_context_send() and net_context_sendto()
will need to send data.
Change-Id: I5372cb9dede2a996276c30241f28689c4f902dff
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This API provides similar kind of functionality as BSD socket
API. This API does not provide BSD socket API.
Change-Id: I537d0ad2a5213f1d1e11fa7891dd4f4d0f3cc4bb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The earlier default 1 was too low, a more usable 2 is now
the default. User can set the limit to 1 if needed.
Change-Id: Ib30a1ceb95c42f69197298f672daaeab6b41890b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When a UDP packet has been received and if a watcher match
is found, then a callback is called. It is useful to have
a pointer to net_conn when calling the callback.
Change-Id: Ifa97b37c22b1fc9cac7eadfba23aa68dfd473fda
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the net_conn needs port information, use struct sockaddr
internally as it has the port numbers built in.
Change-Id: Idb1c87afa956dfe55dc8d533d867fa7845545b12
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
These are need in future commits. The sockaddr struct will hold
the IP address and port number among other things.
Change-Id: I0971c39f0f1cb019aa8610977a245e24548c56ee
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As we send the same network buffers back to sender, then
we need to also swap link layer addresses otherwise the packets
will be discarded by the sender.
Change-Id: I08b083d567bf5f45fd25d8a30fefa5330e12c35e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Creating a dummy macro that is used when debugging is disabled.
Change-Id: I8171463451ef428f1f06fa845d7af6b78c7c5910
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Changing the IP address type to const as the functions do not
modify the IP address.
Change-Id: I176d84af5f05843226a954f91b6bb3bba6596863
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Network interface multicast address was missing information
about the protocol family.
Change-Id: I8d7b0514ec351efddb6997965c940f62fc08a37a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
No need to print debug prints if debugging is not activated.
Change-Id: I42a6453b4f3e11106119561b580ebea41e56452d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Using network interface index instead of net_if pointer can
save 3 bytes of memory. So these utilities help to convert
pointer to index and vice versa.
Change-Id: I8743a06e0935d48798b19526154058be385550af
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When checking the IP address from network interface, return
also the used network interface.
Change-Id: If7b8385193da4cb1b469f697e219cfae3b6477dd
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We do not need any header files from legacy IP stack.
Change-Id: I0c78fe500bec37593e66e8a237a3f92b79cbaf85
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
IPv4/6 functions follows this scheme: net_if_ipv<4/6>_<name>.
Applying that to net_if_set_gw/net_if_set_netmask which are IPv4
functions.
Change-Id: I2dcbb16ce81cfdffbfbb5cae24ad76ddf2b9919a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Reducing the amount of #if defined(CONFIG_NET_IPV<4/6>) for a clearer
code and to lower compiler's stress.
Change-Id: Iffbfbda4409c6cbf48a3057ea1b9e43309cd84e7
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
IPv6 packets with UDP header are compressed and decompressed
as per RFC 6282 (IPHC). Context based compression not implemented.
Change-Id: I8020da26b8d40fdc80e75cba56ef28a01a36159e
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Utility verifies given address is based on link layer address
or not.
Change-Id: I2b89e498fa2481051ec9a47ada8b4a5e8e38ad7a
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
If the link layer address is short address, create interface ID based on
short address.
Change-Id: I49e150cc20a0bf973880d27f418762f68f2d9139
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
While reusing buffers and passing those parameters might have
already some garbage. So just clear first and create iid.
Change-Id: I5774de157e0c39e7e7b1313a598557c58a4c63b0
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>