1/* 2 * net/tipc/node.c: TIPC node management routines 3 * 4 * Copyright (c) 2000-2006, Ericsson AB 5 * Copyright (c) 2005-2006, Wind River Systems 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are met: 10 * 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the names of the copyright holders nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * Alternatively, this software may be distributed under the terms of the 21 * GNU General Public License ("GPL") version 2 as published by the Free 22 * Software Foundation. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. 35 */ 36 37#include "core.h" 38#include "config.h" 39#include "node.h" 40#include "cluster.h" 41#include "net.h" 42#include "addr.h" 43#include "node_subscr.h" 44#include "link.h" 45#include "port.h" 46#include "bearer.h" 47#include "name_distr.h" 48 49void node_print(struct print_buf *buf, struct node *n_ptr, char *str); 50static void node_lost_contact(struct node *n_ptr); 51static void node_established_contact(struct node *n_ptr); 52 53struct node *tipc_nodes = NULL; /* sorted list of nodes within cluster */ 54 55u32 tipc_own_tag = 0; 56 57struct node *tipc_node_create(u32 addr) 58{ 59 struct cluster *c_ptr; 60 struct node *n_ptr; 61 struct node **curr_node; 62 63 n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC); 64 if (!n_ptr) { 65 warn("Node creation failed, no memory\n"); 66 return NULL; 67 } 68 69 c_ptr = tipc_cltr_find(addr); 70 if (!c_ptr) { 71 c_ptr = tipc_cltr_create(addr); 72 } 73 if (!c_ptr) { 74 kfree(n_ptr); 75 return NULL; 76 } 77 78 n_ptr->addr = addr; 79 spin_lock_init(&n_ptr->lock); 80 INIT_LIST_HEAD(&n_ptr->nsub); 81 n_ptr->owner = c_ptr; 82 tipc_cltr_attach_node(c_ptr, n_ptr); 83 n_ptr->last_router = -1; 84 85 /* Insert node into ordered list */ 86 for (curr_node = &tipc_nodes; *curr_node; 87 curr_node = &(*curr_node)->next) { 88 if (addr < (*curr_node)->addr) { 89 n_ptr->next = *curr_node; 90 break; 91 } 92 } 93 (*curr_node) = n_ptr; 94 return n_ptr; 95} 96 97void tipc_node_delete(struct node *n_ptr) 98{ 99 if (!n_ptr) 100 return; 101 102 103 dbg("node %x deleted\n", n_ptr->addr); 104 kfree(n_ptr); 105} 106 107 108/** 109 * tipc_node_link_up - handle addition of link 110 * 111 * Link becomes active (alone or shared) or standby, depending on its priority. 112 */ 113 114void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) 115{ 116 struct link **active = &n_ptr->active_links[0]; 117 118 n_ptr->working_links++; 119 120 info("Established link <%s> on network plane %c\n", 121 l_ptr->name, l_ptr->b_ptr->net_plane); 122 123 if (!active[0]) { 124 dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]); 125 active[0] = active[1] = l_ptr; 126 node_established_contact(n_ptr); 127 return; 128 } 129 if (l_ptr->priority < active[0]->priority) { 130 info("New link <%s> becomes standby\n", l_ptr->name); 131 return; 132 } 133 tipc_link_send_duplicate(active[0], l_ptr); 134 if (l_ptr->priority == active[0]->priority) { 135 active[0] = l_ptr; 136 return; 137 } 138 info("Old link <%s> becomes standby\n", active[0]->name); 139 if (active[1] != active[0]) 140 info("Old link <%s> becomes standby\n", active[1]->name); 141 active[0] = active[1] = l_ptr; 142} 143 144/** 145 * node_select_active_links - select active link 146 */ 147 148static void node_select_active_links(struct node *n_ptr) 149{ 150 struct link **active = &n_ptr->active_links[0]; 151 u32 i; 152 u32 highest_prio = 0; 153 154 active[0] = active[1] = NULL; 155 156 for (i = 0; i < MAX_BEARERS; i++) { 157 struct link *l_ptr = n_ptr->links[i]; 158 159 if (!l_ptr || !tipc_link_is_up(l_ptr) || 160 (l_ptr->priority < highest_prio)) 161 continue; 162 163 if (l_ptr->priority > highest_prio) { 164 highest_prio = l_ptr->priority; 165 active[0] = active[1] = l_ptr; 166 } else { 167 active[1] = l_ptr; 168 } 169 } 170} 171 172/** 173 * tipc_node_link_down - handle loss of link 174 */ 175 176void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr) 177{ 178 struct link **active; 179 180 n_ptr->working_links--; 181 182 if (!tipc_link_is_active(l_ptr)) { 183 info("Lost standby link <%s> on network plane %c\n", 184 l_ptr->name, l_ptr->b_ptr->net_plane); 185 return; 186 } 187 info("Lost link <%s> on network plane %c\n", 188 l_ptr->name, l_ptr->b_ptr->net_plane); 189 190 active = &n_ptr->active_links[0]; 191 if (active[0] == l_ptr) 192 active[0] = active[1]; 193 if (active[1] == l_ptr) 194 active[1] = active[0]; 195 if (active[0] == l_ptr) 196 node_select_active_links(n_ptr); 197 if (tipc_node_is_up(n_ptr)) 198 tipc_link_changeover(l_ptr); 199 else 200 node_lost_contact(n_ptr); 201} 202 203int tipc_node_has_active_links(struct node *n_ptr) 204{ 205 return (n_ptr && 206 ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); 207} 208 209int tipc_node_has_redundant_links(struct node *n_ptr) 210{ 211 return (n_ptr->working_links > 1); 212} 213 214static int tipc_node_has_active_routes(struct node *n_ptr) 215{ 216 return (n_ptr && (n_ptr->last_router >= 0)); 217} 218 219int tipc_node_is_up(struct node *n_ptr) 220{ 221 return (tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr)); 222} 223 224struct node *tipc_node_attach_link(struct link *l_ptr) 225{ 226 struct node *n_ptr = tipc_node_find(l_ptr->addr); 227 228 if (!n_ptr) 229 n_ptr = tipc_node_create(l_ptr->addr); 230 if (n_ptr) { 231 u32 bearer_id = l_ptr->b_ptr->identity; 232 char addr_string[16]; 233 234 if (n_ptr->link_cnt >= 2) { 235 char addr_string[16]; 236 237 err("Attempt to create third link to %s\n", 238 addr_string_fill(addr_string, n_ptr->addr)); 239 return NULL; 240 } 241 242 if (!n_ptr->links[bearer_id]) { 243 n_ptr->links[bearer_id] = l_ptr; 244 tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; 245 n_ptr->link_cnt++; 246 return n_ptr; 247 } 248 err("Attempt to establish second link on <%s> to %s \n", 249 l_ptr->b_ptr->publ.name, 250 addr_string_fill(addr_string, l_ptr->addr)); 251 } 252 return NULL; 253} 254 255void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) 256{ 257 n_ptr->links[l_ptr->b_ptr->identity] = NULL; 258 tipc_net.zones[tipc_zone(l_ptr->addr)]->links--; 259 n_ptr->link_cnt--; 260} 261 262/* 263 * Routing table management - five cases to handle: 264 * 265 * 1: A link towards a zone/cluster external node comes up. 266 * => Send a multicast message updating routing tables of all 267 * system nodes within own cluster that the new destination 268 * can be reached via this node. 269 * (node.establishedContact()=>cluster.multicastNewRoute()) 270 * 271 * 2: A link towards a slave node comes up. 272 * => Send a multicast message updating routing tables of all 273 * system nodes within own cluster that the new destination 274 * can be reached via this node. 275 * (node.establishedContact()=>cluster.multicastNewRoute()) 276 * => Send a message to the slave node about existence 277 * of all system nodes within cluster: 278 * (node.establishedContact()=>cluster.sendLocalRoutes()) 279 * 280 * 3: A new cluster local system node becomes available. 281 * => Send message(s) to this particular node containing 282 * information about all cluster external and slave 283 * nodes which can be reached via this node. 284 * (node.establishedContact()==>network.sendExternalRoutes()) 285 * (node.establishedContact()==>network.sendSlaveRoutes()) 286 * => Send messages to all directly connected slave nodes 287 * containing information about the existence of the new node 288 * (node.establishedContact()=>cluster.multicastNewRoute()) 289 * 290 * 4: The link towards a zone/cluster external node or slave 291 * node goes down. 292 * => Send a multcast message updating routing tables of all 293 * nodes within cluster that the new destination can not any 294 * longer be reached via this node. 295 * (node.lostAllLinks()=>cluster.bcastLostRoute()) 296 * 297 * 5: A cluster local system node becomes unavailable. 298 * => Remove all references to this node from the local 299 * routing tables. Note: This is a completely node 300 * local operation. 301 * (node.lostAllLinks()=>network.removeAsRouter()) 302 * => Send messages to all directly connected slave nodes 303 * containing information about loss of the node 304 * (node.establishedContact()=>cluster.multicastLostRoute()) 305 * 306 */ 307 308static void node_established_contact(struct node *n_ptr) 309{ 310 struct cluster *c_ptr; 311 312 dbg("node_established_contact:-> %x\n", n_ptr->addr); 313 if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) { 314 tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr); 315 } 316 317 /* Syncronize broadcast acks */ 318 n_ptr->bclink.acked = tipc_bclink_get_last_sent(); 319 320 if (is_slave(tipc_own_addr)) 321 return; 322 if (!in_own_cluster(n_ptr->addr)) { 323 /* Usage case 1 (see above) */ 324 c_ptr = tipc_cltr_find(tipc_own_addr); 325 if (!c_ptr) 326 c_ptr = tipc_cltr_create(tipc_own_addr); 327 if (c_ptr) 328 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, 329 tipc_max_nodes); 330 return; 331 } 332 333 c_ptr = n_ptr->owner; 334 if (is_slave(n_ptr->addr)) { 335 /* Usage case 2 (see above) */ 336 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); 337 tipc_cltr_send_local_routes(c_ptr, n_ptr->addr); 338 return; 339 } 340 341 if (n_ptr->bclink.supported) { 342 tipc_nmap_add(&tipc_cltr_bcast_nodes, n_ptr->addr); 343 if (n_ptr->addr < tipc_own_addr) 344 tipc_own_tag++; 345 } 346 347 /* Case 3 (see above) */ 348 tipc_net_send_external_routes(n_ptr->addr); 349 tipc_cltr_send_slave_routes(c_ptr, n_ptr->addr); 350 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE, 351 tipc_highest_allowed_slave); 352} 353 354static void node_lost_contact(struct node *n_ptr) 355{ 356 struct cluster *c_ptr; 357 struct node_subscr *ns, *tns; 358 char addr_string[16]; 359 u32 i; 360 361 /* Clean up broadcast reception remains */ 362 n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0; 363 while (n_ptr->bclink.deferred_head) { 364 struct sk_buff* buf = n_ptr->bclink.deferred_head; 365 n_ptr->bclink.deferred_head = buf->next; 366 buf_discard(buf); 367 } 368 if (n_ptr->bclink.defragm) { 369 buf_discard(n_ptr->bclink.defragm); 370 n_ptr->bclink.defragm = NULL; 371 } 372 if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { 373 tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); 374 } 375 376 /* Update routing tables */ 377 if (is_slave(tipc_own_addr)) { 378 tipc_net_remove_as_router(n_ptr->addr); 379 } else { 380 if (!in_own_cluster(n_ptr->addr)) { 381 /* Case 4 (see above) */ 382 c_ptr = tipc_cltr_find(tipc_own_addr); 383 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, 384 tipc_max_nodes); 385 } else { 386 /* Case 5 (see above) */ 387 c_ptr = tipc_cltr_find(n_ptr->addr); 388 if (is_slave(n_ptr->addr)) { 389 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, 390 tipc_max_nodes); 391 } else { 392 if (n_ptr->bclink.supported) { 393 tipc_nmap_remove(&tipc_cltr_bcast_nodes, 394 n_ptr->addr); 395 if (n_ptr->addr < tipc_own_addr) 396 tipc_own_tag--; 397 } 398 tipc_net_remove_as_router(n_ptr->addr); 399 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 400 LOWEST_SLAVE, 401 tipc_highest_allowed_slave); 402 } 403 } 404 } 405 if (tipc_node_has_active_routes(n_ptr)) 406 return; 407 408 info("Lost contact with %s\n", 409 addr_string_fill(addr_string, n_ptr->addr)); 410 411 /* Abort link changeover */ 412 for (i = 0; i < MAX_BEARERS; i++) { 413 struct link *l_ptr = n_ptr->links[i]; 414 if (!l_ptr) 415 continue; 416 l_ptr->reset_checkpoint = l_ptr->next_in_no; 417 l_ptr->exp_msg_count = 0; 418 tipc_link_reset_fragments(l_ptr); 419 } 420 421 /* Notify subscribers */ 422 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { 423 ns->node = NULL; 424 list_del_init(&ns->nodesub_list); 425 tipc_k_signal((Handler)ns->handle_node_down, 426 (unsigned long)ns->usr_handle); 427 } 428} 429 430/** 431 * tipc_node_select_next_hop - find the next-hop node for a message 432 * 433 * Called by when cluster local lookup has failed. 434 */ 435 436struct node *tipc_node_select_next_hop(u32 addr, u32 selector) 437{ 438 struct node *n_ptr; 439 u32 router_addr; 440 441 if (!tipc_addr_domain_valid(addr)) 442 return NULL; 443 444 /* Look for direct link to destination processsor */ 445 n_ptr = tipc_node_find(addr); 446 if (n_ptr && tipc_node_has_active_links(n_ptr)) 447 return n_ptr; 448 449 /* Cluster local system nodes *must* have direct links */ 450 if (!is_slave(addr) && in_own_cluster(addr)) 451 return NULL; 452 453 /* Look for cluster local router with direct link to node */ 454 router_addr = tipc_node_select_router(n_ptr, selector); 455 if (router_addr) 456 return tipc_node_select(router_addr, selector); 457 458 /* Slave nodes can only be accessed within own cluster via a 459 known router with direct link -- if no router was found,give up */ 460 if (is_slave(addr)) 461 return NULL; 462 463 /* Inter zone/cluster -- find any direct link to remote cluster */ 464 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); 465 n_ptr = tipc_net_select_remote_node(addr, selector); 466 if (n_ptr && tipc_node_has_active_links(n_ptr)) 467 return n_ptr; 468 469 /* Last resort -- look for any router to anywhere in remote zone */ 470 router_addr = tipc_net_select_router(addr, selector); 471 if (router_addr) 472 return tipc_node_select(router_addr, selector); 473 474 return NULL; 475} 476 477/** 478 * tipc_node_select_router - select router to reach specified node 479 * 480 * Uses a deterministic and fair algorithm for selecting router node. 481 */ 482 483u32 tipc_node_select_router(struct node *n_ptr, u32 ref) 484{ 485 u32 ulim; 486 u32 mask; 487 u32 start; 488 u32 r; 489 490 if (!n_ptr) 491 return 0; 492 493 if (n_ptr->last_router < 0) 494 return 0; 495 ulim = ((n_ptr->last_router + 1) * 32) - 1; 496 497 /* Start entry must be random */ 498 mask = tipc_max_nodes; 499 while (mask > ulim) 500 mask >>= 1; 501 start = ref & mask; 502 r = start; 503 504 /* Lookup upwards with wrap-around */ 505 do { 506 if (((n_ptr->routers[r / 32]) >> (r % 32)) & 1) 507 break; 508 } while (++r <= ulim); 509 if (r > ulim) { 510 r = 1; 511 do { 512 if (((n_ptr->routers[r / 32]) >> (r % 32)) & 1) 513 break; 514 } while (++r < start); 515 assert(r != start); 516 } 517 assert(r && (r <= ulim)); 518 return tipc_addr(own_zone(), own_cluster(), r); 519} 520 521void tipc_node_add_router(struct node *n_ptr, u32 router) 522{ 523 u32 r_num = tipc_node(router); 524 525 n_ptr->routers[r_num / 32] = 526 ((1 << (r_num % 32)) | n_ptr->routers[r_num / 32]); 527 n_ptr->last_router = tipc_max_nodes / 32; 528 while ((--n_ptr->last_router >= 0) && 529 !n_ptr->routers[n_ptr->last_router]); 530} 531 532void tipc_node_remove_router(struct node *n_ptr, u32 router) 533{ 534 u32 r_num = tipc_node(router); 535 536 if (n_ptr->last_router < 0) 537 return; /* No routes */ 538 539 n_ptr->routers[r_num / 32] = 540 ((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32])); 541 n_ptr->last_router = tipc_max_nodes / 32; 542 while ((--n_ptr->last_router >= 0) && 543 !n_ptr->routers[n_ptr->last_router]); 544 545 if (!tipc_node_is_up(n_ptr)) 546 node_lost_contact(n_ptr); 547} 548 549 550u32 tipc_available_nodes(const u32 domain) 551{ 552 struct node *n_ptr; 553 u32 cnt = 0; 554 555 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { 556 if (!in_scope(domain, n_ptr->addr)) 557 continue; 558 if (tipc_node_is_up(n_ptr)) 559 cnt++; 560 } 561 return cnt; 562} 563 564struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) 565{ 566 u32 domain; 567 struct sk_buff *buf; 568 struct node *n_ptr; 569 struct tipc_node_info node_info; 570 u32 payload_size; 571 572 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 573 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 574 575 domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 576 if (!tipc_addr_domain_valid(domain)) 577 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 578 " (network address)"); 579 580 if (!tipc_nodes) 581 return tipc_cfg_reply_none(); 582 583 /* For now, get space for all other nodes 584 (will need to modify this when slave nodes are supported */ 585 586 payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1); 587 if (payload_size > 32768u) 588 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 589 " (too many nodes)"); 590 buf = tipc_cfg_reply_alloc(payload_size); 591 if (!buf) 592 return NULL; 593 594 /* Add TLVs for all nodes in scope */ 595 596 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { 597 if (!in_scope(domain, n_ptr->addr)) 598 continue; 599 node_info.addr = htonl(n_ptr->addr); 600 node_info.up = htonl(tipc_node_is_up(n_ptr)); 601 tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, 602 &node_info, sizeof(node_info)); 603 } 604 605 return buf; 606} 607 608struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) 609{ 610 u32 domain; 611 struct sk_buff *buf; 612 struct node *n_ptr; 613 struct tipc_link_info link_info; 614 u32 payload_size; 615 616 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 617 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 618 619 domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); 620 if (!tipc_addr_domain_valid(domain)) 621 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 622 " (network address)"); 623 624 if (tipc_mode != TIPC_NET_MODE) 625 return tipc_cfg_reply_none(); 626 627 /* Get space for all unicast links + multicast link */ 628 629 payload_size = TLV_SPACE(sizeof(link_info)) * 630 (tipc_net.zones[tipc_zone(tipc_own_addr)]->links + 1); 631 if (payload_size > 32768u) 632 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 633 " (too many links)"); 634 buf = tipc_cfg_reply_alloc(payload_size); 635 if (!buf) 636 return NULL; 637 638 /* Add TLV for broadcast link */ 639 640 link_info.dest = htonl(tipc_own_addr & 0xfffff00); 641 link_info.up = htonl(1); 642 sprintf(link_info.str, tipc_bclink_name); 643 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); 644 645 /* Add TLVs for any other links in scope */ 646 647 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { 648 u32 i; 649 650 if (!in_scope(domain, n_ptr->addr)) 651 continue; 652 for (i = 0; i < MAX_BEARERS; i++) { 653 if (!n_ptr->links[i]) 654 continue; 655 link_info.dest = htonl(n_ptr->addr); 656 link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); 657 strcpy(link_info.str, n_ptr->links[i]->name); 658 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, 659 &link_info, sizeof(link_info)); 660 } 661 } 662 663 return buf; 664} 665