Make gcc-2.8.1 build ppp cleanly.
Support OpenBSD again.
This commit is contained in:
parent
9592529e9d
commit
e43ebac1c2
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.36.2.9 1998/04/03 19:25:19 brian Exp $
|
||||
# $Id: Makefile,v 1.36.2.10 1998/04/16 00:25:45 brian Exp $
|
||||
|
||||
PROG= ppp
|
||||
SRCS= arp.c async.c auth.c bundle.c ccp.c chap.c chat.c command.c \
|
||||
@ -7,13 +7,20 @@ SRCS= arp.c async.c auth.c bundle.c ccp.c chap.c chat.c command.c \
|
||||
mp.c pap.c physical.c pred.c prompt.c route.c server.c sig.c \
|
||||
slcompress.c systems.c throughput.c timer.c tun.c vjcomp.c
|
||||
CFLAGS+=-Wall -Wpointer-arith
|
||||
LDADD+= -lmd -lcrypt -lutil -lz
|
||||
LDADD+= -lutil -lz
|
||||
DPADD+= ${LIBMD} ${LIBCRYPT} ${LIBUTIL} ${LIBZ}
|
||||
MAN8= ppp.8
|
||||
BINMODE=4550
|
||||
BINOWN= root
|
||||
BINGRP= network
|
||||
|
||||
OPSYS!= uname -s
|
||||
.if (${OPSYS} == "OpenBSD")
|
||||
MAN= ppp.8
|
||||
.else
|
||||
MAN8= ppp.8
|
||||
LDADD+= -lmd -lcrypt
|
||||
.endif
|
||||
|
||||
.if defined(RELEASE_CRUNCH)
|
||||
CFLAGS+=-DRELEASE_CRUNCH
|
||||
.endif
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.c,v 1.1.2.60 1998/04/24 19:15:34 brian Exp $
|
||||
* $Id: bundle.c,v 1.1.2.61 1998/04/24 19:15:57 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -35,6 +35,7 @@
|
||||
#include <net/if_dl.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <net/if_tun.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -680,7 +681,7 @@ bundle_SetRoute(struct bundle *bundle, int cmd, struct in_addr dst,
|
||||
cp = rtmes.m_space;
|
||||
memcpy(cp, &rtdata, rtdata.sin_len);
|
||||
cp += rtdata.sin_len;
|
||||
if (cmd == RTM_ADD)
|
||||
if (cmd == RTM_ADD) {
|
||||
if (gateway.s_addr == INADDR_ANY) {
|
||||
/* Add a route through the interface */
|
||||
struct sockaddr_dl dl;
|
||||
@ -706,6 +707,7 @@ bundle_SetRoute(struct bundle *bundle, int cmd, struct in_addr dst,
|
||||
cp += rtdata.sin_len;
|
||||
rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY;
|
||||
}
|
||||
}
|
||||
|
||||
if (dst.s_addr == INADDR_ANY)
|
||||
mask.s_addr = INADDR_ANY;
|
||||
@ -728,7 +730,7 @@ bundle_SetRoute(struct bundle *bundle, int cmd, struct in_addr dst,
|
||||
LogPrintf(LogTCPIP, "bundle_SetRoute: Mask = %s\n", inet_ntoa(mask));
|
||||
failed:
|
||||
if (cmd == RTM_ADD && (rtmes.m_rtm.rtm_errno == EEXIST ||
|
||||
(rtmes.m_rtm.rtm_errno == 0 && errno == EEXIST)))
|
||||
(rtmes.m_rtm.rtm_errno == 0 && errno == EEXIST))) {
|
||||
if (!bang)
|
||||
LogPrintf(LogWARN, "Add route failed: %s already exists\n",
|
||||
inet_ntoa(dst));
|
||||
@ -737,7 +739,7 @@ failed:
|
||||
if ((wb = ID0write(s, &rtmes, nb)) < 0)
|
||||
goto failed;
|
||||
}
|
||||
else if (cmd == RTM_DELETE &&
|
||||
} else if (cmd == RTM_DELETE &&
|
||||
(rtmes.m_rtm.rtm_errno == ESRCH ||
|
||||
(rtmes.m_rtm.rtm_errno == 0 && errno == ESRCH))) {
|
||||
if (!bang)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ccp.c,v 1.30.2.37 1998/04/24 19:15:23 brian Exp $
|
||||
* $Id: ccp.c,v 1.30.2.38 1998/04/24 19:15:36 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Support other compression protocols
|
||||
@ -463,7 +463,7 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
|
||||
cp += cp[1];
|
||||
}
|
||||
|
||||
if (mode_type != MODE_NOP)
|
||||
if (mode_type != MODE_NOP) {
|
||||
if (dec->rejend != dec->rej) {
|
||||
/* rejects are preferred */
|
||||
dec->ackend = dec->ack;
|
||||
@ -480,6 +480,7 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
|
||||
ccp->in.algorithm = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -542,7 +543,7 @@ ccp_Decompress(struct ccp *ccp, u_short *proto, struct mbuf *bp)
|
||||
* If proto isn't PROTO_[I]COMPD, we still want to pass it to the
|
||||
* decompression routines so that the dictionary's updated
|
||||
*/
|
||||
if (ccp->fsm.state == ST_OPENED)
|
||||
if (ccp->fsm.state == ST_OPENED) {
|
||||
if (*proto == PROTO_COMPD || *proto == PROTO_ICOMPD) {
|
||||
/* Decompress incoming data */
|
||||
if (ccp->reset_sent != -1)
|
||||
@ -557,6 +558,7 @@ ccp_Decompress(struct ccp *ccp, u_short *proto, struct mbuf *bp)
|
||||
/* Add incoming Network Layer traffic to our dictionary */
|
||||
(*algorithm[ccp->in.algorithm]->i.DictSetup)
|
||||
(ccp->in.state, ccp, *proto, bp);
|
||||
}
|
||||
|
||||
return bp;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: command.c,v 1.131.2.70 1998/04/24 19:15:37 brian Exp $
|
||||
* $Id: command.c,v 1.131.2.71 1998/04/24 19:15:59 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
@ -291,7 +291,7 @@ ShellCommand(struct cmdargs const *arg, int bg)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (arg->argc == arg->argn)
|
||||
if (arg->argc == arg->argn) {
|
||||
if (!arg->prompt) {
|
||||
LogPrintf(LogWARN, "Can't start an interactive shell from"
|
||||
" a config file\n");
|
||||
@ -305,6 +305,7 @@ ShellCommand(struct cmdargs const *arg, int bg)
|
||||
" the foreground mode\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((shpid = fork()) == 0) {
|
||||
int dtablesize, i, fd;
|
||||
@ -508,7 +509,7 @@ static int
|
||||
ShowVersion(struct cmdargs const *arg)
|
||||
{
|
||||
static char VarVersion[] = "PPP Version 2.0-beta";
|
||||
static char VarLocalVersion[] = "$Date: 1998/04/24 19:15:37 $";
|
||||
static char VarLocalVersion[] = "$Date: 1998/04/24 19:15:59 $";
|
||||
|
||||
prompt_Printf(arg->prompt, "%s - %s \n", VarVersion, VarLocalVersion);
|
||||
return 0;
|
||||
@ -1411,14 +1412,14 @@ AddCommand(struct cmdargs const *arg)
|
||||
if (arg->argc != arg->argn+3 && arg->argc != arg->argn+2)
|
||||
return -1;
|
||||
|
||||
if (arg->argc == arg->argn+2)
|
||||
if (arg->argc == arg->argn+2) {
|
||||
if (strcasecmp(arg->argv[arg->argn], "default"))
|
||||
return -1;
|
||||
else {
|
||||
dest.s_addr = netmask.s_addr = INADDR_ANY;
|
||||
gw = 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (strcasecmp(arg->argv[arg->argn], "MYADDR") == 0)
|
||||
dest = arg->bundle->ncp.ipcp.my_ip;
|
||||
else if (strcasecmp(arg->argv[arg->argn], "HISADDR") == 0)
|
||||
@ -1444,7 +1445,7 @@ DeleteCommand(struct cmdargs const *arg)
|
||||
{
|
||||
struct in_addr dest, none;
|
||||
|
||||
if (arg->argc == arg->argn+1)
|
||||
if (arg->argc == arg->argn+1) {
|
||||
if(strcasecmp(arg->argv[arg->argn], "all") == 0)
|
||||
DeleteIfRoutes(arg->bundle, 0);
|
||||
else {
|
||||
@ -1458,7 +1459,7 @@ DeleteCommand(struct cmdargs const *arg)
|
||||
bundle_SetRoute(arg->bundle, RTM_DELETE, dest, none, none,
|
||||
arg->cmd->args ? 1 : 0);
|
||||
}
|
||||
else
|
||||
} else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -1513,7 +1514,7 @@ AliasCommand(struct cmdargs const *arg)
|
||||
static int
|
||||
AliasEnable(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->argc == arg->argn+1)
|
||||
if (arg->argc == arg->argn+1) {
|
||||
if (strcasecmp(arg->argv[arg->argn], "yes") == 0) {
|
||||
if (loadAliasHandlers() == 0)
|
||||
return 0;
|
||||
@ -1523,6 +1524,8 @@ AliasEnable(struct cmdargs const *arg)
|
||||
unloadAliasHandlers();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1531,7 +1534,7 @@ static int
|
||||
AliasOption(struct cmdargs const *arg)
|
||||
{
|
||||
unsigned param = (unsigned)arg->cmd->args;
|
||||
if (arg->argc == arg->argn+1)
|
||||
if (arg->argc == arg->argn+1) {
|
||||
if (strcasecmp(arg->argv[arg->argn], "yes") == 0) {
|
||||
if (AliasEnabled()) {
|
||||
(*PacketAlias.SetMode)(param, param);
|
||||
@ -1545,6 +1548,7 @@ AliasOption(struct cmdargs const *arg)
|
||||
}
|
||||
LogPrintf(LogWARN, "alias not enabled\n");
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif /* #ifndef NOALIAS */
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: deflate.c,v 1.6.4.12 1998/04/24 19:15:24 brian Exp $
|
||||
* $Id: deflate.c,v 1.6.4.13 1998/04/25 00:09:10 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -277,7 +277,7 @@ DeflateInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mi)
|
||||
flush = Z_SYNC_FLUSH;
|
||||
}
|
||||
|
||||
if (state->cx.avail_out == 0)
|
||||
if (state->cx.avail_out == 0) {
|
||||
/* overflow */
|
||||
if (first) {
|
||||
if (!(wp[1] & 1)) {
|
||||
@ -295,6 +295,7 @@ DeflateInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mi)
|
||||
state->cx.next_out = MBUF_CTOP(mo);
|
||||
state->cx.avail_out = DEFLATE_CHUNK_LEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mi != NULL)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: filter.c,v 1.22.2.15 1998/04/14 23:17:05 brian Exp $
|
||||
* $Id: filter.c,v 1.22.2.16 1998/04/16 18:30:51 brian Exp $
|
||||
*
|
||||
* TODO: Shoud send ICMP error message when we discard packets.
|
||||
*/
|
||||
@ -228,7 +228,7 @@ ParseUdpOrTcp(int argc, char const *const *argv, int proto,
|
||||
argv += 3;
|
||||
}
|
||||
|
||||
if (proto == P_TCP)
|
||||
if (proto == P_TCP) {
|
||||
for (; argc > 0; argc--, argv++)
|
||||
if (!strcmp(*argv, "estab"))
|
||||
tgt->opt.estab = 1;
|
||||
@ -238,6 +238,7 @@ ParseUdpOrTcp(int argc, char const *const *argv, int proto,
|
||||
tgt->opt.finrst = 1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (argc > 0) {
|
||||
LogPrintf(LogWARN, "ParseUdpOrTcp: bad src/dst port syntax: %s\n", *argv);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: id.c,v 1.6.4.5 1998/04/17 22:05:16 brian Exp $
|
||||
* $Id: id.c,v 1.6.4.6 1998/04/19 23:08:19 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -37,6 +37,7 @@
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __OpenBSD__
|
||||
#include <util.h>
|
||||
#else
|
||||
#include <libutil.h>
|
||||
#endif
|
||||
|
@ -17,13 +17,14 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ip.c,v 1.38.2.21 1998/04/07 23:45:52 brian Exp $
|
||||
* $Id: ip.c,v 1.38.2.22 1998/04/16 18:30:53 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Return ICMP message for filterd packet
|
||||
* and optionaly record it into log.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -31,6 +32,7 @@
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if_tun.h>
|
||||
|
||||
#ifndef NOALIAS
|
||||
#include <alias.h>
|
||||
@ -336,11 +338,12 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter)
|
||||
return (-1);
|
||||
} else {
|
||||
/* Check Keep Alive filter */
|
||||
if (logit)
|
||||
if (logit) {
|
||||
if (FilterCheck(pip, &bundle->filter.alive) & A_DENY)
|
||||
LogPrintf(LogTCPIP, "%s - NO KEEPALIVE\n", logbuf);
|
||||
else
|
||||
LogPrintf(LogTCPIP, "%s\n", logbuf);
|
||||
}
|
||||
return (pri);
|
||||
}
|
||||
}
|
||||
@ -398,12 +401,13 @@ IpInput(struct bundle *bundle, struct mbuf * bp)
|
||||
nb = ntohs(((struct ip *) tun.data)->ip_len);
|
||||
nb += sizeof tun - sizeof tun.data;
|
||||
nw = write(bundle->tun_fd, &tun, nb);
|
||||
if (nw != nb)
|
||||
if (nw != nb) {
|
||||
if (nw == -1)
|
||||
LogPrintf(LogERROR, "IpInput: wrote %d, got %s\n", nb,
|
||||
strerror(errno));
|
||||
else
|
||||
LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw);
|
||||
}
|
||||
|
||||
if (iresult == PKT_ALIAS_FOUND_HEADER_FRAGMENT) {
|
||||
while ((fptr = (*PacketAlias.GetFragment)(tun.data)) != NULL) {
|
||||
@ -413,12 +417,13 @@ IpInput(struct bundle *bundle, struct mbuf * bp)
|
||||
((char *)fptr - sizeof tun + sizeof tun.data);
|
||||
nb += sizeof tun - sizeof tun.data;
|
||||
nw = write(bundle->tun_fd, frag, nb);
|
||||
if (nw != nb)
|
||||
if (nw != nb) {
|
||||
if (nw == -1)
|
||||
LogPrintf(LogERROR, "IpInput: wrote %d, got %s\n", nb,
|
||||
strerror(errno));
|
||||
else
|
||||
LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw);
|
||||
}
|
||||
free(frag);
|
||||
}
|
||||
}
|
||||
@ -449,11 +454,12 @@ IpInput(struct bundle *bundle, struct mbuf * bp)
|
||||
|
||||
nb += sizeof tun - sizeof tun.data;
|
||||
nw = write(bundle->tun_fd, &tun, nb);
|
||||
if (nw != nb)
|
||||
if (nw != nb) {
|
||||
if (nw == -1)
|
||||
LogPrintf(LogERROR, "IpInput: wrote %d, got %s\n", nb, strerror(errno));
|
||||
else
|
||||
LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw);
|
||||
}
|
||||
}
|
||||
pfree(bp);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ipcp.c,v 1.50.2.44 1998/04/24 19:15:39 brian Exp $
|
||||
* $Id: ipcp.c,v 1.50.2.45 1998/04/25 00:09:11 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o More RFC1772 backwoard compatibility
|
||||
@ -562,7 +562,7 @@ IpcpSendConfigReq(struct fsm *fp)
|
||||
INC_LCP_OPT(TY_IPADDR, 6, o);
|
||||
}
|
||||
|
||||
if (ipcp->my_compproto && !REJECTED(ipcp, TY_COMPPROTO))
|
||||
if (ipcp->my_compproto && !REJECTED(ipcp, TY_COMPPROTO)) {
|
||||
if (ipcp->heis1172) {
|
||||
*(u_short *)o->data = htons(PROTO_VJCOMP);
|
||||
INC_LCP_OPT(TY_COMPPROTO, 4, o);
|
||||
@ -570,6 +570,7 @@ IpcpSendConfigReq(struct fsm *fp)
|
||||
*(u_long *)o->data = htonl(ipcp->my_compproto);
|
||||
INC_LCP_OPT(TY_COMPPROTO, 6, o);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsEnabled(ipcp->cfg.ns.dns_neg) &&
|
||||
!REJECTED(ipcp, TY_PRIMARY_DNS - TY_ADJUST_NS) &&
|
||||
@ -669,13 +670,14 @@ IpcpLayerDown(struct fsm *fp)
|
||||
* XXX this stuff should really live in the FSM. Our config should
|
||||
* associate executable sections in files with events.
|
||||
*/
|
||||
if (SelectSystem(fp->bundle, s, LINKDOWNFILE, NULL) < 0)
|
||||
if (SelectSystem(fp->bundle, s, LINKDOWNFILE, NULL) < 0) {
|
||||
if (bundle_GetLabel(fp->bundle)) {
|
||||
if (SelectSystem(fp->bundle, bundle_GetLabel(fp->bundle),
|
||||
LINKDOWNFILE, NULL) < 0)
|
||||
SelectSystem(fp->bundle, "MYADDR", LINKDOWNFILE, NULL);
|
||||
} else
|
||||
SelectSystem(fp->bundle, "MYADDR", LINKDOWNFILE, NULL);
|
||||
}
|
||||
|
||||
if (!(ipcp->fsm.bundle->phys_type & PHYS_DEMAND))
|
||||
IpcpCleanInterface(ipcp);
|
||||
@ -709,13 +711,15 @@ IpcpLayerUp(struct fsm *fp)
|
||||
* XXX this stuff should really live in the FSM. Our config should
|
||||
* associate executable sections in files with events.
|
||||
*/
|
||||
if (SelectSystem(fp->bundle, inet_ntoa(ipcp->my_ifip), LINKUPFILE, NULL) < 0)
|
||||
if (SelectSystem(fp->bundle, inet_ntoa(ipcp->my_ifip), LINKUPFILE, NULL)
|
||||
< 0) {
|
||||
if (bundle_GetLabel(fp->bundle)) {
|
||||
if (SelectSystem(fp->bundle, bundle_GetLabel(fp->bundle),
|
||||
LINKUPFILE, NULL) < 0)
|
||||
SelectSystem(fp->bundle, "MYADDR", LINKUPFILE, NULL);
|
||||
} else
|
||||
SelectSystem(fp->bundle, "MYADDR", LINKUPFILE, NULL);
|
||||
}
|
||||
|
||||
throughput_start(&ipcp->throughput, "IPCP throughput",
|
||||
Enabled(fp->bundle, OPT_THROUGHPUT));
|
||||
@ -1029,7 +1033,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
|
||||
ipcp->peer_reject |= (1 << (TY_SECONDARY_DNS - TY_ADJUST_NS));
|
||||
}
|
||||
|
||||
if (mode_type != MODE_NOP)
|
||||
if (mode_type != MODE_NOP) {
|
||||
if (dec->rejend != dec->rej) {
|
||||
/* rejects are preferred */
|
||||
dec->ackend = dec->ack;
|
||||
@ -1037,6 +1041,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
|
||||
} else if (dec->nakend != dec->nak)
|
||||
/* then NAKs */
|
||||
dec->ackend = dec->ack;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: lcp.c,v 1.55.2.47 1998/04/24 19:16:05 brian Exp $
|
||||
* $Id: lcp.c,v 1.55.2.48 1998/04/25 00:09:12 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Limit data field length by MRU
|
||||
@ -637,7 +637,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
|
||||
case TY_QUALPROTO:
|
||||
req = (struct lqrreq *)cp;
|
||||
LogPrintf(LogLCP, "%s proto %x, interval %ldms\n",
|
||||
request, ntohs(req->proto), ntohl(req->period) * 10);
|
||||
request, ntohs(req->proto), (long)ntohl(req->period) * 10);
|
||||
switch (mode_type) {
|
||||
case MODE_REQ:
|
||||
if (ntohs(req->proto) != PROTO_LQR || !IsAccepted(lcp->cfg.lqr))
|
||||
@ -854,7 +854,7 @@ reqreject:
|
||||
cp += length;
|
||||
}
|
||||
|
||||
if (mode_type != MODE_NOP)
|
||||
if (mode_type != MODE_NOP) {
|
||||
if (dec->rejend != dec->rej) {
|
||||
/* rejects are preferred */
|
||||
dec->ackend = dec->ack;
|
||||
@ -862,6 +862,7 @@ reqreject:
|
||||
} else if (dec->nakend != dec->nak)
|
||||
/* then NAKs */
|
||||
dec->ackend = dec->ack;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: loadalias.c,v 1.14.2.2 1998/04/07 00:53:57 brian Exp $
|
||||
* $Id: loadalias.c,v 1.14.2.3 1998/04/18 01:01:23 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -80,12 +80,13 @@ loadAliasHandlers()
|
||||
|
||||
path = _PATH_ALIAS_PREFIX;
|
||||
env = getenv("_PATH_ALIAS_PREFIX");
|
||||
if (env)
|
||||
if (env) {
|
||||
if (ID0realuid() == 0)
|
||||
path = env;
|
||||
else
|
||||
LogPrintf(LogALERT, "Ignoring environment _PATH_ALIAS_PREFIX"
|
||||
" value (%s)\n", env);
|
||||
}
|
||||
|
||||
PacketAlias.dl = dlopen(path, RTLD_NOW);
|
||||
if (PacketAlias.dl == (void *) 0) {
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.c,v 1.25.2.9 1998/04/24 19:15:43 brian Exp $
|
||||
* $Id: log.c,v 1.25.2.10 1998/04/24 19:16:05 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -341,22 +341,23 @@ log_SetLevel(struct cmdargs const *arg)
|
||||
local = 1;
|
||||
}
|
||||
|
||||
if (argc == 0 || (argv[0][0] != '+' && argv[0][0] != '-'))
|
||||
if (argc == 0 || (argv[0][0] != '+' && argv[0][0] != '-')) {
|
||||
if (local)
|
||||
LogDiscardAllLocal(&arg->prompt->logmask);
|
||||
else
|
||||
LogDiscardAll();
|
||||
}
|
||||
|
||||
while (argc--) {
|
||||
argp = **argv == '+' || **argv == '-' ? *argv + 1 : *argv;
|
||||
for (i = LogMIN; i <= LogMAX; i++)
|
||||
if (strcasecmp(argp, LogName(i)) == 0) {
|
||||
if (**argv == '-')
|
||||
if (**argv == '-') {
|
||||
if (local)
|
||||
LogDiscardLocal(i, &arg->prompt->logmask);
|
||||
else
|
||||
LogDiscard(i);
|
||||
else if (local)
|
||||
} else if (local)
|
||||
LogKeepLocal(i, &arg->prompt->logmask);
|
||||
else
|
||||
LogKeep(i);
|
||||
|
@ -17,16 +17,18 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: main.c,v 1.121.2.49 1998/04/16 00:26:08 brian Exp $
|
||||
* $Id: main.c,v 1.121.2.50 1998/04/23 03:22:58 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <sys/un.h>
|
||||
#include <net/if_tun.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -581,7 +583,7 @@ DoLoop(struct bundle *bundle, struct prompt *prompt)
|
||||
* Process on-demand dialup. Output packets are queued within tunnel
|
||||
* device until IPCP is opened.
|
||||
*/
|
||||
if (bundle_Phase(bundle) == PHASE_DEAD)
|
||||
if (bundle_Phase(bundle) == PHASE_DEAD) {
|
||||
/*
|
||||
* Note, we must be in AUTO mode :-/ otherwise our interface should
|
||||
* *not* be UP and we can't receive data
|
||||
@ -597,6 +599,7 @@ DoLoop(struct bundle *bundle, struct prompt *prompt)
|
||||
* device - breaking auto-dial.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
pri = PacketCheck(bundle, tun.data, n, &bundle->filter.out);
|
||||
if (pri >= 0) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: modem.c,v 1.77.2.56 1998/04/24 19:16:07 brian Exp $
|
||||
* $Id: modem.c,v 1.77.2.57 1998/04/25 00:09:28 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -35,9 +35,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __OpenBSD__
|
||||
#include <util.h>
|
||||
#else
|
||||
#include <libutil.h>
|
||||
#endif
|
||||
@ -572,8 +574,8 @@ modem_Open(struct physical *modem, struct bundle *bundle)
|
||||
tcgetattr(modem->fd, &rstio);
|
||||
modem->ios = rstio;
|
||||
LogPrintf(LogDEBUG, "modem_Open: modem (get): fd = %d, iflag = %lx, "
|
||||
"oflag = %lx, cflag = %lx\n", modem->fd, rstio.c_iflag,
|
||||
rstio.c_oflag, rstio.c_cflag);
|
||||
"oflag = %lx, cflag = %lx\n", modem->fd, (u_long)rstio.c_iflag,
|
||||
(u_long)rstio.c_oflag, (u_long)rstio.c_cflag);
|
||||
cfmakeraw(&rstio);
|
||||
if (modem->cfg.rts_cts)
|
||||
rstio.c_cflag |= CLOCAL | CCTS_OFLOW | CRTS_IFLOW;
|
||||
@ -595,9 +597,10 @@ modem_Open(struct physical *modem, struct bundle *bundle)
|
||||
}
|
||||
tcsetattr(modem->fd, TCSADRAIN, &rstio);
|
||||
LogPrintf(LogDEBUG, "modem (put): iflag = %lx, oflag = %lx, cflag = %lx\n",
|
||||
rstio.c_iflag, rstio.c_oflag, rstio.c_cflag);
|
||||
(u_long)rstio.c_iflag, (u_long)rstio.c_oflag,
|
||||
(u_long)rstio.c_cflag);
|
||||
|
||||
if (ioctl(modem->fd, TIOCMGET, &modem->mbits) == -1)
|
||||
if (ioctl(modem->fd, TIOCMGET, &modem->mbits) == -1) {
|
||||
if (modem->type != PHYS_STDIN) {
|
||||
LogPrintf(LogERROR, "modem_Open: Cannot get modem status: %s\n",
|
||||
strerror(errno));
|
||||
@ -605,6 +608,7 @@ modem_Open(struct physical *modem, struct bundle *bundle)
|
||||
return (-1);
|
||||
} else
|
||||
modem->mbits = TIOCM_CD;
|
||||
}
|
||||
LogPrintf(LogDEBUG, "modem_Open: modem control = %o\n", modem->mbits);
|
||||
|
||||
oldflag = fcntl(modem->fd, F_GETFL, 0);
|
||||
@ -798,13 +802,13 @@ modem_ShowStatus(struct cmdargs const *arg)
|
||||
|
||||
prompt_Printf(arg->prompt, "Name: %s\n", modem->link.name);
|
||||
prompt_Printf(arg->prompt, " State: ");
|
||||
if (modem->fd >= 0)
|
||||
if (modem->fd >= 0) {
|
||||
if (isatty(modem->fd))
|
||||
prompt_Printf(arg->prompt, "open, %s carrier\n",
|
||||
Online(modem) ? "with" : "no");
|
||||
else
|
||||
prompt_Printf(arg->prompt, "open\n");
|
||||
else
|
||||
} else
|
||||
prompt_Printf(arg->prompt, "closed\n");
|
||||
prompt_Printf(arg->prompt, " Device: %s\n",
|
||||
*modem->name.full ? modem->name.full :
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: mp.c,v 1.1.2.14 1998/04/24 19:16:20 brian Exp $
|
||||
* $Id: mp.c,v 1.1.2.15 1998/04/25 00:09:21 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -678,7 +678,7 @@ mp_SetEnddisc(struct cmdargs const *arg)
|
||||
mp->cfg.enddisc.class = 0;
|
||||
*mp->cfg.enddisc.address = '\0';
|
||||
mp->cfg.enddisc.len = 0;
|
||||
} else if (arg->argc > arg->argn)
|
||||
} else if (arg->argc > arg->argn) {
|
||||
if (!strcasecmp(arg->argv[arg->argn], "label")) {
|
||||
mp->cfg.enddisc.class = ENDDISC_LOCAL;
|
||||
strcpy(mp->cfg.enddisc.address, arg->bundle->cfg.label);
|
||||
@ -739,6 +739,7 @@ mp_SetEnddisc(struct cmdargs const *arg)
|
||||
arg->argv[arg->argn]);
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: physical.c,v 1.1.2.24 1998/04/10 23:51:32 brian Exp $
|
||||
* $Id: physical.c,v 1.1.2.25 1998/04/16 00:26:13 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -176,7 +176,7 @@ Physical_IsSet(struct descriptor *d, const fd_set *fdset)
|
||||
void
|
||||
Physical_Login(struct physical *phys, const char *name)
|
||||
{
|
||||
if (phys->type == PHYS_STDIN && Physical_IsATTY(phys))
|
||||
if (phys->type == PHYS_STDIN && Physical_IsATTY(phys)) {
|
||||
if (phys->Utmp)
|
||||
LogPrintf(LogERROR, "Oops, already logged in on %s\n", phys->name.base);
|
||||
else {
|
||||
@ -189,6 +189,7 @@ Physical_Login(struct physical *phys, const char *name)
|
||||
ID0login(&ut);
|
||||
phys->Utmp = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: route.c,v 1.42.2.17 1998/04/07 00:54:16 brian Exp $
|
||||
* $Id: route.c,v 1.42.2.18 1998/04/19 03:41:01 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -109,8 +109,8 @@ p_sockaddr(struct prompt *prompt, struct sockaddr *phost,
|
||||
case AF_LINK:
|
||||
if (dl->sdl_nlen)
|
||||
snprintf(buf, sizeof buf, "%.*s", dl->sdl_nlen, dl->sdl_data);
|
||||
else if (dl->sdl_alen)
|
||||
if (dl->sdl_type == IFT_ETHER)
|
||||
else if (dl->sdl_alen) {
|
||||
if (dl->sdl_type == IFT_ETHER) {
|
||||
if (dl->sdl_alen < sizeof buf / 3) {
|
||||
int f;
|
||||
u_char *MAC;
|
||||
@ -121,9 +121,9 @@ p_sockaddr(struct prompt *prompt, struct sockaddr *phost,
|
||||
buf[f*3-1] = '\0';
|
||||
} else
|
||||
strcpy(buf, "??:??:??:??:??:??");
|
||||
else
|
||||
} else
|
||||
sprintf(buf, "<IFT type %d>", dl->sdl_type);
|
||||
else if (dl->sdl_slen)
|
||||
} else if (dl->sdl_slen)
|
||||
sprintf(buf, "<slen %d?>", dl->sdl_slen);
|
||||
else
|
||||
sprintf(buf, "link#%d", dl->sdl_index);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: slcompress.c,v 1.15.2.7 1998/04/07 00:54:19 brian Exp $
|
||||
* $Id: slcompress.c,v 1.15.2.8 1998/04/19 23:08:58 brian Exp $
|
||||
*
|
||||
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
|
||||
* - Initial distribution.
|
||||
@ -519,7 +519,7 @@ sl_uncompress_tcp(u_char ** bufp, int len, u_int type,
|
||||
cs->cs_ip.ip_id = htons(ntohs(cs->cs_ip.ip_id) + 1);
|
||||
|
||||
LogPrintf(LogDEBUG, "Uncompress: id = %04x, seq = %08lx\n",
|
||||
cs->cs_ip.ip_id, ntohl(th->th_seq));
|
||||
cs->cs_ip.ip_id, (u_long)ntohl(th->th_seq));
|
||||
|
||||
/*
|
||||
* At this point, cp points to the first byte of data in the packet. If
|
||||
|
@ -23,10 +23,12 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tun.c,v 1.6.4.12 1998/04/06 09:12:38 brian Exp $
|
||||
* $Id: tun.c,v 1.6.4.13 1998/04/07 00:54:23 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/if_tun.h>
|
||||
#include <netinet/in_systm.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user