Commit graph

82 commits

Author SHA1 Message Date
Georg Schwarz
b0a2a17864 Cast IPv6 address from SOCKADDR_P() to struct in6_addr *
We need to cast IPv6 addresses from SOCKADDR_P() to struct in6_addr *
on some platforms, including at least MacOS X.
2008-11-14 08:37:49 -08:00
Karsten Keil
544abd789e Add error messages if address types mismatch
If a user does supply a IPv4 or IPv6 address
but force the other type with -4 or -6, give an error.
The patch also fix the special [::ffff:127.0.1]
address handling, it work now if you bind to this
address but only if you not force IPv6 only, it seems
that the kernel does not signal connections to a
IPv6 socket listen on [::ffff:127.0.0.1], if it was bound
IPv6 only.
I think we can live with it and do not need a special test
for this address.

Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-08-01 08:24:16 -07:00
Karsten Keil
18fd18bd5c Improve address type error handling
This patch detects numeric address types to avoid unnecessary
warnings/errors.  It also cleans up error printing to not print error
messages on stderr in the deamon case.

Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-07-31 11:48:18 -07:00
H. Peter Anvin
e4d3083006 tftpd: switch to getopt_long()
Switch to using getopt_long(); include a version in case the platform
lacks it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-07-30 17:16:00 -07:00
H. Peter Anvin
0c6f7f86d3 tftpd: mark symbols static
Mark symbols not accessed from other files static.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-07-30 16:17:02 -07:00
Karsten Keil
cfb85d4dec Fix numeric IPv6 address handling
This patch fix a issue with numeric IPv6 addresses in the
tftpd -a address[:port] option.

Since IPv6 addresses use colon ':' in differnt counts itself, we cannot detect,
if the last colon is a seperator, so it is needed to put the IPv6 address into
square brackets, e.g. [2001:db8::1], so a optional port assignment is
unambiguous.
The patch also allows to specify numeric IPv6 addresses in other places enclosed
in [], but in these cases it accept these also without [].

Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-07-30 15:20:31 -07:00
H. Peter Anvin
c3a5c712e2 Allow the -4 option even in an IPv4-only configuration
Allow the -4 option even if IPv6 isn't compiled in.
2008-07-23 14:36:18 -04:00
Karsten Keil
28f22b6591 Add support for IPv6 in the server and client.
Add support for IPv6 in the server and client.
You can force the use of IPv4 or IPv6 only with new
-4 and -6 commandline options, if IPv6 support was compiled in.

Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-07-23 14:29:41 -04:00
H. Peter Anvin
9f83475779 Formatting cleanup 2008-07-08 17:26:18 -04:00
H. Peter Anvin
cd22c6ea31 Formatting cleanup
Clean up line break
2008-07-08 17:24:11 -04:00
H. Peter Anvin
22accddda0 Reformat the source code
The source code was a mix of different styles; normalize on NASM
style; basically K&R style with 4 space indentation.
2008-07-08 17:14:44 -04:00
H. Peter Anvin
c7ecc59f86 When running in secure mode (-s), we must not chdir while daemonizing
When running in secure mode (-s), we must not chdir while daemonizing.
Thanks to Adrian Urquhart for spotting this bug.
2007-01-30 15:38:04 -08:00
H. Peter Anvin
d9938a7d83 Add -L option to not daemonize process 2007-01-15 01:12:52 -08:00
H. Peter Anvin
059de7ce20 Use replacement library functions to daemonize, rather than #ifdef hell 2007-01-15 01:11:26 -08:00
H. Peter Anvin
982c1f2697 printf() and htonl() type matching issue
On older systems, htonl() returns unsigned long, on newer systems it
returns uint32_t.  Cast to unsigned long and use %08lX for the format,
that seems to be the easiest solution.
2007-01-08 16:30:10 -08:00
Dyks, Axel (XL)
1cb44ce918 tftp-hpa does not reload the remap file when receiving SIGHUP
... because the signal handling code is enclosed in "#ifdef HAVE_REGEX"
instead of "#ifdef WITH_REGEX"

The following patch against head of "network/tftp/tftp-hap.git" on "kernel.org"
fixes this issues (you are using blanks for indention and not tabs. right?).

