Skip to content

Commit a21a584

Browse files
Erik Hugnedavem330
authored andcommitted
tipc: fix neighbor detection problem after hw address change
If the hardware address of a underlying netdevice is changed, it is not enough to simply reset the bearer/links over this device. We also need to reflect this change in the TIPC bearer and node discovery structures aswell. This patch adds the necessary reinitialization of the node disovery mechanism following a hardware address change so that the correct originating media address is advertised in the discovery messages. Signed-off-by: Erik Hugne <[email protected]> Reported-by: Dong Liu <[email protected]> Reviewed-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c8c3d7e commit a21a584

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

net/tipc/bearer.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
332332
b_ptr->identity = bearer_id;
333333
b_ptr->tolerance = m_ptr->tolerance;
334334
b_ptr->window = m_ptr->window;
335+
b_ptr->domain = disc_domain;
335336
b_ptr->net_plane = bearer_id + 'A';
336337
b_ptr->priority = priority;
337338

@@ -360,7 +361,9 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
360361
{
361362
read_lock_bh(&tipc_net_lock);
362363
pr_info("Resetting bearer <%s>\n", b_ptr->name);
364+
tipc_disc_delete(b_ptr->link_req);
363365
tipc_link_reset_list(b_ptr->identity);
366+
tipc_disc_create(b_ptr, &b_ptr->bcast_addr, b_ptr->domain);
364367
read_unlock_bh(&tipc_net_lock);
365368
return 0;
366369
}
@@ -580,7 +583,11 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
580583
break;
581584
case NETDEV_DOWN:
582585
case NETDEV_CHANGEMTU:
586+
tipc_reset_bearer(b_ptr);
587+
break;
583588
case NETDEV_CHANGEADDR:
589+
tipc_l2_media_addr_set(b_ptr, &b_ptr->addr,
590+
(char *)dev->dev_addr);
584591
tipc_reset_bearer(b_ptr);
585592
break;
586593
case NETDEV_UNREGISTER:

net/tipc/bearer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ struct tipc_media {
116116
* @priority: default link priority for bearer
117117
* @window: default window size for bearer
118118
* @tolerance: default link tolerance for bearer
119+
* @domain: network domain to which links can be established
119120
* @identity: array index of this bearer within TIPC bearer array
120121
* @link_req: ptr to (optional) structure making periodic link setup requests
121122
* @net_plane: network plane ('A' through 'H') currently associated with bearer
@@ -135,6 +136,7 @@ struct tipc_bearer {
135136
u32 priority;
136137
u32 window;
137138
u32 tolerance;
139+
u32 domain;
138140
u32 identity;
139141
struct tipc_link_req *link_req;
140142
char net_plane;

0 commit comments

Comments
 (0)