mirror of
https://github.com/cesanta/mongoose.git
synced 2026-12-04 21:58:22 +00:00
use link-local and global accordingly
This commit is contained in:
1 parent
f3189519d8
commit
d597b89bd4
3 files changed
+98
-64
No files matched your search
@@ -328,6 +328,8 @@ static void init_tests(struct mg_mgr *mgr, struct eth *e, struct ipp *ipp,
|
||||
mif->driver_data = &s_driver_data;
|
||||
#if MG_ENABLE_IPV6
|
||||
if (ipp->ip6 != NULL) {
|
||||
mif->ip6ll[0] = mg_htonll(0xfe80000000000000);
|
||||
mif->ip6ll[1] = mg_htonll(1);
|
||||
mif->ip6[0] = mg_htonll(0x100000000000000);
|
||||
mif->prefix[0] = 1;
|
||||
mif->prefix_len = 64;
|
||||
@@ -664,6 +666,16 @@ static void test_tcp_basics(bool ipv6) {
|
||||
ASSERT((t->ack == mg_htonl(1002)));
|
||||
// make sure it is closed
|
||||
ASSERT(mgr.conns->next == NULL); // only one connection: the listener
|
||||
#if MG_ENABLE_IPV6
|
||||
// Test we use link-local address for link-local peers
|
||||
if (ipv6) {
|
||||
ip6.src[0] = mif.ip6ll[0], ip6.src[1] = mg_htonll(2);
|
||||
ip6.dst[0] = mif.ip6ll[0], ip6.dst[1] = mif.ip6ll[1];
|
||||
init_tcp_handshake(&e, &ipp, &mgr);
|
||||
ASSERT(mgr.conns->loc.addr.ip6[0] == mif.ip6ll[0] &&
|
||||
mgr.conns->loc.addr.ip6[1] == mif.ip6ll[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
s_driver_data.len = 0;
|
||||
mg_mgr_free(&mgr);
|
||||
@@ -1513,6 +1525,18 @@ static void test_udp(bool ipv6) {
|
||||
ASSERT((uint8_t) (((i6->ver & 15) << 2) | (i6->label[0] >> 6)) ==
|
||||
MG_DSCP_AF(4, 1));
|
||||
ASSERT(udp6csum_ok(i6, u));
|
||||
#if MG_ENABLE_IPV6
|
||||
// Test we use link-local address for link-local peers
|
||||
mgr.conns->recv.len = 0;
|
||||
ip6.src[0] = mif.ip6ll[0], ip6.src[1] = mg_htonll(2);
|
||||
ip6.dst[0] = mif.ip6ll[0], ip6.dst[1] = mif.ip6ll[1];
|
||||
s_driver_data.len = 0;
|
||||
create_udp_dat(&e, &ipp, 1, 888, 2);
|
||||
mg_mgr_poll(&mgr, 0);
|
||||
ASSERT(received_response(&s_driver_data));
|
||||
ASSERT(i6->src[0] == mif.ip6ll[0] && i6->src[1] == mif.ip6ll[1] &&
|
||||
i6->dst[0] == ip6.src[0] && i6->dst[1] == ip6.src[1]);
|
||||
#endif
|
||||
} else {
|
||||
ASSERT(i->src == mg_htonl(0x1000000) && i->dst == mg_htonl(0x2000000));
|
||||
ASSERT(i->tos == (MG_DSCP_AF(4, 1) << 2));
|
||||
|
||||
Reference in new issue
Block a user