aboutsummaryrefslogtreecommitdiff
path: root/clients
AgeCommit message (Collapse)AuthorFilesLines
2023-03-28Fix typos in the clients folderThomas Huth8-11/+11
Found with the "codespell" utility Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2021-10-06Silence some trivial compiler warning in the js2x codeThomas Huth2-2/+2
We enabled additional compiler warnings in commit 26d8ba170355c9, but so far we did not address the additional warnings in the js2x code yet. This patch fixes at least some of the trivial warnings there. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-17Do not link libnet to net-snk anymore, and remove net-snk from board-qemuThomas Huth3-3/+2
Since libnet is now linked to Paflof directly, we do not have to link it into net-snk anymore. So for board-qemu, we can now even exclude net-snk completely from the build (for board-js2x, it is still required for the biosemu, so we can not erase the net-snk folder completely yet). Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-17Add a Forth-to-C wrapper for the ping command, tooThomas Huth1-2/+0
Now that we link libnet to Paflof, we can call the ping function there directly instead of using the one from net-snk. We add a similar Forth-to-C wrapper like it has already been done for netboot() - simplification and clean-up will be done in a later patch once we do not link against net-snk anymore. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-17Link libnet code to Paflof and add a wrapper for netboot()Thomas Huth1-2/+0
Now that all necessary functions are provided by Paflof, too, we can finally link the libnet code to this binary. To be able to call the netboot() function from the Forth code now, we also add a wrapper that takes the parameter string from the obp-tftp package and converts it to an argv array that is expected by the netboot() function. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14paflof: Add socket(), send() and recv() functions to paflofThomas Huth1-53/+0
Code is slightly based on the implementation from net-snk, but has been adapted to use the forth_eval() and forth_push/pop() macros instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-06-27net: Move also files from clients/net-snk/app/netapps/ to lib/libnet/Thomas Huth8-1336/+1
These files should go into libnet, too, so we can later link them to paflof instead of net-snk. Note: A "make distclean" is required after applying this patch to make sure that the dependencies for the moved files are properly re-generated. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-06-27net: Move files from clients/net-snk/app/netlib/ to lib/libnet/Thomas Huth27-6125/+4
When we want to link the network stack to other parts of the firmware later (paflof), we've got to turn it into a proper library first. Note: Make sure to run "make distclean" after this patch, so that the dependencies for the moved files get rebuilt properly. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-06-27net-snk: Get rid of netlib and netapps prefixes in include statementsThomas Huth17-44/+44
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-05-05ipv6: Replace magic number 1500 with ETH_MTU_SIZE (i.e. 1518)Thomas Huth2-3/+2
The whole ethernet frame can be up to 1518 bytes including the ethernet header. So this value should be used instead of 1500 when the whole ethernet packet is affected. Since we've already got a nice define for this value, use ETH_MTU_SIZE where it is appropriate. This patch also removes a "memset(n->eth_frame, 0, 1500)" in send_ipv6() to get rid of the magic value 1500 there -- it can be removed since the whole ethernet packet is filled into the buffer right after the memset, so there are no gaps that should be cleared first. 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-05ipv6: Fix NULL pointer dereference in ip6addr_add()Thomas Huth1-1/+2
When ip6addr_add() is called for the first time, both the first_ip6 and the last_ip6 pointer are not initialized yet, i.e. contain NULL. So writing to "last_ip6->next" is a bad idea here. Fix it so that this value is only written when the function is not called for the first time. 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-05ipv6: Fix memory leak in set_ipv6_address() / ip6_create_ll_address()Thomas Huth2-14/+6
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-05ipv6: Clear memory after malloc if necessaryThomas Huth2-3/+12
The IPv6 code uses malloc in a couple of places to allocate the memory for a struct. But it does not properly initializes all members of the struct after the allocation, so the uninitialized members might contain random data. So we should better clear the whole memory for those structs to make sure we do not run into some hard-to-reproduce random problems later. Reported-by: Andrew Jones <drjones@redhat.com> 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-05ipv6: Fix possible NULL-pointer dereference in send_ipv6()Thomas Huth1-16/+16
The "struct neighbor *n" pointer in send_ipv6() can be NULL, e.g. when we're sending to multicast addresses or to a server that sits behind a router (since we do not have an entry in the neighbor cache in this case). However, the final code in send_ipv6() is always using n->eth_frame to assemble the ethernet packet, and thus silently writes the data into the low memory (which happens unnoticed because SLOF does not use the MMU for memory protection). This issue is now fixed by using a separate buffer for assembling those ethernet packets instead. The block for using the router's MAC address is also moved out of the block that is supposed to handle the unicast transfers, so that we do not accidentially end up in the neighbour solicitation code here (which also relies on n != NULL). Reported-by: Andrew Jones <drjones@redhat.com> 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-05ping: use gateway address for routingNikunj A Dadhania1-0/+2
ping was failing for machine across the subnet with statically assinged IP address. The parsed gateway address was ignored in the stack because the router variable was not set. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-05-05ping: add netmask in the ping argumentNikunj A Dadhania5-6/+82
The current ping command does not take netmask as argument, updated the ping command to take "client-ip/nn" format ip address. Add routine to return netmask(class based), when not provided by user. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-05-02loaders: Remove netflash commandThomas Huth1-1/+0
The old netflash code is not available in the net-snk anymore, so it does not make sense to keep the Forth wrapper around. Anyway, "update-flash -f net:..." can be used nowadays instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-04-12ipv6: Indent code with tabs, not with spacesThomas Huth4-16/+14
Some parts of the IPv6 code are still indented with spaces. Let's use tabs instead as mandated by the SLOF coding conventions. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-04-12ipv6: send_ipv6() has to return after doing NDPThomas Huth2-3/+8
The send_ipv6() function should return after doing NDP, since either the queued packet got send out during handle_na() already, or it has been stored to be sent out later (once the neighbor advertisment has been received). If we don't return here, the code runs into the final send_ether() here later, which then sends out the packet a second time. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-04-12ipv6: Do not use unitialized MAC address arrayThomas Huth1-4/+4
The code in send_ipv6() currently basically looks like this: uint8_t *mac_addr, mac[6]; mac_addr = mac; ... n = find_neighbor (&ip_dst); if (ip6_is_multicast (&ip_dst)) { mac_addr = ip6_to_multicast_mac (&ip_dst, mac); } else { // Check if the MAC address is already cached if (n) { if (memcmp(n->mac, null_mac, ETH_ALEN) != 0) memcpy (mac_addr, &(n->mac), ETH_ALEN); /* XXX */ } ... } ... fill_ethhdr (n->eth_frame, htons(ETHERTYPE_IPv6), get_mac_address(), mac_addr); That means mac_addr initially points to the uninitialized mac[6] array on the stack. Now if there was already an entry in the neighbor cache, but the MAC address has not been determined yet, that uninitialized array could be used as final MAC address for fill_ethhdr() (since there is no "else" path at the spot marked with XXX above), resulting in random data in the MAC address field of the ethernet packet. Let's fix this issue by letting mac_addr point to the null_mac by default instead, so that it never points to invalid data. Also rename mac[6] to mc_mac[6] to make it clear that this array is only used for storing the multicast mac address. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-04-12ipv6: Add support for sending packets through a routerThomas Huth3-0/+41
The network boot over IPv6 currently fails if the TFTP server is not in the same subnet as the SLOF client. In that case we have to fill in the MAC address of a router into our packets to get them to the right place. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-11dhcp: fix warning messages when calling strtoip()Nikunj A Dadhania4-12/+12
With the removal of dupicate strtoip in patch "dhcp: Remove duplicated strtoip()" (commit 896e31da2cc260bf5311a89b63683def20329c5b), we get following warnings messages: dhcp.c: In function ‘dhcpv4’: dhcp.c:215:16: warning: pointer targets in passing argument 1 of ‘strtoip’ differ in signedness [-Wpointer-sign] if (!strtoip(dhcp_tftp_name, (uint8_t *)&dhcp_tftp_ip)) { ^ In file included from dhcp.c:51:0: ../netapps/args.h:20:5: note: expected ‘const char *’ but argument is of type ‘int8_t * {aka signed char *}’ int strtoip(const char *, char[4]); ^ dhcp.c:215:32: warning: pointer targets in passing argument 2 of ‘strtoip’ differ in signedness [-Wpointer-sign] if (!strtoip(dhcp_tftp_name, (uint8_t *)&dhcp_tftp_ip)) { ^ In file included from dhcp.c:51:0: ../netapps/args.h:20:5: note: expected ‘char *’ but argument is of type ‘uint8_t * {aka unsigned char *}’ int strtoip(const char *, char[4]); ^ There were unnecessary typecasts which could be removed by declaring dhcp_tftp_name and dhcp_filename. Along with this, change the dns_get_ip signature as well to reduce typecast. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-29dhcp: Remove duplicated strtoip()Alexey Kardashevskiy1-48/+2
There is another implementation in netapps/args.c which is used by netboot.c and ping.c so switch to it. Suggested-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-01-29ethernet: Fix gcc warningsAlexey Kardashevskiy1-1/+4
This fixes gcc warnings but unlike other places, this does not change the type of bytes_received as recv() may return a negative value; instead this adds: 1) casting to size_t when comparing the size; 2) an additional check for a negative value returned from recv(). 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-29net-snk: Fix gcc warningsAlexey Kardashevskiy7-12/+12
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-29net-snk: Fix coding styleAlexey Kardashevskiy8-262/+194
This restyles function prototypes: - return types on the same line; - opening brace is on the next line. VIM configs used for this was: set noexpandtab set tabstop=8 set shiftwidth=4 set cino=:0,(0 This replaces [><]* with "*" as >< are also used to resolve merge conflicts. This removes trailing spaces. This removes some redundant braces. This should cause no behavioural change. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-01-18net-snk: Fix memory leak in dhcp6_process_options()Thomas Huth2-16/+2
The dhcp6_process_options() function allocates a struct dhcp6_received_options each time it is called - but that struct never gets used - and especially is also never freed again. Fix this memory leak by simply removing the unused code. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-18net-snk: Fix memory leak in ip6_to_multicast_mac() / send_ipv6()Thomas Huth1-8/+3
ip6_to_multicast_mac() uses a malloc to allocate a 6 bytes buffer for the MAC address - which never gets freed again! That means we're leaking memory for every multicast IPv6 packet that gets send out. Fix it by simply using the "uint8_t mac[6]" array from send_ipv6() instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-18net-snk: Remove bad NEIGHBOUR_SOLICITATION code in send_ipv6()Thomas Huth1-9/+1
The code that checks for NEIGHBOUR_SOLICITATION packets is bad in two ways: First, it does not check that the packet is really an ICMPv6 packet, so it could accidentially be triggered for UDP or TCP packets, too. Second, the fill_ethhdr() is redundant (since it is done at the end of the function again) and also wrong (it uses the wrong buffer pointer to fill in the ethernet header). All we really need here is to get the right MAC address via ip6_to_multicast_mac() - and this is handled in the following if-statement already (NEIGHBOUR_SOLICITATIONs are always sent as multicast in the send_neighbour_solicitation() function), so the bad code block can simply be removed to fix the two issues. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-14net-snk: Allow stateless autoconfig IPv6 addresses with IP_INIT_IPV6_MANUALThomas Huth1-4/+11
When manually specifying the TFTP server address and boot file name in IPv6 mode, we can still get the client IPv6 address via link-local or stateless IPv6 address autoconfiguration. So the netboot should not abort if just the client IPv6 address has not been specified yet. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-14net-snk: Simplify the ip6_is_multicast() functionThomas Huth1-2/+1
Using a memcpy to just compare one byte looks very cumbersome. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-14net-snk: Move global variable definition out of the header fileThomas Huth6-33/+38
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-14net-snk: Prefer non-link-local unicast IPv6 addresses if possibleThomas Huth1-0/+16
When the IPv6 code is told to create IPv6 addresses automatically (by passing NULL as parameter to set_ipv6_address()), the netboot code currently only uses link-local IPv6 addresses - which is bad since they can not be routed, e.g. if the TFTP server is not on the same link. So set_ipv6_address(NULL) should set own_ip6 preferably to a non-local unicast address if it has been generated successfully during ipv6_init(). Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-14net-snk: Fix the check for link-local addresses when receiving RAsThomas Huth2-2/+9
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-14net-snk: Remove junk at the end of IPv6 TFTP ACK and error packetsThomas Huth1-4/+2
While looking at the network traffic from SLOF with Wireshark, I noticed that there are some junk bytes at the end of TFTP ACK packets. The problem is that send_ack() adds sizeof(struct ethhdr) to the length of the packet that it wants to transmit. But adding the sizeof(struct ethhdr) to the length of the packet is done within send_ipv6() already, so this value got added twice. Removing it from send_ack() fixes this issue - the packets then look fine in Wireshark again. send_error() apparently suffers from the same issue, so let's also remove the sizeof(struct ethhdr) from that function. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-12-23net-snk: Get rid of junk at the end of sent DHCPv6 packetsThomas Huth2-6/+6
Wireshark reports bad FCS values and trailing zeros for SLOF's DHCPv6 packets. This happens due to two bugs. First, the length given to send_ipv6() contained sizeof(struct ethhdr) - but adding that length is the responsibility of the send_ipv6() function itself, the upper layers must not add this length yet. Second, struct option_request was defined with 5 options, but the code only uses 3 options instead. So when the code uses sizeof(struct dhcp_message_header) (which contains the struct option_request), there were additional unused bytes appended to the message. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-12-23net-snk: Use transaction IDs in DHCPv4, tooThomas Huth3-2/+18
Generate a proper transaction ID before sending DHCPv4 packets and check whether the DHCPv4 replies contain that correct XID, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-12-23net-snk: Make use of DHCPv6 transaction IDsThomas Huth3-8/+13
Generate a proper transaction ID before sending DHCPv6 packets and check whether the DHCPv6 replies contain that correct XID, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-12-23net-snk: Seed the pseudo-random number generatorThomas Huth1-0/+14
Use the MAC address and the current timebase value to seed the pseudo-random number generator - this will hopefully give use enough pseudo-randomness so that two guests that are booting in parallel won't use the same rand() numbers. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-12-23net-snk: Improve printed text when booting via networkThomas Huth2-13/+14
The output of net-snk is bad in a couple of places: 1) The hard-coded "Bootloader 1.6" message is pretty useless for the users (we never changed the version number in the past five years) - so let's change that into printing "Initializing NIC" instead. 2) "Requesting IP address via DHCP" is wrong for DHCPv6 since in this case, the net-snk might only request the boot file name via DHCPv6. In the IPv6-only case, the net-snk was already printing "Requesting information..." instead, so let's unify these texts to always print "information" instead of "IP address" 3) The client IPv6 address is never printed out, so do that now, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-12-01Clean up pending packet variable in ipv4 codeThomas Huth1-8/+8
The pending_pkt structure is not really an ARP cache entry, and the fields .ipv4_addr, .mac_addr and .pkt_pending were only set but never read again. So to avoid confusion, convert the pending packet structure into a simple array for storing the packet and an additional length variable. Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-12-01Fix tracking of pending outgoing packets when handling ARP repliesThomas Huth1-1/+1
pending_pkt.pkt_pending is never read, thus setting it to 0 in handle_arp() does not make much sense. On the other hand, arp_table[i].pkt_pending is never set back to 0, but it is checked for tracking which packets still have to be sent in handle_arp(), thus we might send out the same queued packet multiple times when receiving more than one ARP packet from the other side. So setting "pending_pkt.pkt_pending = 0" seems to be a typo, and "arp_table[i].pkt_pending = 0" should be right instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-11-03qemu/js2x/client: Support binutils >= 2.25.1Alexey Kardashevskiy4-6/+6
The recent binutils version introduces explicit definition of a TOC symbol which points to the .toc section and enforces .toc alignment to 256 rather than 8 bytes before. For now the TOC symbol points to same location as it was before - start of .toc + 0x8000; however as this might change, we should not rely on that in the source code. This changes __toc_start (for qemu and js2x boards), _got (for net-snk, takeover, rtas) in linker scripts to use explicitely defined TOC if defined and fall back to the older scheme if not. This changes r2 (the register pointing to TOC) setup code not to add 0x8000 as linker scripts do that now. Here is a bit more information about the change: https://sourceware.org/ml/binutils/2015-10/msg00124.html https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=a27e685fa0a6480bdb07e3be359558524cec89b7 Tested on 1. gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC) GNU ld version 2.23.2 2. gcc version 5.2.1 20151001 (GCC) GNU ld (GNU Binutils) 2.25.51.20150930 Reported-by: William Grant <wgrant@ubuntu.com> Tested-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-09-30takeover: Fix header includesThomas Huth1-1/+1
The ioctl.h header has been removed with commit 6495aef5b625b9ddae ("net-snk: Remove module system"), so it can not be included in the takeover client anymore. Thus remove the include statement (which is no problem since the takeover client does not use ioctls anyway). Include unistd.h instead, to avoid that the compiler is printing out a warning about a missing prototype of the function sbrk(). Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-12Silence compiler warning when building the biosemuThomas Huth11-86/+46
Fixed the compiler warnings about wrong and missing prototypes in the biosemu snk code. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29ipv4: Fix send packet across a subnetNikunj A Dadhania1-4/+8
The send packet code does understand that the IP is not part of the current network and needs to use the router. And then tries to get the MAC address of the router IP from arp cache, that fails. This is becuase there was no ARP Request send for the router IP. So in case when there is router involved, send arp request for the router IP and after the reply, we have the router mac cached to communicate with. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29net-snk: Make call_client_interface() a bit more ABI compliantBenjamin Herrenschmidt1-4/+6
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29net-snk: Remove custom printf versionBenjamin Herrenschmidt2-13/+1
In favor of the libc one Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29net-snk: Sanitize our .lds fileBenjamin Herrenschmidt3-30/+55
No need to have a single giant section, break it back up, add some missing bits, and make sure .opd is separate so that objdump and gdb can properly reconstitute the dot symbols. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [ do not discard .comment, this is fixed with binutils 2.24] Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29net-snk: Avoid type clash for stdin & stdoutBenjamin Herrenschmidt1-5/+6
Now that we are using the libc stdio Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>