diff options
author | Johan Sternerup <johast@axis.com> | 2022-01-20 15:47:11 +0100 |
---|---|---|
committer | Johan Sternerup <johast@axis.com> | 2022-04-06 08:40:23 +0200 |
commit | 526eec8beaf9068b66caab6e1f941ec574e3b82a (patch) | |
tree | dd979631aa81f69e550fd350037253aa75422d8b /tests/test-address.c | |
parent | 642714943a554898645921eb39aa28d26da3f65c (diff) | |
download | libnice-526eec8beaf9068b66caab6e1f941ec574e3b82a.tar.gz |
Don't try to use link-local addresses outside local network
If we have gathered a host IP-address that is link-local we should
never try to use it for anything else than trying to match it with
another link-local address. Some routers seem to have problems with
traffic from link-local addresses destined at external IP-addresses.
By definition link-local addresses should stay local so there's no
reason to access STUN/TURN from it or try to form a candidate with
another address that is not link-local.
Diffstat (limited to 'tests/test-address.c')
-rw-r--r-- | tests/test-address.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test-address.c b/tests/test-address.c index 4b874c8..7ad8cb8 100644 --- a/tests/test-address.c +++ b/tests/test-address.c @@ -151,6 +151,40 @@ test_ipv4 (void) nice_address_free (heap_addr); } + + /* test link-local address check */ + { + NiceAddress *heap_addr = nice_address_new (); + + g_assert_true (nice_address_set_from_string(heap_addr, "169.253.255.255")); + g_assert_true (nice_address_is_linklocal (heap_addr) == FALSE); + + g_assert_true (nice_address_set_from_string(heap_addr, "169.254.0.0")); + g_assert_true (nice_address_is_linklocal (heap_addr) == TRUE); + + g_assert_true (nice_address_set_from_string(heap_addr, "169.254.255.255")); + g_assert_true (nice_address_is_linklocal (heap_addr) == TRUE); + + g_assert_true (nice_address_set_from_string (heap_addr, "127.0.0.1")); + g_assert_true (nice_address_is_linklocal (heap_addr) == FALSE); + + g_assert_true (nice_address_set_from_string(heap_addr, "172.31.255.255")); + g_assert_true (nice_address_is_linklocal (heap_addr) == FALSE); + + g_assert_true (nice_address_set_from_string(heap_addr, "192.168.15.69")); + g_assert_true (nice_address_is_linklocal (heap_addr) == FALSE); + + g_assert_true (nice_address_set_from_string(heap_addr, "fe70::0")); + g_assert_true (nice_address_is_linklocal (heap_addr) == FALSE); + + g_assert_true (nice_address_set_from_string(heap_addr, "fe80::0")); + g_assert_true (nice_address_is_linklocal (heap_addr) == TRUE); + + g_assert_true (nice_address_set_from_string(heap_addr, "fe81::0")); + g_assert_true (nice_address_is_linklocal (heap_addr) == TRUE); + + nice_address_free (heap_addr); + } } static void |