netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event
@ 2014-03-28  9:32 erik.hugne
  2014-03-28  9:32 ` [PATCH net-next 1/2] tipc: fix neighbor detection problem after hw address change erik.hugne
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: erik.hugne @ 2014-03-28  9:32 UTC (permalink / raw)
  To: netdev, tipc-discussion, jon.maloy, maloy
  Cc: ying.xue, paul.gortmaker, richard.alpe, aleksandar.igic, Erik Hugne

From: Erik Hugne <erik.hugne@ericsson.com>

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.

Erik Hugne (2):
  tipc: fix neighbor detection problem after hw address change
  tipc: make discovery domain a bearer attribute

 net/tipc/bearer.c   |  9 ++++++++-
 net/tipc/bearer.h   |  2 ++
 net/tipc/discover.c | 19 +++++++------------
 net/tipc/discover.h |  3 +--
 4 files changed, 18 insertions(+), 15 deletions(-)

-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] tipc: fix neighbor detection problem after hw address change
  2014-03-28  9:32 [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event erik.hugne
@ 2014-03-28  9:32 ` erik.hugne
  2014-03-28  9:32 ` [PATCH net-next 2/2] tipc: make discovery domain a bearer attribute erik.hugne
  2014-03-28 18:46 ` [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: erik.hugne @ 2014-03-28  9:32 UTC (permalink / raw)
  To: netdev, tipc-discussion, jon.maloy, maloy
  Cc: ying.xue, paul.gortmaker, richard.alpe, aleksandar.igic, Erik Hugne

From: Erik Hugne <erik.hugne@ericsson.com>

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 <erik.hugne@ericsson.com>
Reported-by: Dong Liu <dliu.cn@gmail.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
---
 net/tipc/bearer.c | 7 +++++++
 net/tipc/bearer.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index ed45f97..3cd65d4 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -332,6 +332,7 @@ restart:
 	b_ptr->identity = bearer_id;
 	b_ptr->tolerance = m_ptr->tolerance;
 	b_ptr->window = m_ptr->window;
+	b_ptr->domain = disc_domain;
 	b_ptr->net_plane = bearer_id + 'A';
 	b_ptr->priority = priority;
 
@@ -360,7 +361,9 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
 {
 	read_lock_bh(&tipc_net_lock);
 	pr_info("Resetting bearer <%s>\n", b_ptr->name);
+	tipc_disc_delete(b_ptr->link_req);
 	tipc_link_reset_list(b_ptr->identity);
+	tipc_disc_create(b_ptr, &b_ptr->bcast_addr, b_ptr->domain);
 	read_unlock_bh(&tipc_net_lock);
 	return 0;
 }
@@ -580,7 +583,11 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
 			break;
 	case NETDEV_DOWN:
 	case NETDEV_CHANGEMTU:
+		tipc_reset_bearer(b_ptr);
+		break;
 	case NETDEV_CHANGEADDR:
+		tipc_l2_media_addr_set(b_ptr, &b_ptr->addr,
+				       (char *)dev->dev_addr);
 		tipc_reset_bearer(b_ptr);
 		break;
 	case NETDEV_UNREGISTER:
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 3f6d7d0..ba48145 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -116,6 +116,7 @@ struct tipc_media {
  * @priority: default link priority for bearer
  * @window: default window size for bearer
  * @tolerance: default link tolerance for bearer
+ * @domain: network domain to which links can be established
  * @identity: array index of this bearer within TIPC bearer array
  * @link_req: ptr to (optional) structure making periodic link setup requests
  * @net_plane: network plane ('A' through 'H') currently associated with bearer
@@ -135,6 +136,7 @@ struct tipc_bearer {
 	u32 priority;
 	u32 window;
 	u32 tolerance;
+	u32 domain;
 	u32 identity;
 	struct tipc_link_req *link_req;
 	char net_plane;
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] tipc: make discovery domain a bearer attribute
  2014-03-28  9:32 [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event erik.hugne
  2014-03-28  9:32 ` [PATCH net-next 1/2] tipc: fix neighbor detection problem after hw address change erik.hugne
@ 2014-03-28  9:32 ` erik.hugne
  2014-03-28 18:46 ` [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: erik.hugne @ 2014-03-28  9:32 UTC (permalink / raw)
  To: netdev, tipc-discussion, jon.maloy, maloy
  Cc: ying.xue, paul.gortmaker, richard.alpe, aleksandar.igic, Erik Hugne

From: Erik Hugne <erik.hugne@ericsson.com>

The node discovery domain is assigned when a bearer is enabled.
In the previous commit we reflect this attribute directly in the
bearer structure since it's needed to reinitialize the node
discovery mechanism after a hardware address change.

There's no need to replicate this attribute anywhere else, so we
remove it from the tipc_link_req structure.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
---
 net/tipc/bearer.c   |  4 ++--
 net/tipc/discover.c | 19 +++++++------------
 net/tipc/discover.h |  3 +--
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 3cd65d4..3fef7eb 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -336,7 +336,7 @@ restart:
 	b_ptr->net_plane = bearer_id + 'A';
 	b_ptr->priority = priority;
 
-	res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain);
+	res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr);
 	if (res) {
 		bearer_disable(b_ptr, false);
 		pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
@@ -363,7 +363,7 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
 	pr_info("Resetting bearer <%s>\n", b_ptr->name);
 	tipc_disc_delete(b_ptr->link_req);
 	tipc_link_reset_list(b_ptr->identity);
-	tipc_disc_create(b_ptr, &b_ptr->bcast_addr, b_ptr->domain);
+	tipc_disc_create(b_ptr, &b_ptr->bcast_addr);
 	read_unlock_bh(&tipc_net_lock);
 	return 0;
 }
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index fa94da6..542fe34 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -48,7 +48,6 @@
  * struct tipc_link_req - information about an ongoing link setup request
  * @bearer: bearer issuing requests
  * @dest: destination address for request messages
- * @domain: network domain to which links can be established
  * @num_nodes: number of nodes currently discovered (i.e. with an active link)
  * @lock: spinlock for controlling access to requests
  * @buf: request message to be (repeatedly) sent
@@ -58,7 +57,6 @@
 struct tipc_link_req {
 	struct tipc_bearer *bearer;
 	struct tipc_media_addr dest;
-	u32 domain;
 	int num_nodes;
 	spinlock_t lock;
 	struct sk_buff *buf;
@@ -69,14 +67,13 @@ struct tipc_link_req {
 /**
  * tipc_disc_init_msg - initialize a link setup message
  * @type: message type (request or response)
- * @dest_domain: network domain of node(s) which should respond to message
  * @b_ptr: ptr to bearer issuing message
  */
-static struct sk_buff *tipc_disc_init_msg(u32 type, u32 dest_domain,
-					  struct tipc_bearer *b_ptr)
+static struct sk_buff *tipc_disc_init_msg(u32 type, struct tipc_bearer *b_ptr)
 {
 	struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE);
 	struct tipc_msg *msg;
+	u32 dest_domain = b_ptr->domain;
 
 	if (buf) {
 		msg = buf_msg(buf);
@@ -149,7 +146,7 @@ void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
 	}
 	if (!tipc_in_scope(dest, tipc_own_addr))
 		return;
-	if (!tipc_in_scope(b_ptr->link_req->domain, orig))
+	if (!tipc_in_scope(b_ptr->domain, orig))
 		return;
 
 	/* Locate structure corresponding to requesting node */
@@ -242,7 +239,7 @@ void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
 	link_fully_up = link_working_working(link);
 
 	if ((type == DSC_REQ_MSG) && !link_fully_up) {
-		rbuf = tipc_disc_init_msg(DSC_RESP_MSG, orig, b_ptr);
+		rbuf = tipc_disc_init_msg(DSC_RESP_MSG, b_ptr);
 		if (rbuf) {
 			tipc_bearer_send(b_ptr, rbuf, &media_addr);
 			kfree_skb(rbuf);
@@ -306,7 +303,7 @@ static void disc_timeout(struct tipc_link_req *req)
 	spin_lock_bh(&req->lock);
 
 	/* Stop searching if only desired node has been found */
-	if (tipc_node(req->domain) && req->num_nodes) {
+	if (tipc_node(req->bearer->domain) && req->num_nodes) {
 		req->timer_intv = TIPC_LINK_REQ_INACTIVE;
 		goto exit;
 	}
@@ -342,8 +339,7 @@ exit:
  *
  * Returns 0 if successful, otherwise -errno.
  */
-int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
-		     u32 dest_domain)
+int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest)
 {
 	struct tipc_link_req *req;
 
@@ -351,7 +347,7 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
 	if (!req)
 		return -ENOMEM;
 
-	req->buf = tipc_disc_init_msg(DSC_REQ_MSG, dest_domain, b_ptr);
+	req->buf = tipc_disc_init_msg(DSC_REQ_MSG, b_ptr);
 	if (!req->buf) {
 		kfree(req);
 		return -ENOMSG;
@@ -359,7 +355,6 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
 
 	memcpy(&req->dest, dest, sizeof(*dest));
 	req->bearer = b_ptr;
-	req->domain = dest_domain;
 	req->num_nodes = 0;
 	req->timer_intv = TIPC_LINK_REQ_INIT;
 	spin_lock_init(&req->lock);
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index b4fc962..07f3472 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -39,8 +39,7 @@
 
 struct tipc_link_req;
 
-int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
-		     u32 dest_domain);
+int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest);
 void tipc_disc_delete(struct tipc_link_req *req);
 void tipc_disc_add_dest(struct tipc_link_req *req);
 void tipc_disc_remove_dest(struct tipc_link_req *req);
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event
  2014-03-28  9:32 [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event erik.hugne
  2014-03-28  9:32 ` [PATCH net-next 1/2] tipc: fix neighbor detection problem after hw address change erik.hugne
  2014-03-28  9:32 ` [PATCH net-next 2/2] tipc: make discovery domain a bearer attribute erik.hugne
@ 2014-03-28 18:46 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-03-28 18:46 UTC (permalink / raw)
  To: erik.hugne
  Cc: netdev, tipc-discussion, jon.maloy, maloy, ying.xue,
	paul.gortmaker, richard.alpe, aleksandar.igic

From: <erik.hugne@ericsson.com>
Date: Fri, 28 Mar 2014 10:32:07 +0100

> 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.

Series applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-28 18:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28  9:32 [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event erik.hugne
2014-03-28  9:32 ` [PATCH net-next 1/2] tipc: fix neighbor detection problem after hw address change erik.hugne
2014-03-28  9:32 ` [PATCH net-next 2/2] tipc: make discovery domain a bearer attribute erik.hugne
2014-03-28 18:46 ` [PATCH net-next 0/2] tipc: fix handling of NETDEV_CHANGEADDR event David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).