Hi,

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?

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        9 Sep 2018 15:39:32 -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/in_pcb.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in_pcb.c,v
retrieving revision 1.241
diff -u -p -r1.241 in_pcb.c
--- netinet/in_pcb.c    7 Sep 2018 10:55:35 -0000       1.241
+++ netinet/in_pcb.c    9 Sep 2018 15:21:24 -0000
@@ -98,7 +98,6 @@
 
 #ifdef INET6
 #include <netinet6/in6_var.h>
-#include <netinet6/ip6_var.h>
 #endif /* INET6 */
 #ifdef IPSEC
 #include <netinet/ip_esp.h>
Index: netinet/ip_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.338
diff -u -p -r1.338 ip_input.c
--- netinet/ip_input.c  10 Jul 2018 11:34:12 -0000      1.338
+++ netinet/ip_input.c  9 Sep 2018 15:40:38 -0000
@@ -1384,7 +1384,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      9 Sep 2018 15:39:16 -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.104
diff -u -p -r1.104 in6_pcb.c
--- netinet6/in6_pcb.c  14 Jun 2018 17:00:58 -0000      1.104
+++ netinet6/in6_pcb.c  9 Sep 2018 15:39:58 -0000
@@ -124,31 +124,7 @@
 #include <netinet/ip6.h>
 #include <netinet6/ip6_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
 
 int
 in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,

Reply via email to