Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net couple cosmetic style fixes, and drop ^L's



details:   https://anonhg.NetBSD.org/src/rev/399e09b19cf0
branches:  trunk
changeset: 520852:399e09b19cf0
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Jan 18 22:39:12 2002 +0000

description:
couple cosmetic style fixes, and drop ^L's

diffstat:

 sys/net/if_spppsubr.c |  147 ++++++++++++++++++++++++++-----------------------
 1 files changed, 79 insertions(+), 68 deletions(-)

diffs (truncated from 364 to 300 lines):

diff -r fc81ea3b29ae -r 399e09b19cf0 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Fri Jan 18 22:18:36 2002 +0000
+++ b/sys/net/if_spppsubr.c     Fri Jan 18 22:39:12 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.41 2002/01/15 12:28:08 martin Exp $   */
+/*     $NetBSD: if_spppsubr.c,v 1.42 2002/01/18 22:39:12 jdolecek Exp $         */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.41 2002/01/15 12:28:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.42 2002/01/18 22:39:12 jdolecek Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipx.h"
@@ -442,7 +442,7 @@
 };
 
 
-/*
+/*
  * Exported functions, comprising our interface to the lower layer.
  */
 
@@ -1064,10 +1064,9 @@
 {
        struct ifreq *ifr = (struct ifreq*) data;
        struct sppp *sp = (struct sppp*) ifp;
-       int s, rv, going_up, going_down, newmode;
+       int s, error=0, going_up, going_down, newmode;
 
        s = splnet();
-       rv = 0;
        switch (cmd) {
        case SIOCAIFADDR:
        case SIOCSIFDSTADDR:
@@ -1141,7 +1140,7 @@
        {
                struct proc *p = curproc;               /* XXX */
 
-               if ((rv = suser(p->p_ucred, &p->p_acflag)) != 0)
+               if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
                        break;
        }
        /* FALLTHROUGH */
@@ -1150,18 +1149,18 @@
        case SPPPGETSTATUS:
        case SPPPGETIDLETO:
        case SPPPGETAUTHFAILURES:
-               rv = sppp_params(sp, cmd, data);
+               error = sppp_params(sp, cmd, data);
                break;
 
        default:
-               rv = ENOTTY;
+               error = ENOTTY;
        }
        splx(s);
-       return rv;
+       return (error);
 }
 
 
-/*
+/*
  * Cisco framing implementation.
  */
 
@@ -1284,7 +1283,7 @@
        ifp->if_obytes += m->m_pkthdr.len + sp->pp_framebytes;
 }
 
-/*
+/*
  * PPP protocol implementation.
  */
 
@@ -1981,7 +1980,8 @@
                break;
        }
 }
-/*
+
+/*
  *--------------------------------------------------------------------------*
  *                                                                          *
  *                         The LCP implementation.                          *
@@ -2673,7 +2673,7 @@
 }
 
 
-/*
+/*
  *--------------------------------------------------------------------------*
  *                                                                          *
  *                        The IPCP implementation.                          *
@@ -3120,7 +3120,7 @@
 }
 
 
-/*
+/*
  *--------------------------------------------------------------------------*
  *                                                                          *
  *                      The IPv6CP implementation.                          *
@@ -3616,7 +3616,7 @@
 #endif /*INET6*/
 
 
-/*
+/*
  *--------------------------------------------------------------------------*
  *                                                                          *
  *                        The CHAP implementation.                          *
@@ -4127,7 +4127,8 @@
                       sp->myauth.name,
                       0);
 }
-/*
+
+/*
  *--------------------------------------------------------------------------*
  *                                                                          *
  *                        The PAP implementation.                           *
@@ -4453,7 +4454,8 @@
                       pwdlen, sp->myauth.secret,
                       0);
 }
-/*
+
+/*
  * Random miscellaneous functions.
  */
 
