diff options
author | Jon Maloy <jon.maloy@ericsson.com> | 2018-03-22 15:42:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-23 13:12:18 -0400 |
commit | d50ccc2d3909fc1b4d40e4af16b026f05dc68707 (patch) | |
tree | 09ef046f87dc8eb6d4611b26a355477293a01bbd | |
parent | 23fd3eace088ab1872ee59c19191a119ec779ac9 (diff) |
tipc: add 128-bit node identifier
We add a 128-bit node identity, as an alternative to the currently used
32-bit node address.
For the sake of compatibility and to minimize message header changes
we retain the existing 32-bit address field. When not set explicitly by
the user, this field will be filled with a hash value generated from the
much longer node identity, and be used as a shorthand value for the
latter.
We permit either the address or the identity to be set by configuration,
but not both, so when the address value is set by a legacy user the
corresponding 128-bit node identity is generated based on the that value.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/uapi/linux/tipc_netlink.h | 2 | ||||
-rw-r--r-- | net/tipc/addr.c | 81 | ||||
-rw-r--r-- | net/tipc/addr.h | 28 | ||||
-rw-r--r-- | net/tipc/core.c | 4 | ||||
-rw-r--r-- | net/tipc/core.h | 6 | ||||
-rw-r--r-- | net/tipc/discover.c | 4 | ||||
-rw-r--r-- | net/tipc/link.c | 6 | ||||
-rw-r--r-- | net/tipc/name_distr.c | 6 | ||||
-rw-r--r-- | net/tipc/net.c | 51 | ||||
-rw-r--r-- | net/tipc/net.h | 4 | ||||
-rw-r--r-- | net/tipc/node.c | 8 | ||||
-rw-r--r-- | net/tipc/node.h | 4 |
12 files changed, 148 insertions, 56 deletions
diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h index d896ded51bcb..0affb682e5e3 100644 --- a/include/uapi/linux/tipc_netlink.h +++ b/include/uapi/linux/tipc_netlink.h | |||
@@ -169,6 +169,8 @@ enum { | |||
169 | TIPC_NLA_NET_UNSPEC, | 169 | TIPC_NLA_NET_UNSPEC, |
170 | TIPC_NLA_NET_ID, /* u32 */ | 170 | TIPC_NLA_NET_ID, /* u32 */ |
171 | TIPC_NLA_NET_ADDR, /* u32 */ | 171 | TIPC_NLA_NET_ADDR, /* u32 */ |
172 | TIPC_NLA_NET_NODEID, /* u64 */ | ||
173 | TIPC_NLA_NET_NODEID_W1, /* u64 */ | ||
172 | 174 | ||
173 | __TIPC_NLA_NET_MAX, | 175 | __TIPC_NLA_NET_MAX, |
174 | TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1 | 176 | TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1 |
diff --git a/net/tipc/addr.c b/net/tipc/addr.c index 6e06b4d981f1..4841e98591d0 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * net/tipc/addr.c: TIPC address utility routines | 2 | * net/tipc/addr.c: TIPC address utility routines |
3 | * | 3 | * |
4 | * Copyright (c) 2000-2006, Ericsson AB | 4 | * Copyright (c) 2000-2006, 2018, Ericsson AB |
5 | * Copyright (c) 2004-2005, 2010-2011, Wind River Systems | 5 | * Copyright (c) 2004-2005, 2010-2011, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
@@ -34,18 +34,9 @@ | |||
34 | * POSSIBILITY OF SUCH DAMAGE. | 34 | * POSSIBILITY OF SUCH DAMAGE. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/kernel.h> | ||
38 | #include "addr.h" | 37 | #include "addr.h" |
39 | #include "core.h" | 38 | #include "core.h" |
40 | 39 | ||
41 | /** | ||
42 | * in_own_node - test for node inclusion; <0.0.0> always matches | ||
43 | */ | ||
44 | int in_own_node(struct net *net, u32 addr) | ||
45 | { | ||
46 | return addr == tipc_own_addr(net) || !addr; | ||
47 | } | ||
48 | |||
49 | bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr) | 40 | bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr) |
50 | { | 41 | { |
51 | if (!domain || (domain == addr)) | 42 | if (!domain || (domain == addr)) |
@@ -61,9 +52,71 @@ bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr) | |||
61 | return false; | 52 | return false; |
62 | } | 53 | } |
63 | 54 | ||
64 | char *tipc_addr_string_fill(char *string, u32 addr) | 55 | void tipc_set_node_id(struct net *net, u8 *id) |
56 | { | ||
57 | struct tipc_net *tn = tipc_net(net); | ||
58 | u32 *tmp = (u32 *)id; | ||
59 | |||
60 | memcpy(tn->node_id, id, NODE_ID_LEN); | ||
61 | tipc_nodeid2string(tn->node_id_string, id); | ||
62 | tn->node_addr = tmp[0] ^ tmp[1] ^ tmp[2] ^ tmp[3]; | ||
63 | pr_info("Own node identity %s, cluster identity %u\n", | ||
64 | tipc_own_id_string(net), tn->net_id); | ||
65 | } | ||
66 | |||
67 | void tipc_set_node_addr(struct net *net, u32 addr) | ||
65 | { | 68 | { |
66 | snprintf(string, 16, "<%u.%u.%u>", | 69 | struct tipc_net *tn = tipc_net(net); |
67 | tipc_zone(addr), tipc_cluster(addr), tipc_node(addr)); | 70 | u8 node_id[NODE_ID_LEN] = {0,}; |
68 | return string; | 71 | |
72 | tn->node_addr = addr; | ||
73 | if (!tipc_own_id(net)) { | ||
74 | sprintf(node_id, "%x", addr); | ||
75 | tipc_set_node_id(net, node_id); | ||
76 | } | ||
77 | pr_info("32-bit node address hash set to %x\n", addr); | ||
78 | } | ||
79 | |||
80 | char *tipc_nodeid2string(char *str, u8 *id) | ||
81 | { | ||
82 | int i; | ||
83 | u8 c; | ||
84 | |||
85 | /* Already a string ? */ | ||
86 | for (i = 0; i < NODE_ID_LEN; i++) { | ||
87 | c = id[i]; | ||
88 | if (c >= '0' && c <= '9') | ||
89 | continue; | ||
90 | if (c >= 'A' && c <= 'Z') | ||
91 | continue; | ||
92 | if (c >= 'a' && c <= 'z') | ||
93 | continue; | ||
94 | if (c == '.') | ||
95 | continue; | ||
96 | if (c == ':') | ||
97 | continue; | ||
98 | if (c == '_') | ||
99 | continue; | ||
100 | if (c == '-') | ||
101 | continue; | ||
102 | if (c == '@') | ||
103 | continue; | ||
104 | if (c != 0) | ||
105 | break; | ||
106 | } | ||
107 | if (i == NODE_ID_LEN) { | ||
108 | memcpy(str, id, NODE_ID_LEN); | ||
109 | str[NODE_ID_LEN] = 0; | ||
110 | return str; | ||
111 | } | ||
112 | |||
113 | /* Translate to hex string */ | ||
114 | for (i = 0; i < NODE_ID_LEN; i++) | ||
115 | sprintf(&str[2 * i], "%02x", id[i]); | ||
116 | |||
117 | /* Strip off trailing zeroes */ | ||
118 | for (i = NODE_ID_STR_LEN - 2; str[i] == '0'; i--) | ||
119 | str[i] = 0; | ||
120 | |||
121 | return str; | ||
69 | } | 122 | } |
diff --git a/net/tipc/addr.h b/net/tipc/addr.h index 6b48f0dc0205..31bee0ea7b3e 100644 --- a/net/tipc/addr.h +++ b/net/tipc/addr.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * net/tipc/addr.h: Include file for TIPC address utility routines | 2 | * net/tipc/addr.h: Include file for TIPC address utility routines |
3 | * | 3 | * |
4 | * Copyright (c) 2000-2006, Ericsson AB | 4 | * Copyright (c) 2000-2006, 2018, Ericsson AB |
5 | * Copyright (c) 2004-2005, Wind River Systems | 5 | * Copyright (c) 2004-2005, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
@@ -45,9 +45,21 @@ | |||
45 | 45 | ||
46 | static inline u32 tipc_own_addr(struct net *net) | 46 | static inline u32 tipc_own_addr(struct net *net) |
47 | { | 47 | { |
48 | return tipc_net(net)->node_addr; | ||
49 | } | ||
50 | |||
51 | static inline u8 *tipc_own_id(struct net *net) | ||
52 | { | ||
48 | struct tipc_net *tn = tipc_net(net); | 53 | struct tipc_net *tn = tipc_net(net); |
49 | 54 | ||
50 | return tn->own_addr; | 55 | if (!strlen(tn->node_id_string)) |
56 | return NULL; | ||
57 | return tn->node_id; | ||
58 | } | ||
59 | |||
60 | static inline char *tipc_own_id_string(struct net *net) | ||
61 | { | ||
62 | return tipc_net(net)->node_id_string; | ||
51 | } | 63 | } |
52 | 64 | ||
53 | static inline u32 tipc_cluster_mask(u32 addr) | 65 | static inline u32 tipc_cluster_mask(u32 addr) |
@@ -65,9 +77,15 @@ static inline int tipc_scope2node(struct net *net, int sc) | |||
65 | return sc != TIPC_NODE_SCOPE ? 0 : tipc_own_addr(net); | 77 | return sc != TIPC_NODE_SCOPE ? 0 : tipc_own_addr(net); |
66 | } | 78 | } |
67 | 79 | ||
68 | u32 tipc_own_addr(struct net *net); | 80 | static inline int in_own_node(struct net *net, u32 addr) |
69 | int in_own_node(struct net *net, u32 addr); | 81 | { |
82 | return addr == tipc_own_addr(net) || !addr; | ||
83 | } | ||
84 | |||
70 | bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr); | 85 | bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr); |
71 | char *tipc_addr_string_fill(char *string, u32 addr); | 86 | void tipc_set_node_id(struct net *net, u8 *id); |
87 | void tipc_set_node_addr(struct net *net, u32 addr); | ||
88 | char *tipc_nodeid2string(char *str, u8 *id); | ||
89 | u32 tipc_node_id2hash(u8 *id128); | ||
72 | 90 | ||
73 | #endif | 91 | #endif |
diff --git a/net/tipc/core.c b/net/tipc/core.c index 04fd91bb11d7..e92fed49e095 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -56,7 +56,9 @@ static int __net_init tipc_init_net(struct net *net) | |||
56 | int err; | 56 | int err; |
57 | 57 | ||
58 | tn->net_id = 4711; | 58 | tn->net_id = 4711; |
59 | tn->own_addr = 0; | 59 | tn->node_addr = 0; |
60 | memset(tn->node_id, 0, sizeof(tn->node_id)); | ||
61 | memset(tn->node_id_string, 0, sizeof(tn->node_id_string)); | ||
60 | tn->mon_threshold = TIPC_DEF_MON_THRESHOLD; | 62 | tn->mon_threshold = TIPC_DEF_MON_THRESHOLD; |
61 | get_random_bytes(&tn->random, sizeof(int)); | 63 | get_random_bytes(&tn->random, sizeof(int)); |
62 | INIT_LIST_HEAD(&tn->node_list); | 64 | INIT_LIST_HEAD(&tn->node_list); |
diff --git a/net/tipc/core.h b/net/tipc/core.h index bd2b112680a4..eabad41cc832 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -72,13 +72,17 @@ struct tipc_monitor; | |||
72 | #define NODE_HTABLE_SIZE 512 | 72 | #define NODE_HTABLE_SIZE 512 |
73 | #define MAX_BEARERS 3 | 73 | #define MAX_BEARERS 3 |
74 | #define TIPC_DEF_MON_THRESHOLD 32 | 74 | #define TIPC_DEF_MON_THRESHOLD 32 |
75 | #define NODE_ID_LEN 16 | ||
76 | #define NODE_ID_STR_LEN (NODE_ID_LEN * 2 + 1) | ||
75 | 77 | ||
76 | extern unsigned int tipc_net_id __read_mostly; | 78 | extern unsigned int tipc_net_id __read_mostly; |
77 | extern int sysctl_tipc_rmem[3] __read_mostly; | 79 | extern int sysctl_tipc_rmem[3] __read_mostly; |
78 | extern int sysctl_tipc_named_timeout __read_mostly; | 80 | extern int sysctl_tipc_named_timeout __read_mostly; |
79 | 81 | ||
80 | struct tipc_net { | 82 | struct tipc_net { |
81 | u32 own_addr; | 83 | u8 node_id[NODE_ID_LEN]; |
84 | u32 node_addr; | ||
85 | char node_id_string[NODE_ID_STR_LEN]; | ||
82 | int net_id; | 86 | int net_id; |
83 | int random; | 87 | int random; |
84 | bool legacy_addr_format; | 88 | bool legacy_addr_format; |
diff --git a/net/tipc/discover.c b/net/tipc/discover.c index 94d524018ca5..b4c4cd176b9b 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c | |||
@@ -118,13 +118,11 @@ static void tipc_disc_msg_xmit(struct net *net, u32 mtyp, u32 dst, u32 src, | |||
118 | static void disc_dupl_alert(struct tipc_bearer *b, u32 node_addr, | 118 | static void disc_dupl_alert(struct tipc_bearer *b, u32 node_addr, |
119 | struct tipc_media_addr *media_addr) | 119 | struct tipc_media_addr *media_addr) |
120 | { | 120 | { |
121 | char node_addr_str[16]; | ||
122 | char media_addr_str[64]; | 121 | char media_addr_str[64]; |
123 | 122 | ||
124 | tipc_addr_string_fill(node_addr_str, node_addr); | ||
125 | tipc_media_addr_printf(media_addr_str, sizeof(media_addr_str), | 123 | tipc_media_addr_printf(media_addr_str, sizeof(media_addr_str), |
126 | media_addr); | 124 | media_addr); |
127 | pr_warn("Duplicate %s using %s seen on <%s>\n", node_addr_str, | 125 | pr_warn("Duplicate %x using %s seen on <%s>\n", node_addr, |
128 | media_addr_str, b->name); | 126 | media_addr_str, b->name); |
129 | } | 127 | } |
130 | 128 | ||
diff --git a/net/tipc/link.c b/net/tipc/link.c index 4aa56e3bf4fc..bcd76b1e440c 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -442,6 +442,7 @@ bool tipc_link_create(struct net *net, char *if_name, int bearer_id, | |||
442 | struct sk_buff_head *namedq, | 442 | struct sk_buff_head *namedq, |
443 | struct tipc_link **link) | 443 | struct tipc_link **link) |
444 | { | 444 | { |
445 | char *self_str = tipc_own_id_string(net); | ||
445 | struct tipc_link *l; | 446 | struct tipc_link *l; |
446 | 447 | ||
447 | l = kzalloc(sizeof(*l), GFP_ATOMIC); | 448 | l = kzalloc(sizeof(*l), GFP_ATOMIC); |
@@ -451,7 +452,10 @@ bool tipc_link_create(struct net *net, char *if_name, int bearer_id, | |||
451 | l->session = session; | 452 | l->session = session; |
452 | 453 | ||
453 | /* Note: peer i/f name is completed by reset/activate message */ | 454 | /* Note: peer i/f name is completed by reset/activate message */ |
454 | sprintf(l->name, "%x:%s-%x:unknown", self, if_name, peer); | 455 | if (strlen(self_str) > 16) |
456 | sprintf(l->name, "%x:%s-%x:unknown", self, if_name, peer); | ||
457 | else | ||
458 | sprintf(l->name, "%s:%s-%x:unknown", self_str, if_name, peer); | ||
455 | strcpy(l->if_name, if_name); | 459 | strcpy(l->if_name, if_name); |
456 | l->addr = peer; | 460 | l->addr = peer; |
457 | l->peer_caps = peer_caps; | 461 | l->peer_caps = peer_caps; |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 7e571f4f47bc..8240a85b0d0c 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -318,7 +318,6 @@ void tipc_named_process_backlog(struct net *net) | |||
318 | { | 318 | { |
319 | struct distr_queue_item *e, *tmp; | 319 | struct distr_queue_item *e, *tmp; |
320 | struct tipc_net *tn = net_generic(net, tipc_net_id); | 320 | struct tipc_net *tn = net_generic(net, tipc_net_id); |
321 | char addr[16]; | ||
322 | unsigned long now = get_jiffies_64(); | 321 | unsigned long now = get_jiffies_64(); |
323 | 322 | ||
324 | list_for_each_entry_safe(e, tmp, &tn->dist_queue, next) { | 323 | list_for_each_entry_safe(e, tmp, &tn->dist_queue, next) { |
@@ -326,12 +325,11 @@ void tipc_named_process_backlog(struct net *net) | |||
326 | if (!tipc_update_nametbl(net, &e->i, e->node, e->dtype)) | 325 | if (!tipc_update_nametbl(net, &e->i, e->node, e->dtype)) |
327 | continue; | 326 | continue; |
328 | } else { | 327 | } else { |
329 | tipc_addr_string_fill(addr, e->node); | 328 | pr_warn_ratelimited("Dropping name table update (%d) of {%u, %u, %u} from %x key=%u\n", |
330 | pr_warn_ratelimited("Dropping name table update (%d) of {%u, %u, %u} from %s key=%u\n", | ||
331 | e->dtype, ntohl(e->i.type), | 329 | e->dtype, ntohl(e->i.type), |
332 | ntohl(e->i.lower), | 330 | ntohl(e->i.lower), |
333 | ntohl(e->i.upper), | 331 | ntohl(e->i.upper), |
334 | addr, ntohl(e->i.key)); | 332 | e->node, ntohl(e->i.key)); |
335 | } | 333 | } |
336 | list_del(&e->next); | 334 | list_del(&e->next); |
337 | kfree(e); | 335 | kfree(e); |
diff --git a/net/tipc/net.c b/net/tipc/net.c index 7f140a5308ee..e78674891166 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -104,27 +104,31 @@ | |||
104 | * - A local spin_lock protecting the queue of subscriber events. | 104 | * - A local spin_lock protecting the queue of subscriber events. |
105 | */ | 105 | */ |
106 | 106 | ||
107 | int tipc_net_start(struct net *net, u32 addr) | 107 | int tipc_net_init(struct net *net, u8 *node_id, u32 addr) |
108 | { | 108 | { |
109 | struct tipc_net *tn = tipc_net(net); | 109 | if (tipc_own_id(net)) { |
110 | char addr_string[16]; | 110 | pr_info("Cannot configure node identity twice\n"); |
111 | return -1; | ||
112 | } | ||
113 | pr_info("Started in network mode\n"); | ||
111 | 114 | ||
112 | tn->own_addr = addr; | 115 | if (node_id) { |
116 | tipc_set_node_id(net, node_id); | ||
117 | tipc_net_finalize(net, tipc_own_addr(net)); | ||
118 | } | ||
119 | if (addr) | ||
120 | tipc_net_finalize(net, addr); | ||
121 | return 0; | ||
122 | } | ||
113 | 123 | ||
114 | /* Ensure that the new address is visible before we reinit. */ | 124 | void tipc_net_finalize(struct net *net, u32 addr) |
125 | { | ||
126 | tipc_set_node_addr(net, addr); | ||
115 | smp_mb(); | 127 | smp_mb(); |
116 | |||
117 | tipc_named_reinit(net); | 128 | tipc_named_reinit(net); |
118 | tipc_sk_reinit(net); | 129 | tipc_sk_reinit(net); |
119 | |||
120 | tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, | 130 | tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, |
121 | TIPC_CLUSTER_SCOPE, 0, addr); | 131 | TIPC_CLUSTER_SCOPE, 0, addr); |
122 | |||
123 | pr_info("Started in network mode\n"); | ||
124 | pr_info("Own node address %s, cluster identity %u\n", | ||
125 | tipc_addr_string_fill(addr_string, addr), | ||
126 | tn->net_id); | ||
127 | return 0; | ||
128 | } | 132 | } |
129 | 133 | ||
130 | void tipc_net_stop(struct net *net) | 134 | void tipc_net_stop(struct net *net) |
@@ -146,8 +150,10 @@ void tipc_net_stop(struct net *net) | |||
146 | static int __tipc_nl_add_net(struct net *net, struct tipc_nl_msg *msg) | 150 | static int __tipc_nl_add_net(struct net *net, struct tipc_nl_msg *msg) |
147 | { | 151 | { |
148 | struct tipc_net *tn = net_generic(net, tipc_net_id); | 152 | struct tipc_net *tn = net_generic(net, tipc_net_id); |
149 | void *hdr; | 153 | u64 *w0 = (u64 *)&tn->node_id[0]; |
154 | u64 *w1 = (u64 *)&tn->node_id[8]; | ||
150 | struct nlattr *attrs; | 155 | struct nlattr *attrs; |
156 | void *hdr; | ||
151 | 157 | ||
152 | hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, | 158 | hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, |
153 | NLM_F_MULTI, TIPC_NL_NET_GET); | 159 | NLM_F_MULTI, TIPC_NL_NET_GET); |
@@ -160,7 +166,10 @@ static int __tipc_nl_add_net(struct net *net, struct tipc_nl_msg *msg) | |||
160 | 166 | ||
161 | if (nla_put_u32(msg->skb, TIPC_NLA_NET_ID, tn->net_id)) | 167 | if (nla_put_u32(msg->skb, TIPC_NLA_NET_ID, tn->net_id)) |
162 | goto attr_msg_full; | 168 | goto attr_msg_full; |
163 | 169 | if (nla_put_u64_64bit(msg->skb, TIPC_NLA_NET_NODEID, *w0, 0)) | |
170 | goto attr_msg_full; | ||
171 | if (nla_put_u64_64bit(msg->skb, TIPC_NLA_NET_NODEID_W1, *w1, 0)) | ||
172 | goto attr_msg_full; | ||
164 | nla_nest_end(msg->skb, attrs); | 173 | nla_nest_end(msg->skb, attrs); |
165 | genlmsg_end(msg->skb, hdr); | 174 | genlmsg_end(msg->skb, hdr); |
166 | 175 | ||
@@ -212,6 +221,7 @@ int __tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info) | |||
212 | err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX, | 221 | err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX, |
213 | info->attrs[TIPC_NLA_NET], tipc_nl_net_policy, | 222 | info->attrs[TIPC_NLA_NET], tipc_nl_net_policy, |
214 | info->extack); | 223 | info->extack); |
224 | |||
215 | if (err) | 225 | if (err) |
216 | return err; | 226 | return err; |
217 | 227 | ||
@@ -236,9 +246,18 @@ int __tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info) | |||
236 | if (!addr) | 246 | if (!addr) |
237 | return -EINVAL; | 247 | return -EINVAL; |
238 | tn->legacy_addr_format = true; | 248 | tn->legacy_addr_format = true; |
239 | tipc_net_start(net, addr); | 249 | tipc_net_init(net, NULL, addr); |
240 | } | 250 | } |
241 | 251 | ||
252 | if (attrs[TIPC_NLA_NET_NODEID]) { | ||
253 | u8 node_id[NODE_ID_LEN]; | ||
254 | u64 *w0 = (u64 *)&node_id[0]; | ||
255 | u64 *w1 = (u64 *)&node_id[8]; | ||
256 | |||
257 | *w0 = nla_get_u64(attrs[TIPC_NLA_NET_NODEID]); | ||
258 | *w1 = nla_get_u64(attrs[TIPC_NLA_NET_NODEID_W1]); | ||
259 | tipc_net_init(net, node_id, 0); | ||
260 | } | ||
242 | return 0; | 261 | return 0; |
243 | } | 262 | } |
244 | 263 | ||
diff --git a/net/tipc/net.h b/net/tipc/net.h index c0306aa2374b..08efa6010022 100644 --- a/net/tipc/net.h +++ b/net/tipc/net.h | |||
@@ -41,10 +41,8 @@ | |||
41 | 41 | ||
42 | extern const struct nla_policy tipc_nl_net_policy[]; | 42 | extern const struct nla_policy tipc_nl_net_policy[]; |
43 | 43 | ||
44 | int tipc_net_start(struct net *net, u32 addr); | 44 | void tipc_net_finalize(struct net *net, u32 addr); |
45 | |||
46 | void tipc_net_stop(struct net *net); | 45 | void tipc_net_stop(struct net *net); |
47 | |||
48 | int tipc_nl_net_dump(struct sk_buff *skb, struct netlink_callback *cb); | 46 | int tipc_nl_net_dump(struct sk_buff *skb, struct netlink_callback *cb); |
49 | int tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info); | 47 | int tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info); |
50 | int __tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info); | 48 | int __tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info); |
diff --git a/net/tipc/node.c b/net/tipc/node.c index 8a4b04933ecc..7b0c99347406 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -883,11 +883,9 @@ void tipc_node_delete_links(struct net *net, int bearer_id) | |||
883 | 883 | ||
884 | static void tipc_node_reset_links(struct tipc_node *n) | 884 | static void tipc_node_reset_links(struct tipc_node *n) |
885 | { | 885 | { |
886 | char addr_string[16]; | ||
887 | int i; | 886 | int i; |
888 | 887 | ||
889 | pr_warn("Resetting all links to %s\n", | 888 | pr_warn("Resetting all links to %x\n", n->addr); |
890 | tipc_addr_string_fill(addr_string, n->addr)); | ||
891 | 889 | ||
892 | for (i = 0; i < MAX_BEARERS; i++) { | 890 | for (i = 0; i < MAX_BEARERS; i++) { |
893 | tipc_node_link_down(n, i, false); | 891 | tipc_node_link_down(n, i, false); |
@@ -1074,15 +1072,13 @@ illegal_evt: | |||
1074 | static void node_lost_contact(struct tipc_node *n, | 1072 | static void node_lost_contact(struct tipc_node *n, |
1075 | struct sk_buff_head *inputq) | 1073 | struct sk_buff_head *inputq) |
1076 | { | 1074 | { |
1077 | char addr_string[16]; | ||
1078 | struct tipc_sock_conn *conn, *safe; | 1075 | struct tipc_sock_conn *conn, *safe; |
1079 | struct tipc_link *l; | 1076 | struct tipc_link *l; |
1080 | struct list_head *conns = &n->conn_sks; | 1077 | struct list_head *conns = &n->conn_sks; |
1081 | struct sk_buff *skb; | 1078 | struct sk_buff *skb; |
1082 | uint i; | 1079 | uint i; |
1083 | 1080 | ||
1084 | pr_debug("Lost contact with %s\n", | 1081 | pr_debug("Lost contact with %x\n", n->addr); |
1085 | tipc_addr_string_fill(addr_string, n->addr)); | ||
1086 | 1082 | ||
1087 | /* Clean up broadcast state */ | 1083 | /* Clean up broadcast state */ |
1088 | tipc_bcast_remove_peer(n->net, n->bc_entry.link); | 1084 | tipc_bcast_remove_peer(n->net, n->bc_entry.link); |
diff --git a/net/tipc/node.h b/net/tipc/node.h index 5fb38cf0bb5c..e06faf4fa55e 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
@@ -49,14 +49,14 @@ enum { | |||
49 | TIPC_BCAST_STATE_NACK = (1 << 2), | 49 | TIPC_BCAST_STATE_NACK = (1 << 2), |
50 | TIPC_BLOCK_FLOWCTL = (1 << 3), | 50 | TIPC_BLOCK_FLOWCTL = (1 << 3), |
51 | TIPC_BCAST_RCAST = (1 << 4), | 51 | TIPC_BCAST_RCAST = (1 << 4), |
52 | TIPC_NODE_ID32 = (1 << 5) | 52 | TIPC_NODE_ID128 = (1 << 5) |
53 | }; | 53 | }; |
54 | 54 | ||
55 | #define TIPC_NODE_CAPABILITIES (TIPC_BCAST_SYNCH | \ | 55 | #define TIPC_NODE_CAPABILITIES (TIPC_BCAST_SYNCH | \ |
56 | TIPC_BCAST_STATE_NACK | \ | 56 | TIPC_BCAST_STATE_NACK | \ |
57 | TIPC_BCAST_RCAST | \ | 57 | TIPC_BCAST_RCAST | \ |
58 | TIPC_BLOCK_FLOWCTL | \ | 58 | TIPC_BLOCK_FLOWCTL | \ |
59 | TIPC_NODE_ID32) | 59 | TIPC_NODE_ID128) |
60 | #define INVALID_BEARER_ID -1 | 60 | #define INVALID_BEARER_ID -1 |
61 | 61 | ||
62 | void tipc_node_stop(struct net *net); | 62 | void tipc_node_stop(struct net *net); |