cregit-Linux how code gets into the kernel

Release 4.8 net/netfilter/ipvs/ip_vs_proto_ah_esp.c

/*
 * ip_vs_proto_ah_esp.c:        AH/ESP IPSec load balancing support for IPVS
 *
 * Authors:     Julian Anastasov <ja@ssi.bg>, February 2002
 *              Wensong Zhang <wensong@linuxvirtualserver.org>
 *
 *              This program is free software; you can redistribute it and/or
 *              modify it under the terms of the GNU General Public License
 *              version 2 as published by the Free Software Foundation;
 *
 */


#define KMSG_COMPONENT "IPVS"

#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt

#include <linux/in.h>
#include <linux/ip.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>

#include <net/ip_vs.h>


/* TODO:

struct isakmp_hdr {
        __u8            icookie[8];
        __u8            rcookie[8];
        __u8            np;
        __u8            version;
        __u8            xchgtype;
        __u8            flags;
        __u32           msgid;
        __u32           length;
};

*/


#define PORT_ISAKMP	500


static void ah_esp_conn_fill_param_proto(struct netns_ipvs *ipvs, int af, const struct ip_vs_iphdr *iph, struct ip_vs_conn_param *p) { if (likely(!ip_vs_iph_inverse(iph))) ip_vs_conn_fill_param(ipvs, af, IPPROTO_UDP, &iph->saddr, htons(PORT_ISAKMP), &iph->daddr, htons(PORT_ISAKMP), p); else ip_vs_conn_fill_param(ipvs, af, IPPROTO_UDP, &iph->daddr, htons(PORT_ISAKMP), &iph->saddr, htons(PORT_ISAKMP), p); }

Contributors

PersonTokensPropCommitsCommitProp
wensong zhangwensong zhang5757.58%111.11%
julius volzjulius volz1212.12%222.22%
simon hormansimon horman1212.12%111.11%
hans schillstromhans schillstrom55.05%111.11%
eric w. biedermaneric w. biederman44.04%111.11%
alex gartrellalex gartrell44.04%111.11%
hideaki yoshifujihideaki yoshifuji44.04%111.11%
julian anastasovjulian anastasov11.01%111.11%
Total99100.00%9100.00%


static struct ip_vs_conn * ah_esp_conn_in_get(struct netns_ipvs *ipvs, int af, const struct sk_buff *skb, const struct ip_vs_iphdr *iph) { struct ip_vs_conn *cp; struct ip_vs_conn_param p; ah_esp_conn_fill_param_proto(ipvs, af, iph, &p); cp = ip_vs_conn_in_get(&p); if (!cp) { /* * We are not sure if the packet is from our * service, so our conn_schedule hook should return NF_ACCEPT */ IP_VS_DBG_BUF(12, "Unknown ISAKMP entry for outin packet " "%s%s %s->%s\n", ip_vs_iph_icmp(iph) ? "ICMP+" : "", ip_vs_proto_get(iph->protocol)->name, IP_VS_DBG_ADDR(af, &iph->saddr), IP_VS_DBG_ADDR(af, &iph->daddr)); } return cp; }

Contributors

PersonTokensPropCommitsCommitProp
simon hormansimon horman4942.98%111.11%
wensong zhangwensong zhang3732.46%111.11%
julius volzjulius volz108.77%111.11%
hans schillstromhans schillstrom76.14%222.22%
eric w. biedermaneric w. biederman65.26%222.22%
alex gartrellalex gartrell43.51%111.11%
julian anastasovjulian anastasov10.88%111.11%
Total114100.00%9100.00%


static struct ip_vs_conn * ah_esp_conn_out_get(struct netns_ipvs *ipvs, int af, const struct sk_buff *skb, const struct ip_vs_iphdr *iph) { struct ip_vs_conn *cp; struct ip_vs_conn_param p; ah_esp_conn_fill_param_proto(ipvs, af, iph, &p); cp = ip_vs_conn_out_get(&p); if (!cp) { IP_VS_DBG_BUF(12, "Unknown ISAKMP entry for inout packet " "%s%s %s->%s\n", ip_vs_iph_icmp(iph) ? "ICMP+" : "", ip_vs_proto_get(iph->protocol)->name, IP_VS_DBG_ADDR(af, &iph->saddr), IP_VS_DBG_ADDR(af, &iph->daddr)); } return cp; }

Contributors

PersonTokensPropCommitsCommitProp
wensong zhangwensong zhang6860.18%19.09%
julius volzjulius volz1916.81%327.27%
simon hormansimon horman76.19%19.09%
hans schillstromhans schillstrom76.19%218.18%
eric w. biedermaneric w. biederman65.31%218.18%
alex gartrellalex gartrell43.54%19.09%
julian anastasovjulian anastasov21.77%19.09%
Total113100.00%11100.00%


static int ah_esp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, int *verdict, struct ip_vs_conn **cpp, struct ip_vs_iphdr *iph) { /* * AH/ESP is only related traffic. Pass the packet to IP stack. */ *verdict = NF_ACCEPT; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
wensong zhangwensong zhang3164.58%116.67%
jesper dangaard brouerjesper dangaard brouer510.42%116.67%
eric w. biedermaneric w. biederman510.42%116.67%
julius volzjulius volz510.42%233.33%
hans schillstromhans schillstrom24.17%116.67%
Total48100.00%6100.00%

#ifdef CONFIG_IP_VS_PROTO_AH struct ip_vs_protocol ip_vs_protocol_ah = { .name = "AH", .protocol = IPPROTO_AH, .num_states = 1, .dont_defrag = 1, .init = NULL, .exit = NULL, .conn_schedule = ah_esp_conn_schedule, .conn_in_get = ah_esp_conn_in_get, .conn_out_get = ah_esp_conn_out_get, .snat_handler = NULL, .dnat_handler = NULL, .csum_check = NULL, .state_transition = NULL, .register_app = NULL, .unregister_app = NULL, .app_conn_bind = NULL, .debug_packet = ip_vs_tcpudp_debug_packet, .timeout_change = NULL, /* ISAKMP */ }; #endif #ifdef CONFIG_IP_VS_PROTO_ESP struct ip_vs_protocol ip_vs_protocol_esp = { .name = "ESP", .protocol = IPPROTO_ESP, .num_states = 1, .dont_defrag = 1, .init = NULL, .exit = NULL, .conn_schedule = ah_esp_conn_schedule, .conn_in_get = ah_esp_conn_in_get, .conn_out_get = ah_esp_conn_out_get, .snat_handler = NULL, .dnat_handler = NULL, .csum_check = NULL, .state_transition = NULL, .register_app = NULL, .unregister_app = NULL, .app_conn_bind = NULL, .debug_packet = ip_vs_tcpudp_debug_packet, .timeout_change = NULL, /* ISAKMP */ }; #endif

Overall Contributors

PersonTokensPropCommitsCommitProp
wensong zhangwensong zhang29447.57%14.76%
julius volzjulius volz15525.08%314.29%
simon hormansimon horman6811.00%14.76%
hans schillstromhans schillstrom264.21%314.29%
eric w. biedermaneric w. biederman213.40%419.05%
julian anastasovjulian anastasov162.59%419.05%
alex gartrellalex gartrell121.94%14.76%
hannes ederhannes eder111.78%14.76%
arnaldo carvalho de meloarnaldo carvalho de melo60.97%14.76%
jesper dangaard brouerjesper dangaard brouer50.81%14.76%
hideaki yoshifujihideaki yoshifuji40.65%14.76%
Total618100.00%21100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.