Stop using rt_ifp, ok?

Index: netinet/tcp_input.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_input.c,v
retrieving revision 1.308
diff -u -p -r1.308 tcp_input.c
--- netinet/tcp_input.c 6 Nov 2015 11:20:56 -0000       1.308
+++ netinet/tcp_input.c 19 Nov 2015 11:12:56 -0000
@@ -2988,8 +2988,6 @@ tcp_mss(struct tcpcb *tp, int offer)
        if (rt == NULL)
                goto out;
 
-       ifp = rt->rt_ifp;
-
        switch (tp->pf) {
 #ifdef INET6
        case AF_INET6:
@@ -3004,6 +3002,7 @@ tcp_mss(struct tcpcb *tp, int offer)
                goto out;
        }
 
+       ifp = if_get(rt->rt_ifidx);
        /*
         * if there's an mtu associated with the route and we support
         * path MTU discovery for the underlying protocol family, use it.
@@ -3025,7 +3024,7 @@ tcp_mss(struct tcpcb *tp, int offer)
                        mss = rt->rt_rmx.rmx_mtu - iphlen -
                            sizeof(struct tcphdr);
                }
-       } else if (!ifp) {
+       } else if (ifp == NULL) {
                /*
                 * ifp may be null and rmx_mtu may be zero in certain
                 * v6 cases (e.g., if ND wasn't able to resolve the
@@ -3053,7 +3052,7 @@ tcp_mss(struct tcpcb *tp, int offer)
                mssopt = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
                mssopt = max(tcp_mssdflt, mssopt);
        }
-
+       if_put(ifp);
  out:
        /*
         * The current mss, t_maxseg, is initialized to the default value.

Reply via email to