Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Errors on FreeBSD #68

Closed
Uglymotha opened this issue May 12, 2020 · 0 comments
Closed

Compilation Errors on FreeBSD #68

Uglymotha opened this issue May 12, 2020 · 0 comments

Comments

@Uglymotha
Copy link
Contributor

On FreeBSD igmpproxy compilation throws errors like:
/usr/include/net/route.h:82:2: error: unknown type name 'u_long'; did you mean 'long'?
/usr/include/net/route.h:63:18: error: field has incomplete type 'struct sockaddr'
/usr/include/netinet/ip_mroute.h:98:17: error: field has incomplete type 'struct in_addr'

The reason for this is os-freebsd.h is missing several includes, as well as an early or incorrect define of __POSIX_C_SOURCE (which is done in igmpproxy.c before including igmpproxy.h. The latter is causing cdefs.h, included from types.h included from params.h to set BSD_VISIBLE to 0:

#elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 2011
#define __EXT1_VISIBLE 0

In turn this causes types.h not providing the typedefs for u_long etc. The missing include of sys/param.h will also invalidate the evaluation of __FreeBSD_version because the file does not seem to be included from any of the other includes is os-freebsd.h (tested with cc-H os-freebsd.h).

I fixed this issue in os-freebsd.h by adding to top of file, will open a PR for this:
#undef _POSIX_C_SOURCE
#include <sys/param.h>
#define _POSIX_C_SOURCE 200112L

#include <sys/socket.h>
#include <netinet/in.h>

The missing include of sys/param.h will also invalidate the evaluation of

Uglymotha added a commit to Uglymotha/igmpv3proxy that referenced this issue May 20, 2020
Fixes compilation erros on FreeBSD due to missing includes in os-freebsd.h:.
This was causing errors about undefined structs and types in missing includes.
Also defines __BSD_VISIBLE due to FreeBSD not providing u_int, u_long etc
in a default _POSIX_C_SOURCE environment.
    define  __BSD_VISIBLE 1
    include <sys/param.h>
    include <sys/socket.h>
    include <netinet/in.h>
Uglymotha added a commit to Uglymotha/igmpv3proxy that referenced this issue May 20, 2020
On FreeBSD compilation failed due to missing includes in os-freebsd.h:.
This was causing errors about undefined structs and types in missing includes.
Also defines __BSD_VISIBLE due to FreeBSD not providing u_int, u_long etc
in a default _POSIX_C_SOURCE environment.

Fixes: pali#68
Uglymotha added a commit to Uglymotha/igmpv3proxy that referenced this issue May 20, 2020
On FreeBSD compilation failed due to missing includes in os-freebsd.h:.
This was causing errors about undefined structs and types in missing includes.
Also defines __BSD_VISIBLE due to FreeBSD not providing u_int, u_long etc
in a default _POSIX_C_SOURCE environment.

Fixes: pali#68
@pali pali closed this as completed in f71ba40 May 21, 2020
mtremer pushed a commit to ipfire/ipfire-2.x that referenced this issue Jan 2, 2022
- Update from 0.2.1 to 0.3
- Update of rootfile not required
- Changelog
   2021-01-04 18:40:01 +0100  Pali Rohár <pali.rohar@gmail.com>
	* Release version 0.3
   2020-09-05 13:52:50 +0200  Pali Rohár <pali.rohar@gmail.com>
	* Remove duplicate code in mcgroup.c file
           Existing functionality is provided by k_join and k_leave functions.
   2020-09-05 13:07:38 +0200  Pali Rohár <pali.rohar@gmail.com>
	* Fix initialization and deinitialization of mrouter socket
           Ensure that uninitialized socket is invalid (-1) and not stdin (0).
   2020-09-05 13:07:00 +0200  Pali Rohár <pali.rohar@gmail.com>
	* Use main mrouter socket also for sending join/leave messages to upstream router
           There is no need to open additional UDP socket which is used just for calling
	    IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP setsockopt. Main mrouter socket is can
	    be used for these operations too.
   2020-05-20 09:59:11 +0200  Uglymotha <uglymotha@wizdom.nu>
	* Free BSD Compilation Patch
           On FreeBSD compilation failed due to missing includes in os-freebsd.h.
            This was causing errors about undefined structs and types in missing includes.
            Also defines __BSD_VISIBLE due to FreeBSD not providing u_int, u_long etc
            in a default _POSIX_C_SOURCE environment.
           Fixes: pali/igmpproxy#68
   2020-05-08 22:54:06 +0200  Pali Rohár <pali.rohar@gmail.com>
	* Remove MAX_MC_VIFS macro
           Its value is same as MAXVIFS, so use MAXVIFS instead.
   2020-03-06 11:51:21 +0100  Pali Rohár <pali.rohar@gmail.com>
	* Improve downstream host tracking for quickleave mode
           Use bit based per multicast route hash table for tracking downstream hosts.
	   For hasing function is used 32bit MurmurHash3 with pseudorandom seed and
	   size of hash table can be configured via a new "hashtablesize" token in
	   config file. Default size of hash table is 32 bytes, so it can store
	   approximatelly 128 hosts which is half of /24 subnet. For home networks
	   this should be sane default value.
	  Fixes: pali/igmpproxy#57
   2020-02-26 20:27:08 +0100  Pali Rohár <pali.rohar@gmail.com>
	* Show error message when IP_ADD_MEMBERSHIP fails with errno ENOBUFS
	   Also on Linux show hint how to increase maximum number of multicast groups.
	  Fixes: pali/igmpproxy#30
   2020-02-25 23:46:57 +0100  Pali Rohár <pali.rohar@gmail.com>
	* Fix gcc-7 and clang-9 on Travis
   2020-02-25 23:24:26 +0100  Pali Rohár <pali.rohar@gmail.com>
	* Update Travis config file
   2019-06-26 17:42:15 +0200  Pali Rohár <pali.rohar@gmail.com>
	* Use AS_IF macro for C99 check in configure.ac
   2018-09-30 00:28:05 +0200  Pali Rohár <pali.rohar@gmail.com>
	* Fix makefile rules for generating AUTHORS and ChangeLog files
   2018-02-13 20:17:30 +0100  Pali Rohár <pali.rohar@gmail.com>

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant