diff options
author | 2018-02-19 21:47:43 +0000 | |
---|---|---|
committer | 2018-02-19 21:47:43 +0000 | |
commit | 375c217e66fac39856296d4dbc5eda9b54a3454a (patch) | |
tree | c5ae68288c6ba6791f11bbe427f63ab9328ee585 | |
parent | Support ISO colon-separated SGR. (diff) | |
download | wireguard-openbsd-375c217e66fac39856296d4dbc5eda9b54a3454a.tar.xz wireguard-openbsd-375c217e66fac39856296d4dbc5eda9b54a3454a.zip |
- use specific patterns when looping over /etc/hostname.if files
to skip backup or temp files.
- test if the patterns matched actual files
- warn if ifcreate() fails on an interface and continue with the
subsequent interfaces in the list instead of return'ing
OK dlg sthen tb
-rw-r--r-- | etc/netstart | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/etc/netstart b/etc/netstart index 3219b727c8d..ee7f9c917c6 100644 --- a/etc/netstart +++ b/etc/netstart @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: netstart,v 1.192 2018/02/17 13:11:03 rpe Exp $ +# $OpenBSD: netstart,v 1.193 2018/02/19 21:47:43 rpe Exp $ # Turn off Strict Bourne shell mode. set +o sh @@ -84,11 +84,13 @@ vifscreate() { local _vif _hn _if for _vif in $(ifconfig -C); do - for _hn in /etc/hostname.${_vif}*; do + for _hn in /etc/hostname.${_vif}+([[:digit:]]); do [[ -f $_hn ]] || continue _if=${_hn#/etc/hostname.} - ifcreate $_if || return + if ! ifcreate $_if; then + echo "${0##*/}: create for '$_if' failed." + fi done done } @@ -149,9 +151,9 @@ ifmstart() { local _sifs=$1 _xifs=$2 _hn _if _sif _xif for _sif in ${_sifs:-ALL}; do - for _hn in /etc/hostname.*; do + for _hn in /etc/hostname.+([[:alpha:]])+([[:digit:]]); do + [[ -f $_hn ]] || continue _if=${_hn#/etc/hostname.} - [[ $_if == '*' ]] && continue # Skip unwanted ifs. for _xif in $_xifs; do |