Index: net/raw_cb.c =================================================================== --- net/raw_cb.c (revision 180385) +++ net/raw_cb.c (working copy) @@ -34,11 +34,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -55,9 +57,16 @@ struct mtx rawcb_mtx; struct rawcb_list_head rawcb_list; -const static u_long raw_sendspace = RAWSNDQ; -const static u_long raw_recvspace = RAWRCVQ; +SYSCTL_NODE(_net, OID_AUTO, raw, CTLFLAG_RW, 0, "Raw socket infrastructure"); +static u_long raw_sendspace = RAWSNDQ; +SYSCTL_ULONG(_net_raw, OID_AUTO, sendspace, CTLFLAG_RW, &raw_sendspace, 0, + "Default raw socket send space"); + +static u_long raw_recvspace = RAWRCVQ; +SYSCTL_ULONG(_net_raw, OID_AUTO, recvspace, CTLFLAG_RW, &raw_recvspace, 0, + "Default raw socket receive space"); + /* * Allocate a control block and a nominal amount of buffer space for the * socket. @@ -69,12 +78,13 @@ int error; /* - * It is assumed that raw_attach is called - * after space has been allocated for the - * rawcb. + * It is assumed that raw_attach is called after space has been + * allocated for the rawcb; consumer protocols may simply allocate + * type struct rawcb, or a wrapper data structure that begins with a + * struct rawcb. */ - if (rp == 0) - return (ENOBUFS); + KASSERT(rp != NULL, ("raw_attach: rp == NULL")); + error = soreserve(so, raw_sendspace, raw_recvspace); if (error) return (error);