--- zzzz-none-000/linux-4.19.183/drivers/net/ppp/pptp.c 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/drivers/net/ppp/pptp.c 2023-06-28 08:54:19.000000000 +0000 @@ -45,10 +45,19 @@ #define MAX_CALLID 65535 +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) +extern int bcm_ppp_rcv_decomp_run(struct ppp_channel *); + +DECLARE_BITMAP(callid_bitmap, MAX_CALLID + 1); +struct pppox_sock __rcu **callid_sock; + +DEFINE_SPINLOCK(chan_lock); +#else static DECLARE_BITMAP(callid_bitmap, MAX_CALLID + 1); static struct pppox_sock __rcu **callid_sock; static DEFINE_SPINLOCK(chan_lock); +#endif static struct proto pptp_sk_proto __read_mostly; static const struct ppp_channel_ops pptp_chan_ops; @@ -198,8 +207,14 @@ seq_recv = opt->seq_recv; +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + /*always add ack, makes it simple to adjust ack in blog_emit */ + if ((opt->ack_sent == seq_recv) && !blog_gre_tunnel_accelerated()) + header_len -= sizeof(hdr->ack); +#else if (opt->ack_sent == seq_recv) header_len -= sizeof(hdr->ack); +#endif /* Push down and install GRE header */ skb_push(skb, header_len); @@ -209,6 +224,18 @@ hdr->gre_hd.protocol = GRE_PROTO_PPP; hdr->call_id = htons(opt->dst_addr.call_id); +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + /* for accelerated case update the sequencenumber later */ + if (blog_gre_tunnel_accelerated()) + { + hdr->seq = 0; + hdr->gre_hd.flags |= GRE_ACK; + hdr->ack = 0; + } + else{ +#endif + + hdr->seq = htonl(++opt->seq_sent); if (opt->ack_sent != seq_recv) { /* send ack with this message */ @@ -216,6 +243,10 @@ hdr->ack = htonl(seq_recv); opt->ack_sent = seq_recv; } +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + } +#endif + hdr->payload_len = htons(len); /* Push down and install the IP header. */ @@ -307,6 +338,32 @@ goto drop; payload = skb->data + headersize; +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) +#define PPTP_RCV_SEQ_CHECK(seq_rx, label1, label2, label3) \ + { \ + if (seq < (seq_rx) || WRAPPED(opt->seq_recv, seq)) { \ + if ((payload[0] == PPP_ALLSTATIONS) && (payload[1] == PPP_UI) && \ + (PPP_PROTOCOL(payload) == PPP_LCP) && \ + ((payload[4] == PPP_LCP_ECHOREQ) || (payload[4] == PPP_LCP_ECHOREP))) \ + goto label1; \ + else \ + goto label2; \ + } else { \ + goto label3; \ + } \ + } + + if (!blog_gre_tunnel_accelerated() || bcm_ppp_rcv_decomp_run(&po->chan)) + { + /* check for expected sequence number */ + PPTP_RCV_SEQ_CHECK(opt->seq_recv + 1, allow_packet, drop, allow_packet2); + } + else /* blog_gre_tunnel_accelerated is true, so opt->seq_recv and opt->ack_recv have been ++ by pptp_rcv_check() */ + { + /* check for expected sequence number */ + PPTP_RCV_SEQ_CHECK(opt->seq_recv, allow_packet, drop, allow_packet); +allow_packet2: +#else /* check for expected sequence number */ if (seq < opt->seq_recv + 1 || WRAPPED(opt->seq_recv, seq)) { if ((payload[0] == PPP_ALLSTATIONS) && (payload[1] == PPP_UI) && @@ -314,6 +371,7 @@ ((payload[4] == PPP_LCP_ECHOREQ) || (payload[4] == PPP_LCP_ECHOREP))) goto allow_packet; } else { +#endif opt->seq_recv = seq; allow_packet: skb_pull(skb, headersize);