cregit-Linux how code gets into the kernel

Release 4.14 net/ipv4/xfrm4_tunnel.c

Directory: net/ipv4
/* xfrm4_tunnel.c: Generic IP tunnel transformer.
 *
 * Copyright (C) 2003 David S. Miller (davem@redhat.com)
 */


#define pr_fmt(fmt) "IPsec: " fmt

#include <linux/skbuff.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <net/xfrm.h>
#include <net/ip.h>
#include <net/protocol.h>


static int ipip_output(struct xfrm_state *x, struct sk_buff *skb) { skb_push(skb, -skb_network_offset(skb)); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu1860.00%466.67%
David S. Miller1033.33%116.67%
James Morris26.67%116.67%
Total30100.00%6100.00%


static int ipip_xfrm_rcv(struct xfrm_state *x, struct sk_buff *skb) { return ip_hdr(skb)->protocol; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller1875.00%150.00%
Herbert Xu625.00%150.00%
Total24100.00%2100.00%


static int ipip_init_state(struct xfrm_state *x) { if (x->props.mode != XFRM_MODE_TUNNEL) return -EINVAL; if (x->encap) return -EINVAL; x->props.header_len = sizeof(struct iphdr); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller2652.00%125.00%
James Morris1224.00%125.00%
Herbert Xu1020.00%125.00%
Masahide Nakamura24.00%125.00%
Total50100.00%4100.00%


static void ipip_destroy(struct xfrm_state *x) { }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller10100.00%1100.00%
Total10100.00%1100.00%

static const struct xfrm_type ipip_type = { .description = "IPIP", .owner = THIS_MODULE, .proto = IPPROTO_IPIP, .init_state = ipip_init_state, .destructor = ipip_destroy, .input = ipip_xfrm_rcv, .output = ipip_output };
static int xfrm_tunnel_rcv(struct sk_buff *skb) { return xfrm4_rcv_spi(skb, IPPROTO_IPIP, ip_hdr(skb)->saddr); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu26100.00%2100.00%
Total26100.00%2100.00%


static int xfrm_tunnel_err(struct sk_buff *skb, u32 info) { return -ENOENT; }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu18100.00%1100.00%
Total18100.00%1100.00%

static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = { .handler = xfrm_tunnel_rcv, .err_handler = xfrm_tunnel_err, .priority = 3, }; #if IS_ENABLED(CONFIG_IPV6) static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = { .handler = xfrm_tunnel_rcv, .err_handler = xfrm_tunnel_err, .priority = 2, }; #endif
static int __init ipip_init(void) { if (xfrm_register_type(&ipip_type, AF_INET) < 0) { pr_info("%s: can't add xfrm type\n", __func__); return -EAGAIN; } if (xfrm4_tunnel_register(&xfrm_tunnel_handler, AF_INET)) { pr_info("%s: can't add xfrm handler for AF_INET\n", __func__); xfrm_unregister_type(&ipip_type, AF_INET); return -EAGAIN; } #if IS_ENABLED(CONFIG_IPV6) if (xfrm4_tunnel_register(&xfrm64_tunnel_handler, AF_INET6)) { pr_info("%s: can't add xfrm handler for AF_INET6\n", __func__); xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET); xfrm_unregister_type(&ipip_type, AF_INET); return -EAGAIN; } #endif return 0; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller5648.70%120.00%
Kazunori Miyazawa4438.26%120.00%
Joe Perches1210.43%120.00%
Herbert Xu21.74%120.00%
Eric Dumazet10.87%120.00%
Total115100.00%5100.00%


static void __exit ipip_fini(void) { #if IS_ENABLED(CONFIG_IPV6) if (xfrm4_tunnel_deregister(&xfrm64_tunnel_handler, AF_INET6)) pr_info("%s: can't remove xfrm handler for AF_INET6\n", __func__); #endif if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET)) pr_info("%s: can't remove xfrm handler for AF_INET\n", __func__); if (xfrm_unregister_type(&ipip_type, AF_INET) < 0) pr_info("%s: can't remove xfrm type\n", __func__); }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller3347.14%120.00%
Kazunori Miyazawa2231.43%120.00%
Joe Perches1217.14%120.00%
Herbert Xu22.86%120.00%
Eric Dumazet11.43%120.00%
Total70100.00%5100.00%

module_init(ipip_init); module_exit(ipip_fini); MODULE_LICENSE("GPL"); MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_IPIP);

Overall Contributors

PersonTokensPropCommitsCommitProp
David S. Miller23047.13%13.85%
Herbert Xu9519.47%1246.15%
Kazunori Miyazawa9419.26%13.85%
Joe Perches316.35%27.69%
James Morris142.87%27.69%
Masahide Nakamura91.84%27.69%
Eric Dumazet61.23%311.54%
Thomas Schlichter51.02%13.85%
Arjan van de Ven30.61%13.85%
Nicolas Dichtel10.20%13.85%
Total488100.00%26100.00%
Directory: net/ipv4
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.