--- zzzz-none-000/linux-4.4.271/net/ipv6/tcp_ipv6.c 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/net/ipv6/tcp_ipv6.c 2023-04-19 10:22:30.000000000 +0000 @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,8 @@ #include #include +#include + static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb); static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, struct request_sock *req); @@ -239,6 +242,7 @@ fl6.flowi6_mark = sk->sk_mark; fl6.fl6_dport = usin->sin6_port; fl6.fl6_sport = inet->inet_sport; + fl6.flowi6_uid = sk->sk_uid; opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk)); final_p = fl6_update_dst(&fl6, opt, &final); @@ -786,10 +790,10 @@ topt = (__be32 *)(t1 + 1); if (tsecr) { - *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | - (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); - *topt++ = htonl(tsval); - *topt++ = htonl(tsecr); + put_unaligned_be32((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | + (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP, topt++); + put_unaligned_be32(tsval, topt++); + put_unaligned_be32(tsecr, topt++); } #ifdef CONFIG_TCP_MD5SIG @@ -825,6 +829,7 @@ fl6.flowi6_mark = IP6_REPLY_MARK(net, skb->mark); fl6.fl6_dport = t1->dest; fl6.fl6_sport = t1->source; + fl6.flowi6_uid = sock_net_uid(net, sk && sk_fullsock(sk) ? sk : NULL); security_skb_classify_flow(skb, flowi6_to_flowi(&fl6)); /* Pass a socket to ip6_dst_lookup either it is for RST @@ -1412,6 +1417,8 @@ goto no_tcp_socket; process: + avm_pa_add_local_session(AVM_PA_NET_IP6_DEVINFO(net), skb, sk); + if (sk->sk_state == TCP_TIME_WAIT) goto do_time_wait; @@ -1420,7 +1427,6 @@ struct sock *nsk; sk = req->rsk_listener; - tcp_v6_fill_cb(skb, hdr, th); if (tcp_v6_inbound_md5_hash(sk, skb)) { reqsk_put(req); goto discard_it; @@ -1434,6 +1440,9 @@ goto lookup; } sock_hold(sk); + th = tcp_hdr(skb); + hdr = ipv6_hdr(skb); + tcp_v6_fill_cb(skb, hdr, th); nsk = tcp_check_req(sk, skb, req, false); if (!nsk) { reqsk_put(req); @@ -1458,15 +1467,14 @@ if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) goto discard_and_relse; - tcp_v6_fill_cb(skb, hdr, th); - if (tcp_v6_inbound_md5_hash(sk, skb)) goto discard_and_relse; if (tcp_filter(sk, skb)) goto discard_and_relse; - th = (const struct tcphdr *)skb->data; + th = tcp_hdr(skb); hdr = ipv6_hdr(skb); + tcp_v6_fill_cb(skb, hdr, th); skb->dev = NULL;