summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>1995-06-06 12:11:45 +0000
committerPaul Mackerras <paulus@samba.org>1995-06-06 12:11:45 +0000
commit86d0d78471849e25ab8be8706e467605cb609d81 (patch)
tree3abcc8d96236d5d2f9fd6af5325ac051bcaac6a0
parent41bd52fb6047d183d77b914449006deb59425463 (diff)
downloadppp-PPP_NEW_START.tar.gz
Minor fixes from the NetBSD port: fd -> ppp_fd in sys-bsd.c, etc.PPP_NEW_START
-rw-r--r--pppd/Makefile.bsd6
-rw-r--r--pppd/main.c3
-rw-r--r--pppd/sys-bsd.c47
3 files changed, 31 insertions, 25 deletions
diff --git a/pppd/Makefile.bsd b/pppd/Makefile.bsd
index ec15113..20e0808 100644
--- a/pppd/Makefile.bsd
+++ b/pppd/Makefile.bsd
@@ -1,11 +1,11 @@
-# $Id: Makefile.bsd,v 1.7 1995/04/27 00:19:50 paulus Exp $
+# $Id: Makefile.bsd,v 1.7.2.1 1995/06/06 12:11:41 paulus Exp $
BINDIR?= /usr/sbin
-CFLAGS+= -I.. -DHAVE_PATHS_H
+CFLAGS+= -g -I.. -DHAVE_PATHS_H
PROG= pppd
SRCS= main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
- auth.c options.c sys-bsd.c
+ demand.c auth.c options.c sys-bsd.c
MAN8= pppd.0
# The next line is for NetBSD-current systems.
MAN= pppd.cat8
diff --git a/pppd/main.c b/pppd/main.c
index 51b5535..dd2fef6 100644
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.23.2.1 1995/06/01 07:01:31 paulus Exp $";
+static char rcsid[] = "$Id: main.c,v 1.23.2.2 1995/06/06 12:11:43 paulus Exp $";
#endif
#include <stdio.h>
@@ -293,6 +293,7 @@ main(argc, argv)
/*
* Configure the interface and mark it up, etc.
*/
+ fd = loop_fd;
demand_conf();
}
diff --git a/pppd/sys-bsd.c b/pppd/sys-bsd.c
index c6deb26..838c032 100644
--- a/pppd/sys-bsd.c
+++ b/pppd/sys-bsd.c
@@ -19,7 +19,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: sys-bsd.c,v 1.19.2.1 1995/06/01 07:01:39 paulus Exp $";
+static char rcsid[] = "$Id: sys-bsd.c,v 1.19.2.2 1995/06/06 12:11:45 paulus Exp $";
#endif
/*
@@ -92,6 +92,10 @@ void
sys_close()
{
close(sockfd);
+ if (loop_slave >= 0) {
+ close(loop_slave);
+ close(loop_master);
+ }
closelog();
}
@@ -428,7 +432,7 @@ output(unit, p, len)
if (debug)
log_packet(p, len, "sent ");
- if (write(fd, p, len) < 0) {
+ if (write(ppp_fd, p, len) < 0) {
syslog(LOG_ERR, "write: %m");
die(1);
}
@@ -556,18 +560,18 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp)
die(1);
}
- if (ioctl(fd, PPPIOCSASYNCMAP, (caddr_t) &asyncmap) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSASYNCMAP, (caddr_t) &asyncmap) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCSASYNCMAP): %m");
die(1);
}
- if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m");
die(1);
}
x = pcomp? x | SC_COMP_PROT: x &~ SC_COMP_PROT;
x = accomp? x | SC_COMP_AC: x &~ SC_COMP_AC;
- if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
die(1);
}
@@ -582,7 +586,7 @@ ppp_set_xaccm(unit, accm)
int unit;
ext_accm accm;
{
- if (ioctl(fd, PPPIOCSXASYNCMAP, accm) < 0 && errno != ENOTTY)
+ if (ioctl(ppp_fd, PPPIOCSXASYNCMAP, accm) < 0 && errno != ENOTTY)
syslog(LOG_WARNING, "ioctl(set extended ACCM): %m");
}
@@ -599,20 +603,20 @@ ppp_recv_config(unit, mru, asyncmap, pcomp, accomp)
{
int x;
- if (ioctl(fd, PPPIOCSMRU, (caddr_t) &mru) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSMRU, (caddr_t) &mru) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCSMRU): %m");
die(1);
}
- if (ioctl(fd, PPPIOCSRASYNCMAP, (caddr_t) &asyncmap) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSRASYNCMAP, (caddr_t) &asyncmap) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCSRASYNCMAP): %m");
die(1);
}
- if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m");
die(1);
}
x = !accomp? x | SC_REJ_COMP_AC: x &~ SC_REJ_COMP_AC;
- if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
die(1);
}
@@ -631,7 +635,7 @@ ccp_test(unit, opt_ptr, opt_len, for_transmit)
data.ptr = opt_ptr;
data.length = opt_len;
data.transmit = for_transmit;
- return ioctl(fd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0;
+ return ioctl(ppp_fd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0;
}
/*
@@ -643,13 +647,13 @@ ccp_flags_set(unit, isopen, isup)
{
int x;
- if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m");
return;
}
x = isopen? x | SC_CCP_OPEN: x &~ SC_CCP_OPEN;
x = isup? x | SC_CCP_UP: x &~ SC_CCP_UP;
- if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0)
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) < 0)
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
}
@@ -664,7 +668,7 @@ ccp_fatal_error(unit)
{
int x;
- if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCGFLAGS): %m");
return 0;
}
@@ -679,7 +683,7 @@ get_idle_time(u, ip)
int u;
struct ppp_idle *ip;
{
- return ioctl(fd, PPPIOCGIDLE, ip) >= 0;
+ return ioctl(ppp_fd, PPPIOCGIDLE, ip) >= 0;
}
@@ -692,17 +696,17 @@ sifvjcomp(u, vjcomp, cidcomp, maxcid)
{
u_int x;
- if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m");
return 0;
}
x = vjcomp ? x | SC_COMP_TCP: x &~ SC_COMP_TCP;
x = cidcomp? x & ~SC_NO_TCP_CCID: x | SC_NO_TCP_CCID;
- if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
return 0;
}
- if (ioctl(fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0) {
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
return 0;
}
@@ -731,7 +735,7 @@ sifup(u)
}
npi.protocol = PPP_IP;
npi.mode = NPMODE_PASS;
- if (ioctl(fd, PPPIOCSNPMODE, &npi) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSNPMODE, &npi) < 0) {
syslog(LOG_ERR, "ioctl(set IP mode to PASS): %m");
return 0;
}
@@ -751,7 +755,7 @@ sifnpmode(u, proto, mode)
npi.protocol = proto;
npi.mode = mode;
- if (ioctl(fd, PPPIOCSNPMODE, &npi) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSNPMODE, &npi) < 0) {
syslog(LOG_ERR, "ioctl(set NP %d mode to %d): %m", proto, mode);
return 0;
}
@@ -846,7 +850,8 @@ cifaddr(u, o, h)
((struct sockaddr_in *) &ifra.ifra_broadaddr)->sin_addr.s_addr = h;
BZERO(&ifra.ifra_mask, sizeof(ifra.ifra_mask));
if (ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifra) < 0) {
- syslog(LOG_WARNING, "ioctl(SIOCDIFADDR): %m");
+ if (errno != EADDRNOTAVAIL)
+ syslog(LOG_WARNING, "ioctl(SIOCDIFADDR): %m");
return 0;
}
return 1;