curl-users
RE: TFTP via IPv6
Date: Thu, 10 Nov 2005 13:20:11 -0500
I've attached a patch file containing my changes. As suggested, I
updated lib/setup.h to define a makeshift "struct sockaddr_storage" in
the event that this structure is not defined elsewhere. The
corresponding (and now obsolete) #ifdef logic was removed from
lib/ftp.c.
Let me know if there are any issues with the patch.
Dave L.
-----Original Message-----
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Tuesday, November 08, 2005 11:06 AM
To: the curl tool
Subject: Re: TFTP via IPv6
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.html
- application/octet-stream attachment: tftp-ipv6.patch