подскажите, почему не уходят пакеты
int packet_size;
libnet_t *lnet;
char errbuf[LIBNET_ERRBUF_SIZE];
libnet_ptag_t ip = 0, tcp = 0;
lnet = libnet_init(LIBNET_RAW4, "eth0", errbuf);
if (lnet == NULL){
fprintf (stderr, "Error opening context: %s", errbuf);
return -1;
}
packet_size = LIBNET_IPV4_H + LIBNET_TCP_H;
//выводит читабельные IP
printf("saddr = %s\ndaddr = %s\n",libnet_addr2name4(data->saddr,LIBNET_DONT_RESOLVE),libnet_addr2name4(data->daddr,LIBNET_DONT_RESOLVE));
tcp = libnet_build_tcp(data->dport, //src port
data->sport, //dst port
0, //seq
0, //ack
TH_SYN, //flag
65534, //window
0, //csum
0, //urg
LIBNET_TCP_H, //header len
NULL, //payload
0, //payload len
lnet, //libnet context
tcp); //ptag
if(tcp == -1){
fprintf(stderr, "Error building TCP header: %s\n", libnet_geterror(lnet));
return -1;
}
ip = libnet_build_ipv4(packet_size, //size
0, //tos
id, //id IP packet
0, //do not fragment
IPPROTO_TCP, //protocol
64, //ttl
0, //csum
data->daddr, //src addr
data->saddr, //dst addr
NULL, //payload
0, //payload len
lnet, //libnet context
ip); //ptag
if(ip == -1){
fprintf(stderr, "Error building IP header: %s\n", libnet_geterror(lnet));
return -1;
}
if ((libnet_write (lnet)) == -1){
fprintf (stderr, "Unable to send packet: %s\n", libnet_geterror (lnet));
return -1;
}
ошибок никаких не выдаёт, а tcpdump пакеты не видит
libnet-1.1.2.1-2.2.el6.rf.i686
centos 6.4
заранее благодарен !