summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2019-04-29 23:50:35 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2019-04-29 23:50:35 +0000
commit8436fd1223c3f2ccd82029e2dc6d56e46b0592ae (patch)
treeb95e13a8faf349ef66f6eb3d74a362395832bbea
parent026b3707426458759e8413106c35bf5949700714 (diff)
Make v[46]_info() return all the interface flags instead of just
deducing that the interface is up or down. Check for "UP," in the returned flags where a return value of UP was used previously. ok kn@ with feedback/optimizations to be pondered further.
-rw-r--r--distrib/miniroot/install.sub21
1 files changed, 7 insertions, 14 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index cf1a2b9e061..97a33255df0 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1117 2019/04/25 17:18:52 florian Exp $
+# $OpenBSD: install.sub,v 1.1118 2019/04/29 23:50:34 krw Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -903,14 +903,11 @@ __EOT
}
# Obtain and output the inet information related to interface $1.
-# Outputs one of:
-# DOWN
-# UP
-# UP\n<addr> <netmask> <rest of inet line>[\n<more inet lines>]
+# Outputs:
+# <flags>\n<addr> <netmask> <rest of inet line>[\n<more inet lines>]
v4_info() {
ifconfig $1 inet | sed -n '
- 1s/.*<UP,.*/UP/p
- 1s/.*<.*/DOWN/p
+ 1s/.*flags=.*<\(.*\)>.*/\1/p
/inet/s/netmask //
/.inet /s///p'
}
@@ -1069,14 +1066,10 @@ v4_config() {
}
# Obtain and output the inet6 information related to interface $1.
-# Outputs one of:
-# DOWN
-# UP
-# UP\n<addr> <prefixlen> <rest of inet6 line>[\n<more inet6 lines>]
+# <flags>\n<addr> <prefixlen> <rest of inet6 line>[\n<more inet6 lines>]
v6_info() {
ifconfig $1 inet6 | sed -n '
- 1s/.*<UP,.*/UP/p
- 1s/.*<.*/DOWN/p
+ 1s/.*flags=.*<\(.*\)>.*/\1/p
/scopeid/d
/inet6/s/prefixlen //
/.inet6 /s///p'
@@ -3275,7 +3268,7 @@ umount -af >/dev/null 2>&1
# Make sure only successful dhcp requests retain their state.
for _if in $(get_ifs dhcp); do
set -- $(v4_info $_if)
- [[ $1 == UP && -n $2 ]] && continue
+ [[ $1 == @(UP,*) && -n $2 ]] && continue
ifconfig $_if delete down -group dhcp 2>/dev/null
done