History log of /netbsd-current/usr.bin/tftp/tftp.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.37 06-Jan-2023 christos

PR/57166: John Dundas: Correct error code byte order in error message


Revision tags: netbsd-10-base netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914
# 1.36 03-Sep-2016 dholland

storage class first, *then* __dead


# 1.35 03-Sep-2016 sevan

Remove K&R __P macros.
Remove main() function prototype if present.
Mark usage() as __dead if not already.
Binaries generated with & without these patches were compared with diff -r.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.34 16-Jul-2012 he

Undo the non-sharing of the "toplevel" jmp_buf between main.c and tftp.c,
so that we don't get a core dump if a transfer time-out is experienced.
Also, get rid of an extranous newline printed in the case of time-out.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.33 20-Mar-2012 matt

Use C89 function definitions


Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.32 17-Sep-2011 christos

branches: 1.32.2; 1.32.4;
ansify, const, knf


# 1.31 16-Sep-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.30 18-Jan-2009 lukem

fix -Wsign-compare issues


# 1.29 11-Dec-2008 seanb

- Malformed multicast option not being checked
for correctly. Could fault client.
- 'mc' (master client) field not being examined
properly. Actually looking at addr field so
proably always working out to non 0 (master).


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.28 22-Oct-2006 christos

sprinkle volatile.


# 1.27 29-Sep-2006 christos

Coverity CID 4119: Check negative returns (from Arnaud Lacombe)


Revision tags: abandoned-netbsd-4-base
# 1.26 21-Jul-2006 jmcneill

Add support for the multicast TFTP option. Reviewed by Rui Paulo.


Revision tags: chap-midi-nbase chap-midi-base
# 1.25 09-Apr-2006 christos

Pass lint.


# 1.24 01-Feb-2006 martin

Do not use %d for size_t!


# 1.23 31-Jan-2006 christos

PR/32680: Yves-Emmanuel JUTARD: Improve some error checking that causes
memory corruption on out of memory errors.
While I am here, remove some lint.


# 1.22 20-Nov-2005 ross

Fix old-style C code, update to WARNS=4.
Also, move file-scope .c extern decls to the .h file


# 1.21 02-Jun-2005 lukem

appease gcc -Wuninitialized


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.20 10-Oct-2004 he

Move declaration of local variables to start of function instead of
inside a block after code. Fixes build problem for vax, which still
uses gcc 2.95.3.


# 1.19 02-Oct-2004 erh

Make the extended options work on little endian machines.
Allow files smaller than 512 bytes to be received w/o a timeout.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.18 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


# 1.17 11-Jun-2003 briggs

Support negotiation and use of TFTP Option Extension (rfc 2347) for the
'blksize' option (rfc 2348) and the 'timeout' and 'tsize' options (rfc 2349).

Contributed by Wasabi Systems, Inc.


# 1.16 01-Feb-2003 wiz

Fix sendto return value check (incomplete change in 1.14).
Noted by Brian Ginsbach in PR 19842.


Revision tags: netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 fvdl_fs64_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.15 30-Dec-2000 itojun

branches: 1.15.2;
fix argument validation mistake in setpeer().
From: Hiroyuki YAMAMORI <h-yamamo@db3.so-net.ne.jp>


# 1.14 21-Nov-2000 itojun

make sure we do not overrun tp->th_msg on ERROR packet.
correct ERROR length to include terminating \0 (RFC1350 page 8).


# 1.13 22-Oct-2000 dogcow

A too hasty checkin (and lack of -Wsign-compare) made send() never fail.
Newly added 'unsigned' removed from vars that shouldn't have had it.


# 1.12 18-Oct-2000 dogcow

defs had 'short block' for blocksize; changed defs to be unsigned.
added note to tftpd.8 that this bug hits multiple tftp clients.


Revision tags: netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.11 21-Jan-2000 mycroft

branches: 1.11.4;
Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We get
the correct definition from errno.h.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.10 12-Jul-1999 itojun

IPv6 support.
clarify a bit (specifically, routines in tftp.c now does not
modify "peeraddr")


Revision tags: netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.9 19-Dec-1998 christos

branches: 1.9.2;
char -> unsigned char
<fcntl.h> instead of <sys/file.h>
compensate for different types in th_stuff


# 1.8 26-Jul-1998 mycroft

const poisoning.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.7 20-Oct-1997 lukem

deprecate register, use err/warn, fix .Nm usage


# 1.6 07-Oct-1997 mrg

WARNS?=1


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.5 29-Apr-1995 cgd

needs string.h


# 1.4 08-Dec-1994 jtc

Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.3 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.2 21-Apr-1993 mycroft

