david/ipxe
Archived
1
0
Commit Graph

1027 Commits

Author SHA1 Message Date
Michael Brown
09688cb3b5 Correct some packet ownership and freeing bugs. 2006-08-09 14:27:07 +00:00
Michael Brown
43d601b678 out_flags was being set but never used.
Use just random() to allocate initial sequence numbers; the previous
algorithm ended up with a high probability of zeroing the high word.
2006-08-09 13:35:03 +00:00
Michael Brown
065a2a486d Port the UDP port allocation code to TCP 2006-08-09 12:08:20 +00:00
Michael Brown
de0c36a98a Remove some of the confusion surrounding the amount to strip off from
a TCP packet before passing to newdata().
2006-08-09 12:01:09 +00:00
Michael Brown
867c7aef59 iphdr->hlen includes the IP header, so truncate packet *before*
stripping the header.  Also fix an htons/ntohs confusion.
2006-08-09 11:52:53 +00:00
Marty Connor
ee9ae8130a Remove _PROTOCOL macros for gcc 3.2 compatibility 2006-08-09 04:42:14 +00:00
Marty Connor
dd7e103d58 Make VERSION_MAJOR for gPXE be 0 2006-08-09 03:43:41 +00:00
Michael Brown
0dd0a8366e Removed obsolete line merged in with the cmdline stuff 2006-08-09 03:22:29 +00:00
Michael Brown
504a705d9e Do no evil. :) 2006-08-09 03:21:02 +00:00
Michael Brown
c9e6c33bba Attempt a PXE NBP boot as the TFTP test. 2006-08-09 03:00:11 +00:00
Michael Brown
f018da8215 Implement enough of PXENV_GET_CACHED_INFO to support pxelinux. 2006-08-09 02:59:19 +00:00
Michael Brown
75d26d884a Added pxe_netdev; a slight hack for now, but will need to be done
properly for the PXE UNDI API anyway.
2006-08-09 02:58:27 +00:00
Michael Brown
e9561aafc0 Derive xid dynamically from the netdev, so that we can call
create_dhcp_packet() from pxe_preboot.c, after the dhcp_session is long
gone.

Expose the functions required by pxe_preboot.c
2006-08-09 02:56:40 +00:00
Michael Brown
56c995ff60 Aborted 2006-08-09 02:37:05 +00:00
Marty Connor
41af7457a8 Merge of Fredrik Hultin command_line 2006-08-09 02:30:35 +00:00
Michael Brown
691557281f Add a couple of small but vital parts to PXENV_UDP_WRITE. 2006-08-09 01:57:02 +00:00
Michael Brown
a3d508b648 Clarified packet ownership transfer between a few functions.
Added a large number of missing calls to free_pkb().  In the case of UDP,
no received packets were ever freed, which lead to memory exhaustion
remarkably quickly once pxelinux started up.

