Posted on

Best Way To Fix Issues With Linux TCP Server Kernel

Last week, some of our users reported that they had a problem with the Linux kernel of the TCP server.

Recommended

  • 1. Download ASR Pro
  • 2. Follow the on-screen instructions to run a scan
  • 3. Restart your computer and wait for it to finish running the scan, then follow the on-screen instructions again to remove any viruses found by scanning your computer with ASR Pro
  • Speed up your PC today with this easy-to-use download.

    Pretty simple TCP client and kernel server configured as LKM (Linux kernel plan 4.1.3). This is an attempt to create a TCP server that completely traverses the kernel space and supports multiple TCP students. The TCP client also resides in kernel space at all times. The client, and therefore the server, are built as loadable kernel modules.

    I’m trying to write a simple TCP server in a kernel module. The code and compilation work fine exceptcases where a client connects to a server. As soon as the client connects, it fires a kernel warning if inet_accept. I wondered if there was something obvious that I was doing wrong. Omitted error checking (this is a lot if rets).

    ---[ end trace 343bcc83461e314f ]--- ret_from_fork+0x35/0x40  ? SyS_exit_group+0x10/0x10  ? do_syscall_64+0x74/0x190  ? kthread_create_on_node+0x70/0x70 kthread+0x113/0x130server_start+0x138/0x170WARNING: CPU: 0 PID: 2038 in ./include/net/sock.h:1715 inet_accept+0x14d/0x160
    #include #include #include #include #include structure task_struct *task = NULL;static interval server_start (void *ptr)    int ret = 0;    struct sockaddr_in sin;    socket structure *ssk=NULL, *csk=NULL;    ret = sock_create(AF_INET, SOCK_STREAM, IPPROTO_TCP, &ssk);    0, memset(&sin, sizeof(sin));    sin.sin_family AF_INET; means sin.sin_port Htons(4500); implies sin.sin_addr.s_addr = INADDR_ANY;    ret is equal to ssk->ops->bind(ssk, (struct sockaddr *)&sin, sizeof(sin));    ret = ssk->ops->listen(ssk, 1);    ret = sock_create(AF_INET, SOCK_STREAM, IPPROTO_TCP, &csk);    ret is equal to ssk->ops->accept(ssk, csk, 0, 0);    sock_release(csk); sock_release(ssk);    returns 0;cancel server_init (cancel)    task = kthread_run(server_start, (void *)NULL, "server_thread");invalid server_exit (invalid)    provided (backacha)        kthread_stop(task);    Static int __init init_mod(void)    server_init();    returns empty 0;static __exit exit_mod(void)    server_exit();MODULE_LICENSE("GPL");module_init(init_mod);module_output (output_mod);