From owner-freebsd-net@FreeBSD.ORG Fri May 27 08:51:43 2011 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 0B4D0106564A for ; Fri, 27 May 2011 08:51:43 +0000 (UTC) (envelope-from zhanglinuxstar@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id BC9338FC0C for ; Fri, 27 May 2011 08:51:42 +0000 (UTC) Received: by yie12 with SMTP id 12so800997yie.13 for ; Fri, 27 May 2011 01:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=QN+K+P0ZVvwuvyEm22MfOlTADCVLg3AQqOBGRwf6VsA=; b=ver490W0Ovp5mILO9YM0pFJ8PCGHpV4MXcbf+DzU02TPgiTiwaIipxRhD0xTQwiB6r qdF/egA2EkH4UhpxbGFw7tAqlkB4UVxrZ81HPwn6XiT+c2eNM0MgEbDFfsyE/bW8nzZV Tzk0oSmJwN+tIZGnldw/7q++lWvWrf9lx5/pU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=fZ+kSBjve70fxXLQMwk+lrncqa7OyI0trg60a95dJPT0xOnDQGHqswSZvHDgDqVV0C 9Fm0ZXJf0XnfwThYHUI6WSMmd6WbBClpYLGYIQzWvt8qHRey4bj2r2hl0Vxq5iv5vtrQ gAzX0MBoylAApNTci9RSMFnMeJ3+LCkdl0A+s= MIME-Version: 1.0 Received: by 10.150.13.15 with SMTP id 15mr1811475ybm.103.1306484795594; Fri, 27 May 2011 01:26:35 -0700 (PDT) Received: by 10.151.50.21 with HTTP; Fri, 27 May 2011 01:26:35 -0700 (PDT) Date: Fri, 27 May 2011 16:26:35 +0800 Message-ID: From: linux JHON To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: [HELP] sendto:No buffer space available 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: Fri, 27 May 2011 08:51:43 -0000 My machine has two net interface cards, fxp0 and acl0, but acl0 is down, only fxp0 is working. When I send raw packets through fxp0, it gives the error: sendto: No buffer space available. I have googled, but I found no answer. The netstat -m result is: 67/1223/1290 mbufs in use (current/cache/total) 64/340/404/25600 mbuf clusters in use (current/cache/total/max) 64/320 mbuf+clusters out of packet secondary zone in use (current/cache) 0/167/167/12800 4k (page size) jumbo clusters in use (current/cache/total/max) 0/0/0/6400 9k jumbo clusters in use (current/cache/total/max) 0/0/0/3200 16k jumbo clusters in use (current/cache/total/max) 144K/1653K/1798K bytes allocated to network (current/cache/total) 0/0/0 requests for mbufs denied (mbufs/clusters/mbuf+clusters) 0/0/0 requests for jumbo clusters denied (4k/9k/16k) 0/5/6656 sfbufs in use (current/peak/max) 0 requests for sfbufs denied 0 requests for sfbufs delayed 0 requests for I/O initiated by sendfile 0 calls to protocol drain routines And the ifconfig gives that: alc0: flags=8802 metric 0 mtu 1500 options=c3198 ether xxxxxxxxxxxx media: Ethernet autoselect fxp0: flags=8843 metric 0 mtu 1500 options=4219b ether xxxxxxxxxxx inet xxxxxx netmask 0xffffff00 broadcast xxxxxxxx media: Ethernet autoselect (100baseTX ) status: active plip0: flags=8851 metric 0 mtu 1500 lo0: flags=8049 metric 0 mtu 16384 options=3 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4 inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff000000 nd6 options=3 The core code of sending packets is as follows: while (num_of_tries-- > 0) { if (sendto (s, datagram, iph->ip_len, 0, (struct sockaddr *) &servaddr, sizeof (servaddr)) < 0) { fprintf (stderr, "Error in sendto:%s\n", strerror(errno)); exit (1); } else { /*usleep(30);*/ if (ft == 0) { fprintf (stderr, "[****************]\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); ft = 1; } if ((numtries % modval) == 0) fprintf (stderr, "."); } } When I uncomment the sentence: usleep(30), the error disapears. But I want to send packets in high speed, what should I do? Btw, the packets are raw packets. So I thought maybe the kernel send some packets to the net interface card alc0 which doesn't work. How can I bind raw socket with device fxp0???? Thanks in advance.