From owner-svn-src-all@FreeBSD.ORG Tue Apr 20 06:10:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75114106564A; Tue, 20 Apr 2010 06:10:05 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 496168FC27; Tue, 20 Apr 2010 06:10:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K6A5lv036470; Tue, 20 Apr 2010 06:10:05 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K6A5qP036467; Tue, 20 Apr 2010 06:10:05 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201004200610.o3K6A5qP036467@svn.freebsd.org> From: Maxim Konovalov Date: Tue, 20 Apr 2010 06:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206889 - head/sbin/ping6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2010 06:10:05 -0000 Author: maxim Date: Tue Apr 20 06:10:05 2010 New Revision: 206889 URL: http://svn.freebsd.org/changeset/base/206889 Log: o Add do-not-fragment option support to ping6(8). PR: bin/145759 Submitted by: pluknet MFC after: 1 month Modified: head/sbin/ping6/ping6.8 head/sbin/ping6/ping6.c Modified: head/sbin/ping6/ping6.8 ============================================================================== --- head/sbin/ping6/ping6.8 Tue Apr 20 06:08:34 2010 (r206888) +++ head/sbin/ping6/ping6.8 Tue Apr 20 06:10:05 2010 (r206889) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 27, 2008 +.Dd April 20, 2010 .Dt PING6 8 .Os .Sh NAME @@ -40,9 +40,9 @@ packets to network hosts .Sh SYNOPSIS .Nm .\" without ipsec, or new ipsec -.Op Fl dfHmnNoqrRtvwW +.Op Fl DdfHmnNoqrRtvwW .\" old ipsec -.\" .Op Fl AdEfmnNqRtvwW +.\" .Op Fl ADdEfmnNqRtvwW .Bk -words .Op Fl a Ar addrtype .Ek @@ -141,6 +141,8 @@ Stop after sending .Ar count .Tn ECHO_RESPONSE packets. +.It Fl D +Disable IPv6 fragmentation. .It Fl d Set the .Dv SO_DEBUG Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Tue Apr 20 06:08:34 2010 (r206888) +++ head/sbin/ping6/ping6.c Tue Apr 20 06:10:05 2010 (r206889) @@ -191,6 +191,7 @@ struct tv32 { #define F_ONCE 0x200000 #define F_AUDIBLE 0x400000 #define F_MISSED 0x800000 +#define F_DONTFRAG 0x1000000 #define F_NOUSERDATA (F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES) u_int options; @@ -349,7 +350,7 @@ main(argc, argv) #endif /*IPSEC_POLICY_IPSEC*/ #endif while ((ch = getopt(argc, argv, - "a:b:c:dfHg:h:I:i:l:mnNop:qrRS:s:tvwW" ADDOPTS)) != -1) { + "a:b:c:DdfHg:h:I:i:l:mnNop:qrRS:s:tvwW" ADDOPTS)) != -1) { #undef ADDOPTS switch (ch) { case 'a': @@ -415,6 +416,9 @@ main(argc, argv) errx(1, "illegal number of packets -- %s", optarg); break; + case 'D': + options |= F_DONTFRAG; + break; case 'd': options |= F_SO_DEBUG; break; @@ -742,7 +746,11 @@ main(argc, argv) for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t)) *((u_int32_t *)&nonce[i]) = arc4random(); #endif - + optval = 1; + if (options & F_DONTFRAG) + if (setsockopt(s, IPPROTO_IPV6, IPV6_DONTFRAG, + &optval, sizeof(optval)) == -1) + err(1, "IPV6_DONTFRAG"); hold = 1; if (options & F_SO_DEBUG) @@ -2780,7 +2788,7 @@ usage() "A" #endif "usage: ping6 [-" - "d" + "Dd" #if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC) "E" #endif