freebsd: eeze support if enabled.

ifr_netmask is not available on FreeBSD. On Linux ifr_addr is
same union.

Peter2121 did this work.
This commit is contained in:
Alastair Poole 2021-04-10 08:58:38 +01:00
parent 77a3b908ed
commit b02cef69d1
3 changed files with 5 additions and 4 deletions

View File

@ -1,3 +1,3 @@
#!/bin/sh -e
meson -Dsystemd=false -Dv4l2=false -Deeze=false \
meson -Dsystemd=false -Dv4l2=false -Deeze=false -Dinput=false \
$@ . build

View File

@ -3,7 +3,7 @@
#endif
/*FIXME: change OS specific value */
#ifdef __linux__
#if defined(__linux__) || defined(__FreeBSD__)
# include <linux/joystick.h>
#endif

View File

@ -5,6 +5,7 @@
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <unistd.h>
#include <Eeze_Net.h>
@ -203,7 +204,7 @@ eeze_net_scan(Eeze_Net *net)
eina_stringshare_replace_length(&net->broadip, ip, INET_ADDRSTRLEN);
if (ioctl(sock, *i++, &ifr) < 0) goto error;
sa = (struct sockaddr_in*) & (ifr.ifr_netmask);
sa = (struct sockaddr_in*) & (ifr.ifr_addr);
inet_ntop(AF_INET, (struct in_addr*)&sa->sin_addr, ip, INET_ADDRSTRLEN);
eina_stringshare_replace_length(&net->netmask, ip, INET_ADDRSTRLEN);
@ -225,7 +226,7 @@ eeze_net_scan(Eeze_Net *net)
eina_stringshare_replace_length(&net->broadip6, ip6, INET6_ADDRSTRLEN);
if (ioctl(sock, *i++, &ifr) < 0) goto error;
sa6 = (struct sockaddr_in6*) & (ifr.ifr_netmask);
sa6 = (struct sockaddr_in6*) & (ifr.ifr_addr);
inet_ntop(AF_INET6, (struct in6_addr*)&sa6->sin6_addr, ip6, INET6_ADDRSTRLEN);
eina_stringshare_replace_length(&net->netmask6, ip6, INET6_ADDRSTRLEN);