Date: Thu, 17 Feb 2005 11:46:29 +0300 From: Gleb Smirnoff <glebius@freebsd.org> To: net@freebsd.org Subject: in_pcbconnect_setup() question Message-ID: <20050217084629.GB95106@cell.sick.ru>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050217084629.GB95106>