Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Mar 2004 13:00:09 +0200
From:      Artis Caune <ac-lists@latnet.lv>
To:        freebsd-net@freebsd.org
Subject:   Re: BSD Packet filter hook,
Message-ID:  <opr5ezij2ocpfy5d@mail.latnet.lv>
In-Reply-To: <BAY16-DAV23SUIwMw8l00002ee7@hotmail.com>
References:  <BAY16-F67kxJ5zHQE7m00017300@hotmail.com> <40599ACA.1040506@netli.com> <BAY16-DAV23SUIwMw8l00002ee7@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
on 4.x you can replace IPFilter hook:
...
int
my_hook (const struct ip *ip, int ip_hl, struct ifnet *ifp, int out, 
struct mbuf **m)
{
    /* drop all ;) */
    m_freem(*m);
    *m = NULL;
    return 1;
}

/* on load */
fr_checkp = my_hook;
/* on unload */
rf_checkp = NULL;
...



on 5.x (>501108) there is pfil(9) hooks:
...
int
my_hook (void *arg, struct mbuf **m, struct ifnet *ifp, int dir)
{
    /* drop all ;) */
    m_freem(*m);
    *m = NULL;
    return 1;
}

struct pfil_head *pfh_inet;
pfh_inet = pfil_head_get (PFIL_TYPE_AF, AF_INET);
if (pfh_inet == NULL)
    return EINVAL;

/* on load */
pfil_add_hook(my_hook, NULL, PFIL_IN | PFIL_OUT, pfh_inet);
/* on unload */
pfil_remove_hook(my_hook, NULL, PFIL_IN | PFIL_OUT, pfh_inet);
...



-- 
Artis

On Thu, 25 Mar 2004 11:29:23 +0100, Fuhua Yin <fuhuayin@hotmail.com> wrote:

> Dear friends,
>
> Are there anyone who know about how to use BSD Packet filter hook?,
> something like netfilter in linux. But I need to find one for FreeBSD.
>
> Many thanks  IN Advance,
> fuhua
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?opr5ezij2ocpfy5d>