diff options
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d95e2626d944..d4a1ec3bded5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -116,6 +116,7 @@ | |||
| 116 | #include <linux/audit.h> | 116 | #include <linux/audit.h> |
| 117 | #include <linux/dmaengine.h> | 117 | #include <linux/dmaengine.h> |
| 118 | #include <linux/err.h> | 118 | #include <linux/err.h> |
| 119 | #include <linux/ctype.h> | ||
| 119 | 120 | ||
| 120 | /* | 121 | /* |
| 121 | * The list of packet types we will receive (as opposed to discard) | 122 | * The list of packet types we will receive (as opposed to discard) |
| @@ -632,14 +633,22 @@ struct net_device * dev_get_by_flags(unsigned short if_flags, unsigned short mas | |||
| 632 | * @name: name string | 633 | * @name: name string |
| 633 | * | 634 | * |
| 634 | * Network device names need to be valid file names to | 635 | * Network device names need to be valid file names to |
| 635 | * to allow sysfs to work | 636 | * to allow sysfs to work. We also disallow any kind of |
| 637 | * whitespace. | ||
| 636 | */ | 638 | */ |
| 637 | int dev_valid_name(const char *name) | 639 | int dev_valid_name(const char *name) |
| 638 | { | 640 | { |
| 639 | return !(*name == '\0' | 641 | if (*name == '\0') |
| 640 | || !strcmp(name, ".") | 642 | return 0; |
| 641 | || !strcmp(name, "..") | 643 | if (!strcmp(name, ".") || !strcmp(name, "..")) |
| 642 | || strchr(name, '/')); | 644 | return 0; |
| 645 | |||
| 646 | while (*name) { | ||
| 647 | if (*name == '/' || isspace(*name)) | ||
| 648 | return 0; | ||
| 649 | name++; | ||
| 650 | } | ||
| 651 | return 1; | ||
| 643 | } | 652 | } |
| 644 | 653 | ||
| 645 | /** | 654 | /** |
| @@ -1619,26 +1628,10 @@ static inline struct net_device *skb_bond(struct sk_buff *skb) | |||
| 1619 | struct net_device *dev = skb->dev; | 1628 | struct net_device *dev = skb->dev; |
| 1620 | 1629 | ||
| 1621 | if (dev->master) { | 1630 | if (dev->master) { |
| 1622 | /* | 1631 | if (skb_bond_should_drop(skb)) { |
| 1623 | * On bonding slaves other than the currently active | ||
| 1624 | * slave, suppress duplicates except for 802.3ad | ||
| 1625 | * ETH_P_SLOW and alb non-mcast/bcast. | ||
| 1626 | */ | ||
| 1627 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | ||
| 1628 | if (dev->master->priv_flags & IFF_MASTER_ALB) { | ||
| 1629 | if (skb->pkt_type != PACKET_BROADCAST && | ||
| 1630 | skb->pkt_type != PACKET_MULTICAST) | ||
| 1631 | goto keep; | ||
| 1632 | } | ||
| 1633 | |||
| 1634 | if (dev->master->priv_flags & IFF_MASTER_8023AD && | ||
| 1635 | skb->protocol == __constant_htons(ETH_P_SLOW)) | ||
| 1636 | goto keep; | ||
| 1637 | |||
| 1638 | kfree_skb(skb); | 1632 | kfree_skb(skb); |
| 1639 | return NULL; | 1633 | return NULL; |
| 1640 | } | 1634 | } |
| 1641 | keep: | ||
| 1642 | skb->dev = dev->master; | 1635 | skb->dev = dev->master; |
| 1643 | } | 1636 | } |
| 1644 | 1637 | ||
