|
|
|
|
@ -93,8 +93,7 @@ static int sockmeta4_list_equal(struct TOPO_SOCKMETA4* a, struct TOPO_SOCKMETA4*
|
|
|
|
|
while (a && b) { |
|
|
|
|
if (a->id != b->id || a->config_type != b->config_type || |
|
|
|
|
a->address_profile.source != b->address_profile.source || |
|
|
|
|
a->address_profile.mapping != b->address_profile.mapping || a->address_profile.inbound != b->address_profile.inbound || |
|
|
|
|
a->address_profile.evidence_id != b->address_profile.evidence_id || a->address_profile.checked_at != b->address_profile.checked_at) |
|
|
|
|
a->address_profile.mapping != b->address_profile.mapping || a->address_profile.inbound != b->address_profile.inbound) |
|
|
|
|
return 0; |
|
|
|
|
a = a->next; b = b->next; |
|
|
|
|
} |
|
|
|
|
@ -112,8 +111,7 @@ static int sockmeta6_list_equal(struct TOPO_SOCKMETA6* a, struct TOPO_SOCKMETA6*
|
|
|
|
|
while (a && b) { |
|
|
|
|
if (a->id != b->id || a->config_type != b->config_type || |
|
|
|
|
a->address_profile.source != b->address_profile.source || |
|
|
|
|
a->address_profile.mapping != b->address_profile.mapping || a->address_profile.inbound != b->address_profile.inbound || |
|
|
|
|
a->address_profile.evidence_id != b->address_profile.evidence_id || a->address_profile.checked_at != b->address_profile.checked_at) |
|
|
|
|
a->address_profile.mapping != b->address_profile.mapping || a->address_profile.inbound != b->address_profile.inbound) |
|
|
|
|
return 0; |
|
|
|
|
a = a->next; b = b->next; |
|
|
|
|
} |
|
|
|
|
@ -350,19 +348,11 @@ void topo_node_registry_unref(struct TOPO_GROUPS* groups, uint64_t node_id) {
|
|
|
|
|
static void sockmeta_wire_write(uint8_t *out, uint8_t id, uint8_t config, const struct address_profile *profile) { |
|
|
|
|
out[0] = id; out[1] = config; out[2] = profile->mapping; out[3] = profile->inbound; |
|
|
|
|
out[4] = profile->source; |
|
|
|
|
for (unsigned i = 0; i < 8; i++) { |
|
|
|
|
out[5 + i] = (uint8_t)(profile->evidence_id >> (56 - i * 8)); |
|
|
|
|
out[13 + i] = (uint8_t)(profile->checked_at >> (56 - i * 8)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int sockmeta_wire_read(const uint8_t *in, struct address_profile *profile) { |
|
|
|
|
memset(profile, 0, sizeof(*profile)); profile->mapping = in[2]; profile->inbound = in[3]; |
|
|
|
|
profile->source = in[4]; |
|
|
|
|
for (unsigned i = 0; i < 8; i++) { |
|
|
|
|
profile->evidence_id = (profile->evidence_id << 8) | in[5 + i]; |
|
|
|
|
profile->checked_at = (profile->checked_at << 8) | in[13 + i]; |
|
|
|
|
} |
|
|
|
|
if (!address_profile_valid(profile)) { DEBUG_WARN(DEBUG_CATEGORY_BGP, "invalid address profile in NODEINFO"); return -1; } |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
@ -834,10 +824,9 @@ void topo_node_dump_all(struct TOPO_GROUP* group) {
|
|
|
|
|
|
|
|
|
|
int si = 0; |
|
|
|
|
{ struct TOPO_SOCKMETA4* sm = ni->v4_sock_meta; while (sm) { |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, " v4sock[%d]: id=%u config=%u mapping=%s inbound=%s evidence=%016llx checked=%llu", |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, " v4sock[%d]: id=%u config=%u mapping=%s inbound=%s source=%s", |
|
|
|
|
si++, sm->id, sm->config_type, address_mapping_name(sm->address_profile.mapping), |
|
|
|
|
address_inbound_name(sm->address_profile.inbound), (unsigned long long)sm->address_profile.evidence_id, |
|
|
|
|
(unsigned long long)sm->address_profile.checked_at); |
|
|
|
|
address_inbound_name(sm->address_profile.inbound), address_profile_source_name(sm->address_profile.source)); |
|
|
|
|
sm = sm->next; |
|
|
|
|
}} |
|
|
|
|
{ const char* atn[] = {"INTERFACE","NAT","REAL"}; |
|
|
|
|
@ -848,10 +837,9 @@ void topo_node_dump_all(struct TOPO_GROUP* group) {
|
|
|
|
|
a = a->next; |
|
|
|
|
}} |
|
|
|
|
{ int si6 = 0; struct TOPO_SOCKMETA6* sm6 = ni->v6_sock_meta; while (sm6) { |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, " v6sock[%d]: id=%u config=%u mapping=%s inbound=%s evidence=%016llx checked=%llu", |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, " v6sock[%d]: id=%u config=%u mapping=%s inbound=%s source=%s", |
|
|
|
|
si6++, sm6->id, sm6->config_type, address_mapping_name(sm6->address_profile.mapping), |
|
|
|
|
address_inbound_name(sm6->address_profile.inbound), (unsigned long long)sm6->address_profile.evidence_id, |
|
|
|
|
(unsigned long long)sm6->address_profile.checked_at); |
|
|
|
|
address_inbound_name(sm6->address_profile.inbound), address_profile_source_name(sm6->address_profile.source)); |
|
|
|
|
sm6 = sm6->next; |
|
|
|
|
}} |
|
|
|
|
{ int ai6 = 0; struct TOPO_ADDR6* a6 = ni->v6_addrs; while (a6) { |
|
|
|
|
@ -931,9 +919,9 @@ int topo_node_format_all(struct TOPO_GROUP* group, char* buf, size_t buf_size) {
|
|
|
|
|
FMT_ADD(" ed25519: "); for (int k = 0; k < SC_PUBKEY_SIZE; k++) FMT_ADD("%02x", ni->ed25519_public_key[k]); FMT_ADD("\n"); |
|
|
|
|
|
|
|
|
|
{ struct TOPO_SOCKMETA4* sm = ni->v4_sock_meta; int si = 0; while (sm) { |
|
|
|
|
FMT_ADD(" v4sock[%d]: id=%u config=%u mapping=%s inbound=%s checked=%llu\n", si++, sm->id, sm->config_type, |
|
|
|
|
FMT_ADD(" v4sock[%d]: id=%u config=%u mapping=%s inbound=%s source=%s\n", si++, sm->id, sm->config_type, |
|
|
|
|
address_mapping_name(sm->address_profile.mapping), address_inbound_name(sm->address_profile.inbound), |
|
|
|
|
(unsigned long long)sm->address_profile.checked_at); sm = sm->next; |
|
|
|
|
address_profile_source_name(sm->address_profile.source)); sm = sm->next; |
|
|
|
|
}} |
|
|
|
|
{ const char* atn[] = {"INTERFACE","NAT","REAL"}; struct TOPO_ADDR4* a = ni->v4_addrs; int ai = 0; while (a) { |
|
|
|
|
const char* proto = (a->protocol & TOPO_PROTO_REALITY) ? "tcp+reality" : (a->protocol & TOPO_PROTO_TCP) ? "tcp" : (a->protocol & TOPO_PROTO_UDP) ? "udp" : "?"; |
|
|
|
|
@ -942,9 +930,9 @@ int topo_node_format_all(struct TOPO_GROUP* group, char* buf, size_t buf_size) {
|
|
|
|
|
a = a->next; |
|
|
|
|
}} |
|
|
|
|
{ struct TOPO_SOCKMETA6* sm6 = ni->v6_sock_meta; int s6i = 0; while (sm6) { |
|
|
|
|
FMT_ADD(" v6sock[%d]: id=%u config=%u mapping=%s inbound=%s checked=%llu\n", s6i++, sm6->id, sm6->config_type, |
|
|
|
|
FMT_ADD(" v6sock[%d]: id=%u config=%u mapping=%s inbound=%s source=%s\n", s6i++, sm6->id, sm6->config_type, |
|
|
|
|
address_mapping_name(sm6->address_profile.mapping), address_inbound_name(sm6->address_profile.inbound), |
|
|
|
|
(unsigned long long)sm6->address_profile.checked_at); sm6 = sm6->next; |
|
|
|
|
address_profile_source_name(sm6->address_profile.source)); sm6 = sm6->next; |
|
|
|
|
}} |
|
|
|
|
{ struct TOPO_ADDR6* a6 = ni->v6_addrs; int a6i = 0; while (a6) { |
|
|
|
|
const char* proto = (a6->protocol & TOPO_PROTO_REALITY) ? "tcp+reality" : (a6->protocol & TOPO_PROTO_TCP) ? "tcp" : (a6->protocol & TOPO_PROTO_UDP) ? "udp" : "?"; |
|
|
|
|
|