Skip to contentSkip to conversation

batman-adv: netlink restructuring, part 2

RFC Superseded Sven Eckelmann 2 participants 8 messages Nov 4, 2018 – Nov 5, 2018 Batman advanced

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

cover batman-adv: netlink restructuring, part 2

Hi,

Jiri Pirko called the batman-adv configuration interface a while back "a huge mistake" [1] and suggested genl as alternative. But it is not completely clear what he meant by that. I had a look at the implementation in team and devlink (he is maintainer of both). Unfortunately, both work in slightly different ways. But they seem to have in common that there are different classes of configuration options/params which then have their own set of commands. But each set of command works for multiple options/params.

I have tried to replicate something similar with this implementation. It might be important to point out that it requires multiple messages when trying to change multiple options (e.g. modification of gw_bandwidth_down and gw_bandwidth_up require two messages). This should be more like devlink and not like team. But it directly sends the new options back via genlmsg_multicast to all subscribers of the "config" mcast group. There is also currently no nesting of attributes.

The code is basically around the triplet name-type-value. All three are required for set operations, name is required for get operations and nothing of the triplet is required for dump operations (because it will create messages containing this triplet). The different classes of options also require as input:

* mesh interface (the batadv device)
- meshif_index
* hard interface specific (the enslaved devices)
- meshif_index
- hardif_index
* vlan specific (vlan on top of the mesh interface)
- meshif_index
- vlan id

Luckily, Jiri Pirko told us that he will have a look at patches. Here are two patches with an initial implementation. I might have to split them futher - maybe three patches for the infrastructure part and a couple for the import of the sysfs options in the new infrastructure. I am happy to receive suggestions how I should split them.

There is also some potential in reducing the shared code for the .doit commands by moving the BATADV_ATTR_MESH_IFINDEX -> bat_priv code to .pre and .post handlers.

Kind regards,
Sven

[1] https://www.open-mesh.org/issues/300

Sven Eckelmann (2):
batman-adv: Add infrastructure for netlink config manipulation
batman-adv: Convert existing sysfs options to netlink

 include/uapi/linux/batman_adv.h |   55 +
 net/batman-adv/Makefile         |    1 +
 net/batman-adv/netlink.c        |   50 +-
 net/batman-adv/netlink.h        |    6 +
 net/batman-adv/netlink_cfg.c    | 2096 +++++++++++++++++++++++++++++++
 net/batman-adv/netlink_cfg.h    |   78 ++
 6 files changed, 2280 insertions(+), 6 deletions(-)
 create mode 100644 net/batman-adv/netlink_cfg.c
 create mode 100644 net/batman-adv/netlink_cfg.h
Signature · 1 line
2.19.1
author maintainer
#1 lore raw

RFC 1/2 batman-adv: Add infrastructure for netlink config manipulation

The batman-adv configuration interface was implemented solely using sysfs. This approach was condemned by non-batadv developers as "huge mistake". Instead a netlink/genl based implementation was suggested.

The different key-value pairs used for the configuration of batman-adv can be split in three classes (sharing most of the setup code):

* mesh interface (the batadv device)
* hard interface specific (the enslaved devices)
* vlan specific (vlan on top of the mesh interface)

For all three, genl commands to get, set and dump are specified. The actual modification of datastructures is then trivial and abstracted away from the genl handing via objects with callbacks (get, validate, set). The option infrastructure is handling the actual retrieval of mesh interface object, hard interface object and vlan object. It takes care of validation and issuing netlink mcast messages back to userspace.

TODO add more description here.

---
 include/uapi/linux/batman_adv.h |   55 ++
 net/batman-adv/Makefile         |    1 +
 net/batman-adv/netlink.c        |   50 +-
 net/batman-adv/netlink.h        |    6 +
 net/batman-adv/netlink_cfg.c    | 1051 +++++++++++++++++++++++++++++++
 net/batman-adv/netlink_cfg.h    |   78 +++
 6 files changed, 1235 insertions(+), 6 deletions(-)
 create mode 100644 net/batman-adv/netlink_cfg.c
 create mode 100644 net/batman-adv/netlink_cfg.h
include/uapi/linux/batman_adv.h +55 -0
index 324a0e11..9b5f5f2c 100644
@@ -27,6 +27,7 @@
 
 #define BATADV_NL_NAME "batadv"
 
+#define BATADV_NL_MCAST_GROUP_CONFIG	"config"
 #define BATADV_NL_MCAST_GROUP_TPMETER	"tpmeter"
 
 /**
@@ -344,6 +345,26 @@ enum batadv_nl_attrs {
 	 */
 	BATADV_ATTR_MCAST_FLAGS_PRIV,
 
+	/**
+	 * @BATADV_ATTR_VLANID: VLAN id on top of soft interface
+	 */
+	BATADV_ATTR_VLANID,
+
+	/**
+	 * @BATADV_ATTR_OPTION_NAME: name of option to modify
+	 */
+	BATADV_ATTR_OPTION_NAME,
+
+	/**
+	 * @BATADV_ATTR_OPTION_TYPE: type of @BATADV_ATTR_OPTION_VALUE
+	 */
+	BATADV_ATTR_OPTION_TYPE,
+
+	/**
+	 * @BATADV_ATTR_OPTION_VALUE: value set for @BATADV_ATTR_OPTION_NAME
+	 */
+	BATADV_ATTR_OPTION_VALUE,
+
 	/* add attributes above here, update the policy in netlink.c */
 
 	/**
@@ -443,6 +464,40 @@ enum batadv_nl_commands {
 	 */
 	BATADV_CMD_GET_MCAST_FLAGS,
 
+	/**
+	 * @BATADV_CMD_GET_OPTION: Get option(s) from softif
+	 */
+	BATADV_CMD_GET_OPTION,
+
+	/**
+	 * @BATADV_CMD_SET_OPTION: Set option for softif
+	 */
+	BATADV_CMD_SET_OPTION,
+
+	/**
+	 * @BATADV_CMD_GET_OPTION_HARDIF: Get option(s) from a hardif of the
+	 *  current softif
+	 */
+	BATADV_CMD_GET_OPTION_HARDIF,
+
+	/**
+	 * @BATADV_CMD_SET_OPTION_HARDIF: Set option for hardif of the
+	 *  current softif
+	 */
+	BATADV_CMD_SET_OPTION_HARDIF,
+
+	/**
+	 * @BATADV_CMD_GET_OPTION_VLAN: Get option(s) from a VLAN of the
+	 *  current softif
+	 */
+	BATADV_CMD_GET_OPTION_VLAN,
+
+	/**
+	 * @BATADV_CMD_SET_OPTION_VLAN: Set option for VLAN of the
+	 *  current softif
+	 */
+	BATADV_CMD_SET_OPTION_VLAN,
+
 	/* add new commands above here */
 
 	/**
net/batman-adv/Makefile +1 -0
index 9b58160f..a503e145 100644
@@ -36,6 +36,7 @@ batman-adv-$(CONFIG_BATMAN_ADV_DEBUG) += log.o
 batman-adv-y += main.o
 batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o
 batman-adv-y += netlink.o
+batman-adv-y += netlink_cfg.o
 batman-adv-$(CONFIG_BATMAN_ADV_NC) += network-coding.o
 batman-adv-y += originator.o
 batman-adv-y += routing.o
net/batman-adv/netlink.c +44 -6

75 lines not on this page · raw message

net/batman-adv/netlink.h +6 -0
index 571d9a5a..9438572d 100644
@@ -26,6 +26,12 @@
 
 struct nlmsghdr;
 
+/* multicast groups */
+enum batadv_netlink_multicast_groups {
+	BATADV_NL_MCGRP_CONFIG,
+	BATADV_NL_MCGRP_TPMETER,
+};
+
 void batadv_netlink_register(void);
 void batadv_netlink_unregister(void);
 int batadv_netlink_get_ifindex(const struct nlmsghdr *nlh, int attrtype);
net/batman-adv/netlink_cfg.c new file +1051 -0

1,051 lines not on this page · raw message

net/batman-adv/netlink_cfg.h new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.19.1
#2 lore raw

Re: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Add infrastructure for netlink config manipulation

Quoted 6 lines · Sun, Nov 04, 2018 at 08:33:13PM CET, [email protected] wrote:

The batman-adv configuration interface was implemented solely using sysfs. This approach was condemned by non-batadv developers as "huge mistake". Instead a netlink/genl based implementation was suggested.

The different key-value pairs used for the configuration of batman-adv can be split in three classes (sharing most of the setup code):

This is problematic. In general, TLV approach is frowned upon. What is a usual way of exposing options over netlink are well-defined netlink attributes. For example:

BATADV_ATTR_SOME_THING
BATADV_ATTR_ANOTHER_THING

The set and get commands usually work with an object. So if and object have multiple options/attributes, it can we set via a single set command. But this is more free. Depends on what makes more sense.

Quoted 14 lines

* mesh interface (the batadv device)
* hard interface specific (the enslaved devices)
* vlan specific (vlan on top of the mesh interface)

For all three, genl commands to get, set and dump are specified. The actual modification of datastructures is then trivial and abstracted away from the genl handing via objects with callbacks (get, validate, set). The option infrastructure is handling the actual retrieval of mesh interface object, hard interface object and vlan object. It takes care of validation and issuing netlink mcast messages back to userspace.

TODO add more description here.

author maintainer
#3 lore raw

Re: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Add infrastructure for netlink config manipulation

Quoted 12 lines · On Montag, 5. November 2018 11:17:08 CET Jiri Pirko wrote:
Quoted 6 lines · Sun, Nov 04, 2018 at 08:33:13PM CET, [email protected] wrote:

The batman-adv configuration interface was implemented solely using sysfs. This approach was condemned by non-batadv developers as "huge mistake". Instead a netlink/genl based implementation was suggested.

The different key-value pairs used for the configuration of batman-adv can be split in three classes (sharing most of the setup code):

This is problematic. In general, TLV approach is frowned upon. What is a usual way of exposing options over netlink are well-defined netlink attributes. For example:

Quoted 6 lines

BATADV_ATTR_SOME_THING
BATADV_ATTR_ANOTHER_THING

The set and get commands usually work with an object. So if and object have multiple options/attributes, it can we set via a single set command. But this is more free. Depends on what makes more sense.

Hm, so you first say that I should not do that and then say that it can be done because it operates on the same object? Classes in my description are basically your object.

But let assume for now that you don't want to use this approach, we can also have for example something like:

BATADV_CMD_SET_BRIDGE_LOOP_AVOIDANCE which then receives either one or no flag BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE to enable/disable bridge loop avoidance. And a command BATADV_CMD_GET_BRIDGE_LOOP_AVOIDANCE which tells the client using BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE whether it was enabled or not. A dump functionality for all options for this batadv object/class would then not exist.

Kind regards,
Sven

#4 lore raw

Re: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Add infrastructure for netlink config manipulation

Quoted 16 lines · Mon, Nov 05, 2018 at 12:33:25PM CET, [email protected] wrote:
Quoted 15 lines · On Montag, 5. November 2018 11:17:08 CET Jiri Pirko wrote:
Quoted 6 lines · Sun, Nov 04, 2018 at 08:33:13PM CET, [email protected] wrote:

The batman-adv configuration interface was implemented solely using sysfs. This approach was condemned by non-batadv developers as "huge mistake". Instead a netlink/genl based implementation was suggested.

The different key-value pairs used for the configuration of batman-adv can be split in three classes (sharing most of the setup code):

This is problematic. In general, TLV approach is frowned upon. What is a usual way of exposing options over netlink are well-defined netlink attributes. For example:

