aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaq- <tilt@techie.com>2019-01-25 04:35:18 +0000
committerMasaq- <tilt@techie.com>2019-01-25 04:35:18 +0000
commit5f64e0f141096c2f285cfdfa206506d01dafa309 (patch)
tree2d1072afbc6ef49d27d1a6950f4d7a44650ded9c
parentcea2b50c81db45d3f0eb19c327d2cc04bc01e1d2 (diff)
unprivileged ICMP sockets do not receive IP headers
-rw-r--r--src/pkt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkt.c b/src/pkt.c
index d446ffd..27f492f 100644
--- a/src/pkt.c
+++ b/src/pkt.c
@@ -82,7 +82,7 @@ void handle_packet(char *buf, unsigned bytes, int is_pcap, struct sockaddr_in *a
sizeof(icmp_echo_packet_t) +
sizeof(ping_tunnel_pkt_t), bytes);
else {
- if (opts.udp) {
+ if (opts.udp || opts.unprivileged) {
ip_pkt = 0;
pkt = (icmp_echo_packet_t*)buf;
pt_pkt = (ping_tunnel_pkt_t*)pkt->data;
@@ -326,7 +326,7 @@ void handle_data(icmp_echo_packet_t *pkt, int total_len, forward_desc_t *ring[],
*/
expected_len += pt_pkt->data_len;
expected_len += expected_len % 2;
- if (opts.udp)
+ if (opts.udp || opts.unprivileged)
expected_len -= sizeof(ip_packet_t);
if (total_len < expected_len) {
pt_log(kLog_error, "Packet not completely received: %d Should be: %d. "