On Mon, Mar 10, 2014 at 08:49:01AM +0000, Anton Ivanov wrote: > You are correct. My test is wrong. > > However, the result is the same - it wants a non-zero proto there. > > $ sudo ./gaitest > src ai_family 2 ai_socketype 3 ai_protocol 0 > socket creation failed, errno = 93
You are right! I got confused with Linux net/l2tp/l2tp_ip.c driver which handles socket(AF_INET, SOCK_DGRAM, IPPROTO_L2TP). But that has nothing to do with this raw socket code which needs to do socket(AF_INET, SOCK_RAW, IPPROTO_L2TP). IPPROTO_L2TP *is* needed after all since SOCK_RAW wants to know the IP protocol number so it can receive incoming packets. We're not trying to capture all IP packets, just the L2TP ones. So I'm happy again with the code. Stefan