aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c35
-rw-r--r--net/wanrouter/wanmain.c27
2 files changed, 13 insertions, 49 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 01993ad74e76..600bb23c4c2e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1939,22 +1939,6 @@ int netif_rx_ni(struct sk_buff *skb)
1939 1939
1940EXPORT_SYMBOL(netif_rx_ni); 1940EXPORT_SYMBOL(netif_rx_ni);
1941 1941
1942static inline struct net_device *skb_bond(struct sk_buff *skb)
1943{
1944 struct net_device *dev = skb->dev;
1945
1946 if (dev->master) {
1947 if (skb_bond_should_drop(skb)) {
1948 kfree_skb(skb);
1949 return NULL;
1950 }
1951 skb->dev = dev->master;
1952 }
1953
1954 return dev;
1955}
1956
1957
1958static void net_tx_action(struct softirq_action *h) 1942static void net_tx_action(struct softirq_action *h)
1959{ 1943{
1960 struct softnet_data *sd = &__get_cpu_var(softnet_data); 1944 struct softnet_data *sd = &__get_cpu_var(softnet_data);
@@ -2181,6 +2165,7 @@ int netif_receive_skb(struct sk_buff *skb)
2181{ 2165{
2182 struct packet_type *ptype, *pt_prev; 2166 struct packet_type *ptype, *pt_prev;
2183 struct net_device *orig_dev; 2167 struct net_device *orig_dev;
2168 struct net_device *null_or_orig;
2184 int ret = NET_RX_DROP; 2169 int ret = NET_RX_DROP;
2185 __be16 type; 2170 __be16 type;
2186 2171
@@ -2194,10 +2179,14 @@ int netif_receive_skb(struct sk_buff *skb)
2194 if (!skb->iif) 2179 if (!skb->iif)
2195 skb->iif = skb->dev->ifindex; 2180 skb->iif = skb->dev->ifindex;
2196 2181
2197 orig_dev = skb_bond(skb); 2182 null_or_orig = NULL;
2198 2183 orig_dev = skb->dev;
2199 if (!orig_dev) 2184 if (orig_dev->master) {
2200 return NET_RX_DROP; 2185 if (skb_bond_should_drop(skb))
2186 null_or_orig = orig_dev; /* deliver only exact match */
2187 else
2188 skb->dev = orig_dev->master;
2189 }
2201 2190
2202 __get_cpu_var(netdev_rx_stat).total++; 2191 __get_cpu_var(netdev_rx_stat).total++;
2203 2192
@@ -2221,7 +2210,8 @@ int netif_receive_skb(struct sk_buff *skb)
2221#endif 2210#endif
2222 2211
2223 list_for_each_entry_rcu(ptype, &ptype_all, list) { 2212 list_for_each_entry_rcu(ptype, &ptype_all, list) {
2224 if (!ptype->dev || ptype->dev == skb->dev) { 2213 if (ptype->dev == null_or_orig || ptype->dev == skb->dev ||
2214 ptype->dev == orig_dev) {
2225 if (pt_prev) 2215 if (pt_prev)
2226 ret = deliver_skb(skb, pt_prev, orig_dev); 2216 ret = deliver_skb(skb, pt_prev, orig_dev);
2227 pt_prev = ptype; 2217 pt_prev = ptype;
@@ -2246,7 +2236,8 @@ ncls:
2246 list_for_each_entry_rcu(ptype, 2236 list_for_each_entry_rcu(ptype,
2247 &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) { 2237 &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) {
2248 if (ptype->type == type && 2238 if (ptype->type == type &&
2249 (!ptype->dev || ptype->dev == skb->dev)) { 2239 (ptype->dev == null_or_orig || ptype->dev == skb->dev ||
2240 ptype->dev == orig_dev)) {
2250 if (pt_prev) 2241 if (pt_prev)
2251 ret = deliver_skb(skb, pt_prev, orig_dev); 2242 ret = deliver_skb(skb, pt_prev, orig_dev);
2252 pt_prev = ptype; 2243 pt_prev = ptype;
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index b210a88d0960..7f07152bc109 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -57,7 +57,6 @@
57#include <linux/vmalloc.h> /* vmalloc, vfree */ 57#include <linux/vmalloc.h> /* vmalloc, vfree */
58#include <asm/uaccess.h> /* copy_to/from_user */ 58#include <asm/uaccess.h> /* copy_to/from_user */
59#include <linux/init.h> /* __initfunc et al. */ 59#include <linux/init.h> /* __initfunc et al. */
60#include <net/syncppp.h>
61 60
62#define KMEM_SAFETYZONE 8 61#define KMEM_SAFETYZONE 8
63 62
@@ -567,9 +566,6 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
567{ 566{
568 wanif_conf_t *cnf; 567 wanif_conf_t *cnf;
569 struct net_device *dev = NULL; 568 struct net_device *dev = NULL;
570#ifdef CONFIG_WANPIPE_MULTPPP
571 struct ppp_device *pppdev=NULL;
572#endif
573 int err; 569 int err;
574 570
575 if ((wandev->state == WAN_UNCONFIGURED) || (wandev->new_if == NULL)) 571 if ((wandev->state == WAN_UNCONFIGURED) || (wandev->new_if == NULL))
@@ -588,25 +584,10 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
588 goto out; 584 goto out;
589 585
590 if (cnf->config_id == WANCONFIG_MPPP) { 586 if (cnf->config_id == WANCONFIG_MPPP) {
591#ifdef CONFIG_WANPIPE_MULTPPP
592 pppdev = kzalloc(sizeof(struct ppp_device), GFP_KERNEL);
593 err = -ENOBUFS;
594 if (pppdev == NULL)
595 goto out;
596 pppdev->dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
597 if (pppdev->dev == NULL) {
598 kfree(pppdev);
599 err = -ENOBUFS;
600 goto out;
601 }
602 err = wandev->new_if(wandev, (struct net_device *)pppdev, cnf);
603 dev = pppdev->dev;
604#else
605 printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n", 587 printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n",
606 wandev->name); 588 wandev->name);
607 err = -EPROTONOSUPPORT; 589 err = -EPROTONOSUPPORT;
608 goto out; 590 goto out;
609#endif
610 } else { 591 } else {
611 dev = kzalloc(sizeof(struct net_device), GFP_KERNEL); 592 dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
612 err = -ENOBUFS; 593 err = -ENOBUFS;
@@ -661,17 +642,9 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
661 kfree(dev->priv); 642 kfree(dev->priv);
662 dev->priv = NULL; 643 dev->priv = NULL;
663 644
664#ifdef CONFIG_WANPIPE_MULTPPP
665 if (cnf->config_id == WANCONFIG_MPPP)
666 kfree(pppdev);
667 else
668 kfree(dev);
669#else
670 /* Sync PPP is disabled */ 645 /* Sync PPP is disabled */
671 if (cnf->config_id != WANCONFIG_MPPP) 646 if (cnf->config_id != WANCONFIG_MPPP)
672 kfree(dev); 647 kfree(dev);
673#endif
674
675out: 648out:
676 kfree(cnf); 649 kfree(cnf);
677 return err; 650 return err;