diff options
| -rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 12 | ||||
| -rw-r--r-- | net/batman-adv/debugfs.c | 16 | ||||
| -rw-r--r-- | net/batman-adv/originator.c | 48 | ||||
| -rw-r--r-- | net/batman-adv/originator.h | 1 | ||||
| -rw-r--r-- | net/batman-adv/types.h | 3 |
5 files changed, 73 insertions, 7 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index a9b7e82feb31..fb196a07812c 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
| @@ -1777,9 +1777,11 @@ batadv_iv_ogm_orig_print_neigh(struct batadv_orig_node *orig_node, | |||
| 1777 | * batadv_iv_ogm_orig_print - print the originator table | 1777 | * batadv_iv_ogm_orig_print - print the originator table |
| 1778 | * @bat_priv: the bat priv with all the soft interface information | 1778 | * @bat_priv: the bat priv with all the soft interface information |
| 1779 | * @seq: debugfs table seq_file struct | 1779 | * @seq: debugfs table seq_file struct |
| 1780 | * @if_outgoing: the outgoing interface for which this should be printed | ||
| 1780 | */ | 1781 | */ |
| 1781 | static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv, | 1782 | static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv, |
| 1782 | struct seq_file *seq) | 1783 | struct seq_file *seq, |
| 1784 | struct batadv_hard_iface *if_outgoing) | ||
| 1783 | { | 1785 | { |
| 1784 | struct batadv_neigh_node *neigh_node; | 1786 | struct batadv_neigh_node *neigh_node; |
| 1785 | struct batadv_hashtable *hash = bat_priv->orig_hash; | 1787 | struct batadv_hashtable *hash = bat_priv->orig_hash; |
| @@ -1801,12 +1803,12 @@ static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv, | |||
| 1801 | rcu_read_lock(); | 1803 | rcu_read_lock(); |
| 1802 | hlist_for_each_entry_rcu(orig_node, head, hash_entry) { | 1804 | hlist_for_each_entry_rcu(orig_node, head, hash_entry) { |
| 1803 | neigh_node = batadv_orig_router_get(orig_node, | 1805 | neigh_node = batadv_orig_router_get(orig_node, |
| 1804 | BATADV_IF_DEFAULT); | 1806 | if_outgoing); |
| 1805 | if (!neigh_node) | 1807 | if (!neigh_node) |
| 1806 | continue; | 1808 | continue; |
| 1807 | 1809 | ||
| 1808 | n_ifinfo = batadv_neigh_ifinfo_get(neigh_node, | 1810 | n_ifinfo = batadv_neigh_ifinfo_get(neigh_node, |
| 1809 | BATADV_IF_DEFAULT); | 1811 | if_outgoing); |
| 1810 | if (!n_ifinfo) | 1812 | if (!n_ifinfo) |
| 1811 | goto next; | 1813 | goto next; |
| 1812 | 1814 | ||
| @@ -1824,8 +1826,8 @@ static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv, | |||
| 1824 | neigh_node->addr, | 1826 | neigh_node->addr, |
| 1825 | neigh_node->if_incoming->net_dev->name); | 1827 | neigh_node->if_incoming->net_dev->name); |
| 1826 | 1828 | ||
| 1827 | batadv_iv_ogm_orig_print_neigh(orig_node, | 1829 | batadv_iv_ogm_orig_print_neigh(orig_node, if_outgoing, |
| 1828 | BATADV_IF_DEFAULT, seq); | 1830 | seq); |
| 1829 | seq_puts(seq, "\n"); | 1831 | seq_puts(seq, "\n"); |
| 1830 | batman_count++; | 1832 | batman_count++; |
| 1831 | 1833 | ||
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index 2ea36952139a..26cbf34fca03 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c | |||
| @@ -248,6 +248,19 @@ static int batadv_originators_open(struct inode *inode, struct file *file) | |||
| 248 | return single_open(file, batadv_orig_seq_print_text, net_dev); | 248 | return single_open(file, batadv_orig_seq_print_text, net_dev); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | /** | ||
| 252 | * batadv_originators_hardif_open - handles debugfs output for the | ||
| 253 | * originator table of an hard interface | ||
| 254 | * @inode: inode pointer to debugfs file | ||
| 255 | * @file: pointer to the seq_file | ||
| 256 | */ | ||
| 257 | static int batadv_originators_hardif_open(struct inode *inode, | ||
| 258 | struct file *file) | ||
| 259 | { | ||
| 260 | struct net_device *net_dev = (struct net_device *)inode->i_private; | ||
| 261 | return single_open(file, batadv_orig_hardif_seq_print_text, net_dev); | ||
| 262 | } | ||
| 263 | |||
| 251 | static int batadv_gateways_open(struct inode *inode, struct file *file) | 264 | static int batadv_gateways_open(struct inode *inode, struct file *file) |
| 252 | { | 265 | { |
| 253 | struct net_device *net_dev = (struct net_device *)inode->i_private; | 266 | struct net_device *net_dev = (struct net_device *)inode->i_private; |
| @@ -383,8 +396,11 @@ struct batadv_debuginfo batadv_hardif_debuginfo_##_name = { \ | |||
| 383 | .release = single_release, \ | 396 | .release = single_release, \ |
| 384 | }, \ | 397 | }, \ |
| 385 | }; | 398 | }; |
| 399 | static BATADV_HARDIF_DEBUGINFO(originators, S_IRUGO, | ||
| 400 | batadv_originators_hardif_open); | ||
| 386 | 401 | ||
| 387 | static struct batadv_debuginfo *batadv_hardif_debuginfos[] = { | 402 | static struct batadv_debuginfo *batadv_hardif_debuginfos[] = { |
| 403 | &batadv_hardif_debuginfo_originators, | ||
| 388 | NULL, | 404 | NULL, |
| 389 | }; | 405 | }; |
| 390 | 406 | ||
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index bd887809f08e..5ed037fab184 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
| @@ -940,11 +940,57 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) | |||
| 940 | return 0; | 940 | return 0; |
| 941 | } | 941 | } |
| 942 | 942 | ||
| 943 | bat_priv->bat_algo_ops->bat_orig_print(bat_priv, seq); | 943 | bat_priv->bat_algo_ops->bat_orig_print(bat_priv, seq, |
| 944 | BATADV_IF_DEFAULT); | ||
| 944 | 945 | ||
| 945 | return 0; | 946 | return 0; |
| 946 | } | 947 | } |
| 947 | 948 | ||
| 949 | /** | ||
| 950 | * batadv_orig_hardif_seq_print_text - writes originator infos for a specific | ||
| 951 | * outgoing interface | ||
| 952 | * @seq: debugfs table seq_file struct | ||
| 953 | * @offset: not used | ||
| 954 | * | ||
| 955 | * Returns 0 | ||
| 956 | */ | ||
| 957 | int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset) | ||
| 958 | { | ||
| 959 | struct net_device *net_dev = (struct net_device *)seq->private; | ||
| 960 | struct batadv_hard_iface *hard_iface; | ||
| 961 | struct batadv_priv *bat_priv; | ||
| 962 | |||
| 963 | hard_iface = batadv_hardif_get_by_netdev(net_dev); | ||
| 964 | |||
| 965 | if (!hard_iface || !hard_iface->soft_iface) { | ||
| 966 | seq_puts(seq, "Interface not known to B.A.T.M.A.N.\n"); | ||
| 967 | goto out; | ||
| 968 | } | ||
| 969 | |||
| 970 | bat_priv = netdev_priv(hard_iface->soft_iface); | ||
| 971 | if (!bat_priv->bat_algo_ops->bat_orig_print) { | ||
| 972 | seq_puts(seq, | ||
| 973 | "No printing function for this routing protocol\n"); | ||
| 974 | goto out; | ||
| 975 | } | ||
| 976 | |||
| 977 | if (hard_iface->if_status != BATADV_IF_ACTIVE) { | ||
| 978 | seq_puts(seq, "Interface not active\n"); | ||
| 979 | goto out; | ||
| 980 | } | ||
| 981 | |||
| 982 | seq_printf(seq, "[B.A.T.M.A.N. adv %s, IF/MAC: %s/%pM (%s %s)]\n", | ||
| 983 | BATADV_SOURCE_VERSION, hard_iface->net_dev->name, | ||
| 984 | hard_iface->net_dev->dev_addr, | ||
| 985 | hard_iface->soft_iface->name, bat_priv->bat_algo_ops->name); | ||
| 986 | |||
| 987 | bat_priv->bat_algo_ops->bat_orig_print(bat_priv, seq, hard_iface); | ||
| 988 | |||
| 989 | out: | ||
| 990 | batadv_hardif_free_ref(hard_iface); | ||
| 991 | return 0; | ||
| 992 | } | ||
| 993 | |||
| 948 | int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface, | 994 | int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface, |
| 949 | int max_if_num) | 995 | int max_if_num) |
| 950 | { | 996 | { |
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index 75a4d7bad620..ad17c3cb032d 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h | |||
| @@ -53,6 +53,7 @@ batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node, | |||
| 53 | void batadv_orig_ifinfo_free_ref(struct batadv_orig_ifinfo *orig_ifinfo); | 53 | void batadv_orig_ifinfo_free_ref(struct batadv_orig_ifinfo *orig_ifinfo); |
| 54 | 54 | ||
| 55 | int batadv_orig_seq_print_text(struct seq_file *seq, void *offset); | 55 | int batadv_orig_seq_print_text(struct seq_file *seq, void *offset); |
| 56 | int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset); | ||
| 56 | int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface, | 57 | int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface, |
| 57 | int max_if_num); | 58 | int max_if_num); |
| 58 | int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface, | 59 | int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface, |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 529b3747a085..8a1fa167e126 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
| @@ -1083,7 +1083,8 @@ struct batadv_algo_ops { | |||
| 1083 | struct batadv_neigh_node *neigh2, | 1083 | struct batadv_neigh_node *neigh2, |
| 1084 | struct batadv_hard_iface *if_outgoing2); | 1084 | struct batadv_hard_iface *if_outgoing2); |
| 1085 | /* orig_node handling API */ | 1085 | /* orig_node handling API */ |
| 1086 | void (*bat_orig_print)(struct batadv_priv *priv, struct seq_file *seq); | 1086 | void (*bat_orig_print)(struct batadv_priv *priv, struct seq_file *seq, |
| 1087 | struct batadv_hard_iface *hard_iface); | ||
| 1087 | void (*bat_orig_free)(struct batadv_orig_node *orig_node); | 1088 | void (*bat_orig_free)(struct batadv_orig_node *orig_node); |
| 1088 | int (*bat_orig_add_if)(struct batadv_orig_node *orig_node, | 1089 | int (*bat_orig_add_if)(struct batadv_orig_node *orig_node, |
| 1089 | int max_if_num); | 1090 | int max_if_num); |
