[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>
This commit is contained in:
committed by
David S. Miller
parent
ea2ae17d64
commit
967b05f64e
@@ -1425,7 +1425,6 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||
struct sockaddr_ax25 sax;
|
||||
struct sk_buff *skb;
|
||||
ax25_digi dtmp, *dp;
|
||||
unsigned char *asmptr;
|
||||
ax25_cb *ax25;
|
||||
size_t size;
|
||||
int lv, err, addr_len = msg->msg_namelen;
|
||||
@@ -1551,10 +1550,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||
skb_reset_network_header(skb);
|
||||
|
||||
/* Add the PID if one is not supplied by the user in the skb */
|
||||
if (!ax25->pidincl) {
|
||||
asmptr = skb_push(skb, 1);
|
||||
*asmptr = sk->sk_protocol;
|
||||
}
|
||||
if (!ax25->pidincl)
|
||||
*skb_push(skb, 1) = sk->sk_protocol;
|
||||
|
||||
SOCK_DEBUG(sk, "AX.25: Transmitting buffer\n");
|
||||
|
||||
@@ -1573,7 +1570,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||
goto out;
|
||||
}
|
||||
|
||||
asmptr = skb_push(skb, 1 + ax25_addr_size(dp));
|
||||
skb_push(skb, 1 + ax25_addr_size(dp));
|
||||
|
||||
SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp);
|
||||
|
||||
@@ -1581,17 +1578,16 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||
SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi);
|
||||
|
||||
/* Build an AX.25 header */
|
||||
asmptr += (lv = ax25_addr_build(asmptr, &ax25->source_addr,
|
||||
&sax.sax25_call, dp,
|
||||
AX25_COMMAND, AX25_MODULUS));
|
||||
lv = ax25_addr_build(skb->data, &ax25->source_addr, &sax.sax25_call,
|
||||
dp, AX25_COMMAND, AX25_MODULUS);
|
||||
|
||||
SOCK_DEBUG(sk, "Built header (%d bytes)\n",lv);
|
||||
|
||||
skb->h.raw = asmptr;
|
||||
skb_set_transport_header(skb, lv);
|
||||
|
||||
SOCK_DEBUG(sk, "base=%p pos=%p\n", skb->data, asmptr);
|
||||
SOCK_DEBUG(sk, "base=%p pos=%p\n", skb->data, skb->h.raw);
|
||||
|
||||
*asmptr = AX25_UI;
|
||||
*skb->h.raw = AX25_UI;
|
||||
|
||||
/* Datagram frames go straight out of the door as UI */
|
||||
ax25_queue_xmit(skb, ax25->ax25_dev->dev);
|
||||
|
@@ -233,7 +233,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
|
||||
/* UI frame - bypass LAPB processing */
|
||||
if ((*skb->data & ~0x10) == AX25_UI && dp.lastrepeat + 1 == dp.ndigi) {
|
||||
skb->h.raw = skb->data + 2; /* skip control and pid */
|
||||
skb_set_transport_header(skb, 2); /* skip control and pid */
|
||||
|
||||
ax25_send_to_raw(&dest, skb, skb->data[1]);
|
||||
|
||||
|
Reference in New Issue
Block a user