Cleanup for GCC 2.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: pgoyette-localcount-20161104 localcount-20160914
# 1.36 03-Sep-2016 dholland

storage class first, *then* __dead


# 1.35 03-Sep-2016 sevan

Remove K&R __P macros.
Remove main() function prototype if present.
Mark usage() as __dead if not already.
Binaries generated with & without these patches were compared with diff -r.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.34 16-Jul-2012 he

Undo the non-sharing of the "toplevel" jmp_buf between main.c and tftp.c,
so that we don't get a core dump if a transfer time-out is experienced.
Also, get rid of an extranous newline printed in the case of time-out.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
# 1.33 20-Mar-2012 matt

Use C89 function definitions


Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.32 17-Sep-2011 christos

branches: 1.32.2; 1.32.4;
ansify, const, knf


# 1.31 16-Sep-2011 joerg

Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.30 18-Jan-2009 lukem

fix -Wsign-compare issues


# 1.29 11-Dec-2008 seanb

- Malformed multicast option not being checked
for correctly. Could fault client.
- 'mc' (master client) field not being examined
properly. Actually looking at addr field so
proably always working out to non 0 (master).


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.28 22-Oct-2006 christos

sprinkle volatile.


# 1.27 29-Sep-2006 christos

Coverity CID 4119: Check negative returns (from Arnaud Lacombe)


Revision tags: abandoned-netbsd-4-base
# 1.26 21-Jul-2006 jmcneill

Add support for the multicast TFTP option. Reviewed by Rui Paulo.


Revision tags: chap-midi-nbase chap-midi-base
# 1.25 09-Apr-2006 christos

Pass lint.


# 1.24 01-Feb-2006 martin

Do not use %d for size_t!


# 1.23 31-Jan-2006 christos

PR/32680: Yves-Emmanuel JUTARD: Improve some error checking that causes
memory corruption on out of memory errors.
While I am here, remove some lint.


# 1.22 20-Nov-2005 ross

Fix old-style C code, update to WARNS=4.
Also, move file-scope .c extern decls to the .h file


# 1.21 02-Jun-2005 lukem

appease gcc -Wuninitialized


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.20 10-Oct-2004 he

Move declaration of local variables to start of function instead of
inside a block after code. Fixes build problem for vax, which still
uses gcc 2.95.3.


# 1.19 02-Oct-2004 erh

Make the extended options work on little endian machines.
Allow files smaller than 512 bytes to be received w/o a timeout.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.18 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.


# 1.17 11-Jun-2003 briggs

Support negotiation and use of TFTP Option Extension (rfc 2347) for the
'blksize' option (rfc 2348) and the 'timeout' and 'tsize' options (rfc 2349).

Contributed by Wasabi Systems, Inc.


# 1.16 01-Feb-2003 wiz

Fix sendto return value check (incomplete change in 1.14).
Noted by Brian Ginsbach in PR 19842.


Revision tags: netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 fvdl_fs64_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.15 30-Dec-2000 itojun

branches: 1.15.2;
fix argument validation mistake in setpeer().
From: Hiroyuki YAMAMORI <h-yamamo@db3.so-net.ne.jp>


# 1.14 21-Nov-2000 itojun

make sure we do not overrun tp->th_msg on ERROR packet.
correct ERROR length to include terminating \0 (RFC1350 page 8).


# 1.13 22-Oct-2000 dogcow

A too hasty checkin (and lack of -Wsign-compare) made send() never fail.
Newly added 'unsigned' removed from vars that shouldn't have had it.


# 1.12 18-Oct-2000 dogcow

defs had 'short block' for blocksize; changed defs to be unsigned.
added note to tftpd.8 that this bug hits multiple tftp clients.


Revision tags: netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.11 21-Jan-2000 mycroft

branches: 1.11.4;
Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We get
the correct definition from errno.h.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.10 12-Jul-1999 itojun

IPv6 support.
clarify a bit (specifically, routines in tftp.c now does not
modify "peeraddr")


Revision tags: netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.9 19-Dec-1998 christos

branches: 1.9.2;
char -> unsigned char
<fcntl.h> instead of <sys/file.h>
compensate for different types in th_stuff


# 1.8 26-Jul-1998 mycroft

const poisoning.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.7 20-Oct-1997 lukem

deprecate register, use err/warn, fix .Nm usage


# 1.6 07-Oct-1997 mrg

WARNS?=1


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.5 29-Apr-1995 cgd

needs string.h


# 1.4 08-Dec-1994 jtc

Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.3 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.2 21-Apr-1993 mycroft

Cleanup for GCC 2.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision