ifupdown.sh: improve error handling