summaryrefslogtreecommitdiff
path: root/net/batman-adv/bat_v.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/bat_v.c')
-rw-r--r--net/batman-adv/bat_v.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 0fea894855ff..b90a4dfe8ba6 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -22,11 +22,22 @@
#include <linux/init.h>
#include "bat_v_elp.h"
+#include "bat_v_ogm.h"
#include "packet.h"
static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface)
{
- return batadv_v_elp_iface_enable(hard_iface);
+ int ret;
+
+ ret = batadv_v_elp_iface_enable(hard_iface);
+ if (ret < 0)
+ return ret;
+
+ ret = batadv_v_ogm_iface_enable(hard_iface);
+ if (ret < 0)
+ batadv_v_elp_iface_disable(hard_iface);
+
+ return ret;
}
static void batadv_v_iface_disable(struct batadv_hard_iface *hard_iface)
@@ -41,6 +52,7 @@ static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
static void batadv_v_primary_iface_set(struct batadv_hard_iface *hard_iface)
{
batadv_v_elp_primary_iface_set(hard_iface);
+ batadv_v_ogm_primary_iface_set(hard_iface);
}
static void
@@ -69,6 +81,27 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = {
};
/**
+ * batadv_v_mesh_init - initialize the B.A.T.M.A.N. V private resources for a
+ * mesh
+ * @bat_priv: the object representing the mesh interface to initialise
+ *
+ * Return: 0 on success or a negative error code otherwise
+ */
+int batadv_v_mesh_init(struct batadv_priv *bat_priv)
+{
+ return batadv_v_ogm_init(bat_priv);
+}
+
+/**
+ * batadv_v_mesh_free - free the B.A.T.M.A.N. V private resources for a mesh
+ * @bat_priv: the object representing the mesh interface to free
+ */
+void batadv_v_mesh_free(struct batadv_priv *bat_priv)
+{
+ batadv_v_ogm_free(bat_priv);
+}
+
+/**
* batadv_v_init - B.A.T.M.A.N. V initialization function
*
* Description: Takes care of initializing all the subcomponents.
@@ -86,10 +119,22 @@ int __init batadv_v_init(void)
if (ret < 0)
return ret;
- ret = batadv_algo_register(&batadv_batman_v);
+ ret = batadv_recv_handler_register(BATADV_OGM2,
+ batadv_v_ogm_packet_recv);
+ if (ret < 0)
+ goto elp_unregister;
+ ret = batadv_algo_register(&batadv_batman_v);
if (ret < 0)
- batadv_recv_handler_unregister(BATADV_ELP);
+ goto ogm_unregister;
+
+ return ret;
+
+ogm_unregister:
+ batadv_recv_handler_unregister(BATADV_OGM2);
+
+elp_unregister:
+ batadv_recv_handler_unregister(BATADV_ELP);
return ret;
}