b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@mellanox.com>
To: Sven Eckelmann <sven@narfation.org>
Cc: "b.a.t.m.a.n@lists.open-mesh.org" <b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Add infrastructure for netlink config manipulation
Date: Mon, 5 Nov 2018 11:54:12 +0000	[thread overview]
Message-ID: <20181105114754.GE2095@nanopsycho> (raw)
In-Reply-To: <39526497.qhSXs3GhTV@bentobox>

Mon, Nov 05, 2018 at 12:33:25PM CET, sven@narfation.org wrote:
>On Montag, 5. November 2018 11:17:08 CET Jiri Pirko wrote:
>> Sun, Nov 04, 2018 at 08:33:13PM CET, sven@narfation.org 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.
>
>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).


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



>
>Kind regards,
>	Sven



  reply	other threads:[~2018-11-05 11:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-04 19:33 [B.A.T.M.A.N.] [RFC 0/2] batman-adv: netlink restructuring, part 2 Sven Eckelmann
2018-11-04 19:33 ` [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Add infrastructure for netlink config manipulation Sven Eckelmann
2018-11-05 11:17   ` Jiri Pirko
2018-11-05 11:33     ` Sven Eckelmann
2018-11-05 11:54       ` Jiri Pirko [this message]
2018-11-05 12:41         ` Sven Eckelmann
2018-11-05 14:00           ` Jiri Pirko
2018-11-04 19:33 ` [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Convert existing sysfs options to netlink Sven Eckelmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181105114754.GE2095@nanopsycho \
    --to=jiri@mellanox.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sven@narfation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).