In C90, NULL is guaranteed to be declared in <stddef.h> and also in
<string.h>. Though the correct way to define NULL in FreeBSD is to
include <sys/_null.h>, other parts of libstand still require <string.h>
to build; therefore, we keep <string.h> in stand.h and add a note about
this;
- Removing no longer used 'Prototype' definition. Quote from bde@:
'Cruft related to getting incomplete struct declarations within
prototypes forward-declared before the structs. It doesn't mean
"prototype" but only part of a prototype-related hack. No longer
used.'
- Replacing iaddr_t with uintptr_t;
- Removing use of long double to determine alignment. Use a fixed 16 byte
alignment instead;
Reviewed by: bde
Obtained from: DragonFlyBSD (partially)
MFC after: 1 month
this fix only applies to zalloc.c, the other part of libstand such like
qdivrem.c still gives compilation warnings on sparc64 tinderbox builds;
therefore, WARNS level isn't changed for now.
Submitted by: Garrett Cooper <yanegomi@gmail.com>
Reviewed by: bde
(1) Coding style changes.
(2) If the server does not acknowledge any blocksize option,
revert to the default blocksize of 512 bytes.
(3) Send ACK if the first packet happens to be the last packet.
(4) Do not accept blocksize greater than what was requested.
(5) Drop any unwanted OACK received if a tftp transfer is already
in progress.
(6) Terminate incomplete transfers with a special no-error ERROR packet.
Otherwise we rely on the tftp server to time out, which it does
eventually, after re-sending the last packet several times and spamming
the system log about it every time. This idea is borrowed from the
PXE client, which does exactly that.
Submitted by: Alexander Kabaev <kan@FreeBSD.org>
Reviewed and Tested by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
------------------------------------------------------------------------
r172854 | marius | 2007-10-21 10:03:18 -0700 (Sun, 21 Oct 2007) | 16 lines
Changed paths:
M /head/lib/libstand/tftp.c
- Given that we tell the compiler that struct ip is packed and 32-bit
aligned, GCC 4.2.1 also generates code for sendudp() that assumes
this alignment. GCC 4.2.1 however doesn't 32-bit align wbuf, causing
the loader to crash due to an unaligned access of wbuf in sendudp()
when netbooting sparc64. Solve this by specifying wbuf as packed and
32-bit aligned, too. As for lastdata and readudp() this currently is
no issue when compiled with GCC 4.2.1, though give lastdata the same
treatment as wbuf for consistency and possibility of being affected
in the future. [1]
- Sprinkle const on a lookup table.
------------------------------------------------------------------------
send along the "blksize" option specified in RFC2348,
and the "tsize" option specified in RFC2349.
Add code to parse the TFTP Option Acknowledgement (OACK) packet as
specified in RFC2347.
For TFTP servers which support the "blksize" option, we can
specify a TFTP Data block size larger than the default 512 bytes
specified in RFC1350. This offers greater read performance when
downloading files.
We request an initial size of 1428 bytes, which is less than the
Ethernet MTU of 1500 bytes. If the TFTP server sends back an OACK
packet, then use the block size specified in the OACK packet.
Most times it is usually the same value as what we request.
If the TFTP server supports RFC2348, we will see performance improvements
by transferring files over TFTP with larger block sizes.
If we do not get back an OACK packet, then we most likely we
are interoperating with a legacy TFTP server that does not
support TFTP extension options, so default to the block size of
512 bytes.
(2) If the "tftp.blksize" environment variable is set, then
take that value and use it when sending the TFTP RRQ packet,
instead of 1428. This allows us to set different values of
"tftp.blksize" in the loader, so that we can test out different
TFTP block sizes at run time.
Obtained from: Juniper Networks
Fixed by: rodrigc
unwanted packet(non-tftp). Change this to retransmit the packet(request or ack) only after
a timeout.
Obtained from: Juniper Networks
Fixed by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
In sendrecv_tftp:
* Upon receving an unexpected block of data or error, resend the ACK
immediately instead of waiting till the expiry of receive data timeout
to resend the ACK.
* change the receive timeout value between retries to be 2xMINTMO.
Obtained from: Juniper Networks
Fixed by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
to increase in steps of MINTMO, instead of doubling the timeout for every
retry.
Obtained from: Juniper Networks
Fixed by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
This allows the nfs_getrootfh() function to return the
correct file handle size to pxe.c for pxeboot. It also
results in NFSv2 no longer being used by default anywhere
in FreeBSD. If built with OLD_NFSV2 defined, the old
code that predated this patch will be built and NFSv2
will be used.
Tested by: danny at cs.huji.ac.il
MFC after: 2 weeks
CVS r1.94 jhb:
Cast the integer read as the first argument for %b to an unsigned integer
so it's value is not sign extended when assigned to the uintmax_t variable
used internally by printf. For example, if bit 31 is set in the cpuid
feature word, then %b would print out the initial value as a 16 character
hexadecimal value. Now it only prints out an 8 character value.
CVS r1.109 njl:
Add support for 'h' and 'hh' modifiers for printf(9).
CVS r1.117 phk:
If we ignore an unknown % sequence, we must stop interpreting the remaining
% arguments because the varargs are now out of sync and there is a risk that
we might for instance dereference an integer in a %s argument.
SVN r209836 jkim:
Implement optional 'precision' for numbers. Previously, it was parsed but
ignored. Some third-party modules (e.g., APCICA) prefer this format over
zero padding flag '0'.
implement assert() instead of relying on a non-required exit(). The exit()
invocation also did not match the semantics of the exit() routine that
current boot environments happen to require.
PR: kern/144749
Discussed with: bde
MFC after: 1 week
Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and
lower it when needed.
I'm setting WARNS?=0 for secure/. It seems secure/ includes the
Makefile.inc provided by lib/. I'm not going to touch that directory.
Most of the code there is contributed anyway.
support to bzip2fs. This fixes problems with loading compressed amd64
kernel modules containing debug symbols.
Submitted by: David Naylor naylor.b.david (gmail)
MFC after: 1 week
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,
The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.
Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:
- Kip Macy revised the locking code completely, thus completing
the last piece of the puzzle, Kip has also been conducting
active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
me maintaining that branch before the svn conversion
revised/modified by me) to store dhcp options into kenv variables,
so the information is available to the boot loader and can be used
to customize the boot process.
The change is totally unintrusive, essentially made of a single
function to be called while parsing a dhcp response, and a couple
of tables to classify options. The values extracted from dhcp
options are stored in the kenv environment in one of these forms:
+ options whose name and type is known are saved as
dhcp.name = value (string, or number/ip addresses lists)
+ unknown options are assumed to be strings and saved as
dhcp.option-NNN = "value"
+ options listed as '__INDIR' and sent on the wire as e.g.
option unknown-252 "some.name=the actual value"
are saved as
some.name = "the actual value"
+ options listed as '__ILIST' and sent on the wire as e.g.
option unknown-249 "a.b=foo bar; c.d= 123; e.f=done"
are saved as multiple values
a.b="foo bar"
c.d="123"
e.f="done"
As you can see there is quite a bit of flexibility on what can
be passed to the loader or the kernel.
For the time being the vendor-specific table is mostly disabled,
because there is no standard set of options for FreeBSD, and I don't
know all the pxe-specific vendor options.
Also, applications using libstand may live in memory-constrained
environments, so it makes sense to keep these tables as small as
possible, especially considering that one can generate arbitrary
name=value pairs using site-specific options of type __INDIR or
__ILIST (there are 4 __ILIST and 5 __INDIR in the table, numbered
246..249 and 250..254).
Actually, considering that probably 75% of the standard dhcp options
are totally useless, it might make sense to remove them as well.
Submitted by: Danny Braniss
MFC after: 4 weeks