| 436 | |
| 437 | #if defined(SAL_USING_AF_NETLINK) |
| 438 | int netdev_getnetdev(struct msg_buf *msg, int (*cb)(struct msg_buf *m_buf, struct netdev *nd, int nd_num, int index, int ipvx)) |
| 439 | { |
| 440 | struct netdev *cur_nd_list = netdev_list; |
| 441 | struct netdev *nd_node; |
| 442 | int nd_num = 0; |
| 443 | int err = 0; |
| 444 | |
| 445 | if (cur_nd_list == RT_NULL) |
| 446 | return 0; |
| 447 | |
| 448 | rt_spin_lock(&_spinlock); |
| 449 | nd_num = rt_slist_len(&cur_nd_list->list) + 1; |
| 450 | rt_spin_unlock(&_spinlock); |
| 451 | |
| 452 | err = cb(msg, cur_nd_list, nd_num, nd.ifindex, ROUTE_IPV4_TRUE); |
| 453 | if (err < 0) |
| 454 | return err; |
| 455 | |
| 456 | |
| 457 | rt_spin_lock(&_spinlock); |
| 458 | rt_slist_for_each_entry(nd_node, &(cur_nd_list->list), list) |
| 459 | { |
| 460 | rt_spin_unlock(&_spinlock); |
| 461 | err = cb(msg, nd_node, nd_num, nd.ifindex, ROUTE_IPV4_TRUE); |
| 462 | if (err < 0) |
| 463 | { |
| 464 | return err; |
| 465 | } |
| 466 | |
| 467 | rt_spin_lock(&_spinlock); |
| 468 | } |
| 469 | rt_spin_unlock(&_spinlock); |
| 470 | |
| 471 | return 0; |
| 472 | } |
| 473 | #endif |
| 474 | |
| 475 | /** |
nothing calls this directly
no test coverage detected