diff options
| -rw-r--r-- | usr.sbin/ppp/ppp/README.changes | 2 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/bundle.c | 24 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/bundle.h | 3 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/command.c | 18 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/datalink.c | 8 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/defs.h | 3 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/exec.c | 47 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/fsm.c | 13 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/ip.c | 6 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/ipcp.c | 11 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/ipcp.h | 5 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/mp.c | 8 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/nat_cmd.c | 26 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/physical.c | 4 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/ppp.8 | 48 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/server.c | 4 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp/tcp.c | 10 |
17 files changed, 166 insertions, 74 deletions
diff --git a/usr.sbin/ppp/ppp/README.changes b/usr.sbin/ppp/ppp/README.changes index b8df2019beb..c0bd06da70e 100644 --- a/usr.sbin/ppp/ppp/README.changes +++ b/usr.sbin/ppp/ppp/README.changes @@ -1,3 +1,5 @@ +$OpenBSD: README.changes,v 1.15 2000/06/13 09:57:50 brian Exp $ + This file summarises changes made to ppp that effect its configuration. diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c index c53c6109fb1..1c499911da6 100644 --- a/usr.sbin/ppp/ppp/bundle.c +++ b/usr.sbin/ppp/ppp/bundle.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: bundle.c,v 1.36 2000/04/07 23:46:39 brian Exp $ + * $OpenBSD: bundle.c,v 1.37 2000/06/13 09:57:50 brian Exp $ */ #include <sys/param.h> @@ -440,6 +440,7 @@ bundle_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) struct bundle *bundle = descriptor2bundle(d); struct datalink *dl; int result, nlinks; + u_short ifqueue; size_t queued; result = 0; @@ -454,7 +455,8 @@ bundle_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) if (r && (bundle->phase == PHASE_NETWORK || bundle->phys_type.all & PHYS_AUTO)) { /* enough surplus so that we can tell if we're getting swamped */ - if (queued < 30) { + ifqueue = nlinks > bundle->cfg.ifqueue ? nlinks : bundle->cfg.ifqueue; + if (queued < ifqueue) { /* Not enough - select() for more */ if (bundle->choked.timer.state == TIMER_RUNNING) timer_Stop(&bundle->choked.timer); /* Not needed any more */ @@ -806,6 +808,7 @@ bundle_Create(const char *prefix, int type, int unit) OPT_THROUGHPUT | OPT_UTMP; *bundle.cfg.label = '\0'; bundle.cfg.mtu = DEF_MTU; + bundle.cfg.ifqueue = DEF_IFQUEUE; bundle.cfg.choked.timeout = CHOKED_TIMEOUT; bundle.phys_type.all = type; bundle.phys_type.open = 0; @@ -1076,13 +1079,12 @@ bundle_Open(struct bundle *bundle, const char *name, int mask, int force) if ((mask & dl->physical->type) && (dl->state == DATALINK_CLOSED || (force && dl->state == DATALINK_OPENING && - dl->dial.timer.state == TIMER_RUNNING))) { - if (force) /* Ignore redial timeout ? */ - timer_Stop(&dl->dial.timer); + dl->dial.timer.state == TIMER_RUNNING) || + dl->state == DATALINK_READY)) { + timer_Stop(&dl->dial.timer); /* We're finished with this */ datalink_Up(dl, 1, 1); if (mask & PHYS_AUTO) - /* Only one AUTO link at a time */ - break; + break; /* Only one AUTO link at a time */ } if (name != NULL) break; @@ -1157,8 +1159,10 @@ bundle_ShowStatus(struct cmdargs const *arg) prompt_Printf(arg->prompt, ", up time %d:%02d:%02d", secs / 3600, (secs / 60) % 60, secs % 60); } + prompt_Printf(arg->prompt, "\n Queued: %u of %u\n", + ip_QueueLen(&arg->bundle->ncp.ipcp), arg->bundle->cfg.ifqueue); - prompt_Printf(arg->prompt, "\n\nDefaults:\n"); + prompt_Printf(arg->prompt, "\nDefaults:\n"); prompt_Printf(arg->prompt, " Label: %s\n", arg->bundle->cfg.label); prompt_Printf(arg->prompt, " Auth name: %s\n", arg->bundle->cfg.auth.name); @@ -1968,12 +1972,12 @@ bundle_AutoAdjust(struct bundle *bundle, int percent, int what) log_Printf(LogPHASE, "%d%% saturation -> Opening link ``%s''\n", percent, choice->name); datalink_Up(choice, 1, 1); - mp_StopAutoloadTimer(&bundle->ncp.mp); + mp_CheckAutoloadTimer(&bundle->ncp.mp); } else if (otherlinkup) { /* Only bring the second-last link down */ log_Printf(LogPHASE, "%d%% saturation -> Closing link ``%s''\n", percent, choice->name); datalink_Close(choice, CLOSE_STAYDOWN); - mp_StopAutoloadTimer(&bundle->ncp.mp); + mp_CheckAutoloadTimer(&bundle->ncp.mp); } } } diff --git a/usr.sbin/ppp/ppp/bundle.h b/usr.sbin/ppp/ppp/bundle.h index 9ce9b311e49..d426269dbeb 100644 --- a/usr.sbin/ppp/ppp/bundle.h +++ b/usr.sbin/ppp/ppp/bundle.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: bundle.h,v 1.14 2000/04/07 23:46:39 brian Exp $ + * $OpenBSD: bundle.h,v 1.15 2000/06/13 09:57:50 brian Exp $ */ #define PHASE_DEAD 0 /* Link is dead */ @@ -101,6 +101,7 @@ struct bundle { unsigned opt; /* Uses OPT_ bits from above */ char label[50]; /* last thing `load'ed */ u_short mtu; /* Interface mtu */ + u_short ifqueue; /* Interface queue size */ struct { int timeout; /* How long to leave the output queue choked */ diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c index fa862fa0eff..3e27a1243ef 100644 --- a/usr.sbin/ppp/ppp/command.c +++ b/usr.sbin/ppp/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: command.c,v 1.41 2000/04/02 01:36:25 brian Exp $ + * $OpenBSD: command.c,v 1.42 2000/06/13 09:57:50 brian Exp $ * */ #include <sys/param.h> @@ -131,6 +131,7 @@ #define VAR_CRTSCTS 32 #define VAR_URGENTPORTS 33 #define VAR_LOGOUT 34 +#define VAR_IFQUEUE 35 /* ``accept|deny|disable|enable'' masks */ #define NEG_HISMASK (1) @@ -1646,6 +1647,11 @@ SetVariable(struct cmdargs const *arg) cx->cfg.script.hangup[sizeof cx->cfg.script.hangup - 1] = '\0'; break; + case VAR_IFQUEUE: + long_val = atol(argp); + arg->bundle->cfg.ifqueue = long_val < 0 ? 0 : long_val; + break; + case VAR_LOGOUT: strncpy(cx->cfg.script.logout, argp, sizeof cx->cfg.script.logout - 1); cx->cfg.script.logout[sizeof cx->cfg.script.logout - 1] = '\0'; @@ -1855,9 +1861,11 @@ SetVariable(struct cmdargs const *arg) case VAR_URGENTPORTS: if (arg->argn == arg->argc) { + ipcp_SetUrgentTOS(&arg->bundle->ncp.ipcp); ipcp_ClearUrgentTcpPorts(&arg->bundle->ncp.ipcp); ipcp_ClearUrgentUdpPorts(&arg->bundle->ncp.ipcp); } else if (!strcasecmp(arg->argv[arg->argn], "udp")) { + ipcp_SetUrgentTOS(&arg->bundle->ncp.ipcp); if (arg->argn == arg->argc - 1) ipcp_ClearUrgentUdpPorts(&arg->bundle->ncp.ipcp); else for (f = arg->argn + 1; f < arg->argc; f++) @@ -1871,7 +1879,13 @@ SetVariable(struct cmdargs const *arg) ipcp_ClearUrgentUdpPorts(&arg->bundle->ncp.ipcp); ipcp_AddUrgentUdpPort(&arg->bundle->ncp.ipcp, atoi(arg->argv[f])); } + } else if (arg->argn == arg->argc - 1 && + !strcasecmp(arg->argv[arg->argn], "none")) { + ipcp_ClearUrgentTcpPorts(&arg->bundle->ncp.ipcp); + ipcp_ClearUrgentUdpPorts(&arg->bundle->ncp.ipcp); + ipcp_ClearUrgentTOS(&arg->bundle->ncp.ipcp); } else { + ipcp_SetUrgentTOS(&arg->bundle->ncp.ipcp); first = arg->argn; if (!strcasecmp(arg->argv[first], "tcp") && ++first == arg->argc) ipcp_ClearUrgentTcpPorts(&arg->bundle->ncp.ipcp); @@ -1946,6 +1960,8 @@ static struct cmdtab const SetCommands[] = { "hangup script", "set hangup chat-script", (const void *) VAR_HANGUP}, {"ifaddr", NULL, SetInterfaceAddr, LOCAL_AUTH, "destination address", "set ifaddr [src-addr [dst-addr [netmask [trg-addr]]]]"}, + {"ifqueue", NULL, SetVariable, LOCAL_AUTH, "interface queue", + "set ifqueue packets", (const void *)VAR_IFQUEUE}, {"ipcpretry", "ipcpretries", SetVariable, LOCAL_AUTH, "IPCP retries", "set ipcpretry value [attempts]", (const void *)VAR_IPCPRETRY}, {"lcpretry", "lcpretries", SetVariable, LOCAL_AUTH | LOCAL_CX, "LCP retries", diff --git a/usr.sbin/ppp/ppp/datalink.c b/usr.sbin/ppp/ppp/datalink.c index a3c00c41f92..f97d71848da 100644 --- a/usr.sbin/ppp/ppp/datalink.c +++ b/usr.sbin/ppp/ppp/datalink.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: datalink.c,v 1.30 2000/04/07 23:46:39 brian Exp $ + * $OpenBSD: datalink.c,v 1.31 2000/06/13 09:57:51 brian Exp $ */ #include <sys/param.h> @@ -969,8 +969,10 @@ datalink_Up(struct datalink *dl, int runscripts, int packetmode) case DATALINK_READY: if (!dl->script.packetmode && packetmode) { dl->script.packetmode = 1; - if (dl->state == DATALINK_READY) - datalink_LoginDone(dl); + if (dl->state == DATALINK_READY) { + dl->script.run = 0; + datalink_NewState(dl, DATALINK_CARRIER); + } } break; } diff --git a/usr.sbin/ppp/ppp/defs.h b/usr.sbin/ppp/ppp/defs.h index 0c1cd70c241..a351ef3004c 100644 --- a/usr.sbin/ppp/ppp/defs.h +++ b/usr.sbin/ppp/ppp/defs.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: defs.h,v 1.14 2000/04/07 23:46:39 brian Exp $ + * $OpenBSD: defs.h,v 1.15 2000/06/13 09:57:51 brian Exp $ * * TODO: */ @@ -59,6 +59,7 @@ #define DEF_FSMRETRY 3 /* FSM retry frequency */ #define DEF_FSMTRIES 5 /* Default max retries */ #define DEF_FSMAUTHTRIES 3 /* Default max auth retries */ +#define DEF_IFQUEUE 30 /* Default interface queue size */ #define CONFFILE "ppp.conf" #define LINKUPFILE "ppp.linkup" diff --git a/usr.sbin/ppp/ppp/exec.c b/usr.sbin/ppp/ppp/exec.c index 233cea903b3..ef739038a92 100644 --- a/usr.sbin/ppp/ppp/exec.c +++ b/usr.sbin/ppp/ppp/exec.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: exec.c,v 1.12 2000/04/02 01:36:26 brian Exp $ + * $OpenBSD: exec.c,v 1.13 2000/06/13 09:57:51 brian Exp $ */ #include <sys/param.h> @@ -100,16 +100,17 @@ struct device * exec_Create(struct physical *p) { if (p->fd < 0 && *p->name.full == '!') { - int fids[2]; + int fids[2], type; p->fd--; /* We own the device but maybe can't use it - change fd */ + type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; - if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, fids) < 0) + if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", - strerror(errno)); + strerror(errno)); else { - static int child_status; - int stat, argc, i, ret, wret; + static int child_status; /* This variable is abused ! */ + int stat, argc, i, ret, wret, pidpipe[2]; pid_t pid, realpid; char *argv[MAXARGS]; @@ -119,31 +120,41 @@ exec_Create(struct physical *p) fcntl(fids[0], F_SETFL, stat); } realpid = getpid(); - switch ((pid = fork())) { + if (pipe(pidpipe) == -1) { + log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", + strerror(errno)); + close(fids[1]); + } else switch ((pid = fork())) { case -1: - log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", - strerror(errno)); + log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", + strerror(errno)); + close(pidpipe[0]); + close(pidpipe[1]); close(fids[1]); break; case 0: + close(pidpipe[0]); close(fids[0]); timer_TermService(); setuid(ID0realuid()); child_status = 0; - switch (vfork()) { + switch ((pid = vfork())) { case 0: + close(pidpipe[1]); break; case -1: ret = errno; - log_Printf(LogPHASE, "Unable to fork to drop parent: %s\n", - strerror(errno)); + log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", + strerror(errno)); + close(pidpipe[1]); _exit(ret); - break; default: + write(pidpipe[1], &pid, sizeof pid); + close(pidpipe[1]); _exit(child_status); /* The error from exec() ! */ } @@ -171,18 +182,25 @@ exec_Create(struct physical *p) break; default: + close(pidpipe[1]); close(fids[1]); + if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != + sizeof p->session_owner) + p->session_owner = (pid_t)-1; + close(pidpipe[0]); while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) ; if (wret == -1) { log_Printf(LogWARN, "Waiting for child process: %s\n", strerror(errno)); close(fids[0]); + p->session_owner = (pid_t)-1; break; } else if (WIFSIGNALED(stat)) { log_Printf(LogWARN, "Child process received sig %d !\n", WTERMSIG(stat)); close(fids[0]); + p->session_owner = (pid_t)-1; break; } else if (WIFSTOPPED(stat)) { log_Printf(LogWARN, "Child process received stop sig %d !\n", @@ -192,11 +210,12 @@ exec_Create(struct physical *p) log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, strerror(ret)); close(fids[0]); + p->session_owner = (pid_t)-1; break; } p->fd = fids[0]; log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); - physical_SetupStack(p, execdevice.name, PHYSICAL_FORCE_ASYNC); + physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); if (p->cfg.cd.necessity != CD_DEFAULT) log_Printf(LogWARN, "Carrier settings ignored\n"); return &execdevice; diff --git a/usr.sbin/ppp/ppp/fsm.c b/usr.sbin/ppp/ppp/fsm.c index b9dd2dd88cb..7949f2f6d36 100644 --- a/usr.sbin/ppp/ppp/fsm.c +++ b/usr.sbin/ppp/ppp/fsm.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: fsm.c,v 1.13 2000/02/27 01:38:26 brian Exp $ + * $OpenBSD: fsm.c,v 1.14 2000/06/13 09:57:51 brian Exp $ * * TODO: */ @@ -976,9 +976,14 @@ fsm_Input(struct fsm *fp, struct mbuf *bp) } bp = mbuf_Read(bp, &lh, sizeof lh); - if (ntohs(lh.length) != len) - log_Printf(LogWARN, "%s: Oops: Got %d bytes but %d byte payload\n", - fp->link->name, len, (int)ntohs(lh.length)); + if (ntohs(lh.length) != len) { + if (ntohs(lh.length) > len) { + log_Printf(LogWARN, "%s: Oops: Got %d bytes but %d byte payload " + "- dropped\n", fp->link->name, len, (int)ntohs(lh.length)); + m_freem(bp); + return; + } + } if (lh.code < fp->min_code || lh.code > fp->max_code || lh.code > sizeof FsmCodes / sizeof *FsmCodes) { diff --git a/usr.sbin/ppp/ppp/ip.c b/usr.sbin/ppp/ppp/ip.c index 5a50a51d5c7..2974122d09c 100644 --- a/usr.sbin/ppp/ppp/ip.c +++ b/usr.sbin/ppp/ppp/ip.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: ip.c,v 1.22 2000/03/29 09:32:37 brian Exp $ + * $OpenBSD: ip.c,v 1.23 2000/06/13 09:57:51 brian Exp $ * * TODO: * o Return ICMP message for filterd packet @@ -475,7 +475,7 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter) case IPPROTO_UDP: uh = (struct udphdr *) ptop; - if (pip->ip_tos == IPTOS_LOWDELAY) + if (pip->ip_tos == IPTOS_LOWDELAY && bundle->ncp.ipcp.cfg.urgent.tos) pri++; if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0 && @@ -545,7 +545,7 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter) case IPPROTO_TCP: th = (struct tcphdr *) ptop; - if (pip->ip_tos == IPTOS_LOWDELAY) + if (pip->ip_tos == IPTOS_LOWDELAY && bundle->ncp.ipcp.cfg.urgent.tos) pri++; if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0 && diff --git a/usr.sbin/ppp/ppp/ipcp.c b/usr.sbin/ppp/ppp/ipcp.c index a25717230d9..85cc8228d0e 100644 --- a/usr.sbin/ppp/ppp/ipcp.c +++ b/usr.sbin/ppp/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: ipcp.c,v 1.23 2000/03/19 10:33:33 brian Exp $ + * $OpenBSD: ipcp.c,v 1.24 2000/06/13 09:57:51 brian Exp $ * * TODO: * o Support IPADDRS properly @@ -367,10 +367,11 @@ ipcp_WriteDNS(struct ipcp *ipcp) ipcp->ns.dns[1].s_addr = INADDR_ANY; } - mask = umask(0644); + mask = umask(022); if ((fp = ID0fopen(_PATH_RESCONF, "w")) != NULL) { umask(mask); - fputs(ipcp->ns.resolv_nons, fp); + if (ipcp->ns.resolv_nons) + fputs(ipcp->ns.resolv_nons, fp); paddr = inet_ntoa(ipcp->ns.dns[0]); log_Printf(LogIPCP, "Primary nameserver set to %s\n", paddr); fprintf(fp, "\nnameserver %s\n", paddr); @@ -502,8 +503,9 @@ ipcp_Show(struct cmdargs const *arg) prompt_Printf(arg->prompt, ", "); prompt_Printf(arg->prompt, "%u", ipcp->cfg.urgent.udp.port[p]); } + prompt_Printf(arg->prompt, "\n TOS: %s\n\n", + ipcp->cfg.urgent.tos ? "yes" : "no"); - prompt_Printf(arg->prompt, "\n\n"); throughput_disp(&ipcp->throughput, arg->prompt); return 0; @@ -570,6 +572,7 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l, ipcp->cfg.urgent.tcp.port = (u_short *)malloc(NDEFTCPPORTS * sizeof(u_short)); memcpy(ipcp->cfg.urgent.tcp.port, default_urgent_tcp_ports, NDEFTCPPORTS * sizeof(u_short)); + ipcp->cfg.urgent.tos = 1; ipcp->cfg.urgent.udp.nports = ipcp->cfg.urgent.udp.maxports = NDEFUDPPORTS; ipcp->cfg.urgent.udp.port = (u_short *)malloc(NDEFUDPPORTS * sizeof(u_short)); diff --git a/usr.sbin/ppp/ppp/ipcp.h b/usr.sbin/ppp/ppp/ipcp.h index 17a3f04ab04..299fb7bfdf8 100644 --- a/usr.sbin/ppp/ppp/ipcp.h +++ b/usr.sbin/ppp/ppp/ipcp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: ipcp.h,v 1.9 2000/03/19 10:33:33 brian Exp $ + * $OpenBSD: ipcp.h,v 1.10 2000/06/13 09:57:51 brian Exp $ * * TODO: */ @@ -77,6 +77,7 @@ struct ipcp { struct { struct port_range tcp, udp; /* The range of urgent ports */ + unsigned tos : 1; /* Urgent IPTOS_LOWDELAY packets ? */ } urgent; struct fsm_retry fsm; /* How often/frequently to resend requests */ @@ -163,3 +164,5 @@ extern void ipcp_LoadDNS(struct ipcp *); ipcp_ClearUrgentPorts(&(ipcp)->cfg.urgent.tcp) #define ipcp_ClearUrgentUdpPorts(ipcp) \ ipcp_ClearUrgentPorts(&(ipcp)->cfg.urgent.udp) +#define ipcp_ClearUrgentTOS(ipcp) (ipcp)->cfg.urgent.tos = 0; +#define ipcp_SetUrgentTOS(ipcp) (ipcp)->cfg.urgent.tos = 1; diff --git a/usr.sbin/ppp/ppp/mp.c b/usr.sbin/ppp/ppp/mp.c index f137ada4915..292fe7f68b2 100644 --- a/usr.sbin/ppp/ppp/mp.c +++ b/usr.sbin/ppp/ppp/mp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: mp.c,v 1.15 2000/02/27 01:38:27 brian Exp $ + * $OpenBSD: mp.c,v 1.16 2000/06/13 09:57:51 brian Exp $ */ #include <sys/param.h> @@ -292,6 +292,12 @@ mp_Up(struct mp *mp, struct datalink *dl) /* We're adding a link - do a last validation on our parameters */ if (!peerid_Equal(&dl->peer, &mp->peer)) { log_Printf(LogPHASE, "%s: Inappropriate peer !\n", dl->name); + log_Printf(LogPHASE, " Attached to peer %s/%s\n", mp->peer.authname, + mp_Enddisc(mp->peer.enddisc.class, mp->peer.enddisc.address, + mp->peer.enddisc.len)); + log_Printf(LogPHASE, " New link is peer %s/%s\n", dl->peer.authname, + mp_Enddisc(dl->peer.enddisc.class, dl->peer.enddisc.address, + dl->peer.enddisc.len)); return MP_FAILED; } if (mp->local_mrru != lcp->want_mrru || diff --git a/usr.sbin/ppp/ppp/nat_cmd.c b/usr.sbin/ppp/ppp/nat_cmd.c index 204e5a0b78b..1671bec7561 100644 --- a/usr.sbin/ppp/ppp/nat_cmd.c +++ b/usr.sbin/ppp/ppp/nat_cmd.c @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $OpenBSD: nat_cmd.c,v 1.10 2000/04/02 01:36:20 brian Exp $ + * $OpenBSD: nat_cmd.c,v 1.11 2000/06/13 09:57:51 brian Exp $ */ #include <sys/param.h> @@ -345,7 +345,7 @@ nat_SetTarget(struct cmdargs const *arg) struct in_addr addr; if (arg->argc == arg->argn) { - addr.s_addr = INADDR_NONE; + addr.s_addr = INADDR_ANY; PacketAliasSetTarget(addr); return 0; } @@ -353,6 +353,12 @@ nat_SetTarget(struct cmdargs const *arg) if (arg->argc != arg->argn + 1) return -1; + if (!strcasecmp(arg->argv[arg->argn], "MYADDR")) { + addr.s_addr = INADDR_ANY; + PacketAliasSetTarget(addr); + return 0; + } + addr = GetIpAddr(arg->argv[arg->argn]); if (addr.s_addr == INADDR_NONE) { log_Printf(LogWARN, "%s: invalid address\n", arg->argv[arg->argn]); @@ -385,7 +391,6 @@ nat_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, u_short *proto) { static int gfrags; - struct ip *pip, *piip; int ret, len, nfrags; struct mbuf **last; char *fptr; @@ -395,20 +400,11 @@ nat_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, log_Printf(LogDEBUG, "nat_LayerPull: PROTO_IP -> PROTO_IP\n"); m_settype(bp, MB_NATIN); - bp = m_pullup(bp); - pip = (struct ip *)MBUF_CTOP(bp); - piip = (struct ip *)((char *)pip + (pip->ip_hl << 2)); - - if (pip->ip_p == IPPROTO_IGMP || - (pip->ip_p == IPPROTO_IPIP && IN_CLASSD(ntohl(piip->ip_dst.s_addr)))) - return bp; - /* Ensure there's a bit of extra buffer for the NAT code... */ bp = m_pullup(m_append(bp, NULL, NAT_EXTRABUF)); ret = PacketAliasIn(MBUF_CTOP(bp), bp->m_len); - pip = (struct ip *)MBUF_CTOP(bp); - bp->m_len = ntohs(pip->ip_len); + bp->m_len = ntohs(((struct ip *)MBUF_CTOP(bp))->ip_len); if (bp->m_len > MAX_MRU) { log_Printf(LogWARN, "nat_LayerPull: Problem with IP header length (%lu)\n", (unsigned long)bp->m_len); @@ -451,10 +447,8 @@ nat_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, case PKT_ALIAS_IGNORED: if (log_IsKept(LogTCPIP)) { log_Printf(LogTCPIP, "NAT engine ignored data:\n"); - PacketCheck(bundle, (char *)pip, ntohs(pip->ip_len), NULL); + PacketCheck(bundle, MBUF_CTOP(bp), bp->m_len, NULL); } - m_freem(bp); - bp = NULL; break; default: diff --git a/usr.sbin/ppp/ppp/physical.c b/usr.sbin/ppp/ppp/physical.c index 5a64533d0e3..219b133119c 100644 --- a/usr.sbin/ppp/ppp/physical.c +++ b/usr.sbin/ppp/ppp/physical.c @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: physical.c,v 1.21 2000/03/03 21:52:57 brian Exp $ + * $OpenBSD: physical.c,v 1.22 2000/06/13 09:57:51 brian Exp $ * */ @@ -340,6 +340,8 @@ physical_Close(struct physical *p) throughput_log(&p->link.throughput, LogPHASE, p->link.name); if (p->session_owner != (pid_t)-1) { + log_Printf(LogPHASE, "%s: HUPing %d\n", p->link.name, + (int)p->session_owner); ID0kill(p->session_owner, SIGHUP); p->session_owner = (pid_t)-1; } diff --git a/usr.sbin/ppp/ppp/ppp.8 b/usr.sbin/ppp/ppp/ppp.8 index e4d1e3b1c94..18def374806 100644 --- a/usr.sbin/ppp/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ppp.8,v 1.83 2000/04/12 21:47:56 aaron Exp $ +.\" $OpenBSD: ppp.8,v 1.84 2000/06/13 09:57:51 brian Exp $ .Dd 20 September 1995 .nr XX \w'\fC00' .Dt PPP 8 @@ -2823,6 +2823,8 @@ and the address of the local network in which .Dv HISADDR appears. +This allows other machines connecteed to the LAN to talk to +the peer as if the peer itself was connected to the LAN. The proxy entry cannot be made unless .Dv HISADDR is an address from a LAN. @@ -3101,7 +3103,6 @@ This command gives a summary of available nat commands. This option causes various NAT statistics and information to be logged to the file .Pa /var/log/alias.log . -This file name is likely to change in the near future. .It nat port Ar proto Ar targetIP Ns Xo .No : Ns Ar targetPort Ns .Oo @@ -3184,10 +3185,17 @@ This is useful if you want to support protocols such as RPC and LPD which require connections to come from a well known port. .It nat target Op Ar address -Set the given target address or clear it if no address is given. The target -address is used by libalias to specify how to NAT incoming packets by default. -If a target address is not set, the alias address (that of the tun interface) -is used. +Set the given target address or clear it if no address is given. +The target address is used by libalias to specify how to NAT incoming +packets by default. +If a target address is not set or if +.Dq default +is given, packets are not altered and are allowed to route to the internal +network. +.Pp +The target address may be set to +.Dq MYADDR , +in which case libalias will redirect all packets to the interface address. .It nat use_sockets yes|no When enabled, this option tells the network address translation engine to create a socket so that it can guarantee a correct incoming ftp data or @@ -4523,6 +4531,26 @@ In all cases, if the interface is already configured, .Nm will try to maintain the interface IP numbers so that any existing bound sockets will remain valid. +.It set ifqueue Ar packets +Set the maximum number of packets that +.Nm +will read from the tunnel interface while data cannot be sent to any of +the available links. +This queue limit is necessary to flow control outgoing data as the tunnel +interface is likely to be far faster than the combined links available to +.Nm ppp . +.Pp +If +.Ar packets +is set to a value less than the number of links, +.Nm +will read up to that value regardless. +This prevents any possible latency problems. +.Pp +The default value for +.Ar packets +is +.Dq 30 . .It set ccpretry|ccpretries Oo Ar timeout .Op Ar reqtries Op Ar trmtries .Oc @@ -5004,7 +5032,7 @@ is specified, will never idle out before the link has been up for at least that number of seconds. .It set urgent Xo -.Op tcp|udp +.Op tcp|udp|none .Oo Op +|- Ns .Ar port .Oc No ... @@ -5046,6 +5074,12 @@ the current list is adjusted, otherwise the list is reassigned. prefixed with a plus or not prefixed at all are added to the list and .Ar port Ns No s prefixed with a minus are removed from the list. +.Pp +If +.Dq none +is specified, all priority port lists are disabled and even +.Dv IPTOS_LOWDELAY +packets are not prioritised. .It set vj slotcomp on|off This command tells .Nm diff --git a/usr.sbin/ppp/ppp/server.c b/usr.sbin/ppp/ppp/server.c index 831596a8451..99075bcc65a 100644 --- a/usr.sbin/ppp/ppp/server.c +++ b/usr.sbin/ppp/ppp/server.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: server.c,v 1.6 2000/02/27 01:38:28 brian Exp $ + * $OpenBSD: server.c,v 1.7 2000/06/13 09:57:51 brian Exp $ */ #include <sys/types.h> @@ -186,7 +186,7 @@ server_LocalOpen(struct bundle *bundle, const char *name, mode_t mask) int s; if (server.rm && !strcmp(server.rm, name)) { - if (chmod(server.rm, mask)) + if (chmod(server.rm, 0777 & ~mask)) log_Printf(LogERROR, "Local: chmod: %s\n", strerror(errno)); return 0; } diff --git a/usr.sbin/ppp/ppp/tcp.c b/usr.sbin/ppp/ppp/tcp.c index 7d1836daf11..57ac5ea3034 100644 --- a/usr.sbin/ppp/ppp/tcp.c +++ b/usr.sbin/ppp/ppp/tcp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: tcp.c,v 1.8 2000/02/27 01:38:29 brian Exp $ + * $OpenBSD: tcp.c,v 1.9 2000/06/13 09:57:51 brian Exp $ */ #include <sys/types.h> @@ -69,7 +69,7 @@ tcp_OpenConnection(const char *name, char *host, char *port) dest.sin_addr = GetIpAddr(host); if (dest.sin_addr.s_addr == INADDR_NONE) { log_Printf(LogWARN, "%s: %s: unknown host\n", name, host); - return -1; + return -2; } dest.sin_port = htons(atoi(port)); if (dest.sin_port == 0) { @@ -78,19 +78,19 @@ tcp_OpenConnection(const char *name, char *host, char *port) dest.sin_port = sp->s_port; else { log_Printf(LogWARN, "%s: %s: unknown service\n", name, port); - return -1; + return -2; } } log_Printf(LogPHASE, "%s: Connecting to %s:%s/tcp\n", name, host, port); sock = socket(PF_INET, SOCK_STREAM, 0); if (sock < 0) - return sock; + return -2; if (connect(sock, (struct sockaddr *)&dest, sizeof dest) < 0) { log_Printf(LogWARN, "%s: connect: %s\n", name, strerror(errno)); close(sock); - return -1; + return -2; } return sock; |
