*/
#ifndef lint
-static char rcsid[] = "$Id: sys-svr4.c,v 1.2 1995/06/01 01:31:28 paulus Exp $";
+static char rcsid[] = "$Id: sys-svr4.c,v 1.3 1995/06/23 01:54:11 paulus Exp $";
#endif
#include <stdio.h>
void
establish_ppp()
{
- int i;
+ int i, ifd;
pppfd = open("/dev/ppp", O_RDWR | O_NONBLOCK, 0);
if (pppfd < 0) {
die(1);
}
+ /*
+ * Open the ppp device again and link it under the ip multiplexor.
+ * IP will assign a unit number which hopefully is the same as ifunit.
+ * I don't know any way to be certain they will be the same. :-(
+ */
+ ifd = open("/dev/ppp", O_RDWR, 0);
+ if (ifd < 0) {
+ syslog(LOG_ERR, "Can't open /dev/ppp (2): %m");
+ die(1);
+ }
+ if (ioctl(ifd, I_PUSH, "ip") < 0) {
+ syslog(LOG_ERR, "Can't push IP module: %m");
+ close(ifd);
+ die(1);
+ }
+ ipmuxid = ioctl(ipfd, I_LINK, ifd);
+ close(ifd);
+ if (ipmuxid < 0) {
+ syslog(LOG_ERR, "Can't link PPP device to IP: %m");
+ die(1);
+ }
+
/* Pop any existing modules off the tty stream. */
for (i = 0;; ++i)
if (ioctl(fd, I_LOOK, tty_modules[i]) < 0
{
struct ifreq ifr;
- if (ipmuxid < 0) {
- syslog(LOG_DEBUG, "sifup: not plumbed!");
- return 0;
- }
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(ipfd, SIOCGIFFLAGS, &ifr) < 0) {
syslog(LOG_ERR, "Couldn't mark interface up (get): %m");
int u;
u_int32_t o, h, m;
{
- int fd;
struct ifreq ifr;
- fd = open("/dev/ppp", O_RDWR, 0);
- if (fd < 0) {
- syslog(LOG_ERR, "Can't open /dev/ppp (2): %m");
- die(1);
- }
- if (ioctl(fd, I_PUSH, "ip") < 0) {
- syslog(LOG_ERR, "Can't push IP module: %m");
- close(fd);
- return 0;
- }
- ipmuxid = ioctl(ipfd, I_LINK, fd);
- close(fd);
- if (ipmuxid < 0) {
- syslog(LOG_ERR, "Can't link PPP device to IP: %m");
- return 0;
- }
-
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
ifr.ifr_addr.sa_family = AF_INET;
int u;
u_int32_t o, h;
{
+#if 0
if (ipmuxid >= 0) {
if (ioctl(ipfd, I_UNLINK, ipmuxid) < 0) {
syslog(LOG_ERR, "Can't remove ppp interface unit: %m");
}
ipmuxid = -1;
}
+#endif
return 1;
}