Re: accessing tcp/ip from a device driver

phn_at_icke-reklam.ipsec.nu
Date: 10/04/04


Date: Mon, 4 Oct 2004 15:51:47 +0000 (UTC)

cuba five <cubafive@yahoo.com> wrote:
> I am interested in learning the proper way to "talk" over TCP/IP from
> inside a device driver, i.e. like open a socket.

> I have Netbsd 1.6.2 installed and have read all the docs relating to
> device driver writing on netbsg.org; I have created and successfully
> tested a skeleton device driver and my next step is to simply call
> socket() and see what happens....

> But perhaps those with more wisdom than I can shed some light on this
> for me?

> I see ether_ifattach() or if_attach() but perhps those are only for
> ethernet drivers? (man ethersubr and man 9 arp are a little vague)

> For example, say I wanted a sample device driver that would ping
> another computer: open() - setup socket, ioctl(IP) - set IP address,
> read() - get ping results (but not continuous of course). (Not that
> anyone would want to do this, or that this is lame, but just as an
> example.)

> My problem, in learning netbsd, is that I like to see an API, i.e.
> here is a list of system calls one can make from inside a device
> driver:

> printf
> alloc
> bus_dmamem_alloc
> strcpy
> bus_space_read

> etc. Wouldn't it be nice to have a list of them all, just like Appedix
> B: Standard Library of K&R 2nd ed?

What you should consider is a user-lever app that opens sockets. Kernel
modules is not supposed to use sockets.

-- 
Peter Håkanson         
        IPSec  Sverige      ( At Gothenburg Riverside )
           Sorry about my e-mail address, but i'm trying to keep spam out,
	   remove "icke-reklam" if you feel for mailing me. Thanx.


Relevant Pages

  • Re: [RFC][PATCH 0/3] TCP/IP Critical socket communication mechanism
    ... >> pool when the allocation happens in the device driver and we have no ... >> idea which socket the packet is destined for? ...
    (Linux-Kernel)
  • accessing tcp/ip from a device driver
    ... inside a device driver, i.e. like open a socket. ... My problem, in learning netbsd, is that I like to see an API, i.e. ...
    (comp.unix.bsd.netbsd.misc)
  • Re: Help: barcode scanner
    ... Suggest searching for bardcode options at socket... ... they have a number of ppc solutions such as ... These and others, come with a device driver that, once you trigger a scan, simply types the results of the scan into the current application.. ...
    (microsoft.public.pocketpc)
  • execve(): unexpected socket behavior
    ... I have a process which opens and writes to a TCP socket, ... The socket descriptor is a file scope variable, ... I'm scratching my head trying to figure out how to reference the ...
    (comp.unix.programmer)
  • Re: execve(): unexpected socket behavior
    ... I have a process which opens and writes to a TCP socket, which at regular intervals I replace with another instance of the process via execve. ... I have been unable to figure out how to reference them, however, so I can determine when I already have an open socket and so don't have to open another one. ... The socket descriptor is a file scope variable, so is automatically initialized to 0 when the process loads. ...
    (comp.unix.programmer)