summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/netlink.c
diff options
context:
space:
mode:
authorLinus Lüssing <linus.luessing@c0d3.blue>2020-06-01 22:35:22 +0200
committerSimon Wunderlich <sw@simonwunderlich.de>2020-06-26 10:37:11 +0200
commit3bda14d09dc5789a895ab02b7dcfcec19b0a65b3 (patch)
tree2f10916db38855a459d381cfc00c0eeecb0ada66 /net/batman-adv/netlink.c
parentbccb48c89fe3c09f1cbb7c8612e31f5daa1d4541 (diff)
downloadlinux-3bda14d09dc5789a895ab02b7dcfcec19b0a65b3.tar.gz
linux-3bda14d09dc5789a895ab02b7dcfcec19b0a65b3.tar.bz2
linux-3bda14d09dc5789a895ab02b7dcfcec19b0a65b3.zip
batman-adv: Introduce a configurable per interface hop penalty
In some setups multiple hard interfaces with similar link qualities or throughput values are available. But people have expressed the desire to consider one of them as a backup only. Some creative solutions are currently in use: Such people are configuring multiple batman-adv mesh/soft interfaces, wire them together with some veth pairs and then tune the hop penalty to achieve an effect similar to a tunable per interface hop penalty. This patch introduces a new, configurable, per hard interface hop penalty to simplify such setups. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv/netlink.c')
-rw-r--r--net/batman-adv/netlink.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
index cfb00dfa468a..dc193618a761 100644
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -826,6 +826,10 @@ static int batadv_netlink_hardif_fill(struct sk_buff *msg,
goto nla_put_failure;
}
+ if (nla_put_u8(msg, BATADV_ATTR_HOP_PENALTY,
+ atomic_read(&hard_iface->hop_penalty)))
+ goto nla_put_failure;
+
#ifdef CONFIG_BATMAN_ADV_BATMAN_V
if (nla_put_u32(msg, BATADV_ATTR_ELP_INTERVAL,
atomic_read(&hard_iface->bat_v.elp_interval)))
@@ -920,9 +924,15 @@ static int batadv_netlink_set_hardif(struct sk_buff *skb,
{
struct batadv_hard_iface *hard_iface = info->user_ptr[1];
struct batadv_priv *bat_priv = info->user_ptr[0];
+ struct nlattr *attr;
+
+ if (info->attrs[BATADV_ATTR_HOP_PENALTY]) {
+ attr = info->attrs[BATADV_ATTR_HOP_PENALTY];
+
+ atomic_set(&hard_iface->hop_penalty, nla_get_u8(attr));
+ }
#ifdef CONFIG_BATMAN_ADV_BATMAN_V
- struct nlattr *attr;
if (info->attrs[BATADV_ATTR_ELP_INTERVAL]) {
attr = info->attrs[BATADV_ATTR_ELP_INTERVAL];