aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipx/af_ipx.c84
-rw-r--r--net/ipx/ipx_proc.c2
-rw-r--r--net/ipx/ipx_route.c4
-rw-r--r--net/ipx/sysctl_net_ipx.c2
4 files changed, 46 insertions, 46 deletions
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 89f283c51dff..cac35a77f069 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -11,7 +11,7 @@
11 * work I am currently employed to do there. 11 * work I am currently employed to do there.
12 * 12 *
13 * All the material in this file is subject to the Gnu license version 2. 13 * All the material in this file is subject to the Gnu license version 2.
14 * Neither Alan Cox nor the Swansea University Computer Society admit 14 * Neither Alan Cox nor the Swansea University Computer Society admit
15 * liability nor provide warranty for any of this software. This material 15 * liability nor provide warranty for any of this software. This material
16 * is provided as is and at no charge. 16 * is provided as is and at no charge.
17 * 17 *
@@ -152,8 +152,8 @@ static void ipx_destroy_socket(struct sock *sk)
152 ipx_remove_socket(sk); 152 ipx_remove_socket(sk);
153 skb_queue_purge(&sk->sk_receive_queue); 153 skb_queue_purge(&sk->sk_receive_queue);
154#ifdef IPX_REFCNT_DEBUG 154#ifdef IPX_REFCNT_DEBUG
155 atomic_dec(&ipx_sock_nr); 155 atomic_dec(&ipx_sock_nr);
156 printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk, 156 printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk,
157 atomic_read(&ipx_sock_nr)); 157 atomic_read(&ipx_sock_nr));
158 if (atomic_read(&sk->sk_refcnt) != 1) 158 if (atomic_read(&sk->sk_refcnt) != 1)
159 printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n", 159 printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n",
@@ -162,7 +162,7 @@ static void ipx_destroy_socket(struct sock *sk)
162 sock_put(sk); 162 sock_put(sk);
163} 163}
164 164
165/* 165/*
166 * The following code is used to support IPX Interfaces (IPXITF). An 166 * The following code is used to support IPX Interfaces (IPXITF). An
167 * IPX interface is defined by a physical device and a frame type. 167 * IPX interface is defined by a physical device and a frame type.
168 */ 168 */
@@ -369,7 +369,7 @@ static __exit void ipxitf_cleanup(void)
369 struct ipx_interface *i, *tmp; 369 struct ipx_interface *i, *tmp;
370 370
371 spin_lock_bh(&ipx_interfaces_lock); 371 spin_lock_bh(&ipx_interfaces_lock);
372 list_for_each_entry_safe(i, tmp, &ipx_interfaces, node) 372 list_for_each_entry_safe(i, tmp, &ipx_interfaces, node)
373 __ipxitf_put(i); 373 __ipxitf_put(i);
374 spin_unlock_bh(&ipx_interfaces_lock); 374 spin_unlock_bh(&ipx_interfaces_lock);
375} 375}
@@ -446,10 +446,10 @@ static struct sock *ncp_connection_hack(struct ipx_interface *intrfc,
446 * You might call this a hack, but believe me, you do not want a 446 * You might call this a hack, but believe me, you do not want a
447 * complete NCP layer in the kernel, and this is VERY fast as well. */ 447 * complete NCP layer in the kernel, and this is VERY fast as well. */
448 struct sock *sk = NULL; 448 struct sock *sk = NULL;
449 int connection = 0; 449 int connection = 0;
450 u8 *ncphdr = (u8 *)(ipx + 1); 450 u8 *ncphdr = (u8 *)(ipx + 1);
451 451
452 if (*ncphdr == 0x22 && *(ncphdr + 1) == 0x22) /* NCP request */ 452 if (*ncphdr == 0x22 && *(ncphdr + 1) == 0x22) /* NCP request */
453 connection = (((int) *(ncphdr + 5)) << 8) | (int) *(ncphdr + 3); 453 connection = (((int) *(ncphdr + 5)) << 8) | (int) *(ncphdr + 3);
454 else if (*ncphdr == 0x77 && *(ncphdr + 1) == 0x77) /* BURST packet */ 454 else if (*ncphdr == 0x77 && *(ncphdr + 1) == 0x77) /* BURST packet */
455 connection = (((int) *(ncphdr + 9)) << 8) | (int) *(ncphdr + 8); 455 connection = (((int) *(ncphdr + 9)) << 8) | (int) *(ncphdr + 8);
@@ -482,7 +482,7 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc,
482 482
483 if (intrfc == ipx_primary_net && ntohs(ipx->ipx_dest.sock) == 0x451) 483 if (intrfc == ipx_primary_net && ntohs(ipx->ipx_dest.sock) == 0x451)
484 sock1 = ncp_connection_hack(intrfc, ipx); 484 sock1 = ncp_connection_hack(intrfc, ipx);
485 if (!sock1) 485 if (!sock1)
486 /* No special socket found, forward the packet the normal way */ 486 /* No special socket found, forward the packet the normal way */
487 sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock); 487 sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock);
488 488
@@ -607,22 +607,22 @@ int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, char *node)
607 *last_hop = IPX_SKB_CB(skb)->last_hop.netnum; 607 *last_hop = IPX_SKB_CB(skb)->last_hop.netnum;
608 IPX_SKB_CB(skb)->last_hop.index = -1; 608 IPX_SKB_CB(skb)->last_hop.index = -1;
609 } 609 }
610 610
611 /* 611 /*
612 * We need to know how many skbuffs it will take to send out this 612 * We need to know how many skbuffs it will take to send out this
613 * packet to avoid unnecessary copies. 613 * packet to avoid unnecessary copies.
614 */ 614 */
615 615
616 if (!dl || !dev || dev->flags & IFF_LOOPBACK) 616 if (!dl || !dev || dev->flags & IFF_LOOPBACK)
617 send_to_wire = 0; /* No non looped */ 617 send_to_wire = 0; /* No non looped */
618 618
619 /* 619 /*
620 * See if this should be demuxed to sockets on this interface 620 * See if this should be demuxed to sockets on this interface
621 * 621 *
622 * We want to ensure the original was eaten or that we only use 622 * We want to ensure the original was eaten or that we only use
623 * up clones. 623 * up clones.
624 */ 624 */
625 625
626 if (ipx->ipx_dest.net == intrfc->if_netnum) { 626 if (ipx->ipx_dest.net == intrfc->if_netnum) {
627 /* 627 /*
628 * To our own node, loop and free the original. 628 * To our own node, loop and free the original.
@@ -709,8 +709,8 @@ static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb)
709 709
710 /* See if we should update our network number */ 710 /* See if we should update our network number */
711 if (!intrfc->if_netnum) /* net number of intrfc not known yet */ 711 if (!intrfc->if_netnum) /* net number of intrfc not known yet */
712 ipxitf_discover_netnum(intrfc, skb); 712 ipxitf_discover_netnum(intrfc, skb);
713 713
714 IPX_SKB_CB(skb)->last_hop.index = -1; 714 IPX_SKB_CB(skb)->last_hop.index = -1;
715 if (ipx->ipx_type == IPX_TYPE_PPROP) { 715 if (ipx->ipx_type == IPX_TYPE_PPROP) {
716 rc = ipxitf_pprop(intrfc, skb); 716 rc = ipxitf_pprop(intrfc, skb);
@@ -756,7 +756,7 @@ out_intrfc:
756 756
757static void ipxitf_discover_netnum(struct ipx_interface *intrfc, 757static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
758 struct sk_buff *skb) 758 struct sk_buff *skb)
759{ 759{
760 const struct ipx_cb *cb = IPX_SKB_CB(skb); 760 const struct ipx_cb *cb = IPX_SKB_CB(skb);
761 761
762 /* see if this is an intra packet: source_net == dest_net */ 762 /* see if this is an intra packet: source_net == dest_net */
@@ -793,7 +793,7 @@ static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
793 * it, not even processing it locally, if it has exact %IPX_MAX_PPROP_HOPS we 793 * it, not even processing it locally, if it has exact %IPX_MAX_PPROP_HOPS we
794 * don't broadcast it, but process it locally. See chapter 5 of Novell's "IPX 794 * don't broadcast it, but process it locally. See chapter 5 of Novell's "IPX
795 * RIP and SAP Router Specification", Part Number 107-000029-001. 795 * RIP and SAP Router Specification", Part Number 107-000029-001.
796 * 796 *
797 * If it is valid, check if we have pprop broadcasting enabled by the user, 797 * If it is valid, check if we have pprop broadcasting enabled by the user,
798 * if not, just return zero for local processing. 798 * if not, just return zero for local processing.
799 * 799 *
@@ -820,7 +820,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
820 * tctrl <= 15, any data payload... */ 820 * tctrl <= 15, any data payload... */
821 if (IPX_SKB_CB(skb)->ipx_tctrl > IPX_MAX_PPROP_HOPS || 821 if (IPX_SKB_CB(skb)->ipx_tctrl > IPX_MAX_PPROP_HOPS ||
822 ntohs(ipx->ipx_pktsize) < sizeof(struct ipxhdr) + 822 ntohs(ipx->ipx_pktsize) < sizeof(struct ipxhdr) +
823 IPX_MAX_PPROP_HOPS * sizeof(u32)) 823 IPX_MAX_PPROP_HOPS * sizeof(u32))
824 goto out; 824 goto out;
825 /* are we broadcasting this damn thing? */ 825 /* are we broadcasting this damn thing? */
826 rc = 0; 826 rc = 0;
@@ -831,7 +831,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
831 * locally. */ 831 * locally. */
832 if (IPX_SKB_CB(skb)->ipx_tctrl == IPX_MAX_PPROP_HOPS) 832 if (IPX_SKB_CB(skb)->ipx_tctrl == IPX_MAX_PPROP_HOPS)
833 goto out; 833 goto out;
834 834
835 c = ((u8 *) ipx) + sizeof(struct ipxhdr); 835 c = ((u8 *) ipx) + sizeof(struct ipxhdr);
836 l = (__be32 *) c; 836 l = (__be32 *) c;
837 837
@@ -851,7 +851,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
851 /* Except unconfigured interfaces */ 851 /* Except unconfigured interfaces */
852 if (!ifcs->if_netnum) 852 if (!ifcs->if_netnum)
853 continue; 853 continue;
854 854
855 /* That aren't in the list */ 855 /* That aren't in the list */
856 if (ifcs == intrfc) 856 if (ifcs == intrfc)
857 continue; 857 continue;
@@ -1003,7 +1003,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
1003 dlink_type = htons(ETH_P_IPX); 1003 dlink_type = htons(ETH_P_IPX);
1004 datalink = pEII_datalink; 1004 datalink = pEII_datalink;
1005 break; 1005 break;
1006 } else 1006 } else
1007 printk(KERN_WARNING "IPX frame type EtherII over " 1007 printk(KERN_WARNING "IPX frame type EtherII over "
1008 "token-ring is obsolete. Use SNAP " 1008 "token-ring is obsolete. Use SNAP "
1009 "instead.\n"); 1009 "instead.\n");
@@ -1208,14 +1208,14 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg)
1208 rc = 0; 1208 rc = 0;
1209 break; 1209 break;
1210 } 1210 }
1211 case SIOCAIPXITFCRT: 1211 case SIOCAIPXITFCRT:
1212 rc = -EFAULT; 1212 rc = -EFAULT;
1213 if (get_user(val, (unsigned char __user *) arg)) 1213 if (get_user(val, (unsigned char __user *) arg))
1214 break; 1214 break;
1215 rc = 0; 1215 rc = 0;
1216 ipxcfg_auto_create_interfaces = val; 1216 ipxcfg_auto_create_interfaces = val;
1217 break; 1217 break;
1218 case SIOCAIPXPRISLT: 1218 case SIOCAIPXPRISLT:
1219 rc = -EFAULT; 1219 rc = -EFAULT;
1220 if (get_user(val, (unsigned char __user *) arg)) 1220 if (get_user(val, (unsigned char __user *) arg))
1221 break; 1221 break;
@@ -1230,14 +1230,14 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg)
1230/* 1230/*
1231 * Checksum routine for IPX 1231 * Checksum routine for IPX
1232 */ 1232 */
1233 1233
1234/* Note: We assume ipx_tctrl==0 and htons(length)==ipx_pktsize */ 1234/* Note: We assume ipx_tctrl==0 and htons(length)==ipx_pktsize */
1235/* This functions should *not* mess with packet contents */ 1235/* This functions should *not* mess with packet contents */
1236 1236
1237__be16 ipx_cksum(struct ipxhdr *packet, int length) 1237__be16 ipx_cksum(struct ipxhdr *packet, int length)
1238{ 1238{
1239 /* 1239 /*
1240 * NOTE: sum is a net byte order quantity, which optimizes the 1240 * NOTE: sum is a net byte order quantity, which optimizes the
1241 * loop. This only works on big and little endian machines. (I 1241 * loop. This only works on big and little endian machines. (I
1242 * don't know of a machine that isn't.) 1242 * don't know of a machine that isn't.)
1243 */ 1243 */
@@ -1342,7 +1342,7 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname,
1342 rc = -EINVAL; 1342 rc = -EINVAL;
1343 if(len < 0) 1343 if(len < 0)
1344 goto out; 1344 goto out;
1345 1345
1346 rc = -EFAULT; 1346 rc = -EFAULT;
1347 if (put_user(len, optlen) || copy_to_user(optval, &val, len)) 1347 if (put_user(len, optlen) || copy_to_user(optval, &val, len))
1348 goto out; 1348 goto out;
@@ -1372,13 +1372,13 @@ static int ipx_create(struct socket *sock, int protocol)
1372 if (sock->type != SOCK_DGRAM) 1372 if (sock->type != SOCK_DGRAM)
1373 goto out; 1373 goto out;
1374 1374
1375 rc = -ENOMEM; 1375 rc = -ENOMEM;
1376 sk = sk_alloc(PF_IPX, GFP_KERNEL, &ipx_proto, 1); 1376 sk = sk_alloc(PF_IPX, GFP_KERNEL, &ipx_proto, 1);
1377 if (!sk) 1377 if (!sk)
1378 goto out; 1378 goto out;
1379#ifdef IPX_REFCNT_DEBUG 1379#ifdef IPX_REFCNT_DEBUG
1380 atomic_inc(&ipx_sock_nr); 1380 atomic_inc(&ipx_sock_nr);
1381 printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk, 1381 printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk,
1382 atomic_read(&ipx_sock_nr)); 1382 atomic_read(&ipx_sock_nr));
1383#endif 1383#endif
1384 sock_init_data(sock, sk); 1384 sock_init_data(sock, sk);
@@ -1561,7 +1561,7 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr,
1561 goto out; 1561 goto out;
1562 } 1562 }
1563 1563
1564 /* We can either connect to primary network or somewhere 1564 /* We can either connect to primary network or somewhere
1565 * we can route to */ 1565 * we can route to */
1566 rt = ipxrtr_lookup(addr->sipx_network); 1566 rt = ipxrtr_lookup(addr->sipx_network);
1567 rc = -ENETUNREACH; 1567 rc = -ENETUNREACH;
@@ -1641,10 +1641,10 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
1641 struct ipxhdr *ipx; 1641 struct ipxhdr *ipx;
1642 u16 ipx_pktsize; 1642 u16 ipx_pktsize;
1643 int rc = 0; 1643 int rc = 0;
1644 1644
1645 /* Not ours */ 1645 /* Not ours */
1646 if (skb->pkt_type == PACKET_OTHERHOST) 1646 if (skb->pkt_type == PACKET_OTHERHOST)
1647 goto drop; 1647 goto drop;
1648 1648
1649 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) 1649 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
1650 goto out; 1650 goto out;
@@ -1653,12 +1653,12 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
1653 goto drop; 1653 goto drop;
1654 1654
1655 ipx_pktsize = ntohs(ipx_hdr(skb)->ipx_pktsize); 1655 ipx_pktsize = ntohs(ipx_hdr(skb)->ipx_pktsize);
1656 1656
1657 /* Too small or invalid header? */ 1657 /* Too small or invalid header? */
1658 if (ipx_pktsize < sizeof(struct ipxhdr) || 1658 if (ipx_pktsize < sizeof(struct ipxhdr) ||
1659 !pskb_may_pull(skb, ipx_pktsize)) 1659 !pskb_may_pull(skb, ipx_pktsize))
1660 goto drop; 1660 goto drop;
1661 1661
1662 ipx = ipx_hdr(skb); 1662 ipx = ipx_hdr(skb);
1663 if (ipx->ipx_checksum != IPX_NO_CHECKSUM && 1663 if (ipx->ipx_checksum != IPX_NO_CHECKSUM &&
1664 ipx->ipx_checksum != ipx_cksum(ipx, ipx_pktsize)) 1664 ipx->ipx_checksum != ipx_cksum(ipx, ipx_pktsize))
@@ -1786,7 +1786,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
1786 if (rc) 1786 if (rc)
1787 goto out; 1787 goto out;
1788 } 1788 }
1789 1789
1790 rc = -ENOTCONN; 1790 rc = -ENOTCONN;
1791 if (sock_flag(sk, SOCK_ZAPPED)) 1791 if (sock_flag(sk, SOCK_ZAPPED))
1792 goto out; 1792 goto out;
@@ -1875,15 +1875,15 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1875 * This socket wants to take care of the NCP connection 1875 * This socket wants to take care of the NCP connection
1876 * handed to us in arg. 1876 * handed to us in arg.
1877 */ 1877 */
1878 rc = -EPERM; 1878 rc = -EPERM;
1879 if (!capable(CAP_NET_ADMIN)) 1879 if (!capable(CAP_NET_ADMIN))
1880 break; 1880 break;
1881 rc = get_user(ipx_sk(sk)->ipx_ncp_conn, 1881 rc = get_user(ipx_sk(sk)->ipx_ncp_conn,
1882 (const unsigned short __user *)argp); 1882 (const unsigned short __user *)argp);
1883 break; 1883 break;
1884 case SIOCGSTAMP: 1884 case SIOCGSTAMP:
1885 rc = -EINVAL; 1885 rc = -EINVAL;
1886 if (sk) 1886 if (sk)
1887 rc = sock_get_timestamp(sk, argp); 1887 rc = sock_get_timestamp(sk, argp);
1888 break; 1888 break;
1889 case SIOCGIFDSTADDR: 1889 case SIOCGIFDSTADDR:
diff --git a/net/ipx/ipx_proc.c b/net/ipx/ipx_proc.c
index b7463dfca63e..811e4badce81 100644
--- a/net/ipx/ipx_proc.c
+++ b/net/ipx/ipx_proc.c
@@ -352,7 +352,7 @@ int __init ipx_proc_init(void)
352{ 352{
353 struct proc_dir_entry *p; 353 struct proc_dir_entry *p;
354 int rc = -ENOMEM; 354 int rc = -ENOMEM;
355 355
356 ipx_proc_dir = proc_mkdir("ipx", proc_net); 356 ipx_proc_dir = proc_mkdir("ipx", proc_net);
357 357
358 if (!ipx_proc_dir) 358 if (!ipx_proc_dir)
diff --git a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c
index 68560ee0d797..8e1cad971f11 100644
--- a/net/ipx/ipx_route.c
+++ b/net/ipx/ipx_route.c
@@ -234,7 +234,7 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
234 if (rc) { 234 if (rc) {
235 kfree_skb(skb); 235 kfree_skb(skb);
236 goto out_put; 236 goto out_put;
237 } 237 }
238 238
239 /* Apply checksum. Not allowed on 802.3 links. */ 239 /* Apply checksum. Not allowed on 802.3 links. */
240 if (sk->sk_no_check || intrfc->if_dlink_type == htons(IPX_FRAME_8023)) 240 if (sk->sk_no_check || intrfc->if_dlink_type == htons(IPX_FRAME_8023))
@@ -242,7 +242,7 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
242 else 242 else
243 ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr)); 243 ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr));
244 244
245 rc = ipxitf_send(intrfc, skb, (rt && rt->ir_routed) ? 245 rc = ipxitf_send(intrfc, skb, (rt && rt->ir_routed) ?
246 rt->ir_router_node : ipx->ipx_dest.node); 246 rt->ir_router_node : ipx->ipx_dest.node);
247out_put: 247out_put:
248 ipxitf_put(intrfc); 248 ipxitf_put(intrfc);
diff --git a/net/ipx/sysctl_net_ipx.c b/net/ipx/sysctl_net_ipx.c
index fa574735c76f..85ae35fa1e0e 100644
--- a/net/ipx/sysctl_net_ipx.c
+++ b/net/ipx/sysctl_net_ipx.c
@@ -34,7 +34,7 @@ static struct ctl_table ipx_dir_table[] = {
34 .procname = "ipx", 34 .procname = "ipx",
35 .mode = 0555, 35 .mode = 0555,
36 .child = ipx_table, 36 .child = ipx_table,
37 }, 37 },
38 { 0 }, 38 { 0 },
39}; 39};
40 40