aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/eth_media.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/eth_media.c')
-rw-r--r--net/tipc/eth_media.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 1bdc6df0a79e..06488195f998 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -77,12 +77,13 @@ static struct notifier_block notifier = {
77 * Media-dependent "value" field stores MAC address in first 6 bytes 77 * Media-dependent "value" field stores MAC address in first 6 bytes
78 * and zeroes out the remaining bytes. 78 * and zeroes out the remaining bytes.
79 */ 79 */
80static void eth_media_addr_set(struct tipc_media_addr *a, char *mac) 80static void eth_media_addr_set(const struct tipc_bearer *tb_ptr,
81 struct tipc_media_addr *a, char *mac)
81{ 82{
82 memcpy(a->value, mac, ETH_ALEN); 83 memcpy(a->value, mac, ETH_ALEN);
83 memset(a->value + ETH_ALEN, 0, sizeof(a->value) - ETH_ALEN); 84 memset(a->value + ETH_ALEN, 0, sizeof(a->value) - ETH_ALEN);
84 a->media_id = TIPC_MEDIA_TYPE_ETH; 85 a->media_id = TIPC_MEDIA_TYPE_ETH;
85 a->broadcast = !memcmp(mac, eth_media_info.bcast_addr.value, ETH_ALEN); 86 a->broadcast = !memcmp(mac, tb_ptr->bcast_addr.value, ETH_ALEN);
86} 87}
87 88
88/** 89/**
@@ -201,9 +202,13 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
201 /* Associate TIPC bearer with Ethernet bearer */ 202 /* Associate TIPC bearer with Ethernet bearer */
202 eb_ptr->bearer = tb_ptr; 203 eb_ptr->bearer = tb_ptr;
203 tb_ptr->usr_handle = (void *)eb_ptr; 204 tb_ptr->usr_handle = (void *)eb_ptr;
205 memset(tb_ptr->bcast_addr.value, 0, sizeof(tb_ptr->bcast_addr.value));
206 memcpy(tb_ptr->bcast_addr.value, dev->broadcast, ETH_ALEN);
207 tb_ptr->bcast_addr.media_id = TIPC_MEDIA_TYPE_ETH;
208 tb_ptr->bcast_addr.broadcast = 1;
204 tb_ptr->mtu = dev->mtu; 209 tb_ptr->mtu = dev->mtu;
205 tb_ptr->blocked = 0; 210 tb_ptr->blocked = 0;
206 eth_media_addr_set(&tb_ptr->addr, (char *)dev->dev_addr); 211 eth_media_addr_set(tb_ptr, &tb_ptr->addr, (char *)dev->dev_addr);
207 return 0; 212 return 0;
208} 213}
209 214
@@ -315,12 +320,13 @@ static int eth_addr2msg(struct tipc_media_addr *a, char *msg_area)
315/** 320/**
316 * eth_str2addr - convert message header address format to Ethernet format 321 * eth_str2addr - convert message header address format to Ethernet format
317 */ 322 */
318static int eth_msg2addr(struct tipc_media_addr *a, char *msg_area) 323static int eth_msg2addr(const struct tipc_bearer *tb_ptr,
324 struct tipc_media_addr *a, char *msg_area)
319{ 325{
320 if (msg_area[TIPC_MEDIA_TYPE_OFFSET] != TIPC_MEDIA_TYPE_ETH) 326 if (msg_area[TIPC_MEDIA_TYPE_OFFSET] != TIPC_MEDIA_TYPE_ETH)
321 return 1; 327 return 1;
322 328
323 eth_media_addr_set(a, msg_area + ETH_ADDR_OFFSET); 329 eth_media_addr_set(tb_ptr, a, msg_area + ETH_ADDR_OFFSET);
324 return 0; 330 return 0;
325} 331}
326 332
@@ -334,8 +340,6 @@ static struct tipc_media eth_media_info = {
334 .addr2str = eth_addr2str, 340 .addr2str = eth_addr2str,
335 .addr2msg = eth_addr2msg, 341 .addr2msg = eth_addr2msg,
336 .msg2addr = eth_msg2addr, 342 .msg2addr = eth_msg2addr,
337 .bcast_addr = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
338 TIPC_MEDIA_TYPE_ETH, 1 },
339 .priority = TIPC_DEF_LINK_PRI, 343 .priority = TIPC_DEF_LINK_PRI,
340 .tolerance = TIPC_DEF_LINK_TOL, 344 .tolerance = TIPC_DEF_LINK_TOL,
341 .window = TIPC_DEF_LINK_WIN, 345 .window = TIPC_DEF_LINK_WIN,