tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: accept_filter, accf_http, setsockopt and the EINVAL error



On Wed, 24 Jun 2009, Sverre Froyen wrote:

> (1) It seems to me that adding the "httpready" filter a second time is not
> really an error and I'm wondering if setsockopt could be modified to silently
> ignore the second attempt.

I see the following code in kern_accf.c

        /*
         * Require a listen socket; don't try to replace an existing filter
         * without first removing it.
         */
        solock(so);
        if ((so->so_options & SO_ACCEPTCONN) == 0 || so->so_accf != NULL) {
                error = EINVAL;
                goto out;
        }

which seems to imply that the behaviour you see is purposeful..  does
FreeBSD allow implicit replacement of the filter?

> (2) I'm unable to find a documented cause for the EINVAL.  Neither the
> setsockopt(2) nor the accf_http(9) mention this error.  Seems like at least
> set sockopt should mention it.

I'm not sure but perhaps accept filters should be documented in accept()
or listen() also? (currently I don't see any user-side documentation?)

iain


Home | Main Index | Thread Index | Old Index