sync with OpenBSD -current

This commit is contained in:
purplerain 2024-07-16 03:02:11 +00:00
parent bc7421a947
commit 4cca26dc5a
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
120 changed files with 4168 additions and 640 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: icmp6.c,v 1.253 2024/06/20 19:25:42 bluhm Exp $ */
/* $OpenBSD: icmp6.c,v 1.254 2024/07/14 18:53:39 bluhm Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@ -1228,6 +1228,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
char *lladdr = NULL;
int lladdrlen = 0;
struct rtentry *rt = NULL;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
int is_router;
int is_onlink;
struct in6_addr src6 = ip6->ip6_src;
@ -1241,7 +1242,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
return;
/* if we are router, we don't update route by icmp6 redirect */
if (ip6_forwarding != 0)
if (i_am_router)
goto freeit;
if (!(ifp->if_xflags & IFXF_AUTOCONF6))
goto freeit;
@ -1366,7 +1367,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
/* RFC 2461 8.3 */
nd6_cache_lladdr(ifp, &redtgt6, lladdr, lladdrlen, ND_REDIRECT,
is_onlink ? ND_REDIRECT_ONLINK : ND_REDIRECT_ROUTER);
is_onlink ? ND_REDIRECT_ONLINK : ND_REDIRECT_ROUTER, i_am_router);
if (!is_onlink) { /* better router case. perform rtredirect. */
/* perform rtredirect */
@ -1438,11 +1439,12 @@ icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt)
size_t maxlen;
u_char *p;
struct sockaddr_in6 src_sa;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
icmp6_errcount(ND_REDIRECT, 0);
/* if we are not router, we don't send icmp6 redirect */
if (ip6_forwarding == 0)
if (!i_am_router)
goto fail;
/* sanity check */