From patchwork Thu Mar 1 07:35:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1570 Return-Path: Received: from nm18-vm0.bullet.mail.ukl.yahoo.com (nm18-vm0.bullet.mail.ukl.yahoo.com [217.146.183.95]) by open-mesh.org (Postfix) with SMTP id 3C5F6600899 for ; Thu, 1 Mar 2012 08:35:35 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.216] by nm18.bullet.mail.ukl.yahoo.com with NNFMP; 01 Mar 2012 07:35:34 -0000 Received: from [77.238.184.70] by tm9.bullet.mail.ukl.yahoo.com with NNFMP; 01 Mar 2012 07:35:34 -0000 Received: from [127.0.0.1] by smtp139.mail.ukl.yahoo.com with NNFMP; 01 Mar 2012 07:35:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1330587334; bh=iPnzR02ib7Aey1rp90CY6t9PG+SgQ2X7Q9/iov8vwik=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer; b=2gg5GY3JIgkS3GmlNxBSbBL00WA5Kn86aQe7q2ynQC/g0bmAW6F8Ev52RDyIcUn5/9jc6mc4AlP1K60UMS2syquWGG+rik5js73U4UCTMGeeL6HXGHQko+IttmSf2fei+H6nHLltKJt1HVIqkVw/C6RZELmBgBdNPSNbr9ixV4o= X-Yahoo-Newman-Id: 700418.46311.bm@smtp139.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: w0jF9yYVM1nJTQsd8DsvhVf2hHeoNBQw4ruKnlBnSXYRmG_ B_bFZjxBI9HmHARBc.XuT4CGG74ClTf5ydyuzP3_c5_oYbFsQNGE8YP5c46_ FlC7oEt2_HdKNHq2drvdnBsfeH2UM.Q0RlTdzs3ffcPUkXckcmniWv7GUq9J 7mZgNwLxspTWlCicPBwB37Bc.4FvwG43Jyy7HcyFMDH8Gh4sO6CdO0IeCy8a fHfef7WYPbY1csMeLaMtj3e5vykhOpMa82RieO28MfJb.rrXSc6cG9yFqKR5 wdiRmgce2ubNsvAsgpZcZGOgqhkbSV_QiHY748fG9kKfOYEoNtM51toAgoWh IWeKdx_2GonHY2SGnUk865asGcqTeX1_vbSIATWYH676HR431Tpa6qlpjM4l cGfQp X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@119.236.110.45 with plain) by smtp139.mail.ukl.yahoo.com with SMTP; 01 Mar 2012 07:35:33 +0000 GMT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 1 Mar 2012 15:35:16 +0800 Message-Id: <1330587321-12177-1-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.9 Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 1/6] batman-adv: introduce is_single_hop_neigh variable to increase readability X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2012 07:35:36 -0000 Signed-off-by: Marek Lindner Acked-by: Simon Wunderlich --- bat_iv_ogm.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c index d9195b3..aba0204 100644 --- a/bat_iv_ogm.c +++ b/bat_iv_ogm.c @@ -483,7 +483,8 @@ static void bat_iv_ogm_queue_add(struct bat_priv *bat_priv, static void bat_iv_ogm_forward(struct orig_node *orig_node, const struct ethhdr *ethhdr, struct batman_ogm_packet *batman_ogm_packet, - int directlink, struct hard_iface *if_incoming) + bool is_single_hop_neigh, + struct hard_iface *if_incoming) { struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); struct neigh_node *router; @@ -537,7 +538,7 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node, /* switch of primaries first hop flag when forwarding */ batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP; - if (directlink) + if (is_single_hop_neigh) batman_ogm_packet->flags |= DIRECTLINK; else batman_ogm_packet->flags &= ~DIRECTLINK; @@ -926,7 +927,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, struct neigh_node *orig_neigh_router = NULL; int has_directlink_flag; int is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0; - int is_broadcast = 0, is_bidirectional, is_single_hop_neigh; + int is_broadcast = 0, is_bidirectional; + bool is_single_hop_neigh = false; int is_duplicate; uint32_t if_incoming_seqno; @@ -950,8 +952,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); - is_single_hop_neigh = (compare_eth(ethhdr->h_source, - batman_ogm_packet->orig) ? 1 : 0); + if (compare_eth(ethhdr->h_source, batman_ogm_packet->orig)) + is_single_hop_neigh = true; bat_dbg(DBG_BATMAN, bat_priv, "Received BATMAN packet via NB: %pM, IF: %s [%pM] " @@ -1125,7 +1127,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, /* mark direct link on incoming interface */ bat_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, - 1, if_incoming); + is_single_hop_neigh, if_incoming); bat_dbg(DBG_BATMAN, bat_priv, "Forwarding packet: " "rebroadcast neighbor packet with direct link flag\n"); @@ -1148,7 +1150,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, bat_dbg(DBG_BATMAN, bat_priv, "Forwarding packet: rebroadcast originator packet\n"); bat_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, - 0, if_incoming); + is_single_hop_neigh, if_incoming); out_neigh: if ((orig_neigh_node) && (!is_single_hop_neigh))