summaryrefslogtreecommitdiff
path: root/net/batman-adv/bat_iv_ogm.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2012-02-07 17:20:48 +0800
committerAntonio Quartulli <ordex@autistici.org>2012-04-18 09:53:59 +0200
commit77af7575c4b11ce7d27b4cb372abd358b2dcd850 (patch)
tree7e29c816a445dbce85758313685046edb98844d5 /net/batman-adv/bat_iv_ogm.c
parent00a50076a3afa4014cdd57e87e31a00ce4c4b67e (diff)
batman-adv: handle routing code initialization properly
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/bat_iv_ogm.c')
-rw-r--r--net/batman-adv/bat_iv_ogm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 4cc66db699ed..271467033a1c 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -30,10 +30,11 @@
#include "send.h"
#include "bat_algo.h"
-static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
+static int bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
{
struct batman_ogm_packet *batman_ogm_packet;
uint32_t random_seqno;
+ int res = -1;
/* randomize initial seqno to avoid collision */
get_random_bytes(&random_seqno, sizeof(random_seqno));
@@ -42,6 +43,9 @@ static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
hard_iface->packet_len = BATMAN_OGM_LEN;
hard_iface->packet_buff = kmalloc(hard_iface->packet_len, GFP_ATOMIC);
+ if (!hard_iface->packet_buff)
+ goto out;
+
batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
batman_ogm_packet->header.packet_type = BAT_OGM;
batman_ogm_packet->header.version = COMPAT_VERSION;
@@ -50,6 +54,11 @@ static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
batman_ogm_packet->tq = TQ_MAX_VALUE;
batman_ogm_packet->tt_num_changes = 0;
batman_ogm_packet->ttvn = 0;
+
+ res = 0;
+
+out:
+ return res;
}
static void bat_iv_ogm_iface_disable(struct hard_iface *hard_iface)