How to modify a packet captured using ipq_read()
Can anyone help me change the fields of a captured packet using the ipq_set_verdict() function of libipq.
I tried to redirect an icmp packet to 172.16.13.35 by changing the destination address of the icmp packet(which was originally destined to some other ip address) as shown:
unsigned char buf[BUFSIZE];
struct ipq_handle *h;
h = ipq_create_handle(0, PF_INET);
ipq_read(h, buf, BUFSIZE, 0);
ipq_packet_msg_t *m = ipq_get_packet(buf);
struct iphdr *iph = ((struct iphdr *) msg->payload);
ipq_set_verdict(h, m->packet_id,NF_ACCEPT, BUFSIZE, buf);
But the above method does not seem to work. Do I also have to change checksum field? If so, how? Please include code , if any, in your reply.