ncftpget, ncftpput で送信元アドレスを指定するパッチを貼り付け。あんまチェックとかしていないけど、とりあえずなら使えたので。
diff -ubBr ncftp-3.2.0/libncftp/ftp.c ncftp-3.2.0-bind/libncftp/ftp.c
--- ncftp-3.2.0/libncftp/ftp.c 2005-01-02 06:27:07.000000000 +0900
+++ ncftp-3.2.0-bind/libncftp/ftp.c 2007-09-09 16:37:07.000000000 +0900
@@ -88,6 +88,16 @@
return (result);
} /* GetSocketAddress */
+static int
+SetSocketAddress(int sockfd, struct sockaddr_in *saddr)
+{
+ saddr->sin_family = AF_INET;
+ saddr->sin_port = 0;
+
+ return bind(sockfd, (struct sockaddr *) saddr, sizeof(struct sockaddr_in));
+} /* SetSocketAddress */
+
+
@@ -286,7 +296,7 @@
* size specified.
*/
(void) SetSocketBufSize(sockfd, cip->ctrlSocketRBufSize, cip->ctrlSocketSBufSize);
-
+ (void) SetSocketAddress(sockfd, &cip->ourCtlAddr);
#ifdef NO_SIGNALS
err = SConnect(sockfd, &cip->servCtlAddr, (int) cip->connTimeout);
diff -ubBr ncftp-3.2.0/sh_util/ncftpget.c ncftp-3.2.0-bind/sh_util/ncftpget.c
--- ncftp-3.2.0/sh_util/ncftpget.c 2006-08-12 08:36:34.000000000 +0900
+++ ncftp-3.2.0-bind/sh_util/ncftpget.c 2007-09-09 17:17:21.000000000 +0900
@@ -228,7 +228,7 @@
perfilecmd[0] = '\0';
GetoptReset(&opt);
- while ((c = Getopt(&opt, argc, argv, "P:u:j:p:h:e:d:t:aRTr:vVf:ADzZEFbcCB:W:X:Y:")) > 0) {
+ while ((c = Getopt(&opt, argc, argv, "P:u:j:p:h:e:d:t:aRTr:vVf:ADzZEFbcCB:W:X:Y:L:")) > 0) {
if (c == 'b') {
batchmode++;
}
@@ -247,7 +247,7 @@
}
GetoptReset(&opt);
- while ((c = Getopt(&opt, argc, argv, "P:u:j:p:h:e:d:t:aRTr:vVf:o:ADzZEFbcCB:W:X:Y:")) > 0) switch(c) {
+ while ((c = Getopt(&opt, argc, argv, "P:u:j:p:h:e:d:t:aRTr:vVf:o:ADzZEFbcCB:W:X:Y:L:")) > 0) switch(c) {
case 'P':
fi.port = atoi(opt.arg);
break;
@@ -363,6 +363,11 @@
case 'C':
ftpcat = 2;
break;
+ case 'L':
+ if (inet_pton(AF_INET, opt.arg, &fi.ourCtlAddr.sin_addr) <= 0) {
+ (void) fprintf(stderr, "Warning: could not resolve address specified by -L flag: %s\n", opt.arg);
+ }
+ break;
default:
Usage();
}
diff -ubBr ncftp-3.2.0/sh_util/ncftpput.c ncftp-3.2.0-bind/sh_util/ncftpput.c
--- ncftp-3.2.0/sh_util/ncftpput.c 2006-08-12 08:36:29.000000000 +0900
+++ ncftp-3.2.0-bind/sh_util/ncftpput.c 2007-09-09 17:17:51.000000000 +0900
@@ -230,7 +230,7 @@
perfilecmd[0] = '\0';
GetoptReset(&opt);
- while ((c = Getopt(&opt, argc, argv, "P:u:j:p:h:e:d:U:t:mar:RvVf:o:AT:S:EFcCyZzDbB:W:X:Y:")) > 0) {
+ while ((c = Getopt(&opt, argc, argv, "P:u:j:p:h:e:d:U:t:mar:RvVf:o:AT:S:EFcCyZzDbB:W:X:Y:L:")) > 0) {
if (c == 'b') {
batchmode++;
}
@@ -250,7 +250,7 @@
}
GetoptReset(&opt);
- while ((c = Getopt(&opt, argc, argv, "P:u:j:p:h:e:d:U:t:mar:RvVf:o:AT:S:EFcCyZzDbB:W:X:Y:")) > 0) switch(c) {
+ while ((c = Getopt(&opt, argc, argv, "P:u:j:p:h:e:d:U:t:mar:RvVf:o:AT:S:EFcCyZzDbB:W:X:Y:L:")) > 0) switch(c) {
case 'P':
fi.port = atoi(opt.arg);
break;
@@ -380,6 +380,11 @@
STRNCAT(postcmd, opt.arg);
STRNCAT(postcmd, "\n");
break;
+ case 'L':
+ if (inet_pton(AF_INET, opt.arg, &fi.ourCtlAddr.sin_addr) <= 0) {
+ (void) fprintf(stderr, "Warning: could not resolve address specified by -L flag: %s\n", opt.arg);
+ }
+ break;
default:
iperf のソース見難いなぁ。ttcp.c とかの方が良い?