diff options
Diffstat (limited to 'net/batman-adv/bridge_loop_avoidance.c')
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 6705d35b17c..7e60466f571 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -1616,3 +1616,68 @@ out: | |||
1616 | batadv_hardif_free_ref(primary_if); | 1616 | batadv_hardif_free_ref(primary_if); |
1617 | return ret; | 1617 | return ret; |
1618 | } | 1618 | } |
1619 | |||
1620 | int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) | ||
1621 | { | ||
1622 | struct net_device *net_dev = (struct net_device *)seq->private; | ||
1623 | struct batadv_priv *bat_priv = netdev_priv(net_dev); | ||
1624 | struct batadv_hashtable *hash = bat_priv->backbone_hash; | ||
1625 | struct batadv_backbone_gw *backbone_gw; | ||
1626 | struct batadv_hard_iface *primary_if; | ||
1627 | struct hlist_node *node; | ||
1628 | struct hlist_head *head; | ||
1629 | int secs, msecs; | ||
1630 | uint32_t i; | ||
1631 | bool is_own; | ||
1632 | int ret = 0; | ||
1633 | uint8_t *primary_addr; | ||
1634 | |||
1635 | primary_if = batadv_primary_if_get_selected(bat_priv); | ||
1636 | if (!primary_if) { | ||
1637 | ret = seq_printf(seq, | ||
1638 | "BATMAN mesh %s disabled - please specify interfaces to enable it\n", | ||
1639 | net_dev->name); | ||
1640 | goto out; | ||
1641 | } | ||
1642 | |||
1643 | if (primary_if->if_status != BATADV_IF_ACTIVE) { | ||
1644 | ret = seq_printf(seq, | ||
1645 | "BATMAN mesh %s disabled - primary interface not active\n", | ||
1646 | net_dev->name); | ||
1647 | goto out; | ||
1648 | } | ||
1649 | |||
1650 | primary_addr = primary_if->net_dev->dev_addr; | ||
1651 | seq_printf(seq, | ||
1652 | "Backbones announced for the mesh %s (orig %pM, group id %04x)\n", | ||
1653 | net_dev->name, primary_addr, | ||
1654 | ntohs(bat_priv->claim_dest.group)); | ||
1655 | seq_printf(seq, " %-17s %-5s %-9s (%-4s)\n", | ||
1656 | "Originator", "VID", "last seen", "CRC"); | ||
1657 | for (i = 0; i < hash->size; i++) { | ||
1658 | head = &hash->table[i]; | ||
1659 | |||
1660 | rcu_read_lock(); | ||
1661 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | ||
1662 | msecs = jiffies_to_msecs(jiffies - | ||
1663 | backbone_gw->lasttime); | ||
1664 | secs = msecs / 1000; | ||
1665 | msecs = msecs % 1000; | ||
1666 | |||
1667 | is_own = batadv_compare_eth(backbone_gw->orig, | ||
1668 | primary_addr); | ||
1669 | if (is_own) | ||
1670 | continue; | ||
1671 | |||
1672 | seq_printf(seq, | ||
1673 | " * %pM on % 5d % 4i.%03is (%04x)\n", | ||
1674 | backbone_gw->orig, backbone_gw->vid, | ||
1675 | secs, msecs, backbone_gw->crc); | ||
1676 | } | ||
1677 | rcu_read_unlock(); | ||
1678 | } | ||
1679 | out: | ||
1680 | if (primary_if) | ||
1681 | batadv_hardif_free_ref(primary_if); | ||
1682 | return ret; | ||
1683 | } | ||