curl-users
Re: TFTP via IPv6
Date: Tue, 8 Nov 2005 17:05:38 +0100 (CET)
On Tue, 8 Nov 2005, Lang, David wrote:
Thanks for your efforts!
> I'm using version 7.15.0 to perform file transfers using the new TFTP client
> functionality, and have found that a few minor code changes are necessary to
> support TFTP via IPv6.
Aha. It's nice to see that the TFTP feature is already getting used. I didn't
get time to try it over IPv6, but after your changes I might be able to get
some proper test cases for TFTP-ipv6 done.
> 1. All variables/structure members defined as "struct sockaddr" must now be
> defined as "struct sockaddr_storage".
Yes. Just note that we cannot assume that this struct will be available
everywhere, so we must use some #ifdef magic there. In the ftp.c code we have
this construct:
#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
struct sockaddr_storage ss;
#else
char ss[256]; /* this should be big enough to fit a lot */
#endif
It would be made nicer if we moved the check to a single place, perhaps in
lib/setup.h and make our own struct if it isn't already existing, like:
#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
struct sockaddr_storage {
char buffer[256]; /* this should be big enough to fit a lot */
};
#endif
> 2. When pointers to such variables are passed as arguments to system
> calls, they must now be explicitly cast
> as "struct sockaddr *".
>
> With these changes, TFTP via IPv6 seems to work fine.
Cool!
> Let me know if more information is needed. I can submit my modified tftp.c
> file if that's useful.
If you could address the sockaddr_storage concern first, and then make a patch
and post it to us, I'll happily incorporate your changes to the main sources!
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2005-11-08