netdev
[Top] [All Lists]

Re: Kernel Network Implementation help.

To: EOIN RYAN <9726179@xxxxxxxxxxxxx>
Subject: Re: Kernel Network Implementation help.
From: Matti Aarnio <matti.aarnio@xxxxxxxxxxx>
Date: Fri, 23 Mar 2001 18:47:22 +0200
Cc: netdev@xxxxxxxxxxx
In-reply-to: <992C0C12C388D411B264009027AA3418698F31@gabriel.ul.ie>; from 9726179@student.ul.ie on Fri, Mar 23, 2001 at 01:38:34PM +0000
References: <992C0C12C388D411B264009027AA3418698F31@gabriel.ul.ie>
Sender: owner-netdev@xxxxxxxxxxx
On Fri, Mar 23, 2001 at 01:38:34PM +0000, EOIN RYAN wrote:
> Hi,
> 
> I'm a final year student in the University of Limerick, Ireland.  Part of my
> final year project requires me to develop a kernel module which provides an
> network interface for other modules on the system.  I have found getting
> exact information quite difficult, with my main source being the socket.c
> file.  I'm having major problems with the communication and my deadline is
> coming agonisingly close.  
>
> I'm running the 2.2.16 kernel on an intel and at the moment I'm trying to
> get a server to accept a connection and receive a few characters from it.
> The server accepts a telnet connection and gets the name of the connecting
> session however when I try to do a sock->ops->recvmsg i get a efault.

        The  recvmsg()  does copy to userspace, and your reception
        buffer is in kernel space ?   No panic.

        See for example net/ipv6/addrconf.c  file  for
        calls of  get_fs(), and set_fs()  (with KERNEL_DS).
        (Many files have KERNEL_DS parameter for  set_fs()  call,
         those all do it for same reason.)

        This is generic issue in fact, most kernel functions refer
        to data residing in user space, and thus you need to temporarily
        switch your FS (originally some intel F-Segment-Register ?) to
        kernel side from its normal (USER_DS) value.

> Sincerely,
> Eoin Ryan.

/Matti Aarnio  -- not a Guru per se, just "oldtimer" hacker...

<Prev in Thread] Current Thread [Next in Thread>