DragonFly BSD
DragonFly commits List (threaded) for 2006-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/sys/contrib/ipfilter/netinet ip_fil.h


From: YONETANI Tomokazu <qhwt+dfly@xxxxxxxxxx>
Date: Sat, 29 Jul 2006 05:45:51 +0900

On Fri, Jul 28, 2006 at 09:19:11AM -0700, Matthew Dillon wrote:
> 
> :>   Modified files:
> :>     sys/contrib/ipfilter/netinet ip_fil.h 
> :>   Log:
> :>   Why is ip_fil.h trying to declare kernel procedures for userland #include's?
> :>   Remove them.
> :
> :Because ip_fil.c is shared between kernel and userland program(ipftest).
> 
>     Yah, but insofar as I can tell the userland program does not actually
>     try to call those procedures.

It does, just that it's obscured by a macro called IPL_EXTERN()
like this in /usr/src/contrib/ipfilter/ipt.c:
    if (rremove == 0) {
	    i = IPL_EXTERN(ioctl)(IPL_LOGNAT, SIOCADNAT,
				  (caddr_t)&fr,
				  FWRITE|FREAD);
	    if (opts & OPT_DEBUG)
		    fprintf(stderr,
			    "iplioctl(ADNAT,%p,1) = %d\n",
			    fr, i);

cd /usr/src/usr.sbin/ipftest && make CC='cc -E' 2>&1 |less
would untie those #ifdef knots for you.

And the ipftest program currently does not compile because of
the last reorganization (patch attached).

Cheers.
? a
Index: ip_fil.c
===================================================================
RCS file: /cvs/src/sys/contrib/ipfilter/netinet/ip_fil.c,v
retrieving revision 1.21
diff -u -r1.21 ip_fil.c
--- ip_fil.c	28 Jul 2006 02:17:35 -0000	1.21
+++ ip_fil.c	28 Jul 2006 11:03:26 -0000
@@ -667,7 +667,11 @@
 )
 #else
 #if defined(__DragonFly__)
+# if defined(_KERNEL)
 int IPL_EXTERN(ioctl)(struct dev_ioctl_args *ap)
+# else
+int IPL_EXTERN(ioctl)(dev_t dev, u_long cmd, caddr_t data, int mode)
+#endif
 #else
 int IPL_EXTERN(ioctl)(dev, cmd, data, mode
 #if (defined(_KERNEL) && defined(__FreeBSD__))
@@ -693,7 +697,7 @@
 #endif /* DragonFly */
 #endif /* __sgi */
 {
-#if defined(__DragonFly__)
+#if (defined(_KERNEL) && defined(__DragonFly__))
 	dev_t dev = ap->a_head.a_dev;
 	u_long cmd = ap->a_cmd;
 	caddr_t data = ap->a_data;
Index: ip_fil.h
===================================================================
RCS file: /cvs/src/sys/contrib/ipfilter/netinet/ip_fil.h,v
retrieving revision 1.10
diff -u -r1.10 ip_fil.h
--- ip_fil.h	28 Jul 2006 07:31:08 -0000	1.10
+++ ip_fil.h	28 Jul 2006 11:03:26 -0000
@@ -512,7 +512,6 @@
 extern	int	ipf_log (void);
 extern	struct	ifnet *get_unit (char *, int);
 extern	int	mbuflen (mb_t *);
-#if 0
 # if defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
 	  (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000)
 extern	int	iplioctl (dev_t, u_long, caddr_t, int);
@@ -521,7 +520,6 @@
 # endif
 extern	int	iplopen (dev_t, int);
 extern	int	iplclose (dev_t, int);
-#endif
 #else /* #ifndef _KERNEL */
 # if defined(__NetBSD__) && defined(PFIL_HOOKS)
 extern	void	ipfilterattach (int);


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]