diff options
Diffstat (limited to 'net/tipc/eth_media.c')
| -rw-r--r-- | net/tipc/eth_media.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 7a252785f727..682da4a28041 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * net/tipc/eth_media.c: Ethernet bearer support for TIPC | 2 | * net/tipc/eth_media.c: Ethernet bearer support for TIPC |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2001-2006, Ericsson AB | 4 | * Copyright (c) 2001-2006, Ericsson AB |
| 5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005-2006, Wind River Systems |
| 6 | * All rights reserved. | 6 | * All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| @@ -98,17 +98,19 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, | |||
| 98 | u32 size; | 98 | u32 size; |
| 99 | 99 | ||
| 100 | if (likely(eb_ptr->bearer)) { | 100 | if (likely(eb_ptr->bearer)) { |
| 101 | size = msg_size((struct tipc_msg *)buf->data); | 101 | if (likely(!dev->promiscuity) || |
| 102 | skb_trim(buf, size); | 102 | !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || |
| 103 | if (likely(buf->len == size)) { | 103 | !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { |
| 104 | buf->next = NULL; | 104 | size = msg_size((struct tipc_msg *)buf->data); |
| 105 | tipc_recv_msg(buf, eb_ptr->bearer); | 105 | skb_trim(buf, size); |
| 106 | } else { | 106 | if (likely(buf->len == size)) { |
| 107 | kfree_skb(buf); | 107 | buf->next = NULL; |
| 108 | tipc_recv_msg(buf, eb_ptr->bearer); | ||
| 109 | return TIPC_OK; | ||
| 110 | } | ||
| 108 | } | 111 | } |
| 109 | } else { | ||
| 110 | kfree_skb(buf); | ||
| 111 | } | 112 | } |
| 113 | kfree_skb(buf); | ||
| 112 | return TIPC_OK; | 114 | return TIPC_OK; |
| 113 | } | 115 | } |
| 114 | 116 | ||
| @@ -125,8 +127,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) | |||
| 125 | 127 | ||
| 126 | /* Find device with specified name */ | 128 | /* Find device with specified name */ |
| 127 | 129 | ||
| 128 | while (dev && dev->name && | 130 | while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) { |
| 129 | (memcmp(dev->name, driver_name, strlen(dev->name)))) { | ||
| 130 | dev = dev->next; | 131 | dev = dev->next; |
| 131 | } | 132 | } |
| 132 | if (!dev) | 133 | if (!dev) |
| @@ -252,7 +253,9 @@ int tipc_eth_media_start(void) | |||
| 252 | if (eth_started) | 253 | if (eth_started) |
| 253 | return -EINVAL; | 254 | return -EINVAL; |
| 254 | 255 | ||
| 255 | memset(&bcast_addr, 0xff, sizeof(bcast_addr)); | 256 | bcast_addr.type = htonl(TIPC_MEDIA_TYPE_ETH); |
| 257 | memset(&bcast_addr.dev_addr, 0xff, ETH_ALEN); | ||
| 258 | |||
| 256 | memset(eth_bearers, 0, sizeof(eth_bearers)); | 259 | memset(eth_bearers, 0, sizeof(eth_bearers)); |
| 257 | 260 | ||
| 258 | res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", | 261 | res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", |
