Message ID | 20230515082356.3471136-5-roid@nvidia.com |
---|---|
State | Changes Requested |
Delegated to: | Simon Horman |
Headers | show |
Series | Add vxlan gbp offload with TC | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | fail | test: fail |
On Mon, May 15, 2023 at 11:23:53AM +0300, Roi Dayan via dev wrote: > From: Gavin Li <gavinl@nvidia.com> > > Linux kernel netlink module added NLA_F_NESTED flag checking for nested > netlink messages in 5.2. A nested message without the flag set will be > treated as malformated one. The check is optional and is controlled by > message policy. To avoid this, add NLA_F_NESTED explicitly for all > nested netlink messages with a new function > nl_msg_start_nested_with_flag(). > > Signed-off-by: Gavin Li <gavinl@nvidia.com> > Reviewed-by: Roi Dayan <roid@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com>
On 15 May 2023, at 10:23, Roi Dayan wrote: > From: Gavin Li <gavinl@nvidia.com> > > Linux kernel netlink module added NLA_F_NESTED flag checking for nested > netlink messages in 5.2. A nested message without the flag set will be > treated as malformated one. The check is optional and is controlled by > message policy. To avoid this, add NLA_F_NESTED explicitly for all > nested netlink messages with a new function > nl_msg_start_nested_with_flag(). > > Signed-off-by: Gavin Li <gavinl@nvidia.com> > Reviewed-by: Roi Dayan <roid@nvidia.com> The changes look good to me. Acked-by: Eelco Chaudron <echaudro@redhat.com>
diff --git a/lib/netlink.c b/lib/netlink.c index 6215282d6fbe..1e8d5a8ec57d 100644 --- a/lib/netlink.c +++ b/lib/netlink.c @@ -523,6 +523,15 @@ nl_msg_start_nested(struct ofpbuf *msg, uint16_t type) return offset; } +/* Adds the header for nested Netlink attributes to 'msg', with the specified + * 'type', and returns the header's offset within 'msg'. It's similar to + * nl_msg_start_nested() and uses NLA_F_NESTED flag mandatorily. */ +size_t +nl_msg_start_nested_with_flag(struct ofpbuf *msg, uint16_t type) +{ + return nl_msg_start_nested(msg, type | NLA_F_NESTED); +} + /* Finalizes a nested Netlink attribute in 'msg'. 'offset' should be the value * returned by nl_msg_start_nested(). */ void diff --git a/lib/netlink.h b/lib/netlink.h index e9050c31bacd..008604aa60d1 100644 --- a/lib/netlink.h +++ b/lib/netlink.h @@ -81,6 +81,7 @@ void nl_msg_put_string__(struct ofpbuf *, uint16_t type, const char *value, void nl_msg_put_string(struct ofpbuf *, uint16_t type, const char *value); size_t nl_msg_start_nested(struct ofpbuf *, uint16_t type); +size_t nl_msg_start_nested_with_flag(struct ofpbuf *, uint16_t type); void nl_msg_end_nested(struct ofpbuf *, size_t offset); void nl_msg_cancel_nested(struct ofpbuf *, size_t offset); bool nl_msg_end_non_empty_nested(struct ofpbuf *, size_t offset);