Skip to contentSkip to conversation

batctl: Add per interface hop penalty command

PATCH Superseded Linus Lüssing 2 participants 2 messages Jun 1, 2020 – Jun 2, 2020 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 Makefile         |   1 +
 README.rst       |   7 ++-
 if_hop_penalty.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++
 man/batctl.8     |   4 ++
 4 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 if_hop_penalty.c
Makefile +1 -0
index 780c2c0..34096f7 100755
@@ -51,6 +51,7 @@ $(eval $(call add_command,fragmentation,y))
 $(eval $(call add_command,gateways,y))
 $(eval $(call add_command,gw_mode,y))
 $(eval $(call add_command,hop_penalty,y))
+$(eval $(call add_command,if_hop_penalty,y))
 $(eval $(call add_command,interface,y))
 $(eval $(call add_command,isolation_mark,y))
 $(eval $(call add_command,loglevel,y))
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
if_hop_penalty.c new file +113 -0

113 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 2 lines · On Monday, 1 June 2020 22:35:38 CEST Linus Lüssing wrote:

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

I would prefer not to have "this patch" in all your patches :)

Maybe something more like:

* why is it needed
* what was changed

Quoted 6 lines
---
 Makefile         |   1 +
 README.rst       |   7 ++-
 if_hop_penalty.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++

Wouldn't it be more consistent to have this in the main hop_penalty file and just add a new COMMAND_NAMED?

Quoted 3 lines
 man/batctl.8     |   4 ++
 4 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 if_hop_penalty.c

This is missing the change to parse the per hardif in the batctl event monitor command.

Kind regards,
Sven