From 52a3a4b853c8ceccb1148730daa6148c99250b59 Mon Sep 17 00:00:00 2001 From: angt Date: Thu, 10 Dec 2015 15:28:45 +0100 Subject: [PATCH] Add debug option to show ip_proto --- src/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.c b/src/main.c index ac0cdb1..f9b1323 100644 --- a/src/main.c +++ b/src/main.c @@ -662,6 +662,7 @@ int main (int argc, char **argv) { "noquickack", NULL, option_option }, { "retry", &retry_opts, option_option }, { "daemon", NULL, option_option }, + { "debug", NULL, option_option }, { "version", NULL, option_option }, { NULL }, }; @@ -678,6 +679,7 @@ int main (int argc, char **argv) const int delay = option_is_set(opts, "delay"); const int keepalive = option_is_set(opts, "keepalive"); const int noquickack = option_is_set(opts, "noquickack"); + const int debug = option_is_set(opts, "debug"); if (buffer_size < 2048) { buffer_size = 2048; @@ -893,6 +895,12 @@ int main (int argc, char **argv) continue; } + if _0_(debug) { + const int ip_version = ip_get_version(data, GT_MTU_MAX); + const ssize_t ip_proto = ip_get_proto(data, GT_MTU_MAX); + gt_log("%s: version=%i size=%zi proto=%zi\n", sockname, ip_version, ip_size, ip_proto); + } + blks[blk_write++].size = r; blk_count++; }