- On a Linuxserver Ftp.put didnt work, gave error. Tests revealed, that only active mode was bugged, passive mode upload went through.
Can't call method "sockdomain" on an undefined value at /usr/share/perl/5.36/Net/FTP.pm line 913. - Similar error occurs here: https://www.perlmonks.org/?node_id=1106790. Overwriting Net::FTP
LocalAddr => $ftp->sockhost, as described there, removed error, but ftp.put still didnt work. Something with the ip-config 'ifconfig' was wrong, 'ping localhost' showed ipv6. - Tested disabling ipv6 as described in https://bobcares.com/blog/debian-12-disable-ipv6/. This way ipv6 is disabled only for the session, not after 'reboot'. Now ping was ipv4, ifconfig didnt show ipv6 and ftp.put works.
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 - Reenabled ipv6, in 'ifconfig' ipv6 returned, but one ipv6 line was missing. The line returned after 'reboot'.
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 - To keep ipv6 enabled, an approach is to priorize ipv4 over ipv6. Explained in https://weblog.lkiesow.de/20220311-make-linux-prefer-ipv4.html, this can be done by editing
/etc/gai.conf. In the file all lines were commented out. Its needed to uncomment the whole blocklabelandprecedence, except the last line for which another line with priority 100 is uncommented. After the edit, without 'reboot' needed, ping shows ipv4 and ftp.put works.#precedence ::ffff:0:0/96 10 # For sites which prefer IPv4 connections change the last line to precedence ::ffff:0:0/96 100
Conclusion: Who is to blame, is this a perl-ftp bug, that priority ipv6 cannot be handled? In any case, a nullpointer exception shouldnt occur. It would be interesting to test commandline ftp, if it can do active mode put with initial config.