aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRalf Baechle2005-09-12 14:21:48 -0700
committerDavid S. Miller2005-09-12 14:21:48 -0700
commit3f2aadd041a7a3e732d182c3770b3fa95a2300b2 (patch)
treebe2917b8e811c91d95a2413bb31ee44e99dadb88 /net
parent6f74998e5c3b4610e6eba06babf16547369c512a (diff)
[NETROM]: Fix rebuild header mess
For reason that probably nobody recalls NET/ROM does it's actual packet transmission in nr_rebuild_header and even treats invocation of it's hard_start_xmit method nr_xmit as a bug. Fix that by splitting the job done by nr_rebuild_header into two halves. Along with that we now also can get rid of the silly clone of the skb on transmit. Signed-off-by: Ralf Baechle DL5RB <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netrom/nr_dev.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 263da4c26494..431a25384421 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -71,15 +71,10 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
static int nr_rebuild_header(struct sk_buff *skb)
{
- struct net_device *dev = skb->dev;
- struct net_device_stats *stats = netdev_priv(dev);
- struct sk_buff *skbn;
unsigned char *bp = skb->data;
- int len;
- if (arp_find(bp + 7, skb)) {
+ if (arp_find(bp + 7, skb))
return 1;
- }
bp[6] &= ~AX25_CBIT;
bp[6] &= ~AX25_EBIT;
@@ -90,27 +85,7 @@ static int nr_rebuild_header(struct sk_buff *skb)
bp[6] |= AX25_EBIT;
bp[6] |= AX25_SSSID_SPARE;
- if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
- kfree_skb(skb);
- return 1;
- }
-
- if (skb->sk != NULL)
- skb_set_owner_w(skbn, skb->sk);
-
- kfree_skb(skb);
-
- len = skbn->len;
-
- if (!nr_route_frame(skbn, NULL)) {
- kfree_skb(skbn);
- stats->tx_errors++;
- }
-
- stats->tx_packets++;
- stats->tx_bytes += len;
-
- return 1;
+ return 0;
}
#else
@@ -186,8 +161,19 @@ static int nr_close(struct net_device *dev)
static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct net_device_stats *stats = netdev_priv(dev);
- dev_kfree_skb(skb);
- stats->tx_errors++;
+ unsigned int len;
+
+ len = skb->len;
+
+ if (!nr_route_frame(skb, NULL)) {
+ kfree_skb(skb);
+ stats->tx_errors++;
+ return 0;
+ }
+
+ stats->tx_packets++;
+ stats->tx_bytes += len;
+
return 0;
}