UPSTREAM: tcp: Add a tcp_filter hook before handle ack packet

Currently in both ipv4 and ipv6 code path, the ack packet received when
sk at TCP_NEW_SYN_RECV state is not filtered by socket filter or cgroup
filter since it is handled from tcp_child_process and never reaches the
tcp_filter inside tcp_v4_rcv or tcp_v6_rcv. Adding a tcp_filter hooks
here can make sure all the ingress tcp packet can be correctly filtered.

Signed-off-by: Chenbo Feng <fengc@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8fac365f63c866a00015fa13932d8ffc584518b8)

Bug: 30950746
Change-Id: I9b687b5acab56aa3589f65925da64d47dc55492e
This commit is contained in:
Chenbo Feng
2017-06-20 19:06:40 -07:00
parent 87883134eb
commit 7678266293
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -1685,6 +1685,8 @@ process:
}
if (nsk == sk) {
reqsk_put(req);
} else if (tcp_filter(sk, skb)) {
goto discard_and_relse;
} else if (tcp_child_process(sk, nsk, skb)) {
tcp_v4_send_reset(nsk, skb);
goto discard_and_relse;
+2
View File
@@ -1450,6 +1450,8 @@ process:
if (nsk == sk) {
reqsk_put(req);
tcp_v6_restore_cb(skb);
} else if (tcp_filter(sk, skb)) {
goto discard_and_relse;
} else if (tcp_child_process(sk, nsk, skb)) {
tcp_v6_send_reset(nsk, skb);
goto discard_and_relse;