ct = ip_vs_conn_in_get(IPPROTO_IP, snet, 0, 
ct = ip_vs_ct_in_get(IPPROTO_IP, snet, 0, 
ip_vs_sched_persist(struct ip_vs_service *svc,		    const struct sk_buff *skb,		    __u16 ports[2]){	struct ip_vs_conn *cp = NULL;	struct iphdr *iph = skb->nh.iph;	struct ip_vs_dest *dest;	struct ip_vs_conn *ct;	__u16  dport;	 /* destination port to forward */	__u32  snet;	 /* source network of the client, after masking */	/* Mask saddr with the netmask to adjust template granularity */	snet = iph->saddr & svc->netmask;	IP_VS_DBG(6, "p-schedule: src %u.%u.%u.%u:%u dest %u.%u.%u.%u:%u "		  "mnet %u.%u.%u.%u\n",		  NIPQUAD(iph->saddr), ntohs(ports[0]),		  NIPQUAD(iph->daddr), ntohs(ports[1]),		  NIPQUAD(snet));	/*	 * As far as we know, FTP is a very complicated network protocol, and	 * it uses control connection and data connections. For active FTP,	 * FTP server initialize data connection to the client, its source port	 * is often 20. For passive FTP, FTP server tells the clients the port	 * that it passively listens to,  and the client issues the data	 * connection. In the tunneling or direct routing mode, the load	 * balancer is on the client-to-server half of connection, the port	 * number is unknown to the load balancer. So, a conn template like	 * <caddr, 0, vaddr, 0, daddr, 0> is created for persistent FTP	 * service, and a template like <caddr, 0, vaddr, vport, daddr, dport>	 * is created for other persistent services.	 */	if (ports[1] == svc->port) {		/* Check if a template already exists */		if (svc->port != FTPPORT)			ct = ip_vs_conn_in_get(iph->protocol, snet, 0,					       iph->daddr, ports[1]);		else			ct = ip_vs_conn_in_get(iph->protocol, snet, 0,					       iph->daddr, 0);		if (!ct || !ip_vs_check_template(ct)) {			/*			 * No template found or the dest of the connection			 * template is not available.			 */			dest = svc->scheduler->schedule(svc, skb);			if (dest == NULL) {				IP_VS_DBG(1, "p-schedule: no dest found.\n");				return NULL;			}			/*			 * Create a template like <protocol,caddr,0,			 * vaddr,vport,daddr,dport> for non-ftp service,			 * and <protocol,caddr,0,vaddr,0,daddr,0>			 * for ftp service.			 */			if (svc->port != FTPPORT)				ct = ip_vs_conn_new(iph->protocol,						    snet, 0,						    iph->daddr,						    ports[1],						    dest->addr, dest->port,						    0,						    dest);			else				ct = ip_vs_conn_new(iph->protocol,						    snet, 0,						    iph->daddr, 0,						    dest->addr, 0,						    0,						    dest);			if (ct == NULL)				return NULL;			ct->timeout = svc->timeout;		} else {			/* set destination with the found template */			dest = ct->dest;		}		dport = dest->port;	} else {		/*		 * Note: persistent fwmark-based services and persistent		 * port zero service are handled here.		 * fwmark template: <IPPROTO_IP,caddr,0,fwmark,0,daddr,0>		 * port zero template: <protocol,caddr,0,vaddr,0,daddr,0>		 */		if (svc->fwmark)			ct = ip_vs_conn_in_get(IPPROTO_IP, snet, 0,					       htonl(svc->fwmark), 0);		else			ct = ip_vs_conn_in_get(iph->protocol, snet, 0,					       iph->daddr, 0);		if (!ct || !ip_vs_check_template(ct)) {			/*			 * If it is not persistent port zero, return NULL,			 * otherwise create a connection template.			 */			if (svc->port)				return NULL;			dest = svc->scheduler->schedule(svc, skb);			if (dest == NULL) {				IP_VS_DBG(1, "p-schedule: no dest found.\n");				return NULL;			}			/*			 * Create a template according to the service			 */			if (svc->fwmark)				ct = ip_vs_conn_new(IPPROTO_IP,						    snet, 0,						    htonl(svc->fwmark), 0,						    dest->addr, 0,						    0,						    dest);			else				ct = ip_vs_conn_new(iph->protocol,						    snet, 0,						    iph->daddr, 0,						    dest->addr, 0,						    0,						    dest);			if (ct == NULL)				return NULL;			ct->timeout = svc->timeout;		} else {			/* set destination with the found template */			dest = ct->dest;		}		dport = ports[1];	}	/*	 *    Create a new connection according to the template	 */	cp = ip_vs_conn_new(iph->protocol,			    iph->saddr, ports[0],			    iph->daddr, ports[1],			    dest->addr, dport,			    0,			    dest);	if (cp == NULL) {		ip_vs_conn_put(ct);		return NULL;	}	/*	 *    Add its control	 */	ip_vs_control_add(cp, ct);	ip_vs_conn_put(ct);	ip_vs_conn_stats(cp, svc);	return cp;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/87375ab47cd0ba04124c6d3fd80db5c368f5dcb6/ip_vs_core.c/buggy/net/ipv4/ipvs/ip_vs_core.c