LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-06-2016, 06:14 AM   #1
gauravsuman007
LQ Newbie
 
Registered: Jun 2016
Posts: 9

Rep: Reputation: Disabled
Where in kernel/socket memory to store long term information between network sessions


I'm trying to implement the QUIC protocol in the linux kernel. QUIC works on top of UDP to provide a connection-oriented, reliable data transfer. QUIC was designed to reduce the number of handshakes required between sessions as compared to TCP.

Now, I need to store some data from my current QUIC session (something like the SYN cookie) so that I can use it when the session ends and later on use it to initiate a new session. I'm at a loss about where should this data be stored so that it's not deleted between sessions. The data needs to be stored till the socket lives in the memory. Once the socket has been destroyed, I don't need the data anymore.

I'd have normally written it to some file but since I'm working in the kernel space, Disk operations are too slow and can affect the performance of my implementation.

Last edited by gauravsuman007; 07-06-2016 at 10:16 AM.
 
Old 07-06-2016, 09:58 AM   #2
mknirsch
Member
 
Registered: Feb 2003
Location: Germany
Distribution: SLES, SuSe, Ubuntu, HPUX
Posts: 38

Rep: Reputation: 18
Hi,
What kind of data do you want to save and what do you mean by data between different sockets?
The simple way is to store data in a file e.g. in a hidden user directory like /home/user/.data. Memory mapped files can make life easier depending where your data resides. In case of sequential data a fifo might be a good choice. Another approach is a chunk of shared memory in case of e.g. multi threadening.
Be more specific for a better answer.

Regards Martin
 
Old 07-06-2016, 10:22 AM   #3
gauravsuman007
LQ Newbie
 
Registered: Jun 2016
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by mknirsch View Post
Hi,
What kind of data do you want to save and what do you mean by data between different sockets?
The simple way is to store data in a file e.g. in a hidden user directory like /home/user/.data. Memory mapped files can make life easier depending where your data resides. In case of sequential data a fifo might be a good choice. Another approach is a chunk of shared memory in case of e.g. multi threadening.
Be more specific for a better answer.

Regards Martin
I've updated the question to be more specific.
As I've mentioned, I need to store the SYN cookie (just a random string) even after I close a connection. This means I need a memory portion allotted to the socket. Is there any such memory available? I can draw a parallel to the sk_buff structure which has the control block (char cb[40]) to give extra memory for the protocols to play around.
 
Old 07-08-2016, 08:54 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,624
Blog Entries: 4

Rep: Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998
Offhand, I would consider maybe using "a privileged, user-land daemon" to help you out here. Say, let this daemon be the only one who's allowed to open a specific virtual-device, which is its interface to your kernel-side code. You now have "the freedom of user-land" (virtual memory and so-forth ...) at your disposal.
 
Old 07-18-2016, 03:58 PM   #5
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,575

Rep: Reputation: 181Reputation: 181
I you need to use data between connections, it will be accessible outside the socket (because if I understand correctly, your socket will be removed already). The basic question I have is how do you find out that the data you saved is to be applied to the new connection. Is it some kind of a port number, other authorization method? I would probably go for a separate structure for your extra data that links to the socket information.

However, note that as sundialcvs suggests, you can very well implement the protocol in user space too. For a prototype, for example, it is way much easier to do and you can experiment freely without crashing the system.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Good news as 4.1 is a long term kernel (2 years) Rinndalir Slackware 15 09-26-2015 06:27 AM
LXer: Linux Kernel 3.10 picked for long-term support LXer Syndicated Linux News 0 08-04-2013 02:40 PM
LXer: Linux 3.4 Kernel Will Be Supported For The Long-Term LXer Syndicated Linux News 0 08-21-2012 06:21 AM
LXer: Long Term Stable Linux Kernel Initiative Announced LXer Syndicated Linux News 0 10-26-2011 06:30 PM
LXer: Linux kernel with long-term support LXer Syndicated Linux News 0 12-06-2010 04:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration