ah4.c (f94f3cb37a1c4d44dd2070cc4a6165689bda9c92) ah4.c (b71d1d426d263b0b6cb5760322efebbfc89d4463)
1#include <crypto/hash.h>
2#include <linux/err.h>
3#include <linux/module.h>
4#include <linux/slab.h>
5#include <net/ip.h>
6#include <net/xfrm.h>
7#include <net/ah.h>
8#include <linux/crypto.h>

--- 59 unchanged lines hidden (view full) ---

68 crypto_ahash_reqsize(ahash),
69 __alignof__(struct scatterlist));
70}
71
72/* Clear mutable options and find final destination to substitute
73 * into IP header for icv calculation. Options are already checked
74 * for validity, so paranoia is not required. */
75
1#include <crypto/hash.h>
2#include <linux/err.h>
3#include <linux/module.h>
4#include <linux/slab.h>
5#include <net/ip.h>
6#include <net/xfrm.h>
7#include <net/ah.h>
8#include <linux/crypto.h>

--- 59 unchanged lines hidden (view full) ---

68 crypto_ahash_reqsize(ahash),
69 __alignof__(struct scatterlist));
70}
71
72/* Clear mutable options and find final destination to substitute
73 * into IP header for icv calculation. Options are already checked
74 * for validity, so paranoia is not required. */
75
76static int ip_clear_mutable_options(struct iphdr *iph, __be32 *daddr)
76static int ip_clear_mutable_options(const struct iphdr *iph, __be32 *daddr)
77{
78 unsigned char * optptr = (unsigned char*)(iph+1);
79 int l = iph->ihl*4 - sizeof(struct iphdr);
80 int optlen;
81
82 while (l > 0) {
83 switch (*optptr) {
84 case IPOPT_END:

--- 306 unchanged lines hidden (view full) ---

391 kfree (work_iph);
392out:
393 return err;
394}
395
396static void ah4_err(struct sk_buff *skb, u32 info)
397{
398 struct net *net = dev_net(skb->dev);
77{
78 unsigned char * optptr = (unsigned char*)(iph+1);
79 int l = iph->ihl*4 - sizeof(struct iphdr);
80 int optlen;
81
82 while (l > 0) {
83 switch (*optptr) {
84 case IPOPT_END:

--- 306 unchanged lines hidden (view full) ---

391 kfree (work_iph);
392out:
393 return err;
394}
395
396static void ah4_err(struct sk_buff *skb, u32 info)
397{
398 struct net *net = dev_net(skb->dev);
399 struct iphdr *iph = (struct iphdr *)skb->data;
399 const struct iphdr *iph = (const struct iphdr *)skb->data;
400 struct ip_auth_hdr *ah = (struct ip_auth_hdr *)(skb->data+(iph->ihl<<2));
401 struct xfrm_state *x;
402
403 if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH ||
404 icmp_hdr(skb)->code != ICMP_FRAG_NEEDED)
405 return;
406
400 struct ip_auth_hdr *ah = (struct ip_auth_hdr *)(skb->data+(iph->ihl<<2));
401 struct xfrm_state *x;
402
403 if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH ||
404 icmp_hdr(skb)->code != ICMP_FRAG_NEEDED)
405 return;
406
407 x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, ah->spi, IPPROTO_AH, AF_INET);
407 x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr,
408 ah->spi, IPPROTO_AH, AF_INET);
408 if (!x)
409 return;
410 printk(KERN_DEBUG "pmtu discovery on SA AH/%08x/%08x\n",
411 ntohl(ah->spi), ntohl(iph->daddr));
412 xfrm_state_put(x);
413}
414
415static int ah_init_state(struct xfrm_state *x)

--- 123 unchanged lines hidden ---
409 if (!x)
410 return;
411 printk(KERN_DEBUG "pmtu discovery on SA AH/%08x/%08x\n",
412 ntohl(ah->spi), ntohl(iph->daddr));
413 xfrm_state_put(x);
414}
415
416static int ah_init_state(struct xfrm_state *x)

--- 123 unchanged lines hidden ---