In general, any function with _rx() in its name which accepts a pk_buff
*must* either call free_pkb() or pass the pkb to another _rx() function
(e.g. the next layer up the stack).  Since the UDP (and TCP) layers don't
pass packet buffers up to the higher-layer protocols (the
"applications"), they must free the packet buffer after calling the
application's newdata() method.
2006-08-09 01:24:32 +00:00
Michael Brown
fd07f56f0d Note to self: learn to count. 2006-08-09 00:56:07 +00:00
Michael Brown
843bcc291d Added missing __from_text16()s when passing pointers to PXE NBP. 2006-08-09 00:39:21 +00:00
Michael Brown
71754ada2a Allow linking by converting functions to stubs 2006-08-09 00:25:29 +00:00
Michael Brown
17ecfd1d67 Allow linking by converting all functions to stubs 2006-08-09 00:22:28 +00:00
Michael Brown
751ae718bd pxe_int_1a is needed by pxe_call.c 2006-08-09 00:16:57 +00:00
Michael Brown
d1a123b1f4 Added TFTP test code (currently just dumps file to console). 2006-08-09 00:09:29 +00:00
Michael Brown
3611cb17b7 Initial (untested) implementation of TFTP over the new UDP API. 2006-08-08 23:45:52 +00:00
Michael Brown
eda79ec32b The prototype for strcasecmp() is apparently in strings.h. 2006-08-08 22:52:16 +00:00
Nikhil Chandru Rao
409f69a08a Changed ipv4_dump() to consume only one line. 2006-08-08 22:26:35 +00:00
Nikhil Chandru Rao
8bf38fb400 Corrected bugs in the TCP logic. There might be a few more which need to be taken care of. 2006-08-08 22:25:20 +00:00
Michael Brown
72cd29f13c Added some TFTP definitions for use with the new UDP API. 2006-08-08 22:01:16 +00:00
Michael Brown
18c112d205 Added (not yet tested) PXE API entry point and support functions. 2006-08-08 20:43:33 +00:00
Michael Brown
d12383f1d3 Update to match the daft capitalisation in the actual PXE spec 2006-08-08 20:43:05 +00:00
Michael Brown
68e33224ef gcc3 compatibility: removed ARP_NET_PROTOCOL(). 2006-08-08 17:44:25 +00:00
Nikhil Chandru Rao
d2bdf81505 Removed some bugs in TCP 2006-08-08 03:42:30 +00:00
Nikhil Chandru Rao
cb42e573a0 Added retransmissions to TCP 2006-08-07 18:52:26 +00:00
Michael Brown
010288577f Add very, very quick and dirty hello world test 2006-08-07 18:49:10 +00:00
Michael Brown
885a630ddf Fix routing when a gateway exists. This should probably be split into
a separate function.
2006-08-07 17:51:19 +00:00
Michael Brown
8a3f4b7de6 Set a NUL terminator before calling inet_aton. 2006-08-07 17:50:41 +00:00
Michael Brown
ecdcdea1af Remove unused attribute from __table macros; the tables are no longer
static since otherwise gcc4 optimises them away completely.  Also, it
really *is* an error if the table start and end are unused, so they
certainly shouldn't be marked with attribute unused.
2006-08-07 17:06:31 +00:00
Michael Brown
d0e4f198d6 Add iSCSI to the DHCP tests.
Start updating iscsi.c to use Nikhil's TCP API.
2006-08-07 16:48:24 +00:00
Nikhil Chandru Rao
6714ec745a Minor corrections 2006-08-07 07:37:23 +00:00
Michael Brown
eb24eece0e Convert some trivial functions to static inlines. 2006-08-03 23:42:03 +00:00
Michael Brown
ffe0e24249 Make the UDP senddata() methods return a status code.
udp_connect() now follows the standard BSD sockets semantics and simply
sets the default address for outgoing packets; it doesn't filter incoming
packets.
2006-08-03 23:10:14 +00:00
Michael Brown
a0a872f7f1 Updated PXE UDP implementation to use the new Etherboot UDP API.
Updated PXE API dispatcher to use copy_{to,from}_user, and moved to
arch/i386 since the implementation is quite architecture-dependent.
(The individual PXE API calls can be largely
architecture-independent.)
2006-08-02 23:08:10 +00:00
Michael Brown
e24a6cb525 Moved the basic struct sockaddr out of in.h. 2006-08-02 00:06:30 +00:00
Michael Brown
467e9627cc Added features that will be required for PXE UDP support.
Introduced struct sockaddr_tcpip, to simplify code that deals with
both IPv4 and IPv6 addresses.

Reorganised parts of tcpip.c and udp.c.
2006-08-02 00:02:21 +00:00
Nikhil Chandru Rao
9225f4edac TCP support 2006-08-01 20:46:50 +00:00
Nikhil Chandru Rao
c24546c70b Minor changes to the network layer rx() functions 2006-08-01 20:27:26 +00:00
Michael Brown
beadd82208 Remove unused functions. 2006-08-01 14:26:02 +00:00
Michael Brown
1ebb68e49a Renamed trans_{rx,tx}() to tcpip_{rx,tx}(), since they are specific to
the TCP/IP protocol suite (rather than being general transport-layer
functions).
2006-08-01 14:22:04 +00:00
Michael Brown
3a0e293123 Renamed tcpip_if.[ch] to tcpip.[ch] 2006-08-01 14:18:09 +00:00
Michael Brown
21c3d63c2e We shouldn't need to allocate a TX packet buffer when calling newdata();
if the application wants to send data then it will have to use the normal
senddata() mechanism.
2006-08-01 14:13:58 +00:00
Michael Brown
ae277992c2 Request bootfile name; it doesn't seem to be automatically supplied by
all servers.
2006-08-01 14:12:27 +00:00
Michael Brown
6e3e5efaed Accept '%i' as a synonym for '%d'. 2006-07-25 14:33:20 +00:00
Michael Brown
9e761f5f28 Print out "DHCP..." message just in case people think the demo is sitting
there doing nothing when it's actually waiting for a DHCP reply.
2006-07-20 14:20:11 +00:00
Michael Brown
a92d242008 Allow an AoE boot to be directed via DHCP, so that we have a proof of
concept demo that actually does something useful.
2006-07-20 14:15:23 +00:00
Michael Brown
3085f03ad4 Request Etherboot encapsulated options.
Parameter request list is yet another option that ISC dhcpd ignores
unless it's in the main options block.

