[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-net
Subject:    Re: BSD Packet filter hook,
From:       Artis Caune <ac-lists () latnet ! lv>
Date:       2004-03-25 11:00:09
Message-ID: opr5ezij2ocpfy5d () mail ! latnet ! lv
[Download RAW message or body]

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"
_______________________________________________
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"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic