Commit 953c4a08 authored by Martin Schiller's avatar Martin Schiller Committed by David S. Miller

wan/hdlc_x25: fix skb handling

o call skb_reset_network_header() before hdlc->xmit()
 o change skb proto to HDLC (0x0019) before hdlc->xmit()
 o call dev_queue_xmit_nit() before hdlc->xmit()

This changes make it possible to trace (tcpdump) outgoing layer2
(ETH_P_HDLC) packets

Additionally call skb_reset_network_header() after each skb_push() /
skb_pull().
Signed-off-by: default avatarMartin Schiller <ms@dev.tdt.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f362e5fe
...@@ -71,11 +71,12 @@ static int x25_data_indication(struct net_device *dev, struct sk_buff *skb) ...@@ -71,11 +71,12 @@ static int x25_data_indication(struct net_device *dev, struct sk_buff *skb)
{ {
unsigned char *ptr; unsigned char *ptr;
skb_push(skb, 1);
if (skb_cow(skb, 1)) if (skb_cow(skb, 1))
return NET_RX_DROP; return NET_RX_DROP;
skb_push(skb, 1);
skb_reset_network_header(skb);
ptr = skb->data; ptr = skb->data;
*ptr = X25_IFACE_DATA; *ptr = X25_IFACE_DATA;
...@@ -88,6 +89,13 @@ static int x25_data_indication(struct net_device *dev, struct sk_buff *skb) ...@@ -88,6 +89,13 @@ static int x25_data_indication(struct net_device *dev, struct sk_buff *skb)
static void x25_data_transmit(struct net_device *dev, struct sk_buff *skb) static void x25_data_transmit(struct net_device *dev, struct sk_buff *skb)
{ {
hdlc_device *hdlc = dev_to_hdlc(dev); hdlc_device *hdlc = dev_to_hdlc(dev);
skb_reset_network_header(skb);
skb->protocol = hdlc_type_trans(skb, dev);
if (dev_nit_active(dev))
dev_queue_xmit_nit(skb, dev);
hdlc->xmit(skb, dev); /* Ignore return value :-( */ hdlc->xmit(skb, dev); /* Ignore return value :-( */
} }
...@@ -102,6 +110,7 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -102,6 +110,7 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev)
switch (skb->data[0]) { switch (skb->data[0]) {
case X25_IFACE_DATA: /* Data to be transmitted */ case X25_IFACE_DATA: /* Data to be transmitted */
skb_pull(skb, 1); skb_pull(skb, 1);
skb_reset_network_header(skb);
if ((result = lapb_data_request(dev, skb)) != LAPB_OK) if ((result = lapb_data_request(dev, skb)) != LAPB_OK)
dev_kfree_skb(skb); dev_kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment