+ syslog(LOG_ERR, "Couldn't create IP socket: %m");
+ die(1);
+ }
+
+ if (default_device)
+ tty_sid = getsid((pid_t)0);
+
+ /*
+ * Open the ppp device.
+ */
+ pppfd = open("/dev/streams/ppp", O_RDWR | O_NONBLOCK, 0);
+ if (pppfd < 0) {
+ syslog(LOG_ERR, "Can't open /dev/streams/ppp: %m");
+ die(1);
+ }
+ if (kdebugflag) {
+ x = PPPDBG_LOG + PPPDBG_DRIVER;
+ strioctl(pppfd, PPPIO_DEBUG, &x, sizeof(int), 0);
+ }
+
+ /* Assign a new PPA and get its unit number. */
+ if (strioctl(pppfd, PPPIO_NEWPPA, &ifunit, 0, sizeof(int)) < 0) {
+ syslog(LOG_ERR, "Can't create new PPP interface: %m");
+ die(1);
+ }
+
+ /*
+ * Open the ppp device again and push the if_ppp module on it.
+ */
+ iffd = open("/dev/streams/ppp", O_RDWR, 0);
+ if (iffd < 0) {
+ syslog(LOG_ERR, "Can't open /dev/streams/ppp (2): %m");
+ die(1);
+ }
+ if (kdebugflag) {
+ x = PPPDBG_LOG + PPPDBG_DRIVER;
+ strioctl(iffd, PPPIO_DEBUG, &x, sizeof(int), 0);
+ }
+ if (strioctl(iffd, PPPIO_ATTACH, &ifunit, sizeof(int), 0) < 0) {
+ syslog(LOG_ERR, "Couldn't attach ppp interface to device: %m");
+ die(1);
+ }
+ if (ioctl(iffd, I_PUSH, "if_ppp") < 0) {
+ syslog(LOG_ERR, "Can't push ppp interface module: %m");
+ die(1);
+ }
+ if (kdebugflag) {
+ x = PPPDBG_LOG + PPPDBG_IF;
+ strioctl(iffd, PPPIO_DEBUG, &x, sizeof(int), 0);
+ }
+ if (strioctl(iffd, PPPIO_NEWPPA, &ifunit, sizeof(int), 0) < 0) {
+ syslog(LOG_ERR, "Couldn't create ppp interface unit: %m");
+ die(1);
+ }
+ x = PPP_IP;
+ if (strioctl(iffd, PPPIO_BIND, &x, sizeof(int), 0) < 0) {
+ syslog(LOG_ERR, "Couldn't bind ppp interface to IP SAP: %m");
+ die(1);