-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux-2.6-521-packet-tagging.patch
72 lines (66 loc) · 2.17 KB
/
linux-2.6-521-packet-tagging.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fbd0dc7..5cd5e9c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -478,6 +478,8 @@ struct sk_buff {
__u32 dropcount;
};
+#define skb_tag mark
+
__u16 vlan_tci;
#ifndef __GENKSYMS__
__u16 rxhash;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 48593de..6a0153a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -214,6 +214,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
skb->transport_header = ~0U;
#endif
+ if (!in_interrupt()) skb->skb_tag = nx_current_nid(); else skb->skb_tag = 0;
/* make sure we initialize shinfo sequentially */
shinfo = skb_shinfo(skb);
atomic_set(&shinfo->dataref, 1);
@@ -634,6 +635,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
#endif
#endif
new->vlan_tci = old->vlan_tci;
+ new->skb_tag = old->skb_tag;
skb_copy_secmark(new, old);
diff --git a/net/core/sock.c b/net/core/sock.c
index ed068e1..5b70afc 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1176,6 +1176,8 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
sk->sk_prot = sk->sk_prot_creator = prot;
sock_lock_init(sk);
sock_net_set(sk, get_net(net));
+ if (!in_interrupt())
+ sk->sk_mark = nx_current_nid();
atomic_set(&sk->sk_wmem_alloc, 1);
sock_update_classid(sk);
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 6a8a6fd..4ba7f40 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -178,6 +178,8 @@ static int inet_autobind(struct sock *sk)
return -EAGAIN;
}
inet->sport = htons(inet->num);
+ sk->sk_xid = vx_current_xid();
+ if (!in_interrupt()) sk->sk_nid = nx_current_nid(); else sk->sk_nid=0;
}
release_sock(sk);
return 0;
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
index 7d3992f..0964bb4 100644
--- a/net/ipv4/netfilter/ipt_LOG.c
+++ b/net/ipv4/netfilter/ipt_LOG.c
@@ -44,6 +44,8 @@ static void dump_packet(struct sbuff *m,
else
logflags = NF_LOG_MASK;
+ sb_add(m, "TAG=%d ", skb->skb_tag);
+
ih = skb_header_pointer(skb, iphoff, sizeof(_iph), &_iph);
if (ih == NULL) {
sb_add(m, "TRUNCATED");