aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-13 12:51:52 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:17 -0400
commit967b05f64e27d04a4c8879addd0e1c52137e2c9e (patch)
treec2c7ab3f0284903222d6d0864deaedbd4766b9b8 /net/ax25
parentea2ae17d6443abddc79480dc9f7af8feacabddc4 (diff)
[SK_BUFF]: Introduce skb_set_transport_header
For the cases where the transport header is being set to a offset from skb->data. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/af_ax25.c20
-rw-r--r--net/ax25/ax25_in.c2
2 files changed, 9 insertions, 13 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 14db01a4ff63..75d4d695edec 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1425,7 +1425,6 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1425 struct sockaddr_ax25 sax; 1425 struct sockaddr_ax25 sax;
1426 struct sk_buff *skb; 1426 struct sk_buff *skb;
1427 ax25_digi dtmp, *dp; 1427 ax25_digi dtmp, *dp;
1428 unsigned char *asmptr;
1429 ax25_cb *ax25; 1428 ax25_cb *ax25;
1430 size_t size; 1429 size_t size;
1431 int lv, err, addr_len = msg->msg_namelen; 1430 int lv, err, addr_len = msg->msg_namelen;
@@ -1551,10 +1550,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1551 skb_reset_network_header(skb); 1550 skb_reset_network_header(skb);
1552 1551
1553 /* Add the PID if one is not supplied by the user in the skb */ 1552 /* Add the PID if one is not supplied by the user in the skb */
1554 if (!ax25->pidincl) { 1553 if (!ax25->pidincl)
1555 asmptr = skb_push(skb, 1); 1554 *skb_push(skb, 1) = sk->sk_protocol;
1556 *asmptr = sk->sk_protocol;
1557 }
1558 1555
1559 SOCK_DEBUG(sk, "AX.25: Transmitting buffer\n"); 1556 SOCK_DEBUG(sk, "AX.25: Transmitting buffer\n");
1560 1557
@@ -1573,7 +1570,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1573 goto out; 1570 goto out;
1574 } 1571 }
1575 1572
1576 asmptr = skb_push(skb, 1 + ax25_addr_size(dp)); 1573 skb_push(skb, 1 + ax25_addr_size(dp));
1577 1574
1578 SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp); 1575 SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp);
1579 1576
@@ -1581,17 +1578,16 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1581 SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi); 1578 SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi);
1582 1579
1583 /* Build an AX.25 header */ 1580 /* Build an AX.25 header */
1584 asmptr += (lv = ax25_addr_build(asmptr, &ax25->source_addr, 1581 lv = ax25_addr_build(skb->data, &ax25->source_addr, &sax.sax25_call,
1585 &sax.sax25_call, dp, 1582 dp, AX25_COMMAND, AX25_MODULUS);
1586 AX25_COMMAND, AX25_MODULUS));
1587 1583
1588 SOCK_DEBUG(sk, "Built header (%d bytes)\n",lv); 1584 SOCK_DEBUG(sk, "Built header (%d bytes)\n",lv);
1589 1585
1590 skb->h.raw = asmptr; 1586 skb_set_transport_header(skb, lv);
1591 1587
1592 SOCK_DEBUG(sk, "base=%p pos=%p\n", skb->data, asmptr); 1588 SOCK_DEBUG(sk, "base=%p pos=%p\n", skb->data, skb->h.raw);
1593 1589
1594 *asmptr = AX25_UI; 1590 *skb->h.raw = AX25_UI;
1595 1591
1596 /* Datagram frames go straight out of the door as UI */ 1592 /* Datagram frames go straight out of the door as UI */
1597 ax25_queue_xmit(skb, ax25->ax25_dev->dev); 1593 ax25_queue_xmit(skb, ax25->ax25_dev->dev);
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 724ad5ce75d4..31c59387a6fc 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -233,7 +233,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
233 233
234 /* UI frame - bypass LAPB processing */ 234 /* UI frame - bypass LAPB processing */
235 if ((*skb->data & ~0x10) == AX25_UI && dp.lastrepeat + 1 == dp.ndigi) { 235 if ((*skb->data & ~0x10) == AX25_UI && dp.lastrepeat + 1 == dp.ndigi) {
236 skb->h.raw = skb->data + 2; /* skip control and pid */ 236 skb_set_transport_header(skb, 2); /* skip control and pid */
237 237
238 ax25_send_to_raw(&dest, skb, skb->data[1]); 238 ax25_send_to_raw(&dest, skb, skb->data[1]);
239 239