|
@@ -190,6 +190,33 @@ next:
|
|
|
return curr_gw;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * batadv_gw_check_client_stop - check if client mode has been switched off
|
|
|
+ * @bat_priv: the bat priv with all the soft interface information
|
|
|
+ *
|
|
|
+ * This function assumes the caller has checked that the gw state *is actually
|
|
|
+ * changing*. This function is not supposed to be called when there is no state
|
|
|
+ * change.
|
|
|
+ */
|
|
|
+void batadv_gw_check_client_stop(struct batadv_priv *bat_priv)
|
|
|
+{
|
|
|
+ struct batadv_gw_node *curr_gw;
|
|
|
+
|
|
|
+ if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_CLIENT)
|
|
|
+ return;
|
|
|
+
|
|
|
+ curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
|
|
|
+ if (!curr_gw)
|
|
|
+ return;
|
|
|
+
|
|
|
+ /* if batman-adv is switching the gw client mode off and a gateway was
|
|
|
+ * already selected, send a DEL uevent
|
|
|
+ */
|
|
|
+ batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL, NULL);
|
|
|
+
|
|
|
+ batadv_gw_node_free_ref(curr_gw);
|
|
|
+}
|
|
|
+
|
|
|
void batadv_gw_election(struct batadv_priv *bat_priv)
|
|
|
{
|
|
|
struct batadv_gw_node *curr_gw = NULL, *next_gw = NULL;
|