From: Marek Lindner <lindner_marek@yahoo.de> To: davem@davemloft.net Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner <lindner_marek@yahoo.de> Subject: [PATCH 4/6] batman-adv: broadcast primary OGM on all active hard-interfaces Date: Tue, 5 Jul 2011 15:43:58 +0200 [thread overview] Message-ID: <1309873440-11704-5-git-send-email-lindner_marek@yahoo.de> (raw) In-Reply-To: <1309873440-11704-1-git-send-email-lindner_marek@yahoo.de> The primary interface OGM has to be broadcasted on all hard-interfaces even if the primary interface is not the first interface (if_num = 0). Therefore the code has to compare the originating interface with the primary interface instead of checking the if_num. Reported-by: Linus Luessing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> --- net/batman-adv/send.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 2f62b2e..4b8e11b 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c @@ -163,6 +163,7 @@ static void send_packet(struct forw_packet *forw_packet) struct hard_iface *hard_iface; struct net_device *soft_iface; struct bat_priv *bat_priv; + struct hard_iface *primary_if = NULL; struct batman_packet *batman_packet = (struct batman_packet *)(forw_packet->skb->data); int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); @@ -170,19 +171,23 @@ static void send_packet(struct forw_packet *forw_packet) if (!forw_packet->if_incoming) { pr_err("Error - can't forward packet: incoming iface not " "specified\n"); - return; + goto out; } soft_iface = forw_packet->if_incoming->soft_iface; bat_priv = netdev_priv(soft_iface); if (forw_packet->if_incoming->if_status != IF_ACTIVE) - return; + goto out; + + primary_if = primary_if_get_selected(bat_priv); + if (!primary_if) + goto out; /* multihomed peer assumed */ /* non-primary OGMs are only broadcasted on their interface */ if ((directlink && (batman_packet->ttl == 1)) || - (forw_packet->own && (forw_packet->if_incoming->if_num > 0))) { + (forw_packet->own && (forw_packet->if_incoming != primary_if))) { /* FIXME: what about aggregated packets ? */ bat_dbg(DBG_BATMAN, bat_priv, @@ -199,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet) broadcast_addr); forw_packet->skb = NULL; - return; + goto out; } /* broadcast on every interface */ @@ -211,6 +216,10 @@ static void send_packet(struct forw_packet *forw_packet) send_packet_to_if(forw_packet, hard_iface); } rcu_read_unlock(); + +out: + if (primary_if) + hardif_free_ref(primary_if); } static void realloc_packet_buffer(struct hard_iface *hard_iface, -- 1.7.5.3
WARNING: multiple messages have this Message-ID (diff)
From: Marek Lindner <lindner_marek@yahoo.de> To: davem@davemloft.net Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner <lindner_marek@yahoo.de> Subject: [B.A.T.M.A.N.] [PATCH 4/6] batman-adv: broadcast primary OGM on all active hard-interfaces Date: Tue, 5 Jul 2011 15:43:58 +0200 [thread overview] Message-ID: <1309873440-11704-5-git-send-email-lindner_marek@yahoo.de> (raw) In-Reply-To: <1309873440-11704-1-git-send-email-lindner_marek@yahoo.de> The primary interface OGM has to be broadcasted on all hard-interfaces even if the primary interface is not the first interface (if_num = 0). Therefore the code has to compare the originating interface with the primary interface instead of checking the if_num. Reported-by: Linus Luessing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> --- net/batman-adv/send.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 2f62b2e..4b8e11b 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c @@ -163,6 +163,7 @@ static void send_packet(struct forw_packet *forw_packet) struct hard_iface *hard_iface; struct net_device *soft_iface; struct bat_priv *bat_priv; + struct hard_iface *primary_if = NULL; struct batman_packet *batman_packet = (struct batman_packet *)(forw_packet->skb->data); int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); @@ -170,19 +171,23 @@ static void send_packet(struct forw_packet *forw_packet) if (!forw_packet->if_incoming) { pr_err("Error - can't forward packet: incoming iface not " "specified\n"); - return; + goto out; } soft_iface = forw_packet->if_incoming->soft_iface; bat_priv = netdev_priv(soft_iface); if (forw_packet->if_incoming->if_status != IF_ACTIVE) - return; + goto out; + + primary_if = primary_if_get_selected(bat_priv); + if (!primary_if) + goto out; /* multihomed peer assumed */ /* non-primary OGMs are only broadcasted on their interface */ if ((directlink && (batman_packet->ttl == 1)) || - (forw_packet->own && (forw_packet->if_incoming->if_num > 0))) { + (forw_packet->own && (forw_packet->if_incoming != primary_if))) { /* FIXME: what about aggregated packets ? */ bat_dbg(DBG_BATMAN, bat_priv, @@ -199,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet) broadcast_addr); forw_packet->skb = NULL; - return; + goto out; } /* broadcast on every interface */ @@ -211,6 +216,10 @@ static void send_packet(struct forw_packet *forw_packet) send_packet_to_if(forw_packet, hard_iface); } rcu_read_unlock(); + +out: + if (primary_if) + hardif_free_ref(primary_if); } static void realloc_packet_buffer(struct hard_iface *hard_iface, -- 1.7.5.3
next prev parent reply other threads:[~2011-07-05 13:44 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-07-05 13:43 pull request: batman-adv 2011-07-05 Marek Lindner 2011-07-05 13:43 ` [B.A.T.M.A.N.] " Marek Lindner [not found] ` <1309873440-11704-1-git-send-email-lindner_marek-LWAfsSFWpa4@public.gmane.org> 2011-07-05 13:43 ` [PATCH 1/6] batman-adv: unify flags for tt_change/tt_local_entry/tt_global_entry Marek Lindner 2011-07-05 13:43 ` [B.A.T.M.A.N.] " Marek Lindner 2011-07-05 13:43 ` [PATCH 2/6] batman-adv: add_bcast_packet_to_list() takes the sending delay as parameter Marek Lindner 2011-07-05 13:43 ` [B.A.T.M.A.N.] " Marek Lindner 2011-07-06 2:46 ` pull request: batman-adv 2011-07-05 David Miller 2011-07-06 2:46 ` [B.A.T.M.A.N.] " David Miller 2011-07-05 13:43 ` [PATCH 3/6] batman-adv: pass a unique flag arg instead of a sequence of bool ones Marek Lindner 2011-07-05 13:43 ` [B.A.T.M.A.N.] " Marek Lindner 2011-07-05 13:43 ` Marek Lindner [this message] 2011-07-05 13:43 ` [B.A.T.M.A.N.] [PATCH 4/6] batman-adv: broadcast primary OGM on all active hard-interfaces Marek Lindner 2011-07-05 13:43 ` [PATCH 5/6] batman-adv: aggregation checks should use the primary_if pointer Marek Lindner 2011-07-05 13:43 ` [B.A.T.M.A.N.] " Marek Lindner 2011-07-05 13:44 ` [PATCH 6/6] batman-adv: Replace version info instead of appending them Marek Lindner 2011-07-05 13:44 ` [B.A.T.M.A.N.] " Marek Lindner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1309873440-11704-5-git-send-email-lindner_marek@yahoo.de \ --to=lindner_marek@yahoo.de \ --cc=b.a.t.m.a.n@lists.open-mesh.org \ --cc=davem@davemloft.net \ --cc=netdev@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.