l2tp: give proper headroom in pppol2tp_xmit()
pppol2tp_xmit() calls skb_cow_head(skb, 2) before calling l2tp_xmit_skb() Then l2tp_xmit_skb() calls again skb_cow_head(skb, large_headroom) This patchs changes the first skb_cow_head() call to supply the needed headroom to make sure at most one (expensive) pskb_expand_head() is done. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
bc416d9768
commit
09df57ca60
1 changed files with 8 additions and 1 deletions
|
@ -395,6 +395,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
|
||||||
struct pppol2tp_session *ps;
|
struct pppol2tp_session *ps;
|
||||||
int old_headroom;
|
int old_headroom;
|
||||||
int new_headroom;
|
int new_headroom;
|
||||||
|
int uhlen, headroom;
|
||||||
|
|
||||||
if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
|
if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
|
||||||
goto abort;
|
goto abort;
|
||||||
|
@ -413,7 +414,13 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
|
||||||
goto abort_put_sess;
|
goto abort_put_sess;
|
||||||
|
|
||||||
old_headroom = skb_headroom(skb);
|
old_headroom = skb_headroom(skb);
|
||||||
if (skb_cow_head(skb, sizeof(ppph)))
|
uhlen = (tunnel->encap == L2TP_ENCAPTYPE_UDP) ? sizeof(struct udphdr) : 0;
|
||||||
|
headroom = NET_SKB_PAD +
|
||||||
|
sizeof(struct iphdr) + /* IP header */
|
||||||
|
uhlen + /* UDP header (if L2TP_ENCAPTYPE_UDP) */
|
||||||
|
session->hdr_len + /* L2TP header */
|
||||||
|
sizeof(ppph); /* PPP header */
|
||||||
|
if (skb_cow_head(skb, headroom))
|
||||||
goto abort_put_sess_tun;
|
goto abort_put_sess_tun;
|
||||||
|
|
||||||
new_headroom = skb_headroom(skb);
|
new_headroom = skb_headroom(skb);
|
||||||
|
|
Loading…
Reference in a new issue