diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2012-03-01 02:35:16 -0500 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-05-11 04:08:09 -0400 |
commit | 75cd33f86396c446f84c4bb620be70c36a2a54f6 (patch) | |
tree | d6e118090a7aebe4f7e4082db411a8dd560a1537 /net/batman-adv | |
parent | 9205cc521ec74bd510857a464d4ac4edee949bfd (diff) |
batman-adv: introduce is_single_hop_neigh variable to increase readability
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 8b2db2e76c7e..cd8f473c1bd0 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -480,7 +480,8 @@ static void bat_iv_ogm_queue_add(struct bat_priv *bat_priv, | |||
480 | static void bat_iv_ogm_forward(struct orig_node *orig_node, | 480 | static void bat_iv_ogm_forward(struct orig_node *orig_node, |
481 | const struct ethhdr *ethhdr, | 481 | const struct ethhdr *ethhdr, |
482 | struct batman_ogm_packet *batman_ogm_packet, | 482 | struct batman_ogm_packet *batman_ogm_packet, |
483 | int directlink, struct hard_iface *if_incoming) | 483 | bool is_single_hop_neigh, |
484 | struct hard_iface *if_incoming) | ||
484 | { | 485 | { |
485 | struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); | 486 | struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); |
486 | struct neigh_node *router; | 487 | struct neigh_node *router; |
@@ -533,7 +534,7 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node, | |||
533 | 534 | ||
534 | /* switch of primaries first hop flag when forwarding */ | 535 | /* switch of primaries first hop flag when forwarding */ |
535 | batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP; | 536 | batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP; |
536 | if (directlink) | 537 | if (is_single_hop_neigh) |
537 | batman_ogm_packet->flags |= DIRECTLINK; | 538 | batman_ogm_packet->flags |= DIRECTLINK; |
538 | else | 539 | else |
539 | batman_ogm_packet->flags &= ~DIRECTLINK; | 540 | batman_ogm_packet->flags &= ~DIRECTLINK; |
@@ -918,7 +919,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
918 | struct neigh_node *orig_neigh_router = NULL; | 919 | struct neigh_node *orig_neigh_router = NULL; |
919 | int has_directlink_flag; | 920 | int has_directlink_flag; |
920 | int is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0; | 921 | int is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0; |
921 | int is_broadcast = 0, is_bidirectional, is_single_hop_neigh; | 922 | int is_broadcast = 0, is_bidirectional; |
923 | bool is_single_hop_neigh = false; | ||
922 | int is_duplicate; | 924 | int is_duplicate; |
923 | uint32_t if_incoming_seqno; | 925 | uint32_t if_incoming_seqno; |
924 | 926 | ||
@@ -942,8 +944,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
942 | 944 | ||
943 | has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); | 945 | has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); |
944 | 946 | ||
945 | is_single_hop_neigh = (compare_eth(ethhdr->h_source, | 947 | if (compare_eth(ethhdr->h_source, batman_ogm_packet->orig)) |
946 | batman_ogm_packet->orig) ? 1 : 0); | 948 | is_single_hop_neigh = true; |
947 | 949 | ||
948 | bat_dbg(DBG_BATMAN, bat_priv, | 950 | bat_dbg(DBG_BATMAN, bat_priv, |
949 | "Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n", | 951 | "Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n", |
@@ -1114,7 +1116,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1114 | 1116 | ||
1115 | /* mark direct link on incoming interface */ | 1117 | /* mark direct link on incoming interface */ |
1116 | bat_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, | 1118 | bat_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, |
1117 | 1, if_incoming); | 1119 | is_single_hop_neigh, if_incoming); |
1118 | 1120 | ||
1119 | bat_dbg(DBG_BATMAN, bat_priv, | 1121 | bat_dbg(DBG_BATMAN, bat_priv, |
1120 | "Forwarding packet: rebroadcast neighbor packet with direct link flag\n"); | 1122 | "Forwarding packet: rebroadcast neighbor packet with direct link flag\n"); |
@@ -1137,7 +1139,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1137 | bat_dbg(DBG_BATMAN, bat_priv, | 1139 | bat_dbg(DBG_BATMAN, bat_priv, |
1138 | "Forwarding packet: rebroadcast originator packet\n"); | 1140 | "Forwarding packet: rebroadcast originator packet\n"); |
1139 | bat_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, | 1141 | bat_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, |
1140 | 0, if_incoming); | 1142 | is_single_hop_neigh, if_incoming); |
1141 | 1143 | ||
1142 | out_neigh: | 1144 | out_neigh: |
1143 | if ((orig_neigh_node) && (!is_single_hop_neigh)) | 1145 | if ((orig_neigh_node) && (!is_single_hop_neigh)) |