|
@ -1,8 +1,6 @@ |
|
|
Index: squeezelite-1.9.1-1130/main.c
|
|
|
|
|
|
===================================================================
|
|
|
|
|
|
--- squeezelite-1.9.1-1130.orig/main.c
|
|
|
|
|
|
+++ squeezelite-1.9.1-1130/main.c
|
|
|
|
|
|
@@ -84,6 +84,7 @@ static void usage(const char *argv0) {
|
|
|
|
|
|
|
|
|
--- a/main.c
|
|
|
|
|
|
+++ b/main.c
|
|
|
|
|
|
@@ -93,6 +93,7 @@ static void usage(const char *argv0) {
|
|
|
#if IR |
|
|
#if IR |
|
|
" -i [<filename>]\tEnable lirc remote control support (lirc config file ~/.lircrc used if filename not specified)\n" |
|
|
" -i [<filename>]\tEnable lirc remote control support (lirc config file ~/.lircrc used if filename not specified)\n" |
|
|
#endif |
|
|
#endif |
|
@ -10,7 +8,7 @@ Index: squeezelite-1.9.1-1130/main.c |
|
|
" -m <mac addr>\t\tSet mac address, format: ab:cd:ef:12:34:56\n" |
|
|
" -m <mac addr>\t\tSet mac address, format: ab:cd:ef:12:34:56\n" |
|
|
" -M <modelname>\tSet the squeezelite player model name sent to the server (default: " MODEL_NAME_STRING ")\n" |
|
|
" -M <modelname>\tSet the squeezelite player model name sent to the server (default: " MODEL_NAME_STRING ")\n" |
|
|
" -n <name>\t\tSet the player name\n" |
|
|
" -n <name>\t\tSet the player name\n" |
|
|
@@ -267,6 +268,8 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
@@ -285,6 +286,8 @@ int main(int argc, char **argv) {
|
|
|
extern bool user_rates; |
|
|
extern bool user_rates; |
|
|
char *logfile = NULL; |
|
|
char *logfile = NULL; |
|
|
u8_t mac[6]; |
|
|
u8_t mac[6]; |
|
@ -19,7 +17,7 @@ Index: squeezelite-1.9.1-1130/main.c |
|
|
unsigned stream_buf_size = STREAMBUF_SIZE; |
|
|
unsigned stream_buf_size = STREAMBUF_SIZE; |
|
|
unsigned output_buf_size = 0; // set later |
|
|
unsigned output_buf_size = 0; // set later |
|
|
unsigned rates[MAX_SUPPORTED_SAMPLERATES] = { 0 }; |
|
|
unsigned rates[MAX_SUPPORTED_SAMPLERATES] = { 0 }; |
|
|
@@ -307,6 +310,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
@@ -325,6 +328,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
int maxSampleRate = 0; |
|
|
int maxSampleRate = 0; |
|
|
|
|
|
|
|
@ -27,7 +25,7 @@ Index: squeezelite-1.9.1-1130/main.c |
|
|
char *optarg = NULL; |
|
|
char *optarg = NULL; |
|
|
int optind = 1; |
|
|
int optind = 1; |
|
|
int i; |
|
|
int i; |
|
|
@@ -314,8 +318,6 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
@@ -332,8 +336,6 @@ int main(int argc, char **argv) {
|
|
|
#define MAXCMDLINE 512 |
|
|
#define MAXCMDLINE 512 |
|
|
char cmdline[MAXCMDLINE] = ""; |
|
|
char cmdline[MAXCMDLINE] = ""; |
|
|
|
|
|
|
|
@ -36,7 +34,7 @@ Index: squeezelite-1.9.1-1130/main.c |
|
|
for (i = 0; i < argc && (strlen(argv[i]) + strlen(cmdline) + 2 < MAXCMDLINE); i++) { |
|
|
for (i = 0; i < argc && (strlen(argv[i]) + strlen(cmdline) + 2 < MAXCMDLINE); i++) { |
|
|
strcat(cmdline, argv[i]); |
|
|
strcat(cmdline, argv[i]); |
|
|
strcat(cmdline, " "); |
|
|
strcat(cmdline, " "); |
|
|
@@ -323,7 +325,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
@@ -341,7 +343,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
while (optind < argc && strlen(argv[optind]) >= 2 && argv[optind][0] == '-') { |
|
|
while (optind < argc && strlen(argv[optind]) >= 2 && argv[optind][0] == '-') { |
|
|
char *opt = argv[optind] + 1; |
|
|
char *opt = argv[optind] + 1; |
|
@ -45,7 +43,7 @@ Index: squeezelite-1.9.1-1130/main.c |
|
|
#if ALSA |
|
|
#if ALSA |
|
|
"UVO" |
|
|
"UVO" |
|
|
#endif |
|
|
#endif |
|
|
@@ -424,6 +426,9 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
@@ -442,6 +444,9 @@ int main(int argc, char **argv) {
|
|
|
case 'f': |
|
|
case 'f': |
|
|
logfile = optarg; |
|
|
logfile = optarg; |
|
|
break; |
|
|
break; |
|
@ -55,7 +53,7 @@ Index: squeezelite-1.9.1-1130/main.c |
|
|
case 'm': |
|
|
case 'm': |
|
|
{ |
|
|
{ |
|
|
int byte = 0; |
|
|
int byte = 0; |
|
|
@@ -733,6 +738,11 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
@@ -755,6 +760,11 @@ int main(int argc, char **argv) {
|
|
|
winsock_init(); |
|
|
winsock_init(); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -67,7 +65,7 @@ Index: squeezelite-1.9.1-1130/main.c |
|
|
stream_init(log_stream, stream_buf_size); |
|
|
stream_init(log_stream, stream_buf_size); |
|
|
|
|
|
|
|
|
if (!strcmp(output_device, "-")) { |
|
|
if (!strcmp(output_device, "-")) { |
|
|
@@ -776,7 +786,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
@@ -798,7 +808,7 @@ int main(int argc, char **argv) {
|
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -76,42 +74,18 @@ Index: squeezelite-1.9.1-1130/main.c |
|
|
|
|
|
|
|
|
decode_close(); |
|
|
decode_close(); |
|
|
stream_close(); |
|
|
stream_close(); |
|
|
Index: squeezelite-1.9.1-1130/squeezelite.h
|
|
|
|
|
|
===================================================================
|
|
|
|
|
|
--- squeezelite-1.9.1-1130.orig/squeezelite.h
|
|
|
|
|
|
+++ squeezelite-1.9.1-1130/squeezelite.h
|
|
|
|
|
|
@@ -414,7 +414,7 @@ typedef enum { EVENT_TIMEOUT = 0, EVENT_
|
|
|
|
|
|
|
|
|
|
|
|
char *next_param(char *src, char c); |
|
|
|
|
|
u32_t gettime_ms(void); |
|
|
|
|
|
-void get_mac(u8_t *mac);
|
|
|
|
|
|
+in_addr_t get_iface_info(log_level level, char *iface, u8_t *mac);
|
|
|
|
|
|
void set_nonblock(sockfd s); |
|
|
|
|
|
int connect_timeout(sockfd sock, const struct sockaddr *addr, socklen_t addrlen, int timeout); |
|
|
|
|
|
void server_addr(char *server, in_addr_t *ip_ptr, unsigned *port_ptr); |
|
|
|
|
|
@@ -470,7 +470,7 @@ void buf_init(struct buffer *buf, size_t
|
|
|
|
|
|
void buf_destroy(struct buffer *buf); |
|
|
|
|
|
|
|
|
|
|
|
// slimproto.c |
|
|
|
|
|
-void slimproto(log_level level, char *server, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate);
|
|
|
|
|
|
+void slimproto(log_level level, char *server, in_addr_t bcast_addr, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate);
|
|
|
|
|
|
void slimproto_stop(void); |
|
|
|
|
|
void wake_controller(void); |
|
|
|
|
|
|
|
|
|
|
|
Index: squeezelite-1.9.1-1130/slimproto.c
|
|
|
|
|
|
===================================================================
|
|
|
|
|
|
--- squeezelite-1.9.1-1130.orig/slimproto.c
|
|
|
|
|
|
+++ squeezelite-1.9.1-1130/slimproto.c
|
|
|
|
|
|
@@ -113,7 +113,7 @@ void send_packet(u8_t *packet, size_t le
|
|
|
|
|
|
|
|
|
--- a/slimproto.c
|
|
|
|
|
|
+++ b/slimproto.c
|
|
|
|
|
|
@@ -113,7 +113,7 @@ void send_packet(u8_t *packet, size_t len) {
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
-static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t mac[6]) {
|
|
|
-static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t mac[6]) {
|
|
|
+static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t *mac) {
|
|
|
+static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t *mac) {
|
|
|
const char *base_cap = "Model=squeezelite,AccuratePlayPoints=1,HasDigitalOut=1,HasPolarityInversion=1,Firmware=" VERSION; |
|
|
|
|
|
struct HELO_packet pkt; |
|
|
|
|
|
|
|
|
|
|
|
@@ -757,7 +757,7 @@ void wake_controller(void) {
|
|
|
|
|
|
|
|
|
#define BASE_CAP "Model=squeezelite,AccuratePlayPoints=1,HasDigitalOut=1,HasPolarityInversion=1,Firmware=" VERSION |
|
|
|
|
|
#define SSL_CAP "CanHTTPS=1" |
|
|
|
|
|
const char *base_cap; |
|
|
|
|
|
@@ -761,7 +761,7 @@ void wake_controller(void) {
|
|
|
wake_signal(wake_e); |
|
|
wake_signal(wake_e); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -120,7 +94,7 @@ Index: squeezelite-1.9.1-1130/slimproto.c |
|
|
struct sockaddr_in d; |
|
|
struct sockaddr_in d; |
|
|
struct sockaddr_in s; |
|
|
struct sockaddr_in s; |
|
|
char *buf; |
|
|
char *buf; |
|
|
@@ -774,7 +774,7 @@ in_addr_t discover_server(char *default_
|
|
|
|
|
|
|
|
|
@@ -778,7 +778,7 @@ in_addr_t discover_server(char *default_server) {
|
|
|
memset(&d, 0, sizeof(d)); |
|
|
memset(&d, 0, sizeof(d)); |
|
|
d.sin_family = AF_INET; |
|
|
d.sin_family = AF_INET; |
|
|
d.sin_port = htons(PORT); |
|
|
d.sin_port = htons(PORT); |
|
@ -129,7 +103,7 @@ Index: squeezelite-1.9.1-1130/slimproto.c |
|
|
|
|
|
|
|
|
pollinfo.fd = disc_sock; |
|
|
pollinfo.fd = disc_sock; |
|
|
pollinfo.events = POLLIN; |
|
|
pollinfo.events = POLLIN; |
|
|
@@ -809,7 +809,7 @@ in_addr_t discover_server(char *default_
|
|
|
|
|
|
|
|
|
@@ -813,7 +813,7 @@ in_addr_t discover_server(char *default_server) {
|
|
|
#define FIXED_CAP_LEN 256 |
|
|
#define FIXED_CAP_LEN 256 |
|
|
#define VAR_CAP_LEN 128 |
|
|
#define VAR_CAP_LEN 128 |
|
|
|
|
|
|
|
@ -138,7 +112,7 @@ Index: squeezelite-1.9.1-1130/slimproto.c |
|
|
struct sockaddr_in serv_addr; |
|
|
struct sockaddr_in serv_addr; |
|
|
static char fixed_cap[FIXED_CAP_LEN], var_cap[VAR_CAP_LEN] = ""; |
|
|
static char fixed_cap[FIXED_CAP_LEN], var_cap[VAR_CAP_LEN] = ""; |
|
|
bool reconnect = false; |
|
|
bool reconnect = false; |
|
|
@@ -830,7 +830,7 @@ void slimproto(log_level level, char *se
|
|
|
|
|
|
|
|
|
@@ -834,7 +834,7 @@ void slimproto(log_level level, char *server, u8_t mac[6], const char *name, con
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!slimproto_ip) { |
|
|
if (!slimproto_ip) { |
|
@ -147,7 +121,7 @@ Index: squeezelite-1.9.1-1130/slimproto.c |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!slimproto_port) { |
|
|
if (!slimproto_port) { |
|
|
@@ -911,7 +911,7 @@ void slimproto(log_level level, char *se
|
|
|
|
|
|
|
|
|
@@ -915,7 +915,7 @@ void slimproto(log_level level, char *server, u8_t mac[6], const char *name, con
|
|
|
|
|
|
|
|
|
// rediscover server if it was not set at startup |
|
|
// rediscover server if it was not set at startup |
|
|
if (!server && ++failed_connect > 5) { |
|
|
if (!server && ++failed_connect > 5) { |
|
@ -156,10 +130,28 @@ Index: squeezelite-1.9.1-1130/slimproto.c |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
Index: squeezelite-1.9.1-1130/utils.c
|
|
|
|
|
|
===================================================================
|
|
|
|
|
|
--- squeezelite-1.9.1-1130.orig/utils.c
|
|
|
|
|
|
+++ squeezelite-1.9.1-1130/utils.c
|
|
|
|
|
|
|
|
|
--- a/squeezelite.h
|
|
|
|
|
|
+++ b/squeezelite.h
|
|
|
|
|
|
@@ -455,7 +455,7 @@ char* strcasestr(const char *haystack, const char *needle);
|
|
|
|
|
|
|
|
|
|
|
|
char *next_param(char *src, char c); |
|
|
|
|
|
u32_t gettime_ms(void); |
|
|
|
|
|
-void get_mac(u8_t *mac);
|
|
|
|
|
|
+in_addr_t get_iface_info(log_level level, char *iface, u8_t *mac);
|
|
|
|
|
|
void set_nonblock(sockfd s); |
|
|
|
|
|
int connect_timeout(sockfd sock, const struct sockaddr *addr, socklen_t addrlen, int timeout); |
|
|
|
|
|
void server_addr(char *server, in_addr_t *ip_ptr, unsigned *port_ptr); |
|
|
|
|
|
@@ -511,7 +511,7 @@ void buf_init(struct buffer *buf, size_t size);
|
|
|
|
|
|
void buf_destroy(struct buffer *buf); |
|
|
|
|
|
|
|
|
|
|
|
// slimproto.c |
|
|
|
|
|
-void slimproto(log_level level, char *server, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate);
|
|
|
|
|
|
+void slimproto(log_level level, char *server, in_addr_t bcast_addr, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate);
|
|
|
|
|
|
void slimproto_stop(void); |
|
|
|
|
|
void wake_controller(void); |
|
|
|
|
|
|
|
|
|
|
|
--- a/utils.c
|
|
|
|
|
|
+++ b/utils.c
|
|
|
@@ -22,11 +22,11 @@
|
|
|
@@ -22,11 +22,11 @@
|
|
|
#include "squeezelite.h" |
|
|
#include "squeezelite.h" |
|
|
|
|
|
|
|
@ -175,9 +167,9 @@ Index: squeezelite-1.9.1-1130/utils.c |
|
|
#include <net/if_dl.h> |
|
|
#include <net/if_dl.h> |
|
|
#include <net/if_types.h> |
|
|
#include <net/if_types.h> |
|
|
#endif |
|
|
#endif |
|
|
@@ -44,15 +44,11 @@
|
|
|
|
|
|
#if WIN |
|
|
|
|
|
#include <iphlpapi.h> |
|
|
|
|
|
|
|
|
@@ -49,15 +49,11 @@
|
|
|
|
|
|
#include <ctype.h> |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
-#if OSX
|
|
|
-#if OSX
|
|
|
-#include <net/if_dl.h>
|
|
|
-#include <net/if_dl.h>
|
|
@ -193,7 +185,7 @@ Index: squeezelite-1.9.1-1130/utils.c |
|
|
// logging functions |
|
|
// logging functions |
|
|
const char *logtime(void) { |
|
|
const char *logtime(void) { |
|
|
static char buf[100]; |
|
|
static char buf[100]; |
|
|
@@ -114,58 +110,94 @@ u32_t gettime_ms(void) {
|
|
|
|
|
|
|
|
|
@@ -119,58 +115,94 @@ u32_t gettime_ms(void) {
|
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -228,23 +220,29 @@ Index: squeezelite-1.9.1-1130/utils.c |
|
|
+ unsigned char *ptr;
|
|
|
+ unsigned char *ptr;
|
|
|
+ in_addr_t bcast_addr = 0;
|
|
|
+ in_addr_t bcast_addr = 0;
|
|
|
+ int have_mac = 0, have_ifname = 0;
|
|
|
+ int have_mac = 0, have_ifname = 0;
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
+ loglevel = level;
|
|
|
+ loglevel = level;
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- mac[0] = mac[1] = mac[2] = mac[3] = mac[4] = mac[5] = 0;
|
|
|
+ // Check for non-zero MAC
|
|
|
+ // Check for non-zero MAC
|
|
|
+ if (mac[0] | mac[1] | mac[2] != 0)
|
|
|
+ if (mac[0] | mac[1] | mac[2] != 0)
|
|
|
+ have_mac = 1;
|
|
|
+ have_mac = 1;
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- int s = socket(AF_INET, SOCK_DGRAM, 0);
|
|
|
+ // Copy interface name, if it was provided.
|
|
|
+ // Copy interface name, if it was provided.
|
|
|
+ if (iface != NULL) {
|
|
|
+ if (iface != NULL) {
|
|
|
+ if (strlen(iface) > sizeof(ifname))
|
|
|
+ if (strlen(iface) > sizeof(ifname))
|
|
|
+ return -1;
|
|
|
+ return -1;
|
|
|
|
|
|
|
|
|
+ strncpy(ifname, iface, sizeof(ifname));
|
|
|
|
|
|
|
|
|
- ifc.ifc_len = sizeof(ifs);
|
|
|
|
|
|
- ifc.ifc_req = ifs;
|
|
|
|
|
|
+ strncpy(ifname, iface, sizeof(ifname) - 1);
|
|
|
+ have_ifname = 1;
|
|
|
+ have_ifname = 1;
|
|
|
} |
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- mac[0] = mac[1] = mac[2] = mac[3] = mac[4] = mac[5] = 0;
|
|
|
|
|
|
|
|
|
- if (ioctl(s, SIOCGIFCONF, &ifc) == 0) {
|
|
|
|
|
|
- ifend = ifs + (ifc.ifc_len / sizeof(struct ifreq));
|
|
|
+ if (getifaddrs(&addrs) == 0) {
|
|
|
+ if (getifaddrs(&addrs) == 0) {
|
|
|
+ //iterate to find corresponding ethernet address
|
|
|
+ //iterate to find corresponding ethernet address
|
|
|
+ for (ifa = addrs; ifa; ifa = ifa->ifa_next) {
|
|
|
+ for (ifa = addrs; ifa; ifa = ifa->ifa_next) {
|
|
@ -255,11 +253,10 @@ Index: squeezelite-1.9.1-1130/utils.c |
|
|
+ || !ifa->ifa_flags & IFF_BROADCAST) {
|
|
|
+ || !ifa->ifa_flags & IFF_BROADCAST) {
|
|
|
+ continue;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- int s = socket(AF_INET, SOCK_DGRAM, 0);
|
|
|
|
|
|
|
|
|
+
|
|
|
+ if (!have_ifname) {
|
|
|
+ if (!have_ifname) {
|
|
|
+ // We have found a valid interface name. Keep it.
|
|
|
+ // We have found a valid interface name. Keep it.
|
|
|
+ strncpy(ifname, ifa->ifa_name, sizeof(ifname));
|
|
|
|
|
|
|
|
|
+ strncpy(ifname, ifa->ifa_name, sizeof(ifname) - 1);
|
|
|
+ have_ifname = 1;
|
|
|
+ have_ifname = 1;
|
|
|
+ } else {
|
|
|
+ } else {
|
|
|
+ if (strncmp(ifname, ifa->ifa_name, sizeof(ifname)) != 0) {
|
|
|
+ if (strncmp(ifname, ifa->ifa_name, sizeof(ifname)) != 0) {
|
|
@ -268,11 +265,15 @@ Index: squeezelite-1.9.1-1130/utils.c |
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- ifc.ifc_len = sizeof(ifs);
|
|
|
|
|
|
- ifc.ifc_req = ifs;
|
|
|
|
|
|
|
|
|
- for (ifr = ifc.ifc_req; ifr < ifend; ifr++) {
|
|
|
|
|
|
- if (ifr->ifr_addr.sa_family == AF_INET) {
|
|
|
|
|
|
|
|
|
- if (ioctl(s, SIOCGIFCONF, &ifc) == 0) {
|
|
|
|
|
|
- ifend = ifs + (ifc.ifc_len / sizeof(struct ifreq));
|
|
|
|
|
|
|
|
|
- strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name) - 1);
|
|
|
|
|
|
- if (ioctl (s, SIOCGIFHWADDR, &ifreq) == 0) {
|
|
|
|
|
|
- memcpy(mac, ifreq.ifr_hwaddr.sa_data, 6);
|
|
|
|
|
|
- if (mac[0]+mac[1]+mac[2] != 0) {
|
|
|
|
|
|
- break;
|
|
|
|
|
|
- }
|
|
|
+ // Check address family.
|
|
|
+ // Check address family.
|
|
|
+ if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET &&
|
|
|
+ if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET &&
|
|
|
+ ((struct sockaddr_in *)ifa->ifa_broadaddr)->sin_addr.s_addr != 0) {
|
|
|
+ ((struct sockaddr_in *)ifa->ifa_broadaddr)->sin_addr.s_addr != 0) {
|
|
@ -286,16 +287,7 @@ Index: squeezelite-1.9.1-1130/utils.c |
|
|
+ have_ifname = 0;
|
|
|
+ have_ifname = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- for (ifr = ifc.ifc_req; ifr < ifend; ifr++) {
|
|
|
|
|
|
- if (ifr->ifr_addr.sa_family == AF_INET) {
|
|
|
|
|
|
-
|
|
|
|
|
|
- strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
|
|
|
|
|
|
- if (ioctl (s, SIOCGIFHWADDR, &ifreq) == 0) {
|
|
|
|
|
|
- memcpy(mac, ifreq.ifr_hwaddr.sa_data, 6);
|
|
|
|
|
|
- if (mac[0]+mac[1]+mac[2] != 0) {
|
|
|
|
|
|
- break;
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
+
|
|
|
+ // Find MAC address matching interface
|
|
|
+ // Find MAC address matching interface
|
|
|
+ if (!have_mac && bcast_addr != 0) {
|
|
|
+ if (!have_mac && bcast_addr != 0) {
|
|
|
+ for (ifa = addrs; ifa; ifa = ifa->ifa_next) {
|
|
|
+ for (ifa = addrs; ifa; ifa = ifa->ifa_next) {
|
|
@ -324,7 +316,7 @@ Index: squeezelite-1.9.1-1130/utils.c |
|
|
#if SUN |
|
|
#if SUN |
|
|
void get_mac(u8_t mac[]) { |
|
|
void get_mac(u8_t mac[]) { |
|
|
struct arpreq parpreq; |
|
|
struct arpreq parpreq; |
|
|
@@ -232,30 +264,6 @@ void get_mac(u8_t mac[]) {
|
|
|
|
|
|
|
|
|
@@ -237,30 +269,6 @@ void get_mac(u8_t mac[]) {
|
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|