BATADV_ATTR_SOME_THING
BATADV_ATTR_ANOTHER_THING

Quoted 7 lines
Quoted 3 lines

The set and get commands usually work with an object. So if and object have multiple options/attributes, it can we set via a single set command. But this is more free. Depends on what makes more sense.

Hm, so you first say that I should not do that and then say that it can be done because it operates on the same object? Classes in my description are basically your object.

The API needs to be well-defined. That, you can do by defining ATTRs. But with TVLs, that cannot be be done. API is NAME-VALUE and user does not really see what "NAME" he can pass down, as it is parsed later on in batman code. That is my point. To have all options as well-defined netlink attributes with types (for netlink policy purposes).

Quoted 10 lines

But let assume for now that you don't want to use this approach, we can also have for example something like:

BATADV_CMD_SET_BRIDGE_LOOP_AVOIDANCE which then receives either one or no flag BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE to enable/disable bridge loop avoidance. And a command BATADV_CMD_GET_BRIDGE_LOOP_AVOIDANCE which tells the client using BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE whether it was enabled or not. A dump functionality for all options for this batadv object/class would then not exist.

Got it. That is possible to do it this way. But if you would be able to group the attrs somehow, that would be probably nice. 1:1 mapping between cmds and attrs looks a bit weird.

Sidenote: I suggest not to use NLA_FLAG attribute type. Better to use NLA_U8 of value 0/1. NLA_FLAG missing in message might mean 2 things:
1) user wants to set false
2) user is old and does not support this attribute

Quoted 3 lines

Kind regards,
Sven

author maintainer
#5 lore raw

Re: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Add infrastructure for netlink config manipulation

On Montag, 5. November 2018 11:54:12 CET Jiri Pirko wrote:
[...]

Quoted 11 lines
Quoted 10 lines

But let assume for now that you don't want to use this approach, we can also have for example something like:

BATADV_CMD_SET_BRIDGE_LOOP_AVOIDANCE which then receives either one or no flag BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE to enable/disable bridge loop avoidance. And a command BATADV_CMD_GET_BRIDGE_LOOP_AVOIDANCE which tells the client using BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE whether it was enabled or not. A dump functionality for all options for this batadv object/class would then not exist.

Quoted 8 lines

Got it. That is possible to do it this way. But if you would be able to group the attrs somehow, that would be probably nice. 1:1 mapping between cmds and attrs looks a bit weird.

Sidenote: I suggest not to use NLA_FLAG attribute type. Better to use NLA_U8 of value 0/1. NLA_FLAG missing in message might mean 2 things:
1) user wants to set false
2) user is old and does not support this attribute

Ok, let me suggest something more specific (just to make sure we talk about the same thing). We could use the commands:

+ /**
+ * @BATADV_CMD_GET_OPTION: Get option(s) from softif
+ */
+ BATADV_CMD_GET_OPTION,
+
+ /**
+ * @BATADV_CMD_SET_OPTION: Set option for softif
+ */
+ BATADV_CMD_SET_OPTION,
+
+ /**

+        * @BATADV_CMD_GET_OPTION_HARDIF: Get option(s) from a hardif of the
+        *  current softif
+        */
+       BATADV_CMD_GET_OPTION_HARDIF,
+
+       /**
+        * @BATADV_CMD_SET_OPTION_HARDIF: Set option for hardif of the
+        *  current softif
+        */
+       BATADV_CMD_SET_OPTION_HARDIF,
+
+       /**
+        * @BATADV_CMD_GET_OPTION_VLAN: Get option(s) from a VLAN of the
+        *  current softif
+        */
+       BATADV_CMD_GET_OPTION_VLAN,
+
+       /**
+        * @BATADV_CMD_SET_OPTION_VLAN: Set option for VLAN of the
+        *  current softif
+        */

+ BATADV_CMD_SET_OPTION_VLAN,
+

But instead of using BATADV_ATTR_OPTION_NAME+BATADV_ATTR_OPTION_TYPE+ BATADV_ATTR_OPTION_VALUE to send the infos up, we have a number of specific netlink attributes [e.g. BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE (u8)] that are used to exchange the value directly. Multiple attributes can be in the messages and dumping is possible but maybe requires to split all option in multiple messages. Informational dumping (user readable) is then only possible when the userspace part also knows all attributes. And sending things to the kernel is only possible when the userspace also has explicit support for the attribute.

This is at least similar to how I did it in two previous projects but dropped this approach when I saw that it was implemented differently for devlink and team.

Thanks,
Sven

#6 lore raw

Re: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Add infrastructure for netlink config manipulation

Quoted 60 lines · Mon, Nov 05, 2018 at 01:41:17PM CET, [email protected] wrote:

On Montag, 5. November 2018 11:54:12 CET Jiri Pirko wrote:
[...]

Quoted 11 lines
Quoted 10 lines

But let assume for now that you don't want to use this approach, we can also have for example something like:

BATADV_CMD_SET_BRIDGE_LOOP_AVOIDANCE which then receives either one or no flag BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE to enable/disable bridge loop avoidance. And a command BATADV_CMD_GET_BRIDGE_LOOP_AVOIDANCE which tells the client using BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE whether it was enabled or not. A dump functionality for all options for this batadv object/class would then not exist.

Quoted 8 lines

Got it. That is possible to do it this way. But if you would be able to group the attrs somehow, that would be probably nice. 1:1 mapping between cmds and attrs looks a bit weird.

Sidenote: I suggest not to use NLA_FLAG attribute type. Better to use NLA_U8 of value 0/1. NLA_FLAG missing in message might mean 2 things:
1) user wants to set false
2) user is old and does not support this attribute

Ok, let me suggest something more specific (just to make sure we talk about the same thing). We could use the commands:

