From 8e687f4230919c44ff4d971ed7d1c484e6b010ea Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 18 Mar 2021 15:57:16 +0000 Subject: [PATCH] Do not call rtm_ifchg() if IFF_UP changed. The code in if_up() and if_down() already call rtm_ifchg() and so this would just result in a duplicate message. Noticed by deraadt@. OK florian@ bluhm@ --- sys/net/if.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 3e40c59d213..72a25fb7932 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.636 2021/03/11 16:48:47 florian Exp $ */ +/* $OpenBSD: if.c,v 1.637 2021/03/18 15:57:16 claudio Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -2284,8 +2284,11 @@ forceup: break; } - if (oif_flags != ifp->if_flags || oif_xflags != ifp->if_xflags) - rtm_ifchg(ifp); + if (oif_flags != ifp->if_flags || oif_xflags != ifp->if_xflags) { + /* if_up() and if_down() already sent an update, skip here */ + if (((oif_flags ^ ifp->if_flags) & IFF_UP) == 0) + rtm_ifchg(ifp); + } if (((oif_flags ^ ifp->if_flags) & IFF_UP) != 0) getmicrotime(&ifp->if_lastchange); -- 2.20.1