RE: [PATCH libmnl] libmnl: add support for signed types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Jan Engelhardt <jengelh@xxxxxxx>
> Sent: Thursday, August 04, 2022 4:36 PM
> To: Keller, Jacob E <jacob.e.keller@xxxxxxxxx>
> Cc: Netfilter Devel <netfilter-devel@xxxxxxxxxxxxxxx>; Duncan Roe
> <duncan_roe@xxxxxxxxxxxxxxx>; Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
> Subject: Re: [PATCH libmnl] libmnl: add support for signed types
> 
> 
> >+ * mnl_attr_get_s8 - returns 8-bit signed integer attribute payload
> >+ *
> >+ * This function returns the 8-bit value of the attribute payload.
> >+ */
> 
> That's kinda redundant - it's logically the same thing, just written
> ever-so-slightly differently.
> 

I guess I can fix the unsigned wording as well then. This is just a copy of that but converted to signed.

> 
> >+/**
> >+ * mnl_attr_get_s64 - returns 64-bit signed integer attribute.
> >    This
> >+ * function is align-safe, since accessing 64-bit Netlink attributes is a
> >+ * common source of alignment issues.
> 
> That sentence is self-defeating. If NLA access is a commn source of
> alignment issues, then, by transitivity, this function too would
> be potentially affected. Just
> 

This is specifically calling out the use of memcpy rather than just dereferencing the pointer address. The default NLA alignment is only 4bytes, not 8 bytes. This is exactly the same as the unsigned implementation, just copied to implement support for signed types.

Thanks,
Jake

>   "This function reads the 64-bit nlattr in an alignment-safe manner."
> 





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux