summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-05 06:47:02 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-05 06:47:02 +0000
commit99a7e12f34b3661a0d1354eef83a0eef4df5e34c (patch)
tree3560aca9ca86792f9ab7bd87861ea143a1b3c7a3 /net/core
parente73a04659c0b8cdee4dd40e58630e2cf63afb316 (diff)
Merge with Linux 2.3.38.
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c38
-rw-r--r--net/core/filter.c2
-rw-r--r--net/core/netfilter.c10
-rw-r--r--net/core/skbuff.c122
-rw-r--r--net/core/sock.c2
5 files changed, 82 insertions, 92 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 64c13ed05..698a59cfc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -55,7 +55,7 @@
* Adam Sulmicki : Bug Fix : Network Device Unload
* A network device unload needs to purge
* the backlog queue.
- * Paul Rusty Russel : SIOCSIFNAME
+ * Paul Rusty Russell : SIOCSIFNAME
*/
#include <asm/uaccess.h>
@@ -87,9 +87,9 @@
#include <net/profile.h>
#include <linux/init.h>
#include <linux/kmod.h>
-#ifdef CONFIG_NET_RADIO
-#include <linux/wireless.h>
-#endif /* CONFIG_NET_RADIO */
+#if defined(CONFIG_NET_RADIO) || defined(CONFIG_NET_PCMCIA_RADIO)
+#include <linux/wireless.h> /* Note : will define WIRELESS_EXT */
+#endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
#ifdef CONFIG_PLIP
extern int plip_init(void);
#endif
@@ -860,7 +860,11 @@ void netif_rx(struct sk_buff *skb)
#ifdef CONFIG_BRIDGE
static inline void handle_bridge(struct sk_buff *skb, unsigned short type)
{
- if (br_stats.flags & BR_UP && br_protocol_ok(ntohs(type)))
+ /*
+ * The br_stats.flags is checked here to save the expense of a
+ * function call.
+ */
+ if ((br_stats.flags & BR_UP) && br_call_bridge(skb, type))
{
/*
* We pass the bridge a complete frame. This means
@@ -884,7 +888,6 @@ static inline void handle_bridge(struct sk_buff *skb, unsigned short type)
}
#endif
-
/*
* When we are called the queue is ready to grab, the interrupts are
* on and hardware can interrupt and queue to the receive queue as we
@@ -1307,7 +1310,7 @@ static int dev_proc_stats(char *buffer, char **start, off_t offset,
#endif /* CONFIG_PROC_FS */
-#ifdef CONFIG_NET_RADIO
+#ifdef WIRELESS_EXT
#ifdef CONFIG_PROC_FS
/*
@@ -1392,7 +1395,7 @@ static int dev_get_wireless_info(char * buffer, char **start, off_t offset,
return len;
}
#endif /* CONFIG_PROC_FS */
-#endif /* CONFIG_NET_RADIO */
+#endif /* WIRELESS_EXT */
void dev_set_promiscuity(struct net_device *dev, int inc)
{
@@ -1624,13 +1627,13 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
return -EOPNOTSUPP;
}
-#ifdef CONFIG_NET_RADIO
+#ifdef WIRELESS_EXT
if(cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
if (dev->do_ioctl)
return dev->do_ioctl(dev, ifr, cmd);
return -EOPNOTSUPP;
}
-#endif /* CONFIG_NET_RADIO */
+#endif /* WIRELESS_EXT */
}
return -EINVAL;
@@ -1754,7 +1757,7 @@ int dev_ioctl(unsigned int cmd, void *arg)
return -EFAULT;
return ret;
}
-#ifdef CONFIG_NET_RADIO
+#ifdef WIRELESS_EXT
if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
dev_load(ifr.ifr_name);
if (IW_IS_SET(cmd)) {
@@ -1769,7 +1772,7 @@ int dev_ioctl(unsigned int cmd, void *arg)
return -EFAULT;
return ret;
}
-#endif /* CONFIG_NET_RADIO */
+#endif /* WIRELESS_EXT */
return -EINVAL;
}
}
@@ -2083,9 +2086,9 @@ int __init net_dev_init(void)
#ifdef CONFIG_PROC_FS
proc_net_create("dev", 0, dev_get_info);
create_proc_read_entry("net/dev_stat", 0, 0, dev_proc_stats, NULL);
-#ifdef CONFIG_NET_RADIO
+#ifdef WIRELESS_EXT
proc_net_create("wireless", 0, dev_get_wireless_info);
-#endif /* CONFIG_NET_RADIO */
+#endif /* WIRELESS_EXT */
#endif /* CONFIG_PROC_FS */
init_bh(NET_BH, net_bh);
@@ -2095,6 +2098,13 @@ int __init net_dev_init(void)
dst_init();
dev_mcast_init();
+#ifdef CONFIG_BRIDGE
+ /*
+ * Register any statically linked ethernet devices with the bridge
+ */
+ br_spacedevice_register();
+#endif
+
/*
* Initialise network devices
*/
diff --git a/net/core/filter.c b/net/core/filter.c
index d9939e3a4..8749e8c7b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2,7 +2,7 @@
* Linux Socket Filter - Kernel level socket filtering
*
* Author:
- * Jay Schulist <Jay.Schulist@spacs.k12.wi.us>
+ * Jay Schulist <jschlst@turbolinux.com>
*
* Based on the design of:
* - The Berkeley Packet Filter
diff --git a/net/core/netfilter.c b/net/core/netfilter.c
index 91c46a9ef..bf734a60e 100644
--- a/net/core/netfilter.c
+++ b/net/core/netfilter.c
@@ -353,11 +353,12 @@ static unsigned int nf_iterate(struct list_head *head,
int hook,
const struct net_device *indev,
const struct net_device *outdev,
- struct list_head **i)
+ struct list_head **i,
+ int (*okfn)(struct sk_buff *))
{
for (*i = (*i)->next; *i != head; *i = (*i)->next) {
struct nf_hook_ops *elem = (struct nf_hook_ops *)*i;
- switch (elem->hook(hook, skb, indev, outdev)) {
+ switch (elem->hook(hook, skb, indev, outdev, okfn)) {
case NF_QUEUE:
NFDEBUG("nf_iterate: NF_QUEUE for %p.\n", *skb);
return NF_QUEUE;
@@ -471,7 +472,7 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
read_lock_bh(&nf_lock);
elem = &nf_hooks[pf][hook];
verdict = nf_iterate(&nf_hooks[pf][hook], &skb, hook, indev,
- outdev, &elem);
+ outdev, &elem, okfn);
if (verdict == NF_QUEUE) {
NFDEBUG("nf_hook: Verdict = QUEUE.\n");
nf_queue(skb, elem, pf, hook, indev, outdev, okfn);
@@ -553,7 +554,8 @@ void nf_reinject(struct sk_buff *skb, unsigned long mark, unsigned int verdict)
skb->nfmark = mark;
verdict = nf_iterate(&nf_hooks[info->pf][info->hook],
&skb, info->hook,
- info->indev, info->outdev, &elem);
+ info->indev, info->outdev, &elem,
+ info->okfn);
}
if (verdict == NF_QUEUE) {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7c8a332e2..12a8f8d72 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4,7 +4,7 @@
* Authors: Alan Cox <iiitac@pyr.swan.ac.uk>
* Florian La Roche <rzsfl@rz.uni-sb.de>
*
- * Version: $Id: skbuff.c,v 1.60 1999/08/23 07:02:01 davem Exp $
+ * Version: $Id: skbuff.c,v 1.63 2000/01/02 09:15:17 davem Exp $
*
* Fixes:
* Alan Cox : Fixed the worst of the load balancer bugs.
@@ -275,14 +275,48 @@ struct sk_buff *skb_clone(struct sk_buff *skb, int gfp_mask)
return n;
}
+static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
+{
+ /*
+ * Shift between the two data areas in bytes
+ */
+ unsigned long offset = new->data - old->data;
+
+ new->list=NULL;
+ new->sk=NULL;
+ new->dev=old->dev;
+ new->rx_dev=NULL;
+ new->priority=old->priority;
+ new->protocol=old->protocol;
+ new->dst=dst_clone(old->dst);
+ new->h.raw=old->h.raw+offset;
+ new->nh.raw=old->nh.raw+offset;
+ new->mac.raw=old->mac.raw+offset;
+ memcpy(new->cb, old->cb, sizeof(old->cb));
+ new->used=old->used;
+ new->is_clone=0;
+ atomic_set(&new->users, 1);
+ new->pkt_type=old->pkt_type;
+ new->stamp=old->stamp;
+ new->destructor = NULL;
+ new->security=old->security;
+#ifdef CONFIG_NETFILTER
+ new->nfmark=old->nfmark;
+ new->nfreason=old->nfreason;
+ new->nfcache=old->nfcache;
+#ifdef CONFIG_NETFILTER_DEBUG
+ new->nf_debug=old->nf_debug;
+#endif
+#endif
+}
+
/*
* This is slower, and copies the whole data area
*/
-struct sk_buff *skb_copy(struct sk_buff *skb, int gfp_mask)
+struct sk_buff *skb_copy(const struct sk_buff *skb, int gfp_mask)
{
struct sk_buff *n;
- unsigned long offset;
/*
* Allocate the copy buffer
@@ -292,12 +326,6 @@ struct sk_buff *skb_copy(struct sk_buff *skb, int gfp_mask)
if(n==NULL)
return NULL;
- /*
- * Shift between the two data areas in bytes
- */
-
- offset=n->head-skb->head;
-
/* Set the data pointer */
skb_reserve(n,skb->data-skb->head);
/* Set the tail pointer and length */
@@ -305,86 +333,36 @@ struct sk_buff *skb_copy(struct sk_buff *skb, int gfp_mask)
/* Copy the bytes */
memcpy(n->head,skb->head,skb->end-skb->head);
n->csum = skb->csum;
- n->list=NULL;
- n->sk=NULL;
- n->dev=skb->dev;
- n->rx_dev=NULL;
- n->priority=skb->priority;
- n->protocol=skb->protocol;
- n->dst=dst_clone(skb->dst);
- n->h.raw=skb->h.raw+offset;
- n->nh.raw=skb->nh.raw+offset;
- n->mac.raw=skb->mac.raw+offset;
- memcpy(n->cb, skb->cb, sizeof(skb->cb));
- n->used=skb->used;
- n->is_clone=0;
- atomic_set(&n->users, 1);
- n->pkt_type=skb->pkt_type;
- n->stamp=skb->stamp;
- n->destructor = NULL;
- n->security=skb->security;
-#ifdef CONFIG_NETFILTER
- n->nfmark=skb->nfmark;
- n->nfreason=skb->nfreason;
- n->nfcache=skb->nfcache;
-#ifdef CONFIG_NETFILTER_DEBUG
- n->nf_debug=skb->nf_debug;
-#endif
-#endif
+ copy_skb_header(n, skb);
+
return n;
}
-struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, int newheadroom)
+struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
+ int newheadroom,
+ int newtailroom,
+ int gfp_mask)
{
struct sk_buff *n;
- unsigned long offset;
/*
* Allocate the copy buffer
*/
- n=alloc_skb((skb->end-skb->data)+newheadroom, GFP_ATOMIC);
+ n=alloc_skb(newheadroom + (skb->tail - skb->data) + newtailroom,
+ gfp_mask);
if(n==NULL)
return NULL;
skb_reserve(n,newheadroom);
- /*
- * Shift between the two data areas in bytes
- */
-
- offset=n->data-skb->data;
-
/* Set the tail pointer and length */
skb_put(n,skb->len);
- /* Copy the bytes */
- memcpy(n->data,skb->data,skb->len);
- n->list=NULL;
- n->sk=NULL;
- n->priority=skb->priority;
- n->protocol=skb->protocol;
- n->dev=skb->dev;
- n->rx_dev=NULL;
- n->dst=dst_clone(skb->dst);
- n->h.raw=skb->h.raw+offset;
- n->nh.raw=skb->nh.raw+offset;
- n->mac.raw=skb->mac.raw+offset;
- memcpy(n->cb, skb->cb, sizeof(skb->cb));
- n->used=skb->used;
- n->is_clone=0;
- atomic_set(&n->users, 1);
- n->pkt_type=skb->pkt_type;
- n->stamp=skb->stamp;
- n->destructor = NULL;
- n->security=skb->security;
-#ifdef CONFIG_NETFILTER
- n->nfmark=skb->nfmark;
- n->nfreason=skb->nfreason;
- n->nfcache=skb->nfcache;
-#ifdef CONFIG_NETFILTER_DEBUG
- n->nf_debug=skb->nf_debug;
-#endif
-#endif
+
+ /* Copy the data only. */
+ memcpy(n->data, skb->data, skb->len);
+
+ copy_skb_header(n, skb);
return n;
}
diff --git a/net/core/sock.c b/net/core/sock.c
index 15b0ec64f..e069ca898 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.86 1999/09/01 08:11:49 davem Exp $
+ * Version: $Id: sock.c,v 1.87 1999/11/23 08:56:59 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>