X-Git-Url: https://git.sesse.net/?p=greproxy;a=blobdiff_plain;f=greprotocol.cpp;h=6f3513039ed67e00706bd2458cab0970c0cb3764;hp=8a400534a59c52d91343ac7767f1d4247b186c58;hb=HEAD;hpb=4c15e1ffd081f5e2f7840a6dea58b131c4358533 diff --git a/greprotocol.cpp b/greprotocol.cpp index 8a40053..6f35130 100644 --- a/greprotocol.cpp +++ b/greprotocol.cpp @@ -51,7 +51,7 @@ GREProtocol::GREProtocol(const in6_addr &src, const in6_addr &dst) } } -void GREProtocol::send_packet(uint16_t proto, const string &data, int incoming_seq) +void GREProtocol::send_packet(uint16_t proto, const string &data, uint32_t incoming_seq) { char buf[4096]; gre_header *gre = (gre_header *)buf; @@ -62,7 +62,7 @@ void GREProtocol::send_packet(uint16_t proto, const string &data, int incoming_s gre->protocol_type = htons(proto); char *ptr = buf + sizeof(*gre); - int seq_be = htonl(incoming_seq); + uint32_t seq_be = htonl(incoming_seq); memcpy(ptr, &seq_be, sizeof(seq_be)); ptr += sizeof(seq_be); @@ -72,6 +72,8 @@ void GREProtocol::send_packet(uint16_t proto, const string &data, int incoming_s perror("sendto"); return; } + + ++sent_packets; } int GREProtocol::fd() const @@ -114,6 +116,7 @@ void GREProtocol::read_packet(Sender *sender) //printf("gre packet: proto=%x\n", ntohs(gre->protocol_type)); + ++received_packets; sender->send_packet(ntohs(gre->protocol_type), string(ptr, buf + ret), seq); }