Re: [PATCH net-next] net: ptp: get rid of IPV4_HLEN() and OFF_IHL macros
From: Richard Cochran
Date: Wed Oct 14 2020 - 23:36:55 EST
On Wed, Oct 14, 2020 at 01:58:05PM +0200, Christian Eggers wrote:
> Both macros are already marked for removal.
I'm not sure what Daniel Borkmann meant by that comment, but ...
> switch (type & PTP_CLASS_PMASK) {
> case PTP_CLASS_IPV4:
> - ptr += IPV4_HLEN(ptr) + UDP_HLEN;
> + ptr += (((struct iphdr *)ptr)->ihl << 2) + UDP_HLEN;
to my eyes
IPV4_HLEN(ptr)
is way more readable than
(((struct iphdr *)ptr)->ihl << 2)
and this
(struct udphdr *)((char *)ih + (ih->ihl << 2))
is really baroque.
I don't see any improvement here.
Thanks,
Richard