Hi all,
I am doing some light experimentation with the kernel and am writing a module. I am trying to have a /dev file functions as a TCP listening socket. So if you do
My general strategy is to create a socket by jumping into the same path that a syscall takes, which is lands in kern_socket. The call is declared as follows:
I was not certain how to get the
I recognize that this is a redundant effort. My ultimate purpose is to experiment, run into problems and learn.
Thanks!
I am doing some light experimentation with the kernel and am writing a module. I am trying to have a /dev file functions as a TCP listening socket. So if you do
cat /dev/tcp/5555
, it would be the equivalent of nc -l 5555
.My general strategy is to create a socket by jumping into the same path that a syscall takes, which is lands in kern_socket. The call is declared as follows:
C:
int
kern_socket(struct thread *td, int domain, int type, int protocol)
td
pointer from within a kernel module's handler function. Is there a general approach to that? My read handler's header is as follows:
C:
static int
tcpdev_read(struct cdev *dev, struct uio *uio, int flags)
I recognize that this is a redundant effort. My ultimate purpose is to experiment, run into problems and learn.
Thanks!