netinet6: Avoid NPD on `ifconfig ifN inet6 ... pltime 0 vltime 0'.

PR kern/53922
This commit is contained in:
riastradh 2024-03-01 23:50:27 +00:00
parent a4e8759c9c
commit 24b94ff041
1 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6.c,v 1.291 2023/12/09 15:21:02 pgoyette Exp $ */
/* $NetBSD: in6.c,v 1.292 2024/03/01 23:50:27 riastradh Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.291 2023/12/09 15:21:02 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.292 2024/03/01 23:50:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -726,7 +726,14 @@ in6_control1(struct socket *so, u_long cmd, void *data, struct ifnet *ifp)
int s = splsoftnet();
error = in6_update_ifa1(ifp, ifra, &ia, &psref, 0);
splx(s);
if (error)
/*
* in6_update_ifa1 doesn't create the address if its
* valid lifetime (vltime) is zero, since we would just
* delete the address immediately in that case anyway.
* So it may succeed but return null ia. In that case,
* nothing left to do.
*/
if (error || ia == NULL)
break;
pfil_run_addrhooks(if_pfil, cmd, &ia->ia_ifa);
break;