Module Name: src Committed By: riastradh Date: Fri Mar 1 23:50:28 UTC 2024
Modified Files: src/sys/netinet6: in6.c Log Message: netinet6: Avoid NPD on `ifconfig ifN inet6 ... pltime 0 vltime 0'. PR kern/53922 To generate a diff of this commit: cvs rdiff -u -r1.291 -r1.292 src/sys/netinet6/in6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet6/in6.c diff -u src/sys/netinet6/in6.c:1.291 src/sys/netinet6/in6.c:1.292 --- src/sys/netinet6/in6.c:1.291 Sat Dec 9 15:21:02 2023 +++ src/sys/netinet6/in6.c Fri Mar 1 23:50:27 2024 @@ -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 c 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;