提交 825ffe1f 编写于 作者: S Sven Eckelmann 提交者: Simon Wunderlich

batman-adv: Remove unnecessary parentheses

checkpatch introduced with commit 63b7c73e ("checkpatch: add --strict
check for ifs with unnecessary parentheses") an additional test which
identifies some unnecessary parentheses.

Remove these unnecessary parentheses to avoid the warnings and to unify the
coding style slightly more.
Signed-off-by: NSven Eckelmann <sven@narfation.org>
Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
上级 7e7c1afb
...@@ -916,8 +916,8 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) ...@@ -916,8 +916,8 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)
u16 tvlv_len = 0; u16 tvlv_len = 0;
unsigned long send_time; unsigned long send_time;
if ((hard_iface->if_status == BATADV_IF_NOT_IN_USE) || if (hard_iface->if_status == BATADV_IF_NOT_IN_USE ||
(hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)) hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)
return; return;
/* the interface gets activated here to avoid race conditions between /* the interface gets activated here to avoid race conditions between
...@@ -1264,7 +1264,7 @@ static bool batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, ...@@ -1264,7 +1264,7 @@ static bool batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
* drops as they can't send and receive at the same time. * drops as they can't send and receive at the same time.
*/ */
tq_iface_penalty = BATADV_TQ_MAX_VALUE; tq_iface_penalty = BATADV_TQ_MAX_VALUE;
if (if_outgoing && (if_incoming == if_outgoing) && if (if_outgoing && if_incoming == if_outgoing &&
batadv_is_wifi_hardif(if_outgoing)) batadv_is_wifi_hardif(if_outgoing))
tq_iface_penalty = batadv_hop_penalty(BATADV_TQ_MAX_VALUE, tq_iface_penalty = batadv_hop_penalty(BATADV_TQ_MAX_VALUE,
bat_priv); bat_priv);
...@@ -1369,7 +1369,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, ...@@ -1369,7 +1369,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
ret = BATADV_NEIGH_DUP; ret = BATADV_NEIGH_DUP;
} else { } else {
set_mark = 0; set_mark = 0;
if (is_dup && (ret != BATADV_NEIGH_DUP)) if (is_dup && ret != BATADV_NEIGH_DUP)
ret = BATADV_ORIG_DUP; ret = BATADV_ORIG_DUP;
} }
...@@ -1515,7 +1515,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset, ...@@ -1515,7 +1515,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset,
/* drop packet if sender is not a direct neighbor and if we /* drop packet if sender is not a direct neighbor and if we
* don't route towards it * don't route towards it
*/ */
if (!is_single_hop_neigh && (!orig_neigh_router)) { if (!is_single_hop_neigh && !orig_neigh_router) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: OGM via unknown neighbor!\n"); "Drop packet: OGM via unknown neighbor!\n");
goto out_neigh; goto out_neigh;
...@@ -1535,7 +1535,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset, ...@@ -1535,7 +1535,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset,
sameseq = orig_ifinfo->last_real_seqno == ntohl(ogm_packet->seqno); sameseq = orig_ifinfo->last_real_seqno == ntohl(ogm_packet->seqno);
similar_ttl = (orig_ifinfo->last_ttl - 3) <= ogm_packet->ttl; similar_ttl = (orig_ifinfo->last_ttl - 3) <= ogm_packet->ttl;
if (is_bidirect && ((dup_status == BATADV_NO_DUP) || if (is_bidirect && (dup_status == BATADV_NO_DUP ||
(sameseq && similar_ttl))) { (sameseq && similar_ttl))) {
batadv_iv_ogm_orig_update(bat_priv, orig_node, batadv_iv_ogm_orig_update(bat_priv, orig_node,
orig_ifinfo, ethhdr, orig_ifinfo, ethhdr,
...@@ -1553,8 +1553,8 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset, ...@@ -1553,8 +1553,8 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset,
/* OGMs from secondary interfaces should only scheduled once /* OGMs from secondary interfaces should only scheduled once
* per interface where it has been received, not multiple times * per interface where it has been received, not multiple times
*/ */
if ((ogm_packet->ttl <= 2) && if (ogm_packet->ttl <= 2 &&
(if_incoming != if_outgoing)) { if_incoming != if_outgoing) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: OGM from secondary interface and wrong outgoing interface\n"); "Drop packet: OGM from secondary interface and wrong outgoing interface\n");
goto out_neigh; goto out_neigh;
...@@ -1590,7 +1590,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset, ...@@ -1590,7 +1590,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset,
if_incoming, if_outgoing); if_incoming, if_outgoing);
out_neigh: out_neigh:
if ((orig_neigh_node) && (!is_single_hop_neigh)) if (orig_neigh_node && !is_single_hop_neigh)
batadv_orig_node_put(orig_neigh_node); batadv_orig_node_put(orig_neigh_node);
out: out:
if (router_ifinfo) if (router_ifinfo)
...@@ -2523,9 +2523,9 @@ batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv) ...@@ -2523,9 +2523,9 @@ batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
tmp_gw_factor *= 100 * 100; tmp_gw_factor *= 100 * 100;
tmp_gw_factor >>= 18; tmp_gw_factor >>= 18;
if ((tmp_gw_factor > max_gw_factor) || if (tmp_gw_factor > max_gw_factor ||
((tmp_gw_factor == max_gw_factor) && (tmp_gw_factor == max_gw_factor &&
(tq_avg > max_tq))) { tq_avg > max_tq)) {
if (curr_gw) if (curr_gw)
batadv_gw_node_put(curr_gw); batadv_gw_node_put(curr_gw);
curr_gw = gw_node; curr_gw = gw_node;
......
...@@ -767,7 +767,7 @@ batadv_v_gw_get_best_gw_node(struct batadv_priv *bat_priv) ...@@ -767,7 +767,7 @@ batadv_v_gw_get_best_gw_node(struct batadv_priv *bat_priv)
if (batadv_v_gw_throughput_get(gw_node, &bw) < 0) if (batadv_v_gw_throughput_get(gw_node, &bw) < 0)
goto next; goto next;
if (curr_gw && (bw <= max_bw)) if (curr_gw && bw <= max_bw)
goto next; goto next;
if (curr_gw) if (curr_gw)
......
...@@ -134,7 +134,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) ...@@ -134,7 +134,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX; hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX;
throughput = link_settings.base.speed; throughput = link_settings.base.speed;
if (throughput && (throughput != SPEED_UNKNOWN)) if (throughput && throughput != SPEED_UNKNOWN)
return throughput * 10; return throughput * 10;
} }
...@@ -263,8 +263,8 @@ static void batadv_v_elp_periodic_work(struct work_struct *work) ...@@ -263,8 +263,8 @@ static void batadv_v_elp_periodic_work(struct work_struct *work)
goto out; goto out;
/* we are in the process of shutting this interface down */ /* we are in the process of shutting this interface down */
if ((hard_iface->if_status == BATADV_IF_NOT_IN_USE) || if (hard_iface->if_status == BATADV_IF_NOT_IN_USE ||
(hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)) hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)
goto out; goto out;
/* the interface was enabled but may not be ready yet */ /* the interface was enabled but may not be ready yet */
......
...@@ -304,8 +304,8 @@ static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv, ...@@ -304,8 +304,8 @@ static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv,
* due to the store & forward characteristics of WIFI. * due to the store & forward characteristics of WIFI.
* Very low throughput values are the exception. * Very low throughput values are the exception.
*/ */
if ((throughput > 10) && if (throughput > 10 &&
(if_incoming == if_outgoing) && if_incoming == if_outgoing &&
!(if_incoming->bat_v.flags & BATADV_FULL_DUPLEX)) !(if_incoming->bat_v.flags & BATADV_FULL_DUPLEX))
return throughput / 2; return throughput / 2;
...@@ -455,7 +455,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv, ...@@ -455,7 +455,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv,
/* drop packets with old seqnos, however accept the first packet after /* drop packets with old seqnos, however accept the first packet after
* a host has been rebooted. * a host has been rebooted.
*/ */
if ((seq_diff < 0) && !protection_started) if (seq_diff < 0 && !protection_started)
goto out; goto out;
neigh_node->last_seen = jiffies; neigh_node->last_seen = jiffies;
...@@ -568,8 +568,8 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv, ...@@ -568,8 +568,8 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
router_throughput = router_ifinfo->bat_v.throughput; router_throughput = router_ifinfo->bat_v.throughput;
neigh_throughput = neigh_ifinfo->bat_v.throughput; neigh_throughput = neigh_ifinfo->bat_v.throughput;
if ((neigh_seq_diff < BATADV_OGM_MAX_ORIGDIFF) && if (neigh_seq_diff < BATADV_OGM_MAX_ORIGDIFF &&
(router_throughput >= neigh_throughput)) router_throughput >= neigh_throughput)
goto out; goto out;
} }
...@@ -621,7 +621,7 @@ batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv, ...@@ -621,7 +621,7 @@ batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv,
return; return;
/* only unknown & newer OGMs contain TVLVs we are interested in */ /* only unknown & newer OGMs contain TVLVs we are interested in */
if ((seqno_age > 0) && (if_outgoing == BATADV_IF_DEFAULT)) if (seqno_age > 0 && if_outgoing == BATADV_IF_DEFAULT)
batadv_tvlv_containers_process(bat_priv, true, orig_node, batadv_tvlv_containers_process(bat_priv, true, orig_node,
NULL, NULL, NULL, NULL,
(unsigned char *)(ogm2 + 1), (unsigned char *)(ogm2 + 1),
......
...@@ -492,8 +492,8 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res, ...@@ -492,8 +492,8 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
/* this is an hash collision with the temporary selected node. Choose /* this is an hash collision with the temporary selected node. Choose
* the one with the lowest address * the one with the lowest address
*/ */
if ((tmp_max == max) && max_orig_node && if (tmp_max == max && max_orig_node &&
(batadv_compare_eth(candidate->orig, max_orig_node->orig) > 0)) batadv_compare_eth(candidate->orig, max_orig_node->orig) > 0)
goto out; goto out;
ret = true; ret = true;
......
...@@ -248,12 +248,12 @@ void batadv_gw_election(struct batadv_priv *bat_priv) ...@@ -248,12 +248,12 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
} }
} }
if ((curr_gw) && (!next_gw)) { if (curr_gw && !next_gw) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Removing selected gateway - no gateway in range\n"); "Removing selected gateway - no gateway in range\n");
batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL, batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL,
NULL); NULL);
} else if ((!curr_gw) && (next_gw)) { } else if (!curr_gw && next_gw) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Adding route to gateway %pM (bandwidth: %u.%u/%u.%u MBit, tq: %i)\n", "Adding route to gateway %pM (bandwidth: %u.%u/%u.%u MBit, tq: %i)\n",
next_gw->orig_node->orig, next_gw->orig_node->orig,
...@@ -411,8 +411,8 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv, ...@@ -411,8 +411,8 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
goto out; goto out;
} }
if ((gw_node->bandwidth_down == ntohl(gateway->bandwidth_down)) && if (gw_node->bandwidth_down == ntohl(gateway->bandwidth_down) &&
(gw_node->bandwidth_up == ntohl(gateway->bandwidth_up))) gw_node->bandwidth_up == ntohl(gateway->bandwidth_up))
goto out; goto out;
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
......
...@@ -56,8 +56,8 @@ bool batadv_parse_throughput(struct net_device *net_dev, char *buff, ...@@ -56,8 +56,8 @@ bool batadv_parse_throughput(struct net_device *net_dev, char *buff,
if (strncasecmp(tmp_ptr, "mbit", 4) == 0) if (strncasecmp(tmp_ptr, "mbit", 4) == 0)
bw_unit_type = BATADV_BW_UNIT_MBIT; bw_unit_type = BATADV_BW_UNIT_MBIT;
if ((strncasecmp(tmp_ptr, "kbit", 4) == 0) || if (strncasecmp(tmp_ptr, "kbit", 4) == 0 ||
(bw_unit_type == BATADV_BW_UNIT_MBIT)) bw_unit_type == BATADV_BW_UNIT_MBIT)
*tmp_ptr = '\0'; *tmp_ptr = '\0';
} }
...@@ -190,7 +190,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, ...@@ -190,7 +190,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
if (!up_new) if (!up_new)
up_new = 1; up_new = 1;
if ((down_curr == down_new) && (up_curr == up_new)) if (down_curr == down_new && up_curr == up_new)
return count; return count;
batadv_gw_reselect(bat_priv); batadv_gw_reselect(bat_priv);
...@@ -224,16 +224,16 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, ...@@ -224,16 +224,16 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
/* only fetch the tvlv value if the handler wasn't called via the /* only fetch the tvlv value if the handler wasn't called via the
* CIFNOTFND flag and if there is data to fetch * CIFNOTFND flag and if there is data to fetch
*/ */
if ((flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND) || if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND ||
(tvlv_value_len < sizeof(gateway))) { tvlv_value_len < sizeof(gateway)) {
gateway.bandwidth_down = 0; gateway.bandwidth_down = 0;
gateway.bandwidth_up = 0; gateway.bandwidth_up = 0;
} else { } else {
gateway_ptr = tvlv_value; gateway_ptr = tvlv_value;
gateway.bandwidth_down = gateway_ptr->bandwidth_down; gateway.bandwidth_down = gateway_ptr->bandwidth_down;
gateway.bandwidth_up = gateway_ptr->bandwidth_up; gateway.bandwidth_up = gateway_ptr->bandwidth_up;
if ((gateway.bandwidth_down == 0) || if (gateway.bandwidth_down == 0 ||
(gateway.bandwidth_up == 0)) { gateway.bandwidth_up == 0) {
gateway.bandwidth_down = 0; gateway.bandwidth_down = 0;
gateway.bandwidth_up = 0; gateway.bandwidth_up = 0;
} }
...@@ -242,8 +242,8 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, ...@@ -242,8 +242,8 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
batadv_gw_node_update(bat_priv, orig, &gateway); batadv_gw_node_update(bat_priv, orig, &gateway);
/* restart gateway selection */ /* restart gateway selection */
if ((gateway.bandwidth_down != 0) && if (gateway.bandwidth_down != 0 &&
(atomic_read(&bat_priv->gw.mode) == BATADV_GW_MODE_CLIENT)) atomic_read(&bat_priv->gw.mode) == BATADV_GW_MODE_CLIENT)
batadv_gw_check_election(bat_priv, orig); batadv_gw_check_election(bat_priv, orig);
} }
......
...@@ -504,8 +504,8 @@ static void batadv_check_known_mac_addr(const struct net_device *net_dev) ...@@ -504,8 +504,8 @@ static void batadv_check_known_mac_addr(const struct net_device *net_dev)
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
if ((hard_iface->if_status != BATADV_IF_ACTIVE) && if (hard_iface->if_status != BATADV_IF_ACTIVE &&
(hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED)) hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED)
continue; continue;
if (hard_iface->net_dev == net_dev) if (hard_iface->net_dev == net_dev)
...@@ -568,8 +568,8 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface) ...@@ -568,8 +568,8 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
if ((hard_iface->if_status != BATADV_IF_ACTIVE) && if (hard_iface->if_status != BATADV_IF_ACTIVE &&
(hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED)) hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED)
continue; continue;
if (hard_iface->soft_iface != soft_iface) if (hard_iface->soft_iface != soft_iface)
...@@ -654,8 +654,8 @@ batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface) ...@@ -654,8 +654,8 @@ batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface)
static void static void
batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface) batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
{ {
if ((hard_iface->if_status != BATADV_IF_ACTIVE) && if (hard_iface->if_status != BATADV_IF_ACTIVE &&
(hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED)) hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED)
return; return;
hard_iface->if_status = BATADV_IF_INACTIVE; hard_iface->if_status = BATADV_IF_INACTIVE;
......
...@@ -132,10 +132,10 @@ static ssize_t batadv_socket_read(struct file *file, char __user *buf, ...@@ -132,10 +132,10 @@ static ssize_t batadv_socket_read(struct file *file, char __user *buf,
size_t packet_len; size_t packet_len;
int error; int error;
if ((file->f_flags & O_NONBLOCK) && (socket_client->queue_len == 0)) if ((file->f_flags & O_NONBLOCK) && socket_client->queue_len == 0)
return -EAGAIN; return -EAGAIN;
if ((!buf) || (count < sizeof(struct batadv_icmp_packet))) if (!buf || count < sizeof(struct batadv_icmp_packet))
return -EINVAL; return -EINVAL;
if (!access_ok(VERIFY_WRITE, buf, count)) if (!access_ok(VERIFY_WRITE, buf, count))
......
...@@ -544,8 +544,8 @@ batadv_recv_handler_register(u8 packet_type, ...@@ -544,8 +544,8 @@ batadv_recv_handler_register(u8 packet_type,
struct batadv_hard_iface *); struct batadv_hard_iface *);
curr = batadv_rx_handler[packet_type]; curr = batadv_rx_handler[packet_type];
if ((curr != batadv_recv_unhandled_packet) && if (curr != batadv_recv_unhandled_packet &&
(curr != batadv_recv_unhandled_unicast_packet)) curr != batadv_recv_unhandled_unicast_packet)
return -EBUSY; return -EBUSY;
batadv_rx_handler[packet_type] = recv_handler; batadv_rx_handler[packet_type] = recv_handler;
......
...@@ -1126,7 +1126,7 @@ static void batadv_mcast_tvlv_ogm_handler(struct batadv_priv *bat_priv, ...@@ -1126,7 +1126,7 @@ static void batadv_mcast_tvlv_ogm_handler(struct batadv_priv *bat_priv,
bool orig_initialized; bool orig_initialized;
if (orig_mcast_enabled && tvlv_value && if (orig_mcast_enabled && tvlv_value &&
(tvlv_value_len >= sizeof(mcast_flags))) tvlv_value_len >= sizeof(mcast_flags))
mcast_flags = *(u8 *)tvlv_value; mcast_flags = *(u8 *)tvlv_value;
spin_lock_bh(&orig->mcast_handler_lock); spin_lock_bh(&orig->mcast_handler_lock);
......
...@@ -1062,9 +1062,9 @@ batadv_purge_neigh_ifinfo(struct batadv_priv *bat_priv, ...@@ -1062,9 +1062,9 @@ batadv_purge_neigh_ifinfo(struct batadv_priv *bat_priv,
continue; continue;
/* don't purge if the interface is not (going) down */ /* don't purge if the interface is not (going) down */
if ((if_outgoing->if_status != BATADV_IF_INACTIVE) && if (if_outgoing->if_status != BATADV_IF_INACTIVE &&
(if_outgoing->if_status != BATADV_IF_NOT_IN_USE) && if_outgoing->if_status != BATADV_IF_NOT_IN_USE &&
(if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED)) if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED)
continue; continue;
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
...@@ -1106,9 +1106,9 @@ batadv_purge_orig_ifinfo(struct batadv_priv *bat_priv, ...@@ -1106,9 +1106,9 @@ batadv_purge_orig_ifinfo(struct batadv_priv *bat_priv,
continue; continue;
/* don't purge if the interface is not (going) down */ /* don't purge if the interface is not (going) down */
if ((if_outgoing->if_status != BATADV_IF_INACTIVE) && if (if_outgoing->if_status != BATADV_IF_INACTIVE &&
(if_outgoing->if_status != BATADV_IF_NOT_IN_USE) && if_outgoing->if_status != BATADV_IF_NOT_IN_USE &&
(if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED)) if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED)
continue; continue;
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
...@@ -1155,13 +1155,13 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, ...@@ -1155,13 +1155,13 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv,
last_seen = neigh_node->last_seen; last_seen = neigh_node->last_seen;
if_incoming = neigh_node->if_incoming; if_incoming = neigh_node->if_incoming;
if ((batadv_has_timed_out(last_seen, BATADV_PURGE_TIMEOUT)) || if (batadv_has_timed_out(last_seen, BATADV_PURGE_TIMEOUT) ||
(if_incoming->if_status == BATADV_IF_INACTIVE) || if_incoming->if_status == BATADV_IF_INACTIVE ||
(if_incoming->if_status == BATADV_IF_NOT_IN_USE) || if_incoming->if_status == BATADV_IF_NOT_IN_USE ||
(if_incoming->if_status == BATADV_IF_TO_BE_REMOVED)) { if_incoming->if_status == BATADV_IF_TO_BE_REMOVED) {
if ((if_incoming->if_status == BATADV_IF_INACTIVE) || if (if_incoming->if_status == BATADV_IF_INACTIVE ||
(if_incoming->if_status == BATADV_IF_NOT_IN_USE) || if_incoming->if_status == BATADV_IF_NOT_IN_USE ||
(if_incoming->if_status == BATADV_IF_TO_BE_REMOVED)) if_incoming->if_status == BATADV_IF_TO_BE_REMOVED)
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"neighbor purge: originator %pM, neighbor: %pM, iface: %s\n", "neighbor purge: originator %pM, neighbor: %pM, iface: %s\n",
orig_node->orig, neigh_node->addr, orig_node->orig, neigh_node->addr,
......
...@@ -93,14 +93,14 @@ static void _batadv_update_route(struct batadv_priv *bat_priv, ...@@ -93,14 +93,14 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
batadv_orig_ifinfo_put(orig_ifinfo); batadv_orig_ifinfo_put(orig_ifinfo);
/* route deleted */ /* route deleted */
if ((curr_router) && (!neigh_node)) { if (curr_router && !neigh_node) {
batadv_dbg(BATADV_DBG_ROUTES, bat_priv, batadv_dbg(BATADV_DBG_ROUTES, bat_priv,
"Deleting route towards: %pM\n", orig_node->orig); "Deleting route towards: %pM\n", orig_node->orig);
batadv_tt_global_del_orig(bat_priv, orig_node, -1, batadv_tt_global_del_orig(bat_priv, orig_node, -1,
"Deleted route towards originator"); "Deleted route towards originator");
/* route added */ /* route added */
} else if ((!curr_router) && (neigh_node)) { } else if (!curr_router && neigh_node) {
batadv_dbg(BATADV_DBG_ROUTES, bat_priv, batadv_dbg(BATADV_DBG_ROUTES, bat_priv,
"Adding route towards: %pM (via %pM)\n", "Adding route towards: %pM (via %pM)\n",
orig_node->orig, neigh_node->addr); orig_node->orig, neigh_node->addr);
...@@ -381,7 +381,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, ...@@ -381,7 +381,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
/* add record route information if not full */ /* add record route information if not full */
if ((icmph->msg_type == BATADV_ECHO_REPLY || if ((icmph->msg_type == BATADV_ECHO_REPLY ||
icmph->msg_type == BATADV_ECHO_REQUEST) && icmph->msg_type == BATADV_ECHO_REQUEST) &&
(skb->len >= sizeof(struct batadv_icmp_packet_rr))) { skb->len >= sizeof(struct batadv_icmp_packet_rr)) {
if (skb_linearize(skb) < 0) if (skb_linearize(skb) < 0)
goto free_skb; goto free_skb;
......
...@@ -142,7 +142,7 @@ int batadv_send_unicast_skb(struct sk_buff *skb, ...@@ -142,7 +142,7 @@ int batadv_send_unicast_skb(struct sk_buff *skb,
#ifdef CONFIG_BATMAN_ADV_BATMAN_V #ifdef CONFIG_BATMAN_ADV_BATMAN_V
hardif_neigh = batadv_hardif_neigh_get(neigh->if_incoming, neigh->addr); hardif_neigh = batadv_hardif_neigh_get(neigh->if_incoming, neigh->addr);
if ((hardif_neigh) && (ret != NET_XMIT_DROP)) if (hardif_neigh && ret != NET_XMIT_DROP)
hardif_neigh->bat_v.last_unicast_tx = jiffies; hardif_neigh->bat_v.last_unicast_tx = jiffies;
if (hardif_neigh) if (hardif_neigh)
...@@ -615,8 +615,8 @@ batadv_forw_packet_list_steal(struct hlist_head *forw_list, ...@@ -615,8 +615,8 @@ batadv_forw_packet_list_steal(struct hlist_head *forw_list,
* we delete only packets belonging to the given interface * we delete only packets belonging to the given interface
*/ */
if (hard_iface && if (hard_iface &&
(forw_packet->if_incoming != hard_iface) && forw_packet->if_incoming != hard_iface &&
(forw_packet->if_outgoing != hard_iface)) forw_packet->if_outgoing != hard_iface)
continue; continue;
hlist_del(&forw_packet->list); hlist_del(&forw_packet->list);
......
...@@ -160,7 +160,7 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) ...@@ -160,7 +160,7 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
static int batadv_interface_change_mtu(struct net_device *dev, int new_mtu) static int batadv_interface_change_mtu(struct net_device *dev, int new_mtu)
{ {
/* check ranges */ /* check ranges */
if ((new_mtu < 68) || (new_mtu > batadv_hardif_min_mtu(dev))) if (new_mtu < 68 || new_mtu > batadv_hardif_min_mtu(dev))
return -EINVAL; return -EINVAL;
dev->mtu = new_mtu; dev->mtu = new_mtu;
......
...@@ -925,8 +925,8 @@ static int batadv_store_mesh_iface_finish(struct net_device *net_dev, ...@@ -925,8 +925,8 @@ static int batadv_store_mesh_iface_finish(struct net_device *net_dev,
if (hard_iface->if_status == status_tmp) if (hard_iface->if_status == status_tmp)
goto out; goto out;
if ((hard_iface->soft_iface) && if (hard_iface->soft_iface &&
(strncmp(hard_iface->soft_iface->name, ifname, IFNAMSIZ) == 0)) strncmp(hard_iface->soft_iface->name, ifname, IFNAMSIZ) == 0)
goto out; goto out;
if (status_tmp == BATADV_IF_NOT_IN_USE) { if (status_tmp == BATADV_IF_NOT_IN_USE) {
......
...@@ -1206,7 +1206,7 @@ static int batadv_tp_send_ack(struct batadv_priv *bat_priv, const u8 *dst, ...@@ -1206,7 +1206,7 @@ static int batadv_tp_send_ack(struct batadv_priv *bat_priv, const u8 *dst,
/* send the ack */ /* send the ack */
r = batadv_send_skb_to_orig(skb, orig_node, NULL); r = batadv_send_skb_to_orig(skb, orig_node, NULL);
if (unlikely(r < 0) || (r == NET_XMIT_DROP)) { if (unlikely(r < 0) || r == NET_XMIT_DROP) {
ret = BATADV_TP_REASON_DST_UNREACHABLE; ret = BATADV_TP_REASON_DST_UNREACHABLE;
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册