sync with OpenBSD -current
This commit is contained in:
parent
c151d49b7a
commit
be76e7e421
96 changed files with 2153 additions and 617 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_ether.h,v 1.90 2023/07/27 20:21:25 jan Exp $ */
|
||||
/* $OpenBSD: if_ether.h,v 1.91 2024/02/13 13:58:19 bluhm Exp $ */
|
||||
/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -307,6 +307,9 @@ struct ether_extracted {
|
|||
struct ip6_hdr *ip6;
|
||||
struct tcphdr *tcp;
|
||||
struct udphdr *udp;
|
||||
u_int ip4hlen;
|
||||
u_int tcphlen;
|
||||
u_int paylen;
|
||||
};
|
||||
|
||||
void ether_extract_headers(struct mbuf *, struct ether_extracted *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in.h,v 1.147 2024/02/09 14:02:11 bluhm Exp $ */
|
||||
/* $OpenBSD: in.h,v 1.148 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -789,8 +789,6 @@ void in_len2mask(struct in_addr *, int);
|
|||
int in_nam2sin(const struct mbuf *, struct sockaddr_in **);
|
||||
int in_sa2sin(struct sockaddr *, struct sockaddr_in **);
|
||||
|
||||
int route_cache(struct route *, struct in_addr, u_int);
|
||||
|
||||
char *inet_ntoa(struct in_addr);
|
||||
int inet_nat64(int, const void *, void *, const void *, u_int8_t);
|
||||
int inet_nat46(int, const void *, void *, const void *, u_int8_t);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_pcb.c,v 1.292 2024/02/11 01:27:45 bluhm Exp $ */
|
||||
/* $OpenBSD: in_pcb.c,v 1.293 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -920,7 +920,7 @@ in_pcbrtentry(struct inpcb *inp)
|
|||
if (inp->inp_faddr.s_addr == INADDR_ANY)
|
||||
return (NULL);
|
||||
if (route_cache(ro, inp->inp_faddr, inp->inp_rtableid)) {
|
||||
ro->ro_rt = rtalloc_mpath(&ro->ro_dst,
|
||||
ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa,
|
||||
&inp->inp_laddr.s_addr, ro->ro_tableid);
|
||||
}
|
||||
return (ro->ro_rt);
|
||||
|
@ -984,7 +984,7 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin,
|
|||
*/
|
||||
if (route_cache(ro, sin->sin_addr, rtableid)) {
|
||||
/* No route yet, so try to acquire one */
|
||||
ro->ro_rt = rtalloc_mpath(&ro->ro_dst, NULL, ro->ro_tableid);
|
||||
ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, NULL, ro->ro_tableid);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_pcb.h,v 1.151 2024/02/11 01:27:45 bluhm Exp $ */
|
||||
/* $OpenBSD: in_pcb.h,v 1.152 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -150,12 +150,7 @@ struct inpcb {
|
|||
u_int16_t inp_lport; /* [t] local port */
|
||||
struct socket *inp_socket; /* [I] back pointer to socket */
|
||||
caddr_t inp_ppcb; /* pointer to per-protocol pcb */
|
||||
union { /* Route (notice increased size). */
|
||||
struct route ru_route;
|
||||
struct route_in6 ru_route6;
|
||||
} inp_ru;
|
||||
#define inp_route inp_ru.ru_route
|
||||
#define inp_route6 inp_ru.ru_route6
|
||||
struct route inp_route; /* cached route */
|
||||
struct refcnt inp_refcnt; /* refcount PCB, delay memory free */
|
||||
struct mutex inp_mtx; /* protect PCB and socket members */
|
||||
int inp_flags; /* generic IP/datagram flags */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_carp.c,v 1.360 2023/12/23 10:52:54 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_carp.c,v 1.361 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
|
||||
|
@ -54,6 +54,7 @@
|
|||
#include <net/if_var.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/netisr.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include <crypto/sha1.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_input.c,v 1.388 2024/01/31 14:56:42 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_input.c,v 1.389 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1494,7 +1494,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt)
|
|||
route_cache(&ro, ip->ip_dst, m->m_pkthdr.ph_rtableid);
|
||||
if (!rtisvalid(rt)) {
|
||||
rtfree(rt);
|
||||
rt = rtalloc_mpath(&ro.ro_dst, &ip->ip_src.s_addr,
|
||||
rt = rtalloc_mpath(&ro.ro_dstsa, &ip->ip_src.s_addr,
|
||||
m->m_pkthdr.ph_rtableid);
|
||||
if (rt == NULL) {
|
||||
ipstat_inc(ips_noroute);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_output.c,v 1.394 2024/01/31 14:56:43 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_output.c,v 1.395 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -167,7 +167,7 @@ reroute:
|
|||
* destination and is still up. If not, free it and try again.
|
||||
*/
|
||||
route_cache(ro, ip->ip_dst, m->m_pkthdr.ph_rtableid);
|
||||
dst = satosin(&ro->ro_dst);
|
||||
dst = &ro->ro_dstsin;
|
||||
|
||||
if ((IN_MULTICAST(ip->ip_dst.s_addr) ||
|
||||
(ip->ip_dst.s_addr == INADDR_BROADCAST)) &&
|
||||
|
@ -185,7 +185,7 @@ reroute:
|
|||
struct in_ifaddr *ia;
|
||||
|
||||
if (ro->ro_rt == NULL)
|
||||
ro->ro_rt = rtalloc_mpath(&ro->ro_dst,
|
||||
ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa,
|
||||
&ip->ip_src.s_addr, ro->ro_tableid);
|
||||
|
||||
if (ro->ro_rt == NULL) {
|
||||
|
@ -253,7 +253,7 @@ reroute:
|
|||
* still points to the address in "ro". (It may have been
|
||||
* changed to point to a gateway address, above.)
|
||||
*/
|
||||
dst = satosin(&ro->ro_dst);
|
||||
dst = &ro->ro_dstsin;
|
||||
|
||||
/*
|
||||
* See if the caller provided any multicast options
|
||||
|
@ -455,7 +455,7 @@ sendit:
|
|||
rtfree(ro->ro_rt);
|
||||
ro->ro_tableid = orig_rtableid;
|
||||
ro->ro_rt = icmp_mtudisc_clone(
|
||||
satosin(&ro->ro_dst)->sin_addr, ro->ro_tableid, 0);
|
||||
ro->ro_dstsin.sin_addr, ro->ro_tableid, 0);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
|
@ -558,7 +558,8 @@ ip_output_ipsec_pmtu_update(struct tdb *tdb, struct route *ro,
|
|||
rt->rt_mtu = tdb->tdb_mtu;
|
||||
if (ro != NULL && ro->ro_rt != NULL) {
|
||||
rtfree(ro->ro_rt);
|
||||
ro->ro_rt = rtalloc(&ro->ro_dst, RT_RESOLVE, rtableid);
|
||||
ro->ro_rt = rtalloc(&ro->ro_dstsa, RT_RESOLVE,
|
||||
rtableid);
|
||||
}
|
||||
if (rt_mtucloned)
|
||||
rtfree(rt);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_var.h,v 1.112 2024/02/05 23:16:39 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_var.h,v 1.113 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -227,6 +227,7 @@ extern const struct pr_usrreqs rip_usrreqs;
|
|||
|
||||
extern struct rttimer_queue ip_mtudisc_timeout_q;
|
||||
extern struct pool ipqent_pool;
|
||||
struct rtentry;
|
||||
struct route;
|
||||
struct inpcb;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_input.c,v 1.400 2024/02/11 01:27:45 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_input.c,v 1.401 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -145,8 +145,8 @@ struct timeval tcp_ackdrop_ppslim_last;
|
|||
#define ND6_HINT(tp) \
|
||||
do { \
|
||||
if (tp && tp->t_inpcb && (tp->t_inpcb->inp_flags & INP_IPV6) && \
|
||||
rtisvalid(tp->t_inpcb->inp_route6.ro_rt)) { \
|
||||
nd6_nud_hint(tp->t_inpcb->inp_route6.ro_rt); \
|
||||
rtisvalid(tp->t_inpcb->inp_route.ro_rt)) { \
|
||||
nd6_nud_hint(tp->t_inpcb->inp_route.ro_rt); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
|
@ -3166,7 +3166,7 @@ syn_cache_put(struct syn_cache *sc)
|
|||
|
||||
/* Dealing with last reference, no lock needed. */
|
||||
m_free(sc->sc_ipopts);
|
||||
rtfree(sc->sc_route4.ro_rt);
|
||||
rtfree(sc->sc_route.ro_rt);
|
||||
|
||||
pool_put(&syn_cache_pool, sc);
|
||||
}
|
||||
|
@ -3578,13 +3578,8 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
|
|||
/*
|
||||
* Give the new socket our cached route reference.
|
||||
*/
|
||||
if (src->sa_family == AF_INET)
|
||||
inp->inp_route = sc->sc_route4; /* struct assignment */
|
||||
#ifdef INET6
|
||||
else
|
||||
inp->inp_route6 = sc->sc_route6;
|
||||
#endif
|
||||
sc->sc_route4.ro_rt = NULL;
|
||||
inp->inp_route = sc->sc_route; /* struct assignment */
|
||||
sc->sc_route.ro_rt = NULL;
|
||||
|
||||
am = m_get(M_DONTWAIT, MT_SONAME); /* XXX */
|
||||
if (am == NULL)
|
||||
|
@ -4152,7 +4147,7 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m, uint64_t now)
|
|||
if (inp != NULL)
|
||||
ip->ip_tos = inp->inp_ip.ip_tos;
|
||||
|
||||
error = ip_output(m, sc->sc_ipopts, &sc->sc_route4,
|
||||
error = ip_output(m, sc->sc_ipopts, &sc->sc_route,
|
||||
(ip_mtudisc ? IP_MTUDISC : 0), NULL,
|
||||
inp ? inp->inp_seclevel : NULL, 0);
|
||||
break;
|
||||
|
@ -4164,7 +4159,7 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m, uint64_t now)
|
|||
ip6->ip6_hlim = in6_selecthlim(inp);
|
||||
/* leave flowlabel = 0, it is legal and require no state mgmt */
|
||||
|
||||
error = ip6_output(m, NULL /*XXX*/, &sc->sc_route6, 0,
|
||||
error = ip6_output(m, NULL /*XXX*/, &sc->sc_route, 0,
|
||||
NULL, inp ? inp->inp_seclevel : NULL);
|
||||
break;
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_output.c,v 1.142 2024/02/11 01:27:45 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_output.c,v 1.143 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1109,7 +1109,7 @@ send:
|
|||
#endif
|
||||
}
|
||||
error = ip6_output(m, tp->t_inpcb->inp_outputopts6,
|
||||
&tp->t_inpcb->inp_route6, 0, NULL,
|
||||
&tp->t_inpcb->inp_route, 0, NULL,
|
||||
tp->t_inpcb->inp_seclevel);
|
||||
break;
|
||||
#endif /* INET6 */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_subr.c,v 1.198 2024/02/11 01:27:45 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_subr.c,v 1.199 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -401,7 +401,7 @@ tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0,
|
|||
ip6->ip6_plen = tlen - sizeof(struct ip6_hdr);
|
||||
ip6->ip6_plen = htons(ip6->ip6_plen);
|
||||
ip6_output(m, tp ? tp->t_inpcb->inp_outputopts6 : NULL,
|
||||
tp ? &tp->t_inpcb->inp_route6 : NULL,
|
||||
tp ? &tp->t_inpcb->inp_route : NULL,
|
||||
0, NULL,
|
||||
tp ? tp->t_inpcb->inp_seclevel : NULL);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_var.h,v 1.175 2024/01/27 21:13:46 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_var.h,v 1.176 2024/02/13 12:22:09 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -247,16 +247,7 @@ struct syn_cache {
|
|||
TAILQ_ENTRY(syn_cache) sc_bucketq; /* [S] link on bucket list */
|
||||
struct refcnt sc_refcnt; /* ref count list and timer */
|
||||
struct timeout sc_timer; /* rexmt timer */
|
||||
union { /* cached route */
|
||||
struct route route4;
|
||||
#ifdef INET6
|
||||
struct route_in6 route6;
|
||||
#endif
|
||||
} sc_route_u;
|
||||
#define sc_route4 sc_route_u.route4 /* [N] */
|
||||
#ifdef INET6
|
||||
#define sc_route6 sc_route_u.route6 /* [N] */
|
||||
#endif
|
||||
struct route sc_route; /* [N] cached route */
|
||||
long sc_win; /* [I] advertised window */
|
||||
struct syn_cache_head *sc_buckethead; /* [S] our bucket index */
|
||||
struct syn_cache_set *sc_set; /* [S] our syn cache set */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue