… | |
… | |
644 | { |
644 | { |
645 | connection *r = vpn->find_router (); |
645 | connection *r = vpn->find_router (); |
646 | |
646 | |
647 | if (r) |
647 | if (r) |
648 | { |
648 | { |
649 | slog (L_DEBUG, _("%s: no common protocol, trying indirectly through %s"), |
649 | slog (L_DEBUG, _("%s: no common protocol, trying indirectly through %s (%s)"), |
650 | conf->nodename, r->conf->nodename); |
650 | conf->nodename, r->conf->nodename, (const char *)r->si); |
651 | return r->si; |
651 | return r->si; |
652 | } |
652 | } |
653 | else |
653 | else |
654 | slog (L_DEBUG, _("%s: node unreachable, no common protocol"), |
654 | slog (L_DEBUG, _("%s: node unreachable, no common protocol"), |
655 | conf->nodename); |
655 | conf->nodename); |
… | |
… | |
659 | } |
659 | } |
660 | |
660 | |
661 | void |
661 | void |
662 | connection::send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos) |
662 | connection::send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos) |
663 | { |
663 | { |
664 | bool ok; |
664 | if (!vpn->send_vpn_packet (pkt, si, tos)) |
665 | |
|
|
666 | switch (si.prot) |
|
|
667 | { |
|
|
668 | case PROT_IPv4: |
|
|
669 | ok = vpn->send_ipv4_packet (pkt, si, tos); break; |
|
|
670 | case PROT_UDPv4: |
|
|
671 | ok = vpn->send_udpv4_packet (pkt, si, tos); break; |
|
|
672 | #if ENABLE_TCP |
|
|
673 | case PROT_TCPv4: |
|
|
674 | ok = vpn->send_tcpv4_packet (pkt, si, tos); break; |
|
|
675 | #endif |
|
|
676 | #if ENABLE_ICMP |
|
|
677 | case PROT_ICMPv4: |
|
|
678 | ok = vpn->send_icmpv4_packet (pkt, si, tos); break; |
|
|
679 | #endif |
|
|
680 | #if ENABLE_DNS |
|
|
681 | case PROT_DNSv4: |
|
|
682 | ok = send_dnsv4_packet (pkt, si, tos); break; |
|
|
683 | #endif |
|
|
684 | |
|
|
685 | default: |
|
|
686 | slog (L_CRIT, _("%s: FATAL: trying to send packet with unsupported protocol"), (const char *)si); |
|
|
687 | ok = false; |
|
|
688 | } |
|
|
689 | |
|
|
690 | if (!ok) |
|
|
691 | reset_connection (); |
665 | reset_connection (); |
692 | } |
666 | } |
693 | |
667 | |
694 | void |
668 | void |
695 | connection::send_ping (const sockinfo &si, u8 pong) |
669 | connection::send_ping (const sockinfo &si, u8 pong) |