diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 4226a0a3980d..1347615c7cb8 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: auth.c,v 1.26 1998/01/05 01:35:17 brian Exp $ + * $Id: auth.c,v 1.27 1998/01/21 02:15:09 brian Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -160,11 +160,12 @@ AuthGetSecret(const char *fname, const char *system, int len, int setaddr) if (setaddr) { memset(&DefHisAddress, '\0', sizeof DefHisAddress); } - if (n > 2 && setaddr) + if (n > 2 && setaddr) { if (UseHisaddr(vector[2], 1)) IpcpInit(); else return NULL; + } if (n > 3) SetLabel(vector[3]); return (passwd); diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c index 727699d299bd..870298fc7685 100644 --- a/usr.sbin/ppp/chap.c +++ b/usr.sbin/ppp/chap.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap.c,v 1.28 1997/12/24 09:28:53 brian Exp $ + * $Id: chap.c,v 1.29 1998/02/19 02:10:06 brian Exp $ * * TODO: */ @@ -225,7 +225,7 @@ RecvChapTalk(struct fsmheader *chp, struct mbuf *bp) */ if (memcmp(cp, cdigest, 16) == 0) { ChapOutput(CHAP_SUCCESS, chp->id, "Welcome!!", 10); - if ((mode & MODE_DIRECT) && isatty(modem) && Enabled(ConfUtmp)) + if ((mode & MODE_DIRECT) && isatty(modem) && Enabled(ConfUtmp)) { if (Utmp) LogPrintf(LogERROR, "Oops, already logged in on %s\n", VarBaseDevice); @@ -238,6 +238,7 @@ RecvChapTalk(struct fsmheader *chp, struct mbuf *bp) ID0login(&ut); Utmp = 1; } + } NewPhase(PHASE_NETWORK); break; } diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 274028326870..1e0cf8bf2af1 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -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 1998/01/27 23:14:49 brian Exp $ + * $Id: command.c,v 1.132 1998/03/12 02:23:35 brian Exp $ * */ #include @@ -210,15 +210,15 @@ DialCommand(struct cmdargs const *arg) static int SetLoopback(struct cmdargs const *arg) { - if (arg->argc == 1) + if (arg->argc == 1) { if (!strcasecmp(*arg->argv, "on")) { VarLoopback = 1; return 0; - } - else if (!strcasecmp(*arg->argv, "off")) { + } else if (!strcasecmp(*arg->argv, "off")) { VarLoopback = 0; return 0; } + } return -1; } @@ -249,7 +249,7 @@ ShellCommand(struct cmdargs const *arg, int bg) } #endif - if (arg->argc == 0) + if (arg->argc == 0) { if (!(mode & MODE_INTER)) { if (VarTerm) LogPrintf(LogWARN, "Can't start an interactive shell from" @@ -263,6 +263,8 @@ ShellCommand(struct cmdargs const *arg, int bg) " the foreground mode\n"); return 1; } + } + if ((shell = getenv("SHELL")) == 0) shell = _PATH_BSHELL; @@ -533,11 +535,12 @@ ShowInitialMRU(struct cmdargs const *arg) static int ShowPreferredMTU(struct cmdargs const *arg) { - if (VarTerm) + if (VarTerm) { if (VarPrefMTU) fprintf(VarTerm, " Preferred MTU: %d\n", VarPrefMTU); else fprintf(VarTerm, " Preferred MTU: unspecified\n"); + } return 0; } @@ -1001,7 +1004,7 @@ SetServer(struct cmdargs const *arg) /* What's what ? */ port = arg->argv[0]; - if (arg->argc == 2) + if (arg->argc == 2) { if (ismask(arg->argv[1])) { passwd = NULL; mask = arg->argv[1]; @@ -1009,7 +1012,7 @@ SetServer(struct cmdargs const *arg) passwd = arg->argv[1]; mask = NULL; } - else if (arg->argc == 3) { + } else if (arg->argc == 3) { passwd = arg->argv[1]; mask = arg->argv[2]; if (!ismask(mask)) @@ -1513,14 +1516,14 @@ AddCommand(struct cmdargs const *arg) if (arg->argc != 3 && arg->argc != 2) return -1; - if (arg->argc == 2) + if (arg->argc == 2) { if (strcasecmp(arg->argv[0], "default")) return -1; else { dest.s_addr = netmask.s_addr = INADDR_ANY; gw = 1; } - else { + } else { if (strcasecmp(arg->argv[0], "MYADDR") == 0) dest = IpcpInfo.want_ipaddr; else if (strcasecmp(arg->argv[0], "HISADDR") == 0) @@ -1545,7 +1548,7 @@ DeleteCommand(struct cmdargs const *arg) { struct in_addr dest, none; - if (arg->argc == 1) + if (arg->argc == 1) { if(strcasecmp(arg->argv[0], "all") == 0) DeleteIfRoutes(0); else { @@ -1558,7 +1561,7 @@ DeleteCommand(struct cmdargs const *arg) none.s_addr = INADDR_ANY; OsSetRoute(RTM_DELETE, dest, none, none, arg->data ? 1 : 0); } - else + } else return -1; return 0; diff --git a/usr.sbin/ppp/deflate.c b/usr.sbin/ppp/deflate.c index 1897d3a05c82..f3e6d17ff917 100644 --- a/usr.sbin/ppp/deflate.c +++ b/usr.sbin/ppp/deflate.c @@ -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.5 1997/12/28 02:17:06 brian Exp $ + * $Id: deflate.c,v 1.6 1998/01/10 01:55:09 brian Exp $ */ #include @@ -277,7 +277,7 @@ DeflateInput(u_short *proto, struct mbuf *mi) flush = Z_SYNC_FLUSH; } - if (InputState.cx.avail_out == 0) + if (InputState.cx.avail_out == 0) { /* overflow */ if (first) { if (!(wp[1] & 1)) { @@ -295,6 +295,7 @@ DeflateInput(u_short *proto, struct mbuf *mi) InputState.cx.next_out = MBUF_CTOP(mo); InputState.cx.avail_out = DEFLATE_CHUNK_LEN; } + } } if (mi != NULL) diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c index f88d89909e5c..4854811543de 100644 --- a/usr.sbin/ppp/hdlc.c +++ b/usr.sbin/ppp/hdlc.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: hdlc.c,v 1.28 1998/01/21 02:15:15 brian Exp $ + * $Id: hdlc.c,v 1.29 1998/03/12 02:23:38 brian Exp $ * * TODO: */ @@ -389,12 +389,13 @@ DecodePacket(u_short proto, struct mbuf * bp) * If proto isn't PROTO_COMPD, we still want to pass it to the * decompression routines so that the dictionary's updated */ - if (CcpFsm.state == ST_OPENED) + if (CcpFsm.state == ST_OPENED) { if (proto == PROTO_COMPD) { if ((bp = CompdInput(&proto, bp)) == NULL) return; } else if ((proto & 0xfff1) == 0x21) /* Network Layer protocol */ CcpDictSetup(proto, bp); + } switch (proto) { case PROTO_LCP: diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index ddd520bf0ab8..a784bb540b3e 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ip.c,v 1.37 1998/01/11 17:53:18 brian Exp $ + * $Id: ip.c,v 1.38 1998/01/21 02:15:16 brian Exp $ * * TODO: * o Return ICMP message for filterd packet @@ -473,11 +473,12 @@ IpInput(struct mbuf * bp) IpcpAddInOctets(nb); nb += sizeof tun - sizeof tun.data; nw = write(tun_out, &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); diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index fba92c351353..acdfcacdac81 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -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.78 1998/02/19 02:10:11 brian Exp $ + * $Id: modem.c,v 1.79 1998/03/06 00:35:30 brian Exp $ * * TODO: */ @@ -918,11 +918,12 @@ ShowModemStatus(struct cmdargs const *arg) fprintf(VarTerm, "fd = %d, modem control = %o\n", modem, mbits); fprintf(VarTerm, "connect count: %d\n", connect_count); #ifdef TIOCOUTQ - if (modem >= 0) + if (modem >= 0) { if (ioctl(modem, TIOCOUTQ, &nb) >= 0) fprintf(VarTerm, "outq: %d\n", nb); else fprintf(VarTerm, "outq: ioctl probe failed: %s\n", strerror(errno)); + } #endif fprintf(VarTerm, "outqlen: %d\n", ModemQlen()); fprintf(VarTerm, "DialScript = %s\n", VarDialScript); diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c index 2a320ac0b396..cc3042218e0f 100644 --- a/usr.sbin/ppp/pap.c +++ b/usr.sbin/ppp/pap.c @@ -18,7 +18,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: pap.c,v 1.20 1997/12/24 09:29:11 brian Exp $ + * $Id: pap.c,v 1.21 1998/02/19 02:10:13 brian Exp $ * * TODO: */ @@ -166,7 +166,7 @@ PapInput(struct mbuf * bp) SendPapCode(php->id, PAP_ACK, "Greetings!!"); lcp->auth_ineed = 0; if (lcp->auth_iwait == 0) { - if ((mode & MODE_DIRECT) && isatty(modem) && Enabled(ConfUtmp)) + if ((mode & MODE_DIRECT) && isatty(modem) && Enabled(ConfUtmp)) { if (Utmp) LogPrintf(LogERROR, "Oops, already logged in on %s\n", VarBaseDevice); @@ -179,6 +179,7 @@ PapInput(struct mbuf * bp) ID0login(&ut); Utmp = 1; } + } NewPhase(PHASE_NETWORK); } } else { diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index bf705b3e205f..eac0b7448d4e 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -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.41 1998/01/19 02:59:33 brian Exp $ + * $Id: route.c,v 1.42 1998/01/21 02:15:26 brian Exp $ * */ @@ -100,7 +100,7 @@ OsSetRoute(int cmd, cp = rtmes.m_space; memcpy(cp, &rtdata, 16); cp += 16; - if (cmd == RTM_ADD) + if (cmd == RTM_ADD) { if (gateway.s_addr == INADDR_ANY) { /* Add a route through the interface */ struct sockaddr_dl dl; @@ -127,6 +127,7 @@ OsSetRoute(int cmd, cp += 16; rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; } + } if (dst.s_addr == INADDR_ANY) mask.s_addr = INADDR_ANY; @@ -149,7 +150,7 @@ OsSetRoute(int cmd, LogPrintf(LogTCPIP, "OsSetRoute: 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)); @@ -158,7 +159,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) @@ -223,8 +224,8 @@ p_sockaddr(struct sockaddr *phost, struct sockaddr *pmask, int width) 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; @@ -235,9 +236,9 @@ p_sockaddr(struct sockaddr *phost, struct sockaddr *pmask, int width) buf[f*3-1] = '\0'; } else strcpy(buf, "??:??:??:??:??:??"); - else + } else sprintf(buf, "", dl->sdl_type); - else if (dl->sdl_slen) + } else if (dl->sdl_slen) sprintf(buf, "", dl->sdl_slen); else sprintf(buf, "link#%d", dl->sdl_index);