mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed warnings.
This commit is contained in:
parent
04e7b0eb6c
commit
20a8fb8a23
|
@ -588,7 +588,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
int on = 0;
|
||||
int c = 0;
|
||||
int i = 0;
|
||||
char *filename = "data";
|
||||
char idstring[200] = {0};
|
||||
Tox *m;
|
||||
|
|
|
@ -30,10 +30,13 @@
|
|||
#define MAX_INTERFACES 16
|
||||
|
||||
#ifdef __linux
|
||||
#ifndef TOX_ENABLE_IPV6
|
||||
/* Send packet to all broadcast addresses
|
||||
*
|
||||
* return higher than 0 on success.
|
||||
* return 0 on error.
|
||||
*
|
||||
* TODO: Make this work with IPv6 and remove the #ifndef TOX_ENABLE_IPV6.
|
||||
*/
|
||||
static uint32_t send_broadcasts(Networking_Core *net, uint16_t port, uint8_t *data, uint16_t length)
|
||||
{
|
||||
|
@ -80,6 +83,7 @@ static uint32_t send_broadcasts(Networking_Core *net, uint16_t port, uint8_t *da
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Return the broadcast ip. */
|
||||
static IP broadcast_ip(sa_family_t family_socket, sa_family_t family_broadcast)
|
||||
|
@ -161,7 +165,7 @@ static int LAN_ip(IP ip)
|
|||
} else if (ip.family == AF_INET6)
|
||||
{
|
||||
/* autogenerated for each interface: FE80::* (up to FEBF::*)
|
||||
/* FF02::1 is - according to RFC 4291 - multicast all-nodes link-local */
|
||||
FF02::1 is - according to RFC 4291 - multicast all-nodes link-local */
|
||||
if (((ip.ip6.s6_addr[0] == 0xFF) && (ip.ip6.s6_addr[1] < 3) && (ip.ip6.s6_addr[15] == 1)) ||
|
||||
((ip.ip6.s6_addr[0] == 0xFE) && ((ip.ip6.s6_addr[1] & 0xC0) == 0x80)))
|
||||
return 0;
|
||||
|
@ -202,9 +206,10 @@ int send_LANdiscovery(uint16_t port, Net_Crypto *c)
|
|||
memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES);
|
||||
|
||||
#ifdef __linux
|
||||
#ifndef TOX_ENABLE_IPV6
|
||||
send_broadcasts(c->lossless_udp->net, port, data, 1 + crypto_box_PUBLICKEYBYTES);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
int res = -1;
|
||||
IP_Port ip_port;
|
||||
ip_port.port = port;
|
||||
|
|
Loading…
Reference in New Issue
Block a user