aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/decnet/dn_route.c')
-rw-r--r--net/decnet/dn_route.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 3407f190afe8..d7037fe3cafe 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -133,9 +133,9 @@ static struct dst_ops dn_dst_ops = {
133 .entries = ATOMIC_INIT(0), 133 .entries = ATOMIC_INIT(0),
134}; 134};
135 135
136static __inline__ unsigned dn_hash(unsigned short src, unsigned short dst) 136static __inline__ unsigned dn_hash(__le16 src, __le16 dst)
137{ 137{
138 unsigned short tmp = src ^ dst; 138 __u16 tmp = (__u16 __force)(src ^ dst);
139 tmp ^= (tmp >> 3); 139 tmp ^= (tmp >> 3);
140 tmp ^= (tmp >> 5); 140 tmp ^= (tmp >> 5);
141 tmp ^= (tmp >> 10); 141 tmp ^= (tmp >> 10);
@@ -379,9 +379,9 @@ static int dn_return_short(struct sk_buff *skb)
379{ 379{
380 struct dn_skb_cb *cb; 380 struct dn_skb_cb *cb;
381 unsigned char *ptr; 381 unsigned char *ptr;
382 dn_address *src; 382 __le16 *src;
383 dn_address *dst; 383 __le16 *dst;
384 dn_address tmp; 384 __le16 tmp;
385 385
386 /* Add back headers */ 386 /* Add back headers */
387 skb_push(skb, skb->data - skb->nh.raw); 387 skb_push(skb, skb->data - skb->nh.raw);
@@ -394,9 +394,9 @@ static int dn_return_short(struct sk_buff *skb)
394 ptr = skb->data + 2; 394 ptr = skb->data + 2;
395 *ptr++ = (cb->rt_flags & ~DN_RT_F_RQR) | DN_RT_F_RTS; 395 *ptr++ = (cb->rt_flags & ~DN_RT_F_RQR) | DN_RT_F_RTS;
396 396
397 dst = (dn_address *)ptr; 397 dst = (__le16 *)ptr;
398 ptr += 2; 398 ptr += 2;
399 src = (dn_address *)ptr; 399 src = (__le16 *)ptr;
400 ptr += 2; 400 ptr += 2;
401 *ptr = 0; /* Zero hop count */ 401 *ptr = 0; /* Zero hop count */
402 402
@@ -475,7 +475,8 @@ static int dn_route_rx_packet(struct sk_buff *skb)
475 struct dn_skb_cb *cb = DN_SKB_CB(skb); 475 struct dn_skb_cb *cb = DN_SKB_CB(skb);
476 printk(KERN_DEBUG 476 printk(KERN_DEBUG
477 "DECnet: dn_route_rx_packet: rt_flags=0x%02x dev=%s len=%d src=0x%04hx dst=0x%04hx err=%d type=%d\n", 477 "DECnet: dn_route_rx_packet: rt_flags=0x%02x dev=%s len=%d src=0x%04hx dst=0x%04hx err=%d type=%d\n",
478 (int)cb->rt_flags, devname, skb->len, cb->src, cb->dst, 478 (int)cb->rt_flags, devname, skb->len,
479 dn_ntohs(cb->src), dn_ntohs(cb->dst),
479 err, skb->pkt_type); 480 err, skb->pkt_type);
480 } 481 }
481 482
@@ -505,7 +506,7 @@ static int dn_route_rx_long(struct sk_buff *skb)
505 506
506 /* Destination info */ 507 /* Destination info */
507 ptr += 2; 508 ptr += 2;
508 cb->dst = dn_htons(dn_eth2dn(ptr)); 509 cb->dst = dn_eth2dn(ptr);
509 if (memcmp(ptr, dn_hiord_addr, 4) != 0) 510 if (memcmp(ptr, dn_hiord_addr, 4) != 0)
510 goto drop_it; 511 goto drop_it;
511 ptr += 6; 512 ptr += 6;
@@ -513,7 +514,7 @@ static int dn_route_rx_long(struct sk_buff *skb)
513 514
514 /* Source info */ 515 /* Source info */
515 ptr += 2; 516 ptr += 2;
516 cb->src = dn_htons(dn_eth2dn(ptr)); 517 cb->src = dn_eth2dn(ptr);
517 if (memcmp(ptr, dn_hiord_addr, 4) != 0) 518 if (memcmp(ptr, dn_hiord_addr, 4) != 0)
518 goto drop_it; 519 goto drop_it;
519 ptr += 6; 520 ptr += 6;
@@ -541,9 +542,9 @@ static int dn_route_rx_short(struct sk_buff *skb)
541 skb_pull(skb, 5); 542 skb_pull(skb, 5);
542 skb->h.raw = skb->data; 543 skb->h.raw = skb->data;
543 544
544 cb->dst = *(dn_address *)ptr; 545 cb->dst = *(__le16 *)ptr;
545 ptr += 2; 546 ptr += 2;
546 cb->src = *(dn_address *)ptr; 547 cb->src = *(__le16 *)ptr;
547 ptr += 2; 548 ptr += 2;
548 cb->hops = *ptr & 0x3f; 549 cb->hops = *ptr & 0x3f;
549 550
@@ -575,7 +576,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
575{ 576{
576 struct dn_skb_cb *cb; 577 struct dn_skb_cb *cb;
577 unsigned char flags = 0; 578 unsigned char flags = 0;
578 __u16 len = dn_ntohs(*(__u16 *)skb->data); 579 __u16 len = dn_ntohs(*(__le16 *)skb->data);
579 struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; 580 struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr;
580 unsigned char padlen = 0; 581 unsigned char padlen = 0;
581 582
@@ -782,7 +783,7 @@ static int dn_rt_bug(struct sk_buff *skb)
782 struct dn_skb_cb *cb = DN_SKB_CB(skb); 783 struct dn_skb_cb *cb = DN_SKB_CB(skb);
783 784
784 printk(KERN_DEBUG "dn_rt_bug: skb from:%04x to:%04x\n", 785 printk(KERN_DEBUG "dn_rt_bug: skb from:%04x to:%04x\n",
785 cb->src, cb->dst); 786 dn_ntohs(cb->src), dn_ntohs(cb->dst));
786 } 787 }
787 788
788 kfree_skb(skb); 789 kfree_skb(skb);
@@ -823,7 +824,7 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
823 return 0; 824 return 0;
824} 825}
825 826
826static inline int dn_match_addr(__u16 addr1, __u16 addr2) 827static inline int dn_match_addr(__le16 addr1, __le16 addr2)
827{ 828{
828 __u16 tmp = dn_ntohs(addr1) ^ dn_ntohs(addr2); 829 __u16 tmp = dn_ntohs(addr1) ^ dn_ntohs(addr2);
829 int match = 16; 830 int match = 16;
@@ -834,9 +835,9 @@ static inline int dn_match_addr(__u16 addr1, __u16 addr2)
834 return match; 835 return match;
835} 836}
836 837
837static __u16 dnet_select_source(const struct net_device *dev, __u16 daddr, int scope) 838static __le16 dnet_select_source(const struct net_device *dev, __le16 daddr, int scope)
838{ 839{
839 __u16 saddr = 0; 840 __le16 saddr = 0;
840 struct dn_dev *dn_db = dev->dn_ptr; 841 struct dn_dev *dn_db = dev->dn_ptr;
841 struct dn_ifaddr *ifa; 842 struct dn_ifaddr *ifa;
842 int best_match = 0; 843 int best_match = 0;
@@ -861,14 +862,14 @@ static __u16 dnet_select_source(const struct net_device *dev, __u16 daddr, int s
861 return saddr; 862 return saddr;
862} 863}
863 864
864static inline __u16 __dn_fib_res_prefsrc(struct dn_fib_res *res) 865static inline __le16 __dn_fib_res_prefsrc(struct dn_fib_res *res)
865{ 866{
866 return dnet_select_source(DN_FIB_RES_DEV(*res), DN_FIB_RES_GW(*res), res->scope); 867 return dnet_select_source(DN_FIB_RES_DEV(*res), DN_FIB_RES_GW(*res), res->scope);
867} 868}
868 869
869static inline __u16 dn_fib_rules_map_destination(__u16 daddr, struct dn_fib_res *res) 870static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_res *res)
870{ 871{
871 __u16 mask = dnet_make_mask(res->prefixlen); 872 __le16 mask = dnet_make_mask(res->prefixlen);
872 return (daddr&~mask)|res->fi->fib_nh->nh_gw; 873 return (daddr&~mask)|res->fi->fib_nh->nh_gw;
873} 874}
874 875
@@ -892,12 +893,13 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
892 struct dn_fib_res res = { .fi = NULL, .type = RTN_UNICAST }; 893 struct dn_fib_res res = { .fi = NULL, .type = RTN_UNICAST };
893 int err; 894 int err;
894 int free_res = 0; 895 int free_res = 0;
895 __u16 gateway = 0; 896 __le16 gateway = 0;
896 897
897 if (decnet_debug_level & 16) 898 if (decnet_debug_level & 16)
898 printk(KERN_DEBUG 899 printk(KERN_DEBUG
899 "dn_route_output_slow: dst=%04x src=%04x mark=%d" 900 "dn_route_output_slow: dst=%04x src=%04x mark=%d"
900 " iif=%d oif=%d\n", oldflp->fld_dst, oldflp->fld_src, 901 " iif=%d oif=%d\n", dn_ntohs(oldflp->fld_dst),
902 dn_ntohs(oldflp->fld_src),
901 oldflp->fld_fwmark, loopback_dev.ifindex, oldflp->oif); 903 oldflp->fld_fwmark, loopback_dev.ifindex, oldflp->oif);
902 904
903 /* If we have an output interface, verify its a DECnet device */ 905 /* If we have an output interface, verify its a DECnet device */
@@ -961,8 +963,9 @@ source_ok:
961 if (decnet_debug_level & 16) 963 if (decnet_debug_level & 16)
962 printk(KERN_DEBUG 964 printk(KERN_DEBUG
963 "dn_route_output_slow: initial checks complete." 965 "dn_route_output_slow: initial checks complete."
964 " dst=%o4x src=%04x oif=%d try_hard=%d\n", fl.fld_dst, 966 " dst=%o4x src=%04x oif=%d try_hard=%d\n",
965 fl.fld_src, fl.oif, try_hard); 967 dn_ntohs(fl.fld_dst), dn_ntohs(fl.fld_src),
968 fl.oif, try_hard);
966 969
967 /* 970 /*
968 * N.B. If the kernel is compiled without router support then 971 * N.B. If the kernel is compiled without router support then
@@ -1218,8 +1221,8 @@ static int dn_route_input_slow(struct sk_buff *skb)
1218 struct neighbour *neigh = NULL; 1221 struct neighbour *neigh = NULL;
1219 unsigned hash; 1222 unsigned hash;
1220 int flags = 0; 1223 int flags = 0;
1221 __u16 gateway = 0; 1224 __le16 gateway = 0;
1222 __u16 local_src = 0; 1225 __le16 local_src = 0;
1223 struct flowi fl = { .nl_u = { .dn_u = 1226 struct flowi fl = { .nl_u = { .dn_u =
1224 { .daddr = cb->dst, 1227 { .daddr = cb->dst,
1225 .saddr = cb->src, 1228 .saddr = cb->src,
@@ -1266,7 +1269,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
1266 res.type = RTN_LOCAL; 1269 res.type = RTN_LOCAL;
1267 flags |= RTCF_DIRECTSRC; 1270 flags |= RTCF_DIRECTSRC;
1268 } else { 1271 } else {
1269 __u16 src_map = fl.fld_src; 1272 __le16 src_map = fl.fld_src;
1270 free_res = 1; 1273 free_res = 1;
1271 1274
1272 out_dev = DN_FIB_RES_DEV(res); 1275 out_dev = DN_FIB_RES_DEV(res);