Nick Briggs wrote:
>  because netinet/ip_var.h, which it includes, depends on
>    #ifdef MROUTING
>    extern struct socket *ip_mrouter[];     /* multicast routing daemon */
>    #endif
> to get a declaration of struct socket outside of any parameter lists.

I think this is a better fix. Two parts.

1. pfkeyv2_parsemessage.c doesn't even need this header. remove it.

2. to prevent this from happening again, move the forward declaration in
ip_var.h to the end, so that it will fail regardless of compile options. i
think this is better than deliberately exporting another type here.

tested with and without MROUTING set.

Index: net/pfkeyv2_parsemessage.c
===================================================================
RCS file: /cvs/src/sys/net/pfkeyv2_parsemessage.c,v
retrieving revision 1.52
diff -u -p -r1.52 pfkeyv2_parsemessage.c
--- net/pfkeyv2_parsemessage.c  26 Jun 2017 09:17:55 -0000      1.52
+++ net/pfkeyv2_parsemessage.c  14 Jul 2017 02:35:13 -0000
@@ -76,7 +76,6 @@
 #include <sys/mbuf.h>
 #include <sys/proc.h>
 #include <netinet/ip_ipsp.h>
-#include <netinet/ip_var.h>
 #include <net/pfkeyv2.h>
 
 #if NPF > 0
Index: netinet/ip_var.h
===================================================================
RCS file: /cvs/src/sys/netinet/ip_var.h,v
retrieving revision 1.79
diff -u -p -r1.79 ip_var.h
--- netinet/ip_var.h    26 Jun 2017 19:06:12 -0000      1.79
+++ netinet/ip_var.h    14 Jul 2017 02:34:17 -0000
@@ -193,9 +193,6 @@ struct ipq {
 extern struct ipstat ipstat;
 extern LIST_HEAD(ipqhead, ipq) ipq;    /* ip reass. queue */
 extern int ip_defttl;                  /* default IP ttl */
-#ifdef MROUTING
-extern struct socket *ip_mrouter[];    /* multicast routing daemon */
-#endif
 
 #define IPMTUDISCTIMEOUT (10 * 60)     /* as per RFC 1191 */
 
@@ -259,6 +256,10 @@ int         rip_output(struct mbuf *, struct so
 int     rip_usrreq(struct socket *,
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
 int     rip_attach(struct socket *, int);
+
+#ifdef MROUTING
+extern struct socket *ip_mrouter[];    /* multicast routing daemon */
+#endif
 
 #endif /* _KERNEL */
 #endif /* _NETINET_IP_VAR_H_ */

Reply via email to