]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-ultrix.c
Added -vjccid and vj-max-slots options, and reorganized in
[ppp.git] / pppd / sys-ultrix.c
index 46369e6cc1fcf9102e0d64df8aba1fc0816b9350..7fc4034e6b0cdecc568909eac88f98376faa45e9 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-ultrix.c,v 1.11 1995/05/01 00:25:38 paulus Exp $";
+static char rcsid[] = "$Id: sys-ultrix.c,v 1.14 1995/08/11 02:36:26 paulus Exp $";
 #endif
 
 /*
 #endif
 
 /*
@@ -52,6 +52,7 @@ static int initdisc = -1;     /* Initial TTY discipline */
 
 static int     restore_term;   /* 1 => we've munged the terminal */
 static struct termios inittermios; /* Initial TTY termios */
 
 static int     restore_term;   /* 1 => we've munged the terminal */
 static struct termios inittermios; /* Initial TTY termios */
+static struct winsize wsinfo;  /* Initial window size info */
 
 static char *lock_file;
 
 
 static char *lock_file;
 
@@ -336,8 +337,10 @@ set_up_tty(fd, local)
        die(1);
     }
 
        die(1);
     }
 
-    if (!restore_term)
+    if (!restore_term) {
        inittermios = tios;
        inittermios = tios;
+       ioctl(fd, TIOCGWINSZ, &wsinfo);
+    }
 
     tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
 #ifdef CRTSCTS
 
     tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
 #ifdef CRTSCTS
@@ -413,6 +416,7 @@ restore_tty()
        if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
            if (errno != ENXIO)
                syslog(LOG_WARNING, "tcsetattr: %m");
        if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
            if (errno != ENXIO)
                syslog(LOG_WARNING, "tcsetattr: %m");
+       ioctl(fd, TIOCSWINSZ, &wsinfo);
        restore_term = FALSE;
     }
 }
        restore_term = FALSE;
     }
 }
@@ -909,12 +913,12 @@ get_ether_addr(ipaddr, hwaddr)
     u_int32_t ipaddr;
     struct sockaddr *hwaddr;
 {
     u_int32_t ipaddr;
     struct sockaddr *hwaddr;
 {
-    struct ifreq *ifr, *ifend, *ifp;
+    struct ifreq *ifr, *ifend;
     u_int32_t ina, mask;
     u_int32_t ina, mask;
-    struct sockaddr_dl *dla;
     struct ifreq ifreq;
     struct ifconf ifc;
     struct ifreq ifs[MAX_IFS];
     struct ifreq ifreq;
     struct ifconf ifc;
     struct ifreq ifs[MAX_IFS];
+    struct ifdevea ifdevea;
 
     ifc.ifc_len = sizeof(ifs);
     ifc.ifc_req = ifs;
 
     ifc.ifc_len = sizeof(ifs);
     ifc.ifc_req = ifs;
@@ -961,26 +965,17 @@ get_ether_addr(ipaddr, hwaddr)
     syslog(LOG_INFO, "found interface %s for proxy arp", ifr->ifr_name);
 
     /*
     syslog(LOG_INFO, "found interface %s for proxy arp", ifr->ifr_name);
 
     /*
-     * Now scan through again looking for a link-level address
-     * for this interface.
+     * Grab the physical address for this interface.
      */
      */
-    ifp = ifr;
-    for (ifr = ifc.ifc_req; ifr < ifend; ) {
-        if (strcmp(ifp->ifr_name, ifr->ifr_name) == 0
-            && ifr->ifr_addr.sa_family == AF_DLI) {
-            /*
-             * Found the link-level address - copy it out
-             */
-            dla = (struct sockaddr_dl *)&ifr->ifr_addr;
-            hwaddr->sa_family = AF_UNSPEC;
-            BCOPY(dla, hwaddr->sa_data, sizeof(hwaddr->sa_data));
-            return 1;
-        }
-        ifr = (struct ifreq *) ((char *)&ifr->ifr_addr + sizeof(struct sockaddr)
-);
+    strncpy(ifdevea.ifr_name, ifr->ifr_name, sizeof(ifdevea.ifr_name));
+    if (ioctl(sockfd, SIOCRPHYSADDR, &ifdevea) < 0) {
+       syslog(LOG_ERR, "Couldn't get h/w address for %s: %m", ifr->ifr_name);
+       return 0;
     }
 
     }
 
-    return 0;
+    hwaddr->sa_family = AF_UNSPEC;
+    BCOPY(ifdevea.current_pa, hwaddr->sa_data, 6);
+    return 1;
 }
 
 /*
 }
 
 /*