Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Net::ftp && IPv6

by Loops (Curate)
on Nov 11, 2014 at 12:43 UTC ( #1106811=note: print w/replies, xml ) Need Help??

in reply to Net::ftp && IPv6


That whole %eth0 thing is new to me, never seen it used. And if you look at your strace the link-local scope id is still 0. So you're right, the %eth0 isn't being recognized. Try using "ifconfig eth0" to see what its actual scope id is listed as, and use that number after the % instead of "eth0".

Replies are listed 'Best First'.
Re^2: Net::ftp && IPv6
by gurucubano (Initiate) on Nov 11, 2014 at 13:05 UTC
    Hello, Thanks for your feedback. The ifconfig shows the interface as:
    $ /sbin/ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:50:56:B6:53:10 inet addr: Bcast: Mask:255.255.255. +0 inet6 addr: fe80::250:56ff:feb6:5310/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:12739003 errors:0 dropped:0 overruns:0 frame:0 TX packets:4630164 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3144021160 (2998.3 Mb) TX bytes:991348328 (945.4 M +b)
    Re/ %eth0: one has to specify in the link-local addr the interface because theoretically all interfaces could have the same addr; and I think, it is fully correct, because the perl script can connect fine and can login; but only the filetransfer does not work; I assume this is somewhere an issue in th Perl methods; if you look for the addr in the strace output, you will see, tehat the $eth0 is used in all places, but only in the last BIND not:
    fgrep fe80::250:56ff:feb6:5310 tr connect(3, {sa_family=AF_INET6, sin6_port=htons(21), inet_pton(AF_INET +6, "fe80::250:56ff:feb6:5310", &sin6_addr), sin6_flowinfo=0, sin6_sco +pe_id=if_nametoindex("eth0")}, 28) = -1 EINPROGRESS (Operation now in + progress) connect(3, {sa_family=AF_INET6, sin6_port=htons(21), inet_pton(AF_INET +6, "fe80::250:56ff:feb6:5310", &sin6_addr), sin6_flowinfo=0, sin6_sco +pe_id=if_nametoindex("eth0")}, 28) = 0 getsockname(3, {sa_family=AF_INET6, sin6_port=htons(47829), inet_pton( +AF_INET6, "fe80::250:56ff:feb6:5310", &sin6_addr), sin6_flowinfo=0, s +in6_scope_id=if_nametoindex("eth0")}, [28]) = 0 bind(4, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, " +fe80::250:56ff:feb6:5310", &sin6_addr), sin6_flowinfo=0, sin6_scope_i +d=0}, 28) = -1 EINVAL (Invalid argument)


      when I do a small change (hardcoded, just for test) in Net/INET6Glue/
      $ diff /usr/local/sisis-pap/perl5.16.2/lib/site_perl/5.16.2/Net/INET6G +lue/* 30c30 < LocalAddr => $ftp->sockhost, --- > LocalAddr => 'fe80::250:56ff:feb6:5310%eth0'
      the transfer of the data works:
      Net::FTP=GLOB(0x83b0080)<<< 150 Here comes the directory listing. Net::FTP=GLOB(0x83b0080)<<< 226 Directory send OK. file: file file: tr Net::FTP=GLOB(0x83b0080)>>> EPRT |2|fe80::250:56ff:feb6:5310|35672| Net::FTP=GLOB(0x83b0080)<<< 200 EPRT command successful. Consider usin +g EPSV. Net::FTP=GLOB(0x83b0080)>>> RETR file Net::FTP=GLOB(0x83b0080)<<< 150 Opening BINARY mode data connection fo +r file (12 bytes). Net::FTP=GLOB(0x83b0080)<<< 226 File send OK. Net::FTP=GLOB(0x83b0080)>>> QUIT Net::FTP=GLOB(0x83b0080)<<< 221 Goodbye.
      this underpins that somehow on the way down the %eth0 is droped off the $ftp->sockhost;

        Strange. It all just works here in passive mode, and the non-passive case is explainable. When I add the following print to your code, i get the %eth0:

        my $ftp = Net::FTP->new($ipaddr, Debug=>1, Passive=>1) or die "Can't c +onnect: $@\n"; print $ftp->sockhost;

        I'm guessing by this point it's already missing for you? Using Net::FTP 3.02 and IO::Socket::INET is 1.35 here.

        As a digression, my ifconfig shows a scope id of "2" for my eth0 device. When I then use %2 at the end of the ip address, Net::FTP automatically replaces it with %eth0. While that's new to me, it's obviously supported. However Net::FTP violates RFC 2428 by including that in the EPRT command in the non-passive case. I had to do rule rewriting in my Proftpd server to strip it off before things would work.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1106811]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2022-05-21 05:57 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (76 votes). Check out past polls.