b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
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 11/12] batman-adv: throw uevent in userspace on gateway add/change/del event
Date: Mon, 20 Jun 2011 12:17:04 +0200	[thread overview]
Message-ID: <1308565025-21293-12-git-send-email-sven@narfation.org> (raw)
In-Reply-To: <1308565025-21293-1-git-send-email-sven@narfation.org>

From: Antonio Quartulli <ordex@autistici.org>

In case of new default gw, changing the default gw or deleting the default gw a
uevent is triggered with type=gw, action=add/change/del and
data={GW_ORIG_ADDRESS} (if any).

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/gateway_client.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 0350c0c..6381864 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -179,6 +179,7 @@ void gw_election(struct bat_priv *bat_priv)
 {
 	struct gw_node *curr_gw = NULL, *next_gw = NULL;
 	struct neigh_node *router = NULL;
+	char gw_addr[18] = { '\0' };
 
 	/**
 	 * The batman daemon checks here if we already passed a full originator
@@ -200,6 +201,8 @@ void gw_election(struct bat_priv *bat_priv)
 		goto out;
 
 	if (next_gw) {
+		sprintf(gw_addr, "%pM", next_gw->orig_node->orig);
+
 		router = orig_node_get_router(next_gw->orig_node);
 		if (!router) {
 			gw_deselect(bat_priv);
@@ -210,12 +213,14 @@ void gw_election(struct bat_priv *bat_priv)
 	if ((curr_gw) && (!next_gw)) {
 		bat_dbg(DBG_BATMAN, bat_priv,
 			"Removing selected gateway - no gateway in range\n");
+		throw_uevent(bat_priv, UEV_GW, UEV_DEL, NULL);
 	} else if ((!curr_gw) && (next_gw)) {
 		bat_dbg(DBG_BATMAN, bat_priv,
 			"Adding route to gateway %pM (gw_flags: %i, tq: %i)\n",
 			next_gw->orig_node->orig,
 			next_gw->orig_node->gw_flags,
 			router->tq_avg);
+		throw_uevent(bat_priv, UEV_GW, UEV_ADD, gw_addr);
 	} else {
 		bat_dbg(DBG_BATMAN, bat_priv,
 			"Changing route to gateway %pM "
@@ -223,6 +228,7 @@ void gw_election(struct bat_priv *bat_priv)
 			next_gw->orig_node->orig,
 			next_gw->orig_node->gw_flags,
 			router->tq_avg);
+		throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr);
 	}
 
 	gw_select(bat_priv, next_gw);
-- 
1.7.5.3


  parent reply	other threads:[~2011-06-20 10:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-20 10:16 [B.A.T.M.A.N.] pull request: batman-adv 2011-06-20 Sven Eckelmann
2011-06-20 10:16 ` [B.A.T.M.A.N.] [PATCH 01/12] batman-adv: Move compare_orig to originator.c Sven Eckelmann
2011-06-20 10:16 ` [B.A.T.M.A.N.] [PATCH 02/12] batman-adv: Keep interface_tx as local function Sven Eckelmann
2011-06-20 10:16 ` [B.A.T.M.A.N.] [PATCH 03/12] batman-adv: count_real_packets() in batman-adv assumes char is signed Sven Eckelmann
2011-06-20 10:16 ` [B.A.T.M.A.N.] [PATCH 04/12] batman-adv: Reduce usage of char Sven Eckelmann
2011-06-20 10:16 ` [B.A.T.M.A.N.] [PATCH 05/12] batman-adv: Unify the first 3 bytes in each packet Sven Eckelmann
2011-06-20 10:16 ` [B.A.T.M.A.N.] [PATCH 06/12] batman-adv: improved client announcement mechanism Sven Eckelmann
2011-06-20 10:17 ` [B.A.T.M.A.N.] [PATCH 07/12] batman-adv: improved roaming mechanism Sven Eckelmann
2011-06-20 10:17 ` [B.A.T.M.A.N.] [PATCH 08/12] batman-adv: protect the local and the global trans-tables with rcu Sven Eckelmann
2011-06-20 10:17 ` [B.A.T.M.A.N.] [PATCH 09/12] batman-adv: add wrapper function to throw uevent in userspace Sven Eckelmann
2011-06-20 10:17 ` [B.A.T.M.A.N.] [PATCH 10/12] batman-adv: gateway election code refactoring Sven Eckelmann
2011-06-20 10:17 ` Sven Eckelmann [this message]
2011-06-20 10:17 ` [B.A.T.M.A.N.] [PATCH 12/12] batman-adv: improved gateway tq-based selection Sven Eckelmann
2011-06-20 20:01 ` [B.A.T.M.A.N.] pull request: batman-adv 2011-06-20 David Miller

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=1308565025-21293-12-git-send-email-sven@narfation.org \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=lindner_marek@yahoo.de \
    --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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).