--- zzzz-none-000/linux-5.15.111/net/l2tp/l2tp_core.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-atom-6670-761/linux-5.15.111/net/l2tp/l2tp_core.c 2024-02-07 10:23:30.000000000 +0000 @@ -13,6 +13,10 @@ * Arnaldo Carvalho de Melo * David S. Miller (davem@redhat.com) */ +/* + * Includes Intel Corporation's changes/modifications dated: [10/03/2016]. + * Changed/modified portions - Copyright © [2016], Intel Corporation. + */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt @@ -66,6 +70,10 @@ #define CREATE_TRACE_POINTS #include "trace.h" +#ifdef CONFIG_TI_PACKET_PROCESSOR +#include +#endif + #define L2TP_DRV_VERSION "V2.0" /* L2TP header constants */ @@ -386,6 +394,10 @@ write_unlock_bh(&tunnel->hlist_lock); trace_register_session(session); +#ifdef CONFIG_TI_PACKET_PROCESSOR + if ((tunnel->version == L2TP_HDR_VER_3) && (!session->send_seq)) + ti_hil_pp_event (TI_L2TP_ENTRY_CREATED, (void *)session); +#endif// CONFIG_TI_PACKET_PROCESSOR return 0; @@ -723,8 +735,10 @@ } } - /* Session data offset is defined only for L2TPv2 and is - * indicated by an optional 16-bit value in the header. + /* Session data offset is handled differently for L2TPv2 and + * L2TPv3. For L2TPv2, there is an optional 16-bit value in + * the header. For L2TPv3, the offset is negotiated using AVPs + * in the session setup control protocol. */ if (tunnel->version == L2TP_HDR_VER_2) { /* If offset bit set, skip it. */ @@ -732,7 +746,8 @@ offset = ntohs(*(__be16 *)ptr); ptr += 2 + offset; } - } + } else + ptr += session->offset; offset = ptr - optr; if (!pskb_may_pull(skb, offset)) @@ -988,6 +1003,8 @@ *((__be32 *)bufp) = htonl(l2h); bufp += 4; } + if (session->offset) + bufp += session->offset; return bufp - optr; } @@ -1039,7 +1056,7 @@ /* Reset skb netfilter state */ memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED); - nf_reset_ct(skb); + nf_reset_no_generic_ct(skb); bh_lock_sock_nested(sk); if (sock_owned_by_user(sk)) { @@ -1553,6 +1570,11 @@ return; trace_delete_session(session); +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* For L2TPv3 - Generate the HIL Event indicating that the L2TPv3 session has been deleted. */ + if (session->tunnel->version == L2TP_HDR_VER_3) + ti_hil_pp_event (TI_L2TP_ENTRY_DELETED, (void *)session); +#endif// CONFIG_TI_PACKET_PROCESSOR l2tp_session_unhash(session); l2tp_session_queue_purge(session); if (session->session_close) @@ -1572,7 +1594,7 @@ if (session->send_seq) session->hdr_len += 4; } else { - session->hdr_len = 4 + session->cookie_len; + session->hdr_len = 4 + session->cookie_len + session->offset; session->hdr_len += l2tp_get_l2specific_len(session); if (session->tunnel->encap == L2TP_ENCAPTYPE_UDP) session->hdr_len += 4; @@ -1617,6 +1639,7 @@ session->recv_seq = cfg->recv_seq; session->lns_mode = cfg->lns_mode; session->reorder_timeout = cfg->reorder_timeout; + session->offset = cfg->offset; session->l2specific_type = cfg->l2specific_type; session->cookie_len = cfg->cookie_len; memcpy(&session->cookie[0], &cfg->cookie[0], cfg->cookie_len);