@@ -4909,16 +4911,19 @@
        switch (cmd) {
        case SPPPGETAUTHCFG:
            {
-               struct spppauthcfg * cfg = (struct spppauthcfg*)data;
+               struct spppauthcfg *cfg = (struct spppauthcfg *)data;
+               int error;
+               size_t len;
+
                cfg->myauthflags = sp->myauth.flags;
                cfg->hisauthflags = sp->hisauth.flags;
                strncpy(cfg->ifname, sp->pp_if.if_xname, IFNAMSIZ);
                cfg->hisauth = 0;
                if (sp->hisauth.proto)
-                   cfg->hisauth = sp->hisauth.proto == PPP_PAP ? SPPP_AUTHPROTO_PAP : SPPP_AUTHPROTO_CHAP;
+                   cfg->hisauth = (sp->hisauth.proto == PPP_PAP) ? SPPP_AUTHPROTO_PAP : SPPP_AUTHPROTO_CHAP;
                cfg->myauth = 0;
                if (sp->myauth.proto)
-                   cfg->myauth = sp->myauth.proto == PPP_PAP ? SPPP_AUTHPROTO_PAP : SPPP_AUTHPROTO_CHAP;
+                   cfg->myauth = (sp->myauth.proto == PPP_PAP) ? SPPP_AUTHPROTO_PAP : SPPP_AUTHPROTO_CHAP;
                if (cfg->myname_length == 0) {
                    if (sp->myauth.name != NULL)
                        cfg->myname_length = strlen(sp->myauth.name)+1;
@@ -4926,12 +4931,11 @@
                    if (sp->myauth.name == NULL) {
                        cfg->myname_length = 0;
                    } else {
-                       int rv;
-                       size_t len = strlen(sp->myauth.name)+1;
+                       len = strlen(sp->myauth.name)+1;
                        if (cfg->myname_length < len)
-                           return ENAMETOOLONG;
-                       rv = copyout(sp->myauth.name, cfg->myname, len);
-                       if (rv) return rv;
+                           return (ENAMETOOLONG);
+                       error = copyout(sp->myauth.name, cfg->myname, len);
+                       if (error) return error;
                    }
                }
                if (cfg->hisname_length == 0) {
@@ -4941,136 +4945,143 @@
                    if (sp->hisauth.name == NULL) {
                        cfg->hisname_length = 0;
                    } else {
-                       int rv;
-                       size_t len = strlen(sp->hisauth.name)+1;
+                       len = strlen(sp->hisauth.name)+1;
                        if (cfg->hisname_length < len)
-                           return ENAMETOOLONG;
-                       rv = copyout(sp->hisauth.name, cfg->hisname, len);
-                       if (rv) return rv;
+                           return (ENAMETOOLONG);
+                       error = copyout(sp->hisauth.name, cfg->hisname, len);
+                       if (error) return error;
                    }
                }
            }
            break;
        case SPPPSETAUTHCFG:
            {
-               struct spppauthcfg * cfg = (struct spppauthcfg*)data;
-               int rv;
-
-               if (sp->myauth.name) free(sp->myauth.name, M_DEVBUF);
-               sp->myauth.name = NULL;
-               if (sp->myauth.secret) free(sp->myauth.secret, M_DEVBUF);
-               sp->myauth.secret = NULL;
-               if (sp->hisauth.name) free(sp->hisauth.name, M_DEVBUF);
-               sp->hisauth.name = NULL;
-               if (sp->hisauth.secret) free(sp->hisauth.secret, M_DEVBUF);
-               sp->hisauth.secret = NULL;
+               struct spppauthcfg *cfg = (struct spppauthcfg*)data;
+               int error;
+
+               if (sp->myauth.name) {
+                       free(sp->myauth.name, M_DEVBUF);
+                       sp->myauth.name = NULL;
+               }
+               if (sp->myauth.secret) {
+                       free(sp->myauth.secret, M_DEVBUF);
+                       sp->myauth.secret = NULL;
+               }
+               if (sp->hisauth.name) {
+                       free(sp->hisauth.name, M_DEVBUF);
+                       sp->hisauth.name = NULL;
+               }
+               if (sp->hisauth.secret) {
+                       free(sp->hisauth.secret, M_DEVBUF);
+                       sp->hisauth.secret = NULL;
+               }
 
                if (cfg->hisname != NULL && cfg->hisname_length > 0) {
                    if (cfg->hisname_length >= MCLBYTES)
-                       return ENAMETOOLONG;
+                       return (ENAMETOOLONG);
                    sp->hisauth.name = malloc(cfg->hisname_length, M_DEVBUF, M_WAITOK);
-                   rv = copyin(cfg->hisname, sp->hisauth.name, cfg->hisname_length);
-                   if (rv) {
+                   error = copyin(cfg->hisname, sp->hisauth.name, cfg->hisname_length);
+                   if (error) {
                        free(sp->hisauth.name, M_DEVBUF);
                        sp->hisauth.name = NULL;
-                       return rv;
+                       return error;
                    }
                    sp->hisauth.name[cfg->hisname_length-1] = 0;
                }
                if (cfg->hissecret != NULL && cfg->hissecret_length > 0) {
                    if (cfg->hissecret_length >= MCLBYTES)
-                       return ENAMETOOLONG;
+                       return (ENAMETOOLONG);
                    sp->hisauth.secret = malloc(cfg->hissecret_length, M_DEVBUF, M_WAITOK);
-                   rv = copyin(cfg->hissecret, sp->hisauth.secret, cfg->hissecret_length);
-                   if (rv) {
+                   error = copyin(cfg->hissecret, sp->hisauth.secret, cfg->hissecret_length);
+                   if (error) {
                        free(sp->hisauth.secret, M_DEVBUF);
                        sp->hisauth.secret = NULL;
-                       return rv;
+                       return error;
                    }
                    sp->hisauth.secret[cfg->hisname_length-1] = 0;
                }
                if (cfg->myname != NULL && cfg->myname_length > 0) {
                    if (cfg->myname_length >= MCLBYTES)
-                       return ENAMETOOLONG;
+                       return (ENAMETOOLONG);
                    sp->myauth.name = malloc(cfg->myname_length, M_DEVBUF, M_WAITOK);
-                   rv = copyin(cfg->myname, sp->myauth.name, cfg->myname_length);
-                   if (rv) {
+                   error = copyin(cfg->myname, sp->myauth.name, cfg->myname_length);
+                   if (error) {
                        free(sp->myauth.name, M_DEVBUF);
                        sp->myauth.name = NULL;
-                       return rv;
+                       return error;
                    }
                    sp->myauth.name[cfg->myname_length-1] = 0;
                }
                if (cfg->mysecret != NULL && cfg->mysecret_length > 0) {
                    if (cfg->mysecret_length >= MCLBYTES)
-                       return ENAMETOOLONG;
+                       return (ENAMETOOLONG);
                    sp->myauth.secret = malloc(cfg->mysecret_length, M_DEVBUF, M_WAITOK);
-                   rv = copyin(cfg->mysecret, sp->myauth.secret, cfg->mysecret_length);
-                   if (rv) {
+                   error = copyin(cfg->mysecret, sp->myauth.secret, cfg->mysecret_length);
+                   if (error) {
                        free(sp->myauth.secret, M_DEVBUF);
                        sp->myauth.secret = NULL;
-                       return rv;
+                       return error;
                    }
                    sp->myauth.secret[cfg->myname_length-1] = 0;
                }
                sp->myauth.flags = cfg->myauthflags;
                if (cfg->myauth)
-                   sp->myauth.proto = cfg->myauth == SPPP_AUTHPROTO_PAP ? PPP_PAP : PPP_CHAP;
+                   sp->myauth.proto = (cfg->myauth == SPPP_AUTHPROTO_PAP) ? PPP_PAP : PPP_CHAP;
                sp->hisauth.flags = cfg->hisauthflags;
                if (cfg->hisauth)
-                   sp->hisauth.proto = cfg->hisauth == SPPP_AUTHPROTO_PAP ? PPP_PAP : PPP_CHAP;
+                   sp->hisauth.proto = (cfg->hisauth == SPPP_AUTHPROTO_PAP) ? PPP_PAP : PPP_CHAP;



Home | Main Index | Thread Index | Old Index