Re: Reading and writing from tap device attacted to bridge

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

 



Thanx for help
I m newbie to tun/tap programming so plz be patient with my limited knowledge. I wanna to read packets from tap and ultimately wanna alow only SMTP packets from specific recipients.
my confusion is at this point is
once you open a tap device
if ((tap_fd = open("/dev/net/tun", O_RDWR)) < 0) { ..........   }
and then read from
like
if ((len = read(tap_fd, buf, sizeof(buf))) <= 0)
{ .......... }
Now what to expect from read. Is it sk_buff, tun_struct or ethernet header structure.



On 7/18/07, Stephen Hemminger < shemminger@xxxxxxxxxxxxxxxxxxxx> wrote:
On Wed, 18 Jul 2007 18:37:38 +0530
"rajneesh rana" < rana.rajneesh@xxxxxxxxx> wrote:

> On 7/18/07, rajneesh rana <rana.rajneesh@xxxxxxxxx> wrote:
> >
> > I'm trying to trap ethernet frames from a user process over the wire,
> > using the linux tap device. I see a lot of docs/threads about using tun
> > device, but none for tap device.

Use AF_PACKET, it is easier and faster. That is what tcpdump etc use.

> > I am able to open Tap device and attach it to bridge but getting no clue
> > how to read and write  data from tap device.

Examples in http://vtun.sourceforge.net/tun/

_______________________________________________
Bridge mailing list
Bridge@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/bridge

[Index of Archives]     [Netdev]     [AoE Tools]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux