Error in libnet_pblock_coalesce()
marco alamanni <[email protected]> Tue, 25 Jan 2005 13:08:42 +0100 (CET)
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Message-ID | <[email protected]> |
Hi,
i've written a routine to send TCP SYN packets.
When this routine is executed,the first packet is sent
and the it terminates with the following error
message:
libnet_pblock_coalesce(): packet assembly cannot find
an IPv4 header.
The routine's code is the following:
void send_tcp_pkt(u_int32_t daddr) {
seq =3D rand();
tcp =3D
libnet_build_tcp(lport,dport,seq,ack,TH_SYN,32767,0,0,LIBNET_TCP_H,NULL,0=
,l,tcp);
if (tcp =3D=3D -1){
fprintf(stderr,"Can't build tcp header:
%s\n",libnet_geterror(l));
exit(1);
}
ip =3D
libnet_build_ipv4(LIBNET_IPV4_H+LIBNET_TCP_H,0,id,0,64,IPPROTO_TCP,0,ladd=
r,daddr,NULL,0,l,ip);
if (ip =3D=3D -1) {
fprintf(stderr,"Can't build ip header:
%s\n",libnet_geterror(l));
exit(1);
}
if (libnet_write(l) =3D=3D -1){
fprintf(stderr,"libnet_write():
%s\n",libnet_geterror(l));
exit(1);
}
}
What's wrong with this code?
Thanks.
=09
___________________________________=20
Nuovo Yahoo! Messenger: E' molto pi=F9 divertente: Audibles, Avatar, Webc=
am, Giochi, Rubrica=85 Scaricalo ora!=20
http://it.messenger.yahoo.it