Subject: Re: [PATCH net-next] net: ptp: get rid of IPV4_HLEN() and OFF_IHL macros

From: Richard Cochran <[email-masked]>
Date: Wed, 14 Oct 2020 20:36:48 -0700

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