aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/link.c47
-rw-r--r--net/tipc/link.h6
-rw-r--r--net/tipc/node.c6
3 files changed, 36 insertions, 23 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index ff9b0b92e62e..0d8fdc8fe6d4 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -165,9 +165,16 @@ static u32 link_own_addr(struct tipc_link *l)
165/** 165/**
166 * tipc_link_create - create a new link 166 * tipc_link_create - create a new link
167 * @n: pointer to associated node 167 * @n: pointer to associated node
168 * @b: pointer to associated bearer 168 * @if_name: associated interface name
169 * @bearer_id: id (index) of associated bearer
170 * @tolerance: link tolerance to be used by link
171 * @net_plane: network plane (A,B,c..) this link belongs to
172 * @mtu: mtu to be advertised by link
173 * @priority: priority to be used by link
174 * @window: send window to be used by link
175 * @session: session to be used by link
169 * @ownnode: identity of own node 176 * @ownnode: identity of own node
170 * @peer: identity of peer node 177 * @peer: node id of peer node
171 * @maddr: media address to be used 178 * @maddr: media address to be used
172 * @inputq: queue to put messages ready for delivery 179 * @inputq: queue to put messages ready for delivery
173 * @namedq: queue to put binding table update messages ready for delivery 180 * @namedq: queue to put binding table update messages ready for delivery
@@ -175,47 +182,47 @@ static u32 link_own_addr(struct tipc_link *l)
175 * 182 *
176 * Returns true if link was created, otherwise false 183 * Returns true if link was created, otherwise false
177 */ 184 */
178bool tipc_link_create(struct tipc_node *n, struct tipc_bearer *b, u32 session, 185bool tipc_link_create(struct tipc_node *n, char *if_name, int bearer_id,
179 u32 ownnode, u32 peer, struct tipc_media_addr *maddr, 186 int tolerance, char net_plane, u32 mtu, int priority,
187 int window, u32 session, u32 ownnode, u32 peer,
188 struct tipc_media_addr *maddr,
180 struct sk_buff_head *inputq, struct sk_buff_head *namedq, 189 struct sk_buff_head *inputq, struct sk_buff_head *namedq,
181 struct tipc_link **link) 190 struct tipc_link **link)
182{ 191{
183 struct tipc_link *l; 192 struct tipc_link *l;
184 struct tipc_msg *hdr; 193 struct tipc_msg *hdr;
185 char *if_name;
186 194
187 l = kzalloc(sizeof(*l), GFP_ATOMIC); 195 l = kzalloc(sizeof(*l), GFP_ATOMIC);
188 if (!l) 196 if (!l)
189 return false; 197 return false;
190 *link = l; 198 *link = l;
199 l->pmsg = (struct tipc_msg *)&l->proto_msg;
200 hdr = l->pmsg;
201 tipc_msg_init(ownnode, hdr, LINK_PROTOCOL, RESET_MSG, INT_H_SIZE, peer);
202 msg_set_size(hdr, sizeof(l->proto_msg));
203 msg_set_session(hdr, session);
204 msg_set_bearer_id(hdr, l->bearer_id);
191 205
192 /* Note: peer i/f name is completed by reset/activate message */ 206 /* Note: peer i/f name is completed by reset/activate message */
193 if_name = strchr(b->name, ':') + 1;
194 sprintf(l->name, "%u.%u.%u:%s-%u.%u.%u:unknown", 207 sprintf(l->name, "%u.%u.%u:%s-%u.%u.%u:unknown",
195 tipc_zone(ownnode), tipc_cluster(ownnode), tipc_node(ownnode), 208 tipc_zone(ownnode), tipc_cluster(ownnode), tipc_node(ownnode),
196 if_name, tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); 209 if_name, tipc_zone(peer), tipc_cluster(peer), tipc_node(peer));
210 strcpy((char *)msg_data(hdr), if_name);
197 211
198 l->addr = peer; 212 l->addr = peer;
199 l->media_addr = maddr; 213 l->media_addr = maddr;
200 l->owner = n; 214 l->owner = n;
201 l->peer_session = WILDCARD_SESSION; 215 l->peer_session = WILDCARD_SESSION;
202 l->bearer_id = b->identity; 216 l->bearer_id = bearer_id;
203 l->tolerance = b->tolerance; 217 l->tolerance = tolerance;
204 l->net_plane = b->net_plane; 218 l->net_plane = net_plane;
205 l->advertised_mtu = b->mtu; 219 l->advertised_mtu = mtu;
206 l->mtu = b->mtu; 220 l->mtu = mtu;
207 l->priority = b->priority; 221 l->priority = priority;
208 tipc_link_set_queue_limits(l, b->window); 222 tipc_link_set_queue_limits(l, window);
209 l->inputq = inputq; 223 l->inputq = inputq;
210 l->namedq = namedq; 224 l->namedq = namedq;
211 l->state = LINK_RESETTING; 225 l->state = LINK_RESETTING;
212 l->pmsg = (struct tipc_msg *)&l->proto_msg;
213 hdr = l->pmsg;
214 tipc_msg_init(ownnode, hdr, LINK_PROTOCOL, RESET_MSG, INT_H_SIZE, peer);
215 msg_set_size(hdr, sizeof(l->proto_msg));
216 msg_set_session(hdr, session);
217 msg_set_bearer_id(hdr, l->bearer_id);
218 strcpy((char *)msg_data(hdr), if_name);
219 __skb_queue_head_init(&l->transmq); 226 __skb_queue_head_init(&l->transmq);
220 __skb_queue_head_init(&l->backlogq); 227 __skb_queue_head_init(&l->backlogq);
221 __skb_queue_head_init(&l->deferdq); 228 __skb_queue_head_init(&l->deferdq);
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 0201212cb49a..06bf66df9469 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -205,8 +205,10 @@ struct tipc_link {
205 struct tipc_stats stats; 205 struct tipc_stats stats;
206}; 206};
207 207
208bool tipc_link_create(struct tipc_node *n, struct tipc_bearer *b, u32 session, 208bool tipc_link_create(struct tipc_node *n, char *if_name, int bearer_id,
209 u32 ownnode, u32 peer, struct tipc_media_addr *maddr, 209 int tolerance, char net_plane, u32 mtu, int priority,
210 int window, u32 session, u32 ownnode, u32 peer,
211 struct tipc_media_addr *maddr,
210 struct sk_buff_head *inputq, struct sk_buff_head *namedq, 212 struct sk_buff_head *inputq, struct sk_buff_head *namedq,
211 struct tipc_link **link); 213 struct tipc_link **link);
212void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl, 214void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 2670751d0e2e..d3f7ca202281 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -493,6 +493,7 @@ void tipc_node_check_dest(struct net *net, u32 onode,
493 bool link_up = false; 493 bool link_up = false;
494 bool accept_addr = false; 494 bool accept_addr = false;
495 bool reset = true; 495 bool reset = true;
496 char *if_name;
496 497
497 *dupl_addr = false; 498 *dupl_addr = false;
498 *respond = false; 499 *respond = false;
@@ -579,7 +580,10 @@ void tipc_node_check_dest(struct net *net, u32 onode,
579 pr_warn("Cannot establish 3rd link to %x\n", n->addr); 580 pr_warn("Cannot establish 3rd link to %x\n", n->addr);
580 goto exit; 581 goto exit;
581 } 582 }
582 if (!tipc_link_create(n, b, mod(tipc_net(net)->random), 583 if_name = strchr(b->name, ':') + 1;
584 if (!tipc_link_create(n, if_name, b->identity, b->tolerance,
585 b->net_plane, b->mtu, b->priority,
586 b->window, mod(tipc_net(net)->random),
583 tipc_own_addr(net), onode, &le->maddr, 587 tipc_own_addr(net), onode, &le->maddr,
584 &le->inputq, &n->bclink.namedq, &l)) { 588 &le->inputq, &n->bclink.namedq, &l)) {
585 *respond = false; 589 *respond = false;