Skip to content

Commit f3c9ec0

Browse files
committed
Merge branch 'tipc-next'
Erik Hugne says: ==================== tipc: fix handling of NETDEV_CHANGEADDR event Aside from manual reconfiguration of the netdevice hwaddr, this can also be changed automatically for an interface bond in active-backup mode if fail_over_mac is enabled. This patchset fixes the handling of this event in TIPC by properly updating the l2 media address for the bearer, followed by a reinitialization of the node discovery mechanism. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents c8c3d7e + 1647011 commit f3c9ec0

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

net/tipc/bearer.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,11 @@ 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

338-
res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain);
339+
res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr);
339340
if (res) {
340341
bearer_disable(b_ptr, false);
341342
pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
@@ -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);
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;

net/tipc/discover.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
* struct tipc_link_req - information about an ongoing link setup request
4949
* @bearer: bearer issuing requests
5050
* @dest: destination address for request messages
51-
* @domain: network domain to which links can be established
5251
* @num_nodes: number of nodes currently discovered (i.e. with an active link)
5352
* @lock: spinlock for controlling access to requests
5453
* @buf: request message to be (repeatedly) sent
@@ -58,7 +57,6 @@
5857
struct tipc_link_req {
5958
struct tipc_bearer *bearer;
6059
struct tipc_media_addr dest;
61-
u32 domain;
6260
int num_nodes;
6361
spinlock_t lock;
6462
struct sk_buff *buf;
@@ -69,14 +67,13 @@ struct tipc_link_req {
6967
/**
7068
* tipc_disc_init_msg - initialize a link setup message
7169
* @type: message type (request or response)
72-
* @dest_domain: network domain of node(s) which should respond to message
7370
* @b_ptr: ptr to bearer issuing message
7471
*/
75-
static struct sk_buff *tipc_disc_init_msg(u32 type, u32 dest_domain,
76-
struct tipc_bearer *b_ptr)
72+
static struct sk_buff *tipc_disc_init_msg(u32 type, struct tipc_bearer *b_ptr)
7773
{
7874
struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE);
7975
struct tipc_msg *msg;
76+
u32 dest_domain = b_ptr->domain;
8077

8178
if (buf) {
8279
msg = buf_msg(buf);
@@ -149,7 +146,7 @@ void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
149146
}
150147
if (!tipc_in_scope(dest, tipc_own_addr))
151148
return;
152-
if (!tipc_in_scope(b_ptr->link_req->domain, orig))
149+
if (!tipc_in_scope(b_ptr->domain, orig))
153150
return;
154151

155152
/* Locate structure corresponding to requesting node */
@@ -242,7 +239,7 @@ void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
242239
link_fully_up = link_working_working(link);
243240

244241
if ((type == DSC_REQ_MSG) && !link_fully_up) {
245-
rbuf = tipc_disc_init_msg(DSC_RESP_MSG, orig, b_ptr);
242+
rbuf = tipc_disc_init_msg(DSC_RESP_MSG, b_ptr);
246243
if (rbuf) {
247244
tipc_bearer_send(b_ptr, rbuf, &media_addr);
248245
kfree_skb(rbuf);
@@ -306,7 +303,7 @@ static void disc_timeout(struct tipc_link_req *req)
306303
spin_lock_bh(&req->lock);
307304

308305
/* Stop searching if only desired node has been found */
309-
if (tipc_node(req->domain) && req->num_nodes) {
306+
if (tipc_node(req->bearer->domain) && req->num_nodes) {
310307
req->timer_intv = TIPC_LINK_REQ_INACTIVE;
311308
goto exit;
312309
}
@@ -342,24 +339,22 @@ static void disc_timeout(struct tipc_link_req *req)
342339
*
343340
* Returns 0 if successful, otherwise -errno.
344341
*/
345-
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
346-
u32 dest_domain)
342+
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest)
347343
{
348344
struct tipc_link_req *req;
349345

350346
req = kmalloc(sizeof(*req), GFP_ATOMIC);
351347
if (!req)
352348
return -ENOMEM;
353349

354-
req->buf = tipc_disc_init_msg(DSC_REQ_MSG, dest_domain, b_ptr);
350+
req->buf = tipc_disc_init_msg(DSC_REQ_MSG, b_ptr);
355351
if (!req->buf) {
356352
kfree(req);
357353
return -ENOMSG;
358354
}
359355

360356
memcpy(&req->dest, dest, sizeof(*dest));
361357
req->bearer = b_ptr;
362-
req->domain = dest_domain;
363358
req->num_nodes = 0;
364359
req->timer_intv = TIPC_LINK_REQ_INIT;
365360
spin_lock_init(&req->lock);

net/tipc/discover.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939

4040
struct tipc_link_req;
4141

42-
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
43-
u32 dest_domain);
42+
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest);
4443
void tipc_disc_delete(struct tipc_link_req *req);
4544
void tipc_disc_add_dest(struct tipc_link_req *req);
4645
void tipc_disc_remove_dest(struct tipc_link_req *req);

0 commit comments

Comments
 (0)