aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorRyan Moeller <freqlabs@FreeBSD.org>2021-04-16 02:32:25 +0000
committerRyan Moeller <freqlabs@FreeBSD.org>2021-04-16 02:32:25 +0000
commit407fb44c920a580a30dfe7d1add796a7b35a5ac7 (patch)
tree377eb439fd5d010a59241424473ffb077536d93f /sbin/ifconfig
parent77c89fa6f5cd39c150524e04df1e7330c835229f (diff)
downloadsrc-407fb44c920a580a30dfe7d1add796a7b35a5ac7.tar.gz
src-407fb44c920a580a30dfe7d1add796a7b35a5ac7.zip
ifconfig: Reuse media state in ifmedia_getstate
This restores behavior lost in code cleanup, fixing a regression after 2803fa471e77dc8f227fe00bbf075de7feb10022 where changing media options only applies some of the changes, not all. Reported by: np Reviewed by: donner MFC after: immediately Differential Revision: https://reviews.freebsd.org/D29741
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/ifmedia.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index 66eb40254889..aacf34a13248 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -159,7 +159,10 @@ free:
struct ifmediareq *
ifmedia_getstate(void)
{
- static struct ifmediareq *ifmr;
+ static struct ifmediareq *ifmr = NULL;
+
+ if (ifmr != NULL)
+ return (ifmr);
if (ifconfig_media_get_mediareq(lifh, name, &ifmr) == -1)
errc(1, ifconfig_err_errno(lifh),