aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pppoe.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-09-16 19:20:21 -0400
committerDavid S. Miller <davem@davemloft.net>2007-09-16 19:20:21 -0400
commit9355ec23397af32799038d0e8edbfa5b6f425c27 (patch)
tree256b00fa1af6628896c0a1a18866384497e9c5bd /drivers/net/pppoe.c
parentdb7bf6d97c6956b7eb0f22131cb5c37bd41f33c0 (diff)
[PPP] pppoe: Fill in header directly in __pppoe_xmit
This patch removes the hdr variable (which is copied into the skb) and instead sets the header directly in the skb. It also uses __skb_push instead of skb_push since we've just checked using skb_cow for enough head room. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pppoe.c')
-rw-r--r--drivers/net/pppoe.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 8818253102f2..bac36546e0bf 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -848,19 +848,12 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
848{ 848{
849 struct pppox_sock *po = pppox_sk(sk); 849 struct pppox_sock *po = pppox_sk(sk);
850 struct net_device *dev = po->pppoe_dev; 850 struct net_device *dev = po->pppoe_dev;
851 struct pppoe_hdr hdr;
852 struct pppoe_hdr *ph; 851 struct pppoe_hdr *ph;
853 int data_len = skb->len; 852 int data_len = skb->len;
854 853
855 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) 854 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
856 goto abort; 855 goto abort;
857 856
858 hdr.ver = 1;
859 hdr.type = 1;
860 hdr.code = 0;
861 hdr.sid = po->num;
862 hdr.length = htons(skb->len);
863
864 if (!dev) 857 if (!dev)
865 goto abort; 858 goto abort;
866 859
@@ -870,12 +863,17 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
870 if (skb_cow(skb, sizeof(*ph) + dev->hard_header_len)) 863 if (skb_cow(skb, sizeof(*ph) + dev->hard_header_len))
871 goto abort; 864 goto abort;
872 865
873 ph = (struct pppoe_hdr *) skb_push(skb, sizeof(struct pppoe_hdr)); 866 __skb_push(skb, sizeof(*ph));
874 memcpy(ph, &hdr, sizeof(struct pppoe_hdr));
875 skb->protocol = __constant_htons(ETH_P_PPP_SES);
876
877 skb_reset_network_header(skb); 867 skb_reset_network_header(skb);
878 868
869 ph = pppoe_hdr(skb);
870 ph->ver = 1;
871 ph->type = 1;
872 ph->code = 0;
873 ph->sid = po->num;
874 ph->length = htons(data_len);
875
876 skb->protocol = __constant_htons(ETH_P_PPP_SES);
879 skb->dev = dev; 877 skb->dev = dev;
880 878
881 dev->hard_header(skb, dev, ETH_P_PPP_SES, 879 dev->hard_header(skb, dev, ETH_P_PPP_SES,