From 7c7448ab8cb1ce2f1bb5df9cf8d298f1270b3c25 Mon Sep 17 00:00:00 2001 From: Don Bowman Date: Thu, 18 Feb 2016 00:06:02 +0000 Subject: [PATCH] add path mtu discovert (MTU) AKA Don't Fragment support --- src/fping.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fping.c b/src/fping.c index a7af5ed..81f6489 100644 --- a/src/fping.c +++ b/src/fping.c @@ -377,10 +377,19 @@ int main( int argc, char **argv ) /* get command line options */ - while( ( c = getopt( argc, argv, "gedhlmnqusaAvDRz:t:H:i:p:f:r:c:b:C:Q:B:S:I:T:O:" ) ) != EOF ) + while( ( c = getopt( argc, argv, "gedhlmnqusaAvDRz:t:H:i:p:f:r:c:b:C:Q:B:S:I:T:O:M" ) ) != EOF ) { switch( c ) { + case 'M': + { + int val = IP_PMTUDISC_DO; + if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val))) { + perror("setsockopt IP_MTU_DISCOVER"); + } + } + break; + case 't': if( !( timeout = ( unsigned int )atoi( optarg ) * 100 ) ) usage(1); @@ -2380,6 +2389,7 @@ void usage(int is_error) #endif fprintf(out, " -l loop sending pings forever\n" ); fprintf(out, " -m ping multiple interfaces on target host\n" ); + fprintf(out, " -M Don't Fragment (IP_PMTUDISC_DO)\n" ); fprintf(out, " -n show targets by name (-d is equivalent)\n" ); fprintf(out, " -O n set the type of service (tos) flag on the ICMP packets\n" ); fprintf(out, " -p n interval between ping packets to one target (in millisec)\n" );