[RH7] venet: Clear skb->mark on entering to VE's IP stack

Submitted by Kirill Tkhai on Sept. 10, 2020, 10:03 a.m.


Message ID 159973218180.58501.10140677010813157618.stgit@localhost.localdomain
State New
Series "venet: Clear skb->mark on entering to VE's IP stack"
Headers show

Commit Message

Kirill Tkhai Sept. 10, 2020, 10:03 a.m.
Tasks inside VE may add their own netfilter rules based
on skb->mark. Since they expect that incomming skb has
zero mark, the added rules may conflict with the mark
we add in venet_acct_classify_add_outgoing(). So, we have
to clear the mark on enter to VE, and it become looks like
"fresh" skb came from hardware.


Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
 kernel/ve/vznetstat/vznetstat.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/kernel/ve/vznetstat/vznetstat.c b/kernel/ve/vznetstat/vznetstat.c
index 79605fe846e2..f366325bd91b 100644
--- a/kernel/ve/vznetstat/vznetstat.c
+++ b/kernel/ve/vznetstat/vznetstat.c
@@ -715,9 +715,21 @@  static int acct_one_skb(struct venet_stat *stat, struct sk_buff *skb, int dir, i
 	return class;
+static inline void venet_clear_mark(struct sk_buff *skb)
+	skb->mark = 0;
 void venet_acct_classify_add_incoming(struct venet_stat *stat, struct sk_buff *skb)
 	acct_one_skb(stat, skb, ACCT_IN, venet_acct_skb_size(skb));
+	/*
+	 * Every incomming skb must have zero mark, since here is its first
+	 * come into VE's IP stack.
+	 */
+	venet_clear_mark(skb);
 static inline void venet_acct_mark(struct venet_stat *stat,