From owner-freebsd-net@FreeBSD.ORG Sun Feb 21 22:02:21 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A74D2106566C for ; Sun, 21 Feb 2010 22:02:21 +0000 (UTC) (envelope-from hyama99@gmail.com) Received: from mail-fx0-f215.google.com (mail-fx0-f215.google.com [209.85.220.215]) by mx1.freebsd.org (Postfix) with ESMTP id 2F1048FC16 for ; Sun, 21 Feb 2010 22:02:20 +0000 (UTC) Received: by fxm7 with SMTP id 7so1725701fxm.14 for ; Sun, 21 Feb 2010 14:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=pDO52Toiz5A6nJbamzncarKZrHsqF3vHGFxoHAdFYfg=; b=CdIBeONWeFYaWCgS/I4A2djt9sW/Njas6ZNi0nI0K0v7+08SwTTEvNrZUeWbqHgD2C uiK8LPmBIRnx4gvSiSWkI6G5GJAKYq4KYtWGEmvK3U5St01D+fog+lLLitw/6tEdyqGx NaLiuImjXSsnOXeMqAkdMfLMmvjaFva02jdhU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=s4ehplISlq3fQRqWmiYqLC99jaZh8VukijtJ+Ahj04vwufsDzuMVDW03NcV/Oi8Cum 3WhsxTkWtceDsfyGIsZZjyhelyCnMGn6T7zkyszns3DTcK3W0dZJX/as57lKjguxezRf ZjwcZnVrwSxDXiKsBJXCPUHNyiVn3zo4+Zh9U= MIME-Version: 1.0 Received: by 10.239.185.203 with SMTP id d11mr98551hbh.145.1266789731563; Sun, 21 Feb 2010 14:02:11 -0800 (PST) Date: Mon, 22 Feb 2010 07:02:11 +0900 Message-ID: <90dbee151002211402o52ed7cf6q352bd1ef339379bf@mail.gmail.com> From: Hideki Yamamoto To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: IPv6 multicast packet size X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 22:02:21 -0000 Hi, I have encountered IPv6 multicast problem. I cannot send UDP packet longer than Shortest MTU. It seems the bug of IPv6 multicast kernel. I used the same application from FreeBSD 4.11. On that old version, any problems happens. When I would like to change the platform of this application from 4.11 to 7.2 or later, I encountered this problem. Does anyone have any information about this problem? The followings are OS information I have tested, the result of Tshark command, and source code of test program. Best regards, Hideki Yamamoto -------------------------------------------------------------------------- OS information -------------------------------------------------------------------------- # sysctl -a |grep v6 net.inet.tcp.v6mssdflt: 1024 net.inet6.ip6.v6only: 1 # sysctl -a |grep mtu net.inet.tcp.path_mtu_discovery: 1 net.inet.sctp.pmtu_raise_time: 600 net.inet6.ip6.mcast_pmtu: 0 # uname -a FreeBSD tulip 9.0-CURRENT FreeBSD 9.0-CURRENT #16: Fri Jan 15 05:25:24 JST 2010 root@tulip:/usr/obj/usr/src/sys/tulip8 i386 tulip# -------------------------------------------------------------------------- Tshark output that shows the packets are devided into two packtet when delivering 1400 byte lenghth packets. -------------------------------------------------------------------------- # ./udp -s 1400 -o & # tshark -VV -i fxp1 host ff3e::9800:600 |grep -v aaaaaaaaa Capturing on fxp1 Frame 1 (1294 bytes on wire, 1294 bytes captured) Arrival Time: Feb 21, 2010 17:35:08.560297000 [Time delta from previous captured frame: 0.000000000 seconds] [Time delta from previous displayed frame: 0.000000000 seconds] [Time since reference or first frame: 0.000000000 seconds] Frame Number: 1 Frame Length: 1294 bytes Capture Length: 1294 bytes [Frame is marked: False] [Protocols in frame: eth:ipv6:data] Ethernet II, Src: Intel_89:d6:d9 (00:d0:b7:89:d6:d9), Dst: IPv6mcast_98:00:06:00 (33:33:98:00:06:00) Destination: IPv6mcast_98:00:06:00 (33:33:98:00:06:00) Address: IPv6mcast_98:00:06:00 (33:33:98:00:06:00) .... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast) .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default) Source: Intel_89:d6:d9 (00:d0:b7:89:d6:d9) Address: Intel_89:d6:d9 (00:d0:b7:89:d6:d9) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) Type: IPv6 (0x86dd) Internet Protocol Version 6 0110 .... = Version: 6 [0110 .... = This field makes the filter "ip.version == 6" possible: 6] .... 0000 0000 .... .... .... .... .... = Traffic class: 0x00000000 .... .... .... 0000 0000 0000 0000 0000 = Flowlabel: 0x00000000 Payload length: 1240 Next header: IPv6 fragment (0x2c) Hop limit: 1 Source: 2001:2a0:806:206:2d0:b7ff:fe89:d6d9 (2001:2a0:806:206:2d0:b7ff:fe89:d6d9) Destination: ff3e::9800:600 (ff3e::9800:600) Fragmentation Header Next header: UDP (0x11) 0000 0000 0000 0... = Offset: 0 (0x0000) .... .... .... ...1 = More Fragment: Yes Identification: 0xc31d92fa Data (1232 bytes) 0000 5d 61 46 50 05 80 b0 d6 61 61 61 61 61 61 61 61 ]aFP....aaaaaaaa Data: 5D6146500580B0D661616161616161616161616161616161... [Length: 1232] Frame 2 (238 bytes on wire, 238 bytes captured) Arrival Time: Feb 21, 2010 17:35:08.560324000 [Time delta from previous captured frame: 0.000027000 seconds] [Time delta from previous displayed frame: 0.000027000 seconds] [Time since reference or first frame: 0.000027000 seconds] Frame Number: 2 Frame Length: 238 bytes Capture Length: 238 bytes [Frame is marked: False] [Protocols in frame: eth:ipv6:udp:data] Ethernet II, Src: Intel_89:d6:d9 (00:d0:b7:89:d6:d9), Dst: IPv6mcast_98:00:06:00 (33:33:98:00:06:00) Destination: IPv6mcast_98:00:06:00 (33:33:98:00:06:00) Address: IPv6mcast_98:00:06:00 (33:33:98:00:06:00) .... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast) .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default) Source: Intel_89:d6:d9 (00:d0:b7:89:d6:d9) Address: Intel_89:d6:d9 (00:d0:b7:89:d6:d9) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) Type: IPv6 (0x86dd) ------ /********************************************************************** udp.c (modified for MC Send Support) ***********************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // Modify send_addr to Multicast Address char *send_addr="ff3e::9800:600"; char *send_port="18000"; char *recv_addr="2001:99::1"; char *recv_port="16000"; int send_s; int only_out=0; int only_in=0; int out_packet_size; struct addrinfo *send_res; // Add for MC support char *out_if="fxp1"; main(ac,av) int ac; char **av; { int c; while ((c = getopt(ac, av, "s:oi")) != -1) { switch (c) { case 'o': only_out++; break; case 'i': only_in++; break; case 's': out_packet_size = atoi(optarg); break; default: Usage(); exit (1); } } if( only_in && only_out ){ Usage(); exit (1); } if( only_in == 0 ){ create_send_socket(); send_v6_udp(); exit; } recv_v6_udp(); } Usage() { printf("Usage: udpgw [-o][-i][-s output_packet_size]\n"); } create_send_socket() { struct addrinfo hints; int error; struct sockaddr_in6 *sin6;// Add for MC Support int ifindex;// Add for MC Support memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; error = getaddrinfo(send_addr, send_port, &hints, &send_res); if (error != 0) errx(1, "%s", gai_strerror(error)); send_res->ai_family = AF_INET6; send_s = socket(send_res->ai_family, send_res->ai_socktype, send_res->ai_protocol); if (send_s < 0) err(1, "socket"); // Add for MC support sin6 = (struct sockaddr_in6 *)send_res->ai_addr; if(IN6_IS_ADDR_MULTICAST(&(sin6->sin6_addr))) { if ( (ifindex = if_nametoindex(out_if)) == 0 ){ err(1, "socket-MC"); } error = setsockopt(send_s, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)); if (error < 0){ err(1, "socket-MC"); } } } send_v6_udp() { int len,cc,i; char buf[2000]; for( i=0; i<2000 ; i++ ){ buf[i]='a'; } if( 1501 > out_packet_size ){ cc = out_packet_size ; }else{ cc = 1500; } printf("Let's send %d length packet to %s\n",cc,send_addr); while(1){ len = sendto(send_s, buf, cc, 0, send_res->ai_addr, send_res->ai_addrlen); sleep(1); } } recv_v6_udp() { int recv_s; struct addrinfo hints, *res; int error; int len,cc,ccout; char buf[2000]; FILE *outfp=stdout; int fromlen; struct sockaddr_in6 from6; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; error = getaddrinfo(recv_addr, recv_port, &hints, &res); if (error != 0) errx(1, "%s", gai_strerror(error)); res->ai_family = AF_INET6; recv_s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (recv_s < 0) err(1, "socket"); while(1){ cc = recvfrom(recv_s, (void *)buf, sizeof(buf), 0, (struct sockaddr *)&from6, &fromlen); if (cc < 0) { warn("recvfrom"); continue; } if ( only_in == 0 ){ len = sendto(send_s, buf, cc, 0, send_res->ai_addr, send_res->ai_addrlen); } else { if ((ccout = fwrite(buf, cc, 1, outfp)) < 1) close(recv_s); } } } -------------