From fd101f5348b0e38948b622b0f4740f0f3412cec7 Mon Sep 17 00:00:00 2001 From: mvs Date: Thu, 21 Jan 2021 13:18:07 +0000 Subject: [PATCH] carp(4): convert ifunit() to if_unit(9) ok dlg@ bluhm@ --- sys/netinet/ip_carp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index f021f0e2792..00d5fe91512 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.350 2021/01/04 15:02:34 sashan Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.351 2021/01/21 13:18:07 mvs Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -2021,16 +2021,19 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) break; error = 1; if (carpr.carpr_carpdev[0] != '\0' && - (ifp0 = ifunit(carpr.carpr_carpdev)) == NULL) + (ifp0 = if_unit(carpr.carpr_carpdev)) == NULL) return (EINVAL); if (carpr.carpr_peer.s_addr == 0) sc->sc_peer.s_addr = INADDR_CARP_GROUP; else sc->sc_peer.s_addr = carpr.carpr_peer.s_addr; if (ifp0 != NULL && ifp0->if_index != sc->sc_carpdevidx) { - if ((error = carp_set_ifp(sc, ifp0))) + if ((error = carp_set_ifp(sc, ifp0))) { + if_put(ifp0); return (error); + } } + if_put(ifp0); if (vhe->state != INIT && carpr.carpr_state != vhe->state) { switch (carpr.carpr_state) { case BACKUP: -- 2.20.1