>Number: 145759 >Category: bin >Synopsis: [patch] Add do-not-fragment option support to ping6 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Apr 16 14:00:08 UTC 2010 >Closed-Date: >Last-Modified: >Originator: pluknet >Release: HEAD r206338 >Organization: >Environment: >Description: There's a conversation that fully disclose the subject. http://lists.freebsd.org/pipermail/freebsd-net/2009-December/023948.html
Some tests inline: 1. size < lo0 mtu, w/ frag $ ping6 -s 10000 -b 32000 ::1 PING6(10048=40+8+10000 bytes) ::1 --> ::1 10008 bytes from ::1, icmp_seq=0 hlim=64 time=0.139 ms 17:37:56.521150 IP6 localhost > localhost: frag (0|1232) ICMP6, echo request, seq 0, length 1232 17:37:56.521160 IP6 localhost > localhost: frag (1232|1232) 17:37:56.521164 IP6 localhost > localhost: frag (2464|1232) 17:37:56.521168 IP6 localhost > localhost: frag (3696|1232) 17:37:56.521172 IP6 localhost > localhost: frag (4928|1232) 17:37:56.521175 IP6 localhost > localhost: frag (6160|1232) 17:37:56.521179 IP6 localhost > localhost: frag (7392|1232) 17:37:56.521183 IP6 localhost > localhost: frag (8624|1232) 17:37:56.521186 IP6 localhost > localhost: frag (9856|152) 17:37:56.521203 IP6 localhost > localhost: ICMP6, echo reply, seq 0, length 10008 2. size < lo0 mtu, w/o frag $ ping6 -s 10000 -b 32000 -D ::1 PING6(10048=40+8+10000 bytes) ::1 --> ::1 10008 bytes from ::1, icmp_seq=0 hlim=64 time=0.080 ms 17:39:52.182947 IP6 localhost > localhost: ICMP6, echo request, seq 0, length 10008 17:39:52.182962 IP6 localhost > localhost: ICMP6, echo reply, seq 0, length 10008 3. size > lo0 mtu, w/ frag $ ping6 -s 20000 -b 32000 ::1 PING6(20048=40+8+20000 bytes) ::1 --> ::1 20008 bytes from ::1, icmp_seq=0 hlim=64 time=0.234 ms 17:46:22.080945 IP6 localhost > localhost: frag (0|1232) ICMP6, echo request, seq 0, length 1232 17:46:22.080955 IP6 localhost > localhost: frag (1232|1232) 17:46:22.080959 IP6 localhost > localhost: frag (2464|1232) 17:46:22.080962 IP6 localhost > localhost: frag (3696|1232) 17:46:22.080966 IP6 localhost > localhost: frag (4928|1232) 17:46:22.080970 IP6 localhost > localhost: frag (6160|1232) 17:46:22.080973 IP6 localhost > localhost: frag (7392|1232) 17:46:22.080977 IP6 localhost > localhost: frag (8624|1232) 17:46:22.080980 IP6 localhost > localhost: frag (9856|1232) 17:46:22.080984 IP6 localhost > localhost: frag (11088|1232) 17:46:22.080987 IP6 localhost > localhost: frag (12320|1232) 17:46:22.080991 IP6 localhost > localhost: frag (13552|1232) 17:46:22.080994 IP6 localhost > localhost: frag (14784|1232) 17:46:22.080998 IP6 localhost > localhost: frag (16016|1232) 17:46:22.081002 IP6 localhost > localhost: frag (17248|1232) 17:46:22.081005 IP6 localhost > localhost: frag (18480|1232) 17:46:22.081009 IP6 localhost > localhost: frag (19712|296) 17:46:22.081047 IP6 localhost > localhost: frag (0|16336) ICMP6, echo reply, seq 0, length 16336 17:46:22.081048 IP6 localhost > localhost: frag (16336|3672) 4. size > lo0 mtu, w/o frag $ ping6 -s 20000 -b 32000 -D ::1 PING6(20048=40+8+20000 bytes) ::1 --> ::1 ping6: sendmsg: Message too long ping6: wrote ::1 20008 chars, ret=-1 >How-To-Repeat: >Fix: Patch against HEAD r206338, applicable down to 7. Patch attached with submission follows: Index: sbin/ping6/ping6.c =================================================================== --- sbin/ping6/ping6.c (revision 206338) +++ sbin/ping6/ping6.c (working copy) @@ -191,6 +191,7 @@ #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 @@ #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 @@ errx(1, "illegal number of packets -- %s", optarg); break; + case 'D': + options |= F_DONTFRAG; + break; case 'd': options |= F_SO_DEBUG; break; @@ -743,8 +747,12 @@ *((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) (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&hold, sizeof(hold)); @@ -2780,7 +2788,7 @@ "A" #endif "usage: ping6 [-" - "d" + "Dd" #if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC) "E" #endif Index: sbin/ping6/ping6.8 =================================================================== --- sbin/ping6/ping6.8 (revision 206338) +++ sbin/ping6/ping6.8 (working copy) @@ -40,9 +40,9 @@ .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 @@ .Ar count .Tn ECHO_RESPONSE packets. +.It Fl D +Disable IPv6 fragmentation. .It Fl d Set the .Dv SO_DEBUG >Release-Note: >Audit-Trail: >Unformatted: _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"