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.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index c8b7dc2c3257..16eda21fb38c 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -937,11 +937,11 @@ static unsigned long atalk_sum_partial(const unsigned char *data,
937static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset, 937static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset,
938 int len, unsigned long sum) 938 int len, unsigned long sum)
939{ 939{
940 int start = skb_headlen(skb); 940 int end = skb_headlen(skb);
941 int i, copy; 941 int i, copy;
942 942
943 /* checksum stuff in header space */ 943 /* checksum stuff in header space */
944 if ( (copy = start - offset) > 0) { 944 if ((copy = end - offset) > 0) {
945 if (copy > len) 945 if (copy > len)
946 copy = len; 946 copy = len;
947 sum = atalk_sum_partial(skb->data + offset, copy, sum); 947 sum = atalk_sum_partial(skb->data + offset, copy, sum);
@@ -953,11 +953,9 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset,
953 953
954 /* checksum stuff in frags */ 954 /* checksum stuff in frags */
955 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 955 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
956 int end; 956 BUG_TRAP(len >= 0);
957 957
958 BUG_TRAP(start <= offset + len); 958 end = offset + skb_shinfo(skb)->frags[i].size;
959
960 end = start + skb_shinfo(skb)->frags[i].size;
961 if ((copy = end - offset) > 0) { 959 if ((copy = end - offset) > 0) {
962 u8 *vaddr; 960 u8 *vaddr;
963 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 961 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
@@ -965,36 +963,31 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset,
965 if (copy > len) 963 if (copy > len)
966 copy = len; 964 copy = len;
967 vaddr = kmap_skb_frag(frag); 965 vaddr = kmap_skb_frag(frag);
968 sum = atalk_sum_partial(vaddr + frag->page_offset + 966 sum = atalk_sum_partial(vaddr + frag->page_offset,
969 offset - start, copy, sum); 967 copy, sum);
970 kunmap_skb_frag(vaddr); 968 kunmap_skb_frag(vaddr);
971 969
972 if (!(len -= copy)) 970 if (!(len -= copy))
973 return sum; 971 return sum;
974 offset += copy; 972 offset += copy;
975 } 973 }
976 start = end;
977 } 974 }
978 975
979 if (skb_shinfo(skb)->frag_list) { 976 if (skb_shinfo(skb)->frag_list) {
980 struct sk_buff *list = skb_shinfo(skb)->frag_list; 977 struct sk_buff *list = skb_shinfo(skb)->frag_list;
981 978
982 for (; list; list = list->next) { 979 for (; list; list = list->next) {
983 int end; 980 BUG_TRAP(len >= 0);
984
985 BUG_TRAP(start <= offset + len);
986 981
987 end = start + list->len; 982 end = offset + list->len;
988 if ((copy = end - offset) > 0) { 983 if ((copy = end - offset) > 0) {
989 if (copy > len) 984 if (copy > len)
990 copy = len; 985 copy = len;
991 sum = atalk_sum_skb(list, offset - start, 986 sum = atalk_sum_skb(list, 0, copy, sum);
992 copy, sum);
993 if ((len -= copy) == 0) 987 if ((len -= copy) == 0)
994 return sum; 988 return sum;
995 offset += copy; 989 offset += copy;
996 } 990 }
997 start = end;
998 } 991 }
999 } 992 }
1000 993
@@ -1275,7 +1268,7 @@ static int handle_ip_over_ddp(struct sk_buff *skb)
1275 skb->protocol = htons(ETH_P_IP); 1268 skb->protocol = htons(ETH_P_IP);
1276 skb_pull(skb, 13); 1269 skb_pull(skb, 13);
1277 skb->dev = dev; 1270 skb->dev = dev;
1278 skb->h.raw = skb->data; 1271 skb_reset_transport_header(skb);
1279 1272
1280 stats = dev->priv; 1273 stats = dev->priv;
1281 stats->rx_packets++; 1274 stats->rx_packets++;
@@ -1383,10 +1376,10 @@ free_it:
1383 * @pt - packet type 1376 * @pt - packet type
1384 * 1377 *
1385 * Receive a packet (in skb) from device dev. This has come from the SNAP 1378 * 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 1379 * 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 1380 * 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. 1381 * have been extracted. PPP should probably pass frames marked as for this
1389 * [ie ARPHRD_ETHERTALK] 1382 * layer. [ie ARPHRD_ETHERTALK]
1390 */ 1383 */
1391static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, 1384static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
1392 struct packet_type *pt, struct net_device *orig_dev) 1385 struct packet_type *pt, struct net_device *orig_dev)
@@ -1484,7 +1477,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
1484 struct packet_type *pt, struct net_device *orig_dev) 1477 struct packet_type *pt, struct net_device *orig_dev)
1485{ 1478{
1486 /* Expand any short form frames */ 1479 /* Expand any short form frames */
1487 if (skb->mac.raw[2] == 1) { 1480 if (skb_mac_header(skb)[2] == 1) {
1488 struct ddpehdr *ddp; 1481 struct ddpehdr *ddp;
1489 /* Find our address */ 1482 /* Find our address */
1490 struct atalk_addr *ap = atalk_find_dev_addr(dev); 1483 struct atalk_addr *ap = atalk_find_dev_addr(dev);
@@ -1510,8 +1503,8 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
1510 * we write the network numbers ! 1503 * we write the network numbers !
1511 */ 1504 */
1512 1505
1513 ddp->deh_dnode = skb->mac.raw[0]; /* From physical header */ 1506 ddp->deh_dnode = skb_mac_header(skb)[0]; /* From physical header */
1514 ddp->deh_snode = skb->mac.raw[1]; /* From physical header */ 1507 ddp->deh_snode = skb_mac_header(skb)[1]; /* From physical header */
1515 1508
1516 ddp->deh_dnet = ap->s_net; /* Network number */ 1509 ddp->deh_dnet = ap->s_net; /* Network number */
1517 ddp->deh_snet = ap->s_net; 1510 ddp->deh_snet = ap->s_net;
@@ -1522,7 +1515,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
1522 /* Non routable, so force a drop if we slip up later */ 1515 /* Non routable, so force a drop if we slip up later */
1523 ddp->deh_len_hops = htons(skb->len + (DDP_MAXHOPS << 10)); 1516 ddp->deh_len_hops = htons(skb->len + (DDP_MAXHOPS << 10));
1524 } 1517 }
1525 skb->h.raw = skb->data; 1518 skb_reset_transport_header(skb);
1526 1519
1527 return atalk_rcv(skb, dev, pt, orig_dev); 1520 return atalk_rcv(skb, dev, pt, orig_dev);
1528freeit: 1521freeit:
@@ -1771,6 +1764,9 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1771 case SIOCGSTAMP: 1764 case SIOCGSTAMP:
1772 rc = sock_get_timestamp(sk, argp); 1765 rc = sock_get_timestamp(sk, argp);
1773 break; 1766 break;
1767 case SIOCGSTAMPNS:
1768 rc = sock_get_timestampns(sk, argp);
1769 break;
1774 /* Routing */ 1770 /* Routing */
1775 case SIOCADDRT: 1771 case SIOCADDRT:
1776 case SIOCDELRT: 1772 case SIOCDELRT: