I have the following line in my fstab: [2a01:e0a:e0e:5dd0:2e0:4cff:fe2a:2ad1]:/media/data /media/data nfs defaults 0 0. I was trying to debug why this mount disconnects at random times, even if I mount it by hand, and today I realized that it’s related to vpn and wifi connections going down. Through the docs I found that upon a network disconnect a script at /usr/lib/NetworkManager/dispatcher.d/nfs is ran. Here’s what I get when running this script by hand:
~> /usr/lib/NetworkManager/dispatcher.d/nfs wg0 down
ping: [2a01: Name or service not known
ping: [2a01: Name or service not known
ping: [2a01: Name or service not known
ping: [2a01: Name or service not known
Looks like it’s related to two things in this script:
-
On line 81:
HOST=$(echo $line | cut -f1 -d":")-$linebeing a line from fstab - splits on colon to get the host. But the colon is a valid character in an ipv4 address, so it’s invalid to simply split on it -
On line 19, the host in
$2is passed to ping. But an ipv6 address in fstab is enclosed in[], while ping doesn’t understand this address format for some reason
I think the parsing logic on line 81 should first test for a leading [, and then cut until a matching ] if present, or until first : if not. Thus the address passed down would be valid for both inet types