Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

l2tp: ppp: use max L2TP header size for PPP channel hdrlen

chan.hdrlen is read once at channel registration by
ppp_register_net_channel(), and used to set the PPP net device's
hard_header_len. It was set to PPPOL2TP_L2TP_HDR_SIZE_NOSEQ (6), which
is 4 bytes too small if sequence numbers are later enabled via
setsockopt(PPPOL2TP_SO_SENDSEQ), causing unnecessary skb reallocations
on the TX path.

The setsockopt handler attempted to change netdev's hard_header_len by
updating chan.hdrlen, but the PPP layer never re-reads it after the
registration, so the update had no effect.

To avoid the unnecessary reallocations, set chan.hdrlen to
PPPOL2TP_L2TP_HDR_SIZE_SEQ (10) unconditionally at registration and
remove the ineffective update in the setsockopt callback.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Link: https://patch.msgid.link/20260317054141.524879-1-dqfext@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Qingfang Deng and committed by
Paolo Abeni
9f4960b9 96a584db

+5 -10
+5 -10
net/l2tp/l2tp_ppp.c
··· 787 787 goto out_no_ppp; 788 788 } 789 789 790 - /* The only header we need to worry about is the L2TP 791 - * header. This size is different depending on whether 792 - * sequence numbers are enabled for the data channel. 790 + /* Reserve enough headroom for the L2TP header with sequence numbers, 791 + * which is the largest possible. This is used by the PPP layer to set 792 + * the net device's hard_header_len at registration, which must be 793 + * sufficient regardless of whether sequence numbers are enabled later. 793 794 */ 794 - po->chan.hdrlen = PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; 795 + po->chan.hdrlen = PPPOL2TP_L2TP_HDR_SIZE_SEQ; 795 796 796 797 po->chan.private = sk; 797 798 po->chan.ops = &pppol2tp_chan_ops; ··· 1177 1176 break; 1178 1177 } 1179 1178 session->send_seq = !!val; 1180 - { 1181 - struct pppox_sock *po = pppox_sk(sk); 1182 - 1183 - po->chan.hdrlen = val ? PPPOL2TP_L2TP_HDR_SIZE_SEQ : 1184 - PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; 1185 - } 1186 1179 l2tp_session_set_header_len(session, session->tunnel->version, 1187 1180 session->tunnel->encap); 1188 1181 break;