aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/main.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2012-08-03 11:15:46 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-10-29 04:42:29 -0400
commit30da63a6af1dbf60e6d989faa4b984b1c6c9dfaf (patch)
tree6c596e108d2e0e65fe5914f71eef978076459b43 /net/batman-adv/main.c
parentf03a13a7167caeb550b3c424da1be691bfbe54ff (diff)
batman-adv: consolidate duplicated primary_if checking code
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/main.c')
-rw-r--r--net/batman-adv/main.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index b4aa470bc4a6..a4a337d9af9c 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -188,6 +188,42 @@ int batadv_is_my_mac(const uint8_t *addr)
188 return 0; 188 return 0;
189} 189}
190 190
191/**
192 * batadv_seq_print_text_primary_if_get - called from debugfs table printing
193 * function that requires the primary interface
194 * @seq: debugfs table seq_file struct
195 *
196 * Returns primary interface if found or NULL otherwise.
197 */
198struct batadv_hard_iface *
199batadv_seq_print_text_primary_if_get(struct seq_file *seq)
200{
201 struct net_device *net_dev = (struct net_device *)seq->private;
202 struct batadv_priv *bat_priv = netdev_priv(net_dev);
203 struct batadv_hard_iface *primary_if;
204
205 primary_if = batadv_primary_if_get_selected(bat_priv);
206
207 if (!primary_if) {
208 seq_printf(seq,
209 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
210 net_dev->name);
211 goto out;
212 }
213
214 if (primary_if->if_status == BATADV_IF_ACTIVE)
215 goto out;
216
217 seq_printf(seq,
218 "BATMAN mesh %s disabled - primary interface not active\n",
219 net_dev->name);
220 batadv_hardif_free_ref(primary_if);
221 primary_if = NULL;
222
223out:
224 return primary_if;
225}
226
191static int batadv_recv_unhandled_packet(struct sk_buff *skb, 227static int batadv_recv_unhandled_packet(struct sk_buff *skb,
192 struct batadv_hard_iface *recv_if) 228 struct batadv_hard_iface *recv_if)
193{ 229{