Setting tag linux-2.6-22-50
[linux-2.6.git] / linux-2.6-521-packet-tagging.patch
1 diff -Nurb linux-2.6.22-510/include/linux/skbuff.h linux-2.6.22-520/include/linux/skbuff.h
2 --- linux-2.6.22-510/include/linux/skbuff.h     2007-07-08 19:32:17.000000000 -0400
3 +++ linux-2.6.22-520/include/linux/skbuff.h     2008-06-06 17:07:56.000000000 -0400
4 @@ -302,6 +302,7 @@
5  #endif
6  
7         __u32                   mark;
8 +#define skb_tag                        mark
9  
10         sk_buff_data_t          transport_header;
11         sk_buff_data_t          network_header;
12 diff -Nurb linux-2.6.22-510/net/core/skbuff.c linux-2.6.22-520/net/core/skbuff.c
13 --- linux-2.6.22-510/net/core/skbuff.c  2007-07-08 19:32:17.000000000 -0400
14 +++ linux-2.6.22-520/net/core/skbuff.c  2008-06-06 17:07:56.000000000 -0400
15 @@ -56,6 +56,7 @@
16  #include <linux/rtnetlink.h>
17  #include <linux/init.h>
18  #include <linux/scatterlist.h>
19 +#include <linux/vs_network.h>
20  
21  #include <net/protocol.h>
22  #include <net/dst.h>
23 @@ -174,6 +175,7 @@
24         skb->data = data;
25         skb_reset_tail_pointer(skb);
26         skb->end = skb->tail + size;
27 +       if (!in_interrupt()) skb->skb_tag = nx_current_nid(); else skb->skb_tag = 0;
28         /* make sure we initialize shinfo sequentially */
29         shinfo = skb_shinfo(skb);
30         atomic_set(&shinfo->dataref, 1);
31 @@ -443,6 +445,8 @@
32         C(tail);
33         C(end);
34  
35 +       /* Sapan: Cloned skbs aren't owned by anyone. Let the cloner decide who it belongs to. */
36 +
37         atomic_inc(&(skb_shinfo(skb)->dataref));
38         skb->cloned = 1;
39  
40 @@ -492,6 +496,7 @@
41         new->tc_index   = old->tc_index;
42  #endif
43         skb_copy_secmark(new, old);
44 +       new->skb_tag = old->skb_tag;
45         atomic_set(&new->users, 1);
46         skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
47         skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
48 diff -Nurb linux-2.6.22-510/net/ipv4/af_inet.c linux-2.6.22-520/net/ipv4/af_inet.c
49 --- linux-2.6.22-510/net/ipv4/af_inet.c 2008-06-06 17:07:48.000000000 -0400
50 +++ linux-2.6.22-520/net/ipv4/af_inet.c 2008-06-06 17:07:56.000000000 -0400
51 @@ -178,6 +178,8 @@
52                         return -EAGAIN;
53                 }
54                 inet->sport = htons(inet->num);
55 +               sk->sk_xid = vx_current_xid();
56 +               if (!in_interrupt()) sk->sk_nid = nx_current_nid(); else sk->sk_nid=0;
57         }
58         release_sock(sk);
59         return 0;
60 diff -Nurb linux-2.6.22-510/net/ipv4/netfilter/ipt_LOG.c linux-2.6.22-520/net/ipv4/netfilter/ipt_LOG.c
61 --- linux-2.6.22-510/net/ipv4/netfilter/ipt_LOG.c       2008-06-06 17:07:43.000000000 -0400
62 +++ linux-2.6.22-520/net/ipv4/netfilter/ipt_LOG.c       2008-06-06 17:07:56.000000000 -0400
63 @@ -49,6 +49,8 @@
64         else
65                 logflags = NF_LOG_MASK;
66  
67 +       printk("TAG=%d ", skb->skb_tag);
68 +
69         ih = skb_header_pointer(skb, iphoff, sizeof(_iph), &_iph);
70         if (ih == NULL) {
71                 printk("TRUNCATED");
72