diff options
author | 2018-02-17 13:11:03 +0000 | |
---|---|---|
committer | 2018-02-17 13:11:03 +0000 | |
commit | d7d558510a6df2ab417a197aa2db13d67e40e0dc (patch) | |
tree | 080052c601672a8c3ab7bcee4154ea908a217abf | |
parent | Fix behaviour of OpenSSL_version(). (diff) | |
download | wireguard-openbsd-d7d558510a6df2ab417a197aa2db13d67e40e0dc.tar.xz wireguard-openbsd-d7d558510a6df2ab417a197aa2db13d67e40e0dc.zip |
- Add descriptions for the new functions ifcreate() and vifscreate()
- In ifcreate() use the exit code of the {} block directly
- In vifscreate(), use the ifconfig -C output directly in the for _vif loop
- Remove superfluous and somewhat confusing comment
OK dlg kn sthen
-rw-r--r-- | etc/netstart | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/etc/netstart b/etc/netstart index 4a04e733e40..3219b727c8d 100644 --- a/etc/netstart +++ b/etc/netstart @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: netstart,v 1.191 2018/02/14 22:08:45 dlg Exp $ +# $OpenBSD: netstart,v 1.192 2018/02/17 13:11:03 rpe Exp $ # Turn off Strict Bourne shell mode. set +o sh @@ -72,21 +72,22 @@ parse_hn_line() { set +o noglob } +# Create interface $1 if it does not yet exist. ifcreate() { local _if=$1 - { ifconfig $_if || ifconfig $_if create; } >/dev/null 2>&1 || return + { ifconfig $_if || ifconfig $_if create; } >/dev/null 2>&1 } +# Create interfaces for network pseudo-devices referred to by hostname.if files. vifscreate() { - local _vifs=$(ifconfig -C) _vif _hn _if + local _vif _hn _if - for _vif in ${_vifs}; do + for _vif in $(ifconfig -C); do for _hn in /etc/hostname.${_vif}*; do [[ -f $_hn ]] || continue _if=${_hn#/etc/hostname.} - # Create wanted ifs. ifcreate $_if || return done done |