diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2012-02-07 04:20:48 -0500 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-04-18 03:53:59 -0400 |
commit | 77af7575c4b11ce7d27b4cb372abd358b2dcd850 (patch) | |
tree | 7e29c816a445dbce85758313685046edb98844d5 /net/batman-adv/bat_iv_ogm.c | |
parent | 00a50076a3afa4014cdd57e87e31a00ce4c4b67e (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.c | 11 |
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 @@ | |||
30 | #include "send.h" | 30 | #include "send.h" |
31 | #include "bat_algo.h" | 31 | #include "bat_algo.h" |
32 | 32 | ||
33 | static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface) | 33 | static int bat_iv_ogm_iface_enable(struct hard_iface *hard_iface) |
34 | { | 34 | { |
35 | struct batman_ogm_packet *batman_ogm_packet; | 35 | struct batman_ogm_packet *batman_ogm_packet; |
36 | uint32_t random_seqno; | 36 | uint32_t random_seqno; |
37 | int res = -1; | ||
37 | 38 | ||
38 | /* randomize initial seqno to avoid collision */ | 39 | /* randomize initial seqno to avoid collision */ |
39 | get_random_bytes(&random_seqno, sizeof(random_seqno)); | 40 | get_random_bytes(&random_seqno, sizeof(random_seqno)); |
@@ -42,6 +43,9 @@ static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface) | |||
42 | hard_iface->packet_len = BATMAN_OGM_LEN; | 43 | hard_iface->packet_len = BATMAN_OGM_LEN; |
43 | hard_iface->packet_buff = kmalloc(hard_iface->packet_len, GFP_ATOMIC); | 44 | hard_iface->packet_buff = kmalloc(hard_iface->packet_len, GFP_ATOMIC); |
44 | 45 | ||
46 | if (!hard_iface->packet_buff) | ||
47 | goto out; | ||
48 | |||
45 | batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; | 49 | batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; |
46 | batman_ogm_packet->header.packet_type = BAT_OGM; | 50 | batman_ogm_packet->header.packet_type = BAT_OGM; |
47 | batman_ogm_packet->header.version = COMPAT_VERSION; | 51 | batman_ogm_packet->header.version = COMPAT_VERSION; |
@@ -50,6 +54,11 @@ static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface) | |||
50 | batman_ogm_packet->tq = TQ_MAX_VALUE; | 54 | batman_ogm_packet->tq = TQ_MAX_VALUE; |
51 | batman_ogm_packet->tt_num_changes = 0; | 55 | batman_ogm_packet->tt_num_changes = 0; |
52 | batman_ogm_packet->ttvn = 0; | 56 | batman_ogm_packet->ttvn = 0; |
57 | |||
58 | res = 0; | ||
59 | |||
60 | out: | ||
61 | return res; | ||
53 | } | 62 | } |
54 | 63 | ||
55 | static void bat_iv_ogm_iface_disable(struct hard_iface *hard_iface) | 64 | static void bat_iv_ogm_iface_disable(struct hard_iface *hard_iface) |