--- linux-2.6.19.1-vs2.3.0.6/include/asm-alpha/socket.h 2006-09-20 16:58:40 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-alpha/socket.h 2007-01-10 14:40:24 +0100 @@ -51,6 +51,7 @@ #define SCM_TIMESTAMP SO_TIMESTAMP #define SO_PEERSEC 30 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 /* Security levels - as per NRL IPv6 - don't actually do anything */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-arm/socket.h 2006-09-20 16:58:40 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-arm/socket.h 2007-01-10 14:40:31 +0100 @@ -48,6 +48,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-cris/socket.h 2006-09-20 16:58:40 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-cris/socket.h 2007-01-10 14:40:49 +0100 @@ -50,6 +50,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-frv/socket.h 2006-09-20 16:58:40 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-frv/socket.h 2007-01-10 14:41:16 +0100 @@ -48,6 +48,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-h8300/socket.h 2006-09-20 16:58:40 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-h8300/socket.h 2007-01-10 14:41:28 +0100 @@ -48,6 +48,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-i386/socket.h 2006-09-20 16:58:40 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-i386/socket.h 2007-01-10 14:41:35 +0100 @@ -48,6 +48,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-ia64/socket.h 2006-09-20 16:58:40 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-ia64/socket.h 2007-01-10 14:41:41 +0100 @@ -57,6 +57,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_IA64_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-m32r/socket.h 2006-09-20 16:58:40 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-m32r/socket.h 2007-01-10 14:41:49 +0100 @@ -48,6 +48,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_M32R_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-mips/socket.h 2006-09-20 16:58:41 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-mips/socket.h 2007-01-10 14:41:58 +0100 @@ -68,6 +68,7 @@ To add: #define SO_REUSEPORT 0x0200 /* A #define SO_PEERSEC 30 #define SO_SNDBUFFORCE 31 +#define SO_PEERTAG 32 #define SO_RCVBUFFORCE 33 #define SO_PASSSEC 34 --- linux-2.6.19.1-vs2.3.0.6/include/asm-parisc/socket.h 2006-09-20 16:58:41 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-parisc/socket.h 2007-01-10 14:42:14 +0100 @@ -49,5 +49,6 @@ #define SO_PEERSEC 0x401d #define SO_PASSSEC 0x401e +#define SO_PEERTAG 0x4020 #endif /* _ASM_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-powerpc/socket.h 2006-09-20 16:58:41 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-powerpc/socket.h 2007-01-10 14:33:42 +0100 @@ -55,6 +55,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_POWERPC_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-s390/socket.h 2006-09-20 16:58:41 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-s390/socket.h 2007-01-10 14:33:58 +0100 @@ -56,6 +56,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-sh/socket.h 2006-09-20 16:58:43 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-sh/socket.h 2007-01-10 14:34:17 +0100 @@ -48,6 +48,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* __ASM_SH_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-sparc/socket.h 2006-09-20 16:58:43 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-sparc/socket.h 2007-01-10 14:34:45 +0100 @@ -49,6 +49,7 @@ #define SO_PEERSEC 0x001e #define SO_PASSSEC 0x001f +#define SO_PEERTAG 0x0020 /* Security levels - as per NRL IPv6 - don't actually do anything */ #define SO_SECURITY_AUTHENTICATION 0x5001 --- linux-2.6.19.1-vs2.3.0.6/include/asm-sparc64/socket.h 2006-09-20 16:58:43 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-sparc64/socket.h 2007-01-10 14:35:03 +0100 @@ -49,6 +49,7 @@ #define SO_PEERSEC 0x001e #define SO_PASSSEC 0x001f +#define SO_PEERTAG 0x0020 /* Security levels - as per NRL IPv6 - don't actually do anything */ #define SO_SECURITY_AUTHENTICATION 0x5001 --- linux-2.6.19.1-vs2.3.0.6/include/asm-v850/socket.h 2006-09-20 16:58:43 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-v850/socket.h 2007-01-10 14:35:17 +0100 @@ -48,6 +48,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* __V850_SOCKET_H__ */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-x86_64/socket.h 2006-09-20 16:58:43 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-x86_64/socket.h 2007-01-10 14:35:52 +0100 @@ -48,6 +48,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _ASM_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/asm-xtensa/socket.h 2006-09-20 16:58:43 +0200 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/asm-xtensa/socket.h 2007-01-10 14:36:17 +0100 @@ -59,6 +59,7 @@ #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 +#define SO_PEERTAG 32 #define SO_PASSSEC 34 #endif /* _XTENSA_SOCKET_H */ --- linux-2.6.19.1-vs2.3.0.6/include/linux/vs_socket.h 2006-11-30 19:13:42 +0100 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/linux/vs_socket.h 2007-01-10 15:53:27 +0100 @@ -61,6 +61,18 @@ static inline void __vx_acc_sock(struct (s)->sk_nx_info = NULL; \ } while (0) +static inline +int vx_socket_peer_tag(struct socket *sock, int level, + char __user *optval, int __user *optlen, int len) +{ + struct peer_tag tag; + + tag.xid = sock->sk->sk_xid; + tag.nid = sock->sk->sk_nid; + if (copy_to_user(optval, &tag, sizeof(tag))) + return -EFAULT; + return 0; +} #else #warning duplicate inclusion --- linux-2.6.19.1-vs2.3.0.6/include/linux/vserver/tag.h 2006-12-17 04:19:20 +0100 +++ linux-2.6.19.1-vs2.3.0.6.pcred/include/linux/vserver/tag.h 2007-01-10 15:03:49 +0100 @@ -144,4 +144,10 @@ void __dx_propagate_tag(struct nameidata #define dx_propagate_tag(n,i) do { } while (0) #endif +struct peer_tag { + int32_t xid; + int32_t nid; +}; + + #endif /* _DX_TAG_H */ --- linux-2.6.19.1-vs2.3.0.6/net/core/sock.c 2006-11-08 21:52:09 +0100 +++ linux-2.6.19.1-vs2.3.0.6.pcred/net/core/sock.c 2007-01-10 14:48:20 +0100 @@ -789,6 +789,9 @@ int sock_getsockopt(struct socket *sock, case SO_PEERSEC: return security_socket_getpeersec_stream(sock, optval, optlen, len); + case SO_PEERTAG: + return vx_socket_peer_tag(sock, level, optval, optlen, len); + default: return(-ENOPROTOOPT); }