Ethertap Devices

Ethertap Devices

Post by Tim Godfre » Sat, 08 Jul 2000 04:00:00



Does anyone know much about these things?

I have done the following:

(under su -)

mknod /dev/tap0 c 36 16
insmod -x -o tap0 ethertap unit=0
ifconfig tap0 192.168.1.201

All performed without a problem.

I can even ping the damn thing.

The file permissions are as follows

crw-rw-r--   1 root    root    36, 16 July    7 15:39 /dev/tap0

but when I try to open it for writing in my code with this line:

fd = open ("/dev/tap0", O_WRONLY)

if (fd < 0)
{
   fprintf (stderr, "writeEth: could not open /dev/tap0\n%s\n", strerror
(errno));

Quote:}

The code outputs the following:

writeEth: could not open /dev/tap0
Device or resource busy.

Busy? I did not think it was doing anything yet

Could someone please sped some light on this problem?

Thanks in advance,

        Tim Godfrey

 
 
 

Ethertap Devices

Post by phil-news-nos.. » Sat, 08 Jul 2000 04:00:00



| The file permissions are as follows
|
| crw-rw-r--   1 root    root    36, 16 July    7 15:39 /dev/tap0
|
| but when I try to open it for writing in my code with this line:
|
| fd = open ("/dev/tap0", O_WRONLY)
|
| if (fd < 0)
| {
|    fprintf (stderr, "writeEth: could not open /dev/tap0\n%s\n", strerror
| (errno));
| }

Do you have this option compiled into your kernel?

Kernel/User netlink socket (CONFIG_NETLINK) [Y/n/?] ?

CONFIG_NETLINK:

  This driver allows for two-way communication between certain parts
  of the kernel or modules and user processes; the user processes are
  able to read from and write to character special files in the /dev
  directory having major mode 36. So far, the kernel uses it to
  publish some network related information if you say Y to "Routing
  messages", below. It is also used by the firewall code to publish
  information about possible attacks if you say Y to "IP: firewall
  packet netlink device" further down. You also need to say Y here if
  you want to use arpd, a daemon that helps keep the internal ARP
  cache (a mapping between IP addresses and hardware addresses on the
  local network) small. The ethertap device, which lets user space
  programs read and write raw Ethernet frames, also needs the network
  link driver. If unsure, say Y.
Kernel/User netlink socket (CONFIG_NETLINK) [Y/n/?]

--
| Phil Howard - KA9WGN | My current websites: linuxhomepage.com, ham.org
| phil  (at)  ipal.net +----------------------------------------------------


 
 
 

Ethertap Devices

Post by Tim Godfre » Tue, 11 Jul 2000 04:00:00


Quote:> Do you have this option compiled into your kernel?

> Kernel/User netlink socket (CONFIG_NETLINK) [Y/n/?] ?

Yes indeed I do...

I have also tried opening /dev/tap0 as O_RDWR.

Really stumped....

 
 
 

Ethertap Devices

Post by phil-news-nos.. » Wed, 12 Jul 2000 04:00:00



|> Do you have this option compiled into your kernel?
|>
|> Kernel/User netlink socket (CONFIG_NETLINK) [Y/n/?] ?
|>
|
| Yes indeed I do...

Are you loading anything by module?  Or have you compiled everything into
the kernel directly like I do?  If you compile everything in, could you
maybe send me a copy of your kernel .config file?  I could see exactly
what is different between yours and mine and see if any differences
suggest to me something that could be a problem.

| I have also tried opening /dev/tap0 as O_RDWR.
|
| Really stumped....

Has me stumped, too ... except that when I get stumped on my own machines
I'm usually trying a whole lot of things quite rapidly to see if anything
even sheds clues.

Focusing on the fact that your message says a resource is busy, I would
wonder if something opened the /dev/tap0 device.  I can see that on my
own machine:


readpacke 21835 root    3u   CHR      36,16                8213 /dev/tap0

You probably already looked around for anything like that, even though most
likely you have nothing that could have opened it.

I might look around deeper in the netlink device handling code to see what
kinds of things it could be testing for busy conditions and checking to see
if those conditions might exist.  In the mean time, you might want to give
a shot at seeing if my little readpacket program will by some chance make
a difference.  You can grab it at:  http://phil.ipal.org/readpacket.tar.gz
It was something I used to do some testing of ethertap to see what I get
out, and I got stuff like:


tap0      Link encap:Ethernet  HWaddr FE:FD:00:00:00:00
          inet addr:10.1.1.1  Bcast:10.1.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0




---------------------------------------- 73 bytes
01000000 00000000 fefd0000 00000800 45000039 9e840000 4011c428 0a010101
0a020304 04011234 00252e4f 54756520 4a756c20 31312030 353a3539 3a333920
43445420 32303030 0a


--
| Phil Howard - KA9WGN | My current websites: linuxhomepage.com, ham.org
| phil  (at)  ipal.net +----------------------------------------------------

 
 
 

1. Ethertap device driver

Hi,

the ethertap device driver adds two header bytes when transmitting
a frame to netlink. Similarly, it removes those bytes again when
a frame is removed from netlink.

What are those bytes being used for? Are they to be used by
applications?

Thanks for any information,

-Daniel

2. scp giving response: on login?

3. vtund and ethertap devices

4. redirecting ports

5. ethertap device

6. Receiving Mail

7. Ethertap device configuration - Writing RAW ethernet packets

8. conflict between time.h - linux/time.h (from linux/mm.h)

9. ipchains & ethertap device

10. Question about ethertap device

11. Configuring another ethertap device?

12. ethertap devices