Index: ping.8 =================================================================== RCS file: /cvs/src/sbin/ping/ping.8,v retrieving revision 1.60 diff -u -p -r1.60 ping.8 --- ping.8 10 Nov 2018 05:03:23 -0000 1.60 +++ ping.8 10 Nov 2018 05:25:30 -0000 @@ -79,7 +79,7 @@ .Op Fl w Ar maxwait .Ar host .Nm ping6 -.Op Fl dEefHLmnqv +.Op Fl DdEefHLmnqv .Op Fl c Ar count .Op Fl h Ar hoplimit .Op Fl I Ar sourceaddr @@ -116,10 +116,10 @@ If .Ar count is 0, send an unlimited number of packets. .It Fl D -.Pq IPv4 only +Don't fragment. Set the .Dv Don't Fragment -bit. +bit on IPv4 frames, or disable fragmentation of transmitted IPv6 packets. .It Fl d Set the .Dv SO_DEBUG Index: ping.c =================================================================== RCS file: /cvs/src/sbin/ping/ping.c,v retrieving revision 1.231 diff -u -p -r1.231 ping.c --- ping.c 10 Nov 2018 05:03:23 -0000 1.231 +++ ping.c 10 Nov 2018 05:25:31 -0000 @@ -291,7 +291,7 @@ main(int argc, char *argv[]) preload = 0; datap = &outpack[ECHOLEN + ECHOTMLEN]; while ((ch = getopt(argc, argv, v6flag ? - "c:dEefHh:I:i:Ll:mNnp:qS:s:T:V:vw:" : + "c:DdEefHh:I:i:Ll:mNnp:qS:s:T:V:vw:" : "DEI:LRS:c:defHi:l:np:qs:T:t:V:vw:")) != -1) { switch(ch) { case 'c': @@ -681,6 +681,13 @@ main(int argc, char *argv[]) warn("setsockopt(IPV6_TVAL)"); /* XXX err? */ } + if (df) { + optval = 1; + if (setsockopt(s, IPPROTO_IPV6, IPV6_DONTFRAG, + &optval, (socklen_t)sizeof(optval)) < 0) + warn("setsockopt(IPV6_DONTFRAG"); /* err? */ + } + optval = 1; if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &optval, (socklen_t)sizeof(optval)) < 0) @@ -2166,7 +2173,7 @@ usage(void) { if (v6flag) { fprintf(stderr, - "usage: ping6 [-dEefHLmnqv] [-c count] [-h hoplimit] " + "usage: ping6 [-DdEefHLmnqv] [-c count] [-h hoplimit] " "[-I sourceaddr]\n\t[-i wait] [-l preload] [-p pattern] " "[-s packetsize] [-T toskeyword]\n\t" "[-V rtable] [-w maxwait] host\n");