Use 'sc_route{4,6}' directly instead of casting to the almost extinct
'struct route *'.  This help fixing remaining use of 'struct route'.

ok?

Index: netinet/tcp_input.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_input.c,v
retrieving revision 1.325
diff -u -p -r1.325 tcp_input.c
--- netinet/tcp_input.c 20 Jul 2016 09:15:28 -0000      1.325
+++ netinet/tcp_input.c 29 Aug 2016 11:54:55 -0000
@@ -4148,7 +4148,6 @@ syn_cache_add(struct sockaddr *src, stru
 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, 
        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, 
 
        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
Index: netinet/tcp_subr.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.151
diff -u -p -r1.151 tcp_subr.c
--- netinet/tcp_subr.c  7 Mar 2016 18:44:00 -0000       1.151
+++ netinet/tcp_subr.c  29 Aug 2016 11:57:12 -0000
@@ -296,7 +296,6 @@ tcp_respond(struct tcpcb *tp, caddr_t te
        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 te
                 * 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 te
                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 te
                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;
        }
 }
 

Reply via email to