How to compile tcp fast open client app with kernel tfo client support ?

10 messages, 4 authors, 2012-11-13 · open the first message on its own page

How to compile tcp fast open client app with kernel tfo client support ?

From: Vincent Li <hidden>
Date: 2012-11-09 18:05:44

Hi,

this is sort of off toptic, sorry for the noise.

I am running ubuntu 10.0.4 with kernel 3.6.0 with tfo client support,
then I have simple client code that i want to use to test tcp fast
open, here is part of the code:

  int sent = 0;
  while(sent < strlen(get))
  {
    tmpres = sendto(sock, get+sent, strlen(get)-sent, MSG_FASTOPEN,
(struct sockaddr *)remote, sizeof(struct sockaddr));
    if(tmpres == -1){
      perror("Can't send query");
      exit(1);
    }
    sent += tmpres;
  }

when i compile it, as gcc -o htmlgettfo htmlgettfo.c, I got:

htmlgettfo.c: In function 'get_page_thread':
htmlgettfo.c:109: error: 'MSG_FASTOPEN' undeclared (first use in this function)
htmlgettfo.c:109: error: (Each undeclared identifier is reported only once
htmlgettfo.c:109: error: for each function it appears in.)

I have the 3.6.0 kernel header file package installed
/usr/src/linux-headers-3.6.0-custom, the user space include file
/usr/include/linux is original one coming with 10.0.4 distro kernel

I am suspecting I don't have proper linux header file that has
MSG_FASTOPEN declared in user space. can anyone shed a light on how to
get MSG_FASTOPEN supported and compiled in client code properly?

I am attempting to use the test client code to test one of our load
balancer and see how it responds.


I attached my test code

Thanks

Vincent

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Vijay Subramanian <hidden>
Date: 2012-11-09 18:23:13

htmlgettfo.c: In function 'get_page_thread':
htmlgettfo.c:109: error: 'MSG_FASTOPEN' undeclared (first use in this function)
htmlgettfo.c:109: error: (Each undeclared identifier is reported only once
htmlgettfo.c:109: error: for each function it appears in.)

I have the 3.6.0 kernel header file package installed
/usr/src/linux-headers-3.6.0-custom, the user space include file
/usr/include/linux is original one coming with 10.0.4 distro kernel

I am suspecting I don't have proper linux header file that has
MSG_FASTOPEN declared in user space. can anyone shed a light on how to
get MSG_FASTOPEN supported and compiled in client code properly?
Vincent ,
You can try adding the following to the client code.

#define MSG_FASTOPEN    0x20000000

This is missing still from user space header files I presume.

Vijay

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Vincent Li <hidden>
Date: 2012-11-09 18:47:01

On Fri, Nov 9, 2012 at 10:23 AM, Vijay Subramanian
[off-list ref] wrote:
quoted
htmlgettfo.c: In function 'get_page_thread':
htmlgettfo.c:109: error: 'MSG_FASTOPEN' undeclared (first use in this function)
htmlgettfo.c:109: error: (Each undeclared identifier is reported only once
htmlgettfo.c:109: error: for each function it appears in.)

I have the 3.6.0 kernel header file package installed
/usr/src/linux-headers-3.6.0-custom, the user space include file
/usr/include/linux is original one coming with 10.0.4 distro kernel

I am suspecting I don't have proper linux header file that has
MSG_FASTOPEN declared in user space. can anyone shed a light on how to
get MSG_FASTOPEN supported and compiled in client code properly?
Vincent ,
You can try adding the following to the client code.

#define MSG_FASTOPEN    0x20000000

This is missing still from user space header files I presume.

Vijay
Thanks Vijay, that did it. and the load banlancer doesn't recognize
the option, but traffic pass through ok. the data is sent through the
final ack of 3WHS from linux.

Vincent

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Yuchung Cheng <hidden>
Date: 2012-11-09 18:54:04

On Fri, Nov 9, 2012 at 1:47 PM, Vincent Li [off-list ref] wrote:
On Fri, Nov 9, 2012 at 10:23 AM, Vijay Subramanian
[off-list ref] wrote:
quoted
quoted
htmlgettfo.c: In function 'get_page_thread':
htmlgettfo.c:109: error: 'MSG_FASTOPEN' undeclared (first use in this function)
htmlgettfo.c:109: error: (Each undeclared identifier is reported only once
htmlgettfo.c:109: error: for each function it appears in.)

I have the 3.6.0 kernel header file package installed
/usr/src/linux-headers-3.6.0-custom, the user space include file
/usr/include/linux is original one coming with 10.0.4 distro kernel

I am suspecting I don't have proper linux header file that has
MSG_FASTOPEN declared in user space. can anyone shed a light on how to
get MSG_FASTOPEN supported and compiled in client code properly?
Vincent ,
You can try adding the following to the client code.

#define MSG_FASTOPEN    0x20000000

This is missing still from user space header files I presume.

Vijay
Thanks Vijay, that did it. and the load banlancer doesn't recognize
the option, but traffic pass through ok. the data is sent through the
final ack of 3WHS from linux.
Hi Vincent,

Note that MSG_FASTOPEN flag should be used only once. Subsequent
sendto(MSG_FASTOPEN) == connect() on connected sockets. You can verify
if the fast open is successful by checking a bit in TCP_INFO.
http://patchwork.o zlabs.org/patch/192883/ if you are running a fresh
netdev build.

I'll submit a patch to update the man page on MSG_FASTOPEN too.

Yuchung

Vincent
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Vincent Li <hidden>
Date: 2012-11-09 20:17:31

Hi Vincent,