include/uapi/linux/batman_adv.h +34 -0
+       /**
+        * @BATADV_CMD_GET_OPTION: Get option(s) from softif
+        */
+       BATADV_CMD_GET_OPTION,
+
+       /**
+        * @BATADV_CMD_SET_OPTION: Set option for softif
+        */
+       BATADV_CMD_SET_OPTION,
+
+       /**
+        * @BATADV_CMD_GET_OPTION_HARDIF: Get option(s) from a hardif of the
+        *  current softif
+        */
+       BATADV_CMD_GET_OPTION_HARDIF,
+
+       /**
+        * @BATADV_CMD_SET_OPTION_HARDIF: Set option for hardif of the
+        *  current softif
+        */
+       BATADV_CMD_SET_OPTION_HARDIF,
+
+       /**
+        * @BATADV_CMD_GET_OPTION_VLAN: Get option(s) from a VLAN of the
+        *  current softif
+        */
+       BATADV_CMD_GET_OPTION_VLAN,
+
+       /**
+        * @BATADV_CMD_SET_OPTION_VLAN: Set option for VLAN of the
+        *  current softif
+        */
+       BATADV_CMD_SET_OPTION_VLAN,
+
Quoted 4 lines

But instead of using BATADV_ATTR_OPTION_NAME+BATADV_ATTR_OPTION_TYPE+ BATADV_ATTR_OPTION_VALUE to send the infos up, we have a number of specific netlink attributes [e.g. BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE (u8)] that are used to exchange the value directly. Multiple attributes can be in the messages

Yes. That sounds fine.

Quoted 4 lines

and dumping is possible but maybe requires to split all option in multiple messages. Informational dumping (user readable) is then only possible when the userspace part also knows all attributes. And sending things to the kernel is only possible when the userspace also has explicit support for the attribute.

Yes.

Quoted 7 lines

This is at least similar to how I did it in two previous projects but dropped this approach when I saw that it was implemented differently for devlink and team.

Thanks,
Sven

author maintainer
#7 lore raw

RFC 2/2 batman-adv: Convert existing sysfs options to netlink

In reply to Sven Eckelmann

The current netlink options are only available via sysfs. While the new netlink interface could only be used for new options, it is easier for the userspace to have a unified interface which works for new and old options.

Most options in sysfs are already simple values and their sysfs filenames can be used as key for the new netlink configuration interface. But the multi-value files like gw_bandwidth and isolation_mark can be split to better fit in their batadv internal representation:

* isolation_mark
- isolation_mask
- isolation_mark
* gw_bandwidth
- gw_bandwidth_down
- gw_bandwidth_up

TODO add more description here.

---
 net/batman-adv/netlink_cfg.c | 1045 ++++++++++++++++++++++++++++++++++
 1 file changed, 1045 insertions(+)
net/batman-adv/netlink_cfg.c +1045 -0
index 6e4229f1..7f8a41e1 100644
@@ -19,6 +19,7 @@
 #include "netlink_cfg.h"
 #include "main.h"
 
+#include <linux/atomic.h>
 #include <linux/errno.h>
 #include <linux/genetlink.h>
 #include <linux/gfp.h>
@@ -35,17 +36,1061 @@
 #include <uapi/linux/batadv_packet.h>
 #include <uapi/linux/batman_adv.h>
 
+#include "bridge_loop_avoidance.h"
+#include "distributed-arp-table.h"
+#include "gateway_client.h"
+#include "gateway_common.h"
 #include "hard-interface.h"
+#include "log.h"
 #include "netlink.h"
 #include "soft-interface.h"
 
