marco alamanni
2005-01-25 12:08:42 UTC
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 = rand();
tcp =
libnet_build_tcp(lport,dport,seq,ack,TH_SYN,32767,0,0,LIBNET_TCP_H,NULL,0,l,tcp);
if (tcp == -1){
fprintf(stderr,"Can't build tcp header:
%s\n",libnet_geterror(l));
exit(1);
}
ip =
libnet_build_ipv4(LIBNET_IPV4_H+LIBNET_TCP_H,0,id,0,64,IPPROTO_TCP,0,laddr,daddr,NULL,0,l,ip);
if (ip == -1) {
fprintf(stderr,"Can't build ip header:
%s\n",libnet_geterror(l));
exit(1);
}
if (libnet_write(l) == -1){
fprintf(stderr,"libnet_write():
%s\n",libnet_geterror(l));
exit(1);
}
}
What's wrong with this code?
Thanks.
___________________________________
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica Scaricalo ora!
http://it.messenger.yahoo.it
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 = rand();
tcp =
libnet_build_tcp(lport,dport,seq,ack,TH_SYN,32767,0,0,LIBNET_TCP_H,NULL,0,l,tcp);
if (tcp == -1){
fprintf(stderr,"Can't build tcp header:
%s\n",libnet_geterror(l));
exit(1);
}
ip =
libnet_build_ipv4(LIBNET_IPV4_H+LIBNET_TCP_H,0,id,0,64,IPPROTO_TCP,0,laddr,daddr,NULL,0,l,ip);
if (ip == -1) {
fprintf(stderr,"Can't build ip header:
%s\n",libnet_geterror(l));
exit(1);
}
if (libnet_write(l) == -1){
fprintf(stderr,"libnet_write():
%s\n",libnet_geterror(l));
exit(1);
}
}
What's wrong with this code?
Thanks.
___________________________________
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica Scaricalo ora!
http://it.messenger.yahoo.it