adjust planetlab patchset against RHEL kernel
[linux-2.6.git] / linux-2.6-521-packet-tagging.patch
1 diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
2 index 567776e..1b64e1e 100644
3 --- a/include/linux/skbuff.h
4 +++ b/include/linux/skbuff.h
5 @@ -394,6 +394,8 @@ struct sk_buff {
6                 __u32           dropcount;
7         };
8  
9 +#define skb_tag                        mark
10 +
11         __u16                   vlan_tci;
12  
13         sk_buff_data_t          transport_header;
14 diff --git a/net/core/skbuff.c b/net/core/skbuff.c
15 index ec85681..d5a641e 100644
16 --- a/net/core/skbuff.c
17 +++ b/net/core/skbuff.c
18 @@ -208,6 +208,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
19         skb->mac_header = ~0U;
20  #endif
21  
22 +       if (!in_interrupt()) skb->skb_tag = nx_current_nid(); else skb->skb_tag = 0;
23         /* make sure we initialize shinfo sequentially */
24         shinfo = skb_shinfo(skb);
25         atomic_set(&shinfo->dataref, 1);
26 @@ -559,6 +560,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
27  #endif
28  #endif
29         new->vlan_tci           = old->vlan_tci;
30 +       new->skb_tag            = old->skb_tag;
31  
32         skb_copy_secmark(new, old);
33  }
34 diff --git a/net/core/sock.c b/net/core/sock.c
35 index 617fae7..d276d4b 100644
36 --- a/net/core/sock.c
37 +++ b/net/core/sock.c
38 @@ -1056,6 +1056,8 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
39                 sk->sk_prot = sk->sk_prot_creator = prot;
40                 sock_lock_init(sk);
41                 sock_net_set(sk, get_net(net));
42 +               if (!in_interrupt())
43 +                       sk->sk_mark = nx_current_nid();
44                 atomic_set(&sk->sk_wmem_alloc, 1);
45         }
46  
47 diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
48 index 7731d22..026c3b1 100644
49 --- a/net/ipv4/af_inet.c
50 +++ b/net/ipv4/af_inet.c
51 @@ -181,6 +181,8 @@ static int inet_autobind(struct sock *sk)
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 --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
61 index acc44c6..ac29a8c 100644
62 --- a/net/ipv4/netfilter/ipt_LOG.c
63 +++ b/net/ipv4/netfilter/ipt_LOG.c
64 @@ -45,6 +45,8 @@ static void dump_packet(const struct nf_loginfo *info,
65         else
66                 logflags = NF_LOG_MASK;
67  
68 +       printk("TAG=%d ", skb->skb_tag);
69 +
70         ih = skb_header_pointer(skb, iphoff, sizeof(_iph), &_iph);
71         if (ih == NULL) {
72                 printk("TRUNCATED");