net/ipv6/ah6.c
changeset 2 d1f6d8b6f81c
parent 0 aa628870c1d3
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
   405 }
   405 }
   406 
   406 
   407 static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
   407 static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
   408 		    int type, int code, int offset, __be32 info)
   408 		    int type, int code, int offset, __be32 info)
   409 {
   409 {
       
   410 	struct net *net = dev_net(skb->dev);
   410 	struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
   411 	struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
   411 	struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset);
   412 	struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset);
   412 	struct xfrm_state *x;
   413 	struct xfrm_state *x;
   413 
   414 
   414 	if (type != ICMPV6_DEST_UNREACH &&
   415 	if (type != ICMPV6_DEST_UNREACH &&
   415 	    type != ICMPV6_PKT_TOOBIG)
   416 	    type != ICMPV6_PKT_TOOBIG)
   416 		return;
   417 		return;
   417 
   418 
   418 	x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, ah->spi, IPPROTO_AH, AF_INET6);
   419 	x = xfrm_state_lookup(net, (xfrm_address_t *)&iph->daddr, ah->spi, IPPROTO_AH, AF_INET6);
   419 	if (!x)
   420 	if (!x)
   420 		return;
   421 		return;
   421 
   422 
   422 	NETDEBUG(KERN_DEBUG "pmtu discovery on SA AH/%08x/" NIP6_FMT "\n",
   423 	NETDEBUG(KERN_DEBUG "pmtu discovery on SA AH/%08x/%pI6\n",
   423 		 ntohl(ah->spi), NIP6(iph->daddr));
   424 		 ntohl(ah->spi), &iph->daddr);
   424 
   425 
   425 	xfrm_state_put(x);
   426 	xfrm_state_put(x);
   426 }
   427 }
   427 
   428 
   428 static int ah6_init_state(struct xfrm_state *x)
   429 static int ah6_init_state(struct xfrm_state *x)
   507 
   508 
   508 	if (!ahp)
   509 	if (!ahp)
   509 		return;
   510 		return;
   510 
   511 
   511 	kfree(ahp->work_icv);
   512 	kfree(ahp->work_icv);
   512 	ahp->work_icv = NULL;
       
   513 	crypto_free_hash(ahp->tfm);
   513 	crypto_free_hash(ahp->tfm);
   514 	ahp->tfm = NULL;
       
   515 	kfree(ahp);
   514 	kfree(ahp);
   516 }
   515 }
   517 
   516 
   518 static const struct xfrm_type ah6_type =
   517 static const struct xfrm_type ah6_type =
   519 {
   518 {