--- zzzz-none-000/linux-3.10.107/net/ipv4/xfrm4_mode_transport.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/net/ipv4/xfrm4_mode_transport.c 2021-11-10 11:53:56.000000000 +0000 @@ -4,6 +4,12 @@ * Copyright (c) 2004-2006 Herbert Xu */ +/** + * Some part of this file is modified by Ikanos Communications. + * + * Copyright (C) 2013-2014 Ikanos Communications. + */ + #include #include #include @@ -13,6 +19,14 @@ #include #include +#if IS_ENABLED(CONFIG_FUSIV_KERNEL_AP_2_AP) +#if CONFIG_IPSEC_AP_SUPPORT +extern int (*ap2apIPsecUpdateFlowData_ptr)(struct sk_buff *skb, struct xfrm_state *xfrm,int direction); +#else +int (*ap2apL2tpOverIpsecUpdateFlowData_ptr)(struct sk_buff *skb, int direction) = NULL; +#endif +#endif + /* Add encapsulation header. * * The IP header will be moved forward to make space for the encapsulation @@ -23,6 +37,25 @@ struct iphdr *iph = ip_hdr(skb); int ihl = iph->ihl * 4; +#if IS_ENABLED(CONFIG_FUSIV_KERNEL_AP_2_AP) +#if CONFIG_IPSEC_AP_SUPPORT + /* The ESP processing will be done at security AP. Therefore nothing + to do here. */ + + if(ap2apIPsecUpdateFlowData_ptr) + { + if(!ap2apIPsecUpdateFlowData_ptr(skb,x,PROCESS_ESP_ENCAP)) + return 0; + } +#else +#ifdef CONFIG_L2TP_AP_SUPPORT + if(ap2apL2tpOverIpsecUpdateFlowData_ptr) + { + ap2apL2tpOverIpsecUpdateFlowData_ptr(skb, PROCESS_L2TP_ENCAP); + } +#endif +#endif +#endif skb_set_network_header(skb, -x->props.header_len); skb->mac_header = skb->network_header + offsetof(struct iphdr, protocol); @@ -78,3 +111,8 @@ module_exit(xfrm4_transport_exit); MODULE_LICENSE("GPL"); MODULE_ALIAS_XFRM_MODE(AF_INET, XFRM_MODE_TRANSPORT); +#if IS_ENABLED(CONFIG_FUSIV_KERNEL_AP_2_AP) +#ifndef CONFIG_IPSEC_AP_SUPPORT +EXPORT_SYMBOL(ap2apL2tpOverIpsecUpdateFlowData_ptr); +#endif +#endif