ifconfig: Reuse media state in ifmedia_getstate

This restores behavior lost in code cleanup, fixing a regression after
2803fa471e 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
This commit is contained in:
Ryan Moeller 2021-04-15 22:32:25 -04:00
parent 77c89fa6f5
commit 407fb44c92

View File

@ -159,7 +159,10 @@ media_status(int s)
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),