Fix logic error in parsing file and sname fields.
2006-07-20 14:14:41 +00:00
Michael Brown
b26806cf18 Add dhcp_snprintf() for extracting DHCP string options. 2006-07-20 14:13:11 +00:00
Michael Brown
7ca8bcd98c Print out the lease time, just to show how easy it is. 2006-07-20 03:02:34 +00:00
Michael Brown
16d04386b6 Switch default stack to Nikhil's TCP/IP stack 2006-07-20 02:53:15 +00:00
Michael Brown
e74e20cb55 Remove the static IP address hack from netdevice.c, and change the
default test to the DHCP test.
2006-07-20 02:51:52 +00:00
Michael Brown
00a1f000b1 Added dhcp_ipv4_option() and friends.
Added test code to configure the interface for IPv4 after DHCP.
2006-07-20 02:49:59 +00:00
Michael Brown
6a0b4c9772 Free up any allocated options if we fail 2006-07-20 02:25:39 +00:00
Michael Brown
764cb41456 Document memory ownership. 2006-07-20 02:23:42 +00:00
Michael Brown
7ca1bb0fbe Now successfully negotiates the whole DHCPDISCOVER/OFFER/REQUEST/ACK
cycle.  :)
2006-07-20 02:19:06 +00:00
Michael Brown
30d9bcdc6e Rename unwieldy function 2006-07-20 00:24:25 +00:00
Michael Brown
9ad5cede96 Set DHCP_MESSAGE_TYPE option within the main options block. This
doesn't seem to be required by the RFCs, but at least ISC dhcpd and
ethereal refuse to recognise it otherwise.
2006-07-20 00:18:50 +00:00
Michael Brown
881b90e82c Packets without a DHCP_MESSAGE_TYPE option are probably just BOOTP
packets.
2006-07-20 00:03:25 +00:00
Michael Brown
29b358dd39 conn->local_port is now network-endian; do not swap when comparing
against value in header.

Temporarily disable RX checksumming; it's broken and is holding up
work on higher-layer protocols
.
2006-07-20 00:03:01 +00:00
Michael Brown
36c94eae78 Clarify hexiness of header length 2006-07-20 00:01:50 +00:00
Michael Brown
2c0eb6eb1d Correct TCP/IP checksum generation. 2006-07-19 23:38:05 +00:00
Michael Brown
0768670fd8 udp_open() takes ports in network-endian order. 2006-07-19 21:56:27 +00:00
Nikhil Chandru Rao
13dbf5494d Minor edits 2006-07-19 21:05:58 +00:00
Michael Brown
224529d8dd Now capable of sending what, to me, looks like a valid DHCPDISCOVER
(apart from the bad UDP checksum).
2006-07-19 20:50:50 +00:00
Michael Brown
a38010fb0e Make udp_send() call udp_sendto(), rather than vice-versa. 2006-07-19 20:38:49 +00:00
Michael Brown
7c84b74185 A small but very critical bug. 2006-07-19 20:16:46 +00:00
Michael Brown
82f3295794 Use more standardised format specifiers in debug messages (e.g. %p for
a pointer).
2006-07-19 18:45:18 +00:00
Michael Brown
ab633f6a73 Reserve space for lower-layer headers when allocating packet buffer.
Use pkb_available() rather than pkb_len() (which will always return 0
on a freshly allocated buffer).