+/**
+ * batadv_option_get_aggregated_ogms() - Retrieve aggregated_ogms option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_aggregated_ogms(struct batadv_priv *bat_priv,
+					     void *ext_arg,
+					     union batadv_config_value *val)
+{
+	val->vbool = !!atomic_read(&bat_priv->aggregated_ogms);
+	return 0;
+}
+
+/**
+ * batadv_option_set_aggregated_ogms() - Set aggregated_ogms option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_aggregated_ogms(struct batadv_priv *bat_priv, void *ext_arg,
+				  const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->aggregated_ogms, val->vbool);
+	return 0;
+}
+
+/**
+ * batadv_option_get_ap_isolation() - Retrieve ap_isolation option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_ap_isolation(struct batadv_priv *bat_priv,
+					  void *ext_arg,
+					  union batadv_config_value *val)
+{
+	struct batadv_softif_vlan *vlan;
+
+	vlan = batadv_softif_vlan_get(bat_priv, BATADV_NO_FLAGS);
+	if (!vlan)
+		return -ENOENT;
+
+	val->vbool = !!atomic_read(&vlan->ap_isolation);
+	batadv_softif_vlan_put(vlan);
+
+	return 0;
+}
+
+/**
+ * batadv_option_set_ap_isolation() - Set ap_isolation option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_set_ap_isolation(struct batadv_priv *bat_priv,
+					  void *ext_arg,
+					  const union batadv_config_value *val)
+{
+	struct batadv_softif_vlan *vlan;
+
+	vlan = batadv_softif_vlan_get(bat_priv, BATADV_NO_FLAGS);
+	if (!vlan)
+		return -ENOENT;
+
+	atomic_set(&vlan->ap_isolation, val->vbool);
+	batadv_softif_vlan_put(vlan);
+
+	return 0;
+}
+
+/**
+ * batadv_option_get_bonding() - Retrieve bonding option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_bonding(struct batadv_priv *bat_priv,
+				     void *ext_arg,
+				     union batadv_config_value *val)
+{
+	val->vbool = !!atomic_read(&bat_priv->bonding);
+	return 0;
+}
+
+/**
+ * batadv_option_set_bonding() - Set bonding option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_set_bonding(struct batadv_priv *bat_priv,
+				     void *ext_arg,
+				     const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->bonding, val->vbool);
+	return 0;
+}
+
+#ifdef CONFIG_BATMAN_ADV_BLA
+
+/**
+ * batadv_option_get_bridge_loop_avoidance() - Retrieve bridge_loop_avoidance
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_get_bridge_loop_avoidance(struct batadv_priv *bat_priv,
+					void *ext_arg,
+					union batadv_config_value *val)
+{
+	val->vbool = !!atomic_read(&bat_priv->bridge_loop_avoidance);
+	return 0;
+}
+
+/**
+ * batadv_option_set_bridge_loop_avoidance() - Set bridge_loop_avoidance option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_bridge_loop_avoidance(struct batadv_priv *bat_priv,
+					void *ext_arg,
+					const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->bridge_loop_avoidance, val->vbool);
+	batadv_bla_status_update(bat_priv->soft_iface);
+	return 0;
+}
+
+#endif /* CONFIG_BATMAN_ADV_BLA */
+
+#ifdef CONFIG_BATMAN_ADV_DAT
+
+/**
+ * batadv_option_get_distributed_arp_table() - Retrieve distributed_arp_table
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_get_distributed_arp_table(struct batadv_priv *bat_priv,
+					void *ext_arg,
+					union batadv_config_value *val)
+{
+	val->vbool = !!atomic_read(&bat_priv->distributed_arp_table);
+	return 0;
+}
+
+/**
+ * batadv_option_set_distributed_arp_table() - Set distributed_arp_table option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_distributed_arp_table(struct batadv_priv *bat_priv,
+					void *ext_arg,
+					const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->distributed_arp_table, val->vbool);
+	batadv_dat_status_update(bat_priv->soft_iface);
+	return 0;
+}
+
+#endif /* CONFIG_BATMAN_ADV_DAT */
+
+/**
+ * batadv_option_get_fragmentation() - Retrieve fragmentation
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_fragmentation(struct batadv_priv *bat_priv,
+					   void *ext_arg,
+					   union batadv_config_value *val)
+{
+	val->vbool = !!atomic_read(&bat_priv->fragmentation);
+	return 0;
+}
+
+/**
+ * batadv_option_set_fragmentation() - Set fragmentation option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_set_fragmentation(struct batadv_priv *bat_priv,
+					   void *ext_arg,
+					   const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->fragmentation, val->vbool);
+	batadv_update_min_mtu(bat_priv->soft_iface);
+	return 0;
+}
+
+/**
+ * batadv_option_get_gw_bandwidth_down() - Retrieve gw_bandwidth_down
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_gw_bandwidth_down(struct batadv_priv *bat_priv,
+					       void *ext_arg,
+					       union batadv_config_value *val)
+{
+	val->vu32 = atomic_read(&bat_priv->gw.bandwidth_down);
+	return 0;
+}
+
+/**
+ * batadv_option_set_gw_bandwidth_down() - Set gw_bandwidth_down option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_gw_bandwidth_down(struct batadv_priv *bat_priv, void *ext_arg,
+				    const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->gw.bandwidth_down, val->vu32);
+	batadv_gw_tvlv_container_update(bat_priv);
+	return 0;
+}
+
+/**
+ * batadv_option_get_gw_bandwidth_up() - Retrieve gw_bandwidth_up
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_gw_bandwidth_up(struct batadv_priv *bat_priv,
+					     void *ext_arg,
+					     union batadv_config_value *val)
+{
+	val->vu32 = atomic_read(&bat_priv->gw.bandwidth_up);
+	return 0;
+}
+
+/**
+ * batadv_option_set_gw_bandwidth_up() - Set gw_bandwidth_up option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_gw_bandwidth_up(struct batadv_priv *bat_priv, void *ext_arg,
+				  const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->gw.bandwidth_up, val->vu32);
+	batadv_gw_tvlv_container_update(bat_priv);
+	return 0;
+}
+
+/**
+ * batadv_option_get_gw_mode() - Retrieve gw_mode
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save string
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_gw_mode(struct batadv_priv *bat_priv,
+				     void *ext_arg,
+				     union batadv_config_value *val)
+{
+	/* GW mode is not available if the routing algorithm in use does not
+	 * implement the GW API
+	 */
+	if (!bat_priv->algo_ops->gw.get_best_gw_node ||
+	    !bat_priv->algo_ops->gw.is_eligible)
+		return -EOPNOTSUPP;
+
+	switch (atomic_read(&bat_priv->gw.mode)) {
+	case BATADV_GW_MODE_CLIENT:
+		strlcpy(val->string, BATADV_GW_MODE_CLIENT_NAME,
+			sizeof(val->string));
+		break;
+	case BATADV_GW_MODE_SERVER:
+		strlcpy(val->string, BATADV_GW_MODE_SERVER_NAME,
+			sizeof(val->string));
+		break;
+	default:
+		strlcpy(val->string, BATADV_GW_MODE_OFF_NAME,
+			sizeof(val->string));
+		break;
+	}
+
+	return 0;
+}
+
+/**
+ * batadv_option_set_gw_mode() - Set gw_mode option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: string value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_set_gw_mode(struct batadv_priv *bat_priv,
+				     void *ext_arg,
+				     const union batadv_config_value *val)
+{
+	int gw_mode_tmp = BATADV_GW_MODE_OFF;
+
+	if (strcmp(val->string, BATADV_GW_MODE_OFF_NAME) == 0)
+		gw_mode_tmp = BATADV_GW_MODE_OFF;
+
+	if (strcmp(val->string, BATADV_GW_MODE_CLIENT_NAME) == 0)
+		gw_mode_tmp = BATADV_GW_MODE_CLIENT;
+
+	if (strcmp(val->string, BATADV_GW_MODE_SERVER_NAME) == 0)
+		gw_mode_tmp = BATADV_GW_MODE_SERVER;
+
+	/* Invoking batadv_gw_reselect() is not enough to really de-select the
+	 * current GW. It will only instruct the gateway client code to perform
+	 * a re-election the next time that this is needed.
+	 *
+	 * When gw client mode is being switched off the current GW must be
+	 * de-selected explicitly otherwise no GW_ADD uevent is thrown on
+	 * client mode re-activation. This is operation is performed in
+	 * batadv_gw_check_client_stop().
+	 */
+	batadv_gw_reselect(bat_priv);
+	/* always call batadv_gw_check_client_stop() before changing the gateway
+	 * state
+	 */
+	batadv_gw_check_client_stop(bat_priv);
+	atomic_set(&bat_priv->gw.mode, (unsigned int)gw_mode_tmp);
+	batadv_gw_tvlv_container_update(bat_priv);
+
+	return 0;
+}
+
+/**
+ * batadv_option_validate_gw_mode() - Validate gw_mode option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: string value of option to validate
+ * @extack: additional information about error
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_validate_gw_mode(struct batadv_priv *bat_priv,
+					  void *ext_arg,
+					  const union batadv_config_value *val,
+					  struct netlink_ext_ack *extack)
+{
+	const char *str = val->string;
+
+	if (strcmp(BATADV_GW_MODE_OFF_NAME, str) == 0)
+		return 0;
+
+	if (strcmp(BATADV_GW_MODE_CLIENT_NAME, str) == 0)
+		return 0;
+
+	if (strcmp(BATADV_GW_MODE_SERVER_NAME, str) == 0)
+		return 0;
+
+	return -EINVAL;
+}
+
+/**
+ * batadv_option_get_gw_sel_class() - Retrieve gw_sel_class
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_gw_sel_class(struct batadv_priv *bat_priv,
+					  void *ext_arg,
+					  union batadv_config_value *val)
+{
+	/* GW selection class is not available if the routing algorithm in use
+	 * does not implement the GW API
+	 */
+	if (!bat_priv->algo_ops->gw.get_best_gw_node ||
+	    !bat_priv->algo_ops->gw.is_eligible)
+		return -EOPNOTSUPP;
+
+	val->vu32 = atomic_read(&bat_priv->gw.sel_class);
+
+	return 0;
+}
+
+/**
+ * batadv_option_set_gw_sel_class() - Set gw_sel_class option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_set_gw_sel_class(struct batadv_priv *bat_priv,
+					  void *ext_arg,
+					  const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->gw.sel_class, val->vu32);
+	batadv_gw_reselect(bat_priv);
+	return 0;
+}
+
+/**
+ * batadv_option_validate_gw_sel_class() - Validate gw_sel_class option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to validate
+ * @extack: additional information about error
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_validate_gw_sel_class(struct batadv_priv *bat_priv, void *ext_arg,
+				    const union batadv_config_value *val,
+				    struct netlink_ext_ack *extack)
+{
+	u32 value = val->vu32;
+
+	/* setting the GW selection class is allowed only if the routing
+	 * algorithm in use implements the GW API
+	 */
+	if (!bat_priv->algo_ops->gw.get_best_gw_node ||
+	    !bat_priv->algo_ops->gw.is_eligible)
+		return -EOPNOTSUPP;
+
+	if (!bat_priv->algo_ops->gw.store_sel_class) {
+		if (value < 1 || value > BATADV_TQ_MAX_VALUE)
+			return -ERANGE;
+	}
+
+	return 0;
+}
+
+/**
+ * batadv_option_get_hop_penalty() - Retrieve hop_penalty
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_hop_penalty(struct batadv_priv *bat_priv,
+					 void *ext_arg,
+					 union batadv_config_value *val)
+{
+	val->vu32 = atomic_read(&bat_priv->hop_penalty);
+	return 0;
+}
+
+/**
+ * batadv_option_set_hop_penalty() - Set hop_penalty option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_set_hop_penalty(struct batadv_priv *bat_priv,
+					 void *ext_arg,
+					 const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->hop_penalty, val->vu32);
+	return 0;
+}
+
+/**
+ * batadv_option_validate_hop_penalty() - Validate hop_penalty option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to validate
+ * @extack: additional information about error
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_validate_hop_penalty(struct batadv_priv *bat_priv, void *ext_arg,
+				   const union batadv_config_value *val,
+				   struct netlink_ext_ack *extack)
+{
+	u32 value = val->vu32;
+
+	if (value > BATADV_TQ_MAX_VALUE)
+		return -ERANGE;
+
+	return 0;
+}
+
+#ifdef CONFIG_BATMAN_ADV_DEBUG
+
+/**
+ * batadv_option_get_log_level() - Retrieve log_level
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_log_level(struct batadv_priv *bat_priv,
+				       void *ext_arg,
+				       union batadv_config_value *val)
+{
+	val->vu32 = atomic_read(&bat_priv->log_level);
+	return 0;
+}
+
+/**
+ * batadv_option_set_log_level() - Set log_level option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_set_log_level(struct batadv_priv *bat_priv,
+				       void *ext_arg,
+				       const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->log_level, val->vu32);
+	return 0;
+}
+
+/**
+ * batadv_option_validate_log_level() - Validate log_level option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to validate
+ * @extack: additional information about error
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_validate_log_level(struct batadv_priv *bat_priv, void *ext_arg,
+				 const union batadv_config_value *val,
+				 struct netlink_ext_ack *extack)
+{
+	u32 value = val->vu32;
+
+	if (value > BATADV_DBG_ALL)
+		return -ERANGE;
+	return 0;
+}
+
+#endif /* CONFIG_BATMAN_ADV_DEBUG */
+
+#ifdef CONFIG_BATMAN_ADV_MCAST
+
+/**
+ * batadv_option_get_multicast_mode() - Retrieve multicast_mode option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_multicast_mode(struct batadv_priv *bat_priv,
+					    void *ext_arg,
+					    union batadv_config_value *val)
+{
+	val->vbool = !!atomic_read(&bat_priv->multicast_mode);
+	return 0;
+}
+
+/**
+ * batadv_option_set_multicast_mode() - Set multicast_mode option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_multicast_mode(struct batadv_priv *bat_priv, void *ext_arg,
+				 const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->multicast_mode, val->vbool);
+	return 0;
+}
+
+#endif /* CONFIG_BATMAN_ADV_MCAST */
+
+#ifdef CONFIG_BATMAN_ADV_NC
+
+/**
+ * batadv_option_get_network_coding() - Retrieve network_coding option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_network_coding(struct batadv_priv *bat_priv,
+					    void *ext_arg,
+					    union batadv_config_value *val)
+{
+	val->vbool = !!atomic_read(&bat_priv->network_coding);
+	return 0;
+}
+
+/**
+ * batadv_option_set_network_coding() - Set network_coding option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_network_coding(struct batadv_priv *bat_priv, void *ext_arg,
+				 const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->network_coding, val->vbool);
+	batadv_nc_status_update(bat_priv->soft_iface);
+	return 0;
+}
+
+#endif /* CONFIG_BATMAN_ADV_NC */
+
+/**
+ * batadv_option_get_isolation_mark() - Retrieve isolation_mark
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_isolation_mark(struct batadv_priv *bat_priv,
+					    void *ext_arg,
+					    union batadv_config_value *val)
+{
+	val->vu32 = bat_priv->isolation_mark;
+	return 0;
+}
+
+/**
+ * batadv_option_set_isolation_mark() - Set isolation_mark option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_isolation_mark(struct batadv_priv *bat_priv, void *ext_arg,
+				 const union batadv_config_value *val)
+{
+	bat_priv->isolation_mark = val->vu32;
+	return 0;
+}
+
+/**
+ * batadv_option_get_isolation_mask() - Retrieve isolation_mask
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_isolation_mask(struct batadv_priv *bat_priv,
+					    void *ext_arg,
+					    union batadv_config_value *val)
+{
+	val->vu32 = bat_priv->isolation_mark_mask;
+	return 0;
+}
+
+/**
+ * batadv_option_set_isolation_mask() - Set isolation_mask option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_set_isolation_mask(struct batadv_priv *bat_priv, void *ext_arg,
+				 const union batadv_config_value *val)
+{
+	bat_priv->isolation_mark_mask = val->vu32;
+	return 0;
+}
+
+/**
+ * batadv_option_get_orig_interval() - Retrieve orig_interval
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_get_orig_interval(struct batadv_priv *bat_priv,
+					   void *ext_arg,
+					   union batadv_config_value *val)
+{
+	val->vu32 = atomic_read(&bat_priv->orig_interval);
+	return 0;
+}
+
+/**
+ * batadv_option_set_orig_interval() - Set orig_interval option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_set_orig_interval(struct batadv_priv *bat_priv,
+					   void *ext_arg,
+					   const union batadv_config_value *val)
+{
+	atomic_set(&bat_priv->orig_interval, val->vu32);
+	return 0;
+}
+
+/**
+ * batadv_option_validate_orig_interval() - Validate orig_interval option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: Additional option element (unused)
+ * @val: u32 value of option to validate
+ * @extack: additional information about error
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_validate_orig_interval(struct batadv_priv *bat_priv,
+				     void *ext_arg,
+				     const union batadv_config_value *val,
+				     struct netlink_ext_ack *extack)
+{
+	u32 value = val->vu32;
+
+	if (value < 2 * BATADV_JITTER || value > INT_MAX)
+		return -ERANGE;
+
+	return 0;
+}
+
 static const struct batadv_option softif_options[] = {
+	{
+		.name = "aggregated_ogms",
+		.type = NLA_FLAG,
+		.get = batadv_option_get_aggregated_ogms,
+		.set = batadv_option_set_aggregated_ogms,
+	},
+	{
+		.name = "ap_isolation",
+		.type = NLA_FLAG,
+		.get = batadv_option_get_ap_isolation,
+		.set = batadv_option_set_ap_isolation,
+	},
+	{
+		.name = "bonding",
+		.type = NLA_FLAG,
+		.get = batadv_option_get_bonding,
+		.set = batadv_option_set_bonding,
+	},
+#ifdef CONFIG_BATMAN_ADV_BLA
+	{
+		.name = "bridge_loop_avoidance",
+		.type = NLA_FLAG,
+		.get = batadv_option_get_bridge_loop_avoidance,
+		.set = batadv_option_set_bridge_loop_avoidance,
+	},
+#endif /* CONFIG_BATMAN_ADV_BLA */
+#ifdef CONFIG_BATMAN_ADV_DAT
+	{
+		.name = "distributed_arp_table",
+		.type = NLA_FLAG,
+		.get = batadv_option_get_distributed_arp_table,
+		.set = batadv_option_set_distributed_arp_table,
+	},
+#endif /* CONFIG_BATMAN_ADV_DAT */
+	{
+		.name = "fragmentation",
+		.type = NLA_FLAG,
+		.get = batadv_option_get_fragmentation,
+		.set = batadv_option_set_fragmentation,
+	},
+	{
+		.name = "gw_bandwidth_down",
+		.type = NLA_U32,
+		.get = batadv_option_get_gw_bandwidth_down,
+		.set = batadv_option_set_gw_bandwidth_down,
+	},
+	{
+		.name = "gw_bandwidth_up",
+		.type = NLA_U32,
+		.get = batadv_option_get_gw_bandwidth_up,
+		.set = batadv_option_set_gw_bandwidth_up,
+	},
+	{
+		.name = "gw_mode",
+		.type = NLA_NUL_STRING,
+		.get = batadv_option_get_gw_mode,
+		.set = batadv_option_set_gw_mode,
+		.validate = batadv_option_validate_gw_mode,
+	},
+	{
+		.name = "gw_sel_class",
+		.type = NLA_U32,
+		.get = batadv_option_get_gw_sel_class,
+		.set = batadv_option_set_gw_sel_class,
+		.validate = batadv_option_validate_gw_sel_class,
+	},
+	{
+		.name = "hop_penalty",
+		.type = NLA_U32,
+		.get = batadv_option_get_hop_penalty,
+		.set = batadv_option_set_hop_penalty,
+		.validate = batadv_option_validate_hop_penalty,
+	},
+#ifdef CONFIG_BATMAN_ADV_DEBUG
+	{
+		.name = "log_level",
+		.type = NLA_U32,
+		.get = batadv_option_get_log_level,
+		.set = batadv_option_set_log_level,
+		.validate = batadv_option_validate_log_level,
+	},
+#endif /* CONFIG_BATMAN_ADV_DEBUG */
+#ifdef CONFIG_BATMAN_ADV_MCAST
+	{
+		.name = "multicast_mode",
+		.type = NLA_FLAG,
+		.get = batadv_option_get_multicast_mode,
+		.set = batadv_option_set_multicast_mode,
+	},
+#endif /* CONFIG_BATMAN_ADV_MCAST */
+#ifdef CONFIG_BATMAN_ADV_NC
+	{
+		.name = "network_coding",
+		.type = NLA_FLAG,
+		.get = batadv_option_get_network_coding,
+		.set = batadv_option_set_network_coding,
+	},
+#endif /* CONFIG_BATMAN_ADV_NC */
+	{
+		.name = "isolation_mark",
+		.type = NLA_U32,
+		.get = batadv_option_get_isolation_mark,
+		.set = batadv_option_set_isolation_mark,
+	},
+	{
+		.name = "isolation_mask",
+		.type = NLA_U32,
+		.get = batadv_option_get_isolation_mask,
+		.set = batadv_option_set_isolation_mask,
+	},
+	{
+		.name = "orig_interval",
+		.type = NLA_U32,
+		.get = batadv_option_get_orig_interval,
+		.set = batadv_option_set_orig_interval,
+		.validate = batadv_option_validate_orig_interval,
+	},
 };
 
