ip_output() Error Handling in tcp_output()

Matt Miller matt at matthewjmiller.net
Wed Mar 13 15:22:03 UTC 2013


If we have a connection that has received a SYN and ip_output()
returns, say, EHOSTUNREACH, is there anything that guarantees the
connection would always eventually be dropped if the condition
persists?

E.g., similar to this case for ENOBUFS:

http://svnweb.freebsd.org/base?view=revision&revision=61179

Should we ensure that a timer is set for the EHOSTUNREACH, et al.
cases too in addition to setting t_softerror?

        error = ip_output(m, tp->t_inpcb->inp_options, &ro,
            ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0,
            tp->t_inpcb);
...
                switch (error) {
                case EPERM:
                        tp->t_softerror = error;
                        return (error);
                case ENOBUFS:
                        if (!tcp_timer_active(tp, TT_REXMT) &&
                            !tcp_timer_active(tp, TT_PERSIST))
                                tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur);
                        tp->snd_cwnd = tp->t_maxseg;
                        return (0);
...
                case EHOSTDOWN:
                case EHOSTUNREACH:
                case ENETDOWN:
                case ENETUNREACH:
                        if (TCPS_HAVERCVDSYN(tp->t_state)) {
                                tp->t_softerror = error;
                                return (0);
                        }

Thanks,

Matt


More information about the freebsd-net mailing list