diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2014-03-14 02:28:07 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2014-03-14 02:28:07 -0400 |
commit | e924d2d68738f3c63e460a829d4a0eb32e0638e3 (patch) | |
tree | 14d9e93e1024b1a2a2db1994dca639b37418363d /net/ipv6 | |
parent | d5860c5ccfcc20131634527ee3bc4a11a5168dd7 (diff) |
ah6: Use the IPsec protocol multiplexer API
Switch ah6 to use the new IPsec protocol multiplexer.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ah6.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 6c5f0949e0ab..72a4930bdc0a 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -643,8 +643,8 @@ out: | |||
643 | return err; | 643 | return err; |
644 | } | 644 | } |
645 | 645 | ||
646 | static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 646 | static int ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
647 | u8 type, u8 code, int offset, __be32 info) | 647 | u8 type, u8 code, int offset, __be32 info) |
648 | { | 648 | { |
649 | struct net *net = dev_net(skb->dev); | 649 | struct net *net = dev_net(skb->dev); |
650 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; | 650 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; |
@@ -653,17 +653,19 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
653 | 653 | ||
654 | if (type != ICMPV6_PKT_TOOBIG && | 654 | if (type != ICMPV6_PKT_TOOBIG && |
655 | type != NDISC_REDIRECT) | 655 | type != NDISC_REDIRECT) |
656 | return; | 656 | return 0; |
657 | 657 | ||
658 | x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, ah->spi, IPPROTO_AH, AF_INET6); | 658 | x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, ah->spi, IPPROTO_AH, AF_INET6); |
659 | if (!x) | 659 | if (!x) |
660 | return; | 660 | return 0; |
661 | 661 | ||
662 | if (type == NDISC_REDIRECT) | 662 | if (type == NDISC_REDIRECT) |
663 | ip6_redirect(skb, net, skb->dev->ifindex, 0); | 663 | ip6_redirect(skb, net, skb->dev->ifindex, 0); |
664 | else | 664 | else |
665 | ip6_update_pmtu(skb, net, info, 0, 0); | 665 | ip6_update_pmtu(skb, net, info, 0, 0); |
666 | xfrm_state_put(x); | 666 | xfrm_state_put(x); |
667 | |||
668 | return 0; | ||
667 | } | 669 | } |
668 | 670 | ||
669 | static int ah6_init_state(struct xfrm_state *x) | 671 | static int ah6_init_state(struct xfrm_state *x) |
@@ -748,6 +750,11 @@ static void ah6_destroy(struct xfrm_state *x) | |||
748 | kfree(ahp); | 750 | kfree(ahp); |
749 | } | 751 | } |
750 | 752 | ||
753 | static int ah6_rcv_cb(struct sk_buff *skb, int err) | ||
754 | { | ||
755 | return 0; | ||
756 | } | ||
757 | |||
751 | static const struct xfrm_type ah6_type = | 758 | static const struct xfrm_type ah6_type = |
752 | { | 759 | { |
753 | .description = "AH6", | 760 | .description = "AH6", |
@@ -761,10 +768,11 @@ static const struct xfrm_type ah6_type = | |||
761 | .hdr_offset = xfrm6_find_1stfragopt, | 768 | .hdr_offset = xfrm6_find_1stfragopt, |
762 | }; | 769 | }; |
763 | 770 | ||
764 | static const struct inet6_protocol ah6_protocol = { | 771 | static struct xfrm6_protocol ah6_protocol = { |
765 | .handler = xfrm6_rcv, | 772 | .handler = xfrm6_rcv, |
773 | .cb_handler = ah6_rcv_cb, | ||
766 | .err_handler = ah6_err, | 774 | .err_handler = ah6_err, |
767 | .flags = INET6_PROTO_NOPOLICY, | 775 | .priority = 0, |
768 | }; | 776 | }; |
769 | 777 | ||
770 | static int __init ah6_init(void) | 778 | static int __init ah6_init(void) |
@@ -774,7 +782,7 @@ static int __init ah6_init(void) | |||
774 | return -EAGAIN; | 782 | return -EAGAIN; |
775 | } | 783 | } |
776 | 784 | ||
777 | if (inet6_add_protocol(&ah6_protocol, IPPROTO_AH) < 0) { | 785 | if (xfrm6_protocol_register(&ah6_protocol, IPPROTO_AH) < 0) { |
778 | pr_info("%s: can't add protocol\n", __func__); | 786 | pr_info("%s: can't add protocol\n", __func__); |
779 | xfrm_unregister_type(&ah6_type, AF_INET6); | 787 | xfrm_unregister_type(&ah6_type, AF_INET6); |
780 | return -EAGAIN; | 788 | return -EAGAIN; |
@@ -785,7 +793,7 @@ static int __init ah6_init(void) | |||
785 | 793 | ||
786 | static void __exit ah6_fini(void) | 794 | static void __exit ah6_fini(void) |
787 | { | 795 | { |
788 | if (inet6_del_protocol(&ah6_protocol, IPPROTO_AH) < 0) | 796 | if (xfrm6_protocol_deregister(&ah6_protocol, IPPROTO_AH) < 0) |
789 | pr_info("%s: can't remove protocol\n", __func__); | 797 | pr_info("%s: can't remove protocol\n", __func__); |
790 | 798 | ||
791 | if (xfrm_unregister_type(&ah6_type, AF_INET6) < 0) | 799 | if (xfrm_unregister_type(&ah6_type, AF_INET6) < 0) |