- iph = (*pskb)->nh.iph;
- if (x->props.mode) {
- top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len);
- top_iph->ihl = 5;
- top_iph->version = 4;
- top_iph->tos = 0;
- top_iph->tot_len = htons((*pskb)->len);
- top_iph->frag_off = 0;
- if (!(iph->frag_off&htons(IP_DF)))
- __ip_select_ident(top_iph, dst, 0);
- top_iph->ttl = 0;
- top_iph->protocol = IPPROTO_AH;
- top_iph->check = 0;
- top_iph->saddr = x->props.saddr.a4;
- top_iph->daddr = x->id.daddr.a4;
- ah = (struct ip_auth_hdr*)(top_iph+1);
- ah->nexthdr = IPPROTO_IPIP;
- } else {
- memcpy(&tmp_iph, (*pskb)->data, iph->ihl*4);
- top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len);
- memcpy(top_iph, &tmp_iph, iph->ihl*4);
- iph = &tmp_iph.iph;
- top_iph->tos = 0;
- top_iph->tot_len = htons((*pskb)->len);
- top_iph->frag_off = 0;
- top_iph->ttl = 0;
- top_iph->protocol = IPPROTO_AH;
- top_iph->check = 0;
- if (top_iph->ihl != 5) {
- err = ip_clear_mutable_options(top_iph, &top_iph->daddr);
- if (err)
- goto error;
- }
- ah = (struct ip_auth_hdr*)((char*)top_iph+iph->ihl*4);
- ah->nexthdr = iph->protocol;
- }