diff options
author | 2016-08-31 11:05:05 +0000 | |
---|---|---|
committer | 2016-08-31 11:05:05 +0000 | |
commit | c44d9055dab622b2422cc33060c45b4af3dad2d5 (patch) | |
tree | 97f47f79b68429f9aeaf85f436b15117b81f0868 | |
parent | Add a bunch of regress test to verify the RTM_CHANGE behaviour of mpath (diff) | |
download | wireguard-openbsd-c44d9055dab622b2422cc33060c45b4af3dad2d5.tar.xz wireguard-openbsd-c44d9055dab622b2422cc33060c45b4af3dad2d5.zip |
Use 'sc_route{4,6}' directly instead of casting them to 'struct route *'.
This is another little step towards deprecating 'struct route{,_in6}'.
ok florian@
-rw-r--r-- | sys/netinet/tcp_input.c | 9 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 19 |
2 files changed, 11 insertions, 17 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 99539691c3f..5a6013c05ef 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.325 2016/07/20 09:15:28 bluhm Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.326 2016/08/31 11:05:05 mpi Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -4148,7 +4148,6 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, int syn_cache_respond(struct syn_cache *sc, struct mbuf *m) { - struct route *ro; u_int8_t *optp; int optlen, error; u_int16_t tlen; @@ -4163,12 +4162,10 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m) switch (sc->sc_src.sa.sa_family) { case AF_INET: hlen = sizeof(struct ip); - ro = &sc->sc_route4; break; #ifdef INET6 case AF_INET6: hlen = sizeof(struct ip6_hdr); - ro = (struct route *)&sc->sc_route6; break; #endif default: @@ -4379,14 +4376,14 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m) switch (sc->sc_src.sa.sa_family) { case AF_INET: - error = ip_output(m, sc->sc_ipopts, ro, + error = ip_output(m, sc->sc_ipopts, &sc->sc_route4, (ip_mtudisc ? IP_MTUDISC : 0), NULL, inp, 0); break; #ifdef INET6 case AF_INET6: ip6->ip6_hlim = in6_selecthlim(inp); - error = ip6_output(m, NULL /*XXX*/, (struct route_in6 *)ro, 0, + error = ip6_output(m, NULL /*XXX*/, &sc->sc_route6, 0, NULL, NULL); break; #endif diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 99b877295a7..7940a856cf9 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.151 2016/03/07 18:44:00 naddy Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.152 2016/08/31 11:05:05 mpi Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -296,7 +296,6 @@ tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0, int tlen; int win = 0; struct mbuf *m = NULL; - struct route *ro = NULL; struct tcphdr *th; struct ip *ip; #ifdef INET6 @@ -311,12 +310,6 @@ tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0, * socket/tp/pcb (tp->pf is 0), we lose. */ af = tp->pf; - - /* - * The route/route6 distinction is meaningless - * unless you're allocating space or passing parameters. - */ - ro = &tp->t_inpcb->inp_route; } else af = (((struct ip *)template)->ip_v == 6) ? AF_INET6 : AF_INET; @@ -404,7 +397,8 @@ 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, - (struct route_in6 *)ro, 0, NULL, + tp ? &tp->t_inpcb->inp_route6 : NULL, + 0, NULL, tp ? tp->t_inpcb : NULL); break; #endif /* INET6 */ @@ -412,8 +406,11 @@ tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0, ip->ip_len = htons(tlen); ip->ip_ttl = ip_defttl; ip->ip_tos = 0; - ip_output(m, NULL, ro, ip_mtudisc ? IP_MTUDISC : 0, - NULL, tp ? tp->t_inpcb : NULL, 0); + ip_output(m, NULL, + tp ? &tp->t_inpcb->inp_route : NULL, + ip_mtudisc ? IP_MTUDISC : 0, NULL, + tp ? tp->t_inpcb : NULL, 0); + break; } } |