]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/batman-adv/originator.c
batman-adv: initialise last_ttvn and tt_crc for the orig_node structure
[karo-tx-linux.git] / net / batman-adv / originator.c
index a6c35d4e332b95fba0390dac01f499142979712d..f3c3f620d1952eaab745a049cb5ed314f77529eb 100644 (file)
@@ -37,6 +37,14 @@ static void start_purge_timer(struct bat_priv *bat_priv)
        queue_delayed_work(bat_event_workqueue, &bat_priv->orig_work, 1 * HZ);
 }
 
+/* returns 1 if they are the same originator */
+static int compare_orig(const struct hlist_node *node, const void *data2)
+{
+       const void *data1 = container_of(node, struct orig_node, hash_entry);
+
+       return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
+}
+
 int originator_init(struct bat_priv *bat_priv)
 {
        if (bat_priv->orig_hash)
@@ -137,6 +145,7 @@ static void orig_node_free_rcu(struct rcu_head *rcu)
        tt_global_del_orig(orig_node->bat_priv, orig_node,
                            "originator timed out");
 
+       kfree(orig_node->tt_buff);
        kfree(orig_node->bcast_own);
        kfree(orig_node->bcast_own_sum);
        kfree(orig_node);
@@ -205,14 +214,20 @@ struct orig_node *get_orig_node(struct bat_priv *bat_priv, const uint8_t *addr)
        spin_lock_init(&orig_node->ogm_cnt_lock);
        spin_lock_init(&orig_node->bcast_seqno_lock);
        spin_lock_init(&orig_node->neigh_list_lock);
+       spin_lock_init(&orig_node->tt_buff_lock);
 
        /* extra reference for return */
        atomic_set(&orig_node->refcount, 2);
 
+       orig_node->tt_poss_change = false;
        orig_node->bat_priv = bat_priv;
        memcpy(orig_node->orig, addr, ETH_ALEN);
        orig_node->router = NULL;
+       orig_node->tt_crc = 0;
+       atomic_set(&orig_node->last_ttvn, 0);
        orig_node->tt_buff = NULL;
+       orig_node->tt_buff_len = 0;
+       atomic_set(&orig_node->tt_size, 0);
        orig_node->bcast_seqno_reset = jiffies - 1
                                        - msecs_to_jiffies(RESET_PROTECTION_MS);
        orig_node->batman_seqno_reset = jiffies - 1
@@ -322,9 +337,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
                if (purge_orig_neighbors(bat_priv, orig_node,
                                                        &best_neigh_node)) {
                        update_routes(bat_priv, orig_node,
-                                     best_neigh_node,
-                                     orig_node->tt_buff,
-                                     orig_node->tt_buff_len);
+                                     best_neigh_node);
                }
        }
 
@@ -419,9 +432,8 @@ int orig_seq_print_text(struct seq_file *seq, void *offset)
                goto out;
        }
 
-       seq_printf(seq, "[B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%pM (%s)]\n",
-                  SOURCE_VERSION, REVISION_VERSION_STR,
-                  primary_if->net_dev->name,
+       seq_printf(seq, "[B.A.T.M.A.N. adv %s, MainIF/MAC: %s/%pM (%s)]\n",
+                  SOURCE_VERSION, primary_if->net_dev->name,
                   primary_if->net_dev->dev_addr, net_dev->name);
        seq_printf(seq, "  %-15s %s (%s/%i) %17s [%10s]: %20s ...\n",
                   "Originator", "last-seen", "#", TQ_MAX_VALUE, "Nexthop",