DragonFly BSD
DragonFly kernel List (threaded) for 2011-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Changing pf to use kmalloc instead of zalloc


From: Jan Lentfer <Jan.Lentfer@xxxxxx>
Date: Fri, 21 Jan 2011 09:31:34 +0100

I created a patch set that will convert pf to use kmalloc instead of
zalloc (with an intermediate step to use objcache).

The module with kmalloc compiles and loads fine so far, just I can't load
the ruleset anymore, pfctl chokes on 

df386devel# pfctl -ef /etc/pf.conf
pfctl: DIOCSETLIMIT
pfctl: DIOCSETLIMIT


The relevant parts are in pfctl.c:

int
pfctl_load_limit(struct pfctl *pf, unsigned int his_index, unsigned int
limit)
{
        struct pfioc_limit pl;

        memset(&pl, 0, sizeof(pl));
        pl.index = his_index;
        pl.limit = limit;
        if (ioctl(pf->dev, DIOCSETLIMIT, &pl)) {
                if (errno == EBUSY)
                        warnx("Current pool size exceeds requested hard
limit");
                else
                        warnx("DIOCSETLIMIT");
                return (1);
        }
        return (0);
}

in pf_ioctl.c:

        case DIOCSETLIMIT: {
                struct pfioc_limit      *pl = (struct pfioc_limit *)addr;
                int                      old_limit;

                if (pl->index < 0 || pl->index >= PF_LIMIT_MAX ||
                    pf_pool_limits[pl->index].pp == NULL) {
                        error = EINVAL;
                        goto fail;
                }

                /* XXX Get an API to set limits on the zone/pool */
                old_limit = pf_pool_limits[pl->index].limit;
                pf_pool_limits[pl->index].limit = pl->limit;
                pl->limit = old_limit;
                break;
        }

and in pfvar.h:
#define DIOCSETLIMIT    _IOWR('D', 40, struct pfioc_limit)


I am at a loss here on how to proceed. Would it be ok to have DIOCSETLIMIT
always return true because I am not using pools anymore? Or just don't call
pfctl_load_limit() in pfctl anymore?

Need help! :)

Jan



-- 
professional: http://www.oscar-consult.de
private: http://neslonek.homeunix.org/drupal/



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