diff -urN xl2tpd-1.2.0-orig/control.c xl2tpd-1.2.0/control.c
--- xl2tpd-1.2.0-orig/control.c	2009-11-18 10:35:13.000000000 +0800
+++ xl2tpd-1.2.0/control.c	2009-11-18 10:34:32.000000000 +0800
@@ -158,6 +158,44 @@
     udp_xmit (buf, t);
 }
 
+static int get_ppp_num(void){
+	FILE *fp;
+	char tmpbuf[8], pbuf[256];
+	char *p;
+	int start_pnum = 650, i;
+
+	system("ifconfig | grep \"ppp\" | awk '{print $1}' > /tmp/ppp_num");
+	if((fp = fopen("/tmp/ppp_num", "r")) != NULL) {
+		p = pbuf;
+
+		while(fgets(tmpbuf, sizeof(tmpbuf), fp)) {
+			p += sprintf(p, "%s", tmpbuf);			
+		}
+		syslog(LOG_DEBUG, 
+		       "[Get PPP_Num] : used ... %s", 
+		       pbuf);		
+		fclose(fp);
+	}
+
+	if(strcmp(pbuf,"")==0){
+		syslog(LOG_DEBUG, 
+		       "[Get PPP_Num] : Assign ppp_num %d for in-coming call",start_pnum);
+		return start_pnum;
+	}
+
+	for(i = start_pnum; i<(start_pnum+32); i++){
+		sprintf(tmpbuf,"%d",i);
+		if(strstr(pbuf,tmpbuf))
+			continue;
+		syslog(LOG_DEBUG, 
+		       "[Get PPP_Num] : Assign ppp_num %d for in-coming call",i);
+		return i;
+	}
+	syslog(LOG_DEBUG, 
+		       "[Get PPP_Num] : not enough ppp_num ... assing 650 for in-coming call");
+	return start_pnum;
+}
+
 int control_finish (struct tunnel *t, struct call *c)
 {
     /*
@@ -181,6 +219,7 @@
     int i;
     int pppd_passwdfd[2];            
     int tmptid,tmpcid;
+	char unit[8];
 
     if (c->msgtype < 0)
     {
@@ -931,6 +971,9 @@
         po = NULL;
         po = add_opt (po, "passive");
         po = add_opt (po, "-detach");
+		po = add_opt (po, "unit");
+		sprintf(unit,"%d",get_ppp_num());
+		po = add_opt (po,unit);
         po = add_opt (po, "%s:%s", c->lns->localaddr ? ip1 : "", ip2);
         if (c->lns->authself)
         {
