diff options
author | Antonio Quartulli <ordex@autistici.org> | 2011-06-12 05:58:58 -0400 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-06-20 05:37:38 -0400 |
commit | 19595e054d35820e026caac314414e435287e3ae (patch) | |
tree | 7246127eacd1c66e21907eec908161e829fc9fb0 | |
parent | 2265c141086474bbae55a5bb3afa1ebb78ccaa7c (diff) |
batman-adv: throw uevent in userspace on gateway add/change/del event
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>
-rw-r--r-- | 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 0350c0cd690e..6381864c1ca4 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) | |||
179 | { | 179 | { |
180 | struct gw_node *curr_gw = NULL, *next_gw = NULL; | 180 | struct gw_node *curr_gw = NULL, *next_gw = NULL; |
181 | struct neigh_node *router = NULL; | 181 | struct neigh_node *router = NULL; |
182 | char gw_addr[18] = { '\0' }; | ||
182 | 183 | ||
183 | /** | 184 | /** |
184 | * The batman daemon checks here if we already passed a full originator | 185 | * The batman daemon checks here if we already passed a full originator |
@@ -200,6 +201,8 @@ void gw_election(struct bat_priv *bat_priv) | |||
200 | goto out; | 201 | goto out; |
201 | 202 | ||
202 | if (next_gw) { | 203 | if (next_gw) { |
204 | sprintf(gw_addr, "%pM", next_gw->orig_node->orig); | ||
205 | |||
203 | router = orig_node_get_router(next_gw->orig_node); | 206 | router = orig_node_get_router(next_gw->orig_node); |
204 | if (!router) { | 207 | if (!router) { |
205 | gw_deselect(bat_priv); | 208 | gw_deselect(bat_priv); |
@@ -210,12 +213,14 @@ void gw_election(struct bat_priv *bat_priv) | |||
210 | if ((curr_gw) && (!next_gw)) { | 213 | if ((curr_gw) && (!next_gw)) { |
211 | bat_dbg(DBG_BATMAN, bat_priv, | 214 | bat_dbg(DBG_BATMAN, bat_priv, |
212 | "Removing selected gateway - no gateway in range\n"); | 215 | "Removing selected gateway - no gateway in range\n"); |
216 | throw_uevent(bat_priv, UEV_GW, UEV_DEL, NULL); | ||
213 | } else if ((!curr_gw) && (next_gw)) { | 217 | } else if ((!curr_gw) && (next_gw)) { |
214 | bat_dbg(DBG_BATMAN, bat_priv, | 218 | bat_dbg(DBG_BATMAN, bat_priv, |
215 | "Adding route to gateway %pM (gw_flags: %i, tq: %i)\n", | 219 | "Adding route to gateway %pM (gw_flags: %i, tq: %i)\n", |
216 | next_gw->orig_node->orig, | 220 | next_gw->orig_node->orig, |
217 | next_gw->orig_node->gw_flags, | 221 | next_gw->orig_node->gw_flags, |
218 | router->tq_avg); | 222 | router->tq_avg); |
223 | throw_uevent(bat_priv, UEV_GW, UEV_ADD, gw_addr); | ||
219 | } else { | 224 | } else { |
220 | bat_dbg(DBG_BATMAN, bat_priv, | 225 | bat_dbg(DBG_BATMAN, bat_priv, |
221 | "Changing route to gateway %pM " | 226 | "Changing route to gateway %pM " |
@@ -223,6 +228,7 @@ void gw_election(struct bat_priv *bat_priv) | |||
223 | next_gw->orig_node->orig, | 228 | next_gw->orig_node->orig, |
224 | next_gw->orig_node->gw_flags, | 229 | next_gw->orig_node->gw_flags, |
225 | router->tq_avg); | 230 | router->tq_avg); |
231 | throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr); | ||
226 | } | 232 | } |
227 | 233 | ||
228 | gw_select(bat_priv, next_gw); | 234 | gw_select(bat_priv, next_gw); |