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 <[EMAIL PROTECTED]> 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
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to