handle STDC and GNUC inline semantic differences by providing and using an EXTERN_INLINE definition for functions that are defined as inline but provide an externally callable reference. (these are externally called in ipftest)diff -r1.18 -r1.19 src/dist/ipf/ip_fil.c
(plunky)
--- src/dist/ipf/Attic/ip_fil.c 2010/04/17 21:00:08 1.18
+++ src/dist/ipf/Attic/ip_fil.c 2010/06/01 08:53:20 1.19
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip_fil.c,v 1.18 2010/04/17 21:00:08 darrenr Exp $ */ | 1 | /* $NetBSD: ip_fil.c,v 1.19 2010/06/01 08:53:20 plunky Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1993-2001 by Darren Reed. | 4 | * Copyright (C) 1993-2001 by Darren Reed. | |
5 | * | 5 | * | |
6 | * See the IPFILTER.LICENCE file for details on licencing. | 6 | * See the IPFILTER.LICENCE file for details on licencing. | |
7 | */ | 7 | */ | |
8 | #if !defined(lint) | 8 | #if !defined(lint) | |
9 | static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; | 9 | static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; | |
10 | static const char rcsid[] = "@(#)Id: ip_fil.c,v 2.133.2.21 2009/12/27 06:55:08 darrenr Exp"; | 10 | static const char rcsid[] = "@(#)Id: ip_fil.c,v 2.133.2.21 2009/12/27 06:55:08 darrenr Exp"; | |
11 | #endif | 11 | #endif | |
12 | 12 | |||
13 | #ifndef SOLARIS | 13 | #ifndef SOLARIS | |
14 | #define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) | 14 | #define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) | |
@@ -699,50 +699,50 @@ fr_info_t *fin; | @@ -699,50 +699,50 @@ fr_info_t *fin; | |||
699 | iss_seq_off += 0x00010000; | 699 | iss_seq_off += 0x00010000; | |
700 | newiss += iss_seq_off; | 700 | newiss += iss_seq_off; | |
701 | return newiss; | 701 | return newiss; | |
702 | } | 702 | } | |
703 | 703 | |||
704 | 704 | |||
705 | /* ------------------------------------------------------------------------ */ | 705 | /* ------------------------------------------------------------------------ */ | |
706 | /* Function: fr_nextipid */ | 706 | /* Function: fr_nextipid */ | |
707 | /* Returns: int - 0 == success, -1 == error (packet should be droppped) */ | 707 | /* Returns: int - 0 == success, -1 == error (packet should be droppped) */ | |
708 | /* Parameters: fin(I) - pointer to packet information */ | 708 | /* Parameters: fin(I) - pointer to packet information */ | |
709 | /* */ | 709 | /* */ | |
710 | /* Returns the next IPv4 ID to use for this packet. */ | 710 | /* Returns the next IPv4 ID to use for this packet. */ | |
711 | /* ------------------------------------------------------------------------ */ | 711 | /* ------------------------------------------------------------------------ */ | |
712 | INLINE u_short fr_nextipid(fin) | 712 | EXTERN_INLINE u_short fr_nextipid(fin) | |
713 | fr_info_t *fin; | 713 | fr_info_t *fin; | |
714 | { | 714 | { | |
715 | static u_short ipid = 0; | 715 | static u_short ipid = 0; | |
716 | u_short id; | 716 | u_short id; | |
717 | 717 | |||
718 | MUTEX_ENTER(&ipf_rw); | 718 | MUTEX_ENTER(&ipf_rw); | |
719 | id = ipid++; | 719 | id = ipid++; | |
720 | MUTEX_EXIT(&ipf_rw); | 720 | MUTEX_EXIT(&ipf_rw); | |
721 | 721 | |||
722 | return id; | 722 | return id; | |
723 | } | 723 | } | |
724 | 724 | |||
725 | 725 | |||
726 | INLINE void fr_checkv4sum(fin) | 726 | EXTERN_INLINE void fr_checkv4sum(fin) | |
727 | fr_info_t *fin; | 727 | fr_info_t *fin; | |
728 | { | 728 | { | |
729 | if (fr_checkl4sum(fin) == -1) | 729 | if (fr_checkl4sum(fin) == -1) | |
730 | fin->fin_flx |= FI_BAD; | 730 | fin->fin_flx |= FI_BAD; | |
731 | } | 731 | } | |
732 | 732 | |||
733 | 733 | |||
734 | #ifdef USE_INET6 | 734 | #ifdef USE_INET6 | |
735 | INLINE void fr_checkv6sum(fin) | 735 | EXTERN_INLINE void fr_checkv6sum(fin) | |
736 | fr_info_t *fin; | 736 | fr_info_t *fin; | |
737 | { | 737 | { | |
738 | if (fr_checkl4sum(fin) == -1) | 738 | if (fr_checkl4sum(fin) == -1) | |
739 | fin->fin_flx |= FI_BAD; | 739 | fin->fin_flx |= FI_BAD; | |
740 | } | 740 | } | |
741 | #endif | 741 | #endif | |
742 | 742 | |||
743 | 743 | |||
744 | /* | 744 | /* | |
745 | * See above for description, except that all addressing is in user space. | 745 | * See above for description, except that all addressing is in user space. | |
746 | */ | 746 | */ | |
747 | int copyoutptr(src, dst, size) | 747 | int copyoutptr(src, dst, size) | |
748 | void *src, *dst; | 748 | void *src, *dst; |
--- src/sys/dist/ipf/netinet/Attic/ip_compat.h 2010/04/17 21:00:44 1.28
+++ src/sys/dist/ipf/netinet/Attic/ip_compat.h 2010/06/01 08:53:20 1.29
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip_compat.h,v 1.28 2010/04/17 21:00:44 darrenr Exp $ */ | 1 | /* $NetBSD: ip_compat.h,v 1.29 2010/06/01 08:53:20 plunky Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1993-2001, 2003 by Darren Reed. | 4 | * Copyright (C) 1993-2001, 2003 by Darren Reed. | |
5 | * | 5 | * | |
6 | * See the IPFILTER.LICENCE file for details on licencing. | 6 | * See the IPFILTER.LICENCE file for details on licencing. | |
7 | * | 7 | * | |
8 | * @(#)ip_compat.h 1.8 1/14/96 | 8 | * @(#)ip_compat.h 1.8 1/14/96 | |
9 | * Id: ip_compat.h,v 2.142.2.79 2010/01/31 16:22:54 darrenr Exp | 9 | * Id: ip_compat.h,v 2.142.2.79 2010/01/31 16:22:54 darrenr Exp | |
10 | */ | 10 | */ | |
11 | 11 | |||
12 | #ifndef _NETINET_IP_COMPAT_H_ | 12 | #ifndef _NETINET_IP_COMPAT_H_ | |
13 | #define _NETINET_IP_COMPAT_H_ | 13 | #define _NETINET_IP_COMPAT_H_ | |
14 | 14 | |||
@@ -1571,26 +1571,34 @@ typedef union { | @@ -1571,26 +1571,34 @@ typedef union { | |||
1571 | #define ipf_isr ipf_lkun_s.ipf_sr | 1571 | #define ipf_isr ipf_lkun_s.ipf_sr | |
1572 | #define ipf_isw ipf_lkun_s.ipf_sw | 1572 | #define ipf_isw ipf_lkun_s.ipf_sw | |
1573 | #define ipf_magic ipf_lkun_s.ipf_magic | 1573 | #define ipf_magic ipf_lkun_s.ipf_magic | |
1574 | 1574 | |||
1575 | #if !defined(__GNUC__) || \ | 1575 | #if !defined(__GNUC__) || \ | |
1576 | (defined(__FreeBSD_version) && (__FreeBSD_version >= 503000)) | 1576 | (defined(__FreeBSD_version) && (__FreeBSD_version >= 503000)) | |
1577 | # ifndef INLINE | 1577 | # ifndef INLINE | |
1578 | # define INLINE | 1578 | # define INLINE | |
1579 | # endif | 1579 | # endif | |
1580 | #else | 1580 | #else | |
1581 | # define INLINE __inline__ | 1581 | # define INLINE __inline__ | |
1582 | #endif | 1582 | #endif | |
1583 | 1583 | |||
1584 | #ifndef EXTERN_INLINE | |||
1585 | # if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) | |||
1586 | # define EXTERN_INLINE inline | |||
1587 | # else | |||
1588 | # define EXTERN_INLINE extern inline | |||
1589 | # endif | |||
1590 | #endif | |||
1591 | ||||
1584 | #if defined(linux) && defined(_KERNEL) | 1592 | #if defined(linux) && defined(_KERNEL) | |
1585 | extern void ipf_read_enter __P((ipfrwlock_t *)); | 1593 | extern void ipf_read_enter __P((ipfrwlock_t *)); | |
1586 | extern void ipf_write_enter __P((ipfrwlock_t *)); | 1594 | extern void ipf_write_enter __P((ipfrwlock_t *)); | |
1587 | extern void ipf_rw_exit __P((ipfrwlock_t *)); | 1595 | extern void ipf_rw_exit __P((ipfrwlock_t *)); | |
1588 | extern void ipf_rw_init __P((ipfrwlock_t *, char *)); | 1596 | extern void ipf_rw_init __P((ipfrwlock_t *, char *)); | |
1589 | extern void ipf_rw_downgrade __P((ipfrwlock_t *)); | 1597 | extern void ipf_rw_downgrade __P((ipfrwlock_t *)); | |
1590 | #endif | 1598 | #endif | |
1591 | 1599 | |||
1592 | /* | 1600 | /* | |
1593 | * In a non-kernel environment, there are a lot of macros that need to be | 1601 | * In a non-kernel environment, there are a lot of macros that need to be | |
1594 | * filled in to be null-ops or to point to some compatibility function, | 1602 | * filled in to be null-ops or to point to some compatibility function, | |
1595 | * somewhere in userland. | 1603 | * somewhere in userland. | |
1596 | */ | 1604 | */ |
--- src/sys/dist/ipf/netinet/Attic/ip_fil_netbsd.c 2010/04/17 21:00:44 1.54
+++ src/sys/dist/ipf/netinet/Attic/ip_fil_netbsd.c 2010/06/01 08:53:20 1.55
@@ -1,24 +1,24 @@ | @@ -1,24 +1,24 @@ | |||
1 | /* $NetBSD: ip_fil_netbsd.c,v 1.54 2010/04/17 21:00:44 darrenr Exp $ */ | 1 | /* $NetBSD: ip_fil_netbsd.c,v 1.55 2010/06/01 08:53:20 plunky Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1993-2003 by Darren Reed. | 4 | * Copyright (C) 1993-2003 by Darren Reed. | |
5 | * | 5 | * | |
6 | * See the IPFILTER.LICENCE file for details on licencing. | 6 | * See the IPFILTER.LICENCE file for details on licencing. | |
7 | */ | 7 | */ | |
8 | #if !defined(lint) | 8 | #if !defined(lint) | |
9 | #if defined(__NetBSD__) | 9 | #if defined(__NetBSD__) | |
10 | #include <sys/cdefs.h> | 10 | #include <sys/cdefs.h> | |
11 | __KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.54 2010/04/17 21:00:44 darrenr Exp $"); | 11 | __KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.55 2010/06/01 08:53:20 plunky Exp $"); | |
12 | #else | 12 | #else | |
13 | static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; | 13 | static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; | |
14 | static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 2.55.2.67 2009/12/19 05:41:08 darrenr Exp"; | 14 | static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 2.55.2.67 2009/12/19 05:41:08 darrenr Exp"; | |
15 | #endif | 15 | #endif | |
16 | #endif | 16 | #endif | |
17 | 17 | |||
18 | #if defined(KERNEL) || defined(_KERNEL) | 18 | #if defined(KERNEL) || defined(_KERNEL) | |
19 | # undef KERNEL | 19 | # undef KERNEL | |
20 | # undef _KERNEL | 20 | # undef _KERNEL | |
21 | # define KERNEL 1 | 21 | # define KERNEL 1 | |
22 | # define _KERNEL 1 | 22 | # define _KERNEL 1 | |
23 | #endif | 23 | #endif | |
24 | #include <sys/param.h> | 24 | #include <sys/param.h> | |
@@ -1807,27 +1807,27 @@ fr_info_t *fin; | @@ -1807,27 +1807,27 @@ fr_info_t *fin; | |||
1807 | u_short fr_nextipid(fr_info_t *fin) | 1807 | u_short fr_nextipid(fr_info_t *fin) | |
1808 | { | 1808 | { | |
1809 | static u_short ipid = 0; | 1809 | static u_short ipid = 0; | |
1810 | u_short id; | 1810 | u_short id; | |
1811 | 1811 | |||
1812 | MUTEX_ENTER(&ipf_rw); | 1812 | MUTEX_ENTER(&ipf_rw); | |
1813 | id = ipid++; | 1813 | id = ipid++; | |
1814 | MUTEX_EXIT(&ipf_rw); | 1814 | MUTEX_EXIT(&ipf_rw); | |
1815 | 1815 | |||
1816 | return id; | 1816 | return id; | |
1817 | } | 1817 | } | |
1818 | 1818 | |||
1819 | 1819 | |||
1820 | INLINE void fr_checkv4sum(fin) | 1820 | EXTERN_INLINE void fr_checkv4sum(fin) | |
1821 | fr_info_t *fin; | 1821 | fr_info_t *fin; | |
1822 | { | 1822 | { | |
1823 | #ifdef M_CSUM_TCP_UDP_BAD | 1823 | #ifdef M_CSUM_TCP_UDP_BAD | |
1824 | int manual, pflag, cflags, active; | 1824 | int manual, pflag, cflags, active; | |
1825 | mb_t *m; | 1825 | mb_t *m; | |
1826 | 1826 | |||
1827 | if ((fin->fin_flx & FI_NOCKSUM) != 0) | 1827 | if ((fin->fin_flx & FI_NOCKSUM) != 0) | |
1828 | return; | 1828 | return; | |
1829 | 1829 | |||
1830 | if (fin->fin_cksum != 0) | 1830 | if (fin->fin_cksum != 0) | |
1831 | return; | 1831 | return; | |
1832 | 1832 | |||
1833 | manual = 0; | 1833 | manual = 0; | |
@@ -1881,27 +1881,27 @@ skipauto: | @@ -1881,27 +1881,27 @@ skipauto: | |||
1881 | # else | 1881 | # else | |
1882 | ; | 1882 | ; | |
1883 | # endif | 1883 | # endif | |
1884 | #else | 1884 | #else | |
1885 | # ifdef IPFILTER_CKSUM | 1885 | # ifdef IPFILTER_CKSUM | |
1886 | if (fr_checkl4sum(fin) == -1) | 1886 | if (fr_checkl4sum(fin) == -1) | |
1887 | fin->fin_flx |= FI_BAD; | 1887 | fin->fin_flx |= FI_BAD; | |
1888 | # endif | 1888 | # endif | |
1889 | #endif | 1889 | #endif | |
1890 | } | 1890 | } | |
1891 | 1891 | |||
1892 | 1892 | |||
1893 | #ifdef USE_INET6 | 1893 | #ifdef USE_INET6 | |
1894 | INLINE void fr_checkv6sum(fin) | 1894 | EXTERN_INLINE void fr_checkv6sum(fin) | |
1895 | fr_info_t *fin; | 1895 | fr_info_t *fin; | |
1896 | { | 1896 | { | |
1897 | # ifdef M_CSUM_TCP_UDP_BAD | 1897 | # ifdef M_CSUM_TCP_UDP_BAD | |
1898 | int manual, pflag, cflags, active; | 1898 | int manual, pflag, cflags, active; | |
1899 | mb_t *m; | 1899 | mb_t *m; | |
1900 | 1900 | |||
1901 | if ((fin->fin_flx & FI_NOCKSUM) != 0) | 1901 | if ((fin->fin_flx & FI_NOCKSUM) != 0) | |
1902 | return; | 1902 | return; | |
1903 | 1903 | |||
1904 | manual = 0; | 1904 | manual = 0; | |
1905 | m = fin->fin_m; | 1905 | m = fin->fin_m; | |
1906 | 1906 | |||
1907 | switch (fin->fin_p) | 1907 | switch (fin->fin_p) |