+#ifdef CONFIG_BATMAN_ADV_BATMAN_V
+
+/**
+ * batadv_option_get_elp_interval() - Retrieve elp_interval
+ *  option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: hard interface object with option
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_hardif_get_elp_interval(struct batadv_priv *bat_priv,
+						 void *ext_arg,
+						 union batadv_config_value *val)
+{
+	struct batadv_hard_iface *hard_iface = ext_arg;
+
+	val->vu32 = atomic_read(&hard_iface->bat_v.elp_interval);
+	return 0;
+}
+
+/**
+ * batadv_option_set_elp_interval() - Set elp_interval option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: hard interface object to modify
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_hardif_set_elp_interval(struct batadv_priv *bat_priv,
+				      void *ext_arg,
+				      const union batadv_config_value *val)
+{
+	struct batadv_hard_iface *hard_iface = ext_arg;
+
+	atomic_set(&hard_iface->bat_v.elp_interval, val->vu32);
+	return 0;
+}
+
+/**
+ * batadv_option_hardif_get_tp_override() - Retrieve throughput_override option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: hard interface object with option
+ * @val: Target to save u32
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_hardif_get_tp_override(struct batadv_priv *bat_priv,
+						void *ext_arg,
+						union batadv_config_value *val)
+{
+	struct batadv_hard_iface *hard_iface = ext_arg;
+
+	val->vu32 = atomic_read(&hard_iface->bat_v.throughput_override);
+	return 0;
+}
+
+/**
+ * batadv_option_hardif_set_tp_override() - Set throughput_override option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: hard interface object to modify
+ * @val: u32 value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_hardif_set_tp_override(struct batadv_priv *bat_priv,
+				     void *ext_arg,
+				     const union batadv_config_value *val)
+{
+	struct batadv_hard_iface *hard_iface = ext_arg;
+
+	atomic_set(&hard_iface->bat_v.throughput_override, val->vu32);
+	return 0;
+}
+
+#endif /* CONFIG_BATMAN_ADV_BATMAN_V */
+
 static const struct batadv_option hardif_options[] = {
+#ifdef CONFIG_BATMAN_ADV_BATMAN_V
+	{
+		.name = "elp_interval",
+		.type = NLA_U32,
+		.get = batadv_option_hardif_get_elp_interval,
+		.set = batadv_option_hardif_set_elp_interval,
+	},
+	{
+		.name = "throughput_override",
+		.type = NLA_U32,
+		.get = batadv_option_hardif_get_tp_override,
+		.set = batadv_option_hardif_set_tp_override,
+	},
+#endif /* CONFIG_BATMAN_ADV_BATMAN_V */
 };
 
