Add e1000e driver to support ICH9-based nodes.
[linux-2.6.git] / linux-2.6-520-vnet+.patch
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 {
5         XT_MARK_SET=0,
6         XT_MARK_AND,
7         XT_MARK_OR,
8 +       XT_MARK_COPYXID,
9  };
10  
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
15 @@ -0,0 +1,14 @@
16 +#ifndef _XT_SETXID_H_target
17 +#define _XT_SETXID_H_target
18 +
19 +/* Version 1 */
20 +enum {
21 +       XT_SET_PACKET_XID=0
22 +};
23 +
24 +struct xt_setxid_target_info_v1 {
25 +       unsigned long mark;
26 +       u_int8_t mode;
27 +};
28 +
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
33 @@ -9,9 +9,10 @@
34  #define ipt_mark_target_info xt_mark_target_info
35  
36  /* Version 1 */
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
44  
45  #define ipt_mark_target_info_v1 xt_mark_target_info_v1
46  
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
50 @@ -0,0 +1,13 @@
51 +#ifndef _IPT_SETXID_H_target
52 +#define _IPT_SETXID_H_target
53 +
54 +/* Backwards compatibility for old userspace */
55 +
56 +#include <linux/netfilter/xt_SETXID.h>
57 +
58 +/* Version 1 */
59 +#define IPT_SET_PACKET_XID     XT_SET_PACKET_XID
60 +
61 +#define ipt_setxid_target_info_v1 xt_setxid_target_info_v1
62 +
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 {
68  #endif
69  #ifdef CONFIG_NETWORK_SECMARK
70         __u32                   secmark;
71 +#  define skb_tag              secmark
72 +#else
73 +#  define skb_tag              mark
74  #endif
75  
76         __u32                   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 {
81  #define SOL_TIPC       271
82  #define SOL_RXRPC      272
83  
84 +#define SO_SETXID      SO_PEERCRED
85 +
86  /* IPX options */
87  #define IPX_TYPE       1
88  
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
93  /* network caps */
94  
95  #define NXC_RAW_ICMP           0x00000100
96 +#define NXC_RAW_SOCKET         0x00000200
97 +#define NXC_RAW_SEND           0x00000400
98  
99  
100  /* address types */
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;
107  
108 +       /* PLANETLAB. VNET-specific */
109 +       xid_t xid[IP_CT_DIR_MAX];
110 +
111         /* features dynamically at the end: helper, nat (both optional) */
112         char data[0];
113  };
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;
118  
119  extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
120                                     __be32 raddr, __be32 laddr,
121 -                                   int dif);
122 +                                   int dif, int tag);
123  
124  extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
125  
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
129 @@ -56,6 +56,7 @@
130  #include <linux/rtnetlink.h>
131  #include <linux/init.h>
132  #include <linux/scatterlist.h>
133 +#include <linux/vs_network.h>
134  
135  #include <net/protocol.h>
136  #include <net/dst.h>
137 @@ -174,6 +175,7 @@ struct sk_buff *__alloc_skb(unsigned int
138         skb->data = data;
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
146         C(tail);
147         C(end);
148  
149 +       /* Sapan: Cloned skbs aren't owned by anyone. Let the cloner decide who it belongs to. */
150 +
151         atomic_inc(&(skb_shinfo(skb)->dataref));
152         skb->cloned = 1;
153  
154 @@ -492,6 +496,7 @@ static void copy_skb_header(struct sk_bu
155         new->tc_index   = old->tc_index;
156  #endif
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:
166                 }
167                 goto set_sndbuf;
168  
169 +       case SO_SETXID:
170 +               if (current_vx_info()) {
171 +                       ret = -EPERM;
172 +                       break;
173 +               }
174 +               if (val < 0 || val > MAX_S_CONTEXT) {
175 +                       ret = -EINVAL;
176 +                       break;
177 +               }
178 +               sk->sk_xid = val;
179 +               sk->sk_nid = val;
180 +               break;
181 +
182         case SO_RCVBUF:
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];
187  
188                 /* Sorry... */
189 -               if (!capable(CAP_NET_RAW)) {
190 +               if (!nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET)) {
191                         ret = -EPERM;
192                         break;
193                 }
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
198                         return -EAGAIN;
199                 }
200                 inet->sport = htons(inet->num);
201 +               sk->sk_xid = vx_current_xid();
202 +               sk->sk_nid = nx_current_nid();
203         }
204         release_sock(sk);
205         return 0;
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,
212                                                  iph->saddr,
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 @@ -937,8 +937,8 @@ char sysctl_icmp_ipod_key[32+1] = { "SET
219  
220  static void icmp_ping_of_death(struct sk_buff *skb)
221  {
222 -       struct icmphdr *icmph = skb->h.icmph;
223 -       struct iphdr *iph = skb->nh.iph;
224 +       struct icmphdr *icmph = skb_transport_header(skb);
225 +       struct iphdr *iph = skb_network_header(skb);
226         int doit = 0;
227  
228  #if 0
229 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
230 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/ip_options.c       2007-07-21 18:00:25.000000000 -0400
231 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/ip_options.c       2007-11-14 17:03:19.000000000 -0500
232 @@ -409,7 +409,7 @@ int ip_options_compile(struct ip_options
233                                         optptr[2] += 8;
234                                         break;
235                                       default:
236 -                                       if (!skb && !capable(CAP_NET_RAW)) {
237 +                                       if (!skb && !nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET)) {
238                                                 pp_ptr = optptr + 3;
239                                                 goto error;
240                                         }
241 @@ -445,7 +445,7 @@ int ip_options_compile(struct ip_options
242                                 opt->router_alert = optptr - iph;
243                         break;
244                       case IPOPT_CIPSO:
245 -                       if ((!skb && !capable(CAP_NET_RAW)) || opt->cipso) {
246 +                       if ((!skb && !nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET)) || opt->cipso) {
247                                 pp_ptr = optptr;
248                                 goto error;
249                         }
250 @@ -458,7 +458,7 @@ int ip_options_compile(struct ip_options
251                       case IPOPT_SEC:
252                       case IPOPT_SID:
253                       default:
254 -                       if (!skb && !capable(CAP_NET_RAW)) {
255 +                       if (!skb && !nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET)) {
256                                 pp_ptr = optptr;
257                                 goto error;
258                         }
259 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
260 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/netfilter/ipt_LOG.c        2007-08-11 21:54:37.000000000 -0400
261 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/netfilter/ipt_LOG.c        2007-11-14 16:00:55.000000000 -0500
262 @@ -49,6 +49,8 @@ static void dump_packet(const struct nf_
263         else
264                 logflags = NF_LOG_MASK;
265  
266 +       printk("TAG=%d ", skb->skb_tag);
267 +
268         ih = skb_header_pointer(skb, iphoff, sizeof(_iph), &_iph);
269         if (ih == NULL) {
270                 printk("TRUNCATED");
271 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
272 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/ipv4/raw.c      2007-10-29 21:23:59.000000000 -0400
273 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/ipv4/raw.c      2007-11-14 17:02:08.000000000 -0500
274 @@ -103,7 +103,7 @@ static void raw_v4_unhash(struct sock *s
275  
276  struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
277                              __be32 raddr, __be32 laddr,
278 -                            int dif)
279 +                            int dif, int tag)
280  {
281         struct hlist_node *node;
282  
283 @@ -112,6 +112,7 @@ struct sock *__raw_v4_lookup(struct sock
284  
285                 if (inet->num == num                                    &&
286                     !(inet->daddr && inet->daddr != raddr)              &&
287 +                   (!sk->sk_nx_info || tag == 1 || sk->sk_nid == tag)  &&
288                     v4_sock_addr_match(sk->sk_nx_info, inet, laddr)     &&
289                     !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
290                         goto found; /* gotcha */
291 @@ -161,7 +162,7 @@ int raw_v4_input(struct sk_buff *skb, st
292                 goto out;
293         sk = __raw_v4_lookup(__sk_head(head), iph->protocol,
294                              iph->saddr, iph->daddr,
295 -                            skb->dev->ifindex);
296 +                            skb->dev->ifindex, skb->skb_tag);
297  
298         while (sk) {
299                 delivered = 1;
300 @@ -174,7 +175,7 @@ int raw_v4_input(struct sk_buff *skb, st
301                 }
302                 sk = __raw_v4_lookup(sk_next(sk), iph->protocol,
303                                      iph->saddr, iph->daddr,
304 -                                    skb->dev->ifindex);
305 +                                    skb->dev->ifindex, skb->skb_tag);
306         }
307  out:
308         read_unlock(&raw_v4_lock);
309 @@ -315,7 +316,7 @@ static int raw_send_hdrinc(struct sock *
310         }
311  
312         err = -EPERM;
313 -       if (!nx_check(0, VS_ADMIN) && !capable(CAP_NET_RAW) &&
314 +       if (!nx_check(0, VS_ADMIN) && !nx_capable(CAP_NET_RAW, NXC_RAW_SOCKET) &&
315                 sk->sk_nx_info &&
316                 !v4_addr_in_nx_info(sk->sk_nx_info, iph->saddr, NXA_MASK_BIND))
317                 goto error_free;
318 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
319 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Kconfig       2007-07-21 18:00:27.000000000 -0400
320 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Kconfig       2007-11-14 15:27:12.000000000 -0500
321 @@ -389,6 +389,13 @@ config NETFILTER_XT_TARGET_TCPMSS
322  
323           To compile it as a module, choose M here.  If unsure, say N.
324  
325 +config NETFILTER_XT_TARGET_SETXID
326 +       tristate '"SETXID" target support'
327 +       depends on NETFILTER_XTABLES
328 +       help
329 +         This option adds a `SETXID' target, which allows you to alter the
330 +         xid of a socket.
331 +
332  config NETFILTER_XT_MATCH_COMMENT
333         tristate  '"comment" match support'
334         depends on NETFILTER_XTABLES
335 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
336 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/Makefile      2007-07-21 17:58:59.000000000 -0400
337 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/Makefile      2007-11-14 15:25:53.000000000 -0500
338 @@ -37,6 +37,7 @@ obj-$(CONFIG_NF_CONNTRACK_TFTP) += nf_co
339  obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
340  
341  # targets
342 +obj-$(CONFIG_NETFILTER_XT_TARGET_SETXID) += xt_SETXID.o
343  obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o
344  obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o
345  obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
346 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
347 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/nf_conntrack_core.c   2007-07-21 18:00:27.000000000 -0400
348 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/nf_conntrack_core.c   2007-11-14 16:39:09.000000000 -0500
349 @@ -726,6 +726,8 @@ init_conntrack(const struct nf_conntrack
350  
351         /* Overload tuple linked list to put us in unconfirmed list. */
352         list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed);
353 +       conntrack->xid[IP_CT_DIR_ORIGINAL] = -1;
354 +       conntrack->xid[IP_CT_DIR_REPLY] = -1;
355  
356         write_unlock_bh(&nf_conntrack_lock);
357  
358 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
359 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_MARK.c     2007-07-21 17:59:00.000000000 -0400
360 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_MARK.c     2007-11-15 13:57:04.000000000 -0500
361 @@ -5,13 +5,18 @@
362   * This program is free software; you can redistribute it and/or modify
363   * it under the terms of the GNU General Public License version 2 as
364   * published by the Free Software Foundation.
365 + *
366   */
367  
368  #include <linux/module.h>
369 +#include <linux/version.h>
370  #include <linux/skbuff.h>
371  #include <linux/ip.h>
372  #include <net/checksum.h>
373 +#include <net/route.h>
374 +#include <net/inet_hashtables.h>
375  
376 +#include <net/netfilter/nf_conntrack.h>
377  #include <linux/netfilter/x_tables.h>
378  #include <linux/netfilter/xt_MARK.h>
379  
380 @@ -21,6 +26,48 @@ MODULE_DESCRIPTION("ip[6]tables MARK mod
381  MODULE_ALIAS("ipt_MARK");
382  MODULE_ALIAS("ip6t_MARK");
383  
384 +static inline u_int16_t
385 +get_dst_port(struct nf_conntrack_tuple *tuple)
386 +{
387 +       switch (tuple->dst.protonum) {
388 +       case IPPROTO_GRE:
389 +               /* XXX Truncate 32-bit GRE key to 16 bits */
390 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
391 +               return tuple->dst.u.gre.key;
392 +#else
393 +               return htons(ntohl(tuple->dst.u.gre.key));
394 +#endif  
395 +       case IPPROTO_ICMP:
396 +               /* Bind on ICMP echo ID */
397 +               return tuple->src.u.icmp.id;
398 +       case IPPROTO_TCP:
399 +               return tuple->dst.u.tcp.port;
400 +       case IPPROTO_UDP:
401 +               return tuple->dst.u.udp.port;
402 +       default:
403 +               return tuple->dst.u.all;
404 +       }
405 +}
406 +
407 +static inline u_int16_t
408 +get_src_port(struct nf_conntrack_tuple *tuple)
409 +{
410 +       switch (tuple->dst.protonum) {
411 +       case IPPROTO_GRE:
412 +               /* XXX Truncate 32-bit GRE key to 16 bits */
413 +               return htons(ntohl(tuple->src.u.gre.key));
414 +       case IPPROTO_ICMP:
415 +               /* Bind on ICMP echo ID */
416 +               return tuple->src.u.icmp.id;
417 +       case IPPROTO_TCP:
418 +               return tuple->src.u.tcp.port;
419 +       case IPPROTO_UDP:
420 +               return tuple->src.u.udp.port;
421 +       default:
422 +               return tuple->src.u.all;
423 +       }
424 +}
425 +
426  static unsigned int
427  target_v0(struct sk_buff **pskb,
428           const struct net_device *in,
429 @@ -44,7 +91,7 @@ target_v1(struct sk_buff **pskb,
430           const void *targinfo)
431  {
432         const struct xt_mark_target_info_v1 *markinfo = targinfo;
433 -       int mark = 0;
434 +       int mark = -1;
435  
436         switch (markinfo->mode) {
437         case XT_MARK_SET:
438 @@ -58,9 +105,52 @@ target_v1(struct sk_buff **pskb,
439         case XT_MARK_OR:
440                 mark = (*pskb)->mark | markinfo->mark;
441                 break;
442 +
443 +       case XT_MARK_COPYXID: {
444 +               enum ip_conntrack_info ctinfo;
445 +               struct sock *connection_sk;
446 +               int dif;
447 +
448 +               struct nf_conn *ct = nf_ct_get((*pskb), &ctinfo);
449 +               extern struct inet_hashinfo tcp_hashinfo;
450 +               enum ip_conntrack_dir dir;
451 +
452 +               if (!ct) 
453 +                       break;
454 +               dir = CTINFO2DIR(ctinfo);
455 +               u_int32_t src_ip = ct->tuplehash[dir].tuple.src.u3.ip;
456 +               u_int16_t src_port = get_src_port(&ct->tuplehash[dir].tuple);
457 +
458 +               u_int32_t ip;
459 +               u_int16_t port;
460 +
461 +               dif = ((struct rtable *)(*pskb)->dst)->rt_iif;
462 +               ip = ct->tuplehash[dir].tuple.dst.u3.ip;
463 +               port = get_dst_port(&ct->tuplehash[dir].tuple);
464 +
465 +               if ((*pskb)->sk) 
466 +                       connection_sk = (*pskb)->sk;
467 +               else {
468 +                       connection_sk = inet_lookup(&tcp_hashinfo, src_ip, src_port, ip, port, dif);
469 +               }
470 +
471 +               if (connection_sk) {
472 +#ifdef REQUIRESFIXFROMSAPAN
473 +                       connection_sk->sk_peercred.gid = connection_sk->sk_peercred.uid = ct->xid[dir];
474 +                       ct->xid[!dir]=connection_sk->sk_xid;
475 +                       /*connection_sk->sk_peercred.gid = connection_sk->sk_peercred.uid = connection_sk->sk_xid;*/
476 +                       if (connection_sk->sk_xid != 0) 
477 +                               mark = connection_sk->sk_xid;
478 +#endif
479 +                       if (connection_sk != (*pskb)->sk)
480 +                               sock_put(connection_sk);
481 +               }
482 +               break;
483 +               }
484         }
485  
486 -       (*pskb)->mark = mark;
487 +       if (mark != -1)
488 +               (*pskb)->mark = mark;
489         return XT_CONTINUE;
490  }
491  
492 @@ -92,7 +182,8 @@ checkentry_v1(const char *tablename,
493  
494         if (markinfo->mode != XT_MARK_SET
495             && markinfo->mode != XT_MARK_AND
496 -           && markinfo->mode != XT_MARK_OR) {
497 +           && markinfo->mode != XT_MARK_OR
498 +           && markinfo->mode != XT_MARK_COPYXID) {
499                 printk(KERN_WARNING "MARK: unknown mode %u\n",
500                        markinfo->mode);
501                 return 0;
502 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
503 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/netfilter/xt_SETXID.c   1969-12-31 19:00:00.000000000 -0500
504 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/netfilter/xt_SETXID.c   2007-11-14 16:20:02.000000000 -0500
505 @@ -0,0 +1,79 @@
506 +#include <linux/module.h>
507 +#include <linux/skbuff.h>
508 +#include <linux/ip.h>
509 +#include <net/checksum.h>
510 +#include <linux/vs_network.h>
511 +
512 +#include <linux/netfilter/x_tables.h>
513 +#include <linux/netfilter/xt_SETXID.h>
514 +
515 +MODULE_LICENSE("GPL");
516 +MODULE_AUTHOR("");
517 +MODULE_DESCRIPTION("");
518 +MODULE_ALIAS("ipt_SETXID");
519 +
520 +static unsigned int
521 +target_v1(struct sk_buff **pskb,
522 +         const struct net_device *in,
523 +         const struct net_device *out,
524 +         unsigned int hooknum,
525 +         const struct xt_target *target,
526 +         const void *targinfo)
527 +{
528 +       const struct xt_setxid_target_info_v1 *setxidinfo = targinfo;
529 +
530 +       switch (setxidinfo->mode) {
531 +       case XT_SET_PACKET_XID:
532 +                (*pskb)->skb_tag = setxidinfo->mark;
533 +               break;
534 +       }
535 +       return XT_CONTINUE;
536 +}
537 +
538 +
539 +static int
540 +checkentry_v1(const char *tablename,
541 +             const void *entry,
542 +             const struct xt_target *target,
543 +             void *targinfo,
544 +             unsigned int hook_mask)
545 +{
546 +       struct xt_setxid_target_info_v1 *setxidinfo = targinfo;
547 +
548 +       if (setxidinfo->mode != XT_SET_PACKET_XID) {
549 +               printk(KERN_WARNING "SETXID: unknown mode %u\n",
550 +                      setxidinfo->mode);
551 +               return 0;
552 +       }
553 +
554 +       return 1;
555 +}
556 +
557 +static struct xt_target xt_setxid_target[] = {
558 +       {
559 +               .name           = "SETXID",
560 +               .family         = AF_INET,
561 +               .revision       = 1,
562 +               .checkentry     = checkentry_v1,
563 +               .target         = target_v1,
564 +               .targetsize     = sizeof(struct xt_setxid_target_info_v1),
565 +               .table          = "mangle",
566 +               .me             = THIS_MODULE,
567 +       }
568 +};
569 +
570 +static int __init init(void)
571 +{
572 +       int err;
573 +
574 +       err = xt_register_targets(xt_setxid_target, ARRAY_SIZE(xt_setxid_target));
575 +       return err;
576 +}
577 +
578 +static void __exit fini(void)
579 +{
580 +       xt_unregister_targets(xt_setxid_target, ARRAY_SIZE(xt_setxid_target));
581 +}
582 +
583 +module_init(init);
584 +module_exit(fini);
585 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
586 --- linux-2.6.22.10-vs2.3.0.29-pl03/net/packet/af_packet.c      2007-07-21 18:00:27.000000000 -0400
587 +++ linux-2.6.22.10-vs2.3.0.29-pl04/net/packet/af_packet.c      2007-11-15 13:57:04.000000000 -0500
588 @@ -78,6 +78,7 @@
589  #include <linux/poll.h>
590  #include <linux/module.h>
591  #include <linux/init.h>
592 +#include <linux/vs_network.h>
593  
594  #ifdef CONFIG_INET
595  #include <net/inet_common.h>
596 @@ -420,6 +421,10 @@ static inline unsigned int run_filter(st
597                                       unsigned int res)
598  {
599         struct sk_filter *filter;
600 +       int tag = skb->skb_tag;
601 +
602 +       if (sk->sk_nx_info && !(tag == 1 || sk->sk_nid == tag))
603 +               return 0;
604  
605         rcu_read_lock_bh();
606         filter = rcu_dereference(sk->sk_filter);
607 @@ -984,7 +989,7 @@ static int packet_create(struct socket *
608         __be16 proto = (__force __be16)protocol; /* weird, but documented */
609         int err;
610  
611 -       if (!capable(CAP_NET_RAW))
612 +       if (!nx_capable(CAP_NET_RAW, NXC_RAW_SEND))
613                 return -EPERM;
614         if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW &&
615             sock->type != SOCK_PACKET)