Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Mar 2010 11:51:16 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        net@FreeBSD.org
Subject:   Small patch to ipfilter for arm
Message-ID:  <20100329.115116.385399974524554540.imp@bsdimp.com>

next in thread | raw e-mail | index | archive | help
OK.  I'd like to propose the following patch for ipfilter:

Index: sys/contrib/ipfilter/netinet/ip_compat.h
===================================================================
--- sys/contrib/ipfilter/netinet/ip_compat.h    (revision 205838)
+++ sys/contrib/ipfilter/netinet/ip_compat.h    (working copy)
@@ -975,7 +975,6 @@
 #   define     SPL_NET(x)      ;
 #   define     SPL_IMP(x)      ;
 #   define     SPL_SCHED(x)    ;
-extern int     in_cksum __P((struct mbuf *, int));
 #  else
 #   define     SPL_SCHED(x)    x = splhigh()
 #  endif /* __FreeBSD_version >= 500043 */

This declaration is wrong, and it prevents arm from building ipfilter.

Why is it wrong?  Because we have:

#  if (__FreeBSD_version >= 500002)
#   include <netinet/in_systm.h>
#   include <netinet/ip.h>
#   include <machine/in_cksum.h>
#  endif

#  if (__FreeBSD_version >= 500043)
...
<the above code>
...
#  endif

So, we have in_cksum.h being included *AND* we're defining this
function.  However, in_cksum.h is supposed to do this.

Why don't we see problems today?  No architecture except arm has an
assembler in_cksum in the tree.  All the other architectures have

#define in_cksum(a, b) in_cksum_skip(a, b, 0)

in their headers.  Since the above extern uses __P to hide the args,
in_cksum doesn't expand the macro, so we don't see any problems or
conflicts.  On arm, where we define in_cksum() correctly to return
u_short, there's a conflict.

So, it would best if we just dropped this one line from ip_compat.h,
since it was always wrong anyway.

Comments?

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100329.115116.385399974524554540.imp>