linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neal Cardwell <ncardwell@google.com>
To: louisrossberg <louisrossberg@protonmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>
Subject: Re: Listening on a TCP socket from a Kernel Module
Date: Sun, 16 May 2021 21:55:09 -0400	[thread overview]
Message-ID: <CADVnQymGvCTEzdd8dSLZnn0dwnHAoNiwo72yEFeNr47+Na8GDg@mail.gmail.com> (raw)
In-Reply-To: <5J_z4QNPMBAk4y0rGshI7mBykT1tivh3037CbQRYXTu_Ra6zuojEcI0RB04ghXQxgdtDbt3YFv6sA882mrFyTdzQePwHwvLoECnqFTnYNZI=@protonmail.com>

On Sun, May 16, 2021 at 7:20 PM louisrossberg
<louisrossberg@protonmail.com> wrote:
>
> Hello, can somebody point me in the right direction for
> what I would use to listen on a TCP socket from the
> kernel? I am working on a kernel module and have spent the
> past day looking through include/net and include/linux for
> something that would allow me to do so. I know TCP
> listening is typically done in userspace, but it should be
> possible at the kernel level right?  tcp_diag looks
> promising, but it seems like that is mainly for monitoring
> sockets, and I'm not sure if I would be able to provide
> responses from it.
>
> Louis Rossberg,
> Warped Technologies

Perhaps kernel_listen() and related functions (kernel_bind(),
kernel_accept(), etc.) in net/socket.c might do the trick for your use
case? Looking at how the callers of these functions structure their
code might give you enough to go on.

(I'm adding the Linux kernel networking mailing list to this thread as well.)

best regards,
neal

  reply	other threads:[~2021-05-17  1:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-16 23:20 Listening on a TCP socket from a Kernel Module louisrossberg
2021-05-17  1:55 ` Neal Cardwell [this message]
2021-05-17 12:50   ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADVnQymGvCTEzdd8dSLZnn0dwnHAoNiwo72yEFeNr47+Na8GDg@mail.gmail.com \
    --to=ncardwell@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louisrossberg@protonmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).