diff options
Diffstat (limited to 'src/nat/gnunet-service-nat.c')
-rw-r--r-- | src/nat/gnunet-service-nat.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c index 8e7ce51e9..8d771f474 100644 --- a/src/nat/gnunet-service-nat.c +++ b/src/nat/gnunet-service-nat.c | |||
@@ -485,9 +485,8 @@ match_ipv6 (const char *network, | |||
485 | network, | 485 | network, |
486 | &net)); | 486 | &net)); |
487 | memset (&mask, 0, sizeof (mask)); | 487 | memset (&mask, 0, sizeof (mask)); |
488 | if (0 == memcmp (&mask, | 488 | if (0 == GNUNET_memcmp (&mask, |
489 | ip, | 489 | ip)) |
490 | sizeof (mask))) | ||
491 | return GNUNET_YES; | 490 | return GNUNET_YES; |
492 | off = 0; | 491 | off = 0; |
493 | while (bits > 8) | 492 | while (bits > 8) |
@@ -731,9 +730,8 @@ check_notify_client (struct LocalAddressList *delta, | |||
731 | (! is_nat_v4 (&v4.sin_addr)) ) | 730 | (! is_nat_v4 (&v4.sin_addr)) ) |
732 | continue; /* based on external-IP, but this IP is not | 731 | continue; /* based on external-IP, but this IP is not |
733 | from private address range. */ | 732 | from private address range. */ |
734 | if ( (0 != memcmp (&v4.sin_addr, | 733 | if ( (0 != GNUNET_memcmp (&v4.sin_addr, |
735 | &c4->sin_addr, | 734 | &c4->sin_addr)) && |
736 | sizeof (struct in_addr))) && | ||
737 | (0 != c4->sin_addr.s_addr) && | 735 | (0 != c4->sin_addr.s_addr) && |
738 | (! is_nat_v4 (&c4->sin_addr)) ) | 736 | (! is_nat_v4 (&c4->sin_addr)) ) |
739 | continue; /* this IP is not from private address range, | 737 | continue; /* this IP is not from private address range, |
@@ -762,37 +760,31 @@ check_notify_client (struct LocalAddressList *delta, | |||
762 | continue; /* IPv4 not relevant */ | 760 | continue; /* IPv4 not relevant */ |
763 | c6 = (const struct sockaddr_in6 *) &ch->caddrs[i].ss; | 761 | c6 = (const struct sockaddr_in6 *) &ch->caddrs[i].ss; |
764 | if ( match_ipv6 ("::1", &c6->sin6_addr, 128) && | 762 | if ( match_ipv6 ("::1", &c6->sin6_addr, 128) && |
765 | (0 != memcmp (&c6->sin6_addr, | 763 | (0 != GNUNET_memcmp (&c6->sin6_addr, |
766 | &in6addr_any, | 764 | &in6addr_any)) && |
767 | sizeof (struct in6_addr))) && | ||
768 | (! match_ipv6 ("::1", &v6.sin6_addr, 128)) ) | 765 | (! match_ipv6 ("::1", &v6.sin6_addr, 128)) ) |
769 | continue; /* bound to loopback, but this is not loopback */ | 766 | continue; /* bound to loopback, but this is not loopback */ |
770 | if ( (! match_ipv6 ("::1", &c6->sin6_addr, 128) ) && | 767 | if ( (! match_ipv6 ("::1", &c6->sin6_addr, 128) ) && |
771 | match_ipv6 ("::1", &v6.sin6_addr, 128) ) | 768 | match_ipv6 ("::1", &v6.sin6_addr, 128) ) |
772 | continue; /* bound to non-loopback, but this is loopback */ | 769 | continue; /* bound to non-loopback, but this is loopback */ |
773 | if ( (0 != (delta->ac & GNUNET_NAT_AC_EXTERN)) && | 770 | if ( (0 != (delta->ac & GNUNET_NAT_AC_EXTERN)) && |
774 | (0 != memcmp (&c6->sin6_addr, | 771 | (0 != GNUNET_memcmp (&c6->sin6_addr, |
775 | &in6addr_any, | 772 | &in6addr_any)) && |
776 | sizeof (struct in6_addr))) && | ||
777 | (! is_nat_v6 (&v6.sin6_addr)) ) | 773 | (! is_nat_v6 (&v6.sin6_addr)) ) |
778 | continue; /* based on external-IP, but this IP is not | 774 | continue; /* based on external-IP, but this IP is not |
779 | from private address range. */ | 775 | from private address range. */ |
780 | if ( (0 != memcmp (&v6.sin6_addr, | 776 | if ( (0 != GNUNET_memcmp (&v6.sin6_addr, |
781 | &c6->sin6_addr, | 777 | &c6->sin6_addr)) && |
782 | sizeof (struct in6_addr))) && | 778 | (0 != GNUNET_memcmp (&c6->sin6_addr, |
783 | (0 != memcmp (&c6->sin6_addr, | 779 | &in6addr_any)) && |
784 | &in6addr_any, | ||
785 | sizeof (struct in6_addr))) && | ||
786 | (! is_nat_v6 (&c6->sin6_addr)) ) | 780 | (! is_nat_v6 (&c6->sin6_addr)) ) |
787 | continue; /* this IP is not from private address range, | 781 | continue; /* this IP is not from private address range, |
788 | and IP does not match. */ | 782 | and IP does not match. */ |
789 | if ( (match_ipv6 ("fe80::", &c6->sin6_addr, 10)) && | 783 | if ( (match_ipv6 ("fe80::", &c6->sin6_addr, 10)) && |
790 | (0 != memcmp (&c6->sin6_addr, | 784 | (0 != GNUNET_memcmp (&c6->sin6_addr, |
791 | &in6addr_any, | 785 | &in6addr_any)) && |
792 | sizeof (struct in6_addr))) && | 786 | (0 != GNUNET_memcmp (&v6.sin6_addr, |
793 | (0 != memcmp (&v6.sin6_addr, | 787 | &c6->sin6_addr)) && |
794 | &c6->sin6_addr, | ||
795 | sizeof (struct in6_addr))) && | ||
796 | (0 == (delta->ac & GNUNET_NAT_AC_EXTERN)) ) | 788 | (0 == (delta->ac & GNUNET_NAT_AC_EXTERN)) ) |
797 | continue; /* client bound to link-local, and the other address | 789 | continue; /* client bound to link-local, and the other address |
798 | does not match and is not an external IP */ | 790 | does not match and is not an external IP */ |
@@ -1726,9 +1718,8 @@ handle_stun (void *cls, | |||
1726 | &se->stun_server_addr, | 1718 | &se->stun_server_addr, |
1727 | sa_len)) ) | 1719 | sa_len)) ) |
1728 | continue; /* different STUN server */ | 1720 | continue; /* different STUN server */ |
1729 | if (0 != memcmp (&external_addr, | 1721 | if (0 != GNUNET_memcmp (&external_addr, |
1730 | &se->external_addr, | 1722 | &se->external_addr)) |
1731 | sizeof (struct sockaddr_in))) | ||
1732 | { | 1723 | { |
1733 | /* external IP changed, update! */ | 1724 | /* external IP changed, update! */ |
1734 | notify_clients_stun_change (&se->external_addr, | 1725 | notify_clients_stun_change (&se->external_addr, |