Re: Intercepting a packet, changing it and re-injecting into the network



Fabricio, good day!
I'm developing a network application which needs *to intercept* a packet
(not just *copy* a packet, like libpcap does), move this packet into my
application (userland), do some checking in the packet and according
with some heuristics, the application may change the payload and
re-inject the modified packet into the network. Note that sometimes,
I'll change the payload, drop the packet or just let it go.

So, how can a I do that in FreeBSD? I can use 6.1, 7.1, any version.

Probably you should read the divert(4) manual page and the ipfw(8)
manual, looking for the 'divert' directive. The good example of
your application is /sbin/natd.

The aforementioned facilities are present in FreeBSD at least since 4.x.
--
Eygene
_______________________________________________
freebsd-net@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: freebsd router
    ... >> You're basically limited in an MP environment ... > to sucking the packet ... are committing this hacked code to the source ... the FreeBSD "team" has become. ...
    (freebsd-isp)
  • RE: Freebsd Theme Song
    ... from the network into the ethernet receiver. ... It takes a certain amount of time to get the packet out of ... At low data rates polling is less ... >Subject: Re: Freebsd Theme Song ...
    (freebsd-questions)
  • Underutilisation of CPU --- am I PCI bus bandwidth limited?
    ... I am using FreeBSD ... box echoes at user-level (think inetd udp echo, though in fact I have also used ... an optimised server which gets higher throughput). ... low figure is not unexpected given there are 2 syscalls per packet). ...
    (freebsd-net)
  • FreeBSD Security Advisory FreeBSD-SA-05:13.ipfw
    ... For general information regarding FreeBSD Security Advisories, ... including descriptions of the fields above, security branches, and the ... ipfwis a system facility which allows IP packet filtering, ... The ipfw tables lookup code caches the result of the last query. ...
    (FreeBSD-Security)
  • [FreeBSD-Announce] FreeBSD Security Advisory FreeBSD-SA-05:13.ipfw
    ... For general information regarding FreeBSD Security Advisories, ... including descriptions of the fields above, security branches, and the ... ipfwis a system facility which allows IP packet filtering, ... The ipfw tables lookup code caches the result of the last query. ...
    (freebsd-announce)