I would say the socket argument is invalid at runtime, is it correctly checked earlier in the code? Perhaps it worked on linux because everything went fine in the few cases you used it; or perhaps the ported version introduces some bugs if you changed several things.

I would say the socket argument is invalid at runtime, is it correctly checked earlier in the code? Perhaps it worked on linux because everything went fine in the few cases you used it; or perhaps the ported version introduces some bugs if you changed several things.

yes, I change only struct elements, because linux and netbsd sockets differently.
Either of element has a similar on netbsd socket, but that tcp_h->res1, it's exist only on linux and I was constrained // marked it.
I've change structure objects like this...
after on linux
ip_h->daddr
tcp_h->source
before on netbsd
ip_h->ip_dst.s_addr
tcp_h->th_sport
but I cant' find out res or res1 into headers include/netinet/*.h on netbsd
Furthermore, I find out there similar of problem...http://mail-index.netbsd.org/tech-ne...1/03/0001.html
But I'm confused about that. When I make a tcp packet with data, I should give space for structs ip_h,tch_h and data_h.
buf_siz = sizeof(struct ip) + sizeof(struct tcphdr)+ sizeof(data) ;
And I not understand what is meaning he was writing.