linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] tipc: initialise addr_trail_end when setting node addresses
@ 2019-08-09  0:54 Chris Packham
  2019-08-10 17:46 ` Jon Maloy
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Packham @ 2019-08-09  0:54 UTC (permalink / raw)
  To: jon.maloy, ying.xue, davem
  Cc: netdev, tipc-discussion, linux-kernel, Chris Packham

Ensure addr_trail_end is set to jiffies when configuring the node
address. This ensures that we don't treat the initial value of 0 as
being a wrapped. This isn't a problem when using auto-generated node
addresses because the addr_trail_end is updated for the duplicate
address detection phase.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Changes in v2:
- move setting to tipc_set_node_addr() as suggested
- reword commit message

 net/tipc/addr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index b88d48d00913..0f1eaed1bd1b 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -75,6 +75,7 @@ void tipc_set_node_addr(struct net *net, u32 addr)
 		tipc_set_node_id(net, node_id);
 	}
 	tn->trial_addr = addr;
+	tn->addr_trial_end = jiffies;
 	pr_info("32-bit node address hash set to %x\n", addr);
 }
 
-- 
2.22.0


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

* RE: [PATCH v2] tipc: initialise addr_trail_end when setting node addresses
  2019-08-09  0:54 [PATCH v2] tipc: initialise addr_trail_end when setting node addresses Chris Packham
@ 2019-08-10 17:46 ` Jon Maloy
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Maloy @ 2019-08-10 17:46 UTC (permalink / raw)
  To: Chris Packham, ying.xue, davem; +Cc: netdev, tipc-discussion, linux-kernel

I would re-phrase this a little:
We set the field 'addr_trial_end' to 'jiffies', instead of the current value 0,  at the moment the node address is initialized. 
This guarantees we don't inadvertently enter an address trial period when the node address is explicitly set by the user.

Acked-by: Jon Maloy <jon.maloy@ericsson.com>


> -----Original Message-----
> From: netdev-owner@vger.kernel.org <netdev-owner@vger.kernel.org> On
> Behalf Of Chris Packham
> Sent: 8-Aug-19 20:55
> To: Jon Maloy <jon.maloy@ericsson.com>; ying.xue@windriver.com;
> davem@davemloft.net
> Cc: netdev@vger.kernel.org; tipc-discussion@lists.sourceforge.net; linux-
> kernel@vger.kernel.org; Chris Packham <chris.packham@alliedtelesis.co.nz>
> Subject: [PATCH v2] tipc: initialise addr_trail_end when setting node addresses
> 
> Ensure addr_trail_end is set to jiffies when configuring the node address. This
> ensures that we don't treat the initial value of 0 as being a wrapped. This isn't a
> problem when using auto-generated node addresses because the
> addr_trail_end is updated for the duplicate address detection phase.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> Changes in v2:
> - move setting to tipc_set_node_addr() as suggested
> - reword commit message
> 
>  net/tipc/addr.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/tipc/addr.c b/net/tipc/addr.c index
> b88d48d00913..0f1eaed1bd1b 100644
> --- a/net/tipc/addr.c
> +++ b/net/tipc/addr.c
> @@ -75,6 +75,7 @@ void tipc_set_node_addr(struct net *net, u32 addr)
>  		tipc_set_node_id(net, node_id);
>  	}
>  	tn->trial_addr = addr;
> +	tn->addr_trial_end = jiffies;
>  	pr_info("32-bit node address hash set to %x\n", addr);  }
> 
> --
> 2.22.0


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

end of thread, other threads:[~2019-08-10 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09  0:54 [PATCH v2] tipc: initialise addr_trail_end when setting node addresses Chris Packham
2019-08-10 17:46 ` Jon Maloy

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