… | |
… | |
1098 | break; |
1098 | break; |
1099 | |
1099 | |
1100 | case vpn_packet::PT_CONNECT_INFO: |
1100 | case vpn_packet::PT_CONNECT_INFO: |
1101 | if (ictx && octx && rsi == si && pkt->hmac_chk (ictx)) |
1101 | if (ictx && octx && rsi == si && pkt->hmac_chk (ictx)) |
1102 | { |
1102 | { |
1103 | connect_info_packet *p = (connect_info_packet *) pkt; |
1103 | connect_info_packet *p = (connect_info_packet *)pkt; |
1104 | |
1104 | |
1105 | assert (p->id > 0 && p->id <= vpn->conns.size ()); // hmac-auth does not mean we accept anything |
1105 | if (p->id > 0 && p->id <= vpn->conns.size ()) // hmac-auth does not mean we accept anything |
1106 | |
1106 | { |
1107 | connection *c = vpn->conns[p->id - 1]; |
1107 | connection *c = vpn->conns[p->id - 1]; |
1108 | |
1108 | |
1109 | c->conf->protocols = p->protocols; |
1109 | c->conf->protocols = p->protocols; |
1110 | protocol = best_protocol (c->conf->protocols & THISNODE->protocols & p->si.supported_protocols (c->conf)); |
1110 | protocol = best_protocol (c->conf->protocols & THISNODE->protocols & p->si.supported_protocols (c->conf)); |
1111 | p->si.upgrade_protocol (protocol, c->conf); |
1111 | p->si.upgrade_protocol (protocol, c->conf); |
1112 | |
1112 | |
1113 | slog (L_TRACE, "<<%d PT_CONNECT_INFO(%d,%s) (%d)", |
1113 | slog (L_TRACE, "<<%d PT_CONNECT_INFO(%d,%s) (%d)", |
1114 | conf->id, p->id, (const char *)p->si, !c->ictx && !c->octx); |
1114 | conf->id, p->id, (const char *)p->si, !c->ictx && !c->octx); |
1115 | |
1115 | |
1116 | const sockinfo &dsi = forward_si (p->si); |
1116 | const sockinfo &dsi = forward_si (p->si); |
1117 | |
1117 | |
1118 | if (dsi.valid ()) |
1118 | if (dsi.valid ()) |
1119 | c->send_auth_request (dsi, true); |
1119 | c->send_auth_request (dsi, true); |
|
|
1120 | } |
1120 | } |
1121 | } |
1121 | |
1122 | |
1122 | break; |
1123 | break; |
1123 | |
1124 | |
1124 | default: |
1125 | default: |