+/**
+ * batadv_option_get_ap_isolation() - Retrieve ap_isolation option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: vlan to modify
+ * @val: Target to save boolean
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int batadv_option_vlan_get_ap_isolation(struct batadv_priv *bat_priv,
+					       void *ext_arg,
+					       union batadv_config_value *val)
+{
+	struct batadv_softif_vlan *vlan = ext_arg;
+
+	val->vbool = !!atomic_read(&vlan->ap_isolation);
+
+	return 0;
+}
+
+/**
+ * batadv_option_set_ap_isolation() - Set ap_isolation option
+ * @bat_priv: the bat priv with all the soft interface information
+ * @ext_arg: vlan to modify
+ * @val: Boolean value of option to set
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+static int
+batadv_option_vlan_set_ap_isolation(struct batadv_priv *bat_priv,
+				    void *ext_arg,
+				    const union batadv_config_value *val)
+{
+	struct batadv_softif_vlan *vlan = ext_arg;
+
+	atomic_set(&vlan->ap_isolation, val->vbool);
+
+	return 0;
+}
+
 static const struct batadv_option vlan_options[] = {
+	{
+		.name = "ap_isolation",
+		.type = NLA_FLAG,
+		.get = batadv_option_vlan_get_ap_isolation,
+		.set = batadv_option_vlan_set_ap_isolation,
+	},
 };
 
 /**
Signature · 1 line
2.19.1