OpenVZ Forum


Home » General » Support » *SOLVED* want SOCK_RAW inside vps
*SOLVED* want SOCK_RAW inside vps [message #5951] Tue, 05 September 2006 21:53 Go to next message
jeffa is currently offline  jeffa
Messages: 8
Registered: September 2006
Junior Member
Hi, I have a program that I want to run inside a VPS that opens a raw socket:
s = socket(AF_INET, SOCK_RAW, IPPROTO_ESP)

...but this returns EAFNOSUPPORT, "Address family not supported by protocol". If run as non-root then you get EPERM "Operation not permitted" as expected. This works fine as root from the host system.

I'm running the latest 2.6.16-026test017 SMP development kernel.

My capabilities line says:
CAPABILITY="NET_ADMIN:on NET_RAW:on SYS_ADMIN:on SYS_TTY_CONFIG:on "
and cat /proc/1/status says:
CapPrm: 000000005decfeff
CapEff: 000000005decfeff

What am I missing?

[Updated on: Fri, 08 September 2006 06:43] by Moderator

Report message to a moderator

Re: want SOCK_RAW inside vps [message #5953 is a reply to message #5951] Tue, 05 September 2006 22:12 Go to previous messageGo to next message
jeffa is currently offline  jeffa
Messages: 8
Registered: September 2006
Junior Member
Now I also see using a simple test program that ICMP, TCP. and UDP raw sockets are permitted, but all others return this error. Is there some way to get a VPS that supports opening a raw socket using other protocol numbers?
Re: want SOCK_RAW inside vps [message #5957 is a reply to message #5951] Wed, 06 September 2006 06:23 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Hello,

The problem is that OpenVZ kernel in rpm is compiled with
CONFIG_INET_ESP option off. So this protocol is not supported. You should recompile the kernel with CONFIG_INET_ESP option turned on.

Good luck,
vass.
Re: want SOCK_RAW inside vps [message #6004 is a reply to message #5957] Wed, 06 September 2006 15:47 Go to previous message
jeffa is currently offline  jeffa
Messages: 8
Registered: September 2006
Junior Member
Thanks for replying. I was able to bind using the protocols that I wanted (not just IPPROTO_ESP) by adding protocols to the switch statement in vz_security_proto_check() in net/sock.c.

There it restricts PF_INET to these protocols:
case IPPROTO_IP:
case IPPROTO_ICMP:
case IPPROTO_TCP:
case IPPROTO_UDP:
case IPPROTO_RAW:
Previous Topic: *SOLVED* UBC settings for multiple jboss VE
Next Topic: Having to create /dev/vzctl after every reboot?
Goto Forum:
  


Current Time: Tue Aug 13 20:27:40 GMT 2024

Total time taken to generate the page: 0.05037 seconds