diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-22 19:33:00 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-22 19:33:00 -0400 |
| commit | 38afd6adf6bccd7176e88c07cac104d3639aa30d (patch) | |
| tree | 2142409984b609e51ef60b6a14318dd4e878718a /net/ipv4/ipip.c | |
| parent | 8ed1383fb7b6685968588141d5934e0e6715e954 (diff) | |
| parent | 261688d01ec07d3a265b8ace6ec68310fbd96a96 (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'net/ipv4/ipip.c')
| -rw-r--r-- | net/ipv4/ipip.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 68a78731f722..c3947cd566b7 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
| @@ -273,7 +273,7 @@ static void ipip_tunnel_uninit(struct net_device *dev) | |||
| 273 | dev_put(dev); | 273 | dev_put(dev); |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | static void ipip_err(struct sk_buff *skb, void *__unused) | 276 | static void ipip_err(struct sk_buff *skb, u32 info) |
| 277 | { | 277 | { |
| 278 | #ifndef I_WISH_WORLD_WERE_PERFECT | 278 | #ifndef I_WISH_WORLD_WERE_PERFECT |
| 279 | 279 | ||
| @@ -852,11 +852,39 @@ static int __init ipip_fb_tunnel_init(struct net_device *dev) | |||
| 852 | return 0; | 852 | return 0; |
| 853 | } | 853 | } |
| 854 | 854 | ||
| 855 | #ifdef CONFIG_INET_TUNNEL | ||
| 855 | static struct xfrm_tunnel ipip_handler = { | 856 | static struct xfrm_tunnel ipip_handler = { |
| 856 | .handler = ipip_rcv, | 857 | .handler = ipip_rcv, |
| 857 | .err_handler = ipip_err, | 858 | .err_handler = ipip_err, |
| 858 | }; | 859 | }; |
| 859 | 860 | ||
| 861 | static inline int ipip_register(void) | ||
| 862 | { | ||
| 863 | return xfrm4_tunnel_register(&ipip_handler); | ||
| 864 | } | ||
| 865 | |||
| 866 | static inline int ipip_unregister(void) | ||
| 867 | { | ||
| 868 | return xfrm4_tunnel_deregister(&ipip_handler); | ||
| 869 | } | ||
| 870 | #else | ||
| 871 | static struct net_protocol ipip_protocol = { | ||
| 872 | .handler = ipip_rcv, | ||
| 873 | .err_handler = ipip_err, | ||
| 874 | .no_policy = 1, | ||
| 875 | }; | ||
| 876 | |||
| 877 | static inline int ipip_register(void) | ||
| 878 | { | ||
| 879 | return inet_add_protocol(&ipip_protocol, IPPROTO_IPIP); | ||
| 880 | } | ||
| 881 | |||
| 882 | static inline int ipip_unregister(void) | ||
| 883 | { | ||
| 884 | return inet_del_protocol(&ipip_protocol, IPPROTO_IPIP); | ||
| 885 | } | ||
| 886 | #endif | ||
| 887 | |||
| 860 | static char banner[] __initdata = | 888 | static char banner[] __initdata = |
| 861 | KERN_INFO "IPv4 over IPv4 tunneling driver\n"; | 889 | KERN_INFO "IPv4 over IPv4 tunneling driver\n"; |
| 862 | 890 | ||
| @@ -866,7 +894,7 @@ static int __init ipip_init(void) | |||
| 866 | 894 | ||
| 867 | printk(banner); | 895 | printk(banner); |
| 868 | 896 | ||
| 869 | if (xfrm4_tunnel_register(&ipip_handler) < 0) { | 897 | if (ipip_register() < 0) { |
| 870 | printk(KERN_INFO "ipip init: can't register tunnel\n"); | 898 | printk(KERN_INFO "ipip init: can't register tunnel\n"); |
| 871 | return -EAGAIN; | 899 | return -EAGAIN; |
| 872 | } | 900 | } |
| @@ -888,13 +916,13 @@ static int __init ipip_init(void) | |||
| 888 | err2: | 916 | err2: |
| 889 | free_netdev(ipip_fb_tunnel_dev); | 917 | free_netdev(ipip_fb_tunnel_dev); |
| 890 | err1: | 918 | err1: |
| 891 | xfrm4_tunnel_deregister(&ipip_handler); | 919 | ipip_unregister(); |
| 892 | goto out; | 920 | goto out; |
| 893 | } | 921 | } |
| 894 | 922 | ||
| 895 | static void __exit ipip_fini(void) | 923 | static void __exit ipip_fini(void) |
| 896 | { | 924 | { |
| 897 | if (xfrm4_tunnel_deregister(&ipip_handler) < 0) | 925 | if (ipip_unregister() < 0) |
| 898 | printk(KERN_INFO "ipip close: can't deregister tunnel\n"); | 926 | printk(KERN_INFO "ipip close: can't deregister tunnel\n"); |
| 899 | 927 | ||
| 900 | unregister_netdev(ipip_fb_tunnel_dev); | 928 | unregister_netdev(ipip_fb_tunnel_dev); |
