/*
* Line specific open routine for async tty devices.
- * Attach the given tty to the first available ppp unit.
+ * Just make some checks and return.
* Called from device open routine or ttioctl() at >= splsofttty()
*/
/* ARGSUSED */
@@ -199,49 +200,25 @@
dev_t dev;
register struct tty *tp;
{
- struct proc *p = curproc; /* XXX */
+ struct proc *p = curproc; /* XXX */
register struct ppp_softc *sc;
int error, s;
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
-
+
+ printf("pppopen() enteredn");
s = spltty();
/* interface vars */
char ifname[32]; /* Interface name */
-int ifunit; /* Interface unit number */
char *progname; /* Name of this program */
char hostname[MAXNAMELEN]; /* Our hostname */
diff -urN /usr/src/usr.sbin/pppd/options.c pppd/options.c
--- /usr/src/usr.sbin/pppd/options.c Sat Jul 31 18:08:34 1999
+++ pppd/options.c Mon Aug 2 16:50:21 1999
@@ -85,6 +85,7 @@
int kdebugflag = 0; /* Tell kernel to print debug messages */
int default_device = 1; /* Using /dev/tty or equivalent */
char devnam[MAXPATHLEN] = "/dev/tty"; /* Device name */
+int ifunit = -1; /* PPP iface unit number, if -1 - auto */
int crtscts = 0; /* Use hardware flow control */
int modem = 1; /* Use modem control lines */
int inspeed = 0; /* Input/Output speed requested */
@@ -138,6 +139,7 @@
* Prototypes
*/
static int setdevname __P((char *, int));
+static int setpppunit __P((char **));
static int setspeed __P((char *));
static int setdebug __P((char **));
static int setkdebug __P((char **));
@@ -285,6 +287,7 @@
int num_args;
int (*cmd_func) __P((char **));
} cmds[] = {
+ {"pppunit",1,setpppunit}, /* Set PPP iface number */
{"-all", 0, noopt}, /* Don't request/allow any options (useless) */
{"noaccomp", 0, noaccomp}, /* Disable Address/Control compression */
{"-ac", 0, noaccomp}, /* Disable Address/Control compress */
@@ -1308,6 +1311,19 @@
return (1);
}
+/*
+ * setpppunit - Set PPP unit number.
+ */
+static int
+setpppunit(argv)
+ char **argv;
+{
+ int unit;
+ if (!number_option(*argv, &unit, 0))
+ return 0;
+ ifunit = unit;
+ return (1);
+}
/*
* setmru - Set the largest MTU we'll use.
diff -urN /usr/src/usr.sbin/pppd/patchlevel.h pppd/patchlevel.h
--- /usr/src/usr.sbin/pppd/patchlevel.h Sat Jun 20 22:02:14 1998
+++ pppd/patchlevel.h Mon Aug 2 16:48:18 1999
@@ -2,5 +2,5 @@
#define PATCHLEVEL 5
#define VERSION "2.3"
-#define IMPLEMENTATION ""
-#define DATE "4 May 1998"
+#define IMPLEMENTATION "-PPPIOCSUNIT"
+#define DATE "02 Aug 1999"
diff -urN /usr/src/usr.sbin/pppd/sys-bsd.c pppd/sys-bsd.c
--- /usr/src/usr.sbin/pppd/sys-bsd.c Sat Jul 31 18:08:34 1999
+++ pppd/sys-bsd.c Mon Aug 2 13:56:58 1999
@@ -236,10 +236,19 @@
}
if (!demand) {
+
+ /*
+ * Allocate async PPP unit
+ */
+ if (ioctl(fd, PPPIOCSUNIT, &ifunit) < 0) {
+ syslog(LOG_ERR, "ioctl(PPPIOCSUNIT): %m");
+ die(1);
+ }
+
/*
* Find out which interface we were given.
*/
- if (ioctl(fd, PPPIOCGUNIT, &ifunit) < 0) {
+ if (ioctl(fd, PPPIOCGUNIT, &ifunit) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCGUNIT): %m");
die(1);
}
587 Прочтений • [[FreeBSD] Патч для привязки имени PPP интерфейса к порту. (mac freebsd kernel patch ip)] [08.05.2012] [Комментариев: 0]