summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrob <rob@openbsd.org>2017-08-12 04:40:47 +0000
committerrob <rob@openbsd.org>2017-08-12 04:40:47 +0000
commit36c807e046858ca8806b5d780e19f96469730df9 (patch)
tree3e0e5fb1bca0df461300185d1954efb89fbb3f52
parentInitial pledge for snmpd. snmpe remains unpledged. Regression tests pass. (diff)
downloadwireguard-openbsd-36c807e046858ca8806b5d780e19f96469730df9.tar.xz
wireguard-openbsd-36c807e046858ca8806b5d780e19f96469730df9.zip
Use vether instead of physical interfaces for temporary carp creation.
Recommended by and discussed with many.
-rw-r--r--regress/usr.sbin/ifstated/ifstated15
1 files changed, 8 insertions, 7 deletions
diff --git a/regress/usr.sbin/ifstated/ifstated b/regress/usr.sbin/ifstated/ifstated
index 26142ecc74c..6c5ceff7158 100644
--- a/regress/usr.sbin/ifstated/ifstated
+++ b/regress/usr.sbin/ifstated/ifstated
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: ifstated,v 1.3 2017/07/31 18:41:21 rob Exp $
+# $OpenBSD: ifstated,v 1.4 2017/08/12 04:40:47 rob Exp $
#/*
# * Copyright (c) Rob Pierce <rob@2keys.ca>
# *
@@ -31,6 +31,7 @@ SLEEP=10
cleanup() {
ifconfig carp${VHIDA} destroy > /dev/null 2>&1
ifconfig carp${VHIDB} destroy > /dev/null 2>&1
+ ifconfig vether${VHIDB} destroy > /dev/null 2>&1
rm working/ifstated.conf >/dev/null 2>&1
rm working/ifstated.log >/dev/null 2>&1
rm working/output.test >/dev/null 2>&1
@@ -53,15 +54,15 @@ skip() {
trap 'skip' INT
-# look for a suitable physical interface for carp
-NIC="$(netstat -rn -finet | grep ^default | awk '{ print $8 }')"
-STATUS="$(ifconfig | grep -A5 ^${NIC} | grep status: | awk '{ print $2 }')"
-
-if [ "$STATUS" != "active" ]
+ifconfig vether${VHIDB} create >/dev/null 2>&2
+if [ $? -ne 0 ]
then
- echo "No suitable physical interface found."
+ echo "Could not create temporary vether interface."
echo SKIPPED
exit 0
+else
+ ifconfig vether${VHIDB} up
+ NIC=vether${VHIDB}
fi
if [ "$(pgrep ifstated)" ]