On Tue, Sep 11, 2018 at 06:12:03PM +0200, Alexander Bluhm wrote:
> On Sun, Sep 09, 2018 at 09:53:59PM +0200, Alexander Bluhm wrote:
> > My goal is to get in6_pcb and in_pcb in sync.
> >
> > Let's make both inetctlerrmap and inet6ctlerrmap u_char. That is
> > what FreeBSD does. There it is also in in6?_input.c.
> >
> > FreeBSD and NetBSD have the declaration in in6?_var.h, we have it
> > in in6?.h, but I don't bother enough to move it.
> >
> > ok?
>
> Merged to -current. Anyone?
Why u_char instead of int? The errors in that list are used in errno which
is an int. So my usual feeling is to use the type which is naturally used
and don't try to optimize for space.
Diff itself is OK claudio@
--
:wq Claudio
> bluhm
>
> Index: netinet/in.h
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in.h,v
> retrieving revision 1.131
> diff -u -p -r1.131 in.h
> --- netinet/in.h 10 Jul 2018 11:34:12 -0000 1.131
> +++ netinet/in.h 11 Sep 2018 16:00:39 -0000
> @@ -795,8 +795,8 @@ __END_DECLS
> #endif /* !_KERNEL */
>
> #ifdef _KERNEL
> -extern const int inetctlerrmap[];
> -extern const struct in_addr zeroin_addr;
> +extern const u_char inetctlerrmap[];
> +extern const struct in_addr zeroin_addr;
>
> struct mbuf;
> struct sockaddr;
> Index: netinet/ip_input.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_input.c,v
> retrieving revision 1.340
> diff -u -p -r1.340 ip_input.c
> --- netinet/ip_input.c 10 Sep 2018 16:14:07 -0000 1.340
> +++ netinet/ip_input.c 11 Sep 2018 16:00:39 -0000
> @@ -1379,7 +1379,7 @@ ip_stripoptions(struct mbuf *m)
> ip->ip_len = htons(ntohs(ip->ip_len) - olen);
> }
>
> -const int inetctlerrmap[PRC_NCMDS] = {
> +const u_char inetctlerrmap[PRC_NCMDS] = {
> 0, 0, 0, 0,
> 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH,
> EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED,
> Index: netinet6/in6.h
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/in6.h,v
> retrieving revision 1.102
> diff -u -p -r1.102 in6.h
> --- netinet6/in6.h 7 Jun 2018 08:46:24 -0000 1.102
> +++ netinet6/in6.h 11 Sep 2018 16:00:39 -0000
> @@ -404,8 +404,8 @@ typedef __socklen_t socklen_t; /* length
> #endif /* __BSD_VISIBLE */
>
> #ifdef _KERNEL
> -extern const u_char inet6ctlerrmap[];
> -extern const struct in6_addr zeroin6_addr;
> +extern const u_char inet6ctlerrmap[];
> +extern const struct in6_addr zeroin6_addr;
>
> struct mbuf;
> struct ifnet;
> Index: netinet6/in6_pcb.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/in6_pcb.c,v
> retrieving revision 1.105
> diff -u -p -r1.105 in6_pcb.c
> --- netinet6/in6_pcb.c 11 Sep 2018 14:34:49 -0000 1.105
> +++ netinet6/in6_pcb.c 11 Sep 2018 16:00:39 -0000
> @@ -119,31 +119,7 @@
>
> #include <netinet6/in6_var.h>
>
> -/*
> - * External globals
> - */
> -
> -/*
> - * Globals
> - */
> -
> const struct in6_addr zeroin6_addr;
> -
> -/*
> - * Keep separate inet6ctlerrmap, because I may remap some of these.
> - * I also put it here, because, quite frankly, it belongs here, not in
> - * ip{v6,}_input().
> - */
> -#if 0
> -u_char inet6ctlerrmap[PRC_NCMDS] = {
> - 0, 0, 0, 0,
> - 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH,
> - EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED,
> - EMSGSIZE, EHOSTUNREACH, 0, 0,
> - 0, 0, 0, 0,
> - ENOPROTOOPT
> -};
> -#endif
>
> struct inpcbhead *
> in6_pcbhash(struct inpcbtable *table, int rdom,
>