Cheers
Axel
2006-12-05 14:36:32 -08:00
Zack Bartel
ec5973ac5f Moved pick_port_bind() to the libcommon common code so both client and server can use it. Client can now specify a range of ephemeral ports (transaction id) 2006-11-13 17:33:29 -08:00
H. Peter Anvin
14993bc916 Introduce socklen_t; detect non-local (e.g. broadcast) receive addresses 2006-10-04 21:54:04 -07:00
H. Peter Anvin
40133b212b Move common code to a common/ subdirectory 2006-10-04 10:19:06 -07:00
H. Peter Anvin
b3892e801f Correct the logic when to loop for the port range 2006-02-16 09:29:35 -08:00
Peter Anvin
ccb6289984 Actually do loop... 2005-10-13 15:20:41 -07:00
Peter Anvin
4187af0e6f Cleaner version implementing port range 2005-10-13 11:41:37 -07:00
Peter Anvin
ae1305e2d5 Local port range functionality hack 2005-10-13 11:30:45 -07:00
Peter Anvin
25d63c415a Disable path MTU discovery by default. It's useless for TFTP. 2005-10-13 11:16:40 -07:00
hpa
17b5188b65 - Fix bug in the handling of timeouts.
- Add support for \U..\E and \L..\E.
- Add support for inverse rules.
2004-09-14 22:38:46 +00:00
hpa
2cba51056f Fix a pathology where a client sending ACKs for the wrong
packet can prevent proper retransmission.
2004-06-13 21:11:24 +00:00
hpa
9c3ab465f2 Remove broken Cygwin workaround 2004-01-08 20:48:30 +00:00
hpa
530706aebe #include <sys/socket.h> if it exists;
Add option to control the max blksize negotiated.
2003-08-23 00:31:20 +00:00
hpa
571deaa36b Apply some code cleanups that apparently fix Solaris 7 gcc problems. 2003-04-12 06:54:58 +00:00
hpa
c11a43fa53 Formatting fix 2003-01-31 02:22:33 +00:00
hpa
0f52cd8fa4 More error message improvements; work around a suspect Solaris compiler bug 2002-11-09 02:22:59 +00:00
hpa
b3ec0c58e6 Better error messages. 2002-11-08 01:10:08 +00:00
hpa
82eae1bcd6 Fix some timeout-related bugs; allow the user to set the default timeout. 2002-10-23 21:21:46 +00:00
hpa
725183b5ba Check that the received address is really AF_INET. 2002-10-23 20:47:23 +00:00
hpa
b5b455d116 Correct LOG_WARN -> LOG_WARNING 2002-09-03 19:03:02 +00:00
hpa
d2692c9f98 Downgrade client-side errors from LOG_ERR to LOG_WARN 2002-09-03 19:02:02 +00:00
hpa
7a3373656d Fix running on Cygwin *without* chroot 2001-11-29 22:07:50 +00:00
hpa
64ae5fda79 -> Clean up the use of autoconf macros a bit.
-> Always pass O_TEXT/O_BINARY and "t"/"b" respectively, as appropriate.
2001-11-29 22:02:52 +00:00
hpa
5c5b5e8a0b More Cygwin compatibility work -- now actually WORKS!
Always leave fds 0-2 defined; point them to /dev/null rather than
just closing them...
2001-11-29 20:53:59 +00:00
hpa
98d7543721 Working on version 0.29.
Initial work for compiling on Win32/Cygwin.

Posixly correctness.
2001-11-27 10:05:13 +00:00
hpa
f9e7950883 Fix listen mode (-l) 2001-11-20 19:45:11 +00:00
hpa
78fd7348ea Add the -p option for using regular Unix permissions. 2001-11-17 01:55:08 +00:00
hpa
57044bc5df Interpret the \i and \x escape sequences to insert the IP of the
requesting host
2001-11-16 23:38:29 +00:00
hpa
3d401fa4c9 Be paranoid about multiple inclusions (apparently some systems don't like
it for certain header files.)  Be a little bit more careful in setting
up the standard environment in config.h.  This is AIX portability work.
2001-11-16 20:15:27 +00:00
hpa
7028f9064a Kill SA_RESETHAND, it doesn't exist on MacOS X and isn't necessary 2001-11-15 04:11:39 +00:00
hpa
7edb3d5b92 Display configuration information when using the -V option... 2001-11-14 04:16:23 +00:00
hpa
06bfb2bf4f - Better parsing of the "connect" command (tftp).
- Move missing header file stuff consistently into config.h.
- Make "make -j" work correctly.
2001-11-13 19:58:32 +00:00
hpa
d2206bf9b9 Fix the Sorcerer's Apprentice bug in both the client and the server. 2001-11-13 04:16:12 +00:00
hpa
480bee14e9 (Finally) handle block number wraparound correctly. 2001-11-13 03:11:52 +00:00
hpa
2c31169f57 Major overhaul of the portability stuff; port to autoconf 2.52 2001-11-12 10:03:04 +00:00