From b2ad5f821b1381492d792ca10b1eb7a107b48f14 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 10 Jan 2001 17:17:53 +0000 Subject: Merge with Linux 2.4.0-prerelease. Big Makefile rewrite, test your Makefiles. --- net/802/Makefile | 25 +-- net/802/transit/Makefile | 4 +- net/Makefile | 15 -- net/appletalk/Makefile | 11 +- net/atm/Makefile | 40 ++--- net/atm/addr.c | 4 +- net/atm/common.c | 379 +++++++++++++++++++++++++++++++----------- net/atm/lec.c | 7 +- net/atm/proc.c | 2 +- net/atm/resources.c | 7 + net/atm/signaling.c | 4 + net/ax25/Makefile | 19 +-- net/ax25/af_ax25.c | 15 +- net/ax25/ax25_addr.c | 3 - net/ax25/ax25_dev.c | 24 +-- net/ax25/ax25_ds_in.c | 3 - net/ax25/ax25_ds_subr.c | 3 - net/ax25/ax25_ds_timer.c | 4 - net/ax25/ax25_iface.c | 8 +- net/ax25/ax25_in.c | 2 - net/ax25/ax25_ip.c | 2 - net/ax25/ax25_out.c | 2 - net/ax25/ax25_route.c | 13 +- net/ax25/ax25_std_in.c | 4 - net/ax25/ax25_std_subr.c | 4 - net/ax25/ax25_std_timer.c | 4 - net/ax25/ax25_subr.c | 4 - net/ax25/ax25_timer.c | 3 - net/ax25/ax25_uid.c | 12 +- net/bridge/Makefile | 4 +- net/bridge/br_input.c | 6 +- net/core/Makefile | 30 +--- net/core/skbuff.c | 15 +- net/core/sock.c | 23 +-- net/decnet/Makefile | 15 +- net/econet/Makefile | 4 +- net/ethernet/Makefile | 4 +- net/ipv4/Makefile | 56 ++----- net/ipv4/af_inet.c | 8 +- net/ipv4/ip_fragment.c | 4 +- net/ipv4/ipconfig.c | 2 +- net/ipv4/netfilter/Makefile | 289 ++++++++------------------------ net/ipv4/tcp_input.c | 118 ++++++++----- net/ipv4/udp.c | 20 +-- net/ipv6/Makefile | 11 +- net/ipv6/netfilter/Makefile | 173 +------------------ net/ipx/Makefile | 21 +-- net/irda/Makefile | 61 ++----- net/irda/compressors/Makefile | 13 +- net/irda/ircomm/Makefile | 26 +-- net/irda/irlan/Makefile | 9 +- net/irda/irnet/Makefile | 10 +- net/khttpd/Makefile | 6 +- net/lapb/Makefile | 7 +- net/netlink/Makefile | 13 +- net/netrom/Makefile | 9 +- net/netrom/af_netrom.c | 17 +- net/netrom/nr_dev.c | 3 - net/netrom/nr_in.c | 4 - net/netrom/nr_loopback.c | 11 +- net/netrom/nr_out.c | 4 - net/netrom/nr_route.c | 15 +- net/netrom/nr_subr.c | 4 - net/netrom/nr_timer.c | 4 - net/packet/Makefile | 11 +- net/rose/Makefile | 9 +- net/rose/af_rose.c | 11 +- net/rose/rose_dev.c | 3 - net/rose/rose_in.c | 4 - net/rose/rose_link.c | 4 - net/rose/rose_loopback.c | 11 +- net/rose/rose_out.c | 4 - net/rose/rose_route.c | 19 +-- net/rose/rose_subr.c | 4 - net/rose/rose_timer.c | 4 - net/sched/Makefile | 84 +++++----- net/sunrpc/Makefile | 19 +-- net/unix/Makefile | 9 +- net/wanrouter/Makefile | 8 +- net/x25/Makefile | 9 +- net/x25/af_x25.c | 10 +- 81 files changed, 714 insertions(+), 1155 deletions(-) (limited to 'net') diff --git a/net/802/Makefile b/net/802/Makefile index 66f8af658..03e484b50 100644 --- a/net/802/Makefile +++ b/net/802/Makefile @@ -8,34 +8,38 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := 802.o -O_OBJS = p8023.o +export-objs = llc_macinit.o p8022.o psnap.o + +obj-y = p8023.o + +obj-$(CONFIG_SYSCTL) += sysctl_net_802.o +obj-$(CONFIG_LLC) += llc_sendpdu.o llc_utility.o cl2llc.o llc_macinit.o ifeq ($(CONFIG_SYSCTL),y) -O_OBJS += sysctl_net_802.o +obj-y += sysctl_net_802.o endif ifeq ($(CONFIG_LLC),y) -SUB_DIRS += transit -O_OBJS += llc_sendpdu.o llc_utility.o cl2llc.o -OX_OBJS += llc_macinit.o +subdir-y += transit +obj-y += llc_sendpdu.o llc_utility.o cl2llc.o llc_macinit.o SNAP = y endif ifdef CONFIG_TR -O_OBJS += tr.o +obj-y += tr.o SNAP=y endif ifdef CONFIG_NET_FC -O_OBJS += fc.o +obj-y += fc.o endif ifdef CONFIG_FDDI -O_OBJS += fddi.o +obj-y += fddi.o endif ifdef CONFIG_HIPPI -O_OBJS += hippi.o +obj-y += hippi.o endif ifdef CONFIG_IPX @@ -47,10 +51,9 @@ ifdef CONFIG_ATALK endif ifeq ($(SNAP),y) -OX_OBJS += p8022.o psnap.o +obj-y += p8022.o psnap.o endif - include $(TOPDIR)/Rules.make cl2llc.c: cl2llc.pre diff --git a/net/802/transit/Makefile b/net/802/transit/Makefile index d2e2e5de4..249369703 100644 --- a/net/802/transit/Makefile +++ b/net/802/transit/Makefile @@ -1,3 +1,5 @@ +include $(TOPDIR)/Rules.make + all: pdutr.h timertr.h pdutr.h: pdutr.pre compile.awk @@ -9,5 +11,3 @@ timertr.h: timertr.pre compile.awk clean: touch pdutr.h timertr.h rm pdutr.h timertr.h - - diff --git a/net/Makefile b/net/Makefile index ddfdab2a5..38c663226 100644 --- a/net/Makefile +++ b/net/Makefile @@ -52,19 +52,4 @@ obj-$(CONFIG_MODULES) += netsyms.o obj-$(CONFIG_SYSCTL) += sysctl_net.o endif - -# Subdirectories that should be entered when MAKING_MODULES=1, even if set to 'y'. -both-m := $(filter $(mod-subdirs), $(subdir-y)) - -# Translate to Rules.make lists. -O_OBJS := $(filter-out $(export-objs), $(obj-y)) -OX_OBJS := $(filter $(export-objs), $(obj-y)) -M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) -MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) - -SUB_DIRS := $(subdir-y) -MOD_SUB_DIRS := $(sort $(subdir-m) $(both-m)) -ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-)) - - include $(TOPDIR)/Rules.make diff --git a/net/appletalk/Makefile b/net/appletalk/Makefile index 4adbc858c..99e57580a 100644 --- a/net/appletalk/Makefile +++ b/net/appletalk/Makefile @@ -8,14 +8,13 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := appletalk.o -O_OBJS := aarp.o -M_OBJS := $(O_TARGET) -OX_OBJS += ddp.o +export-objs = ddp.o -ifeq ($(CONFIG_SYSCTL),y) -O_OBJS += sysctl_net_atalk.o -endif +obj-y := aarp.o ddp.o +obj-m := $(O_TARGET) + +obj-$(CONFIG_SYSCTL) += sysctl_net_atalk.o include $(TOPDIR)/Rules.make diff --git a/net/atm/Makefile b/net/atm/Makefile index c21cdcad1..40d63cc87 100644 --- a/net/atm/Makefile +++ b/net/atm/Makefile @@ -11,13 +11,15 @@ include ../../.config O_TARGET= atm.o -ifeq ($(CONFIG_ATM),y) +export-objs = common.o atm_misc.o raw.o resources.o ipcommon.o proc.o lane_mpoa_init.o -O_OBJS = addr.o pvc.o signaling.o svc.o -OX_OBJS = common.o atm_misc.o raw.o resources.o +multi-list = mpoa.o +mpoa-objs = mpc.o mpoa_caches.o mpoa_proc.o + +obj-$(CONFIG_ATM) = addr.o pvc.o signaling.o svc.o common.o atm_misc.o raw.o resources.o ifeq ($(CONFIG_ATM_CLIP),y) -O_OBJS += clip.o +obj-y += clip.o NEED_IPCOM = ipcommon.o endif @@ -25,34 +27,16 @@ ifeq ($(CONFIG_NET_SCH_ATM),y) NEED_IPCOM = ipcommon.o endif -OX_OBJS += $(NEED_IPCOM) +obj-y += $(NEED_IPCOM) ifeq ($(CONFIG_PROC_FS),y) -OX_OBJS += proc.o -endif - -ifeq ($(CONFIG_ATM_LANE),y) -O_OBJS += lec.o -OX_OBJS += lane_mpoa_init.o -else - ifeq ($(CONFIG_ATM_LANE),m) - OX_OBJS += lane_mpoa_init.o - M_OBJS += lec.o - endif -endif - -ifeq ($(CONFIG_ATM_MPOA),y) -O_OBJS += mpc.o mpoa_caches.o mpoa_proc.o -else - ifeq ($(CONFIG_ATM_MPOA),m) - M_OBJS += mpoa.o - endif -endif - +obj-y += proc.o endif +obj-$(CONFIG_ATM_LANE) += lec.o lane_mpoa_init.o +obj-$(CONFIG_ATM_MPOA) += mpoa.o include $(TOPDIR)/Rules.make -mpoa.o: mpc.o mpoa_caches.o mpoa_proc.o - $(LD) -r -o mpoa.o mpc.o mpoa_caches.o mpoa_proc.o +mpoa.o: $(mpoa-objs) + $(LD) -r -o mpoa.o $(mpoa-objs) diff --git a/net/atm/addr.c b/net/atm/addr.c index 8bca9d1c3..1814a8b21 100644 --- a/net/atm/addr.c +++ b/net/atm/addr.c @@ -42,7 +42,7 @@ static int identical(struct sockaddr_atmsvc *a,struct sockaddr_atmsvc *b) */ static DECLARE_MUTEX(local_lock); - +extern spinlock_t atm_dev_lock; static void notify_sigd(struct atm_dev *dev) { @@ -58,12 +58,14 @@ void reset_addr(struct atm_dev *dev) struct atm_dev_addr *this; down(&local_lock); + spin_lock (&atm_dev_lock); while (dev->local) { this = dev->local; dev->local = this->next; kfree(this); } up(&local_lock); + spin_unlock (&atm_dev_lock); notify_sigd(dev); } diff --git a/net/atm/common.c b/net/atm/common.c index 16a6fb6b4..ea0ad690a 100644 --- a/net/atm/common.c +++ b/net/atm/common.c @@ -72,6 +72,7 @@ EXPORT_SYMBOL(atm_tcp_ops); #define DPRINTK(format,args...) #endif +spinlock_t atm_dev_lock = SPIN_LOCK_UNLOCKED; static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size) { @@ -139,13 +140,19 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk) vcc->dev->ops->free_rx_skb(vcc,skb); else kfree_skb(skb); } + spin_lock (&atm_dev_lock); + fops_put (vcc->dev->ops); if (atomic_read(&vcc->rx_inuse)) printk(KERN_WARNING "atm_release_vcc: strange ... " "rx_inuse == %d after closing\n", atomic_read(&vcc->rx_inuse)); bind_vcc(vcc,NULL); - } + } else + spin_lock (&atm_dev_lock); + if (free_sk) free_atm_vcc_sk(sk); + + spin_unlock (&atm_dev_lock); } @@ -238,9 +245,11 @@ static int atm_do_connect_dev(struct atm_vcc *vcc,struct atm_dev *dev,int vpi, vcc->qos.txtp.min_pcr,vcc->qos.txtp.max_pcr,vcc->qos.txtp.max_sdu); DPRINTK(" RX: %d, PCR %d..%d, SDU %d\n",vcc->qos.rxtp.traffic_class, vcc->qos.rxtp.min_pcr,vcc->qos.rxtp.max_pcr,vcc->qos.rxtp.max_sdu); + fops_get (dev->ops); if (dev->ops->open) { error = dev->ops->open(vcc,vpi,vci); if (error) { + fops_put (dev->ops); bind_vcc(vcc,NULL); return error; } @@ -252,10 +261,18 @@ static int atm_do_connect_dev(struct atm_vcc *vcc,struct atm_dev *dev,int vpi, static int atm_do_connect(struct atm_vcc *vcc,int itf,int vpi,int vci) { struct atm_dev *dev; + int return_val; + spin_lock (&atm_dev_lock); dev = atm_find_dev(itf); - if (!dev) return -ENODEV; - return atm_do_connect_dev(vcc,dev,vpi,vci); + if (!dev) + return_val = -ENODEV; + else + return_val = atm_do_connect_dev(vcc,dev,vpi,vci); + + spin_unlock (&atm_dev_lock); + + return return_val; } @@ -285,8 +302,10 @@ int atm_connect_vcc(struct atm_vcc *vcc,int itf,short vpi,int vci) else { struct atm_dev *dev; + spin_lock (&atm_dev_lock); for (dev = atm_devs; dev; dev = dev->next) if (!atm_do_connect_dev(vcc,dev,vpi,vci)) break; + spin_unlock (&atm_dev_lock); if (!dev) return -ENODEV; } if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC) @@ -523,57 +542,86 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) struct atm_vcc *vcc; int *tmp_buf; void *buf; - int error,len,size,number; + int error,len,size,number, ret_val; + ret_val = 0; + spin_lock (&atm_dev_lock); vcc = ATM_SD(sock); switch (cmd) { case SIOCOUTQ: if (sock->state != SS_CONNECTED || - !test_bit(ATM_VF_READY,&vcc->flags)) - return -EINVAL; - return put_user(vcc->sk->sndbuf- + !test_bit(ATM_VF_READY,&vcc->flags)) { + ret_val = -EINVAL; + goto done; + } + ret_val = put_user(vcc->sk->sndbuf- atomic_read(&vcc->tx_inuse)-ATM_PDU_OVHD, (int *) arg) ? -EFAULT : 0; + goto done; case SIOCINQ: { struct sk_buff *skb; - if (sock->state != SS_CONNECTED) - return -EINVAL; + if (sock->state != SS_CONNECTED) { + ret_val = -EINVAL; + goto done; + } skb = skb_peek(&vcc->recvq); - return put_user(skb ? skb->len : 0,(int *) arg) + ret_val = put_user(skb ? skb->len : 0,(int *) arg) ? -EFAULT : 0; + goto done; } case ATM_GETNAMES: if (get_user(buf, - &((struct atm_iobuf *) arg)->buffer)) - return -EFAULT; + &((struct atm_iobuf *) arg)->buffer)) { + ret_val = -EFAULT; + goto done; + } if (get_user(len, - &((struct atm_iobuf *) arg)->length)) - return -EFAULT; + &((struct atm_iobuf *) arg)->length)) { + ret_val = -EFAULT; + goto done; + } size = 0; for (dev = atm_devs; dev; dev = dev->next) size += sizeof(int); - if (size > len) return -E2BIG; + if (size > len) { + ret_val = -E2BIG; + goto done; + } tmp_buf = kmalloc(size,GFP_KERNEL); - if (!tmp_buf) return -ENOMEM; + if (!tmp_buf) { + ret_val = -ENOMEM; + goto done; + } for (dev = atm_devs; dev; dev = dev->next) *tmp_buf++ = dev->number; - if (copy_to_user(buf,(char *) tmp_buf-size,size)) - return -EFAULT; - return put_user(size, + if (copy_to_user(buf,(char *) tmp_buf-size,size)) { + ret_val = -EFAULT; + goto done; + } + ret_val = put_user(size, &((struct atm_iobuf *) arg)->length) ? -EFAULT : 0; + goto done; case SIOCGSTAMP: /* borrowed from IP */ - if (!vcc->timestamp.tv_sec) return -ENOENT; + if (!vcc->timestamp.tv_sec) { + ret_val = -ENOENT; + goto done; + } vcc->timestamp.tv_sec += vcc->timestamp.tv_usec/1000000; vcc->timestamp.tv_usec %= 1000000; - return copy_to_user((void *) arg,&vcc->timestamp, + ret_val = copy_to_user((void *) arg,&vcc->timestamp, sizeof(struct timeval)) ? -EFAULT : 0; + goto done; case ATM_SETSC: printk(KERN_WARNING "ATM_SETSC is obsolete\n"); - return 0; + ret_val = 0; + goto done; case ATMSIGD_CTRL: - if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } /* * The user/kernel protocol for exchanging signalling * info uses kernel pointers as opaque references, @@ -581,175 +629,308 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) * on the kernel... so we should make sure that we * have the same privledges that /proc/kcore needs */ - if (!capable(CAP_SYS_RAWIO)) return -EPERM; + if (!capable(CAP_SYS_RAWIO)) { + ret_val = -EPERM; + goto done; + } error = sigd_attach(vcc); if (!error) sock->state = SS_CONNECTED; - return error; + ret_val = error; + goto done; #ifdef CONFIG_ATM_CLIP case SIOCMKCLIP: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - return clip_create(arg); + if (!capable(CAP_NET_ADMIN)) + ret_val = -EPERM; + else + ret_val = clip_create(arg); + goto done; case ATMARPD_CTRL: - if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } error = atm_init_atmarp(vcc); if (!error) sock->state = SS_CONNECTED; - return error; + ret_val = error; + goto done; case ATMARP_MKIP: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - return clip_mkip(vcc,arg); + if (!capable(CAP_NET_ADMIN)) + ret_val = -EPERM; + else + ret_val = clip_mkip(vcc,arg); + goto done; case ATMARP_SETENTRY: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - return clip_setentry(vcc,arg); + if (!capable(CAP_NET_ADMIN)) + ret_val = -EPERM; + else + ret_val = clip_setentry(vcc,arg); + goto done; case ATMARP_ENCAP: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - return clip_encap(vcc,arg); + if (!capable(CAP_NET_ADMIN)) + ret_val = -EPERM; + else + ret_val = clip_encap(vcc,arg); + goto done; #endif #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) case ATMLEC_CTRL: - if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } if (atm_lane_ops.lecd_attach == NULL) atm_lane_init(); - if (atm_lane_ops.lecd_attach == NULL) /* try again */ - return -ENOSYS; - error = atm_lane_ops.lecd_attach(vcc, (int)arg); - if (error >= 0) sock->state = SS_CONNECTED; - return error; + if (atm_lane_ops.lecd_attach == NULL) { /* try again */ + ret_val = -ENOSYS; + goto done; + } + error = atm_lane_ops.lecd_attach(vcc, (int)arg); + if (error >= 0) sock->state = SS_CONNECTED; + ret_val = error; + goto done; case ATMLEC_MCAST: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - return atm_lane_ops.mcast_attach(vcc, (int)arg); + if (!capable(CAP_NET_ADMIN)) + ret_val = -EPERM; + else + ret_val = atm_lane_ops.mcast_attach(vcc, (int)arg); + goto done; case ATMLEC_DATA: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - return atm_lane_ops.vcc_attach(vcc, (void*)arg); + if (!capable(CAP_NET_ADMIN)) + ret_val = -EPERM; + else + ret_val = atm_lane_ops.vcc_attach(vcc, (void*)arg); + goto done; #endif #if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE) case ATMMPC_CTRL: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (atm_mpoa_ops.mpoad_attach == NULL) + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } + if (atm_mpoa_ops.mpoad_attach == NULL) atm_mpoa_init(); - if (atm_mpoa_ops.mpoad_attach == NULL) /* try again */ - return -ENOSYS; - error = atm_mpoa_ops.mpoad_attach(vcc, (int)arg); - if (error >= 0) sock->state = SS_CONNECTED; - return error; + if (atm_mpoa_ops.mpoad_attach == NULL) { /* try again */ + ret_val = -ENOSYS; + goto done; + } + error = atm_mpoa_ops.mpoad_attach(vcc, (int)arg); + if (error >= 0) sock->state = SS_CONNECTED; + ret_val = error; + goto done; case ATMMPC_DATA: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - return atm_mpoa_ops.vcc_attach(vcc, arg); + if (!capable(CAP_NET_ADMIN)) + ret_val = -EPERM; + else + ret_val = atm_mpoa_ops.vcc_attach(vcc, arg); + goto done; #endif #if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE) case SIOCSIFATMTCP: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (!atm_tcp_ops.attach) return -ENOPKG; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } + if (!atm_tcp_ops.attach) { + ret_val = -ENOPKG; + goto done; + } + fops_get (&atm_tcp_ops); error = atm_tcp_ops.attach(vcc,(int) arg); if (error >= 0) sock->state = SS_CONNECTED; - return error; + else fops_put (&atm_tcp_ops); + ret_val = error; + goto done; case ATMTCP_CREATE: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (!atm_tcp_ops.create_persistent) return -ENOPKG; - return atm_tcp_ops.create_persistent((int) arg); + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } + if (!atm_tcp_ops.create_persistent) { + ret_val = -ENOPKG; + goto done; + } + error = atm_tcp_ops.create_persistent((int) arg); + if (error < 0) fops_put (&atm_tcp_ops); + ret_val = error; + goto done; case ATMTCP_REMOVE: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (!atm_tcp_ops.remove_persistent) return -ENOPKG; - return atm_tcp_ops.remove_persistent((int) arg); + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } + if (!atm_tcp_ops.remove_persistent) { + ret_val = -ENOPKG; + goto done; + } + error = atm_tcp_ops.remove_persistent((int) arg); + fops_put (&atm_tcp_ops); + ret_val = error; + goto done; #endif default: break; } - if (get_user(buf,&((struct atmif_sioc *) arg)->arg)) return -EFAULT; - if (get_user(len,&((struct atmif_sioc *) arg)->length)) return -EFAULT; - if (get_user(number,&((struct atmif_sioc *) arg)->number)) - return -EFAULT; - if (!(dev = atm_find_dev(number))) return -ENODEV; + if (get_user(buf,&((struct atmif_sioc *) arg)->arg)) { + ret_val = -EFAULT; + goto done; + } + if (get_user(len,&((struct atmif_sioc *) arg)->length)) { + ret_val = -EFAULT; + goto done; + } + if (get_user(number,&((struct atmif_sioc *) arg)->number)) { + ret_val = -EFAULT; + goto done; + } + if (!(dev = atm_find_dev(number))) { + ret_val = -ENODEV; + goto done; + } + size = 0; switch (cmd) { case ATM_GETTYPE: size = strlen(dev->type)+1; - if (copy_to_user(buf,dev->type,size)) return -EFAULT; + if (copy_to_user(buf,dev->type,size)) { + ret_val = -EFAULT; + goto done; + } break; case ATM_GETESI: size = ESI_LEN; - if (copy_to_user(buf,dev->esi,size)) return -EFAULT; + if (copy_to_user(buf,dev->esi,size)) { + ret_val = -EFAULT; + goto done; + } break; case ATM_SETESI: { int i; for (i = 0; i < ESI_LEN; i++) - if (dev->esi[i]) return -EEXIST; + if (dev->esi[i]) { + ret_val = -EEXIST; + goto done; + } } /* fall through */ case ATM_SETESIF: { unsigned char esi[ESI_LEN]; - if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(esi,buf,ESI_LEN)) - return -EFAULT; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } + if (copy_from_user(esi,buf,ESI_LEN)) { + ret_val = -EFAULT; + goto done; + } memcpy(dev->esi,esi,ESI_LEN); - return ESI_LEN; + ret_val = ESI_LEN; + goto done; } case ATM_GETSTATZ: - if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } /* fall through */ case ATM_GETSTAT: size = sizeof(struct atm_dev_stats); error = fetch_stats(dev,buf,cmd == ATM_GETSTATZ); - if (error) return error; + if (error) { + ret_val = error; + goto done; + } break; case ATM_GETCIRANGE: size = sizeof(struct atm_cirange); - if (copy_to_user(buf,&dev->ci_range,size)) - return -EFAULT; + if (copy_to_user(buf,&dev->ci_range,size)) { + ret_val = -EFAULT; + goto done; + } break; case ATM_GETLINKRATE: size = sizeof(int); - if (copy_to_user(buf,&dev->link_rate,size)) - return -EFAULT; + if (copy_to_user(buf,&dev->link_rate,size)) { + ret_val = -EFAULT; + goto done; + } break; case ATM_RSTADDR: - if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } reset_addr(dev); break; case ATM_ADDADDR: case ATM_DELADDR: - if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } { struct sockaddr_atmsvc addr; - if (copy_from_user(&addr,buf,sizeof(addr))) - return -EFAULT; + if (copy_from_user(&addr,buf,sizeof(addr))) { + ret_val = -EFAULT; + goto done; + } if (cmd == ATM_ADDADDR) - return add_addr(dev,&addr); - else return del_addr(dev,&addr); + ret_val = add_addr(dev,&addr); + else + ret_val = del_addr(dev,&addr); + goto done; } case ATM_GETADDR: size = get_addr(dev,buf,len); - if (size < 0) return size; + if (size < 0) + ret_val = size; + else /* may return 0, but later on size == 0 means "don't write the length" */ - return put_user(size, - &((struct atmif_sioc *) arg)->length) ? -EFAULT : 0; + ret_val = put_user(size, + &((struct atmif_sioc *) arg)->length) ? -EFAULT : 0; + goto done; case ATM_SETLOOP: if (__ATM_LM_XTRMT((int) (long) buf) && __ATM_LM_XTLOC((int) (long) buf) > - __ATM_LM_XTRMT((int) (long) buf)) - return -EINVAL; + __ATM_LM_XTRMT((int) (long) buf)) { + ret_val = -EINVAL; + goto done; + } /* fall through */ case ATM_SETCIRANGE: case SONET_GETSTATZ: case SONET_SETDIAG: case SONET_CLRDIAG: case SONET_SETFRAMING: - if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (!capable(CAP_NET_ADMIN)) { + ret_val = -EPERM; + goto done; + } /* fall through */ default: - if (!dev->ops->ioctl) return -EINVAL; + if (!dev->ops->ioctl) { + ret_val = -EINVAL; + goto done; + } size = dev->ops->ioctl(dev,cmd,buf); - if (size < 0) - return size == -ENOIOCTLCMD ? -EINVAL : size; + if (size < 0) { + ret_val = (size == -ENOIOCTLCMD ? -EINVAL : size); + goto done; + } } - if (!size) return 0; - return put_user(size,&((struct atmif_sioc *) arg)->length) ? - -EFAULT : 0; + + if (size) + ret_val = put_user(size,&((struct atmif_sioc *) arg)->length) ? + -EFAULT : 0; + + done: + spin_unlock (&atm_dev_lock); + return ret_val; } diff --git a/net/atm/lec.c b/net/atm/lec.c index d9921b408..035058033 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c @@ -857,12 +857,7 @@ void cleanup_module(void) for (i = 0; i < MAX_LEC_ITF; i++) { if (dev_lec[i] != NULL) { priv = (struct lec_priv *)dev_lec[i]->priv; - if (priv->is_trdev) { -#ifdef CONFIG_TR - unregister_trdev(dev_lec[i]); -#endif - } else - unregister_netdev(dev_lec[i]); + unregister_trdev(dev_lec[i]); kfree(dev_lec[i]); dev_lec[i] = NULL; } diff --git a/net/atm/proc.c b/net/atm/proc.c index e8d3170be..ef0091735 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c @@ -220,7 +220,7 @@ static void vc_info(struct atm_vcc *vcc,char *buf) default: here += sprintf(here,"%3d",vcc->family); } - here += sprintf(here," %04x %5ld %7d/%7d %7d/%7d\n",vcc->flags.bits, + here += sprintf(here," %04lx %5d %7d/%7d %7d/%7d\n",vcc->flags.bits, vcc->reply, atomic_read(&vcc->tx_inuse),vcc->sk->sndbuf, atomic_read(&vcc->rx_inuse),vcc->sk->rcvbuf); diff --git a/net/atm/resources.c b/net/atm/resources.c index 9502367ef..910afff61 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c @@ -25,6 +25,7 @@ struct atm_dev *atm_devs = NULL; static struct atm_dev *last_dev = NULL; struct atm_vcc *nodev_vccs = NULL; +extern spinlock_t atm_dev_lock; static struct atm_dev *alloc_atm_dev(const char *type) @@ -48,11 +49,15 @@ static struct atm_dev *alloc_atm_dev(const char *type) static void free_atm_dev(struct atm_dev *dev) { + spin_lock (&atm_dev_lock); + if (dev->prev) dev->prev->next = dev->next; else atm_devs = dev->next; if (dev->next) dev->next->prev = dev->prev; else last_dev = dev->prev; kfree(dev); + + spin_unlock (&atm_dev_lock); } @@ -100,10 +105,12 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, if (atm_proc_dev_register(dev) < 0) { printk(KERN_ERR "atm_dev_register: " "atm_proc_dev_register failed for dev %s\n",type); + spin_unlock (&atm_dev_lock); free_atm_dev(dev); return NULL; } #endif + spin_unlock (&atm_dev_lock); return dev; } diff --git a/net/atm/signaling.c b/net/atm/signaling.c index 0b3d64941..fab17e7c6 100644 --- a/net/atm/signaling.c +++ b/net/atm/signaling.c @@ -33,6 +33,7 @@ struct atm_vcc *sigd = NULL; static DECLARE_WAIT_QUEUE_HEAD(sigd_sleep); +extern spinlock_t atm_dev_lock; static void sigd_put_skb(struct sk_buff *skb) { @@ -219,7 +220,10 @@ static void sigd_close(struct atm_vcc *vcc) printk(KERN_ERR "sigd_close: closing with requests pending\n"); while ((skb = skb_dequeue(&vcc->recvq))) kfree_skb(skb); purge_vccs(nodev_vccs); + + spin_lock (&atm_dev_lock); for (dev = atm_devs; dev; dev = dev->next) purge_vccs(dev->vccs); + spin_unlock (&atm_dev_lock); } diff --git a/net/ax25/Makefile b/net/ax25/Makefile index b89b517c7..379185077 100644 --- a/net/ax25/Makefile +++ b/net/ax25/Makefile @@ -9,20 +9,17 @@ O_TARGET := ax25.o -O_OBJS := ax25_addr.o ax25_dev.o ax25_iface.o ax25_in.o ax25_ip.o ax25_out.o \ - ax25_route.o ax25_std_in.o ax25_std_subr.o ax25_std_timer.o \ - ax25_subr.o ax25_timer.o ax25_uid.o -M_OBJS := $(O_TARGET) -OX_OBJS += af_ax25.o +export-objs := af_ax25.o + +obj-y := ax25_addr.o ax25_dev.o ax25_iface.o ax25_in.o ax25_ip.o ax25_out.o \ + ax25_route.o ax25_std_in.o ax25_std_subr.o ax25_std_timer.o \ + ax25_subr.o ax25_timer.o ax25_uid.o af_ax25.o -ifeq ($(CONFIG_AX25_DAMA_SLAVE),y) -O_OBJS += ax25_ds_in.o ax25_ds_subr.o ax25_ds_timer.o -endif +obj-m := $(O_TARGET) -ifeq ($(CONFIG_SYSCTL),y) -O_OBJS += sysctl_net_ax25.o -endif +obj-$(CONFIG_AX25_DAMA_SLAVE) += ax25_ds_in.o ax25_ds_subr.o ax25_ds_timer.o +obj-$(CONFIG_SYSCTL) += sysctl_net_ax25.o include $(TOPDIR)/Rules.make diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 8e34e42e2..b73b4e5f2 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -105,7 +105,6 @@ */ #include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -140,7 +139,7 @@ -ax25_cb *volatile ax25_list = NULL; +ax25_cb *volatile ax25_list; static struct proto_ops ax25_proto_ops; @@ -1853,15 +1852,11 @@ static int __init ax25_init(void) ax25_packet_type.type = htons(ETH_P_AX25); dev_add_pack(&ax25_packet_type); register_netdevice_notifier(&ax25_dev_notifier); -#ifdef CONFIG_SYSCTL ax25_register_sysctl(); -#endif -#ifdef CONFIG_PROC_FS proc_net_create("ax25_route", 0, ax25_rt_get_info); proc_net_create("ax25", 0, ax25_get_info); proc_net_create("ax25_calls", 0, ax25_uid_get_info); -#endif printk(KERN_INFO "NET4: G4KLX/GW4PTS AX.25 for Linux. Version 0.37 for Linux NET4.0\n"); return 0; @@ -1869,24 +1864,19 @@ static int __init ax25_init(void) module_init(ax25_init); -#ifdef MODULE MODULE_AUTHOR("Jonathan Naylor G4KLX "); MODULE_DESCRIPTION("The amateur radio AX.25 link layer protocol"); static void __exit ax25_exit(void) { -#ifdef CONFIG_PROC_FS proc_net_remove("ax25_route"); proc_net_remove("ax25"); proc_net_remove("ax25_calls"); -#endif ax25_rt_free(); ax25_uid_free(); ax25_dev_free(); -#ifdef CONFIG_SYSCTL ax25_unregister_sysctl(); -#endif unregister_netdevice_notifier(&ax25_dev_notifier); ax25_packet_type.type = htons(ETH_P_AX25); @@ -1895,6 +1885,3 @@ static void __exit ax25_exit(void) sock_unregister(PF_AX25); } module_exit(ax25_exit); -#endif /* MODULE */ - -#endif diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c index 1b0f9da67..f96c65586 100644 --- a/net/ax25/ax25_addr.c +++ b/net/ax25/ax25_addr.c @@ -19,8 +19,6 @@ * AX.25 036 Jonathan(G4KLX) Split from ax25_subr.c. */ -#include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -303,4 +301,3 @@ void ax25_digi_invert(ax25_digi *in, ax25_digi *out) } } -#endif diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c index 0436db903..efeec64e0 100644 --- a/net/ax25/ax25_dev.c +++ b/net/ax25/ax25_dev.c @@ -17,7 +17,6 @@ */ #include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -39,8 +38,9 @@ #include #include #include +#include -ax25_dev *ax25_dev_list = NULL; +ax25_dev *ax25_dev_list; ax25_dev *ax25_dev_ax25dev(struct net_device *dev) { @@ -78,9 +78,7 @@ void ax25_dev_device_up(struct net_device *dev) return; } -#ifdef CONFIG_SYSCTL ax25_unregister_sysctl(); -#endif memset(ax25_dev, 0x00, sizeof(*ax25_dev)); @@ -107,9 +105,7 @@ void ax25_dev_device_up(struct net_device *dev) ax25_dev_list = ax25_dev; restore_flags(flags); -#ifdef CONFIG_SYSCTL ax25_register_sysctl(); -#endif } void ax25_dev_device_down(struct net_device *dev) @@ -120,9 +116,7 @@ void ax25_dev_device_down(struct net_device *dev) if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) return; -#ifdef CONFIG_SYSCTL ax25_unregister_sysctl(); -#endif save_flags(flags); cli(); @@ -141,9 +135,7 @@ void ax25_dev_device_down(struct net_device *dev) ax25_dev_list = s->next; restore_flags(flags); kfree(ax25_dev); -#ifdef CONFIG_SYSCTL ax25_register_sysctl(); -#endif return; } @@ -152,9 +144,7 @@ void ax25_dev_device_down(struct net_device *dev) s->next = ax25_dev->next; restore_flags(flags); kfree(ax25_dev); -#ifdef CONFIG_SYSCTL ax25_register_sysctl(); -#endif return; } @@ -162,9 +152,7 @@ void ax25_dev_device_down(struct net_device *dev) } restore_flags(flags); -#ifdef CONFIG_SYSCTL ax25_register_sysctl(); -#endif } int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd) @@ -209,12 +197,10 @@ struct net_device *ax25_fwd_dev(struct net_device *dev) return ax25_dev->forward; } -#ifdef MODULE - /* * Free all memory associated with device structures. */ -void ax25_dev_free(void) +void __exit ax25_dev_free(void) { ax25_dev *s, *ax25_dev = ax25_dev_list; @@ -225,7 +211,3 @@ void ax25_dev_free(void) kfree(s); } } - -#endif - -#endif diff --git a/net/ax25/ax25_ds_in.c b/net/ax25/ax25_ds_in.c index 3354206df..6c65baea5 100644 --- a/net/ax25/ax25_ds_in.c +++ b/net/ax25/ax25_ds_in.c @@ -22,8 +22,6 @@ * Joerg(DL1BKE) ax25->n2count never got reset */ -#include -#if defined(CONFIG_AX25_DAMA_SLAVE) #include #include #include @@ -312,4 +310,3 @@ int ax25_ds_frame_in(ax25_cb *ax25, struct sk_buff *skb, int type) return queued; } -#endif diff --git a/net/ax25/ax25_ds_subr.c b/net/ax25/ax25_ds_subr.c index 3a6f6c259..e3e88d771 100644 --- a/net/ax25/ax25_ds_subr.c +++ b/net/ax25/ax25_ds_subr.c @@ -22,8 +22,6 @@ * AX.25 037 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_AX25_DAMA_SLAVE) #include #include #include @@ -217,4 +215,3 @@ void ax25_dama_off(ax25_cb *ax25) ax25_dev_dama_off(ax25->ax25_dev); } -#endif diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c index 06135e9de..3c5b2ea9c 100644 --- a/net/ax25/ax25_ds_timer.c +++ b/net/ax25/ax25_ds_timer.c @@ -15,8 +15,6 @@ * AX.25 037 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_AX25_DAMA_SLAVE) #include #include #include @@ -224,5 +222,3 @@ void ax25_ds_t1_timeout(ax25_cb *ax25) ax25_calculate_t1(ax25); ax25_start_t1timer(ax25); } - -#endif diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c index 2e53ad959..15ca9c453 100644 --- a/net/ax25/ax25_iface.c +++ b/net/ax25/ax25_iface.c @@ -14,7 +14,6 @@ */ #include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -40,18 +39,18 @@ static struct protocol_struct { struct protocol_struct *next; unsigned int pid; int (*func)(struct sk_buff *, ax25_cb *); -} *protocol_list = NULL; +} *protocol_list; static struct linkfail_struct { struct linkfail_struct *next; void (*func)(ax25_cb *, int); -} *linkfail_list = NULL; +} *linkfail_list; static struct listen_struct { struct listen_struct *next; ax25_address callsign; struct net_device *dev; -} *listen_list = NULL; +} *listen_list; int ax25_protocol_register(unsigned int pid, int (*func)(struct sk_buff *, ax25_cb *)) { @@ -267,4 +266,3 @@ int ax25_protocol_is_registered(unsigned int pid) return 0; } -#endif diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c index 6efbc57f2..ed5e6fbce 100644 --- a/net/ax25/ax25_in.c +++ b/net/ax25/ax25_in.c @@ -39,7 +39,6 @@ */ #include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -480,4 +479,3 @@ int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_typ return ax25_rcv(skb, dev, (ax25_address *)dev->dev_addr, ptype); } -#endif diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c index a298fb59d..e6dcda83d 100644 --- a/net/ax25/ax25_ip.c +++ b/net/ax25/ax25_ip.c @@ -14,7 +14,6 @@ */ #include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -210,4 +209,3 @@ int ax25_rebuild_header(struct sk_buff *skb) #endif -#endif diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c index e6b19f53b..231c170e7 100644 --- a/net/ax25/ax25_out.c +++ b/net/ax25/ax25_out.c @@ -35,7 +35,6 @@ */ #include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -408,4 +407,3 @@ int ax25_check_iframes_acked(ax25_cb *ax25, unsigned short nr) return 0; } -#endif diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c index 32a7ab515..254ff36fb 100644 --- a/net/ax25/ax25_route.c +++ b/net/ax25/ax25_route.c @@ -41,8 +41,6 @@ * Arnaldo C. Melo s/suser/capable/ */ -#include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -64,8 +62,9 @@ #include #include #include +#include -static ax25_route *ax25_route_list = NULL; +static ax25_route *ax25_route_list; static ax25_route *ax25_find_route(ax25_address *, struct net_device *); @@ -434,12 +433,10 @@ struct sk_buff *ax25_rt_build_path(struct sk_buff *skb, ax25_address *src, ax25_ return skb; } -#ifdef MODULE - /* * Free all memory associated with routing structures. */ -void ax25_rt_free(void) +void __exit ax25_rt_free(void) { ax25_route *s, *ax25_rt = ax25_route_list; @@ -453,7 +450,3 @@ void ax25_rt_free(void) kfree(s); } } - -#endif - -#endif diff --git a/net/ax25/ax25_std_in.c b/net/ax25/ax25_std_in.c index 1e27580cf..d1cfc3ff9 100644 --- a/net/ax25/ax25_std_in.c +++ b/net/ax25/ax25_std_in.c @@ -37,8 +37,6 @@ * AX.25 037 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -467,5 +465,3 @@ int ax25_std_frame_in(ax25_cb *ax25, struct sk_buff *skb, int type) return queued; } - -#endif diff --git a/net/ax25/ax25_std_subr.c b/net/ax25/ax25_std_subr.c index 1b1d1c8bb..c868e0507 100644 --- a/net/ax25/ax25_std_subr.c +++ b/net/ax25/ax25_std_subr.c @@ -20,8 +20,6 @@ * AX.25 037 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -102,5 +100,3 @@ void ax25_std_timeout_response(ax25_cb *ax25) ax25->condition &= ~AX25_COND_ACK_PENDING; } - -#endif diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c index 4e97c51b8..5a2d8771c 100644 --- a/net/ax25/ax25_std_timer.c +++ b/net/ax25/ax25_std_timer.c @@ -22,8 +22,6 @@ * AX.25 037 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -170,5 +168,3 @@ void ax25_std_t1timer_expiry(ax25_cb *ax25) ax25_calculate_t1(ax25); ax25_start_t1timer(ax25); } - -#endif diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c index 97ef02d08..669789646 100644 --- a/net/ax25/ax25_subr.c +++ b/net/ax25/ax25_subr.c @@ -33,8 +33,6 @@ * AX.25 037 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -324,5 +322,3 @@ void ax25_disconnect(ax25_cb *ax25, int reason) ax25->sk->dead = 1; } } - -#endif diff --git a/net/ax25/ax25_timer.c b/net/ax25/ax25_timer.c index 08e190456..01e7596f3 100644 --- a/net/ax25/ax25_timer.c +++ b/net/ax25/ax25_timer.c @@ -26,7 +26,6 @@ */ #include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -255,5 +254,3 @@ static void ax25_idletimer_expiry(unsigned long param) #endif } } - -#endif diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c index eb226b14c..603d8b8cc 100644 --- a/net/ax25/ax25_uid.c +++ b/net/ax25/ax25_uid.c @@ -13,8 +13,6 @@ * AX.25 036 Jonathan(G4KLX) Split from af_ax25.c. */ -#include -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include #include #include @@ -48,7 +46,7 @@ * Callsign/UID mapper. This is in kernel space for security on multi-amateur machines. */ -static ax25_uid_assoc *ax25_uid_list = NULL; +static ax25_uid_assoc *ax25_uid_list; int ax25_uid_policy = 0; @@ -164,12 +162,10 @@ int ax25_uid_get_info(char *buffer, char **start, off_t offset, int length) return len; } -#ifdef MODULE - /* * Free all memory associated with UID/Callsign structures. */ -void ax25_uid_free(void) +void __exit ax25_uid_free(void) { ax25_uid_assoc *s, *ax25_uid = ax25_uid_list; @@ -180,7 +176,3 @@ void ax25_uid_free(void) kfree(s); } } - -#endif - -#endif diff --git a/net/bridge/Makefile b/net/bridge/Makefile index 082388fe5..4c2c72812 100644 --- a/net/bridge/Makefile +++ b/net/bridge/Makefile @@ -8,9 +8,9 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := bridge.o -O_OBJS := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \ +obj-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \ br_ioctl.o br_notify.o br_stp.o br_stp_bpdu.o \ br_stp_if.o br_stp_timer.o -M_OBJS := $(O_TARGET) +obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 24cf40fa5..6438fc2f0 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -5,7 +5,7 @@ * Authors: * Lennert Buytenhek * - * $Id: br_input.c,v 1.6 2000/06/26 18:09:17 davem Exp $ + * $Id: br_input.c,v 1.7 2000/12/13 16:44:14 davem Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,8 +28,7 @@ static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb) skb->dev = &br->dev; skb->pkt_type = PACKET_HOST; - skb->mac.raw = skb->data; - skb_pull(skb, skb->nh.raw - skb->data); + skb_pull(skb, skb->mac.raw - skb->data); skb->protocol = eth_type_trans(skb, &br->dev); netif_rx(skb); } @@ -42,7 +41,6 @@ static void __br_handle_frame(struct sk_buff *skb) struct net_bridge_port *p; int passedup; - skb->nh.raw = skb->mac.raw; dest = skb->mac.ethernet->h_dest; p = skb->dev->br_port; diff --git a/net/core/Makefile b/net/core/Makefile index af3c74091..9a0e8ff97 100644 --- a/net/core/Makefile +++ b/net/core/Makefile @@ -9,35 +9,23 @@ O_TARGET := core.o -O_OBJS := sock.o skbuff.o iovec.o datagram.o scm.o +export-objs := netfilter.o profile.o + +obj-y := sock.o skbuff.o iovec.o datagram.o scm.o ifeq ($(CONFIG_SYSCTL),y) ifeq ($(CONFIG_NET),y) -O_OBJS += sysctl_net_core.o -endif +obj-y += sysctl_net_core.o endif - -ifdef CONFIG_FILTER -O_OBJS += filter.o -endif - -ifdef CONFIG_NET - -O_OBJS += dev.o dev_mcast.o dst.o neighbour.o rtnetlink.o utils.o - -ifdef CONFIG_NETFILTER -OX_OBJS += netfilter.o endif -ifeq ($(CONFIG_NET_DIVERT),y) -O_OBJS += dv.o -endif +obj-$(CONFIG_FILTER) += filter.o -endif +obj-$(CONFIG_NET) += dev.o dev_mcast.o dst.o neighbour.o rtnetlink.o utils.o -ifdef CONFIG_NET_PROFILE -OX_OBJS += profile.o -endif +obj-$(CONFIG_NETFILTER) += netfilter.o +obj-$(CONFIG_NET_DIVERT) += dv.o +obj-$(CONFIG_NET_PROFILE) += profile.o include $(TOPDIR)/Rules.make diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c5dcecfb3..5275e83b8 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -223,15 +223,20 @@ static inline void skb_headerinit(void *p, kmem_cache_t *cache, { struct sk_buff *skb = p; - skb->destructor = NULL; - skb->pkt_type = PACKET_HOST; /* Default type */ - skb->prev = skb->next = NULL; + skb->next = NULL; + skb->prev = NULL; skb->list = NULL; skb->sk = NULL; skb->stamp.tv_sec=0; /* No idea about time */ + skb->dev = NULL; + skb->dst = NULL; + memset(skb->cb, 0, sizeof(skb->cb)); + skb->pkt_type = PACKET_HOST; /* Default type */ skb->ip_summed = 0; + skb->priority = 0; skb->security = 0; /* By default packets are insecure */ - skb->dst = NULL; + skb->destructor = NULL; + #ifdef CONFIG_NETFILTER skb->nfmark = skb->nfcache = 0; skb->nfct = NULL; @@ -242,8 +247,6 @@ static inline void skb_headerinit(void *p, kmem_cache_t *cache, #ifdef CONFIG_NET_SCHED skb->tc_index = 0; #endif - memset(skb->cb, 0, sizeof(skb->cb)); - skb->priority = 0; } /* diff --git a/net/core/sock.c b/net/core/sock.c index 7b9484437..d15bd82f4 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.101 2000/11/10 04:02:04 davem Exp $ + * Version: $Id: sock.c,v 1.102 2000/12/11 23:00:24 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -866,24 +866,17 @@ void sklist_remove_socket(struct sock **list, struct sock *sk) write_lock_bh(&net_big_sklist_lock); - s= *list; - if(s==sk) - { - *list = s->next; - write_unlock_bh(&net_big_sklist_lock); - sock_put(sk); - return; - } - while(s && s->next) - { - if(s->next==sk) - { - s->next=sk->next; + while ((s = *list) != NULL) { + if (s == sk) { + *list = s->next; break; } - s=s->next; + list = &s->next; } + write_unlock_bh(&net_big_sklist_lock); + if (s) + sock_put(s); } void sklist_insert_socket(struct sock **list, struct sock *sk) diff --git a/net/decnet/Makefile b/net/decnet/Makefile index 03d35cc9c..ac7a1a462 100644 --- a/net/decnet/Makefile +++ b/net/decnet/Makefile @@ -1,18 +1,13 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := decnet.o -O_OBJS := af_decnet.o dn_nsp_in.o dn_nsp_out.o dn_route.o dn_dev.o dn_neigh.o dn_timer.o -M_OBJS := $(O_TARGET) +obj-y := af_decnet.o dn_nsp_in.o dn_nsp_out.o dn_route.o dn_dev.o dn_neigh.o dn_timer.o +obj-m := $(O_TARGET) -ifeq ($(CONFIG_DECNET_ROUTER),y) -O_OBJS += dn_fib.o dn_rules.o dn_table.o -endif +obj-$(CONFIG_DECNET_ROUTER) += dn_fib.o dn_rules.o dn_table.o +obj-$(CONFIG_DECNET_FW) += dn_fw.o -ifeq ($(CONFIG_DECNET_FW),y) -O_OBJS += dn_fw.o -endif - -O_OBJS += sysctl_net_decnet.o +obj-y += sysctl_net_decnet.o include $(TOPDIR)/Rules.make diff --git a/net/econet/Makefile b/net/econet/Makefile index 38d0d4b58..d51815b2c 100644 --- a/net/econet/Makefile +++ b/net/econet/Makefile @@ -9,7 +9,7 @@ O_TARGET := econet.o -O_OBJS := af_econet.o sysctl_net_ec.o -M_OBJS := $(O_TARGET) +obj-y := af_econet.o sysctl_net_ec.o +obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make diff --git a/net/ethernet/Makefile b/net/ethernet/Makefile index 193d6af8b..6764a1af7 100644 --- a/net/ethernet/Makefile +++ b/net/ethernet/Makefile @@ -23,9 +23,7 @@ ifdef CONFIG_ATALK OBJ2 := pe2.o endif -ifdef CONFIG_NET -O_OBJS := $(OBJS) $(OBJ2) -endif +obj-$(CONFIG_NET) := $(OBJS) $(OBJ2) include $(TOPDIR)/Rules.make diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index 1a6a53bc8..f93dc211a 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -8,57 +8,23 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := ipv4.o -IPV4_OBJS := utils.o route.o inetpeer.o proc.o protocol.o \ + +export-objs = ipip.o ip_gre.o + +obj-y := utils.o route.o inetpeer.o proc.o protocol.o \ ip_input.o ip_fragment.o ip_forward.o ip_options.o \ ip_output.o ip_sockglue.o \ tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \ raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \ sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o -IPV4X_OBJS := - -M_OBJS := - -ifeq ($(CONFIG_IP_MULTIPLE_TABLES),y) -IPV4_OBJS += fib_rules.o -endif - -ifeq ($(CONFIG_IP_ROUTE_NAT),y) -IPV4_OBJS += ip_nat_dumb.o -endif - -ifeq ($(CONFIG_IP_MROUTE),y) -IPV4_OBJS += ipmr.o -endif - -ifeq ($(CONFIG_NET_IPIP),y) -IPV4X_OBJS += ipip.o -else - ifeq ($(CONFIG_NET_IPIP),m) - MX_OBJS += ipip.o - endif -endif - -ifeq ($(CONFIG_NET_IPGRE),y) -IPV4X_OBJS += ip_gre.o -else - ifeq ($(CONFIG_NET_IPGRE),m) - MX_OBJS += ip_gre.o - endif -endif - -ifeq ($(CONFIG_SYN_COOKIES),y) -IPV4_OBJS += syncookies.o -# module not supported, because it would be too messy. -endif - -ifeq ($(CONFIG_IP_PNP),y) -IPV4_OBJS += ipconfig.o -endif -ifdef CONFIG_INET -O_OBJS := $(IPV4_OBJS) -OX_OBJS := $(IPV4X_OBJS) -endif +obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o +obj-$(CONFIG_IP_ROUTE_NAT) += ip_nat_dumb.o +obj-$(CONFIG_IP_MROUTE) += ipmr.o +obj-$(CONFIG_NET_IPIP) += ipip.o +obj-$(CONFIG_NET_IPGRE) += ip_gre.o +obj-$(CONFIG_SYN_COOKIES) += syncookies.o +obj-$(CONFIG_IP_PNP) += ipconfig.o include $(TOPDIR)/Rules.make diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 3222d25d1..ba35b03c9 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -5,7 +5,7 @@ * * PF_INET protocol family socket handler. * - * Version: $Id: af_inet.c,v 1.123 2000/11/10 01:42:43 davem Exp $ + * Version: $Id: af_inet.c,v 1.127 2000/12/22 19:51:50 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -723,11 +723,7 @@ int inet_recvmsg(struct socket *sock, struct msghdr *msg, int size, struct sock *sk = sock->sk; int addr_len = 0; int err; - - /* We may need to bind the socket. */ - /* It is pretty strange. I would return error in this case --ANK */ - if (sk->num==0 && inet_autobind(sk) != 0) - return -EAGAIN; + err = sk->prot->recvmsg(sk, msg, size, flags&MSG_DONTWAIT, flags&~MSG_DONTWAIT, &addr_len); if (err >= 0) diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 7091bf82c..afed5862e 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -324,6 +324,7 @@ static struct ipq *ip_frag_create(unsigned hash, struct iphdr *iph) qp->len = 0; qp->meat = 0; qp->fragments = NULL; + qp->iif = 0; /* Initialize a timer for this entry. */ init_timer(&qp->timer); @@ -485,7 +486,8 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb) else qp->fragments = skb; - qp->iif = skb->dev->ifindex; + if (skb->dev) + qp->iif = skb->dev->ifindex; skb->dev = NULL; qp->meat += skb->len; atomic_add(skb->truesize, &ip_frag_mem); diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index f0e9bb5bb..b7af2b9f6 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -783,7 +783,7 @@ static int __init ic_dynamic(void) printk("."); jiff = jiffies + timeout; while (jiffies < jiff && !ic_got_reply) - ; + barrier(); if (ic_got_reply) { printk(" OK\n"); break; diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index cb430624f..995860767 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile @@ -8,229 +8,78 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := netfilter.o -M_OBJS := - -IP_NF_CONNTRACK_OBJ:=ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o - -IP_NF_NAT_OBJ:=ip_nat_core.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o - -# All the parts of conntrack and NAT required for compatibility layer. -IP_NF_COMPAT_LAYER:=ip_fw_compat.o ip_fw_compat_redir.o ip_fw_compat_masq.o $(IP_NF_CONNTRACK_OBJ) $(IP_NF_NAT_OBJ) - -# Link order matters here. -ifeq ($(CONFIG_IP_NF_CONNTRACK),y) -OX_OBJS += ip_conntrack_standalone.o -O_OBJS += $(IP_NF_CONNTRACK_OBJ) -else - ifeq ($(CONFIG_IP_NF_CONNTRACK),m) - MI_OBJS += $(IP_NF_CONNTRACK_OBJ) - MIX_OBJS += ip_conntrack_standalone.o - M_OBJS += ip_conntrack.o - endif -endif - -ifeq ($(CONFIG_IP_NF_FTP),y) -OX_OBJS += ip_conntrack_ftp.o -else - ifeq ($(CONFIG_IP_NF_FTP),m) - MX_OBJS += ip_conntrack_ftp.o - endif -endif - -ifeq ($(CONFIG_IP_NF_IPTABLES),y) -OX_OBJS += ip_tables.o -else - ifeq ($(CONFIG_IP_NF_IPTABLES),m) - MX_OBJS += ip_tables.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MATCH_LIMIT),y) -O_OBJS += ipt_limit.o -else - ifeq ($(CONFIG_IP_NF_MATCH_LIMIT),m) - M_OBJS += ipt_limit.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MATCH_MARK),y) -O_OBJS += ipt_mark.o -else - ifeq ($(CONFIG_IP_NF_MATCH_MARK),m) - M_OBJS += ipt_mark.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MATCH_MAC),y) -O_OBJS += ipt_mac.o -else - ifeq ($(CONFIG_IP_NF_MATCH_MAC),m) - M_OBJS += ipt_mac.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MATCH_MULTIPORT),y) -O_OBJS += ipt_multiport.o -else - ifeq ($(CONFIG_IP_NF_MATCH_MULTIPORT),m) - M_OBJS += ipt_multiport.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MATCH_OWNER),y) -O_OBJS += ipt_owner.o -else - ifeq ($(CONFIG_IP_NF_MATCH_OWNER),m) - M_OBJS += ipt_owner.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MATCH_TOS),y) -O_OBJS += ipt_tos.o -else - ifeq ($(CONFIG_IP_NF_MATCH_TOS),m) - M_OBJS += ipt_tos.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MATCH_STATE),y) -O_OBJS += ipt_state.o -else - ifeq ($(CONFIG_IP_NF_MATCH_STATE),m) - M_OBJS += ipt_state.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MATCH_UNCLEAN),y) -O_OBJS += ipt_unclean.o -else - ifeq ($(CONFIG_IP_NF_MATCH_UNCLEAN),m) - M_OBJS += ipt_unclean.o - endif -endif - -ifeq ($(CONFIG_IP_NF_NAT),y) -O_OBJS += ip_nat_standalone.o ip_nat_rule.o $(IP_NF_NAT_OBJ) - ifeq ($(CONFIG_IP_NF_FTP),y) - O_OBJS += ip_nat_ftp.o - endif -else - ifeq ($(CONFIG_IP_NF_NAT),m) - MI_OBJS += ip_nat_rule.o $(IP_NF_NAT_OBJ) - MIX_OBJS += ip_nat_standalone.o - M_OBJS += iptable_nat.o - ifeq ($(CONFIG_IP_NF_FTP),m) - M_OBJS += ip_nat_ftp.o - endif - endif -endif - -ifeq ($(CONFIG_IP_NF_FILTER),y) -O_OBJS += iptable_filter.o -else - ifeq ($(CONFIG_IP_NF_FILTER),m) - M_OBJS += iptable_filter.o - endif -endif - -ifeq ($(CONFIG_IP_NF_MANGLE),y) -O_OBJS += iptable_mangle.o -else - ifeq ($(CONFIG_IP_NF_MANGLE),m) - M_OBJS += iptable_mangle.o - endif -endif - -ifeq ($(CONFIG_IP_NF_TARGET_REJECT),y) -O_OBJS += ipt_REJECT.o -else - ifeq ($(CONFIG_IP_NF_TARGET_REJECT),m) - M_OBJS += ipt_REJECT.o - endif -endif - -ifeq ($(CONFIG_IP_NF_TARGET_MIRROR),y) -O_OBJS += ipt_MIRROR.o -else - ifeq ($(CONFIG_IP_NF_TARGET_MIRROR),m) - M_OBJS += ipt_MIRROR.o - endif -endif - -ifeq ($(CONFIG_IP_NF_TARGET_TOS),y) -O_OBJS += ipt_TOS.o -else - ifeq ($(CONFIG_IP_NF_TARGET_TOS),m) - M_OBJS += ipt_TOS.o - endif -endif - -ifeq ($(CONFIG_IP_NF_TARGET_MARK),y) -O_OBJS += ipt_MARK.o -else - ifeq ($(CONFIG_IP_NF_TARGET_MARK),m) - M_OBJS += ipt_MARK.o - endif -endif - -ifeq ($(CONFIG_IP_NF_TARGET_MASQUERADE),y) -O_OBJS += ipt_MASQUERADE.o -else - ifeq ($(CONFIG_IP_NF_TARGET_MASQUERADE),m) - M_OBJS += ipt_MASQUERADE.o - endif -endif - -ifeq ($(CONFIG_IP_NF_TARGET_REDIRECT),y) -O_OBJS += ipt_REDIRECT.o -else - ifeq ($(CONFIG_IP_NF_TARGET_REDIRECT),m) - M_OBJS += ipt_REDIRECT.o - endif -endif - -ifeq ($(CONFIG_IP_NF_TARGET_LOG),y) -O_OBJS += ipt_LOG.o -else - ifeq ($(CONFIG_IP_NF_TARGET_LOG),m) - M_OBJS += ipt_LOG.o - endif -endif - -ifeq ($(CONFIG_IP_NF_COMPAT_IPCHAINS),y) -O_OBJS += ipchains_core.o $(IP_NF_COMPAT_LAYER) -else - ifeq ($(CONFIG_IP_NF_COMPAT_IPCHAINS),m) - M_OBJS += ipchains.o - endif -endif - -ifeq ($(CONFIG_IP_NF_COMPAT_IPFWADM),y) -O_OBJS += ipfwadm_core.o $(IP_NF_COMPAT_LAYER) -else - ifeq ($(CONFIG_IP_NF_COMPAT_IPFWADM),m) - M_OBJS += ipfwadm.o - endif -endif - -ifeq ($(CONFIG_IP_NF_QUEUE),y) -O_OBJS += ip_queue.o -else - ifeq ($(CONFIG_IP_NF_QUEUE),m) - M_OBJS += ip_queue.o - endif -endif + +export-objs = ip_conntrack_standalone.o ip_conntrack_ftp.o ip_fw_compat.o ip_nat_standalone.o ip_tables.o + +# Multipart objects. +list-multi := ip_conntrack.o iptable_nat.o ipfwadm.o ipchains.o + +# objects for the conntrack and NAT core (used by standalone and backw. compat) +ip_nf_conntrack-objs := ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o +ip_nf_nat-objs := ip_nat_core.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o + +# objects for the standalone - connection tracking / NAT +ip_conntrack-objs := ip_conntrack_standalone.o $(ip_nf_conntrack-objs) +iptable_nat-objs := ip_nat_standalone.o ip_nat_rule.o $(ip_nf_nat-objs) + +# objects for backwards compatibility mode +ip_nf_compat-objs := ip_fw_compat.o ip_fw_compat_redir.o ip_fw_compat_masq.o $(ip_nf_conntrack-objs) $(ip_nf_nat-objs) + +ipfwadm-objs := $(ip_nf_compat-objs) ipfwadm_core.o +ipchains-objs := $(ip_nf_compat-objs) ipchains_core.o + +# connection tracking +obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o + +# connection tracking helpers +obj-$(CONFIG_IP_NF_FTP) += ip_conntrack_ftp.o + +# NAT helpers +obj-$(CONFIG_IP_NF_FTP) += ip_nat_ftp.o + +# generic IP tables +obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o + +# the three instances of ip_tables +obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o +obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o +obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o + +# matches +obj-$(CONFIG_IP_NF_MATCH_LIMIT) += ipt_limit.o +obj-$(CONFIG_IP_NF_MATCH_MARK) += ipt_mark.o +obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o +obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o +obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o +obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o +obj-$(CONFIG_IP_NF_MATCH_STATE) += ipt_state.o +obj-$(CONFIG_IP_NF_MATCH_UNCLEAN) += ipt_unclean.o + +# targets +obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o +obj-$(CONFIG_IP_NF_TARGET_MIRROR) += ipt_MIRROR.o +obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o +obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o +obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o +obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o +obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o + +# backwards compatibility +obj-$(CONFIG_IP_NF_COMPAT_IPCHAINS) += ipchains.o +obj-$(CONFIG_IP_NF_COMPAT_IPFWADM) += ipfwadm.o + +obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o include $(TOPDIR)/Rules.make -ip_conntrack.o: ip_conntrack_standalone.o $(IP_NF_CONNTRACK_OBJ) - $(LD) -r -o $@ $(IP_NF_CONNTRACK_OBJ) ip_conntrack_standalone.o +ip_conntrack.o: $(ip_conntrack-objs) + $(LD) -r -o $@ $(ip_conntrack-objs) -iptable_nat.o: ip_nat_standalone.o ip_nat_rule.o $(IP_NF_NAT_OBJ) - $(LD) -r -o $@ ip_nat_standalone.o ip_nat_rule.o $(IP_NF_NAT_OBJ) +iptable_nat.o: $(iptable_nat-objs) + $(LD) -r -o $@ $(iptable_nat-objs) -ipfwadm.o: ipfwadm_core.o $(IP_NF_COMPAT_LAYER) - $(LD) -r -o $@ ipfwadm_core.o $(IP_NF_COMPAT_LAYER) +ipfwadm.o: $(ipfwadm-objs) + $(LD) -r -o $@ $(ipfwadm-objs) -ipchains.o: ipchains_core.o $(IP_NF_COMPAT_LAYER) - $(LD) -r -o $@ ipchains_core.o $(IP_NF_COMPAT_LAYER) +ipchains.o: $(ipchains-objs) + $(LD) -r -o $@ $(ipchains-objs) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 15d087716..4e3eab087 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp_input.c,v 1.203 2000/11/28 17:04:09 davem Exp $ + * Version: $Id: tcp_input.c,v 1.205 2000/12/13 18:31:48 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -108,6 +108,7 @@ int sysctl_tcp_max_orphans = NR_FILE; #define IsReno(tp) ((tp)->sack_ok == 0) #define IsFack(tp) ((tp)->sack_ok & 2) +#define IsDSack(tp) ((tp)->sack_ok & 4) #define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH) @@ -438,14 +439,40 @@ static __inline__ void tcp_rtt_estimator(struct tcp_opt *tp, __u32 mrtt) if (tp->srtt != 0) { m -= (tp->srtt >> 3); /* m is now error in rtt est */ tp->srtt += m; /* rtt = 7/8 rtt + 1/8 new */ - if (m < 0) + if (m < 0) { m = -m; /* m is now abs(error) */ - m -= (tp->mdev >> 2); /* similar update on mdev */ + m -= (tp->mdev >> 2); /* similar update on mdev */ + /* This is similar to one of Eifel findings. + * Eifel blocks mdev updates when rtt decreases. + * This solution is a bit different: we use finer gain + * for mdev in this case (alpha*beta). + * Like Eifel it also prevents growth of rto, + * but also it limits too fast rto decreases, + * happening in pure Eifel. + */ + if (m > 0) + m >>= 3; + } else { + m -= (tp->mdev >> 2); /* similar update on mdev */ + } tp->mdev += m; /* mdev = 3/4 mdev + 1/4 new */ + if (tp->mdev > tp->mdev_max) { + tp->mdev_max = tp->mdev; + if (tp->mdev_max > tp->rttvar) + tp->rttvar = tp->mdev_max; + } + if (after(tp->snd_una, tp->rtt_seq)) { + if (tp->mdev_max < tp->rttvar) + tp->rttvar -= (tp->rttvar-tp->mdev_max)>>2; + tp->rtt_seq = tp->snd_una; + tp->mdev_max = TCP_RTO_MIN; + } } else { /* no previous measure. */ tp->srtt = m<<3; /* take the measured time to be rtt */ tp->mdev = m<<2; /* make sure rto = 3*rtt */ + tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN); + tp->rtt_seq = tp->snd_nxt; } } @@ -454,45 +481,34 @@ static __inline__ void tcp_rtt_estimator(struct tcp_opt *tp, __u32 mrtt) */ static __inline__ void tcp_set_rto(struct tcp_opt *tp) { - tp->rto = (tp->srtt >> 3) + tp->mdev; - /* I am not enough educated to understand this magic. - * However, it smells bad. snd_cwnd>31 is common case. + /* Old crap is replaced with new one. 8) + * + * More seriously: + * 1. If rtt variance happened to be less 50msec, it is hallucination. + * It cannot be less due to utterly erratic ACK generation made + * at least by solaris and freebsd. "Erratic ACKs" has _nothing_ + * to do with delayed acks, because at cwnd>2 true delack timeout + * is invisible. Actually, Linux-2.4 also generates erratic + * ACKs in some curcumstances. */ - /* OK, I found comment in 2.0 source tree, it deserves - * to be reproduced: - * ==== - * Note: Jacobson's algorithm is fine on BSD which has a 1/2 second - * granularity clock, but with our 1/100 second granularity clock we - * become too sensitive to minor changes in the round trip time. - * We add in two compensating factors. First we multiply by 5/4. - * For large congestion windows this allows us to tolerate burst - * traffic delaying up to 1/4 of our packets. We also add in - * a rtt / cong_window term. For small congestion windows this allows - * a single packet delay, but has negligible effect - * on the compensation for large windows. + tp->rto = (tp->srtt >> 3) + tp->rttvar; + + /* 2. Fixups made earlier cannot be right. + * If we do not estimate RTO correctly without them, + * all the algo is pure shit and should be replaced + * with correct one. It is exaclty, which we pretend to do. */ - tp->rto += (tp->rto >> 2) + (tp->rto >> (tp->snd_cwnd-1)); -} - -/* Keep the rto between HZ/5 and 120*HZ. 120*HZ is the upper bound - * on packet lifetime in the internet. We need the HZ/5 lower - * bound to behave correctly against BSD stacks with a fixed - * delayed ack. - * FIXME: It's not entirely clear this lower bound is the best - * way to avoid the problem. Is it possible to drop the lower - * bound and still avoid trouble with BSD stacks? Perhaps - * some modification to the RTO calculation that takes delayed - * ack bias into account? This needs serious thought. -- erics +} + +/* NOTE: clamping at TCP_RTO_MIN is not required, current algo + * guarantees that rto is higher. */ static __inline__ void tcp_bound_rto(struct tcp_opt *tp) { - if (tp->rto < TCP_RTO_MIN) - tp->rto = TCP_RTO_MIN; - else if (tp->rto > TCP_RTO_MAX) + if (tp->rto > TCP_RTO_MAX) tp->rto = TCP_RTO_MAX; } - /* Save metrics learned by this TCP session. This function is called only, when TCP finishes sucessfully i.e. when it enters TIME-WAIT or goes from LAST-ACK to CLOSE. @@ -649,8 +665,10 @@ static void tcp_init_metrics(struct sock *sk) */ if (dst->rtt > tp->srtt) tp->srtt = dst->rtt; - if (dst->rttvar > tp->mdev) + if (dst->rttvar > tp->mdev) { tp->mdev = dst->rttvar; + tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN); + } tcp_set_rto(tp); tcp_bound_rto(tp); if (tp->rto < TCP_TIMEOUT_INIT && !tp->saw_tstamp) @@ -666,7 +684,7 @@ reset: */ if (!tp->saw_tstamp && tp->srtt) { tp->srtt = 0; - tp->mdev = TCP_TIMEOUT_INIT; + tp->mdev = tp->mdev_max = tp->rttvar = TCP_TIMEOUT_INIT; tp->rto = TCP_TIMEOUT_INIT; } } @@ -774,11 +792,13 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ if (before(start_seq, ack)) { dup_sack = 1; + tp->sack_ok |= 4; NET_INC_STATS_BH(TCPDSACKRecv); } else if (num_sacks > 1 && !after(end_seq, ntohl(sp[1].end_seq)) && !before(start_seq, ntohl(sp[1].start_seq))) { dup_sack = 1; + tp->sack_ok |= 4; NET_INC_STATS_BH(TCPDSACKOfoRecv); } @@ -1286,8 +1306,10 @@ static void tcp_undo_cwr(struct tcp_opt *tp, int undo) { if (tp->prior_ssthresh) { tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh<<1); - if (undo && tp->prior_ssthresh > tp->snd_ssthresh) + if (undo && tp->prior_ssthresh > tp->snd_ssthresh) { tp->snd_ssthresh = tp->prior_ssthresh; + TCP_ECN_withdraw_cwr(tp); + } } else { tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh); } @@ -1615,13 +1637,16 @@ static void tcp_ack_no_tstamp(struct tcp_opt *tp, u32 seq_rtt, int flag) * I.e. Karn's algorithm. (SIGCOMM '87, p5.) */ + if (flag & FLAG_RETRANS_DATA_ACKED) + return; + tcp_rtt_estimator(tp, seq_rtt); tcp_set_rto(tp); if (tp->backoff) { /* To relax it? We have valid sample as soon as we are * here. Why not to clear backoff? */ - if (!tp->retransmits || !(flag & FLAG_RETRANS_DATA_ACKED)) + if (!tp->retransmits) tp->backoff = 0; else tp->rto <<= tp->backoff; @@ -1661,16 +1686,25 @@ static __inline__ void tcp_cong_avoid(struct tcp_opt *tp) } } +/* Restart timer after forward progress on connection. + * RFC2988 recommends (and BSD does) to restart timer to now+rto, + * which is certainly wrong and effectively means that + * rto includes one more _full_ rtt. + * + * For details see: + * ftp://ftp.inr.ac.ru:/ip-routing/README.rto + */ + static __inline__ void tcp_ack_packets_out(struct sock *sk, struct tcp_opt *tp) { if (tp->packets_out==0) { tcp_clear_xmit_timer(sk, TCP_TIME_RETRANS); } else { struct sk_buff *skb = skb_peek(&sk->write_queue); - __u32 when = tp->rto - (tcp_time_stamp - TCP_SKB_CB(skb)->when); + __u32 when = tp->rto + tp->rttvar - (tcp_time_stamp - TCP_SKB_CB(skb)->when); - if ((__s32)when <= 0) - when = TCP_RTO_MIN; + if ((__s32)when < (__s32)tp->rttvar) + when = tp->rttvar; tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, when); } } @@ -1841,7 +1875,7 @@ static int tcp_ack_update_window(struct sock *sk, struct tcp_opt *tp, #ifdef TCP_DEBUG if (before(tp->snd_una + tp->snd_wnd, tp->snd_nxt)) { - if ((tp->snd_una + tp->snd_wnd)-tp->snd_nxt >= (1<snd_wscale) + if (tp->snd_nxt-(tp->snd_una + tp->snd_wnd) >= (1<snd_wscale) && net_ratelimit()) printk(KERN_DEBUG "TCP: peer %u.%u.%u.%u:%u/%u shrinks window %u:%u:%u. Bad, what else can I say?\n", NIPQUAD(sk->daddr), htons(sk->dport), sk->num, diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 5df184df5..a4ff40d56 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -282,19 +282,17 @@ __inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport } static inline struct sock *udp_v4_mcast_next(struct sock *sk, - unsigned short num, - unsigned long raddr, - unsigned short rnum, - unsigned long laddr, + u16 loc_port, u32 loc_addr, + u16 rmt_port, u32 rmt_addr, int dif) { struct sock *s = sk; - unsigned short hnum = ntohs(num); + unsigned short hnum = ntohs(loc_port); for(; s; s = s->next) { if ((s->num != hnum) || - (s->daddr && s->daddr!=raddr) || - (s->dport != rnum && s->dport != 0) || - (s->rcv_saddr && s->rcv_saddr != laddr) || + (s->daddr && s->daddr!=rmt_addr) || + (s->dport != rmt_port && s->dport != 0) || + (s->rcv_saddr && s->rcv_saddr != loc_addr) || (s->bound_dev_if && s->bound_dev_if != dif)) continue; break; @@ -861,15 +859,15 @@ static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh, read_lock(&udp_hash_lock); sk = udp_hash[ntohs(uh->dest) & (UDP_HTABLE_SIZE - 1)]; dif = skb->dev->ifindex; - sk = udp_v4_mcast_next(sk, uh->dest, saddr, uh->source, daddr, dif); + sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); if (sk) { struct sock *sknext = NULL; do { struct sk_buff *skb1 = skb; - sknext = udp_v4_mcast_next(sk->next, uh->dest, saddr, - uh->source, daddr, dif); + sknext = udp_v4_mcast_next(sk->next, uh->dest, daddr, + uh->source, saddr, dif); if(sknext) skb1 = skb_clone(skb, GFP_ATOMIC); diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index 23754e3d3..f9964e085 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile @@ -8,18 +8,15 @@ O_TARGET := ipv6.o -IPV6_OBJS := af_inet6.o ip6_output.o ip6_input.o addrconf.o sit.o \ + +obj-y := af_inet6.o ip6_output.o ip6_input.o addrconf.o sit.o \ route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o raw.o \ protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.o \ exthdrs.o sysctl_net_ipv6.o datagram.o proc.o \ ip6_flowlabel.o -M_OBJS := $(O_TARGET) - -#ifeq ($(CONFIG_IPV6_FIREWALL),y) -# IPV6_OBJS += ip6_fw.o -#endif +obj-m := $(O_TARGET) -O_OBJS := $(IPV6_OBJS) +#obj-$(CONFIG_IPV6_FIREWALL) += ip6_fw.o include $(TOPDIR)/Rules.make diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile index 5f89671a2..aec5db879 100644 --- a/net/ipv6/netfilter/Makefile +++ b/net/ipv6/netfilter/Makefile @@ -8,172 +8,17 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := netfilter.o -M_OBJS := -IP6_NF_CONNTRACK_OBJ:=ip6_conntrack_core.o ip6_conntrack_proto_generic.o ip6_conntrack_proto_tcp.o ip6_conntrack_proto_udp.o ip6_conntrack_proto_icmp.o +multi-objs := +export-objs := # Link order matters here. -ifeq ($(CONFIG_IP6_NF_CONNTRACK),y) -O_OBJS += ip6_conntrack_standalone.o $(IP6_NF_CONNTRACK_OBJ) -else - ifeq ($(CONFIG_IP6_NF_CONNTRACK),m) - MI_OBJS += $(IP6_NF_CONNTRACK_OBJ) - MIX_OBJS += ip6_conntrack_standalone.o - M_OBJS += ip6_conntrack.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_FTP),y) -O_OBJS += ip6_conntrack_ftp.o -else - ifeq ($(CONFIG_IP6_NF_FTP),m) - MX_OBJS += ip6_conntrack_ftp.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_IPTABLES),y) -O_OBJS += ip6_tables.o -else - ifeq ($(CONFIG_IP6_NF_IPTABLES),m) - MX_OBJS += ip6_tables.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_MATCH_LIMIT),y) -O_OBJS += ip6t_limit.o -else - ifeq ($(CONFIG_IP6_NF_MATCH_LIMIT),m) - M_OBJS += ip6t_limit.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_MATCH_MARK),y) -O_OBJS += ip6t_mark.o -else - ifeq ($(CONFIG_IP6_NF_MATCH_MARK),m) - M_OBJS += ip6t_mark.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_MATCH_MAC),y) -O_OBJS += ip6t_mac.o -else - ifeq ($(CONFIG_IP6_NF_MATCH_MAC),m) - M_OBJS += ip6t_mac.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_MATCH_MULTIPORT),y) -O_OBJS += ip6t_multiport.o -else - ifeq ($(CONFIG_IP6_NF_MATCH_MULTIPORT),m) - M_OBJS += ip6t_multiport.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_MATCH_OWNER),y) -O_OBJS += ip6t_owner.o -else - ifeq ($(CONFIG_IP6_NF_MATCH_OWNER),m) - M_OBJS += ip6t_owner.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_MATCH_TOS),y) -O_OBJS += ip6t_tos.o -else - ifeq ($(CONFIG_IP6_NF_MATCH_TOS),m) - M_OBJS += ip6t_tos.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_MATCH_STATE),y) -O_OBJS += ip6t_state.o -else - ifeq ($(CONFIG_IP6_NF_MATCH_STATE),m) - M_OBJS += ip6t_state.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_MATCH_UNCLEAN),y) -O_OBJS += ip6t_unclean.o -else - ifeq ($(CONFIG_IP6_NF_MATCH_UNCLEAN),m) - M_OBJS += ip6t_unclean.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_FILTER),y) -O_OBJS += ip6table_filter.o -else - ifeq ($(CONFIG_IP6_NF_FILTER),m) - M_OBJS += ip6table_filter.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_TARGET_REJECT),y) -O_OBJS += ip6t_REJECT.o -else - ifeq ($(CONFIG_IP6_NF_TARGET_REJECT),m) - M_OBJS += ip6t_REJECT.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_TARGET_MIRROR),y) -O_OBJS += ip6t_MIRROR.o -else - ifeq ($(CONFIG_IP6_NF_TARGET_MIRROR),m) - M_OBJS += ip6t_MIRROR.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_TARGET_TOS),y) -O_OBJS += ip6t_TOS.o -else - ifeq ($(CONFIG_IP6_NF_TARGET_TOS),m) - M_OBJS += ip6t_TOS.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_TARGET_MARK),y) -O_OBJS += ip6t_MARK.o -else - ifeq ($(CONFIG_IP6_NF_TARGET_MARK),m) - M_OBJS += ip6t_MARK.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_TARGET_REDIRECT),y) -O_OBJS += ip6t_REDIRECT.o -else - ifeq ($(CONFIG_IP6_NF_TARGET_REDIRECT),m) - M_OBJS += ip6t_REDIRECT.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_TARGET_LOG),y) -O_OBJS += ip6t_LOG.o -else - ifeq ($(CONFIG_IP6_NF_TARGET_LOG),m) - M_OBJS += ip6t_LOG.o - endif -endif - -ifeq ($(CONFIG_IP6_NF_QUEUE),y) -O_OBJS += ip6_queue.o -else - ifeq ($(CONFIG_IP6_NF_QUEUE),m) - M_OBJS += ip6_queue.o - endif -endif +obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o +obj-$(CONFIG_IP6_NF_MATCH_LIMIT) += ip6t_limit.o +obj-$(CONFIG_IP6_NF_MATCH_MARK) += ip6t_mark.o +obj-$(CONFIG_IP6_NF_MATCH_MAC) += ip6t_mac.o +obj-$(CONFIG_IP6_NF_MATCH_MULTIPORT) += ip6t_multiport.o +obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o +obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o include $(TOPDIR)/Rules.make - -ip6_conntrack.o: ip6_conntrack_standalone.o $(IP6_NF_CONNTRACK_OBJ) - $(LD) -r -o $@ $(IP6_NF_CONNTRACK_OBJ) ip6_conntrack_standalone.o - -ip6fwadm.o: ipfwadm_core.o $(IP6_NF_COMPAT_LAYER) - $(LD) -r -o $@ ip6fwadm_core.o $(IP6_NF_COMPAT_LAYER) - -ip6chains.o: ip6chains_core.o $(IP6_NF_COMPAT_LAYER) - $(LD) -r -o $@ ip6chains_core.o $(IP6_NF_COMPAT_LAYER) diff --git a/net/ipx/Makefile b/net/ipx/Makefile index fb55995ae..abb69cc95 100644 --- a/net/ipx/Makefile +++ b/net/ipx/Makefile @@ -10,25 +10,18 @@ # We only get in/to here if CONFIG_IPX = 'y' or 'm' O_TARGET := ipx.o -M_OBJS := -OX_OBJS := af_ipx.o -ifeq ($(CONFIG_IPX),m) - M_OBJS += $(O_TARGET) -endif +export-objs = af_ipx.o af_spx.o -ifeq ($(CONFIG_SYSCTL),y) - O_OBJS += sysctl_net_ipx.o -endif +obj-y := af_ipx.o -ifeq ($(CONFIG_SPX),y) -OX_OBJS += af_spx.o -else - ifeq ($(CONFIG_SPX),m) - MX_OBJS += af_spx.o - endif +ifeq ($(CONFIG_IPX),m) + obj-m += $(O_TARGET) endif +obj-$(CONFIG_SYSCTL) += sysctl_net_ipx.o +obj-$(CONFIG_SPX) += af_spx.o + include $(TOPDIR)/Rules.make tar: diff --git a/net/irda/Makefile b/net/irda/Makefile index 3ab07c88d..cb152e47a 100644 --- a/net/irda/Makefile +++ b/net/irda/Makefile @@ -7,59 +7,39 @@ # # Note 2! The CFLAGS definition is now in the main makefile... -ALL_SUB_DIRS := irlan irnet ircomm compressors -SUB_DIRS := -MOD_SUB_DIRS := -OX_OBJS := - O_TARGET := irda.o -O_OBJS := iriap.o iriap_event.o irlmp.o irlmp_event.o irlmp_frame.o \ + +export-objs := irsyms.o + +obj-y := iriap.o iriap_event.o irlmp.o irlmp_event.o irlmp_frame.o \ irlap.o irlap_event.o irlap_frame.o timer.o qos.o irqueue.o \ irttp.o irda_device.o irias_object.o crc.o wrapper.o af_irda.o \ - discovery.o parameters.o -OX_OBJS := irsyms.o + discovery.o parameters.o irsyms.o ifeq ($(CONFIG_IRDA),m) -M_OBJS := $(O_TARGET) -endif - -ifeq ($(CONFIG_IRDA_COMPRESSION),y) -O_OBJS += irlap_comp.o +obj-m := $(O_TARGET) endif -ifeq ($(CONFIG_PROC_FS),y) -O_OBJS += irproc.o -endif +obj-$(CONFIG_IRDA_COMPRESSION) += irlap_comp.o +obj-$(CONFIG_PROC_FS) += irproc.o +obj-$(CONFIG_SYSCTL) += irsysctl.o +obj-$(CONFIG_IRLAN) += irlan/irlan.o -ifeq ($(CONFIG_SYSCTL),y) -O_OBJS += irsysctl.o -endif +subdir-$(CONFIG_IRLAN) += irlan +subdir-$(CONFIG_IRNET) += irnet +subdir-$(CONFIG_IRCOMM) += ircomm +subdir-$(CONFIG_IRDA_COMPRESSION) += compressors ifeq ($(CONFIG_IRLAN),y) -SUB_DIRS += irlan -O_OBJS += irlan/irlan.o -else - ifeq ($(CONFIG_IRLAN),m) - MOD_SUB_DIRS += irlan - endif +obj-y += irlan/irlan.o endif ifeq ($(CONFIG_IRNET),y) -SUB_DIRS += irnet -O_OBJS += irnet/irnet.o -else - ifeq ($(CONFIG_IRNET),m) - MOD_SUB_DIRS += irnet - endif -endif - -ifeq ($(CONFIG_IRDA_COMPRESSION),y) -SUB_DIRS += compressors -MOD_IN_SUB_DIRS += compressors +obj-y += irnet/irnet.o endif ifeq ($(CONFIG_IRDA_DEFLATE),y) -O_OBJS += compressors/irda_deflate.o +obj-y += compressors/irda_deflate.o else ifeq ($(CONFIG_IRDA_DEFLATE),m) MOD_TO_LIST += irda_deflate.o @@ -67,12 +47,7 @@ else endif ifeq ($(CONFIG_IRCOMM),y) -SUB_DIRS += ircomm -O_OBJS += ircomm/ircomm_and_tty.o -else - ifeq ($(CONFIG_IRCOMM),m) - MOD_SUB_DIRS += ircomm - endif +obj-y += ircomm/ircomm_and_tty.o endif include $(TOPDIR)/Rules.make diff --git a/net/irda/compressors/Makefile b/net/irda/compressors/Makefile index 6d233020f..470b229ce 100644 --- a/net/irda/compressors/Makefile +++ b/net/irda/compressors/Makefile @@ -8,16 +8,11 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := -O_OBJS := -M_OBJS := -ifeq ($(CONFIG_IRDA_DEFLATE),y) -O_OBJS += irda_deflate.o -else - ifeq ($(CONFIG_IRDA_DEFLATE),m) - M_OBJS += irda_deflate.o - endif -endif +obj-y := +obj-m := + +obj-$(CONFIG_IRDA_DEFLATE) += irda_deflate.o include $(TOPDIR)/Rules.make diff --git a/net/irda/ircomm/Makefile b/net/irda/ircomm/Makefile index 89e3294fd..fe0a6a830 100644 --- a/net/irda/ircomm/Makefile +++ b/net/irda/ircomm/Makefile @@ -8,26 +8,18 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := ircomm_and_tty.o -O_OBJS := ircomm_param.o ircomm_core.o ircomm_event.o ircomm_lmp.o ircomm_ttp.o ircomm_tty.o ircomm_tty_attach.o ircomm_tty_ioctl.o -M_OBJS := ircomm.o ircomm-tty.o -MI_OBJS := ircomm_param.o ircomm_core.o ircomm_event.o ircomm_lmp.o ircomm_ttp.o ircomm_tty.o ircomm_tty_attach.o ircomm_tty_ioctl.o -OX_OBJS += +multi-objs := ircomm.o ircomm-tty.o +ircomm-objs := ircomm_core.o ircomm_event.o ircomm_lmp.o ircomm_ttp.o +ircomm-tty-objs := ircomm_tty.o ircomm_tty_attach.o ircomm_tty_ioctl.o ircomm_param.o -# Special rule to build the composite modules - -ifeq ($(CONFIG_IRCOMM),m) -ircomm.o: $(MI_OBJS) - $(LD) $(LD_RFLAG) -r -o $@ ircomm_core.o ircomm_event.o ircomm_lmp.o ircomm_ttp.o - -ircomm-tty.o: $(MI_OBJS) - $(LD) $(LD_RFLAG) -r -o $@ ircomm_tty.o ircomm_tty_attach.o ircomm_tty_ioctl.o ircomm_param.o - - -endif +obj-$(CONFIG_IRCOMM) += ircomm.o ircomm-tty.o include $(TOPDIR)/Rules.make -tar: - tar -cvf /dev/f1 . +ircomm.o: $(ircomm-objs) + $(LD) $(LD_RFLAG) -r -o $@ $(ircomm-objs) + +ircomm-tty.o: $(ircomm-tty-objs) + $(LD) $(LD_RFLAG) -r -o $@ $(ircomm-tty-objs) diff --git a/net/irda/irlan/Makefile b/net/irda/irlan/Makefile index 61285f23c..7ab6b6d37 100644 --- a/net/irda/irlan/Makefile +++ b/net/irda/irlan/Makefile @@ -8,13 +8,8 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := irlan.o -O_OBJS := irlan_common.o irlan_eth.o irlan_event.o irlan_client.o irlan_provider.o irlan_filter.o irlan_provider_event.o irlan_client_event.o -M_OBJS := $(O_TARGET) -MI_OBJS := -OX_OBJS += +obj-y := irlan_common.o irlan_eth.o irlan_event.o irlan_client.o irlan_provider.o irlan_filter.o irlan_provider_event.o irlan_client_event.o +obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make - -tar: - tar -cvf /dev/f1 . diff --git a/net/irda/irnet/Makefile b/net/irda/irnet/Makefile index 50554ac72..ea4c3d3a4 100644 --- a/net/irda/irnet/Makefile +++ b/net/irda/irnet/Makefile @@ -9,14 +9,8 @@ MOD_LIST_NAME := IRDA_MODULES O_TARGET := irnet.o -#O_OBJS := irnet_ppp.o -O_OBJS := irnet_ppp.o irnet_irda.o -M_OBJS := $(O_TARGET) -MI_OBJS := -OX_OBJS += +obj-y := irnet_ppp.o irnet_irda.o +obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make - -tar: - tar -cvf /dev/f1 . diff --git a/net/khttpd/Makefile b/net/khttpd/Makefile index b594de142..a7b2e0221 100644 --- a/net/khttpd/Makefile +++ b/net/khttpd/Makefile @@ -9,17 +9,15 @@ O_TARGET := khttpd.o -M_OBJS := $(O_TARGET) -O_OBJS := main.o accept.o datasending.o logging.o misc.o rfc.o rfc_time.o security.o \ +obj-m := $(O_TARGET) +obj-y := main.o accept.o datasending.o logging.o misc.o rfc.o rfc_time.o security.o \ sockets.o sysctl.o userspace.o waitheaders.o - include $(TOPDIR)/Rules.make rfc_time.o: times.h - make_times_h: make_times_h.c $(HOSTCC) $(HOSTCFLAGS) -o make_times_h make_times_h.c diff --git a/net/lapb/Makefile b/net/lapb/Makefile index 434e79aa0..10745d904 100644 --- a/net/lapb/Makefile +++ b/net/lapb/Makefile @@ -9,10 +9,11 @@ O_TARGET := lapb.o -O_OBJS := lapb_in.o lapb_out.o lapb_subr.o lapb_timer.o -M_OBJS := $(O_TARGET) -OX_OBJS += lapb_iface.o +export-objs := lapb_iface.o + +obj-y := lapb_in.o lapb_out.o lapb_subr.o lapb_timer.o lapb_iface.o +obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make diff --git a/net/netlink/Makefile b/net/netlink/Makefile index da89d0af0..15edc5301 100644 --- a/net/netlink/Makefile +++ b/net/netlink/Makefile @@ -9,17 +9,12 @@ O_TARGET := netlink.o -O_OBJS := -OX_OBJS := af_netlink.o +export-objs := af_netlink.o -M_OBJS := +obj-y := af_netlink.o -ifeq ($(CONFIG_NETLINK_DEV), y) - O_OBJS += netlink_dev.o -endif +obj-m := -ifeq ($(CONFIG_NETLINK_DEV), m) - M_OBJS += netlink_dev.o -endif +obj-$(CONFIG_NETLINK_DEV) += netlink_dev.o include $(TOPDIR)/Rules.make diff --git a/net/netrom/Makefile b/net/netrom/Makefile index 1afcfd8e7..e44e36144 100644 --- a/net/netrom/Makefile +++ b/net/netrom/Makefile @@ -8,13 +8,12 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := netrom.o -O_OBJS := af_netrom.o nr_dev.o nr_in.o nr_loopback.o nr_out.o nr_route.o \ + +obj-y := af_netrom.o nr_dev.o nr_in.o nr_loopback.o nr_out.o nr_route.o \ nr_subr.o nr_timer.o -M_OBJS := $(O_TARGET) +obj-m := $(O_TARGET) -ifeq ($(CONFIG_SYSCTL),y) -O_OBJS += sysctl_net_netrom.o -endif +obj-$(CONFIG_SYSCTL) += sysctl_net_netrom.o include $(TOPDIR)/Rules.make diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index a0c139b3a..a4b89d294 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -34,7 +34,6 @@ */ #include -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #include #include #include @@ -82,7 +81,7 @@ int sysctl_netrom_link_fails_count = NR_DEFAULT_FAILS; static unsigned short circuit = 0x101; -static struct sock *volatile nr_list = NULL; +static struct sock *volatile nr_list; static struct proto_ops nr_proto_ops; @@ -1280,7 +1279,7 @@ static int __init nr_proto_init(void) sock_register(&nr_family_ops); register_netdevice_notifier(&nr_dev_notifier); - printk(KERN_INFO "G4KLX NET/ROM for Linux. Version 0.7 for AX25.037 Linux 2.1\n"); + printk(KERN_INFO "G4KLX NET/ROM for Linux. Version 0.7 for AX25.037 Linux 2.4\n"); ax25_protocol_register(AX25_P_NETROM, nr_route_frame); ax25_linkfail_register(nr_link_failed); @@ -1291,18 +1290,15 @@ static int __init nr_proto_init(void) nr_loopback_init(); -#ifdef CONFIG_PROC_FS proc_net_create("nr", 0, nr_get_info); proc_net_create("nr_neigh", 0, nr_neigh_get_info); proc_net_create("nr_nodes", 0, nr_nodes_get_info); -#endif return 0; } module_init(nr_proto_init); -#ifdef MODULE EXPORT_NO_SYMBOLS; MODULE_PARM(nr_ndevs, "i"); @@ -1311,15 +1307,13 @@ MODULE_PARM_DESC(nr_ndevs, "number of NET/ROM devices"); MODULE_AUTHOR("Jonathan Naylor G4KLX "); MODULE_DESCRIPTION("The amateur radio NET/ROM network and transport layer protocol"); -static void nr_exit(void) +static void __exit nr_exit(void) { int i; -#ifdef CONFIG_PROC_FS proc_net_remove("nr"); proc_net_remove("nr_neigh"); proc_net_remove("nr_nodes"); -#endif nr_loopback_clear(); nr_rt_free(); @@ -1346,8 +1340,3 @@ static void nr_exit(void) kfree(dev_nr); } module_exit(nr_exit); -#endif /* MODULE */ - - - -#endif diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 1625d1c90..d5a472703 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c @@ -19,7 +19,6 @@ */ #include -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #define __NO_VERSION__ #include #include @@ -236,5 +235,3 @@ int nr_init(struct net_device *dev) return 0; }; - -#endif diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c index fadf69de8..29762e929 100644 --- a/net/netrom/nr_in.c +++ b/net/netrom/nr_in.c @@ -24,8 +24,6 @@ * NET/ROM 007 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #include #include #include @@ -304,5 +302,3 @@ int nr_process_rx_frame(struct sock *sk, struct sk_buff *skb) return queued; } - -#endif diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c index fc0665de2..5290ae024 100644 --- a/net/netrom/nr_loopback.c +++ b/net/netrom/nr_loopback.c @@ -15,14 +15,13 @@ * */ -#include -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #include #include #include #include #include #include +#include static struct sk_buff_head loopback_queue; static struct timer_list loopback_timer; @@ -91,9 +90,7 @@ static void nr_loopback_timer(unsigned long param) } } -#ifdef MODULE - -void nr_loopback_clear(void) +void __exit nr_loopback_clear(void) { struct sk_buff *skb; @@ -102,7 +99,3 @@ void nr_loopback_clear(void) while ((skb = skb_dequeue(&loopback_queue)) != NULL) kfree_skb(skb); } - -#endif - -#endif diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c index 93da60adb..090068988 100644 --- a/net/netrom/nr_out.c +++ b/net/netrom/nr_out.c @@ -16,8 +16,6 @@ * NET/ROM 007 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #include #include #include @@ -272,5 +270,3 @@ void nr_check_iframes_acked(struct sock *sk, unsigned short nr) } } } - -#endif diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index 308e73af2..ec0578b51 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c @@ -21,8 +21,6 @@ * Tomi(OH2BNS) Routing quality and link failure changes. */ -#include -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #include #include #include @@ -48,12 +46,13 @@ #include #include #include +#include #include static unsigned int nr_neigh_no = 1; -static struct nr_node *nr_node_list = NULL; -static struct nr_neigh *nr_neigh_list = NULL; +static struct nr_node *nr_node_list; +static struct nr_neigh *nr_neigh_list; static void nr_remove_neigh(struct nr_neigh *); @@ -850,12 +849,10 @@ int nr_neigh_get_info(char *buffer, char **start, off_t offset, int length) return len; } -#ifdef MODULE - /* * Free all memory associated with the nodes and routes lists. */ -void nr_rt_free(void) +void __exit nr_rt_free(void) { struct nr_neigh *s, *nr_neigh = nr_neigh_list; struct nr_node *t, *nr_node = nr_node_list; @@ -874,7 +871,3 @@ void nr_rt_free(void) nr_remove_neigh(s); } } - -#endif - -#endif diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c index 096ca3a8f..fee0478fa 100644 --- a/net/netrom/nr_subr.c +++ b/net/netrom/nr_subr.c @@ -15,8 +15,6 @@ * NET/ROM 007 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #include #include #include @@ -297,5 +295,3 @@ void nr_disconnect(struct sock *sk, int reason) sk->dead = 1; } - -#endif diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c index ac62ad54a..116770434 100644 --- a/net/netrom/nr_timer.c +++ b/net/netrom/nr_timer.c @@ -15,8 +15,6 @@ * Implemented idle timer. */ -#include -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #include #include #include @@ -245,5 +243,3 @@ static void nr_t1timer_expiry(unsigned long param) nr_start_t1timer(sk); } - -#endif diff --git a/net/packet/Makefile b/net/packet/Makefile index 95a98ed95..f17e887c1 100644 --- a/net/packet/Makefile +++ b/net/packet/Makefile @@ -9,15 +9,6 @@ O_TARGET := packet.o -O_OBJS := -M_OBJS := - -ifeq ($(CONFIG_PACKET),y) - O_OBJS += af_packet.o -else - ifeq ($(CONFIG_PACKET), m) - M_OBJS += af_packet.o - endif -endif +obj-$(CONFIG_PACKET) += af_packet.o include $(TOPDIR)/Rules.make diff --git a/net/rose/Makefile b/net/rose/Makefile index de3f1b257..7799143b0 100644 --- a/net/rose/Makefile +++ b/net/rose/Makefile @@ -8,13 +8,12 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := rose.o -O_OBJS := af_rose.o rose_dev.o rose_in.o rose_link.o rose_loopback.o \ + +obj-y := af_rose.o rose_dev.o rose_in.o rose_link.o rose_loopback.o \ rose_out.o rose_route.o rose_subr.o rose_timer.o -M_OBJS := $(O_TARGET) +obj-m := $(O_TARGET) -ifeq ($(CONFIG_SYSCTL),y) -O_OBJS += sysctl_net_rose.o -endif +obj-$(CONFIG_SYSCTL) += sysctl_net_rose.o include $(TOPDIR)/Rules.make diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index f639e578a..a92bf86f5 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -25,7 +25,6 @@ */ #include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #include #include #include @@ -1448,7 +1447,7 @@ static int __init rose_proto_init(void) sock_register(&rose_family_ops); register_netdevice_notifier(&rose_dev_notifier); - printk(KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 for AX25.037 Linux 2.1\n"); + printk(KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 for AX25.037 Linux 2.4\n"); ax25_protocol_register(AX25_P_ROSE, rose_route_frame); ax25_linkfail_register(rose_link_failed); @@ -1460,17 +1459,14 @@ static int __init rose_proto_init(void) rose_add_loopback_neigh(); -#ifdef CONFIG_PROC_FS proc_net_create("rose", 0, rose_get_info); proc_net_create("rose_neigh", 0, rose_neigh_get_info); proc_net_create("rose_nodes", 0, rose_nodes_get_info); proc_net_create("rose_routes", 0, rose_routes_get_info); -#endif return 0; } module_init(rose_proto_init); -#ifdef MODULE EXPORT_NO_SYMBOLS; MODULE_PARM(rose_ndevs, "i"); @@ -1483,12 +1479,10 @@ static void __exit rose_exit(void) { int i; -#ifdef CONFIG_PROC_FS proc_net_remove("rose"); proc_net_remove("rose_neigh"); proc_net_remove("rose_nodes"); proc_net_remove("rose_routes"); -#endif rose_loopback_clear(); rose_rt_free(); @@ -1518,7 +1512,4 @@ static void __exit rose_exit(void) kfree(dev_rose); } module_exit(rose_exit); -#endif /* MODULE */ - -#endif diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c index 88f2d55e7..92ad1e55a 100644 --- a/net/rose/rose_dev.c +++ b/net/rose/rose_dev.c @@ -15,7 +15,6 @@ */ #include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #define __NO_VERSION__ #include #include @@ -205,5 +204,3 @@ int rose_init(struct net_device *dev) return 0; }; - -#endif diff --git a/net/rose/rose_in.c b/net/rose/rose_in.c index be86c9e16..38fb76c1b 100644 --- a/net/rose/rose_in.c +++ b/net/rose/rose_in.c @@ -22,8 +22,6 @@ * Removed M bit processing. */ -#include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #include #include #include @@ -303,5 +301,3 @@ int rose_process_rx_frame(struct sock *sk, struct sk_buff *skb) return queued; } - -#endif diff --git a/net/rose/rose_link.c b/net/rose/rose_link.c index d9b5a4a1d..2c793e4e6 100644 --- a/net/rose/rose_link.c +++ b/net/rose/rose_link.c @@ -14,8 +14,6 @@ * ROSE 003 Jonathan(G4KLX) New timer architecture. */ -#include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #include #include #include @@ -322,5 +320,3 @@ void rose_transmit_link(struct sk_buff *skb, struct rose_neigh *neigh) } } } - -#endif diff --git a/net/rose/rose_loopback.c b/net/rose/rose_loopback.c index 2136fd601..ad00608a3 100644 --- a/net/rose/rose_loopback.c +++ b/net/rose/rose_loopback.c @@ -14,14 +14,13 @@ * */ -#include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #include #include #include #include #include #include +#include static struct sk_buff_head loopback_queue; static struct timer_list loopback_timer; @@ -107,9 +106,7 @@ static void rose_loopback_timer(unsigned long param) } } -#ifdef MODULE - -void rose_loopback_clear(void) +void __exit rose_loopback_clear(void) { struct sk_buff *skb; @@ -120,7 +117,3 @@ void rose_loopback_clear(void) kfree_skb(skb); } } - -#endif - -#endif diff --git a/net/rose/rose_out.c b/net/rose/rose_out.c index aea1d9f68..8f9855df7 100644 --- a/net/rose/rose_out.c +++ b/net/rose/rose_out.c @@ -15,8 +15,6 @@ * Removed M bit processing. */ -#include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #include #include #include @@ -130,5 +128,3 @@ void rose_enquiry_response(struct sock *sk) rose_stop_timer(sk); } - -#endif diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index d5d4de9ec..1bedfdf0d 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -19,8 +19,6 @@ * Added use count to neighbours. */ -#include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #include #include #include @@ -47,15 +45,16 @@ #include #include #include +#include #include static unsigned int rose_neigh_no = 1; -static struct rose_node *rose_node_list = NULL; -static struct rose_neigh *rose_neigh_list = NULL; -static struct rose_route *rose_route_list = NULL; +static struct rose_node *rose_node_list; +static struct rose_neigh *rose_neigh_list; +static struct rose_route *rose_route_list; -struct rose_neigh *rose_loopback_neigh = NULL; +struct rose_neigh *rose_loopback_neigh; static void rose_remove_neigh(struct rose_neigh *); @@ -1126,12 +1125,10 @@ int rose_routes_get_info(char *buffer, char **start, off_t offset, int length) return len; } -#ifdef MODULE - /* * Release all memory associated with ROSE routing structures. */ -void rose_rt_free(void) +void __exit rose_rt_free(void) { struct rose_neigh *s, *rose_neigh = rose_neigh_list; struct rose_node *t, *rose_node = rose_node_list; @@ -1158,7 +1155,3 @@ void rose_rt_free(void) rose_remove_route(u); } } - -#endif - -#endif diff --git a/net/rose/rose_subr.c b/net/rose/rose_subr.c index dc172ac3b..384347a0e 100644 --- a/net/rose/rose_subr.c +++ b/net/rose/rose_subr.c @@ -15,8 +15,6 @@ * ROSE 003 Jonathan(G4KLX) Added use count to neighbours. */ -#include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #include #include #include @@ -528,5 +526,3 @@ void rose_disconnect(struct sock *sk, int reason, int cause, int diagnostic) sk->dead = 1; } - -#endif diff --git a/net/rose/rose_timer.c b/net/rose/rose_timer.c index 718a64ec0..8bd30424d 100644 --- a/net/rose/rose_timer.c +++ b/net/rose/rose_timer.c @@ -15,8 +15,6 @@ * Implemented idle timer. */ -#include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) #include #include #include @@ -207,5 +205,3 @@ static void rose_idletimer_expiry(unsigned long param) sk->dead = 1; } - -#endif diff --git a/net/sched/Makefile b/net/sched/Makefile index de1f71601..95707af00 100644 --- a/net/sched/Makefile +++ b/net/sched/Makefile @@ -9,171 +9,171 @@ O_TARGET := sched.o -O_OBJS := sch_generic.o +obj-y := sch_generic.o ifeq ($(CONFIG_NET_SCHED), y) -O_OBJS += sch_api.o sch_fifo.o +obj-y += sch_api.o sch_fifo.o ifeq ($(CONFIG_NET_ESTIMATOR), y) -O_OBJS += estimator.o +obj-y += estimator.o endif ifeq ($(CONFIG_NET_CLS), y) -O_OBJS += cls_api.o +obj-y += cls_api.o ifeq ($(CONFIG_NET_CLS_POLICE), y) -O_OBJS += police.o +obj-y += police.o endif endif ifeq ($(CONFIG_NET_SCH_INGRESS), y) -O_OBJS += sch_ingress.o +obj-y += sch_ingress.o else ifeq ($(CONFIG_NET_SCH_INGRESS), m) - M_OBJS += sch_ingress.o + obj-m += sch_ingress.o endif endif ifeq ($(CONFIG_NET_SCH_CBQ), y) -O_OBJS += sch_cbq.o +obj-y += sch_cbq.o else ifeq ($(CONFIG_NET_SCH_CBQ), m) - M_OBJS += sch_cbq.o + obj-m += sch_cbq.o endif endif ifeq ($(CONFIG_NET_SCH_CSZ), y) -O_OBJS += sch_csz.o +obj-y += sch_csz.o else ifeq ($(CONFIG_NET_SCH_CSZ), m) - M_OBJS += sch_csz.o + obj-m += sch_csz.o endif endif ifeq ($(CONFIG_NET_SCH_HPFQ), y) -O_OBJS += sch_hpfq.o +obj-y += sch_hpfq.o else ifeq ($(CONFIG_NET_SCH_HPFQ), m) - M_OBJS += sch_hpfq.o + obj-m += sch_hpfq.o endif endif ifeq ($(CONFIG_NET_SCH_HFSC), y) -O_OBJS += sch_hfsc.o +obj-y += sch_hfsc.o else ifeq ($(CONFIG_NET_SCH_HFSC), m) - M_OBJS += sch_hfsc.o + obj-m += sch_hfsc.o endif endif ifeq ($(CONFIG_NET_SCH_SFQ), y) -O_OBJS += sch_sfq.o +obj-y += sch_sfq.o else ifeq ($(CONFIG_NET_SCH_SFQ), m) - M_OBJS += sch_sfq.o + obj-m += sch_sfq.o endif endif ifeq ($(CONFIG_NET_SCH_RED), y) -O_OBJS += sch_red.o +obj-y += sch_red.o else ifeq ($(CONFIG_NET_SCH_RED), m) - M_OBJS += sch_red.o + obj-m += sch_red.o endif endif ifeq ($(CONFIG_NET_SCH_TBF), y) -O_OBJS += sch_tbf.o +obj-y += sch_tbf.o else ifeq ($(CONFIG_NET_SCH_TBF), m) - M_OBJS += sch_tbf.o + obj-m += sch_tbf.o endif endif ifeq ($(CONFIG_NET_SCH_PRIO), y) -O_OBJS += sch_prio.o +obj-y += sch_prio.o else ifeq ($(CONFIG_NET_SCH_PRIO), m) - M_OBJS += sch_prio.o + obj-m += sch_prio.o endif endif ifeq ($(CONFIG_NET_SCH_TEQL), y) -O_OBJS += sch_teql.o +obj-y += sch_teql.o else ifeq ($(CONFIG_NET_SCH_TEQL), m) - M_OBJS += sch_teql.o + obj-m += sch_teql.o endif endif ifeq ($(CONFIG_NET_SCH_GRED), y) -O_OBJS += sch_gred.o +obj-y += sch_gred.o else ifeq ($(CONFIG_NET_SCH_GRED), m) - M_OBJS += sch_gred.o + obj-m += sch_gred.o endif endif ifeq ($(CONFIG_NET_SCH_DSMARK), y) -O_OBJS += sch_dsmark.o +obj-y += sch_dsmark.o else ifeq ($(CONFIG_NET_SCH_DSMARK), m) - M_OBJS += sch_dsmark.o + obj-m += sch_dsmark.o endif endif ifeq ($(CONFIG_NET_CLS_TCINDEX), y) -O_OBJS += cls_tcindex.o +obj-y += cls_tcindex.o else ifeq ($(CONFIG_NET_CLS_TCINDEX), m) - M_OBJS += cls_tcindex.o + obj-m += cls_tcindex.o endif endif ifeq ($(CONFIG_NET_SCH_ATM), y) -O_OBJS += sch_atm.o +obj-y += sch_atm.o endif ifeq ($(CONFIG_NET_CLS_U32), y) -O_OBJS += cls_u32.o +obj-y += cls_u32.o else ifeq ($(CONFIG_NET_CLS_U32), m) - M_OBJS += cls_u32.o + obj-m += cls_u32.o endif endif ifeq ($(CONFIG_NET_CLS_RSVP), y) -O_OBJS += cls_rsvp.o +obj-y += cls_rsvp.o else ifeq ($(CONFIG_NET_CLS_RSVP), m) - M_OBJS += cls_rsvp.o + obj-m += cls_rsvp.o endif endif ifeq ($(CONFIG_NET_CLS_RSVP6), y) -O_OBJS += cls_rsvp6.o +obj-y += cls_rsvp6.o else ifeq ($(CONFIG_NET_CLS_RSVP6), m) - M_OBJS += cls_rsvp6.o + obj-m += cls_rsvp6.o endif endif ifeq ($(CONFIG_NET_CLS_ROUTE4), y) -O_OBJS += cls_route.o +obj-y += cls_route.o else ifeq ($(CONFIG_NET_CLS_ROUTE4), m) - M_OBJS += cls_route.o + obj-m += cls_route.o endif endif ifeq ($(CONFIG_NET_CLS_FW), y) -O_OBJS += cls_fw.o +obj-y += cls_fw.o else ifeq ($(CONFIG_NET_CLS_FW), m) - M_OBJS += cls_fw.o + obj-m += cls_fw.o endif endif diff --git a/net/sunrpc/Makefile b/net/sunrpc/Makefile index ef5030354..19e7e4d4f 100644 --- a/net/sunrpc/Makefile +++ b/net/sunrpc/Makefile @@ -8,20 +8,17 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := sunrpc.o -O_OBJS := clnt.o xprt.o sched.o \ + +export-objs := sunrpc_syms.o + +obj-y := clnt.o xprt.o sched.o \ auth.o auth_null.o auth_unix.o \ svc.o svcsock.o svcauth.o \ - pmap_clnt.o xdr.o -OX_OBJS := sunrpc_syms.o - -ifeq ($(CONFIG_PROC_FS),y) - O_OBJS += stats.o -endif + pmap_clnt.o xdr.o sunrpc_syms.o -ifeq ($(CONFIG_SYSCTL),y) - O_OBJS += sysctl.o -endif +obj-$(CONFIG_PROC_FS) += stats.o +obj-$(CONFIG_SYSCTL) += sysctl.o -M_OBJS := $(O_TARGET) +obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make diff --git a/net/unix/Makefile b/net/unix/Makefile index a335b486d..88a262671 100644 --- a/net/unix/Makefile +++ b/net/unix/Makefile @@ -8,12 +8,11 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := unix.o -O_OBJS := af_unix.o garbage.o -M_OBJS := $(O_TARGET) -ifeq ($(CONFIG_SYSCTL),y) -O_OBJS += sysctl_net_unix.o -endif +obj-y := af_unix.o garbage.o +obj-m := $(O_TARGET) + +obj-$(CONFIG_SYSCTL) += sysctl_net_unix.o include $(TOPDIR)/Rules.make diff --git a/net/wanrouter/Makefile b/net/wanrouter/Makefile index beafe5059..1a2ec4cc1 100644 --- a/net/wanrouter/Makefile +++ b/net/wanrouter/Makefile @@ -8,9 +8,11 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := wanrouter.o -OX_OBJS := wanmain.o -O_OBJS := wanproc.o -M_OBJS := $(O_TARGET) + +export-objs := wanmain.o + +obj-y := wanproc.o wanmain.o +obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make diff --git a/net/x25/Makefile b/net/x25/Makefile index 3341a8003..0890eff84 100644 --- a/net/x25/Makefile +++ b/net/x25/Makefile @@ -8,13 +8,12 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := x25.o -O_OBJS := af_x25.o x25_dev.o x25_facilities.o x25_in.o x25_link.o x25_out.o \ + +obj-y := af_x25.o x25_dev.o x25_facilities.o x25_in.o x25_link.o x25_out.o \ x25_route.o x25_subr.o x25_timer.o -M_OBJS := $(O_TARGET) +obj-m := $(O_TARGET) -ifeq ($(CONFIG_SYSCTL),y) -O_OBJS += sysctl_net_x25.o -endif +obj-$(CONFIG_SYSCTL) += sysctl_net_x25.o include $(TOPDIR)/Rules.make diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 8d42109d8..c8f8c3e97 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -29,7 +29,6 @@ */ #include -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include #include #include @@ -65,7 +64,7 @@ int sysctl_x25_reset_request_timeout = X25_DEFAULT_T22; int sysctl_x25_clear_request_timeout = X25_DEFAULT_T23; int sysctl_x25_ack_holdback_timeout = X25_DEFAULT_T2; -static struct sock *volatile x25_list = NULL; +static struct sock *volatile x25_list /* = NULL initially */; static struct proto_ops x25_proto_ops; @@ -1329,10 +1328,8 @@ static int __init x25_init(void) x25_register_sysctl(); #endif -#ifdef CONFIG_PROC_FS proc_net_create("x25", 0, x25_get_info); proc_net_create("x25_routes", 0, x25_routes_get_info); -#endif #ifdef MODULE /* @@ -1355,7 +1352,6 @@ module_init(x25_init); -#ifdef MODULE EXPORT_NO_SYMBOLS; MODULE_AUTHOR("Jonathan Naylor "); @@ -1364,10 +1360,8 @@ MODULE_DESCRIPTION("The X.25 Packet Layer network layer protocol"); static void __exit x25_exit(void) { -#ifdef CONFIG_PROC_FS proc_net_remove("x25"); proc_net_remove("x25_routes"); -#endif x25_link_free(); x25_route_free(); @@ -1383,6 +1377,4 @@ static void __exit x25_exit(void) sock_unregister(AF_X25); } module_exit(x25_exit); -#endif -#endif -- cgit v1.2.3