aboutsummaryrefslogtreecommitdiffstats
path: root/net/appletalk/ddp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/appletalk/ddp.c')
-rw-r--r--net/appletalk/ddp.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 113c175f1715..f6a92a0b7aa6 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1275,7 +1275,7 @@ static int handle_ip_over_ddp(struct sk_buff *skb)
1275 skb->protocol = htons(ETH_P_IP); 1275 skb->protocol = htons(ETH_P_IP);
1276 skb_pull(skb, 13); 1276 skb_pull(skb, 13);
1277 skb->dev = dev; 1277 skb->dev = dev;
1278 skb->h.raw = skb->data; 1278 skb_reset_transport_header(skb);
1279 1279
1280 stats = dev->priv; 1280 stats = dev->priv;
1281 stats->rx_packets++; 1281 stats->rx_packets++;
@@ -1383,10 +1383,10 @@ free_it:
1383 * @pt - packet type 1383 * @pt - packet type
1384 * 1384 *
1385 * Receive a packet (in skb) from device dev. This has come from the SNAP 1385 * Receive a packet (in skb) from device dev. This has come from the SNAP
1386 * decoder, and on entry skb->h.raw is the DDP header, skb->len is the DDP 1386 * decoder, and on entry skb->transport_header is the DDP header, skb->len
1387 * header, skb->len is the DDP length. The physical headers have been 1387 * is the DDP header, skb->len is the DDP length. The physical headers
1388 * extracted. PPP should probably pass frames marked as for this layer. 1388 * have been extracted. PPP should probably pass frames marked as for this
1389 * [ie ARPHRD_ETHERTALK] 1389 * layer. [ie ARPHRD_ETHERTALK]
1390 */ 1390 */
1391static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, 1391static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
1392 struct packet_type *pt, struct net_device *orig_dev) 1392 struct packet_type *pt, struct net_device *orig_dev)
@@ -1417,10 +1417,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
1417 /* 1417 /*
1418 * Size check to see if ddp->deh_len was crap 1418 * Size check to see if ddp->deh_len was crap
1419 * (Otherwise we'll detonate most spectacularly 1419 * (Otherwise we'll detonate most spectacularly
1420 * in the middle of recvmsg()). 1420 * in the middle of atalk_checksum() or recvmsg()).
1421 */ 1421 */
1422 if (skb->len < sizeof(*ddp)) 1422 if (skb->len < sizeof(*ddp) || skb->len < (len_hops & 1023)) {
1423 pr_debug("AppleTalk: dropping corrupted frame (deh_len=%u, "
1424 "skb->len=%u)\n", len_hops & 1023, skb->len);
1423 goto freeit; 1425 goto freeit;
1426 }
1424 1427
1425 /* 1428 /*
1426 * Any checksums. Note we don't do htons() on this == is assumed to be 1429 * Any checksums. Note we don't do htons() on this == is assumed to be
@@ -1481,7 +1484,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
1481 struct packet_type *pt, struct net_device *orig_dev) 1484 struct packet_type *pt, struct net_device *orig_dev)
1482{ 1485{
1483 /* Expand any short form frames */ 1486 /* Expand any short form frames */
1484 if (skb->mac.raw[2] == 1) { 1487 if (skb_mac_header(skb)[2] == 1) {
1485 struct ddpehdr *ddp; 1488 struct ddpehdr *ddp;
1486 /* Find our address */ 1489 /* Find our address */
1487 struct atalk_addr *ap = atalk_find_dev_addr(dev); 1490 struct atalk_addr *ap = atalk_find_dev_addr(dev);
@@ -1507,8 +1510,8 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
1507 * we write the network numbers ! 1510 * we write the network numbers !
1508 */ 1511 */
1509 1512
1510 ddp->deh_dnode = skb->mac.raw[0]; /* From physical header */ 1513 ddp->deh_dnode = skb_mac_header(skb)[0]; /* From physical header */
1511 ddp->deh_snode = skb->mac.raw[1]; /* From physical header */ 1514 ddp->deh_snode = skb_mac_header(skb)[1]; /* From physical header */
1512 1515
1513 ddp->deh_dnet = ap->s_net; /* Network number */ 1516 ddp->deh_dnet = ap->s_net; /* Network number */
1514 ddp->deh_snet = ap->s_net; 1517 ddp->deh_snet = ap->s_net;
@@ -1519,7 +1522,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
1519 /* Non routable, so force a drop if we slip up later */ 1522 /* Non routable, so force a drop if we slip up later */
1520 ddp->deh_len_hops = htons(skb->len + (DDP_MAXHOPS << 10)); 1523 ddp->deh_len_hops = htons(skb->len + (DDP_MAXHOPS << 10));
1521 } 1524 }
1522 skb->h.raw = skb->data; 1525 skb_reset_transport_header(skb);
1523 1526
1524 return atalk_rcv(skb, dev, pt, orig_dev); 1527 return atalk_rcv(skb, dev, pt, orig_dev);
1525freeit: 1528freeit:
@@ -1768,6 +1771,9 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1768 case SIOCGSTAMP: 1771 case SIOCGSTAMP:
1769 rc = sock_get_timestamp(sk, argp); 1772 rc = sock_get_timestamp(sk, argp);
1770 break; 1773 break;
1774 case SIOCGSTAMPNS:
1775 rc = sock_get_timestampns(sk, argp);
1776 break;
1771 /* Routing */ 1777 /* Routing */
1772 case SIOCADDRT: 1778 case SIOCADDRT:
1773 case SIOCDELRT: 1779 case SIOCDELRT: