Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Apr 2001 15:51:54 -0400
From:      Bosko Milekic <bmilekic@technokratis.com>
To:        Jessey <r041102@ms17.hinet.net>
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: I call sosend occur error . The error code=22.
Message-ID:  <20010417155154.A13132@technokratis.com>
In-Reply-To: <001a01c0c825$aee59300$f3fb1fa3@wen>; from r041102@ms17.hinet.net on Thu, Apr 19, 2001 at 12:36:11AM %2B0800
References:  <001a01c0c825$aee59300$f3fb1fa3@wen>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, Apr 19, 2001 at 12:36:11AM +0800, Jessey wrote:
> Dear Sir:
> I call sosend occur error. The error code=22.
> What wrong in my code?
> 
> The code follow:
> 
> socreate(); file://is ok;
> 
> |
> }
> 
> top=m_get(MT_DATA,M_DONTWAIT);
> 
>      if(top==NULL)
>      {
>          log(LOG_INFO, "top=NULL occur error\n");
>          goto out;
>      }
> 
>      top->m_next=NULL;
>      top->m_nextpkt=NULL;
>      top->m_len=50;
>      adr=sizeof(struct m_hdr) +sizeof(int)+sizeof(struct ifnet *);
>      log(LOG_INFO, "adr= %d \n",adr);
> 
>      top->m_data=top+adr;
      ^^^^^^^^^^^^^^^^^^^^^^
	First of all, that looks totally bogus!

>      log(LOG_INFO, "top= %x, top->m_data= %x,top+adr=%x \n",top 
> ,top->m_data,top+adr);
> 
>      top->m_type=MT_DATA;
>      top->m_flags=M_PKTHDR;
>      top->m_pkthdr.len=50;
>      top->m_pkthdr.rcvif=NULL;

	You should probably just be using m_gethdr. Is this kernel code?
 
>      log(LOG_INFO, "top= %x, Data= %x \n",top ,top->m_data);
> 
>      error = sosend(so,(struct sockaddr *) &sin,NULL,top, 
> 0,MSG_DONTROUTE);

	Error code 22 is EINVAL. Something sosend() calls is telling you that
whatever you're passing to sosend() is probably invalid. Are you sure that
what you're trying to do is OK?

> Thanks/regards

-- 
 Bosko Milekic
 bmilekic@technokratis.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010417155154.A13132>