aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2023-01-14 22:58:41 +0000
committerSam James <sam@gentoo.org>2023-01-15 01:51:20 +0000
commit1601d0dbed5d0373f0e19f90f07612bf60c59184 (patch)
tree9a420865436231514fe8cd06a5484fee71086add /net/netplugd.sh
parentnet/hsr: add Parallel Redundancy Protocol (PRP) support (diff)
downloadnetifrc-1601d0dbed5d0373f0e19f90f07612bf60c59184.tar.gz
netifrc-1601d0dbed5d0373f0e19f90f07612bf60c59184.tar.bz2
netifrc-1601d0dbed5d0373f0e19f90f07612bf60c59184.zip
net/l2tp.sh: Rewrite to address issues of POSIX conformance (and more besides)
Ensure that awk(1) is used portably throughout. Eliminate the use of ${parameter^^} expansion syntax, which is a bashism. Delegate netfirc parameter parsing to xargs(1) and awk(1). The potential for code injection is thus eliminated, to the extent that is currently possible in netifrc. It also eliminates potential issues pertaining to word splitting and unintentional pathname expansion. Add additional sanity checks and increase the rigour of those that exist. For instance, blank values are no longer permitted and the tunnel_id parameter must match that of l2tpsession_*, in the case that l2tptunnel_* is defined. Add additional diagnostic messages while improving the clarity of those that already existed. This is achieved in some instances by being more precise and, in others, through the use of English that exhibits greater formality and consistency. At least one grammatical error was rectified. Simplify and refine the code in terms of both structure and syntax, and greatly reduce the number of (local) variables. As a byproduct, all complaints previously raised by shellcheck have been eliminated, save for the use of local, whose behaviour is not defined by POSIX. I have not attempted to eliminate the use of local because, for now, it continues to be used extensively throughout the netifrc codebase. Honour the exit status value of ip(8) for the "add" and "del" verbs, rather than parse STDERR. Optimise l2tp_post_stop() by refraining from executing ip(8) and awk(8) in the case that the interface cannot be identifed as a virtual one. Further, do not attempt to destroy the tunnels associated with an identified session in the case that the attempt to destroy the session has failed. Signed-off-by: Kerin Millar <kfm@plushkava.net> Bug: https://bugs.gentoo.org/890238 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net/netplugd.sh')
0 files changed, 0 insertions, 0 deletions