diff options
Diffstat (limited to 'net')
66 files changed, 262 insertions, 505 deletions
diff --git a/net/802/cl2llc.c b/net/802/cl2llc.c index 8d236b4c4bf1..c8cce10e9935 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 987d8a5c450b..3b6dc3478a9b 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 f0c6d116ee64..924a9cc6081b 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 3e88ee85f0a4..000000000000 --- 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 4d4f6c373126..96b8ee502d4f 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 99e57580a934..e8e2c8f8a9c8 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 b2bd5a624a18..e566554ee27a 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 5dd0494e9e07..0ebd861c4198 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 3791850770a1..5974031f411f 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 b73b4e5f27b2..4a2684ebec93 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 ed5e6fbcecc6..7c1484d6e912 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 c01ae329c564..e6016f93de43 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 8fcfe3fe4a99..928e89cdbac8 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 2857d5c913ec..7aa4af3f503a 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/iovec.c b/net/core/iovec.c index 4ebad506e856..2fe34a20dc9b 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 5275e83b88ec..b248bf8bba1f 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -44,7 +44,7 @@ #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> diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index b930878c2eef..6cca075c00bb 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 0c9fb1f7ff8e..264d6fcb15ef 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 51592202afec..c43892ea55a9 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 6b980e3f34bc..8d668ff41839 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 b7af2b9f6997..8b10997e2166 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 3698eb41d571..fcfb6e6538f4 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> @@ -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/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c index e834d5103343..2967ed241b7c 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 5db8dc8dd4b6..677ea7a371ba 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 d267223ed1b9..8f20486cd5f3 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 6660e0f7292f..a4c6102d1fe8 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 a3f83272b9fc..3ce6b95091c0 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 27815dcb7996..a3e72327bd44 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 3d177c7c90bb..8067f5a18080 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 9931651428c2..bef0e2fcd929 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 e934897ec5ef..1a4c44a39222 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 fb73651bf2a3..38edf6ec864f 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; @@ -2407,8 +2410,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 +2426,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 +2440,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 +2489,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 f0d2cbb0d188..d83ddaab8c96 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/irlap.c b/net/irda/irlap.c index f66847b820e7..b815f9f3a0cb 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> diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 8b4d47caa553..29debb1bd840 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/khttpd/misc.c b/net/khttpd/misc.c index b459b51fe13b..b5a2f3fd6671 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 ff5e2545115d..c2629682ac6f 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 8672cce7c4b9..4fd267885ee2 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 792abd083d56..f54e6e96092a 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 244eb76db353..4352b92e4ea6 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 9c05d4788308..9c784399648c 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 10745d9048fb..85b699195804 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 1723588da48d..aad566564000 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 0b45f57f597c..b44e7e19ae3e 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 8c8b21c10ba7..c3fcc2f52d01 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 611eba6f18a2..aa701ad2148f 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 2b6b7dfb89da..d65e32e5e1cb 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 a8218d679558..f6800ac257c6 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 da7598a79654..9513cbab9924 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 e44e36144fe6..cf3a8a4b2138 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 ebe3bbe81ebc..52b98f4e1a8c 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 790a5749003a..b8ff49ea10bb 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 7799143b04ed..08da73aed76b 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 021d7d658ca9..51d638b3a8cc 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 a66fd2b45761..d30d08896ab2 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 a6af993c882d..9cda62023cf0 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 a9e42721a2c5..0e9fddb2807b 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 3da9ff39227f..dae3067b55f2 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 92a531fe09b2..443c456b80d4 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 b229ee3e1018..7e5c082a5c4a 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 26a1407719a0..53d0ed236e78 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 dfc437522791..54f45a19c02b 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 121e4d9de05c..a2e28fef263f 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 16d46de54386..bc89eef4ec52 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 7f12a1f16539..26e3f913064c 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 39d7781d057b..84833dd055dc 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; } |
