1 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_MARK.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter/xt_MARK.h
2 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_MARK.h 2006-06-17 21:49:35.000000000 -0400
3 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter/xt_MARK.h 2007-11-14 16:04:04.000000000 -0500
4 @@ -11,6 +11,7 @@ enum {
11 struct xt_mark_target_info_v1 {
12 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_SETXID.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter/xt_SETXID.h
13 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter/xt_SETXID.h 1969-12-31 19:00:00.000000000 -0500
14 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter/xt_SETXID.h 2007-11-14 16:05:44.000000000 -0500
16 +#ifndef _XT_SETXID_H_target
17 +#define _XT_SETXID_H_target
24 +struct xt_setxid_target_info_v1 {
29 +#endif /*_XT_SETXID_H_target*/
30 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_MARK.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter_ipv4/ipt_MARK.h
31 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_MARK.h 2006-06-17 21:49:35.000000000 -0400
32 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter_ipv4/ipt_MARK.h 2007-11-14 16:03:44.000000000 -0500
34 #define ipt_mark_target_info xt_mark_target_info
37 -#define IPT_MARK_SET XT_MARK_SET
38 -#define IPT_MARK_AND XT_MARK_AND
39 -#define IPT_MARK_OR XT_MARK_OR
40 +#define IPT_MARK_SET XT_MARK_SET
41 +#define IPT_MARK_AND XT_MARK_AND
42 +#define IPT_MARK_OR XT_MARK_OR
43 +#define IPT_MARK_COPYXID XT_MARK_COPYXID
45 #define ipt_mark_target_info_v1 xt_mark_target_info_v1
47 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_SETXID.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter_ipv4/ipt_SETXID.h
48 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/netfilter_ipv4/ipt_SETXID.h 1969-12-31 19:00:00.000000000 -0500
49 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/netfilter_ipv4/ipt_SETXID.h 2007-11-14 16:05:44.000000000 -0500
51 +#ifndef _IPT_SETXID_H_target
52 +#define _IPT_SETXID_H_target
54 +/* Backwards compatibility for old userspace */
56 +#include <linux/netfilter/xt_SETXID.h>
59 +#define IPT_SET_PACKET_XID XT_SET_PACKET_XID
61 +#define ipt_setxid_target_info_v1 xt_setxid_target_info_v1
63 +#endif /*_IPT_SETXID_H_target*/
64 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/skbuff.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/skbuff.h
65 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/skbuff.h 2007-07-21 18:00:24.000000000 -0400
66 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/skbuff.h 2007-11-15 13:57:04.000000000 -0500
67 @@ -299,6 +299,9 @@ struct sk_buff {
69 #ifdef CONFIG_NETWORK_SECMARK
71 +# define skb_tag secmark
73 +# define skb_tag mark
77 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/socket.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/socket.h
78 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/socket.h 2007-07-21 18:00:24.000000000 -0400
79 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/socket.h 2007-11-14 14:24:36.000000000 -0500
80 @@ -288,6 +288,8 @@ struct ucred {
84 +#define SO_SETXID SO_PEERCRED
89 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/vserver/network.h linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/vserver/network.h
90 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/linux/vserver/network.h 2007-10-29 21:23:59.000000000 -0400
91 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/linux/vserver/network.h 2007-11-14 14:23:54.000000000 -0500
92 @@ -44,6 +44,8 @@ static inline uint64_t __nxf_init_set(vo
95 #define NXC_RAW_ICMP 0x00000100
96 +#define NXC_RAW_SOCKET 0x00000200
97 +#define NXC_RAW_SEND 0x00000400
101 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/net/netfilter/nf_conntrack.h linux-2.6.22.10-vs2.3.0.29-pl04/include/net/netfilter/nf_conntrack.h
102 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/net/netfilter/nf_conntrack.h 2007-07-21 18:00:24.000000000 -0400
103 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/net/netfilter/nf_conntrack.h 2007-11-14 16:35:42.000000000 -0500
104 @@ -131,6 +131,9 @@ struct nf_conn
105 /* Storage reserved for other modules: */
106 union nf_conntrack_proto proto;
108 + /* PLANETLAB. VNET-specific */
109 + xid_t xid[IP_CT_DIR_MAX];
111 /* features dynamically at the end: helper, nat (both optional) */
114 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/include/net/raw.h linux-2.6.22.10-vs2.3.0.29-pl04/include/net/raw.h
115 --- linux-2.6.22.10-vs2.3.0.29-pl03/include/net/raw.h 2007-05-04 09:55:46.000000000 -0400
116 +++ linux-2.6.22.10-vs2.3.0.29-pl04/include/net/raw.h 2007-11-14 14:22:49.000000000 -0500
117 @@ -36,7 +36,7 @@ extern rwlock_t raw_v4_lock;
119 extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
120 __be32 raddr, __be32 laddr,
124 extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
126 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/skbuff.c linux-2.6.22.10-vs2.3.0.29-pl04/net/core/skbuff.c
127 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/core/skbuff.c 2007-07-21 18:00:25.000000000 -0400
128 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/core/skbuff.c 2007-11-14 15:12:52.000000000 -0500
130 #include <linux/rtnetlink.h>
131 #include <linux/init.h>
132 #include <linux/scatterlist.h>
133 +#include <linux/vs_network.h>
135 #include <net/protocol.h>
137 @@ -174,6 +175,7 @@ struct sk_buff *__alloc_skb(unsigned int
139 skb_reset_tail_pointer(skb);
140 skb->end = skb->tail + size;
141 + skb->skb_tag = nx_current_nid();
142 /* make sure we initialize shinfo sequentially */
143 shinfo = skb_shinfo(skb);
144 atomic_set(&shinfo->dataref, 1);
145 @@ -443,6 +445,8 @@ struct sk_buff *skb_clone(struct sk_buff
149 + /* Sapan: Cloned skbs aren't owned by anyone. Let the cloner decide who it belongs to. */
151 atomic_inc(&(skb_shinfo(skb)->dataref));
154 @@ -492,6 +496,7 @@ static void copy_skb_header(struct sk_bu
155 new->tc_index = old->tc_index;
157 skb_copy_secmark(new, old);
158 + new->skb_tag = old->skb_tag;
159 atomic_set(&new->users, 1);
160 skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
161 skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
162 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/core/sock.c linux-2.6.22.10-vs2.3.0.29-pl04/net/core/sock.c
163 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/core/sock.c 2007-10-29 21:23:59.000000000 -0400
164 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/core/sock.c 2007-11-14 14:36:36.000000000 -0500
165 @@ -444,6 +444,19 @@ set_sndbuf:
170 + if (current_vx_info()) {
174 + if (val < 0 || val > MAX_S_CONTEXT) {
183 /* Don't error on this BSD doesn't and if you think
184 about it this is right. Otherwise apps have to
185 @@ -573,7 +586,7 @@ set_rcvbuf:
186 char devname[IFNAMSIZ];
189 - if (!capable(CAP_NET_RAW)) {
190 + if (!nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET)) {
194 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/af_inet.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/af_inet.c
195 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/af_inet.c 2007-10-29 21:23:59.000000000 -0400
196 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/af_inet.c 2007-11-14 16:40:54.000000000 -0500
197 @@ -178,6 +178,8 @@ static int inet_autobind(struct sock *sk
200 inet->sport = htons(inet->num);
201 + sk->sk_xid = vx_current_xid();
202 + sk->sk_nid = nx_current_nid();
206 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/icmp.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/icmp.c
207 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/icmp.c 2007-11-14 14:00:56.000000000 -0500
208 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/icmp.c 2007-11-15 13:57:04.000000000 -0500
209 @@ -709,7 +709,7 @@ static void icmp_unreach(struct sk_buff
210 if ((raw_sk = sk_head(&raw_v4_htable[hash])) != NULL) {
211 while ((raw_sk = __raw_v4_lookup(raw_sk, protocol, iph->daddr,
213 - skb->dev->ifindex)) != NULL) {
214 + skb->dev->ifindex, skb->skb_tag)) != NULL) {
215 raw_err(raw_sk, skb, info);
216 raw_sk = sk_next(raw_sk);
217 iph = (struct iphdr *)skb->data;
218 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/ip_options.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/ip_options.c
219 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/ip_options.c 2007-07-21 18:00:25.000000000 -0400
220 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/ip_options.c 2007-11-14 17:03:19.000000000 -0500
221 @@ -409,7 +409,7 @@ int ip_options_compile(struct ip_options
225 - if (!skb && !capable(CAP_NET_RAW)) {
226 + if (!skb && !nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET)) {
230 @@ -445,7 +445,7 @@ int ip_options_compile(struct ip_options
231 opt->router_alert = optptr - iph;
234 - if ((!skb && !capable(CAP_NET_RAW)) || opt->cipso) {
235 + if ((!skb && !nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET)) || opt->cipso) {
239 @@ -458,7 +458,7 @@ int ip_options_compile(struct ip_options
243 - if (!skb && !capable(CAP_NET_RAW)) {
244 + if (!skb && !nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET)) {
248 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/netfilter/ipt_LOG.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/netfilter/ipt_LOG.c
249 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/netfilter/ipt_LOG.c 2007-08-11 21:54:37.000000000 -0400
250 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/netfilter/ipt_LOG.c 2007-11-14 16:00:55.000000000 -0500
251 @@ -49,6 +49,8 @@ static void dump_packet(const struct nf_
253 logflags = NF_LOG_MASK;
255 + printk("TAG=%d ", skb->skb_tag);
257 ih = skb_header_pointer(skb, iphoff, sizeof(_iph), &_iph);
260 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/raw.c
261 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c 2007-10-29 21:23:59.000000000 -0400
262 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/raw.c 2007-11-14 17:02:08.000000000 -0500
263 @@ -103,7 +103,7 @@ static void raw_v4_unhash(struct sock *s
265 struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
266 __be32 raddr, __be32 laddr,
270 struct hlist_node *node;
272 @@ -112,6 +112,7 @@ struct sock *__raw_v4_lookup(struct sock
274 if (inet->num == num &&
275 !(inet->daddr && inet->daddr != raddr) &&
276 + (!sk->sk_nx_info || tag == 1 || sk->sk_nid == tag) &&
277 v4_sock_addr_match(sk->sk_nx_info, inet, laddr) &&
278 !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
279 goto found; /* gotcha */
280 @@ -161,7 +162,7 @@ int raw_v4_input(struct sk_buff *skb, st
282 sk = __raw_v4_lookup(__sk_head(head), iph->protocol,
283 iph->saddr, iph->daddr,
284 - skb->dev->ifindex);
285 + skb->dev->ifindex, skb->skb_tag);
289 @@ -174,7 +175,7 @@ int raw_v4_input(struct sk_buff *skb, st
291 sk = __raw_v4_lookup(sk_next(sk), iph->protocol,
292 iph->saddr, iph->daddr,
293 - skb->dev->ifindex);
294 + skb->dev->ifindex, skb->skb_tag);
297 read_unlock(&raw_v4_lock);
298 @@ -315,7 +316,7 @@ static int raw_send_hdrinc(struct sock *
302 - if (!nx_check(0, VS_ADMIN) && !capable(CAP_NET_RAW) &&
303 + if (!nx_check(0, VS_ADMIN) && !nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET) &&
305 !v4_addr_in_nx_info(sk->sk_nx_info, iph->saddr, NXA_MASK_BIND))
307 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Kconfig linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Kconfig
308 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Kconfig 2007-07-21 18:00:27.000000000 -0400
309 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Kconfig 2007-11-14 15:27:12.000000000 -0500
310 @@ -389,6 +389,13 @@ config NETFILTER_XT_TARGET_TCPMSS
312 To compile it as a module, choose M here. If unsure, say N.
314 +config NETFILTER_XT_TARGET_SETXID
315 + tristate '"SETXID" target support'
316 + depends on NETFILTER_XTABLES
318 + This option adds a `SETXID' target, which allows you to alter the
321 config NETFILTER_XT_MATCH_COMMENT
322 tristate '"comment" match support'
323 depends on NETFILTER_XTABLES
324 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Makefile linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Makefile
325 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Makefile 2007-07-21 17:58:59.000000000 -0400
326 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Makefile 2007-11-14 15:25:53.000000000 -0500
327 @@ -37,6 +37,7 @@ obj-$(CONFIG_NF_CONNTRACK_TFTP) += nf_co
328 obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
331 +obj-$(CONFIG_NETFILTER_XT_TARGET_SETXID) += xt_SETXID.o
332 obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o
333 obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o
334 obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
335 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/nf_conntrack_core.c linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/nf_conntrack_core.c
336 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/nf_conntrack_core.c 2007-07-21 18:00:27.000000000 -0400
337 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/nf_conntrack_core.c 2007-11-14 16:39:09.000000000 -0500
338 @@ -726,6 +726,8 @@ init_conntrack(const struct nf_conntrack
340 /* Overload tuple linked list to put us in unconfirmed list. */
341 list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed);
342 + conntrack->xid[IP_CT_DIR_ORIGINAL] = -1;
343 + conntrack->xid[IP_CT_DIR_REPLY] = -1;
345 write_unlock_bh(&nf_conntrack_lock);
347 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_MARK.c linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_MARK.c
348 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_MARK.c 2007-07-21 17:59:00.000000000 -0400
349 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_MARK.c 2007-11-15 13:57:04.000000000 -0500
351 * This program is free software; you can redistribute it and/or modify
352 * it under the terms of the GNU General Public License version 2 as
353 * published by the Free Software Foundation.
357 #include <linux/module.h>
358 +#include <linux/version.h>
359 #include <linux/skbuff.h>
360 #include <linux/ip.h>
361 #include <net/checksum.h>
362 +#include <net/route.h>
363 +#include <net/inet_hashtables.h>
365 +#include <net/netfilter/nf_conntrack.h>
366 #include <linux/netfilter/x_tables.h>
367 #include <linux/netfilter/xt_MARK.h>
369 @@ -21,6 +26,48 @@ MODULE_DESCRIPTION("ip[6]tables MARK mod
370 MODULE_ALIAS("ipt_MARK");
371 MODULE_ALIAS("ip6t_MARK");
373 +static inline u_int16_t
374 +get_dst_port(struct nf_conntrack_tuple *tuple)
376 + switch (tuple->dst.protonum) {
378 + /* XXX Truncate 32-bit GRE key to 16 bits */
379 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
380 + return tuple->dst.u.gre.key;
382 + return htons(ntohl(tuple->dst.u.gre.key));
385 + /* Bind on ICMP echo ID */
386 + return tuple->src.u.icmp.id;
388 + return tuple->dst.u.tcp.port;
390 + return tuple->dst.u.udp.port;
392 + return tuple->dst.u.all;
396 +static inline u_int16_t
397 +get_src_port(struct nf_conntrack_tuple *tuple)
399 + switch (tuple->dst.protonum) {
401 + /* XXX Truncate 32-bit GRE key to 16 bits */
402 + return htons(ntohl(tuple->src.u.gre.key));
404 + /* Bind on ICMP echo ID */
405 + return tuple->src.u.icmp.id;
407 + return tuple->src.u.tcp.port;
409 + return tuple->src.u.udp.port;
411 + return tuple->src.u.all;
416 target_v0(struct sk_buff **pskb,
417 const struct net_device *in,
418 @@ -44,7 +91,7 @@ target_v1(struct sk_buff **pskb,
419 const void *targinfo)
421 const struct xt_mark_target_info_v1 *markinfo = targinfo;
425 switch (markinfo->mode) {
427 @@ -58,9 +105,52 @@ target_v1(struct sk_buff **pskb,
429 mark = (*pskb)->mark | markinfo->mark;
432 + case XT_MARK_COPYXID: {
433 + enum ip_conntrack_info ctinfo;
434 + struct sock *connection_sk;
437 + struct nf_conn *ct = nf_ct_get((*pskb), &ctinfo);
438 + extern struct inet_hashinfo tcp_hashinfo;
439 + enum ip_conntrack_dir dir;
443 + dir = CTINFO2DIR(ctinfo);
444 + u_int32_t src_ip = ct->tuplehash[dir].tuple.src.u3.ip;
445 + u_int16_t src_port = get_src_port(&ct->tuplehash[dir].tuple);
450 + dif = ((struct rtable *)(*pskb)->dst)->rt_iif;
451 + ip = ct->tuplehash[dir].tuple.dst.u3.ip;
452 + port = get_dst_port(&ct->tuplehash[dir].tuple);
455 + connection_sk = (*pskb)->sk;
457 + connection_sk = inet_lookup(&tcp_hashinfo, src_ip, src_port, ip, port, dif);
460 + if (connection_sk) {
461 +#ifdef REQUIRESFIXFROMSAPAN
462 + connection_sk->sk_peercred.gid = connection_sk->sk_peercred.uid = ct->xid[dir];
463 + ct->xid[!dir]=connection_sk->sk_xid;
464 + /*connection_sk->sk_peercred.gid = connection_sk->sk_peercred.uid = connection_sk->sk_xid;*/
465 + if (connection_sk->sk_xid != 0)
466 + mark = connection_sk->sk_xid;
468 + if (connection_sk != (*pskb)->sk)
469 + sock_put(connection_sk);
475 - (*pskb)->mark = mark;
477 + (*pskb)->mark = mark;
481 @@ -92,7 +182,8 @@ checkentry_v1(const char *tablename,
483 if (markinfo->mode != XT_MARK_SET
484 && markinfo->mode != XT_MARK_AND
485 - && markinfo->mode != XT_MARK_OR) {
486 + && markinfo->mode != XT_MARK_OR
487 + && markinfo->mode != XT_MARK_COPYXID) {
488 printk(KERN_WARNING "MARK: unknown mode %u\n",
491 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_SETXID.c linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_SETXID.c
492 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_SETXID.c 1969-12-31 19:00:00.000000000 -0500
493 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_SETXID.c 2007-11-14 16:20:02.000000000 -0500
495 +#include <linux/module.h>
496 +#include <linux/skbuff.h>
497 +#include <linux/ip.h>
498 +#include <net/checksum.h>
499 +#include <linux/vs_network.h>
501 +#include <linux/netfilter/x_tables.h>
502 +#include <linux/netfilter/xt_SETXID.h>
504 +MODULE_LICENSE("GPL");
506 +MODULE_DESCRIPTION("");
507 +MODULE_ALIAS("ipt_SETXID");
510 +target_v1(struct sk_buff **pskb,
511 + const struct net_device *in,
512 + const struct net_device *out,
513 + unsigned int hooknum,
514 + const struct xt_target *target,
515 + const void *targinfo)
517 + const struct xt_setxid_target_info_v1 *setxidinfo = targinfo;
519 + switch (setxidinfo->mode) {
520 + case XT_SET_PACKET_XID:
521 + (*pskb)->skb_tag = setxidinfo->mark;
524 + return XT_CONTINUE;
529 +checkentry_v1(const char *tablename,
531 + const struct xt_target *target,
533 + unsigned int hook_mask)
535 + struct xt_setxid_target_info_v1 *setxidinfo = targinfo;
537 + if (setxidinfo->mode != XT_SET_PACKET_XID) {
538 + printk(KERN_WARNING "SETXID: unknown mode %u\n",
546 +static struct xt_target xt_setxid_target[] = {
551 + .checkentry = checkentry_v1,
552 + .target = target_v1,
553 + .targetsize = sizeof(struct xt_setxid_target_info_v1),
559 +static int __init init(void)
563 + err = xt_register_targets(xt_setxid_target, ARRAY_SIZE(xt_setxid_target));
567 +static void __exit fini(void)
569 + xt_unregister_targets(xt_setxid_target, ARRAY_SIZE(xt_setxid_target));
574 diff -Nurp linux-2.6.22.10-vs2.3.0.29-pl03/net/packet/af_packet.c linux-2.6.22.10-vs2.3.0.29-pl04/net/packet/af_packet.c
575 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/packet/af_packet.c 2007-07-21 18:00:27.000000000 -0400
576 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/packet/af_packet.c 2007-11-15 13:57:04.000000000 -0500
578 #include <linux/poll.h>
579 #include <linux/module.h>
580 #include <linux/init.h>
581 +#include <linux/vs_network.h>
584 #include <net/inet_common.h>
585 @@ -420,6 +421,10 @@ static inline unsigned int run_filter(st
588 struct sk_filter *filter;
589 + int tag = skb->skb_tag;
591 + if (sk->sk_nx_info && !(tag == 1 || sk->sk_nid == tag))
595 filter = rcu_dereference(sk->sk_filter);
596 @@ -984,7 +989,7 @@ static int packet_create(struct socket *
597 __be16 proto = (__force __be16)protocol; /* weird, but documented */
600 - if (!capable(CAP_NET_RAW))
601 + if (!nx_capable(CAP_NET_RAW, NXC_RAW_SEND))
603 if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW &&
604 sock->type != SOCK_PACKET)