Subject: Re: [Patch net-next] tcp_metrics: rearrange fields to avoid holes

From: Cong Wang <[email-masked]>
Date: Thu, 01 Aug 2013 16:13:42 +0800

On Thu, 2013-08-01 at 00:15 -0700, David Miller wrote:
> From: Cong Wang <[email-masked]>
> Date: Thu, 01 Aug 2013 10:48:31 +0800
> 
> > Please teach me how to do that?
> 
> struct inet_addr {
> 	union {
> 		u32	v4;
> 		u32	v6[4];
> 	};
> };
> 
> ie. exactly what that code is using already.
> 
> And it's called called inetpeer_addr, we have it already, there is no
> need to make something new.
> 
> Making this code use a structure with completely unnecessary and
> unused members is pointless and a step backwards.

Ah, I was thinking to keep it compatible with sockaddr*, actually this
is indeed unnecessary. I am going to define something like:

struct inet_addr_base {
        union {
                struct in_addr  sin_addr;
                struct in6_addr sin6_addr;
        };
        unsigned short int      sin_family;
};

which could used by bridge multicast code too.

Thanks for the hint.