From: Donald Hunter <donald.hunter@gmail.com>
To: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Cc: donald.hunter@redhat.com, Donald Hunter <donald.hunter@gmail.com>
Subject: [PATCH net-next v1 2/4] tools: ynl: Initialise fixed headers to 0 in genetlink-legacy
Date: Fri, 26 May 2023 13:32:21 +0100 [thread overview]
Message-ID: <20230526123223.35755-3-donald.hunter@gmail.com> (raw)
In-Reply-To: <20230526123223.35755-1-donald.hunter@gmail.com>
This eliminates the need for e.g. --json '{"dp-ifindex":0}' which is not
too big a deal for ovs but will get tiresome for fixed header structs that
have many members.
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
---
tools/net/ynl/lib/ynl.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index 7c7a54d6841c..4e0811ec5a8d 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -541,7 +541,7 @@ class YnlFamily(SpecFamily):
if op.fixed_header:
fixed_header_members = self.consts[op.fixed_header].members
for m in fixed_header_members:
- value = vals.pop(m.name)
+ value = vals.pop(m.name) if m.name in vals else 0
format = NlAttr.get_format(m.type, m.byte_order)
msg += format.pack(value)
for name, value in vals.items():
--
2.40.0
next prev parent reply other threads:[~2023-05-26 12:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 12:32 [PATCH net-next v1 0/4] netlink: specs: add ynl spec for ovs_flow Donald Hunter
2023-05-26 12:32 ` [PATCH net-next v1 1/4] doc: ynl: Add doc attr to struct members in genetlink-legacy spec Donald Hunter
2023-05-26 12:32 ` Donald Hunter [this message]
2023-05-26 12:32 ` [PATCH net-next v1 3/4] tools: ynl: Support enums in struct members in genetlink-legacy Donald Hunter
2023-05-26 12:32 ` [PATCH net-next v1 4/4] netlink: specs: add ynl spec for ovs_flow Donald Hunter
2023-05-26 23:46 ` Jakub Kicinski
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=20230526123223.35755-3-donald.hunter@gmail.com \
--to=donald.hunter@gmail.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@redhat.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.