aboutsummaryrefslogtreecommitdiff
path: root/src/pkt.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-05-27 20:53:13 +0200
committerToni Uhlig <matzeton@googlemail.com>2020-05-27 20:53:13 +0200
commit011c923648a6998b483a3d5ee8f462fe7100b6a7 (patch)
treee8532bff322a6aed3d94a87284f5aa6e18f5d6b3 /src/pkt.c
parentd2e92ee748f3b3e826ffcbf665adc45637ad9045 (diff)
re-enabled and improved logging of packet headers and payload (SEND)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/pkt.c')
-rw-r--r--src/pkt.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pkt.c b/src/pkt.c
index cae71de..90ae7da 100644
--- a/src/pkt.c
+++ b/src/pkt.c
@@ -237,7 +237,7 @@ void handle_packet(char * buf, unsigned bytes, int is_pcap, struct sockaddr_in *
}
if (opts.udp || opts.unprivileged) {
- ip_pkt = 0;
+ ip_pkt = NULL;
pkt = (icmp_echo_packet_t *)buf;
pt_pkt = (ping_tunnel_pkt_t *)pkt->data;
} else {
@@ -297,9 +297,8 @@ void handle_packet(char * buf, unsigned bytes, int is_pcap, struct sockaddr_in *
is_pcap);
log_sendrecv_hexstr("RECV ICMP", pkt, sizeof(*pkt));
log_sendrecv_hexstr("RECV PTNG", pt_pkt, sizeof(*pt_pkt));
- if (bytes > sizeof(icmp_echo_packet_t) + sizeof(ping_tunnel_pkt_t)) {
- log_sendrecv_hexstr("RECV PAYL", buf + sizeof(icmp_echo_packet_t) + sizeof(ping_tunnel_pkt_t),
- bytes - sizeof(icmp_echo_packet_t) - sizeof(ping_tunnel_pkt_t));
+ if (bytes - (pt_pkt->data - buf) > 0) {
+ log_sendrecv_hexstr("RECV PAYL", pt_pkt->data, bytes - (pt_pkt->data - buf));
}
/* This test essentially verifies that the packet comes from someone who isn't us. */