lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230816082030.5c716f37@kernel.org>
Date: Wed, 16 Aug 2023 08:20:30 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Donald Hunter <donald.hunter@...il.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Jonathan
 Corbet <corbet@....net>, linux-doc@...r.kernel.org, Stanislav Fomichev
 <sdf@...gle.com>, Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>,
 donald.hunter@...hat.com
Subject: Re: [PATCH net-next v2 05/10] tools/net/ynl: Refactor
 decode_fixed_header into NlMsg

On Tue, 15 Aug 2023 20:42:49 +0100 Donald Hunter wrote:
> +    def __init__(self, nl_msg, ynl=None):
> +        self.genl_cmd, self.genl_version, _ = struct.unpack_from("BBH", nl_msg.raw, 0)
> +        nl_msg.raw = nl_msg.raw[4:]

It's a bit of a layering violation that we are futzing with the raw
member of NlMsg inside GenlMsg, no?

Should we add "fixed hdrs len" argument to NlMsg? Either directly or
pass ynl and let get the expected len from ynl? That way NlMsg can
split itself into hdr, userhdrs and attrs without GenlMsg "fixing it
up"?

> -        self.hdr = nl_msg.raw[0:4]
> -        offset = 4
> -
> -        self.genl_cmd, self.genl_version, _ = struct.unpack("BBH", self.hdr)
> -
> -        self.fixed_header_attrs = dict()
> -        for m in fixed_header_members:
> -            format = NlAttr.get_format(m.type, m.byte_order)
> -            decoded = format.unpack_from(nl_msg.raw, offset)
> -            offset += format.size
> -            self.fixed_header_attrs[m.name] = decoded[0]
> +        if ynl:
> +            op = ynl.rsp_by_value[self.genl_cmd]
> +            if op.fixed_header:
> +                nl_msg.decode_fixed_header(ynl, op.fixed_header)
>  
> -        self.raw = nl_msg.raw[offset:]
> +        self.raw = nl_msg.raw

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