Note that MSG_FASTOPEN flag should be used only once. Subsequent
sendto(MSG_FASTOPEN) == connect() on connected sockets. You can verify
if the fast open is successful by checking a bit in TCP_INFO.
http://patchwork.o zlabs.org/patch/192883/ if you are running a fresh
netdev build.

I'll submit a patch to update the man page on MSG_FASTOPEN too.

Yuchung
I have tried to run fresh build net-next, for some reason the build
stops ssh service from starting up, tried 3.7.0-rc4 too, same issue. I
don't know if it is new kernel bug or ubuntu upstart bug, but that is
another issue.

I will study the tcp fast open more, thanks.

Vincent

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Eric Dumazet <hidden>
Date: 2012-11-09 20:27:08

On Fri, 2012-11-09 at 12:17 -0800, Vincent Li wrote:
I have tried to run fresh build net-next, for some reason the build
stops ssh service from starting up, tried 3.7.0-rc4 too, same issue. I
don't know if it is new kernel bug or ubuntu upstart bug, but that is
another issue.
Not sure Ubuntu 10.04 binaries can run a 3.7 kernel.

Some bug fixes in kernel need bug fixes in userland.

You could try a bisection ?

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Vijay Subramanian <hidden>
Date: 2012-11-09 20:54:08

On 9 November 2012 12:27, Eric Dumazet [off-list ref] wrote:
On Fri, 2012-11-09 at 12:17 -0800, Vincent Li wrote:
quoted
I have tried to run fresh build net-next, for some reason the build
stops ssh service from starting up, tried 3.7.0-rc4 too, same issue. I
don't know if it is new kernel bug or ubuntu upstart bug, but that is
another issue.
Not sure Ubuntu 10.04 binaries can run a 3.7 kernel.

Some bug fixes in kernel need bug fixes in userland.

You could try a bisection ?
 I saw the same issue with Ubuntu starting around 3.7.0-rc1 but 3.6
was fine if I recall. (I did a partial bisection but was not sure it
was a kernel issue)
 sshd would not start up on boot and I 'fixed' it by adding the
following in /etc/rc.local since I assumed it was a userspace issue.

if [ ! -d /var/run/sshd ]; then
   mkdir /var/run/sshd
   chmod 0755 /var/run/sshd
fi
/usr/sbin/sshd


Thanks,
Vijay

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Vincent Li <hidden>
Date: 2012-11-09 21:09:58

On Fri, Nov 9, 2012 at 12:54 PM, Vijay Subramanian
[off-list ref] wrote:
On 9 November 2012 12:27, Eric Dumazet [off-list ref] wrote:
quoted
On Fri, 2012-11-09 at 12:17 -0800, Vincent Li wrote:
quoted
I have tried to run fresh build net-next, for some reason the build
stops ssh service from starting up, tried 3.7.0-rc4 too, same issue. I
don't know if it is new kernel bug or ubuntu upstart bug, but that is
another issue.
Not sure Ubuntu 10.04 binaries can run a 3.7 kernel.

Some bug fixes in kernel need bug fixes in userland.

You could try a bisection ?
 I saw the same issue with Ubuntu starting around 3.7.0-rc1 but 3.6
was fine if I recall. (I did a partial bisection but was not sure it
was a kernel issue)
 sshd would not start up on boot and I 'fixed' it by adding the
following in /etc/rc.local since I assumed it was a userspace issue.

if [ ! -d /var/run/sshd ]; then
   mkdir /var/run/sshd
   chmod 0755 /var/run/sshd
fi
/usr/sbin/sshd


Thanks,
Vijay
thanks again, you "fixed" my other issue :-)

Vincent

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Vincent Li <hidden>
Date: 2012-11-13 00:33:54

On Fri, Nov 9, 2012 at 12:54 PM, Vijay Subramanian
[off-list ref] wrote:
On 9 November 2012 12:27, Eric Dumazet [off-list ref] wrote:
quoted
On Fri, 2012-11-09 at 12:17 -0800, Vincent Li wrote:
quoted
I have tried to run fresh build net-next, for some reason the build
stops ssh service from starting up, tried 3.7.0-rc4 too, same issue. I
don't know if it is new kernel bug or ubuntu upstart bug, but that is
another issue.
Not sure Ubuntu 10.04 binaries can run a 3.7 kernel.

Some bug fixes in kernel need bug fixes in userland.

You could try a bisection ?
 I saw the same issue with Ubuntu starting around 3.7.0-rc1 but 3.6
was fine if I recall. (I did a partial bisection but was not sure it
was a kernel issue)
 sshd would not start up on boot and I 'fixed' it by adding the
following in /etc/rc.local since I assumed it was a userspace issue.

if [ ! -d /var/run/sshd ]; then
   mkdir /var/run/sshd
   chmod 0755 /var/run/sshd
fi
/usr/sbin/sshd


Thanks,
Vijay
Hi Vijay,

just FYI, I filed a bug report in ubuntu and it appears to be a kernel
commit breaks the user space code that still using deprecated kernel
knobs oom_adj.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1077248

commit 01dc52ebdf472f77cca623ca693ca24cfc0f1bbe
Author: Davidlohr Bueso [off-list ref]
Date: Mon Oct 8 16:29:30 2012 -0700

    oom: remove deprecated oom_adj

    The deprecated /proc/<pid>/oom_adj is scheduled for removal this month.

Re: How to compile tcp fast open client app with kernel tfo client support ?

From: Vijay Subramanian <hidden>
Date: 2012-11-13 01:13:44

Hi Vijay,

just FYI, I filed a bug report in ubuntu and it appears to be a kernel
commit breaks the user space code that still using deprecated kernel
knobs oom_adj.
Vincent,
Thanks for following up and finding the exact cause!!

Vijay
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help