udp_send() should assume that the buffer has already been allocated.
2006-07-19 18:21:30 +00:00
Michael Brown
6858b14a34 Add pkb_available() 2006-07-19 18:16:48 +00:00
Michael Brown
e8daeb62b1 Eliminate confusion between functions that return pointers and
functions that return status codes.

Zero the DHCP packet buffer *before* creating the options structures
inside it.
2006-07-19 18:11:31 +00:00
Michael Brown
3369f93036 Add block identification to debug messages 2006-07-19 17:58:27 +00:00
Michael Brown
6d9d48537e Added some debug messages and DHCP test code 2006-07-19 17:49:31 +00:00
Michael Brown
317b962b65 Proof of concept: transmit a single DHCPDISCOVER and dump out any
parsed DHCP responses.
2006-07-19 17:32:13 +00:00
Michael Brown
76070cd226 Added missing prototype 2006-07-19 17:29:18 +00:00
Michael Brown
16fc9858db Beginnings of DHCP protocol implementation 2006-07-19 17:01:06 +00:00
Michael Brown
a7011edfd4 Add net/udp 2006-07-19 17:00:40 +00:00
Michael Brown
bf0cdd42cf Add some DHCP options that we are likely to use 2006-07-19 17:00:32 +00:00
Michael Brown
e0668ad8df Correct typo 2006-07-19 16:58:44 +00:00
Nikhil Chandru Rao
bf515d3d65 Minor edit in net/udp.c 2006-07-19 16:27:54 +00:00
Nikhil Chandru Rao
ab577e1a3a The following edits were made: \
1. Updated UDP send data code\
2. Corrected internet checksum\
3. Moved udp_buffer() and udp_buflen() to udp.c from udp.h
2006-07-19 16:25:23 +00:00
Michael Brown
b8d619e822 Added macros for generating static DHCP options 2006-07-19 16:16:51 +00:00
Michael Brown
254fe6e00e Split DHCP packet creation into two parts: creating the basic packet
structure, and populating it with options.  This should allow us to
use the same basic options list for both DHCPDISCOVER and DHCPREQUEST,
plus making it much easier to set the non-constant parameters
(e.g. requested IP address) in request packets.
2006-07-19 12:12:45 +00:00
Michael Brown
e40ebb67de Allow for calling find_dhcp_option() with "options" set to NULL, in order
to search through all registered option blocks.

Move some static inlines that are likely to be used frequently into
dhcpopts.c as normal functions, to save space.
2006-07-19 11:05:38 +00:00
Michael Brown
7ab29b0bfe This file breaks "make blib"; please find a way to avoid doing this. 2006-07-17 19:19:17 +00:00
Derek Pryor
e71098a652 The first packet (ClientHello Handshake) can be constructed and is accepted
by SSL servers. Framework.c allows me to test the library against a given
https server.
2006-07-17 16:38:20 +00:00
Michael Brown
6c01d3bb95 Fix creation of the htype field; the ll_proto field from which it is
derived is a 16-bit big-endian field, but htype is only 8 bits wide.
2006-07-17 13:07:14 +00:00
Michael Brown
35b0233baa Tidy up hex_dump() output. 2006-07-17 13:04:29 +00:00
Michael Brown
b24947f0c0 Add sketch code to reassemble a DHCP packet from our internal "everything
is a DHCP option" data structures.

We need this code in order to be able to return a DHCP packet to a PXE NBP
which reflects options from our multiple sources (e.g. NVS and DHCP
server).  This is expensive, but necessary.  Having paid this cost, we may
as well try to use the same code to generate our DHCP request packets,
since the process is similar.
2006-07-17 12:47:22 +00:00
Michael Brown
12da7ea475 Add (untested) code for parsing a received DHCP packet and constructing a
DHCP options block from the contents.
2006-07-15 19:24:55 +00:00
Michael Brown
19e8b41562 Add code to modify DHCP option values within a block. 2006-07-13 20:49:04 +00:00
Michael Brown
3acbff4f00 How did this ever work properly before? 2006-07-13 18:27:23 +00:00
Derek Pryor
47be47bf17 Adding SSL Constructs header file. (First version) 2006-07-10 13:26:20 +00:00