Add debug option to show ip_proto

This commit is contained in:
angt
2015-12-10 15:28:45 +01:00
parent 4cf0e7bc68
commit 52a3a4b853

View File

@@ -662,6 +662,7 @@ int main (int argc, char **argv)
{ "noquickack", NULL, option_option }, { "noquickack", NULL, option_option },
{ "retry", &retry_opts, option_option }, { "retry", &retry_opts, option_option },
{ "daemon", NULL, option_option }, { "daemon", NULL, option_option },
{ "debug", NULL, option_option },
{ "version", NULL, option_option }, { "version", NULL, option_option },
{ NULL }, { NULL },
}; };
@@ -678,6 +679,7 @@ int main (int argc, char **argv)
const int delay = option_is_set(opts, "delay"); const int delay = option_is_set(opts, "delay");
const int keepalive = option_is_set(opts, "keepalive"); const int keepalive = option_is_set(opts, "keepalive");
const int noquickack = option_is_set(opts, "noquickack"); const int noquickack = option_is_set(opts, "noquickack");
const int debug = option_is_set(opts, "debug");
if (buffer_size < 2048) { if (buffer_size < 2048) {
buffer_size = 2048; buffer_size = 2048;
@@ -893,6 +895,12 @@ int main (int argc, char **argv)
continue; 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; blks[blk_write++].size = r;
blk_count++; blk_count++;
} }