Commit 35bd69d4 authored by Marek Lindner's avatar Marek Lindner Committed by Greg Kroah-Hartman

Staging: batman-adv: remove redundant pointer to originator interface

Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1d59f82c
...@@ -250,7 +250,7 @@ ssize_t bat_device_write(struct file *file, const char __user *buff, ...@@ -250,7 +250,7 @@ ssize_t bat_device_write(struct file *file, const char __user *buff,
if (!orig_node->router) if (!orig_node->router)
goto unlock; goto unlock;
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
......
...@@ -137,7 +137,6 @@ struct orig_node *get_orig_node(uint8_t *addr) ...@@ -137,7 +137,6 @@ struct orig_node *get_orig_node(uint8_t *addr)
memcpy(orig_node->orig, addr, ETH_ALEN); memcpy(orig_node->orig, addr, ETH_ALEN);
orig_node->router = NULL; orig_node->router = NULL;
orig_node->batman_if = NULL;
orig_node->hna_buff = NULL; orig_node->hna_buff = NULL;
size = num_ifs * sizeof(TYPE_OF_WORD) * NUM_WORDS; size = num_ifs * sizeof(TYPE_OF_WORD) * NUM_WORDS;
......
...@@ -97,11 +97,6 @@ static void update_route(struct orig_node *orig_node, ...@@ -97,11 +97,6 @@ static void update_route(struct orig_node *orig_node,
bat_dbg(DBG_ROUTES, "Changing route towards: %pM (now via %pM - was via %pM)\n", orig_node->orig, neigh_node->addr, orig_node->router->addr); bat_dbg(DBG_ROUTES, "Changing route towards: %pM (now via %pM - was via %pM)\n", orig_node->orig, neigh_node->addr, orig_node->router->addr);
} }
if (neigh_node != NULL)
orig_node->batman_if = neigh_node->if_incoming;
else
orig_node->batman_if = NULL;
orig_node->router = neigh_node; orig_node->router = neigh_node;
} }
...@@ -616,12 +611,11 @@ static int recv_my_icmp_packet(struct sk_buff *skb) ...@@ -616,12 +611,11 @@ static int recv_my_icmp_packet(struct sk_buff *skb)
ret = NET_RX_DROP; ret = NET_RX_DROP;
if ((orig_node != NULL) && if ((orig_node != NULL) &&
(orig_node->batman_if != NULL) &&
(orig_node->router != NULL)) { (orig_node->router != NULL)) {
/* don't lock while sending the packets ... we therefore /* don't lock while sending the packets ... we therefore
* copy the required data before sending */ * copy the required data before sending */
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
...@@ -678,12 +672,11 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb) ...@@ -678,12 +672,11 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb)
ret = NET_RX_DROP; ret = NET_RX_DROP;
if ((orig_node != NULL) && if ((orig_node != NULL) &&
(orig_node->batman_if != NULL) &&
(orig_node->router != NULL)) { (orig_node->router != NULL)) {
/* don't lock while sending the packets ... we therefore /* don't lock while sending the packets ... we therefore
* copy the required data before sending */ * copy the required data before sending */
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
...@@ -760,12 +753,11 @@ int recv_icmp_packet(struct sk_buff *skb) ...@@ -760,12 +753,11 @@ int recv_icmp_packet(struct sk_buff *skb)
hash_find(orig_hash, icmp_packet->dst)); hash_find(orig_hash, icmp_packet->dst));
if ((orig_node != NULL) && if ((orig_node != NULL) &&
(orig_node->batman_if != NULL) &&
(orig_node->router != NULL)) { (orig_node->router != NULL)) {
/* don't lock while sending the packets ... we therefore /* don't lock while sending the packets ... we therefore
* copy the required data before sending */ * copy the required data before sending */
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
...@@ -844,12 +836,11 @@ int recv_unicast_packet(struct sk_buff *skb) ...@@ -844,12 +836,11 @@ int recv_unicast_packet(struct sk_buff *skb)
hash_find(orig_hash, unicast_packet->dest)); hash_find(orig_hash, unicast_packet->dest));
if ((orig_node != NULL) && if ((orig_node != NULL) &&
(orig_node->batman_if != NULL) &&
(orig_node->router != NULL)) { (orig_node->router != NULL)) {
/* don't lock while sending the packets ... we therefore /* don't lock while sending the packets ... we therefore
* copy the required data before sending */ * copy the required data before sending */
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
......
...@@ -236,7 +236,6 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -236,7 +236,6 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev)
orig_node = transtable_search(ethhdr->h_dest); orig_node = transtable_search(ethhdr->h_dest);
if ((orig_node) && if ((orig_node) &&
(orig_node->batman_if) &&
(orig_node->router)) { (orig_node->router)) {
if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0) if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0)
goto unlock; goto unlock;
...@@ -252,13 +251,13 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -252,13 +251,13 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev)
memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
/* net_dev won't be available when not active */ /* net_dev won't be available when not active */
if (orig_node->batman_if->if_active != IF_ACTIVE) if (orig_node->router->if_incoming->if_active != IF_ACTIVE)
goto unlock; goto unlock;
/* don't lock while sending the packets ... we therefore /* don't lock while sending the packets ... we therefore
* copy the required data before sending */ * copy the required data before sending */
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
......
...@@ -49,7 +49,6 @@ struct batman_if { ...@@ -49,7 +49,6 @@ struct batman_if {
struct orig_node { /* structure for orig_list maintaining nodes of mesh */ struct orig_node { /* structure for orig_list maintaining nodes of mesh */
uint8_t orig[ETH_ALEN]; uint8_t orig[ETH_ALEN];
struct neigh_node *router; struct neigh_node *router;
struct batman_if *batman_if;
TYPE_OF_WORD *bcast_own; TYPE_OF_WORD *bcast_own;
uint8_t *bcast_own_sum; uint8_t *bcast_own_sum;
uint8_t tq_own; uint8_t tq_own;
......
...@@ -498,14 +498,14 @@ static int generate_vis_packet(struct bat_priv *bat_priv) ...@@ -498,14 +498,14 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
if (orig_node->router != NULL if (orig_node->router != NULL
&& compare_orig(orig_node->router->addr, && compare_orig(orig_node->router->addr,
orig_node->orig) orig_node->orig)
&& orig_node->batman_if && (orig_node->router->if_incoming->if_active ==
&& (orig_node->batman_if->if_active == IF_ACTIVE) IF_ACTIVE)
&& orig_node->router->tq_avg > 0) { && orig_node->router->tq_avg > 0) {
/* fill one entry into buffer. */ /* fill one entry into buffer. */
entry = &entry_array[info->packet.entries]; entry = &entry_array[info->packet.entries];
memcpy(entry->src, memcpy(entry->src,
orig_node->batman_if->net_dev->dev_addr, orig_node->router->if_incoming->net_dev->dev_addr,
ETH_ALEN); ETH_ALEN);
memcpy(entry->dest, orig_node->orig, ETH_ALEN); memcpy(entry->dest, orig_node->orig, ETH_ALEN);
entry->quality = orig_node->router->tq_avg; entry->quality = orig_node->router->tq_avg;
...@@ -573,8 +573,7 @@ static void broadcast_vis_packet(struct vis_info *info, int packet_length) ...@@ -573,8 +573,7 @@ static void broadcast_vis_packet(struct vis_info *info, int packet_length)
orig_node = hashit.bucket->data; orig_node = hashit.bucket->data;
/* if it's a vis server and reachable, send it. */ /* if it's a vis server and reachable, send it. */
if ((!orig_node) || (!orig_node->batman_if) || if ((!orig_node) || (!orig_node->router))
(!orig_node->router))
continue; continue;
if (!(orig_node->flags & VIS_SERVER)) if (!(orig_node->flags & VIS_SERVER))
continue; continue;
...@@ -584,7 +583,7 @@ static void broadcast_vis_packet(struct vis_info *info, int packet_length) ...@@ -584,7 +583,7 @@ static void broadcast_vis_packet(struct vis_info *info, int packet_length)
continue; continue;
memcpy(info->packet.target_orig, orig_node->orig, ETH_ALEN); memcpy(info->packet.target_orig, orig_node->orig, ETH_ALEN);
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
...@@ -609,12 +608,12 @@ static void unicast_vis_packet(struct vis_info *info, int packet_length) ...@@ -609,12 +608,12 @@ static void unicast_vis_packet(struct vis_info *info, int packet_length)
orig_node = ((struct orig_node *) orig_node = ((struct orig_node *)
hash_find(orig_hash, info->packet.target_orig)); hash_find(orig_hash, info->packet.target_orig));
if ((!orig_node) || (!orig_node->batman_if) || (!orig_node->router)) if ((!orig_node) || (!orig_node->router))
goto out; goto out;
/* don't lock while sending the packets ... we therefore /* don't lock while sending the packets ... we therefore
* copy the required data before sending */ * copy the required data before sending */
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment