提交 19595e05 编写于 作者: A Antonio Quartulli 提交者: Sven Eckelmann

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: NAntonio Quartulli <ordex@autistici.org>
Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: NSven Eckelmann <sven@narfation.org>
上级 2265c141
...@@ -179,6 +179,7 @@ void gw_election(struct bat_priv *bat_priv) ...@@ -179,6 +179,7 @@ void gw_election(struct bat_priv *bat_priv)
{ {
struct gw_node *curr_gw = NULL, *next_gw = NULL; struct gw_node *curr_gw = NULL, *next_gw = NULL;
struct neigh_node *router = NULL; struct neigh_node *router = NULL;
char gw_addr[18] = { '\0' };
/** /**
* The batman daemon checks here if we already passed a full originator * 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,6 +201,8 @@ void gw_election(struct bat_priv *bat_priv)
goto out; goto out;
if (next_gw) { if (next_gw) {
sprintf(gw_addr, "%pM", next_gw->orig_node->orig);
router = orig_node_get_router(next_gw->orig_node); router = orig_node_get_router(next_gw->orig_node);
if (!router) { if (!router) {
gw_deselect(bat_priv); gw_deselect(bat_priv);
...@@ -210,12 +213,14 @@ void gw_election(struct bat_priv *bat_priv) ...@@ -210,12 +213,14 @@ void gw_election(struct bat_priv *bat_priv)
if ((curr_gw) && (!next_gw)) { if ((curr_gw) && (!next_gw)) {
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"Removing selected gateway - no gateway in range\n"); "Removing selected gateway - no gateway in range\n");
throw_uevent(bat_priv, UEV_GW, UEV_DEL, NULL);
} else if ((!curr_gw) && (next_gw)) { } else if ((!curr_gw) && (next_gw)) {
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"Adding route to gateway %pM (gw_flags: %i, tq: %i)\n", "Adding route to gateway %pM (gw_flags: %i, tq: %i)\n",
next_gw->orig_node->orig, next_gw->orig_node->orig,
next_gw->orig_node->gw_flags, next_gw->orig_node->gw_flags,
router->tq_avg); router->tq_avg);
throw_uevent(bat_priv, UEV_GW, UEV_ADD, gw_addr);
} else { } else {
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"Changing route to gateway %pM " "Changing route to gateway %pM "
...@@ -223,6 +228,7 @@ void gw_election(struct bat_priv *bat_priv) ...@@ -223,6 +228,7 @@ void gw_election(struct bat_priv *bat_priv)
next_gw->orig_node->orig, next_gw->orig_node->orig,
next_gw->orig_node->gw_flags, next_gw->orig_node->gw_flags,
router->tq_avg); router->tq_avg);
throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr);
} }
gw_select(bat_priv, next_gw); gw_select(bat_priv, next_gw);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册