ipcomp.c (2d8ad8719591fa803b0d589ed057fa46f49b7155) ipcomp.c (b71d1d426d263b0b6cb5760322efebbfc89d4463)
1/*
2 * IP Payload Compression Protocol (IPComp) - RFC3173.
3 *
4 * Copyright (c) 2003 James Morris <jmorris@intercode.com.au>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)

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

22#include <net/ipcomp.h>
23#include <net/protocol.h>
24#include <net/sock.h>
25
26static void ipcomp4_err(struct sk_buff *skb, u32 info)
27{
28 struct net *net = dev_net(skb->dev);
29 __be32 spi;
1/*
2 * IP Payload Compression Protocol (IPComp) - RFC3173.
3 *
4 * Copyright (c) 2003 James Morris <jmorris@intercode.com.au>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)

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

22#include <net/ipcomp.h>
23#include <net/protocol.h>
24#include <net/sock.h>
25
26static void ipcomp4_err(struct sk_buff *skb, u32 info)
27{
28 struct net *net = dev_net(skb->dev);
29 __be32 spi;
30 struct iphdr *iph = (struct iphdr *)skb->data;
30 const struct iphdr *iph = (const struct iphdr *)skb->data;
31 struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2));
32 struct xfrm_state *x;
33
34 if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH ||
35 icmp_hdr(skb)->code != ICMP_FRAG_NEEDED)
36 return;
37
38 spi = htonl(ntohs(ipch->cpi));
31 struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2));
32 struct xfrm_state *x;
33
34 if (icmp_hdr(skb)->type != ICMP_DEST_UNREACH ||
35 icmp_hdr(skb)->code != ICMP_FRAG_NEEDED)
36 return;
37
38 spi = htonl(ntohs(ipch->cpi));
39 x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr,
39 x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr,
40 spi, IPPROTO_COMP, AF_INET);
41 if (!x)
42 return;
43 NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%pI4\n",
44 spi, &iph->daddr);
45 xfrm_state_put(x);
46}
47

--- 138 unchanged lines hidden ---
40 spi, IPPROTO_COMP, AF_INET);
41 if (!x)
42 return;
43 NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%pI4\n",
44 spi, &iph->daddr);
45 xfrm_state_put(x);
46}
47

--- 138 unchanged lines hidden ---