Return to BSD News archive
Xref: sserve comp.os.386bsd.bugs:645 comp.bugs.4bsd:1954 Newsgroups: comp.os.386bsd.bugs,comp.bugs.4bsd Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!olivea!decwrl!pa.dec.com!nntpd2.cxo.dec.com!nntpd.lkg.dec.com!lkg.dec.com!thomas From: thomas@lkg.dec.com (Matt Thomas) Subject: Re: socreate() will call protocol's usrreq even if it is NULL Message-ID: <1993May2.020428.18808@nntpd.lkg.dec.com> Lines: 42 Sender: thomas@netrix.lkg.dec.com (Matt Thomas) Reply-To: thomas@lkg.dec.com Organization: Digital Equipment Corporation References: <1993Apr26.165813.172@uvm.edu> Date: Sun, 2 May 1993 02:04:28 GMT In article <1993Apr26.165813.172@uvm.edu>, wollman@sadye.emba.uvm.edu (Garrett Wollman) writes: |>I found this while debugging IP multicast routing... If a protocol |>has a no pr_usrreq entry point specified, such as the EON does (and my |>encapsulation protocol used to), a call such as: |> |> s = socket(PF_INET, SOCK_RAW, IPPROTO_ENCAP); |> |>will result in socreate() calling through the null usrreq pointer, |>thus crashing the system. Here is a patch which causes socreate to |>return EINVAL instead. (EPROTONOSUPPORT might be a better choice, but |>EINVAL was what came immediately to my head.) That fix is rather inefficient. Why go through the effort of creating the socket when you can't use it? The way ULTRIX and DEC OSF/1 fix this bug is via: *** uipc_socket.c Sun Jul 19 01:02:08 1992 --- uipc_socket.c.fixed Sun May 2 03:06:33 1993 *************** *** 69,75 **** prp = pffindproto(dom, proto, type); else prp = pffindtype(dom, type); ! if (prp == 0) return (EPROTONOSUPPORT); if (prp->pr_type != type) return (EPROTOTYPE); --- 69,75 ---- prp = pffindproto(dom, proto, type); else prp = pffindtype(dom, type); ! if (prp == NULL || prp->pr_usrreq == NULL) return (EPROTONOSUPPORT); if (prp->pr_type != type) return (EPROTOTYPE); -- Matt Thomas Internet: thomas@lkg.dec.com U*X Networking UUCP: ...!decwrl!thomas Digital Equipment Corporation Disclaimer: This message reflects my own Littleton, MA warped views, etc.