summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/802/cl2llc.c6
-rw-r--r--net/802/llc_macinit.c4
-rw-r--r--net/802/llc_sendpdu.c2
-rw-r--r--net/Changes44
-rw-r--r--net/Config.in20
-rw-r--r--net/appletalk/Makefile2
-rw-r--r--net/atm/common.c3
-rw-r--r--net/atm/lec.h4
-rw-r--r--net/ax25/Makefile2
-rw-r--r--net/ax25/af_ax25.c26
-rw-r--r--net/ax25/ax25_in.c4
-rw-r--r--net/ax25/sysctl_net_ax25.c4
-rw-r--r--net/bridge/br_private.h74
-rw-r--r--net/bridge/br_private_stp.h30
-rw-r--r--net/core/datagram.c13
-rw-r--r--net/core/iovec.c2
-rw-r--r--net/core/skbuff.c3
-rw-r--r--net/core/sock.c9
-rw-r--r--net/decnet/af_decnet.c1
-rw-r--r--net/decnet/sysctl_net_decnet.c6
-rw-r--r--net/ipv4/arp.c32
-rw-r--r--net/ipv4/devinet.c4
-rw-r--r--net/ipv4/ipconfig.c2
-rw-r--r--net/ipv4/netfilter/ip_fw_compat.c21
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c2
-rw-r--r--net/ipv4/netfilter/ipt_TOS.c6
-rw-r--r--net/ipv4/raw.c1
-rw-r--r--net/ipv4/syncookies.c2
-rw-r--r--net/ipv4/tcp.c170
-rw-r--r--net/ipv4/tcp_input.c88
-rw-r--r--net/ipv4/tcp_timer.c2
-rw-r--r--net/ipv4/udp.c28
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/raw.c1
-rw-r--r--net/ipx/af_ipx.c50
-rw-r--r--net/irda/compressors/irda_deflate.c2
-rw-r--r--net/irda/irlan/irlan_client.c3
-rw-r--r--net/irda/irlan/irlan_eth.c1
-rw-r--r--net/irda/irlap.c28
-rw-r--r--net/irda/irlap_event.c48
-rw-r--r--net/irda/irlap_frame.c5
-rw-r--r--net/irda/irlmp.c2
-rw-r--r--net/irda/irttp.c13
-rw-r--r--net/irda/qos.c189
-rw-r--r--net/khttpd/misc.c2
-rw-r--r--net/khttpd/rfc.c2
-rw-r--r--net/khttpd/rfc_time.c2
-rw-r--r--net/khttpd/security.c2
-rw-r--r--net/khttpd/sysctl.c4
-rw-r--r--net/khttpd/userspace.c2
-rw-r--r--net/lapb/Makefile2
-rw-r--r--net/lapb/lapb_iface.c14
-rw-r--r--net/lapb/lapb_in.c4
-rw-r--r--net/lapb/lapb_out.c4
-rw-r--r--net/lapb/lapb_subr.c4
-rw-r--r--net/lapb/lapb_timer.c4
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/netlink/netlink_dev.c2
-rw-r--r--net/netrom/Makefile2
-rw-r--r--net/netsyms.c1
-rw-r--r--net/packet/af_packet.c1
-rw-r--r--net/rose/Makefile2
-rw-r--r--net/sched/sch_atm.c2
-rw-r--r--net/sched/sch_dsmark.c2
-rw-r--r--net/sunrpc/auth.c2
-rw-r--r--net/sunrpc/auth_null.c2
-rw-r--r--net/sunrpc/auth_unix.c2
-rw-r--r--net/sunrpc/clnt.c2
-rw-r--r--net/sunrpc/sched.c2
-rw-r--r--net/sunrpc/svcsock.c3
-rw-r--r--net/sunrpc/xprt.c2
-rw-r--r--net/unix/af_unix.c11
-rw-r--r--net/unix/garbage.c2
-rw-r--r--net/wanrouter/wanmain.c2
-rw-r--r--net/wanrouter/wanproc.c33
75 files changed, 446 insertions, 638 deletions
diff --git a/net/802/cl2llc.c b/net/802/cl2llc.c
index 8d236b4c4..c8cce10e9 100644
--- a/net/802/cl2llc.c
+++ b/net/802/cl2llc.c
@@ -28,7 +28,7 @@
#include <linux/types.h>
#include <linux/kernel.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/p8022.h>
@@ -96,7 +96,7 @@ int llc_data_request(llcptr lp, struct sk_buff *skb)
else
llc_interpret_pseudo_code(lp, REJECT1, skb, NO_FRAME);
break;
- default:
+ default:;
}
if(lp->llc_callbacks)
{
@@ -497,7 +497,7 @@ void llc_interpret_pseudo_code(llcptr lp, int pc_label, struct sk_buff *skb,
else
lp->f_flag = fr->i_hdr.i_pflag;
break;
- default:
+ default:;
}
pc++;
}
diff --git a/net/802/llc_macinit.c b/net/802/llc_macinit.c
index 987d8a5c4..3b6dc3478 100644
--- a/net/802/llc_macinit.c
+++ b/net/802/llc_macinit.c
@@ -24,7 +24,7 @@
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/unistd.h>
#include <linux/string.h>
#include <linux/netdevice.h>
@@ -125,7 +125,7 @@ int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb)
free=0;
break;
- default:
+ default:;
/*
* All other type 1 pdus ignored for now
*/
diff --git a/net/802/llc_sendpdu.c b/net/802/llc_sendpdu.c
index f0c6d116e..924a9cc60 100644
--- a/net/802/llc_sendpdu.c
+++ b/net/802/llc_sendpdu.c
@@ -19,7 +19,7 @@
#include <linux/types.h>
#include <linux/kernel.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/p8022.h>
diff --git a/net/Changes b/net/Changes
deleted file mode 100644
index 3e88ee85f..000000000
--- a/net/Changes
+++ /dev/null
@@ -1,44 +0,0 @@
---------------- Things That Need Doing Before 2.2 ------------------
-
-o insw_and_csum
-
--------------------------- Bugs to fix ------------------------------
-
-o Should unix domain connect never block ?
-o Screend loadable firewall module
-o Remove kernel RARP and replace with user mode daemon.
-o Merge ARM half word trap fixes for ethernet headers
-o Stop route addition to downed interfaces
-o Make sure route add window functionality is back or documented
- equivalences are clear
-o Merge ATM
-o Merge IRDA
-
-Possible projects for victim^H^H^H^H^Holunteers
-
-9. Implementing streams. Not as a blind slow SYS5.4 style copy but actually
-working out how to do it so it runs like greased lightning. Quite a big
-problem. [See the LiS project]
-
-11. IP over SCSI. [worked on]
-
-14. Bidirectional PLIP. Also PLIP for the newer style parallel ports.
-
-15. 802.2LLC and thus Netbeui sockets. Becoming less important since the
-rumour is microsoft are phasing out netbeui for netbios/IP. Microsoft have
-gone for netbios/funny-ipx-variant it seems in Win95, but TCP is selectable.
-
-17. PPP multilink. Another nasty job.
-
-19. IPv4 IP-AH and IP-ESP.
-
-20. (userspace) GUI interface to the bandwidth allocators so mere
- mortals can do this
-
-
-BTW: Don't let the magic words 'kernel programming' worry you. Its like DOS
-- you make a mistake you have to reboot. You do at least get dumps and a
-kernel logger that is reliable. There is now a loadable module allowing
-use of gdb on the kernel (no breakpoints though!). No magic involved.
-
-Alan
diff --git a/net/Config.in b/net/Config.in
index 4d4f6c373..96b8ee502 100644
--- a/net/Config.in
+++ b/net/Config.in
@@ -77,15 +77,15 @@ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'WAN router' CONFIG_WAN_ROUTER
bool 'Fast switching (read help!)' CONFIG_NET_FASTROUTE
bool 'Forwarding between high speed interfaces' CONFIG_NET_HW_FLOWCONTROL
- if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
- mainmenu_option next_comment
- comment 'QoS and/or fair queueing'
- bool 'QoS and/or fair queueing (EXPERIMENTAL)' CONFIG_NET_SCHED
- if [ "$CONFIG_NET_SCHED" = "y" ]; then
- source net/sched/Config.in
- fi
-# bool 'Network code profiler' CONFIG_NET_PROFILE
- endmenu
- fi
fi
+
+mainmenu_option next_comment
+comment 'QoS and/or fair queueing'
+bool 'QoS and/or fair queueing (EXPERIMENTAL)' CONFIG_NET_SCHED
+if [ "$CONFIG_NET_SCHED" = "y" ]; then
+ source net/sched/Config.in
+fi
+#bool 'Network code profiler' CONFIG_NET_PROFILE
+endmenu
+
endmenu
diff --git a/net/appletalk/Makefile b/net/appletalk/Makefile
index 99e57580a..e8e2c8f8a 100644
--- a/net/appletalk/Makefile
+++ b/net/appletalk/Makefile
@@ -18,5 +18,3 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_atalk.o
include $(TOPDIR)/Rules.make
-tar:
- tar -cvf /dev/f1 .
diff --git a/net/atm/common.c b/net/atm/common.c
index b2bd5a624..e566554ee 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -26,6 +26,7 @@
#include <asm/uaccess.h>
#include <asm/atomic.h>
#include <asm/poll.h>
+#include <asm/ioctls.h>
#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
#include <linux/atmlec.h>
@@ -376,6 +377,8 @@ int atm_recvmsg(struct socket *sock,struct msghdr *m,int total_len,
if (error <= 0) return error;
vcc->timestamp = skb->stamp;
eff_len = skb->len > size ? size : skb->len;
+ if (skb->len > size) /* Not fit ? Report it... */
+ m->msg_flags |= MSG_TRUNC;
if (vcc->dev->ops->feedback)
vcc->dev->ops->feedback(vcc,skb,(unsigned long) skb->data,
(unsigned long) buff,eff_len);
diff --git a/net/atm/lec.h b/net/atm/lec.h
index 5dd0494e9..0ebd861c4 100644
--- a/net/atm/lec.h
+++ b/net/atm/lec.h
@@ -72,7 +72,7 @@ struct atm_lane_ops {
* 2. LLC Data frames whose total length, including LLC field and data,
* but not padding required to meet the minimum data frame length,
* is less than 1536(0x0600) MUST be encoded by placing that length
- * in the the h_type field. The LLC field follows header immediatelly.
+ * in the h_type field. The LLC field follows header immediatelly.
* 3. LLC data frames longer than this maximum MUST be encoded by placing
* the value 0 in the h_type field.
*
@@ -154,5 +154,5 @@ void lec_push(struct atm_vcc *vcc, struct sk_buff *skb);
void atm_lane_init(void);
void atm_lane_init_ops(struct atm_lane_ops *ops);
-#endif _LEC_H_
+#endif /* _LEC_H_ */
diff --git a/net/ax25/Makefile b/net/ax25/Makefile
index 379185077..5974031f4 100644
--- a/net/ax25/Makefile
+++ b/net/ax25/Makefile
@@ -23,5 +23,3 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_ax25.o
include $(TOPDIR)/Rules.make
-tar:
- tar -cvf /dev/f1 .
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index b73b4e5f2..4a2684ebe 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1782,10 +1782,9 @@ static int ax25_get_info(char *buffer, char **start, off_t offset, int length)
return(len);
}
-static struct net_proto_family ax25_family_ops =
-{
- PF_AX25,
- ax25_create
+static struct net_proto_family ax25_family_ops = {
+ family: PF_AX25,
+ create: ax25_create,
};
static struct proto_ops SOCKOPS_WRAPPED(ax25_proto_ops) = {
@@ -1814,18 +1813,13 @@ SOCKOPS_WRAP(ax25_proto, PF_AX25);
/*
* Called by socket.c on kernel start up
*/
-static struct packet_type ax25_packet_type =
-{
- 0, /* MUTTER ntohs(ETH_P_AX25),*/
- 0, /* copy */
- ax25_kiss_rcv,
- NULL,
- NULL,
+static struct packet_type ax25_packet_type = {
+ type: __constant_htons(ETH_P_AX25),
+ func: ax25_kiss_rcv,
};
static struct notifier_block ax25_dev_notifier = {
- ax25_device_event,
- 0
+ notifier_call: ax25_device_event,
};
EXPORT_SYMBOL(ax25_encapsulate);
@@ -1846,10 +1840,11 @@ EXPORT_SYMBOL(asc2ax);
EXPORT_SYMBOL(null_ax25_address);
EXPORT_SYMBOL(ax25_display_timer);
+static const char banner[] __initdata = KERN_INFO "NET4: G4KLX/GW4PTS AX.25 for Linux. Version 0.37 for Linux NET4.0\n";
+
static int __init ax25_init(void)
{
sock_register(&ax25_family_ops);
- ax25_packet_type.type = htons(ETH_P_AX25);
dev_add_pack(&ax25_packet_type);
register_netdevice_notifier(&ax25_dev_notifier);
ax25_register_sysctl();
@@ -1858,7 +1853,7 @@ static int __init ax25_init(void)
proc_net_create("ax25", 0, ax25_get_info);
proc_net_create("ax25_calls", 0, ax25_uid_get_info);
- printk(KERN_INFO "NET4: G4KLX/GW4PTS AX.25 for Linux. Version 0.37 for Linux NET4.0\n");
+ printk(banner);
return 0;
}
module_init(ax25_init);
@@ -1879,7 +1874,6 @@ static void __exit ax25_exit(void)
ax25_unregister_sysctl();
unregister_netdevice_notifier(&ax25_dev_notifier);
- ax25_packet_type.type = htons(ETH_P_AX25);
dev_remove_pack(&ax25_packet_type);
sock_unregister(PF_AX25);
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index ed5e6fbce..7c1484d6e 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -36,6 +36,7 @@
* AX.25 036 Jonathan(G4KLX) Move DAMA code into own file.
* Joerg(DL1BKE) Fixed DAMA Slave.
* AX.25 037 Jonathan(G4KLX) New timer architecture.
+ * Thomas(DL9SAU) Fixed missing initialization of skb->protocol.
*/
#include <linux/config.h>
@@ -158,6 +159,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
skb->nh.raw = skb->data;
skb->dev = ax25->ax25_dev->dev;
skb->pkt_type = PACKET_HOST;
+ skb->protocol = htons(ETH_P_IP);
ip_rcv(skb, skb->dev, NULL); /* Wrong ptype */
return 1;
}
@@ -287,6 +289,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, ax25_address *d
skb->nh.raw = skb->data;
skb->dev = dev;
skb->pkt_type = PACKET_HOST;
+ skb->protocol = htons(ETH_P_IP);
ip_rcv(skb, dev, ptype); /* Note ptype here is the wrong one, fix me later */
break;
@@ -296,6 +299,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, ax25_address *d
skb->nh.raw = skb->data;
skb->dev = dev;
skb->pkt_type = PACKET_HOST;
+ skb->protocol = htons(ETH_P_ARP);
arp_rcv(skb, dev, ptype); /* Note ptype here is wrong... */
break;
#endif
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c
index c01ae329c..e6016f93d 100644
--- a/net/ax25/sysctl_net_ax25.c
+++ b/net/ax25/sysctl_net_ax25.c
@@ -27,8 +27,8 @@ static int min_ds_timeout[] = {0}, max_ds_timeout[] = {65535 * HZ};
static struct ctl_table_header *ax25_table_header;
-static ctl_table *ax25_table = NULL;
-static int ax25_table_size = 0;
+static ctl_table *ax25_table;
+static int ax25_table_size;
static ctl_table ax25_dir_table[] = {
{NET_AX25, "ax25", NULL, 0, 0555, NULL},
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 8fcfe3fe4..928e89cdb 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -4,7 +4,7 @@
* Authors:
* Lennert Buytenhek <buytenh@gnu.org>
*
- * $Id: br_private.h,v 1.4 2001/01/19 04:51:48 davem Exp $
+ * $Id: br_private.h,v 1.5 2001/02/05 06:03:47 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -116,83 +116,83 @@ extern struct notifier_block br_device_notifier;
extern unsigned char bridge_ula[6];
/* br.c */
-void br_dec_use_count(void);
-void br_inc_use_count(void);
+extern void br_dec_use_count(void);
+extern void br_inc_use_count(void);
/* br_device.c */
-void br_dev_setup(struct net_device *dev);
+extern void br_dev_setup(struct net_device *dev);
/* br_fdb.c */
-void br_fdb_changeaddr(struct net_bridge_port *p,
+extern void br_fdb_changeaddr(struct net_bridge_port *p,
unsigned char *newaddr);
-void br_fdb_cleanup(struct net_bridge *br);
-void br_fdb_delete_by_port(struct net_bridge *br,
+extern void br_fdb_cleanup(struct net_bridge *br);
+extern void br_fdb_delete_by_port(struct net_bridge *br,
struct net_bridge_port *p);
-struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
+extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
unsigned char *addr);
-void br_fdb_put(struct net_bridge_fdb_entry *ent);
-int br_fdb_get_entries(struct net_bridge *br,
+extern void br_fdb_put(struct net_bridge_fdb_entry *ent);
+extern int br_fdb_get_entries(struct net_bridge *br,
unsigned char *_buf,
int maxnum,
int offset);
-void br_fdb_insert(struct net_bridge *br,
+extern void br_fdb_insert(struct net_bridge *br,
struct net_bridge_port *source,
unsigned char *addr,
int is_local);
/* br_forward.c */
-void br_forward(struct net_bridge_port *to,
+extern void br_forward(struct net_bridge_port *to,
struct sk_buff *skb);
-void br_flood(struct net_bridge *br,
+extern void br_flood(struct net_bridge *br,
struct sk_buff *skb,
int clone);
/* br_if.c */
-int br_add_bridge(char *name);
-int br_del_bridge(char *name);
-int br_add_if(struct net_bridge *br,
+extern int br_add_bridge(char *name);
+extern int br_del_bridge(char *name);
+extern int br_add_if(struct net_bridge *br,
struct net_device *dev);
-int br_del_if(struct net_bridge *br,
+extern int br_del_if(struct net_bridge *br,
struct net_device *dev);
-int br_get_bridge_ifindices(int *indices,
+extern int br_get_bridge_ifindices(int *indices,
int num);
-void br_get_port_ifindices(struct net_bridge *br,
+extern void br_get_port_ifindices(struct net_bridge *br,
int *ifindices);
/* br_input.c */
-void br_handle_frame(struct sk_buff *skb);
+extern void br_handle_frame(struct sk_buff *skb);
/* br_ioctl.c */
-void br_call_ioctl_atomic(void (*fn)(void));
-int br_ioctl(struct net_bridge *br,
+extern void br_call_ioctl_atomic(void (*fn)(void));
+extern int br_ioctl(struct net_bridge *br,
unsigned int cmd,
unsigned long arg0,
unsigned long arg1,
unsigned long arg2);
-int br_ioctl_deviceless_stub(unsigned long arg);
+extern int br_ioctl_deviceless_stub(unsigned long arg);
/* br_stp.c */
-int br_is_root_bridge(struct net_bridge *br);
-struct net_bridge_port *br_get_port(struct net_bridge *br,
+extern int br_is_root_bridge(struct net_bridge *br);
+extern struct net_bridge_port *br_get_port(struct net_bridge *br,
int port_no);
-void br_init_port(struct net_bridge_port *p);
-port_id br_make_port_id(struct net_bridge_port *p);
-void br_become_designated_port(struct net_bridge_port *p);
+extern void br_init_port(struct net_bridge_port *p);
+extern port_id br_make_port_id(struct net_bridge_port *p);
+extern void br_become_designated_port(struct net_bridge_port *p);
/* br_stp_if.c */
-void br_stp_enable_bridge(struct net_bridge *br);
-void br_stp_disable_bridge(struct net_bridge *br);
-void br_stp_enable_port(struct net_bridge_port *p);
-void br_stp_disable_port(struct net_bridge_port *p);
-void br_stp_recalculate_bridge_id(struct net_bridge *br);
-void br_stp_set_bridge_priority(struct net_bridge *br,
+extern void br_stp_enable_bridge(struct net_bridge *br);
+extern void br_stp_disable_bridge(struct net_bridge *br);
+extern void br_stp_enable_port(struct net_bridge_port *p);
+extern void br_stp_disable_port(struct net_bridge_port *p);
+extern void br_stp_recalculate_bridge_id(struct net_bridge *br);
+extern void br_stp_set_bridge_priority(struct net_bridge *br,
int newprio);
-void br_stp_set_port_priority(struct net_bridge_port *p,
+extern void br_stp_set_port_priority(struct net_bridge_port *p,
int newprio);
-void br_stp_set_path_cost(struct net_bridge_port *p,
+extern void br_stp_set_path_cost(struct net_bridge_port *p,
int path_cost);
/* br_stp_bpdu.c */
-void br_stp_handle_bpdu(struct sk_buff *skb);
+extern void br_stp_handle_bpdu(struct sk_buff *skb);
#endif
diff --git a/net/bridge/br_private_stp.h b/net/bridge/br_private_stp.h
index 2857d5c91..7aa4af3f5 100644
--- a/net/bridge/br_private_stp.h
+++ b/net/bridge/br_private_stp.h
@@ -4,7 +4,7 @@
* Authors:
* Lennert Buytenhek <buytenh@gnu.org>
*
- * $Id: br_private_stp.h,v 1.2 2000/10/30 22:03:20 davem Exp $
+ * $Id: br_private_stp.h,v 1.3 2001/02/05 06:03:47 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -33,21 +33,21 @@ struct br_config_bpdu
};
/* br_stp.c */
-void br_become_root_bridge(struct net_bridge *br);
-void br_config_bpdu_generation(struct net_bridge *);
-void br_configuration_update(struct net_bridge *);
-int br_is_designated_port(struct net_bridge_port *p);
-int br_is_root_bridge(struct net_bridge *br);
-void br_port_state_selection(struct net_bridge *);
-void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu);
-void br_received_tcn_bpdu(struct net_bridge_port *p);
-void br_tick(unsigned long __data);
-void br_transmit_config(struct net_bridge_port *p);
-void br_transmit_tcn(struct net_bridge *br);
-void br_topology_change_detection(struct net_bridge *br);
+extern void br_become_root_bridge(struct net_bridge *br);
+extern void br_config_bpdu_generation(struct net_bridge *);
+extern void br_configuration_update(struct net_bridge *);
+extern int br_is_designated_port(struct net_bridge_port *p);
+extern int br_is_root_bridge(struct net_bridge *br);
+extern void br_port_state_selection(struct net_bridge *);
+extern void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu);
+extern void br_received_tcn_bpdu(struct net_bridge_port *p);
+extern void br_tick(unsigned long __data);
+extern void br_transmit_config(struct net_bridge_port *p);
+extern void br_transmit_tcn(struct net_bridge *br);
+extern void br_topology_change_detection(struct net_bridge *br);
/* br_stp_bpdu.c */
-void br_send_config_bpdu(struct net_bridge_port *, struct br_config_bpdu *);
-void br_send_tcn_bpdu(struct net_bridge_port *);
+extern void br_send_config_bpdu(struct net_bridge_port *, struct br_config_bpdu *);
+extern void br_send_tcn_bpdu(struct net_bridge_port *);
#endif
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 0b865f6b9..d7064ec63 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -72,19 +72,19 @@ static int wait_for_packet(struct sock * sk, int *err, long *timeo_p)
/* Socket errors? */
error = sock_error(sk);
if (error)
- goto out;
+ goto out_err;
if (!skb_queue_empty(&sk->receive_queue))
goto ready;
/* Socket shut down? */
if (sk->shutdown & RCV_SHUTDOWN)
- goto out;
+ goto out_noerr;
/* Sequenced packets can come disconnected. If so we report the problem */
error = -ENOTCONN;
if(connection_based(sk) && !(sk->state==TCP_ESTABLISHED || sk->state==TCP_LISTEN))
- goto out;
+ goto out_err;
/* handle signals */
if (signal_pending(current))
@@ -99,11 +99,16 @@ ready:
interrupted:
error = sock_intr_errno(*timeo_p);
+out_err:
+ *err = error;
out:
current->state = TASK_RUNNING;
remove_wait_queue(sk->sleep, &wait);
- *err = error;
return error;
+out_noerr:
+ *err = 0;
+ error = 1;
+ goto out;
}
/*
diff --git a/net/core/iovec.c b/net/core/iovec.c
index 4ebad506e..2fe34a20d 100644
--- a/net/core/iovec.c
+++ b/net/core/iovec.c
@@ -21,7 +21,7 @@
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/net.h>
#include <linux/in6.h>
#include <asm/uaccess.h>
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5275e83b8..c9b760cae 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -44,11 +44,10 @@
#include <linux/interrupt.h>
#include <linux/in.h>
#include <linux/inet.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/string.h>
#include <linux/skbuff.h>
-#include <linux/slab.h>
#include <linux/cache.h>
#include <linux/init.h>
diff --git a/net/core/sock.c b/net/core/sock.c
index d15bd82f4..fa5e0a890 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -7,7 +7,7 @@
* handler for protocols to use and generic option handler.
*
*
- * Version: $Id: sock.c,v 1.102 2000/12/11 23:00:24 davem Exp $
+ * Version: $Id: sock.c,v 1.104 2001/01/30 07:48:30 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -550,6 +550,13 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
goto lenout;
}
+ /* Dubious BSD thing... Probably nobody even uses it, but
+ * the UNIX standard wants it for whatever reason... -DaveM
+ */
+ case SO_ACCEPTCONN:
+ v.val = (sk->state == TCP_LISTEN);
+ break;
+
default:
return(-ENOPROTOOPT);
}
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index b930878c2..6cca075c0 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -114,6 +114,7 @@ Version 0.0.6 2.1.110 07-aug-98 Eduardo Marcelo Serrat
#include <net/sock.h>
#include <asm/segment.h>
#include <asm/system.h>
+#include <asm/ioctls.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/proc_fs.h>
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index 0c9fb1f7f..264d6fcb1 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -127,7 +127,7 @@ static int dn_node_address_strategy(ctl_table *table, int *name, int nlen,
void *newval, size_t newlen,
void **context)
{
- int len;
+ size_t len;
dn_address addr;
if (oldval && oldlenp) {
@@ -161,7 +161,7 @@ static int dn_node_address_handler(ctl_table *table, int write,
void *buffer, size_t *lenp)
{
char addr[DN_ASCBUF_LEN];
- int len;
+ size_t len;
dn_address dnaddr;
if (!*lenp || (filp->f_pos && !write)) {
@@ -265,7 +265,7 @@ static int dn_def_dev_handler(ctl_table *table, int write,
struct file * filp,
void *buffer, size_t *lenp)
{
- int len;
+ size_t len;
struct net_device *dev = decnet_default_device;
char devname[17];
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 51592202a..c43892ea5 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -65,19 +65,9 @@
* clean up the APFDDI & gen. FDDI bits.
* Alexey Kuznetsov: new arp state machine;
* now it is in net/core/neighbour.c.
+ * Krzysztof Halasa: Added Frame Relay ARP support.
*/
-/* RFC1122 Status:
- 2.3.2.1 (ARP Cache Validation):
- MUST provide mechanism to flush stale cache entries (OK)
- SHOULD be able to configure cache timeout (OK)
- MUST throttle ARP retransmits (OK)
- 2.3.2.2 (ARP Packet Queue):
- SHOULD save at least one packet from each "conversation" with an
- unresolved IP address. (OK)
- 950727 -- MS
-*/
-
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
@@ -647,6 +637,20 @@ int arp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
goto out;
break;
#endif
+#ifdef CONFIG_NET_FC
+ case ARPHRD_IEEE802:
+ /*
+ * According to RFC 2625, Fibre Channel devices (which are IEEE
+ * 802 devices) should accept ARP hardware types of 6 (IEEE 802)
+ * and 1 (Ethernet).
+ */
+ if (arp->ar_hrd != __constant_htons(ARPHRD_ETHER) &&
+ arp->ar_hrd != __constant_htons(ARPHRD_IEEE802))
+ goto out;
+ if (arp->ar_pro != __constant_htons(ETH_P_IP))
+ goto out;
+ break;
+#endif
#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
case ARPHRD_AX25:
if (arp->ar_pro != __constant_htons(AX25_P_IP))
@@ -689,6 +693,12 @@ int arp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
goto out;
/*
+ * Special case: We must set Frame Relay source Q.922 address
+ */
+ if (dev_type == ARPHRD_DLCI)
+ sha = dev->broadcast;
+
+/*
* Process entry. The idea here is we want to send a reply if it is a
* request for us or if it is a request for someone else that we hold
* a proxy for. We want to add an entry to our cache if it is a reply
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 6b980e3f3..8d668ff41 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1,7 +1,7 @@
/*
* NET3 IP device support routines.
*
- * Version: $Id: devinet.c,v 1.39 2000/12/10 22:24:11 davem Exp $
+ * Version: $Id: devinet.c,v 1.40 2001/02/05 06:03:47 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -50,9 +50,7 @@
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#endif
-#ifdef CONFIG_KMOD
#include <linux/kmod.h>
-#endif
#include <net/ip.h>
#include <net/route.h>
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index b7af2b9f6..8b10997e2 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1,5 +1,5 @@
/*
- * $Id: ipconfig.c,v 1.34 2000/07/26 01:04:18 davem Exp $
+ * $Id: ipconfig.c,v 1.35 2000/12/30 06:46:36 davem Exp $
*
* Automatic Configuration of IP -- use BOOTP or RARP or user-supplied
* information to configure own IP address and routes.
diff --git a/net/ipv4/netfilter/ip_fw_compat.c b/net/ipv4/netfilter/ip_fw_compat.c
index cc3d2fb9c..fcfb6e653 100644
--- a/net/ipv4/netfilter/ip_fw_compat.c
+++ b/net/ipv4/netfilter/ip_fw_compat.c
@@ -9,6 +9,7 @@ struct notifier_block;
#include <linux/inetdevice.h>
#include <linux/netdevice.h>
#include <linux/module.h>
+#include <asm/uaccess.h>
#include <net/ip.h>
#include <net/route.h>
#include <linux/netfilter_ipv4/compat_firewall.h>
@@ -132,7 +133,7 @@ fw_in(unsigned int hooknum,
if (ret == FW_ACCEPT || ret == FW_SKIP) {
if (fwops->fw_acct_out)
fwops->fw_acct_out(fwops, PF_INET,
- (struct net_device *)in,
+ (struct net_device *)out,
(*pskb)->nh.raw, &redirpt,
pskb);
confirm_connection(*pskb);
@@ -197,14 +198,28 @@ static unsigned int fw_confirm(unsigned int hooknum,
return NF_ACCEPT;
}
-extern int ip_fw_ctl(int optval, void *user, unsigned int len);
+extern int ip_fw_ctl(int optval, void *m, unsigned int len);
static int sock_fn(struct sock *sk, int optval, void *user, unsigned int len)
{
+ /* MAX of:
+ 2.2: sizeof(struct ip_fwtest) (~14x4 + 3x4 = 17x4)
+ 2.2: sizeof(struct ip_fwnew) (~1x4 + 15x4 + 3x4 + 3x4 = 22x4)
+ 2.0: sizeof(struct ip_fw) (~25x4)
+
+ We can't include both 2.0 and 2.2 headers, they conflict.
+ Hence, 200 is a good number. --RR */
+ char tmp_fw[200];
if (!capable(CAP_NET_ADMIN))
return -EPERM;
- return -ip_fw_ctl(optval, user, len);
+ if (len > sizeof(tmp_fw) || len < 1)
+ return -EINVAL;
+
+ if (copy_from_user(&tmp_fw, user, len))
+ return -EFAULT;
+
+ return -ip_fw_ctl(optval, &tmp_fw, len);
}
static struct nf_hook_ops preroute_ops
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index e5fbe41af..9ee86138d 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -330,11 +330,9 @@ static void __exit fini(void)
module_init(init);
module_exit(fini);
-#ifdef MODULE
EXPORT_SYMBOL(ip_nat_setup_info);
EXPORT_SYMBOL(ip_nat_helper_register);
EXPORT_SYMBOL(ip_nat_helper_unregister);
EXPORT_SYMBOL(ip_nat_expect_register);
EXPORT_SYMBOL(ip_nat_expect_unregister);
EXPORT_SYMBOL(ip_nat_cheat_check);
-#endif
diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c
index e834d5103..2967ed241 100644
--- a/net/ipv4/netfilter/ipt_TOS.c
+++ b/net/ipv4/netfilter/ipt_TOS.c
@@ -19,11 +19,11 @@ target(struct sk_buff **pskb,
const struct ipt_tos_target_info *tosinfo = targinfo;
if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) {
- u_int8_t diffs[2];
+ u_int16_t diffs[2];
- diffs[0] = iph->tos;
+ diffs[0] = htons(iph->tos) ^ 0xFFFF;
iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos;
- diffs[1] = iph->tos;
+ diffs[1] = htons(iph->tos);
iph->check = csum_fold(csum_partial((char *)diffs,
sizeof(diffs),
iph->check^0xFFFF));
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 5db8dc8dd..677ea7a37 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -41,6 +41,7 @@
#include <linux/config.h>
#include <asm/system.h>
#include <asm/uaccess.h>
+#include <asm/ioctls.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/errno.h>
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index d267223ed..8f20486cd 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -17,7 +17,7 @@
#include <linux/config.h>
#if defined(CONFIG_SYN_COOKIES)
#include <linux/tcp.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/random.h>
#include <net/tcp.h>
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6660e0f72..a4c6102d1 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -245,175 +245,6 @@
* TCP_CLOSE socket is finished
*/
-/*
- * RFC1122 status:
- * NOTE: I'm not going to be doing comments in the code for this one except
- * for violations and the like. tcp.c is just too big... If I say something
- * "does?" or "doesn't?", it means I'm not sure, and will have to hash it out
- * with Alan. -- MS 950903
- * [Note: Most of the TCP code has been rewriten/redesigned since this
- * RFC1122 check. It is probably not correct anymore. It should be redone
- * before 2.2. -AK]
- *
- * Use of PSH (4.2.2.2)
- * MAY aggregate data sent without the PSH flag. (does)
- * MAY queue data received without the PSH flag. (does)
- * SHOULD collapse successive PSH flags when it packetizes data. (doesn't)
- * MAY implement PSH on send calls. (doesn't, thus:)
- * MUST NOT buffer data indefinitely (doesn't [1 second])
- * MUST set PSH on last segment (does)
- * MAY pass received PSH to application layer (doesn't)
- * SHOULD send maximum-sized segment whenever possible. (almost always does)
- *
- * Window Size (4.2.2.3, 4.2.2.16)
- * MUST treat window size as an unsigned number (does)
- * SHOULD treat window size as a 32-bit number (does not)
- * MUST NOT shrink window once it is offered (does not normally)
- *
- * Urgent Pointer (4.2.2.4)
- * **MUST point urgent pointer to last byte of urgent data (not right
- * after). (doesn't, to be like BSD. That's configurable, but defaults
- * to off)
- * MUST inform application layer asynchronously of incoming urgent
- * data. (does)
- * MUST provide application with means of determining the amount of
- * urgent data pending. (does)
- * **MUST support urgent data sequence of arbitrary length. (doesn't, but
- * it's sort of tricky to fix, as urg_ptr is a 16-bit quantity)
- * [Follows BSD 1 byte of urgent data]
- *
- * TCP Options (4.2.2.5)
- * MUST be able to receive TCP options in any segment. (does)
- * MUST ignore unsupported options (does)
- *
- * Maximum Segment Size Option (4.2.2.6)
- * MUST implement both sending and receiving MSS. (does, but currently
- * only uses the smaller of both of them)
- * SHOULD send an MSS with every SYN where receive MSS != 536 (MAY send
- * it always). (does, even when MSS == 536, which is legal)
- * MUST assume MSS == 536 if no MSS received at connection setup (does)
- * MUST calculate "effective send MSS" correctly:
- * min(physical_MTU, remote_MSS+20) - sizeof(tcphdr) - sizeof(ipopts)
- * (does - but allows operator override)
- *
- * TCP Checksum (4.2.2.7)
- * MUST generate and check TCP checksum. (does)
- *
- * Initial Sequence Number Selection (4.2.2.8)
- * MUST use the RFC 793 clock selection mechanism. (doesn't, but it's
- * OK: RFC 793 specifies a 250KHz clock, while we use 1MHz, which is
- * necessary for 10Mbps networks - and harder than BSD to spoof!
- * With syncookies we don't)
- *
- * Simultaneous Open Attempts (4.2.2.10)
- * MUST support simultaneous open attempts (does)
- *
- * Recovery from Old Duplicate SYN (4.2.2.11)
- * MUST keep track of active vs. passive open (does)
- *
- * RST segment (4.2.2.12)
- * SHOULD allow an RST segment to contain data (does, but doesn't do
- * anything with it, which is standard)
- *
- * Closing a Connection (4.2.2.13)
- * MUST inform application of whether connection was closed by RST or
- * normal close. (does)
- * MAY allow "half-duplex" close (treat connection as closed for the
- * local app, even before handshake is done). (does)
- * MUST linger in TIME_WAIT for 2 * MSL (does)
- *
- * Retransmission Timeout (4.2.2.15)
- * MUST implement Jacobson's slow start and congestion avoidance
- * stuff. (does)
- *
- * Probing Zero Windows (4.2.2.17)
- * MUST support probing of zero windows. (does)
- * MAY keep offered window closed indefinitely. (does)
- * MUST allow remote window to stay closed indefinitely. (does)
- *
- * Passive Open Calls (4.2.2.18)
- * MUST NOT let new passive open affect other connections. (doesn't)
- * MUST support passive opens (LISTENs) concurrently. (does)
- *
- * Time to Live (4.2.2.19)
- * MUST make TCP TTL configurable. (does - IP_TTL option)
- *
- * Event Processing (4.2.2.20)
- * SHOULD queue out-of-order segments. (does)
- * MUST aggregate ACK segments whenever possible. (does but badly)
- *
- * Retransmission Timeout Calculation (4.2.3.1)
- * MUST implement Karn's algorithm and Jacobson's algorithm for RTO
- * calculation. (does, or at least explains them in the comments 8*b)
- * SHOULD initialize RTO to 0 and RTT to 3. (does)
- *
- * When to Send an ACK Segment (4.2.3.2)
- * SHOULD implement delayed ACK. (does)
- * MUST keep ACK delay < 0.5 sec. (does)
- *
- * When to Send a Window Update (4.2.3.3)
- * MUST implement receiver-side SWS. (does)
- *
- * When to Send Data (4.2.3.4)
- * MUST implement sender-side SWS. (does)
- * SHOULD implement Nagle algorithm. (does)
- *
- * TCP Connection Failures (4.2.3.5)
- * MUST handle excessive retransmissions "properly" (see the RFC). (does)
- * SHOULD inform application layer of soft errors. (does)
- *
- * TCP Keep-Alives (4.2.3.6)
- * MAY provide keep-alives. (does)
- * MUST make keep-alives configurable on a per-connection basis. (does)
- * MUST default to no keep-alives. (does)
- * MUST make keep-alive interval configurable. (does)
- * MUST make default keep-alive interval > 2 hours. (does)
- * MUST NOT interpret failure to ACK keep-alive packet as dead
- * connection. (doesn't)
- * SHOULD send keep-alive with no data. (does)
- *
- * TCP Multihoming (4.2.3.7)
- * MUST get source address from IP layer before sending first
- * SYN. (does)
- * MUST use same local address for all segments of a connection. (does)
- *
- * IP Options (4.2.3.8)
- * MUST ignore unsupported IP options. (does)
- * MAY support Time Stamp and Record Route. (does)
- * MUST allow application to specify a source route. (does)
- * MUST allow received Source Route option to set route for all future
- * segments on this connection. (does not (security issues))
- *
- * ICMP messages (4.2.3.9)
- * MUST act on ICMP errors. (does)
- * MUST slow transmission upon receipt of a Source Quench. (doesn't anymore
- * because that is deprecated now by the IETF, can be turned on)
- * MUST NOT abort connection upon receipt of soft Destination
- * Unreachables (0, 1, 5), Time Exceededs and Parameter
- * Problems. (doesn't)
- * SHOULD report soft Destination Unreachables etc. to the
- * application. (does, except during SYN_RECV and may drop messages
- * in some rare cases before accept() - ICMP is unreliable)
- * SHOULD abort connection upon receipt of hard Destination Unreachable
- * messages (2, 3, 4). (does, but see above)
- *
- * Remote Address Validation (4.2.3.10)
- * MUST reject as an error OPEN for invalid remote IP address. (does)
- * MUST ignore SYN with invalid source address. (does)
- * MUST silently discard incoming SYN for broadcast/multicast
- * address. (does)
- *
- * Asynchronous Reports (4.2.4.1)
- * MUST provide mechanism for reporting soft errors to application
- * layer. (does)
- *
- * Type of Service (4.2.4.2)
- * MUST allow application layer to set Type of Service. (does IP_TOS)
- *
- * (Whew. -- MS 950903)
- * (Updated by AK, but not complete yet.)
- **/
-
#include <linux/config.h>
#include <linux/types.h>
#include <linux/fcntl.h>
@@ -425,6 +256,7 @@
#include <net/tcp.h>
#include <asm/uaccess.h>
+#include <asm/ioctls.h>
int sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a3f83272b..3ce6b9509 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -600,7 +600,7 @@ void tcp_update_metrics(struct sock *sk)
/* Increase initial CWND conservatively: if estimated
* RTT is low enough (<20msec) or if we have some preset ssthresh.
*
- * Numbers are taken from RFC1414.
+ * Numbers are taken from RFC2414.
*/
__u32 tcp_init_cwnd(struct tcp_opt *tp)
{
@@ -2164,43 +2164,23 @@ extern __inline__ int tcp_paws_discard(struct tcp_opt *tp, struct sk_buff *skb)
!tcp_disordered_ack(tp, skb));
}
-static int __tcp_sequence(struct tcp_opt *tp, u32 seq, u32 end_seq)
-{
- u32 end_window = tp->rcv_wup + tp->rcv_wnd;
-#ifdef TCP_FORMAL_WINDOW
- u32 rcv_wnd = tcp_receive_window(tp);
-#else
- u32 rcv_wnd = tp->rcv_wnd;
-#endif
-
- if (rcv_wnd &&
- after(end_seq, tp->rcv_nxt) &&
- before(seq, end_window))
- return 1;
- if (seq != end_window)
- return 0;
- return (seq == end_seq);
-}
-
-/* This functions checks to see if the tcp header is actually acceptable.
+/* Check segment sequence number for validity.
+ *
+ * Segment controls are considered valid, if the segment
+ * fits to the window after truncation to the window. Acceptability
+ * of data (and SYN, FIN, of course) is checked separately.
+ * See tcp_data_queue(), for example.
*
- * Actually, our check is seriously broken, we must accept RST,ACK,URG
- * even on zero window effectively trimming data. It is RFC, guys.
- * But our check is so beautiful, that I do not want to repair it
- * now. However, taking into account those stupid plans to start to
- * send some texts with RST, we have to handle at least this case. --ANK
+ * Also, controls (RST is main one) are accepted using RCV.WUP instead
+ * of RCV.NXT. Peer still did not advance his SND.UNA when we
+ * delayed ACK, so that hisSND.UNA<=ourRCV.WUP.
+ * (borrowed from freebsd)
*/
-extern __inline__ int tcp_sequence(struct tcp_opt *tp, u32 seq, u32 end_seq, int rst)
-{
-#ifdef TCP_FORMAL_WINDOW
- u32 rcv_wnd = tcp_receive_window(tp);
-#else
- u32 rcv_wnd = tp->rcv_wnd;
-#endif
- if (seq == tp->rcv_nxt)
- return (rcv_wnd || (end_seq == seq) || rst);
- return __tcp_sequence(tp, seq, end_seq);
+static inline int tcp_sequence(struct tcp_opt *tp, u32 seq, u32 end_seq)
+{
+ return !before(end_seq, tp->rcv_wup) &&
+ !after(seq, tp->rcv_nxt + tcp_receive_window(tp));
}
/* When we get a reset we do this. */
@@ -2541,7 +2521,10 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
* Out of sequence packets to the out_of_order_queue.
*/
if (TCP_SKB_CB(skb)->seq == tp->rcv_nxt) {
- /* Ok. In sequence. */
+ if (tcp_receive_window(tp) == 0)
+ goto out_of_window;
+
+ /* Ok. In sequence. In window. */
if (tp->ucopy.task == current &&
tp->copied_seq == tp->rcv_nxt &&
tp->ucopy.len &&
@@ -2601,20 +2584,27 @@ queue_and_out:
return;
}
-#ifdef TCP_DEBUG
- /* An old packet, either a retransmit or some packet got lost. */
if (!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt)) {
- /* A retransmit, 2nd most common case. Force an imediate ack.
- *
- * It is impossible, seq is checked by top level.
- */
- printk("BUG: retransmit in tcp_data_queue: seq %X\n", TCP_SKB_CB(skb)->seq);
+ /* A retransmit, 2nd most common case. Force an immediate ack. */
+ NET_INC_STATS_BH(DelayedACKLost);
tcp_enter_quickack_mode(tp);
+ tcp_dsack_set(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
+
+out_of_window:
tcp_schedule_ack(tp);
__kfree_skb(skb);
return;
}
-#endif
+
+ /* Out of window. F.e. zero window probe.
+ *
+ * Note: it is highly possible that we may open window and enqueue
+ * this segment now. However, this will be known only after we queue
+ * it, which will result in queue full of successive 1 byte BSD
+ * window probes, it is SWS in fact. So, always reject it and send ACK.
+ */
+ if (!before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt+tcp_receive_window(tp)))
+ goto out_of_window;
tcp_enter_quickack_mode(tp);
@@ -2625,6 +2615,12 @@ queue_and_out:
TCP_SKB_CB(skb)->end_seq);
tcp_dsack_set(tp, TCP_SKB_CB(skb)->seq, tp->rcv_nxt);
+
+ /* If window is closed, drop tail of packet. But after
+ * remembering D-SACK for its head made in previous line.
+ */
+ if (!tcp_receive_window(tp))
+ goto out_of_window;
goto queue_and_out;
}
@@ -3333,7 +3329,7 @@ slow_path:
* Standard slow path.
*/
- if (!tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq, th->rst)) {
+ if (!tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq)) {
/* RFC793, page 37: "In all states except SYN-SENT, all reset
* (RST) segments are validated by checking their SEQ-fields."
* And page 69: "If an incoming segment is not acceptable,
@@ -3669,7 +3665,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
}
/* step 1: check sequence number */
- if (!tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq, th->rst)) {
+ if (!tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq)) {
if (!th->rst)
tcp_send_dupack(sk, skb);
goto discard;
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 27815dcb7..a3e72327b 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -5,7 +5,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_timer.c,v 1.80 2000/10/03 07:29:01 anton Exp $
+ * Version: $Id: tcp_timer.c,v 1.81 2001/01/01 02:38:30 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 3d177c7c9..8067f5a18 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -69,31 +69,9 @@
* 2 of the License, or (at your option) any later version.
*/
-/* RFC1122 Status:
- 4.1.3.1 (Ports):
- SHOULD send ICMP_PORT_UNREACHABLE in response to datagrams to
- an un-listened port. (OK)
- 4.1.3.2 (IP Options)
- MUST pass IP options from IP -> application (OK)
- MUST allow application to specify IP options (OK)
- 4.1.3.3 (ICMP Messages)
- MUST pass ICMP error messages to application (OK -- except when SO_BSDCOMPAT is set)
- 4.1.3.4 (UDP Checksums)
- MUST provide facility for checksumming (OK)
- MAY allow application to control checksumming (OK)
- MUST default to checksumming on (OK)
- MUST discard silently datagrams with bad csums (OK, except during debugging)
- 4.1.3.5 (UDP Multihoming)
- MUST allow application to specify source address (OK)
- SHOULD be able to communicate the chosen src addr up to application
- when application doesn't choose (DOES - use recvmsg cmsgs)
- 4.1.3.6 (Invalid Addresses)
- MUST discard invalid source addresses (OK -- done in the new routing code)
- MUST only send datagrams with one of our addresses (OK)
-*/
-
#include <asm/system.h>
#include <asm/uaccess.h>
+#include <asm/ioctls.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/socket.h>
@@ -161,7 +139,7 @@ static int udp_v4_get_port(struct sock *sk, unsigned short snum)
next:;
}
result = best;
- for(;; result += UDP_HTABLE_SIZE) {
+ for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) {
if (result > sysctl_local_port_range[1])
result = sysctl_local_port_range[0]
+ ((result - sysctl_local_port_range[0]) &
@@ -169,6 +147,8 @@ static int udp_v4_get_port(struct sock *sk, unsigned short snum)
if (!udp_lport_inuse(result))
break;
}
+ if (i >= (1 << 16) / UDP_HTABLE_SIZE)
+ goto fail;
gotit:
udp_port_rover = snum = result;
} else {
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 993165142..bef0e2fcd 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6,7 +6,7 @@
* Pedro Roque <roque@di.fc.ul.pt>
* Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
*
- * $Id: addrconf.c,v 1.59 2000/11/28 11:39:43 davem Exp $
+ * $Id: addrconf.c,v 1.60 2001/01/01 02:38:30 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index e934897ec..1a4c44a39 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -29,6 +29,7 @@
#include <linux/if_arp.h>
#include <linux/icmpv6.h>
#include <asm/uaccess.h>
+#include <asm/ioctls.h>
#include <net/sock.h>
#include <net/snmp.h>
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index fb73651bf..0d0e6e00f 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -64,6 +64,7 @@
* Revision 043: Shared SKBs, don't mangle packets, some cleanups
* Arnaldo Carvalho de Melo <acme@conectiva.com.br>,
* December, 2000
+ * Revision 044: Call ipxitf_hold on NETDEV_UP (acme)
*
* Protect the module by a MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT
* pair. Also, now usage count is managed this way
@@ -443,19 +444,21 @@ static int ipxitf_device_event(struct notifier_block *notifier,
struct net_device *dev = ptr;
ipx_interface *i, *tmp;
- if (event != NETDEV_DOWN)
- return NOTIFY_DONE;
+ if (event != NETDEV_DOWN && event != NETDEV_UP)
+ goto out;
spin_lock_bh(&ipx_interfaces_lock);
for (i = ipx_interfaces; i;) {
tmp = i->if_next;
if (i->if_dev == dev)
- __ipxitf_put(i);
+ if (event == NETDEV_UP)
+ ipxitf_hold(i);
+ else
+ __ipxitf_put(i);
i = tmp;
-
}
spin_unlock_bh(&ipx_interfaces_lock);
- return NOTIFY_DONE;
+out: return NOTIFY_DONE;
}
static void ipxitf_def_skb_handler(struct sock *sock, struct sk_buff *skb)
@@ -1067,7 +1070,7 @@ static int ipxitf_create(ipx_interface_definition *idef)
intrfc->if_sklist = NULL;
intrfc->if_sknum = IPX_MIN_EPHEMERAL_SOCKET;
/* Setup primary if necessary */
- if ((idef->ipx_special == IPX_PRIMARY))
+ if (idef->ipx_special == IPX_PRIMARY)
ipx_primary_net = intrfc;
intrfc->if_internal = 0;
intrfc->if_ipx_offset = dev->hard_header_len + datalink->header_length;
@@ -1191,6 +1194,7 @@ static ipx_interface *ipxitf_auto_create(struct net_device *dev,
atomic_set(&intrfc->refcnt, 1);
MOD_INC_USE_COUNT;
ipxitf_insert(intrfc);
+ dev_hold(dev);
}
return intrfc;
@@ -1832,6 +1836,10 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname,
return -EFAULT;
len = min(len, sizeof(int));
+
+ if(len < 0)
+ return -EINVAL;
+
if (put_user(len, optlen))
return -EFAULT;
@@ -2407,8 +2415,8 @@ int ipx_unregister_spx(void)
*/
static struct net_proto_family ipx_family_ops = {
- PF_IPX,
- ipx_create
+ family: PF_IPX,
+ create: ipx_create,
};
static struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = {
@@ -2423,7 +2431,7 @@ static struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = {
poll: datagram_poll,
ioctl: ipx_ioctl,
listen: sock_no_listen,
- shutdown: sock_no_shutdown, /* FIXME: We have to really support shutdown. */
+ shutdown: sock_no_shutdown, /* FIXME: have to support shutdown */
setsockopt: ipx_setsockopt,
getsockopt: ipx_getsockopt,
sendmsg: ipx_sendmsg,
@@ -2437,26 +2445,20 @@ SOCKOPS_WRAP(ipx_dgram, PF_IPX);
static struct packet_type ipx_8023_packet_type =
{
- __constant_htons(ETH_P_802_3),
- NULL, /* All devices */
- ipx_rcv,
- (void *) 1, /* yap, I understand shared skbs :-) */
- NULL,
+ type: __constant_htons(ETH_P_802_3),
+ func: ipx_rcv,
+ data: (void *) 1, /* yap, I understand shared skbs :-) */
};
static struct packet_type ipx_dix_packet_type =
{
- __constant_htons(ETH_P_IPX),
- NULL, /* All devices */
- ipx_rcv,
- (void *) 1, /* yap, I understand shared skbs :-) */
- NULL,
+ type: __constant_htons(ETH_P_IPX),
+ func: ipx_rcv,
+ data: (void *) 1, /* yap, I understand shared skbs :-) */
};
-static struct notifier_block ipx_dev_notifier={
- ipxitf_device_event,
- NULL,
- 0
+static struct notifier_block ipx_dev_notifier = {
+ notifier_call: ipxitf_device_event,
};
@@ -2492,7 +2494,7 @@ static int __init ipx_init(void)
proc_net_create("ipx_interface", 0, ipx_interface_get_info);
proc_net_create("ipx_route", 0, ipx_rt_get_info);
#endif
- printk(KERN_INFO "NET4: Linux IPX 0.43 for NET4.0\n");
+ printk(KERN_INFO "NET4: Linux IPX 0.44 for NET4.0\n");
printk(KERN_INFO "IPX Portions Copyright (c) 1995 Caldera, Inc.\n");
printk(KERN_INFO "IPX Portions Copyright (c) 2000 Conectiva, Inc.\n");
return 0;
diff --git a/net/irda/compressors/irda_deflate.c b/net/irda/compressors/irda_deflate.c
index f0d2cbb0d..d83ddaab8 100644
--- a/net/irda/compressors/irda_deflate.c
+++ b/net/irda/compressors/irda_deflate.c
@@ -51,7 +51,7 @@
#include <linux/ptrace.h>
#include <linux/ioport.h>
#include <linux/in.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/errno.h>
#include <linux/string.h> /* used in new tty drivers */
diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c
index e3a3ada15..9ed244a6f 100644
--- a/net/irda/irlan/irlan_client.c
+++ b/net/irda/irlan/irlan_client.c
@@ -120,8 +120,9 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr)
return;
}
- /* Address may have changed! */
+ /* Addresses may have changed! */
self->saddr = saddr;
+ self->daddr = daddr;
if (self->disconnect_reason == LM_USER_REQUEST) {
IRDA_DEBUG(0, __FUNCTION__ "(), still stopped by user\n");
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index 007c4acfd..0ca4612cc 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -61,6 +61,7 @@ int irlan_eth_init(struct net_device *dev)
dev->hard_start_xmit = irlan_eth_xmit;
dev->get_stats = irlan_eth_get_stats;
dev->set_multicast_list = irlan_eth_set_multicast_list;
+ dev->features |= NETIF_F_DYNALLOC;
ether_setup(dev);
diff --git a/net/irda/irlap.c b/net/irda/irlap.c
index 38d66d327..b815f9f3a 100644
--- a/net/irda/irlap.c
+++ b/net/irda/irlap.c
@@ -29,7 +29,7 @@
********************************************************************/
#include <linux/config.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/string.h>
#include <linux/skbuff.h>
#include <linux/delay.h>
@@ -998,7 +998,7 @@ void irlap_init_qos_capabilities(struct irlap_cb *self,
}
/*
- * Function irlap_apply_default_connection_parameters (void)
+ * Function irlap_apply_default_connection_parameters (void, now)
*
* Use the default connection and transmission parameters
*
@@ -1010,14 +1010,16 @@ void irlap_apply_default_connection_parameters(struct irlap_cb *self)
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
+ /* xbofs : Default value in NDM */
+ self->next_bofs = 12;
+ self->bofs_count = 12;
+
+ /* NDM Speed is 9600 */
irlap_change_speed(self, 9600, TRUE);
/* Set mbusy when going to NDM state */
irda_device_set_media_busy(self->netdev, TRUE);
- /* Default value in NDM */
- self->bofs_count = 12;
-
/*
* Generate random connection address for this session, which must
* be 7 bits wide and different from 0x00 and 0xfe
@@ -1056,23 +1058,31 @@ void irlap_apply_default_connection_parameters(struct irlap_cb *self)
}
/*
- * Function irlap_apply_connection_parameters (qos)
+ * Function irlap_apply_connection_parameters (qos, now)
*
* Initialize IrLAP with the negotiated QoS values
*
+ * If 'now' is false, the speed and xbofs will be changed after the next
+ * frame is sent.
+ * If 'now' is true, the speed and xbofs is changed immediately
*/
-void irlap_apply_connection_parameters(struct irlap_cb *self)
+void irlap_apply_connection_parameters(struct irlap_cb *self, int now)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
- irlap_change_speed(self, self->qos_tx.baud_rate.value, FALSE);
+ /* Set the negociated xbofs value */
+ self->next_bofs = self->qos_tx.additional_bofs.value;
+ if(now)
+ self->bofs_count = self->next_bofs;
+
+ /* Set the negociated link speed (may need the new xbofs value) */
+ irlap_change_speed(self, self->qos_tx.baud_rate.value, now);
self->window_size = self->qos_tx.window_size.value;
self->window = self->qos_tx.window_size.value;
- self->bofs_count = self->qos_tx.additional_bofs.value;
/*
* Calculate how many bytes it is possible to transmit before the
diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c
index e5454d3a4..10a942584 100644
--- a/net/irda/irlap_event.c
+++ b/net/irda/irlap_event.c
@@ -684,25 +684,26 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
irlap_initiate_connection_state(self);
-#if 0
/*
- * We are allowed to send two frames, but this may increase
- * the connect latency, so lets not do it for now.
+ * Applying the parameters now will make sure we change speed
+ * *after* we have sent the next frame
*/
- irlap_send_ua_response_frame(self, &self->qos_rx);
-#endif
+ irlap_apply_connection_parameters(self, FALSE);
/*
- * Applying the parameters now will make sure we change speed
- * after we have sent the next frame
+ * Sending this frame will force a speed change after it has
+ * been sent (i.e. the frame will be sent at 9600).
*/
- irlap_apply_connection_parameters(self);
+ irlap_send_ua_response_frame(self, &self->qos_rx);
+#if 0
/*
- * Sending this frame will force a speed change after it has
- * been sent
+ * We are allowed to send two frames, but this may increase
+ * the connect latency, so lets not do it for now.
*/
+ /* What the hell is this ? - Jean II */
irlap_send_ua_response_frame(self, &self->qos_rx);
+#endif
/*
* The WD-timer could be set to the duration of the P-timer
@@ -794,8 +795,9 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
irlap_qos_negotiate(self, skb);
+ /* Send UA frame and then change link settings */
+ irlap_apply_connection_parameters(self, FALSE);
irlap_send_ua_response_frame(self, &self->qos_rx);
- irlap_apply_connection_parameters(self);
irlap_next_state(self, LAP_NRM_S);
irlap_connect_confirm(self, skb);
@@ -827,10 +829,19 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
irlap_qos_negotiate(self, skb);
- irlap_apply_connection_parameters(self);
+ /* Set the new link setting *now* (before the rr frame) */
+ irlap_apply_connection_parameters(self, TRUE);
self->retry_count = 0;
- /* This frame will actually force the speed change */
+ /* Wait for turnaround time to give a chance to the other
+ * device to be ready to receive us.
+ * Note : the time to switch speed is typically larger
+ * than the turnaround time, but as we don't have the other
+ * side speed switch time, that's our best guess...
+ * Jean II */
+ irlap_wait_min_turn_around(self, &self->qos_tx);
+
+ /* This frame will actually be sent at the new speed */
irlap_send_rr_frame(self, CMD_FRAME);
irlap_start_final_timer(self, self->final_timeout/2);
@@ -991,7 +1002,8 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
case RECV_UA_RSP: /* FALLTHROUGH */
case RECV_DM_RSP:
del_timer(&self->final_timer);
-
+
+ /* Set new link parameters */
irlap_apply_default_connection_parameters(self);
/* Always switch state before calling upper layers */
@@ -1944,10 +1956,13 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);
+ /* Send disconnect response */
irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_ua_response_frame(self, NULL);
+
del_timer(&self->wd_timer);
irlap_flush_all_queues(self);
+ /* Set default link parameters */
irlap_apply_default_connection_parameters(self);
irlap_disconnect_indication(self, LAP_DISC_INDICATION);
@@ -2000,10 +2015,13 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event,
case RECV_DISC_CMD:
/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);
-
+
+ /* Send disconnect response */
irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_ua_response_frame(self, NULL);
+
del_timer(&self->wd_timer);
+ /* Set default link parameters */
irlap_apply_default_connection_parameters(self);
irlap_disconnect_indication(self, LAP_DISC_INDICATION);
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index fff5bef93..102fb096e 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -60,7 +60,7 @@ static inline void irlap_insert_info(struct irlap_cb *self,
*/
cb->magic = LAP_MAGIC;
cb->mtt = self->mtt_required;
- cb->speed = self->speed;
+ cb->next_speed = self->speed;
/* Reset */
self->mtt_required = 0;
@@ -70,10 +70,13 @@ static inline void irlap_insert_info(struct irlap_cb *self,
* force the negotiated minimum turnaround time
*/
cb->xbofs = self->bofs_count;
+ cb->next_xbofs = self->next_bofs;
cb->xbofs_delay = self->xbofs_delay;
/* Reset XBOF's delay (used only for getting min turn time) */
self->xbofs_delay = 0;
+ /* Put the correct xbofs value for the next packet */
+ self->bofs_count = self->next_bofs;
}
/*
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index 8b4d47caa..29debb1bd 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -24,7 +24,7 @@
********************************************************************/
#include <linux/config.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/string.h>
#include <linux/skbuff.h>
#include <linux/types.h>
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 645815835..f9425f635 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -139,6 +139,15 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
ASSERT(irttp != NULL, return NULL;);
ASSERT(irttp->magic == TTP_MAGIC, return NULL;);
+ /* The IrLMP spec (IrLMP 1.1 p10) says that we have the right to
+ * use only 0x01-0x6F. Of course, we can use LSAP_ANY as well.
+ * JeanII */
+ if((stsap_sel != LSAP_ANY) &&
+ ((stsap_sel < 0x01) || (stsap_sel >= 0x70))) {
+ IRDA_DEBUG(0, __FUNCTION__ "(), invalid tsap!\n");
+ return NULL;
+ }
+
self = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC);
if (self == NULL) {
IRDA_DEBUG(0, __FUNCTION__ "(), unable to kmalloc!\n");
@@ -1564,9 +1573,9 @@ int irttp_proc_read(char *buf, char **start, off_t offset, int len)
self->remote_credit);
len += sprintf(buf+len, "send credit: %d\n",
self->send_credit);
- len += sprintf(buf+len, " tx packets: %d, ",
+ len += sprintf(buf+len, " tx packets: %ld, ",
self->stats.tx_packets);
- len += sprintf(buf+len, "rx packets: %d, ",
+ len += sprintf(buf+len, "rx packets: %ld, ",
self->stats.rx_packets);
len += sprintf(buf+len, "tx_queue len: %d ",
skb_queue_len(&self->tx_queue));
diff --git a/net/irda/qos.c b/net/irda/qos.c
index 997b3e8ff..453140e4e 100644
--- a/net/irda/qos.c
+++ b/net/irda/qos.c
@@ -70,10 +70,6 @@ static int irlap_param_additional_bofs(void *instance, irda_param_t *parm,
int get);
static int irlap_param_min_turn_time(void *instance, irda_param_t *param,
int get);
-static int value_index(__u32 value, __u32 *array, int size);
-static __u32 byte_value(__u8 byte, __u32 *array);
-static __u32 index_value(int index, __u32 *array);
-static int value_lower_bits(__u32 value, __u32 *array, int size, __u16 *field);
__u32 min_turn_times[] = { 10000, 5000, 1000, 500, 100, 50, 10, 0 }; /* us */
__u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000,
@@ -130,6 +126,98 @@ static pi_major_info_t pi_major_call_table[] = {
static pi_param_info_t irlap_param_info = { pi_major_call_table, 2, 0x7f, 7 };
+/* ---------------------- LOCAL SUBROUTINES ---------------------- */
+/* Note : we start with a bunch of local subroutines.
+ * As the compiler is "one pass", this is the only way to get them to
+ * inline properly...
+ * Jean II
+ */
+/*
+ * Function value_index (value, array, size)
+ *
+ * Returns the index to the value in the specified array
+ */
+static inline int value_index(__u32 value, __u32 *array, int size)
+{
+ int i;
+
+ for (i=0; i < size; i++)
+ if (array[i] == value)
+ break;
+ return i;
+}
+
+/*
+ * Function index_value (index, array)
+ *
+ * Returns value to index in array, easy!
+ *
+ */
+static inline __u32 index_value(int index, __u32 *array)
+{
+ return array[index];
+}
+
+/*
+ * Function msb_index (word)
+ *
+ * Returns index to most significant bit (MSB) in word
+ *
+ */
+int msb_index (__u16 word)
+{
+ __u16 msb = 0x8000;
+ int index = 15; /* Current MSB */
+
+ while (msb) {
+ if (word & msb)
+ break; /* Found it! */
+ msb >>=1;
+ index--;
+ }
+ return index;
+}
+
+static inline __u32 byte_value(__u8 byte, __u32 *array)
+{
+ int index;
+
+ ASSERT(array != NULL, return -1;);
+
+ index = msb_index(byte);
+
+ return index_value(index, array);
+}
+
+/*
+ * Function value_lower_bits (value, array)
+ *
+ * Returns a bit field marking all possibility lower than value.
+ * We may need a "value_higher_bits" in the future...
+ */
+static inline int value_lower_bits(__u32 value, __u32 *array, int size, __u16 *field)
+{
+ int i;
+ __u16 mask = 0x1;
+ __u16 result = 0x0;
+
+ for (i=0; i < size; i++) {
+ /* Add the current value to the bit field, shift mask */
+ result |= mask;
+ mask <<= 1;
+ /* Finished ? */
+ if (array[i] >= value)
+ break;
+ }
+ /* Send back a valid index */
+ if(i >= size)
+ i = size - 1; /* Last item */
+ *field = result;
+ return i;
+}
+
+/* -------------------------- MAIN CALLS -------------------------- */
+
/*
* Function irda_qos_compute_intersection (qos, new)
*
@@ -596,99 +684,6 @@ __u32 irlap_requested_line_capacity(struct qos_info *qos)
return line_capacity;
}
-__u32 irlap_min_turn_time_in_bytes(__u32 speed, __u32 min_turn_time)
-{
- __u32 bytes;
-
- bytes = speed * min_turn_time / 10000000;
-
- return bytes;
-}
-
-static __u32 byte_value(__u8 byte, __u32 *array)
-{
- int index;
-
- ASSERT(array != NULL, return -1;);
-
- index = msb_index(byte);
-
- return index_value(index, array);
-}
-
-/*
- * Function msb_index (word)
- *
- * Returns index to most significant bit (MSB) in word
- *
- */
-int msb_index (__u16 word)
-{
- __u16 msb = 0x8000;
- int index = 15; /* Current MSB */
-
- while (msb) {
- if (word & msb)
- break; /* Found it! */
- msb >>=1;
- index--;
- }
- return index;
-}
-
-/*
- * Function value_index (value, array, size)
- *
- * Returns the index to the value in the specified array
- */
-static int value_index(__u32 value, __u32 *array, int size)
-{
- int i;
-
- for (i=0; i < size; i++)
- if (array[i] == value)
- break;
- return i;
-}
-
-/*
- * Function index_value (index, array)
- *
- * Returns value to index in array, easy!
- *
- */
-static __u32 index_value(int index, __u32 *array)
-{
- return array[index];
-}
-
-/*
- * Function value_lower_bits (value, array)
- *
- * Returns a bit field marking all possibility lower than value.
- * We may need a "value_higher_bits" in the future...
- */
-static int value_lower_bits(__u32 value, __u32 *array, int size, __u16 *field)
-{
- int i;
- __u16 mask = 0x1;
- __u16 result = 0x0;
-
- for (i=0; i < size; i++) {
- /* Add the current value to the bit field, shift mask */
- result |= mask;
- mask <<= 1;
- /* Finished ? */
- if (array[i] >= value)
- break;
- }
- /* Send back a valid index */
- if(i >= size)
- i = size - 1; /* Last item */
- *field = result;
- return i;
-}
-
void irda_qos_bits_to_value(struct qos_info *qos)
{
int index;
diff --git a/net/khttpd/misc.c b/net/khttpd/misc.c
index b459b51fe..b5a2f3fd6 100644
--- a/net/khttpd/misc.c
+++ b/net/khttpd/misc.c
@@ -26,7 +26,7 @@ General functions
#include <linux/ctype.h>
#include <linux/errno.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/net.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
diff --git a/net/khttpd/rfc.c b/net/khttpd/rfc.c
index ff5e25451..c2629682a 100644
--- a/net/khttpd/rfc.c
+++ b/net/khttpd/rfc.c
@@ -28,7 +28,7 @@ RFC related functions (headers and stuff)
#include <linux/ctype.h>
#include <linux/errno.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/net.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
diff --git a/net/khttpd/rfc_time.c b/net/khttpd/rfc_time.c
index 8672cce7c..4fd267885 100644
--- a/net/khttpd/rfc_time.c
+++ b/net/khttpd/rfc_time.c
@@ -27,7 +27,7 @@ Functions related to time:
#include <linux/time.h>
#include <linux/kernel.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/ctype.h>
diff --git a/net/khttpd/security.c b/net/khttpd/security.c
index 792abd083..f54e6e960 100644
--- a/net/khttpd/security.c
+++ b/net/khttpd/security.c
@@ -27,7 +27,7 @@ Permissions/Security functions
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/net.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
diff --git a/net/khttpd/sysctl.c b/net/khttpd/sysctl.c
index 244eb76db..4352b92e4 100644
--- a/net/khttpd/sysctl.c
+++ b/net/khttpd/sysctl.c
@@ -25,7 +25,7 @@ Sysctl interface
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/net.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
@@ -259,7 +259,7 @@ void EndSysctl(void)
static int proc_dosecurestring(ctl_table *table, int write, struct file *filp,
void *buffer, size_t *lenp)
{
- int len;
+ size_t len;
char *p, c=0;
char String[256];
diff --git a/net/khttpd/userspace.c b/net/khttpd/userspace.c
index 9c05d4788..9c7843996 100644
--- a/net/khttpd/userspace.c
+++ b/net/khttpd/userspace.c
@@ -35,7 +35,7 @@ Return value:
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/net.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
diff --git a/net/lapb/Makefile b/net/lapb/Makefile
index 10745d904..85b699195 100644
--- a/net/lapb/Makefile
+++ b/net/lapb/Makefile
@@ -17,5 +17,3 @@ obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
-tar:
- tar -cvf /dev/f1 .
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c
index 1723588da..aad566564 100644
--- a/net/lapb/lapb_iface.c
+++ b/net/lapb/lapb_iface.c
@@ -16,7 +16,6 @@
*/
#include <linux/config.h>
-#if defined(CONFIG_LAPB) || defined(CONFIG_LAPB_MODULE)
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/types.h>
@@ -41,7 +40,7 @@
#include <linux/init.h>
#include <net/lapb.h>
-static lapb_cb *volatile lapb_list = NULL;
+static lapb_cb *volatile lapb_list /* = NULL initially */;
/*
* Free an allocated lapb control block. This is done to centralise
@@ -271,7 +270,7 @@ int lapb_connect_request(void *token)
return LAPB_OK;
}
-
+
int lapb_disconnect_request(void *token)
{
lapb_cb *lapb;
@@ -399,18 +398,15 @@ EXPORT_SYMBOL(lapb_disconnect_request);
EXPORT_SYMBOL(lapb_data_request);
EXPORT_SYMBOL(lapb_data_received);
+static const char banner[] __initdata = KERN_INFO "NET4: LAPB for Linux. Version 0.01 for NET4.0\n";
+
static int __init lapb_init(void)
{
- printk(KERN_INFO "NET4: LAPB for Linux. Version 0.01 for NET4.0\n");
+ printk(banner);
return 0;
}
-#ifdef MODULE
MODULE_AUTHOR("Jonathan Naylor <g4klx@g4klx.demon.co.uk>");
MODULE_DESCRIPTION("The X.25 Link Access Procedure B link layer protocol");
-#endif
-
module_init(lapb_init);
-
-#endif
diff --git a/net/lapb/lapb_in.c b/net/lapb/lapb_in.c
index 0b45f57f5..b44e7e19a 100644
--- a/net/lapb/lapb_in.c
+++ b/net/lapb/lapb_in.c
@@ -15,8 +15,6 @@
* 2000-10-29 Henner Eisen lapb_data_indication() return status.
*/
-#include <linux/config.h>
-#if defined(CONFIG_LAPB) || defined(CONFIG_LAPB_MODULE)
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
@@ -641,5 +639,3 @@ void lapb_data_input(lapb_cb *lapb, struct sk_buff *skb)
lapb_kick(lapb);
}
-
-#endif
diff --git a/net/lapb/lapb_out.c b/net/lapb/lapb_out.c
index 8c8b21c10..c3fcc2f52 100644
--- a/net/lapb/lapb_out.c
+++ b/net/lapb/lapb_out.c
@@ -14,8 +14,6 @@
* LAPB 002 Jonathan Naylor New timer architecture.
*/
-#include <linux/config.h>
-#if defined(CONFIG_LAPB) || defined(CONFIG_LAPB_MODULE)
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
@@ -223,5 +221,3 @@ void lapb_check_need_response(lapb_cb *lapb, int type, int pf)
if (type == LAPB_COMMAND && pf)
lapb_enquiry_response(lapb);
}
-
-#endif
diff --git a/net/lapb/lapb_subr.c b/net/lapb/lapb_subr.c
index 611eba6f1..aa701ad21 100644
--- a/net/lapb/lapb_subr.c
+++ b/net/lapb/lapb_subr.c
@@ -13,8 +13,6 @@
* LAPB 001 Jonathan Naylor Started Coding
*/
-#include <linux/config.h>
-#if defined(CONFIG_LAPB) || defined(CONFIG_LAPB_MODULE)
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
@@ -281,5 +279,3 @@ void lapb_transmit_frmr(lapb_cb *lapb)
lapb_transmit_buffer(lapb, skb, LAPB_RESPONSE);
}
-
-#endif
diff --git a/net/lapb/lapb_timer.c b/net/lapb/lapb_timer.c
index 2b6b7dfb8..d65e32e5e 100644
--- a/net/lapb/lapb_timer.c
+++ b/net/lapb/lapb_timer.c
@@ -14,8 +14,6 @@
* LAPB 002 Jonathan Naylor New timer architecture.
*/
-#include <linux/config.h>
-#if defined(CONFIG_LAPB) || defined(CONFIG_LAPB_MODULE)
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
@@ -189,5 +187,3 @@ static void lapb_t1timer_expiry(unsigned long param)
lapb_start_t1timer(lapb);
}
-
-#endif
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a8218d679..f6800ac25 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -29,7 +29,7 @@
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/fs.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <asm/uaccess.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
diff --git a/net/netlink/netlink_dev.c b/net/netlink/netlink_dev.c
index da7598a79..9513cbab9 100644
--- a/net/netlink/netlink_dev.c
+++ b/net/netlink/netlink_dev.c
@@ -20,7 +20,7 @@
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/poll.h>
diff --git a/net/netrom/Makefile b/net/netrom/Makefile
index e44e36144..cf3a8a4b2 100644
--- a/net/netrom/Makefile
+++ b/net/netrom/Makefile
@@ -17,5 +17,3 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_netrom.o
include $(TOPDIR)/Rules.make
-tar:
- tar -cvf /dev/f1 .
diff --git a/net/netsyms.c b/net/netsyms.c
index ebe3bbe81..52b98f4e1 100644
--- a/net/netsyms.c
+++ b/net/netsyms.c
@@ -17,6 +17,7 @@
#include <linux/trdevice.h>
#include <linux/fcdevice.h>
#include <linux/ioport.h>
+#include <linux/tty.h>
#include <net/neighbour.h>
#include <net/snmp.h>
#include <net/dst.h>
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 790a57490..b8ff49ea1 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -62,6 +62,7 @@
#include <linux/timer.h>
#include <asm/system.h>
#include <asm/uaccess.h>
+#include <asm/ioctls.h>
#include <linux/proc_fs.h>
#include <linux/poll.h>
#include <linux/module.h>
diff --git a/net/rose/Makefile b/net/rose/Makefile
index 7799143b0..08da73aed 100644
--- a/net/rose/Makefile
+++ b/net/rose/Makefile
@@ -17,5 +17,3 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_rose.o
include $(TOPDIR)/Rules.make
-tar:
- tar -cvf /dev/f1 .
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 021d7d658..51d638b3a 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -5,6 +5,8 @@
#include <linux/config.h>
#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/errno.h>
#include <linux/skbuff.h>
#include <linux/interrupt.h>
#include <linux/atmdev.h>
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index a66fd2b45..d30d08896 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -6,6 +6,8 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/errno.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h> /* for pkt_sched */
#include <linux/rtnetlink.h>
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index a6af993c8..9cda62023 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -8,7 +8,7 @@
#include <linux/types.h>
#include <linux/sched.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/socket.h>
#include <linux/sunrpc/clnt.h>
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c
index a9e42721a..0e9fddb28 100644
--- a/net/sunrpc/auth_null.c
+++ b/net/sunrpc/auth_null.c
@@ -7,7 +7,7 @@
*/
#include <linux/types.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/utsname.h>
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index 3da9ff392..dae3067b5 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -7,7 +7,7 @@
*/
#include <linux/types.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/sunrpc/clnt.h>
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 92a531fe0..443c456b8 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -25,7 +25,7 @@
#include <linux/types.h>
#include <linux/mm.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/in.h>
#include <linux/utsname.h>
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index b229ee3e1..7e5c082a5 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -14,7 +14,7 @@
#define __KERNEL_SYSCALLS__
#include <linux/sched.h>
#include <linux/interrupt.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/unistd.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 26a140771..53d0ed236 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -28,13 +28,14 @@
#include <linux/udp.h>
#include <linux/version.h>
#include <linux/unistd.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <net/checksum.h>
#include <net/ip.h>
#include <asm/uaccess.h>
+#include <asm/ioctls.h>
#include <linux/sunrpc/types.h>
#include <linux/sunrpc/xdr.h>
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index dfc437522..54f45a19c 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -47,7 +47,7 @@
#include <linux/version.h>
#include <linux/types.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/capability.h>
#include <linux/sched.h>
#include <linux/errno.h>
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 121e4d9de..a2e28fef2 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -8,7 +8,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
- * Version: $Id: af_unix.c,v 1.109 2001/01/06 00:42:23 davem Exp $
+ * Version: $Id: af_unix.c,v 1.111 2001/02/02 11:37:28 davem Exp $
*
* Fixes:
* Linus Torvalds : Assorted bug cures.
@@ -96,7 +96,7 @@
#include <linux/net.h>
#include <linux/in.h>
#include <linux/fs.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <asm/uaccess.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
@@ -1316,9 +1316,12 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
size=len-sent;
/* Keep two messages in the pipe so it schedules better */
- if (size > sk->sndbuf/2 - 16)
- size = sk->sndbuf/2 - 16;
+ if (size > sk->sndbuf/2 - 64)
+ size = sk->sndbuf/2 - 64;
+ if (size > (128 * 1024) / 2)
+ size = (128 * 1024) / 2;
+
/*
* Keep to page sized kmalloc()'s as various people
* have suggested. Big mallocs stress the vm too
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 16d46de54..bc89eef4e 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -71,7 +71,7 @@
#include <linux/un.h>
#include <linux/net.h>
#include <linux/fs.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/file.h>
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 7f12a1f16..26e3f9130 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -41,7 +41,7 @@
#include <linux/errno.h> /* return codes */
#include <linux/kernel.h>
#include <linux/module.h> /* support for loadable modules */
-#include <linux/malloc.h> /* kmalloc(), kfree() */
+#include <linux/slab.h> /* kmalloc(), kfree() */
#include <linux/mm.h> /* verify_area(), etc. */
#include <linux/string.h> /* inline mem*, str* functions */
#include <linux/vmalloc.h> /* vmalloc, vfree */
diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c
index 39d7781d0..84833dd05 100644
--- a/net/wanrouter/wanproc.c
+++ b/net/wanrouter/wanproc.c
@@ -13,6 +13,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* ============================================================================
+* Jan 20, 2001 Arnaldo C.Melo Fix leak on error in router_proc_read, cleanups
* Jun 02, 1999 Gideon Hack Updates for Linux 2.2.X kernels.
* Jun 29, 1997 Alan Cox Merged with 1.0.3 vendor code
* Jan 29, 1997 Gene Kozin v1.0.1. Implemented /proc read routines
@@ -25,7 +26,7 @@
#include <linux/stddef.h> /* offsetof(), etc. */
#include <linux/errno.h> /* return codes */
#include <linux/kernel.h>
-#include <linux/malloc.h> /* kmalloc(), kfree() */
+#include <linux/slab.h> /* kmalloc(), kfree() */
#include <linux/mm.h> /* verify_area(), etc. */
#include <linux/string.h> /* inline mem*, str* functions */
#include <linux/init.h> /* __init et al. */
@@ -43,23 +44,9 @@
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
#endif
-#ifndef max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
#define PROC_BUFSZ 4000 /* buffer size for printing proc info */
-
-/****** Data Types **********************************************************/
-
-typedef struct wan_stat_entry
-{
- struct wan_stat_entry *next;
- char *description; /* description string */
- void *data; /* -> data */
- unsigned data_type; /* data type */
-} wan_stat_entry_t;
-
/****** Function Prototypes *************************************************/
#ifdef CONFIG_PROC_FS
@@ -78,7 +65,7 @@ static int wandev_get_info(char* buf, char** start, off_t offs, int len);
/*
* Structures for interfacing with the /proc filesystem.
- * Router creates its own directory /proc/net/router with the folowing
+ * Router creates its own directory /proc/net/wanrouter with the folowing
* entries:
* config device configuration
* status global device statistics
@@ -86,7 +73,7 @@ static int wandev_get_info(char* buf, char** start, off_t offs, int len);
*/
/*
- * Generic /proc/net/router/<file> file and inode operations
+ * Generic /proc/net/wanrouter/<file> file and inode operations
*/
static struct file_operations router_fops =
{
@@ -99,7 +86,7 @@ static struct inode_operations router_inode =
};
/*
- * /proc/net/router/<device> file operations
+ * /proc/net/wanrouter/<device> file operations
*/
static struct file_operations wandev_fops =
@@ -109,7 +96,7 @@ static struct file_operations wandev_fops =
};
/*
- * /proc/net/router
+ * /proc/net/wanrouter
*/
static struct proc_dir_entry *proc_router;
@@ -251,13 +238,15 @@ static ssize_t router_proc_read(struct file* file, char* buf, size_t count,
offs = file->f_pos;
if (offs < pos) {
len = min(pos - offs, count);
- if(copy_to_user(buf, (page + offs), len))
- return -EFAULT;
+ if(copy_to_user(buf, (page + offs), len)) {
+ len = -EFAULT;
+ goto out;
+ }
file->f_pos += len;
}
else
len = 0;
- kfree(page);
+out: kfree(page);
return len;
}