in_pcbconnect_setup() question

From: Gleb Smirnoff (glebius_at_freebsd.org)
Date: 02/17/05

  • Next message: Robert Watson: "Re: paranoia"
    Date: Thu, 17 Feb 2005 11:46:29 +0300
    To: net@freebsd.org
    
    

      Dear networkers,

      I've noticed a small oddity in in_pcbconnect_setup(). According to SuS, in
    case of connection-less socket layer, e.g. SOCK_DGRAM, the connect() syscall
    should only choose local address and that's all. To server this purposes a
    route lookup is done in in_pcbconnect_setup(). However, if route is pointing
    to a loopback interface, it is not accepted.
    (Not clear to me) comment is also present:

                    /*
                     * If we found a route, use the address
                     * corresponding to the outgoing interface
                     * unless it is the loopback (in case a route
                     * to our address on another net goes to loopback).
                     */
                    if (sro.ro_rt && !(sro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK))
                            ia = ifatoia(sro.ro_rt->rt_ifa);
                    if (sro.ro_rt)
                            RTFREE(sro.ro_rt);

    For example, this breaks connect() of a UDP socket to a blackhole-routed IP
    address, which shouldn't return an error. I'd like to change this block to the
    following:

                    /*
                     * If we found a route, use the address
                     * corresponding to the outgoing interface.
                     */

                    if (sro.ro_rt) {
                            ia = ifatoia(sro.ro_rt->rt_ifa);
                            RTFREE(sro.ro_rt);
                    }

    Is there any hidden obstacles? Can someone explain me this comment?

    -- 
    Totus tuus, Glebius.
    GLEBIUS-RIPN GLEB-RIPE
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
    

  • Next message: Robert Watson: "Re: paranoia"
  • Quantcast