Jeremie Courreges-Anglas <[email protected]> writes:

> Using a mix of 32 and 64 bits counters leads to an ugly conversion to
> percpu counters.  Why not move to 64 bits counters?  struct ipipstat is
> afaik only used by netstat and ports/shells/nsh (I can cook a fix for
> the latter).
>
> ok?

ping

> Index: sys/netinet/ip_ipip.h
> ===================================================================
> RCS file: /d/cvs/src/sys/netinet/ip_ipip.h,v
> retrieving revision 1.6
> diff -u -p -r1.6 ip_ipip.h
> --- sys/netinet/ip_ipip.h     14 Dec 2007 18:33:41 -0000      1.6
> +++ sys/netinet/ip_ipip.h     10 Feb 2017 15:48:13 -0000
> @@ -43,18 +43,17 @@
>   * Not quite all the functionality of RFC-1853, but the main idea is there.
>   */
>  
> -struct ipipstat
> -{
> -    u_int32_t        ipips_ipackets;         /* total input packets */
> -    u_int32_t        ipips_opackets;         /* total output packets */
> -    u_int32_t        ipips_hdrops;           /* packet shorter than header 
> shows */
> -    u_int32_t        ipips_qfull;
> -    u_int64_t   ipips_ibytes;
> -    u_int64_t   ipips_obytes;
> -    u_int32_t        ipips_pdrops;           /* packet dropped due to policy 
> */
> -    u_int32_t        ipips_spoof;            /* IP spoofing attempts */
> -    u_int32_t   ipips_family;                /* Protocol family mismatch */
> -    u_int32_t   ipips_unspec;            /* Missing tunnel endpoint address 
> */
> +struct ipipstat {
> +    u_int64_t        ipips_ipackets;         /* total input packets */
> +    u_int64_t        ipips_opackets;         /* total output packets */
> +    u_int64_t        ipips_hdrops;           /* packet shorter than header 
> shows */
> +    u_int64_t        ipips_qfull;
> +    u_int64_t        ipips_ibytes;
> +    u_int64_t        ipips_obytes;
> +    u_int64_t        ipips_pdrops;           /* packet dropped due to policy 
> */
> +    u_int64_t        ipips_spoof;            /* IP spoofing attempts */
> +    u_int64_t        ipips_family;           /* Protocol family mismatch */
> +    u_int64_t        ipips_unspec;            /* Missing tunnel endpoint 
> address */
>  };
>  
>  #define IP4_DEFAULT_TTL    0
> Index: usr.bin/netstat/inet.c
> ===================================================================
> RCS file: /d/cvs/src/usr.bin/netstat/inet.c,v
> retrieving revision 1.154
> diff -u -p -r1.154 inet.c
> --- usr.bin/netstat/inet.c    7 Feb 2017 18:18:16 -0000       1.154
> +++ usr.bin/netstat/inet.c    10 Feb 2017 15:39:13 -0000
> @@ -1065,16 +1065,16 @@ ipip_stats(char *name)
>  #define p(f, m) if (ipipstat.f || sflag <= 1) \
>       printf(m, ipipstat.f, plural(ipipstat.f))
>  
> -     p(ipips_ipackets, "\t%u total input packet%s\n");
> -     p(ipips_opackets, "\t%u total output packet%s\n");
> -     p(ipips_hdrops, "\t%u packet%s shorter than header shows\n");
> -     p(ipips_pdrops, "\t%u packet%s dropped due to policy\n");
> -     p(ipips_spoof, "\t%u packet%s with possibly spoofed local addresses\n");
> -     p(ipips_qfull, "\t%u packet%s were dropped due to full output queue\n");
> +     p(ipips_ipackets, "\t%llu total input packet%s\n");
> +     p(ipips_opackets, "\t%llu total output packet%s\n");
> +     p(ipips_hdrops, "\t%llu packet%s shorter than header shows\n");
> +     p(ipips_pdrops, "\t%llu packet%s dropped due to policy\n");
> +     p(ipips_spoof, "\t%llu packet%s with possibly spoofed local 
> addresses\n");
> +     p(ipips_qfull, "\t%llu packet%s were dropped due to full output 
> queue\n");
>       p(ipips_ibytes, "\t%llu input byte%s\n");
>       p(ipips_obytes, "\t%llu output byte%s\n");
> -     p(ipips_family, "\t%u protocol family mismatche%s\n");
> -     p(ipips_unspec, "\t%u attempt%s to use tunnel with unspecified 
> endpoint(s)\n");
> +     p(ipips_family, "\t%llu protocol family mismatche%s\n");
> +     p(ipips_unspec, "\t%llu attempt%s to use tunnel with unspecified 
> endpoint(s)\n");
>  #undef p
>  }


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to