batctl: Add support for hop_penalty settings command
[feed/routing.git] / batctl / patches / 0001-batctl-Add-hop_penalty-command.patch
1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Fri, 22 Feb 2019 22:19:59 +0100
3 Subject: batctl: Add hop_penalty command
4
5 Signed-off-by: Sven Eckelmann <sven@narfation.org>
6
7 diff --git a/Makefile b/Makefile
8 index 4d8b7095a1e307f0dde7660a718e4ad9c6b11102..55105cc754f546891ba2fcaf57dc8b3ac4c22f71 100755
9 --- a/Makefile
10 +++ b/Makefile
11 @@ -63,6 +63,7 @@ $(eval $(call add_command,event,y))
12 $(eval $(call add_command,fragmentation,y))
13 $(eval $(call add_command,gateways,y))
14 $(eval $(call add_command,gw_mode,y))
15 +$(eval $(call add_command,hop_penalty,y))
16 $(eval $(call add_command,interface,y))
17 $(eval $(call add_command,isolation_mark,y))
18 $(eval $(call add_command,log,y))
19 diff --git a/hop_penalty.c b/hop_penalty.c
20 new file mode 100644
21 index 0000000000000000000000000000000000000000..6e6a06a661e2ffbb76793116fb214396523bbd8d
22 --- /dev/null
23 +++ b/hop_penalty.c
24 @@ -0,0 +1,35 @@
25 +// SPDX-License-Identifier: GPL-2.0
26 +/* Copyright (C) 2009-2019 B.A.T.M.A.N. contributors:
27 + *
28 + * Marek Lindner <mareklindner@neomailbox.ch>
29 + *
30 + * This program is free software; you can redistribute it and/or
31 + * modify it under the terms of version 2 of the GNU General Public
32 + * License as published by the Free Software Foundation.
33 + *
34 + * This program is distributed in the hope that it will be useful, but
35 + * WITHOUT ANY WARRANTY; without even the implied warranty of
36 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37 + * General Public License for more details.
38 + *
39 + * You should have received a copy of the GNU General Public License
40 + * along with this program; if not, write to the Free Software
41 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
42 + * 02110-1301, USA
43 + *
44 + * License-Filename: LICENSES/preferred/GPL-2.0
45 + */
46 +
47 +#include <stddef.h>
48 +
49 +#include "main.h"
50 +#include "sys.h"
51 +
52 +static struct settings_data batctl_settings_hop_penalty = {
53 + .sysfs_name = "hop_penalty",
54 + .params = NULL,
55 +};
56 +
57 +COMMAND_NAMED(SUBCOMMAND, hop_penalty, "hp", handle_sys_setting,
58 + COMMAND_FLAG_MESH_IFACE, &batctl_settings_hop_penalty,
59 + "[penalty] \tdisplay or modify hop_penalty setting");