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

FreeBSD compilation fail #30

Open
ghost opened this issue Mar 13, 2016 · 2 comments
Open

FreeBSD compilation fail #30

ghost opened this issue Mar 13, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 13, 2016

Hi,
uname -a
FreeBSD freebsd1 10.2-RELEASE-p9 FreeBSD 10.2-RELEASE-p9 #0: Thu Jan 14 01:32:46 UTC 2016 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
compiler
clang 3.4.1

The problem while compiling:

/home/alex/Downloads/libsocket-master/C/inet/libinetsocket.c:957:43: error: no member named 'ifr_ifindex' in 'struct ifreq'
mreq4.imr_ifindex = interface.ifr_ifindex;
~~~~~~~~~ ^
/home/alex/Downloads/libsocket-master/C/inet/libinetsocket.c:997:48: error: no member named 'ifr_ifindex' in 'struct ifreq'
mreq6.ipv6mr_interface = interface.ifr_ifindex;
~~~~~~~~~ ^
/home/alex/Downloads/libsocket-master/C/inet/libinetsocket.c:1000:60: error: use of undeclared identifier 'IPV6_ADD_MEMBERSHIP'
if ( -1 == check_error(setsockopt(sfd,IPPROTO_IPV6,IPV6_ADD_MEMBERSHIP,&mreq6,sizeof(struct ipv6_mreq))) )

Temporary solution:
Add to ./C/inet/libnetsocket.c:

#ifdef __FreeBSD__
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
#define IPV6_DROP_MEMBERSHIP    IPV6_LEAVE_GROUP
#endif

Modify line ~960

# ifdef __FreeBSD__
    mreq4.imr_ifindex = interface.ifr_ifru.ifru_index;
#else       
    mreq4.imr_ifindex = interface.ifr_ifindex;
# endif

And modify line ~1005

# ifdef __FreeBSD__
        mreq6.ipv6mr_interface = interface.ifr_ifru.ifru_index;
#else       
        mreq6.ipv6mr_interface = interface.ifr_ifindex;
# endif

Modified file:
libinetsocket.c.tar.gz
I have attached the modified file.
Thanks.

@dermesser
Copy link
Owner

Thanks for finding this bug! Can you send me a pull request in order to patch this? (should be easy given that you already have the patched file)

@ghost
Copy link
Author

ghost commented Mar 16, 2016

Ok, I will send pull request soon.

Kind Regards,
Alexander

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