1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-29 16:47:15 +00:00

Deny negative values for `ip6_maxdynroutes'.

Negative value allows unlimited count of redirect routes.

By default previously modified `ip6_neighborgcthresh' and
`ip6_maxdynroutes' are positive. I doubt someone sets them to '-1' with
current. No reason to wait API change fallout.

ok bluhm
This commit is contained in:
mvs
2025-08-03 11:12:58 +00:00
parent b7e3f4fc96
commit 86b533b794
2 changed files with 4 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: icmp6.c,v 1.274 2025/08/03 11:08:40 mvs Exp $ */
/* $OpenBSD: icmp6.c,v 1.275 2025/08/03 11:12:58 mvs Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1292,7 +1292,6 @@ icmp6_redirect_input(struct mbuf *m, int off)
struct sockaddr_in6 ssrc;
unsigned long rtcount;
struct rtentry *newrt = NULL;
int ip6_maxdynroutes_local = atomic_load_int(&ip6_maxdynroutes);
/*
* do not install redirect route, if the number of entries
@@ -1301,8 +1300,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
* (there will be additional hops, though).
*/
rtcount = rt_timer_queue_count(&icmp6_redirect_timeout_q);
if (ip6_maxdynroutes_local >= 0 &&
rtcount >= ip6_maxdynroutes_local)
if (rtcount >= atomic_load_int(&ip6_maxdynroutes))
goto freeit;
bzero(&sdst, sizeof(sdst));

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: ip6_input.c,v 1.295 2025/08/03 04:11:57 mvs Exp $ */
/* $OpenBSD: ip6_input.c,v 1.296 2025/08/03 11:12:58 mvs Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -1460,7 +1460,7 @@ const struct sysctl_bounded_args ipv6ctl_vars[] = {
{ IPV6CTL_MFORWARDING, &ip6_mforwarding, 0, 1 },
{ IPV6CTL_MCAST_PMTU, &ip6_mcast_pmtu, 0, 1 },
{ IPV6CTL_NEIGHBORGCTHRESH, &ip6_neighborgcthresh, 0, 5 * 2048 },
{ IPV6CTL_MAXDYNROUTES, &ip6_maxdynroutes, -1, 5 * 4096 },
{ IPV6CTL_MAXDYNROUTES, &ip6_maxdynroutes, 0, 5 * 4096 },
};
int