1 | /* |
1 | /* |
2 | vpn.C -- handle the protocol, encryption, handshaking etc. |
2 | vpn.C -- handle the protocol, encryption, handshaking etc. |
3 | Copyright (C) 2003-2008 Marc Lehmann <gvpe@schmorp.de> |
3 | Copyright (C) 2003-2008,2010,2011 Marc Lehmann <gvpe@schmorp.de> |
4 | |
4 | |
5 | This file is part of GVPE. |
5 | This file is part of GVPE. |
6 | |
6 | |
7 | GVPE is free software; you can redistribute it and/or modify it |
7 | GVPE is free software; you can redistribute it and/or modify it |
8 | under the terms of the GNU General Public License as published by the |
8 | under the terms of the GNU General Public License as published by the |
… | |
… | |
559 | if (len > 0) |
559 | if (len > 0) |
560 | { |
560 | { |
561 | pkt->len = len; |
561 | pkt->len = len; |
562 | |
562 | |
563 | // raw sockets deliver the ipv4 header, but don't expect it on sends |
563 | // raw sockets deliver the ipv4 header, but don't expect it on sends |
564 | pkt->skip_hdr (IP_OVERHEAD); |
564 | pkt->skip_hdr (pkt->ipv4_hdr_len ()); |
565 | |
565 | |
566 | recv_vpn_packet (pkt, si); |
566 | recv_vpn_packet (pkt, si); |
567 | } |
567 | } |
568 | else |
568 | else |
569 | { |
569 | { |
… | |
… | |
606 | if (hdr->type == ::conf.icmp_type |
606 | if (hdr->type == ::conf.icmp_type |
607 | && hdr->code == 255) |
607 | && hdr->code == 255) |
608 | { |
608 | { |
609 | // raw sockets deliver the ipv4, but don't expect it on sends |
609 | // raw sockets deliver the ipv4, but don't expect it on sends |
610 | // this is slow, but... |
610 | // this is slow, but... |
611 | pkt->skip_hdr (ICMP_OVERHEAD); |
611 | pkt->skip_hdr (pkt->ipv4_hdr_len () + (ICMP_OVERHEAD - IP_OVERHEAD)); |
612 | |
612 | |
613 | recv_vpn_packet (pkt, si); |
613 | recv_vpn_packet (pkt, si); |
614 | } |
614 | } |
615 | } |
615 | } |
616 | else |
616 | else |