Skip to content

Commit

Permalink
batman-adv: throw uevent in userspace on gateway add/change/del event
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Antonio Quartulli authored and Sven Eckelmann committed Jun 20, 2011
1 parent 2265c14 commit 19595e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/batman-adv/gateway_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -210,19 +213,22 @@ 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 "
"(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_CHANGE, gw_addr);
}

gw_select(bat_priv, next_gw);
Expand Down

0 comments on commit 19595e0

Please sign in to comment.