skb->h.th or skb->h.iph is not suitable here as I don't want a copy of
the ip or tcp headers only, I want to be able to modify certain fields of the
two headers also. Furthermore, skb->h is a union, implying that you can have
only one or the other, but I need both.
What do you think of the method below:
Let's say you have a struct sk_buff * skb;, and that skb->head (or
skb->data) is pointing to the start of the ip header. Then, to get the
pointers to the ip headers and the tcp headers, all you have to do is:
(struct iphdr *) myiphdr = (struct iphdr *) skb->head;
__u32 iphdrlen = GETVALUE(myiphdr->ihl);
(struct tcphdr *) mytcphdr = (struct tcphdr *) (skb->head + iphdrlen);
Thanks in advance.
Foo Chun Choong