Skip to contentSkip to conversation

batctl: Add per interface hop penalty command

PATCH In review Linus Lüssing 1 participant 2 messages Jun 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 batctl: Add per interface hop penalty command

This patch extends the hop penalty setting to be configurable not only on a node scope but also on a per hard interface basis.

---
 README.rst    |  7 ++++++-
 event.c       |  4 ++++
 hop_penalty.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 man/batctl.8  |  4 ++++
 4 files changed, 61 insertions(+), 1 deletion(-)
README.rst +6 -1
index 128f539..4830347 100644
@@ -562,8 +562,13 @@ Usage::
 
 Example::
 
-  $ batctl penalty
+  $ batctl hop_penalty
   30
+  $ batctl hardif eth0 hop_penalty
+  0
+  $ batctl hardif eth0 hop_penalty 50
+  $ batctl hardif eth0 hop_penalty
+  50
 
 
 batctl isolation_mark
event.c +4 -0
index cebb803..3fbc6cc 100644
@@ -317,6 +317,10 @@ static void event_parse_set_hardif(struct nlattr **attrs)
 
 	printf("%s (%s): set hardif:\n", meshif_name, hardif_name);
 
+	if (attrs[BATADV_ATTR_HOP_PENALTY])
+		printf("* hop_penalty %u\n",
+		       nla_get_u8(attrs[BATADV_ATTR_HOP_PENALTY]));
+
 	if (attrs[BATADV_ATTR_ELP_INTERVAL])
 		printf("* elp_interval %u ms\n",
 		       nla_get_u32(attrs[BATADV_ATTR_ELP_INTERVAL]));
hop_penalty.c +47 -0

66 lines not on this page · raw message

man/batctl.8 +4 -0
index 6e75cdd..d4d5fe5 100644
@@ -109,6 +109,10 @@ disable fragmentation.
 If no parameter is given the current hop penalty setting is displayed. Otherwise the parameter is used to set the
 hop penalty. The penalty is can be 0-255 (255 sets originator message's TQ to zero when forwarded by this hop).
 .br
+.IP "[\fBhardif <hardif>\fP] \fBhop_penalty\fP|\fBhp\fP [\fBpenalty\fP]"
+If no parameter is given the current hop penalty setting of the hard interface is displayed. Otherwise the parameter is used to set the
+hop penalty. The penalty can be 0-255 (255 sets originator message's TQ to zero when forwarded over this interface).
+.br
 .IP "[\fBmeshif <netdev>\fP] \fBnetwork_coding\fP|\fBnc\fP [\fB0\fP|\fB1\fP]"
 If no parameter is given the current network coding mode setting is displayed. Otherwise the parameter is used to enable or
 disable network coding.
Signature · 1 line
2.27.0.rc2
#1 lore raw
Quoted 10 lines · Linus Lüssing

This patch extends the hop penalty setting to be configurable not only on a node scope but also on a per hard interface basis.

---
 README.rst    |  7 ++++++-
 event.c       |  4 ++++
 hop_penalty.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 man/batctl.8  |  4 ++++
 4 files changed, 61 insertions(+), 1 deletion(-)

Changelog v2:

* merged if_hop_penalty.c into hop_penalty.c (saved some duplicate code)
* added and tested hardif event monitor for the hop penalty attribute