Commit Graph

7 Commits

Author SHA1 Message Date
Thomas Huth c7e03a58c1 net-snk: Get rid of netlib and netapps prefixes in include statements
These prefixes prevent that the files can easily be moved to another
folder, so let's use proper "-I" statements in the Makefiles instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-06-27 12:31:05 +10:00
Thomas Huth 8f8c4e6414 ipv6: Fix memory leak in set_ipv6_address() / ip6_create_ll_address()
The  set_ipv6_address() function calls ip6_create_ll_address() to
get a link-local address. The latter function uses malloc to create
a buffer for composing that address, and returns the corresponding
poniter to the caller. However, set_ipv6_address() does not free
that buffer again, so the allocated memory is lost.
Since set_ipv6_address() already allocated space for the new IPv6
address anyway, let's fix this issue by passing the buffer from
set_ipv6_address() to ip6_create_ll_address() instead, so that
ip6_create_ll_address() does not have to allocate memory at all.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-05-05 16:11:04 +10:00
Alexey Kardashevskiy f344ef9b22 net-snk: Fix gcc warnings
This replaces some local variable types and some function parameters from
signed to unsigned to fix gcc warnings.

Tested DHCP+TFTP on both IPv4 and IPv6.

The make command used to test:
make qemu WARNFLAGS=-Wextra

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-01-29 17:10:35 +11:00
Thomas Huth 9308463cfd net-snk: Move global variable definition out of the header file
The IPv6 code declares a bunch of global variables (without "extern"
keyword!) in the ipv6.h header file. This is bad style and does not
work when linking with "-fno-common" for example. So let's move
the variables to the files where they are used instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-14 11:26:07 +11:00
Thomas Huth 7dc047e600 net-snk: Fix the check for link-local addresses when receiving RAs
The code that checks whether the router advertisments contain only
a link-local address has a bug: It must check the full first 10 bits
of the address, not only the first 9 bits. Otherwise, site-local
addresses (which start with 0xFEC0...) are also recognized as
link-local, which is wrong, of course.
Fix it by also introducing a proper wrapper functions for link-local
addresses (which will be used in a later patch, too).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-14 11:25:51 +11:00
Nikunj A Dadhania 8e6f2bba50 net-snk: use socket descriptor in the network stack
With module layer cleanup, and a fixed socket() call, start using the
fd across the network stack.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:17:10 +05:30
Avik Sil aee78336b9 Add ipv6 support in net-snk
This patch adds support for booting from a IPv6 network. It gets the boot information
(tftp server, boot file name) from DHCPv6 server or can be specified manually using
obp-tftp arguments. To boot from a IPv6 network, type "boot net:ipv6" from the SLOF
prompt. To specify ipaddresses manually, type "boot net:ipv6,<si6addr>,<filename>,<ci6addr>"
from the SLOF prompt.

This patch is based on the IPv6 code written by the former SLOF team.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-17 16:22:03 +05:30