--- zzzz-none-000/linux-2.6.28.10/drivers/net/pppoe.c 2009-05-02 18:54:43.000000000 +0000 +++ fusiv-7390-686/linux-2.6.28.10/drivers/net/pppoe.c 2012-02-14 14:37:49.000000000 +0000 @@ -82,6 +82,9 @@ #include #include +#if CONFIG_IPSEC_AP_SUPPORT +#include <../../../fusiv_src/kernel/ap_code/seclib/cendef.h> +#endif #define PPPOE_HASH_BITS 4 #define PPPOE_HASH_SIZE (1<pppoe_dev; struct pppoe_hdr *ph; int data_len = skb->len; +#if CONFIG_IPSEC_AP_SUPPORT + int ivlen=0,padlen=0,data_len1=0; +#endif if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) goto abort; @@ -886,7 +929,19 @@ ph->type = 1; ph->code = 0; ph->sid = po->num; +#if CONFIG_IPSEC_AP_SUPPORT + data_len1 = data_len; + if (skb->apFlowData.encap_protocol == PROCESS_ESP_ENCAP) + { + ivlen = ((skb->apFlowData.encAlg == CEN_DES) || (skb->apFlowData.encAlg == CEN_TDES))?8:16; + padlen = (data_len1 - 2 + 2)%ivlen; + if (padlen) padlen = ivlen - padlen; + data_len1 += ESP_TUNNEL_HEADER_SIZE+ivlen+padlen; + } + ph->length = htons(data_len1); +#else ph->length = htons(data_len); +#endif skb->protocol = __constant_htons(ETH_P_PPP_SES); skb->dev = dev; @@ -1090,7 +1145,54 @@ .owner = THIS_MODULE, }; +int isPPPModTypePPPoE(struct ppp_channel *pppchan) +{ + if ((pppchan->ops) && + (pppchan->ops->start_xmit) && + (pppchan->ops->start_xmit == pppoe_xmit)) + return 1; + + return 0; +} + +char *getPPPoEIfName(struct ppp_channel *pppchan) +{ + struct sock *sk = (struct sock *) pppchan->private; + struct pppox_sock *po; + + if (!sk) + return NULL; + + po = pppox_sk(sk); + + if (!po) + return NULL; + + if (po->pppoe_dev) + return po->pppoe_dev->name; + return NULL; +} + +int getPPPoESessIdAndAddr(struct ppp_channel *pppchan, unsigned char *addr) +{ + struct sock *sk = (struct sock *) pppchan->private; + struct pppox_sock *po; + int result; + + if (!sk) + return 0; + + po = pppox_sk(sk); + + if (!po) + return 0; + + for (result = 0; result < 6; result++) + addr[result] = po->pppoe_pa.remote[result]; + + return po->pppoe_pa.sid; +} static int __init pppoe_init(void) { int err = proto_register(&pppoe_sk_proto, 0); @@ -1131,6 +1233,16 @@ module_init(pppoe_init); module_exit(pppoe_exit); +EXPORT_SYMBOL(isPPPModTypePPPoE); +EXPORT_SYMBOL(getPPPoEIfName); +EXPORT_SYMBOL(getPPPoESessIdAndAddr); + +#if defined(CONFIG_FUSIV_KERNEL_PPPOE_RELAY) || defined(CONFIG_FUSIV_KERNEL_PPPOE_RELAY_MODULE) +EXPORT_SYMBOL(gbEnablePPPoERelay); +EXPORT_SYMBOL(relayGotDiscoveryPacket_ptr); +EXPORT_SYMBOL(relayGotSessionPacket_ptr); +#endif + MODULE_AUTHOR("Michal Ostrowski "); MODULE_DESCRIPTION("PPP over Ethernet driver"); MODULE_LICENSE("GPL");