Index: sys/kern/uipc_socket2.c =================================================================== --- sys/kern/uipc_socket2.c (revision 194233) +++ sys/kern/uipc_socket2.c (working copy) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include int maxsockets; Index: sys/kern/uipc_syscalls.c =================================================================== --- sys/kern/uipc_syscalls.c (revision 194233) +++ sys/kern/uipc_syscalls.c (working copy) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Index: sys/kern/uipc_usrreq.c =================================================================== --- sys/kern/uipc_usrreq.c (revision 194233) +++ sys/kern/uipc_usrreq.c (working copy) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Index: sys/kern/uipc_socket.c =================================================================== --- sys/kern/uipc_socket.c (revision 194233) +++ sys/kern/uipc_socket.c (working copy) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -509,7 +510,7 @@ soabort(so) ACCEPT_LOCK(); SOCK_LOCK(so); sotryfree(so); /* note: does not decrement the ref count */ - return error; + return (error); } return (0); } @@ -1438,7 +1439,8 @@ release: out: SOCKBUF_LOCK_ASSERT(&so->so_rcv); SOCKBUF_UNLOCK(&so->so_rcv); - return (error); + /* Tu nawiasu nie ma celowo, bo to caly czas zwraca EAGAIN. */ + return error; } int @@ -1526,7 +1528,7 @@ sooptcopyin(sopt, buf, len, minlen) * is set to however much we actually retrieved. */ if ((valsize = sopt->sopt_valsize) < minlen) - return EINVAL; + return (EINVAL); if (valsize > len) sopt->sopt_valsize = valsize = len; @@ -1534,7 +1536,7 @@ sooptcopyin(sopt, buf, len, minlen) return (copyin(sopt->sopt_val, buf, valsize)); bcopy(sopt->sopt_val, buf, valsize); - return 0; + return (0); } /* @@ -1767,7 +1769,7 @@ sooptcopyout(struct sockopt *sopt, const void *buf else bcopy(buf, sopt->sopt_val, valsize); } - return error; + return (error); } int @@ -1926,12 +1928,12 @@ soopt_getm(struct sockopt *sopt, struct mbuf **mp) MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_DATA); if (m == NULL) - return ENOBUFS; + return (ENOBUFS); if (sopt_size > MLEN) { MCLGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); - return ENOBUFS; + return (ENOBUFS); } m->m_len = min(MCLBYTES, sopt_size); } else { @@ -1945,7 +1947,7 @@ soopt_getm(struct sockopt *sopt, struct mbuf **mp) MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_DATA); if (m == NULL) { m_freem(*mp); - return ENOBUFS; + return (ENOBUFS); } if (sopt_size > MLEN) { MCLGET(m, sopt->sopt_td != NULL ? M_TRYWAIT : @@ -1953,7 +1955,7 @@ soopt_getm(struct sockopt *sopt, struct mbuf **mp) if ((m->m_flags & M_EXT) == 0) { m_freem(m); m_freem(*mp); - return ENOBUFS; + return (ENOBUFS); } m->m_len = min(MCLBYTES, sopt_size); } else { @@ -1963,7 +1965,7 @@ soopt_getm(struct sockopt *sopt, struct mbuf **mp) m_prev->m_next = m; m_prev = m; } - return 0; + return (0); } /* XXX; copyin sopt data into mbuf chain for (__FreeBSD__ < 3) routines. */ @@ -1973,7 +1975,7 @@ soopt_mcopyin(struct sockopt *sopt, struct mbuf *m struct mbuf *m0 = m; if (sopt->sopt_val == NULL) - return 0; + return (0); while (m != NULL && sopt->sopt_valsize >= m->m_len) { if (sopt->sopt_td != NULL) { int error; @@ -1982,7 +1984,7 @@ soopt_mcopyin(struct sockopt *sopt, struct mbuf *m m->m_len); if (error != 0) { m_freem(m0); - return(error); + return (error); } } else bcopy(sopt->sopt_val, mtod(m, char *), m->m_len); @@ -1992,7 +1994,7 @@ soopt_mcopyin(struct sockopt *sopt, struct mbuf *m } if (m != NULL) /* should be allocated enoughly at ip6_sooptmcopyin() */ panic("ip6_sooptmcopyin"); - return 0; + return (0); } /* XXX; copyout mbuf chain data into soopt for (__FreeBSD__ < 3) routines. */ @@ -2003,7 +2005,7 @@ soopt_mcopyout(struct sockopt *sopt, struct mbuf * size_t valsize = 0; if (sopt->sopt_val == NULL) - return 0; + return (0); while (m != NULL && sopt->sopt_valsize >= m->m_len) { if (sopt->sopt_td != NULL) { int error; @@ -2012,7 +2014,7 @@ soopt_mcopyout(struct sockopt *sopt, struct mbuf * m->m_len); if (error != 0) { m_freem(m0); - return(error); + return (error); } } else bcopy(mtod(m, char *), sopt->sopt_val, m->m_len); @@ -2024,10 +2026,10 @@ soopt_mcopyout(struct sockopt *sopt, struct mbuf * if (m != NULL) { /* enough soopt buffer should be given from user-land */ m_freem(m0); - return(EINVAL); + return (EINVAL); } sopt->sopt_valsize = valsize; - return 0; + return (0); } void Index: sys/kern/uipc_domain.c =================================================================== --- sys/kern/uipc_domain.c (revision 194233) +++ sys/kern/uipc_domain.c (working copy) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* Index: sys/kern/uipc_sem.c =================================================================== --- sys/kern/uipc_sem.c (revision 194233) +++ sys/kern/uipc_sem.c (working copy) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Index: sys/kern/uipc_mbuf2.c =================================================================== --- sys/kern/uipc_mbuf2.c (revision 194233) +++ sys/kern/uipc_mbuf2.c (working copy) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -104,7 +105,7 @@ m_pulldown(struct mbuf *m, int off, int len, int * panic("m == NULL in m_pulldown()"); if (len > MCLBYTES) { m_freem(m); - return NULL; /* impossible */ + return (NULL); /* impossible */ } #ifdef PULLDOWN_DEBUG @@ -128,7 +129,7 @@ m_pulldown(struct mbuf *m, int off, int len, int * n = n->m_next; if (!n) { m_freem(m); - return NULL; /* mbuf chain too short */ + return (NULL); /* mbuf chain too short */ } /* @@ -175,7 +176,7 @@ m_pulldown(struct mbuf *m, int off, int len, int * o = m_dup1(n, off, n->m_len - off, M_DONTWAIT); if (o == NULL) { m_freem(m); - return NULL; /* ENOBUFS */ + return (NULL); /* ENOBUFS */ } n->m_len = off; o->m_next = n->m_next; @@ -202,7 +203,7 @@ m_pulldown(struct mbuf *m, int off, int len, int * olen += o->m_len; if (hlen + olen < len) { m_freem(m); - return NULL; /* mbuf chain too short */ + return (NULL); /* mbuf chain too short */ } /* @@ -237,7 +238,7 @@ m_pulldown(struct mbuf *m, int off, int len, int * o = m_get(M_DONTWAIT, m->m_type); if (!o) { m_freem(m); - return NULL; /* ENOBUFS */ + return (NULL); /* ENOBUFS */ } /* get hlen from into */ o->m_len = hlen; @@ -264,7 +265,7 @@ ok: #endif if (offp) *offp = off; - return n; + return (n); } static struct mbuf * @@ -274,7 +275,7 @@ m_dup1(struct mbuf *m, int off, int len, int wait) int copyhdr; if (len > MCLBYTES) - return NULL; + return (NULL); if (off == 0 && (m->m_flags & M_PKTHDR) != 0) copyhdr = 1; else @@ -291,15 +292,15 @@ m_dup1(struct mbuf *m, int off, int len, int wait) n = m_get(wait, m->m_type); } if (!n) - return NULL; /* ENOBUFS */ + return (NULL); /* ENOBUFS */ if (copyhdr && !m_dup_pkthdr(n, m, wait)) { m_free(n); - return NULL; + return (NULL); } m_copydata(m, off, len, mtod(n, caddr_t)); n->m_len = len; - return n; + return (n); } /* Free a packet tag. */ @@ -321,13 +322,13 @@ m_tag_alloc(u_int32_t cookie, int type, int len, i MBUF_CHECKSLEEP(wait); if (len < 0) - return NULL; + return (NULL); t = malloc(len + sizeof(struct m_tag), M_PACKET_TAGS, wait); if (t == NULL) - return NULL; + return (NULL); m_tag_setup(t, cookie, type, len); t->m_tag_free = m_tag_free_default; - return t; + return (t); } /* Unlink and free a packet tag. */ @@ -388,10 +389,10 @@ m_tag_locate(struct mbuf *m, u_int32_t cookie, int p = SLIST_NEXT(t, m_tag_link); while (p != NULL) { if (p->m_tag_cookie == cookie && p->m_tag_id == type) - return p; + return (p); p = SLIST_NEXT(p, m_tag_link); } - return NULL; + return (NULL); } /* Copy a single tag. */ @@ -420,7 +421,7 @@ m_tag_copy(struct m_tag *t, int how) } else #endif bcopy(t + 1, p + 1, t->m_tag_len); /* Copy the data */ - return p; + return (p); } /* @@ -442,7 +443,7 @@ m_tag_copy_chain(struct mbuf *to, struct mbuf *fro t = m_tag_copy(p, how); if (t == NULL) { m_tag_delete_chain(to, NULL); - return 0; + return (0); } if (tprev == NULL) SLIST_INSERT_HEAD(&to->m_pkthdr.tags, t, m_tag_link); @@ -450,5 +451,5 @@ m_tag_copy_chain(struct mbuf *to, struct mbuf *fro SLIST_INSERT_AFTER(tprev, t, m_tag_link); tprev = t; } - return 1; + return (1); } Index: sys/kern/uipc_cow.c =================================================================== --- sys/kern/uipc_cow.c (revision 194233) +++ sys/kern/uipc_cow.c (working copy) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Index: sys/kern/uipc_mbuf.c =================================================================== --- sys/kern/uipc_mbuf.c (revision 194233) +++ sys/kern/uipc_mbuf.c (working copy) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -149,11 +150,11 @@ m_getm(struct mbuf *m, int len, int how, short typ if (mtail != NULL) mtail->m_next = top; - return top; + return (top); failed: if (top != NULL) m_freem(top); - return NULL; + return (NULL); } /* Index: sys/kern/uipc_accf.c =================================================================== --- sys/kern/uipc_accf.c (revision 194233) +++ sys/kern/uipc_accf.c (working copy) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include "opt_param.h" #include #include +#include #include #include #include Index: sys/opencrypto/deflate.c =================================================================== --- sys/opencrypto/deflate.c (revision 194233) +++ sys/opencrypto/deflate.c (working copy) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -160,7 +161,7 @@ end: } } *out = output; - return result; + return (result); bad: *out = NULL; @@ -170,7 +171,7 @@ bad: inflateEnd(&zbuf); else deflateEnd(&zbuf); - return 0; + return (0); } void * @@ -181,7 +182,7 @@ z_alloc(nil, type, size) void *ptr; ptr = malloc(type *size, M_CRYPTO_DATA, M_NOWAIT); - return ptr; + return (ptr); } void Index: sys/opencrypto/rmd160.c =================================================================== --- sys/opencrypto/rmd160.c (revision 194233) +++ sys/opencrypto/rmd160.c (working copy) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Index: sys/opencrypto/cryptosoft.c =================================================================== --- sys/opencrypto/cryptosoft.c (revision 194233) +++ sys/opencrypto/cryptosoft.c (working copy) @@ -26,6 +26,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -76,7 +77,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da /* Check for non-padded data */ if (crd->crd_len % blks) - return EINVAL; + return (EINVAL); /* Initialize the IV */ if (crd->crd_flags & CRD_F_ENCRYPT) { @@ -118,7 +119,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da /* Find beginning of data */ m = m_getptr(m, crd->crd_skip, &k); if (m == NULL) - return EINVAL; + return (EINVAL); i = crd->crd_len; @@ -172,7 +173,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da /* Advance pointer */ m = m_getptr(m, k + blks, &k); if (m == NULL) - return EINVAL; + return (EINVAL); i -= blks; @@ -191,7 +192,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da /* Sanity check */ if (m == NULL) - return EINVAL; + return (EINVAL); /* * Warning: idat may point to garbage here, but @@ -236,7 +237,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da } } - return 0; /* Done with mbuf encryption/decryption */ + return (0); /* Done with mbuf encryption/decryption */ } else if (flags & CRYPTO_F_IOV) { struct uio *uio = (struct uio *) buf; struct iovec *iov; @@ -244,7 +245,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da /* Find beginning of data */ iov = cuio_getptr(uio, crd->crd_skip, &k); if (iov == NULL) - return EINVAL; + return (EINVAL); i = crd->crd_len; @@ -298,7 +299,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da /* Advance pointer */ iov = cuio_getptr(uio, k + blks, &k); if (iov == NULL) - return EINVAL; + return (EINVAL); i -= blks; @@ -350,7 +351,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da } } - return 0; /* Done with iovec encryption/decryption */ + return (0); /* Done with iovec encryption/decryption */ } else { /* contiguous buffer */ if (crd->crd_flags & CRD_F_ENCRYPT) { for (i = crd->crd_skip; @@ -383,11 +384,11 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_da } } - return 0; /* Done with contiguous buffer encryption/decryption */ + return (0); /* Done with contiguous buffer encryption/decryption */ } /* Unreachable */ - return EINVAL; + return (EINVAL); } static void @@ -450,7 +451,7 @@ swcr_authcompute(struct cryptodesc *crd, struct sw int err; if (sw->sw_ictx == 0) - return EINVAL; + return (EINVAL); axf = sw->sw_axf; @@ -462,7 +463,7 @@ swcr_authcompute(struct cryptodesc *crd, struct sw err = crypto_apply(flags, buf, crd->crd_skip, crd->crd_len, (int (*)(void *, void *, unsigned int))axf->Update, (caddr_t)&ctx); if (err) - return err; + return (err); switch (sw->sw_alg) { case CRYPTO_MD5_HMAC: @@ -472,7 +473,7 @@ swcr_authcompute(struct cryptodesc *crd, struct sw case CRYPTO_SHA2_512_HMAC: case CRYPTO_RIPEMD160_HMAC: if (sw->sw_octx == NULL) - return EINVAL; + return (EINVAL); axf->Final(aalg, &ctx); bcopy(sw->sw_octx, &ctx, axf->ctxsize); @@ -483,7 +484,7 @@ swcr_authcompute(struct cryptodesc *crd, struct sw case CRYPTO_MD5_KPDK: case CRYPTO_SHA1_KPDK: if (sw->sw_octx == NULL) - return EINVAL; + return (EINVAL); axf->Update(&ctx, sw->sw_octx, sw->sw_klen); axf->Final(aalg, &ctx); @@ -497,7 +498,7 @@ swcr_authcompute(struct cryptodesc *crd, struct sw /* Inject the authentication data */ crypto_copyback(flags, buf, crd->crd_inject, sw->sw_mlen == 0 ? axf->hashsize : sw->sw_mlen, aalg); - return 0; + return (0); } /* @@ -531,7 +532,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_d FREE(data, M_CRYPTO_DATA); if (result == 0) - return EINVAL; + return (EINVAL); /* Copy back the (de)compressed data. m_copyback is * extending the mbuf as necessary. @@ -542,7 +543,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_d if (result > crd->crd_len) { /* Compression was useless, we lost time */ FREE(out, M_CRYPTO_DATA); - return 0; + return (0); } } @@ -573,7 +574,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_d } } FREE(out, M_CRYPTO_DATA); - return 0; + return (0); } /* @@ -590,7 +591,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct int error; if (sid == NULL || cri == NULL) - return EINVAL; + return (EINVAL); if (swcr_sessions) { for (i = 1; i < swcr_sesnum; i++) @@ -614,7 +615,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct swcr_sesnum = 0; else swcr_sesnum /= 2; - return ENOBUFS; + return (ENOBUFS); } /* Copy existing sessions */ @@ -635,7 +636,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (*swd == NULL) { swcr_freesession(NULL, i); - return ENOBUFS; + return (ENOBUFS); } switch (cri->cri_alg) { @@ -669,7 +670,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct cri->cri_key, cri->cri_klen / 8); if (error) { swcr_freesession(NULL, i); - return error; + return (error); } } (*swd)->sw_exf = txf; @@ -700,14 +701,14 @@ swcr_newsession(void *arg, u_int32_t *sid, struct M_NOWAIT); if ((*swd)->sw_ictx == NULL) { swcr_freesession(NULL, i); - return ENOBUFS; + return (ENOBUFS); } (*swd)->sw_octx = malloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); if ((*swd)->sw_octx == NULL) { swcr_freesession(NULL, i); - return ENOBUFS; + return (ENOBUFS); } if (cri->cri_key != NULL) { @@ -730,14 +731,14 @@ swcr_newsession(void *arg, u_int32_t *sid, struct M_NOWAIT); if ((*swd)->sw_ictx == NULL) { swcr_freesession(NULL, i); - return ENOBUFS; + return (ENOBUFS); } (*swd)->sw_octx = malloc(cri->cri_klen / 8, M_CRYPTO_DATA, M_NOWAIT); if ((*swd)->sw_octx == NULL) { swcr_freesession(NULL, i); - return ENOBUFS; + return (ENOBUFS); } /* Store the key so we can "append" it to the payload */ @@ -761,7 +762,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct M_NOWAIT); if ((*swd)->sw_ictx == NULL) { swcr_freesession(NULL, i); - return ENOBUFS; + return (ENOBUFS); } axf->Init((*swd)->sw_ictx); @@ -775,14 +776,14 @@ swcr_newsession(void *arg, u_int32_t *sid, struct break; default: swcr_freesession(NULL, i); - return EINVAL; + return (EINVAL); } (*swd)->sw_alg = cri->cri_alg; cri = cri->cri_next; swd = &((*swd)->sw_next); } - return 0; + return (0); } /* @@ -799,11 +800,11 @@ swcr_freesession(void *arg, u_int64_t tid) if (sid > swcr_sesnum || swcr_sessions == NULL || swcr_sessions[sid] == NULL) - return EINVAL; + return (EINVAL); /* Silently accept and return */ if (sid == 0) - return 0; + return (0); while ((swd = swcr_sessions[sid]) != NULL) { swcr_sessions[sid] = swd->sw_next; @@ -871,7 +872,7 @@ swcr_freesession(void *arg, u_int64_t tid) FREE(swd, M_CRYPTO_DATA); } - return 0; + return (0); } /* @@ -886,7 +887,7 @@ swcr_process(void *arg, struct cryptop *crp, int h /* Sanity check */ if (crp == NULL) - return EINVAL; + return (EINVAL); if (crp->crp_desc == NULL || crp->crp_buf == NULL) { crp->crp_etype = EINVAL; @@ -969,7 +970,7 @@ swcr_process(void *arg, struct cryptop *crp, int h done: crypto_done(crp); - return 0; + return (0); } /* Index: sys/opencrypto/cryptodev.c =================================================================== --- sys/opencrypto/cryptodev.c (revision 194233) +++ sys/opencrypto/cryptodev.c (working copy) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Index: sys/opencrypto/crypto.c =================================================================== --- sys/opencrypto/crypto.c (revision 194233) +++ sys/opencrypto/crypto.c (working copy) @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -165,10 +166,10 @@ crypto_init(void) error); goto bad; } - return 0; + return (0); bad: crypto_destroy(); - return error; + return (error); } /* @@ -242,9 +243,9 @@ crypto_modevent(module_t mod, int type, void *unus /*XXX disallow if active sessions */ error = 0; crypto_destroy(); - return 0; + return (0); } - return error; + return (error); } static moduledata_t crypto_mod = { @@ -363,7 +364,7 @@ crypto_newsession(u_int64_t *sid, struct cryptoini } done: CRYPTO_DRIVER_UNLOCK(); - return err; + return (err); } static void @@ -416,7 +417,7 @@ crypto_freesession(u_int64_t sid) done: CRYPTO_DRIVER_UNLOCK(); - return err; + return (err); } /* @@ -444,7 +445,7 @@ crypto_get_driverid(u_int32_t flags) if (2 * crypto_drivers_num <= crypto_drivers_num) { CRYPTO_DRIVER_UNLOCK(); printf("crypto: driver count wraparound!\n"); - return -1; + return (-1); } newdrv = malloc(2 * crypto_drivers_num * @@ -452,7 +453,7 @@ crypto_get_driverid(u_int32_t flags) if (newdrv == NULL) { CRYPTO_DRIVER_UNLOCK(); printf("crypto: no space to expand driver table!\n"); - return -1; + return (-1); } bcopy(crypto_drivers, newdrv, @@ -472,14 +473,14 @@ crypto_get_driverid(u_int32_t flags) CRYPTO_DRIVER_UNLOCK(); - return i; + return (i); } static struct cryptocap * crypto_checkdriver(u_int32_t hid) { if (crypto_drivers == NULL) - return NULL; + return (NULL); return (hid >= crypto_drivers_num ? NULL : &crypto_drivers[hid]); } @@ -523,7 +524,7 @@ crypto_kregister(u_int32_t driverid, int kalg, u_i err = EINVAL; CRYPTO_DRIVER_UNLOCK(); - return err; + return (err); } /* @@ -575,7 +576,7 @@ crypto_register(u_int32_t driverid, int alg, u_int err = EINVAL; CRYPTO_DRIVER_UNLOCK(); - return err; + return (err); } /* @@ -623,7 +624,7 @@ crypto_unregister(u_int32_t driverid, int alg) err = EINVAL; CRYPTO_DRIVER_UNLOCK(); - return err; + return (err); } /* @@ -664,7 +665,7 @@ crypto_unregister_all(u_int32_t driverid) err = EINVAL; CRYPTO_DRIVER_UNLOCK(); - return err; + return (err); } /* @@ -691,7 +692,7 @@ crypto_unblock(u_int32_t driverid, int what) err = EINVAL; CRYPTO_Q_UNLOCK(); - return err; + return (err); } /* @@ -737,7 +738,7 @@ crypto_dispatch(struct cryptop *crp) if (crp_sleep) wakeup_one(&crp_q); CRYPTO_Q_UNLOCK(); - return 0; + return (0); } /* @@ -760,7 +761,7 @@ crypto_kdispatch(struct cryptkop *krp) wakeup_one(&crp_q); CRYPTO_Q_UNLOCK(); - return 0; + return (0); } /* @@ -817,7 +818,7 @@ crypto_kinvoke(struct cryptkop *krp) krp->krp_status = error; crypto_kdone(krp); } - return 0; + return (0); } #ifdef CRYPTO_TIMING @@ -883,12 +884,12 @@ crypto_invoke(struct cryptocap *cap, struct crypto crp->crp_etype = EAGAIN; crypto_done(crp); - return 0; + return (0); } else { /* * Invoke the driver to process the request. */ - return cap->cc_process(cap->cc_arg, crp, hint); + return (cap->cc_process(cap->cc_arg, crp, hint)); } } @@ -947,14 +948,14 @@ crypto_getreq(int num) crd = uma_zalloc(cryptodesc_zone, M_NOWAIT|M_ZERO); if (crd == NULL) { crypto_freereq(crp); - return NULL; + return (NULL); } crd->crd_next = crp->crp_desc; crp->crp_desc = crd; } } - return crp; + return (crp); } /* Index: sys/opencrypto/criov.c =================================================================== --- sys/opencrypto/criov.c (revision 194233) +++ sys/opencrypto/criov.c (working copy) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Index: sys/opencrypto/xform.c =================================================================== --- sys/opencrypto/xform.c (revision 194233) +++ sys/opencrypto/xform.c (working copy) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -281,7 +282,7 @@ static int null_setkey(u_int8_t **sched, u_int8_t *key, int len) { *sched = NULL; - return 0; + return (0); } static void null_zerokey(u_int8_t **sched) @@ -321,7 +322,7 @@ des1_setkey(u_int8_t **sched, u_int8_t *key, int l } else err = ENOMEM; *sched = (u_int8_t *) p; - return err; + return (err); } static void @@ -366,7 +367,7 @@ des3_setkey(u_int8_t **sched, u_int8_t *key, int l } else err = ENOMEM; *sched = (u_int8_t *) p; - return err; + return (err); } static void @@ -419,7 +420,7 @@ blf_setkey(u_int8_t **sched, u_int8_t *key, int le err = 0; } else err = ENOMEM; - return err; + return (err); } static void @@ -453,7 +454,7 @@ cast5_setkey(u_int8_t **sched, u_int8_t *key, int err = 0; } else err = ENOMEM; - return err; + return (err); } static void @@ -497,7 +498,7 @@ skipjack_setkey(u_int8_t **sched, u_int8_t *key, i err = 0; } else err = ENOMEM; - return err; + return (err); } static void @@ -536,7 +537,7 @@ rijndael128_setkey(u_int8_t **sched, u_int8_t *key err = 0; } else err = ENOMEM; - return err; + return (err); } static void @@ -575,7 +576,7 @@ cml_setkey(u_int8_t **sched, u_int8_t *key, int le err = 0; } else err = ENOMEM; - return err; + return (err); } static void @@ -598,7 +599,7 @@ null_init(void *ctx) static int null_update(void *ctx, u_int8_t *buf, u_int16_t len) { - return 0; + return (0); } static void @@ -612,14 +613,14 @@ static int RMD160Update_int(void *ctx, u_int8_t *buf, u_int16_t len) { RMD160Update(ctx, buf, len); - return 0; + return (0); } static int MD5Update_int(void *ctx, u_int8_t *buf, u_int16_t len) { MD5Update(ctx, buf, len); - return 0; + return (0); } static void @@ -632,7 +633,7 @@ static int SHA1Update_int(void *ctx, u_int8_t *buf, u_int16_t len) { SHA1Update(ctx, buf, len); - return 0; + return (0); } static void @@ -645,21 +646,21 @@ static int SHA256Update_int(void *ctx, u_int8_t *buf, u_int16_t len) { SHA256_Update(ctx, buf, len); - return 0; + return (0); } static int SHA384Update_int(void *ctx, u_int8_t *buf, u_int16_t len) { SHA384_Update(ctx, buf, len); - return 0; + return (0); } static int SHA512Update_int(void *ctx, u_int8_t *buf, u_int16_t len) { SHA512_Update(ctx, buf, len); - return 0; + return (0); } /* @@ -672,7 +673,7 @@ deflate_compress(data, size, out) u_int32_t size; u_int8_t **out; { - return deflate_global(data, size, 0, out); + return (deflate_global(data, size, 0, out)); } static u_int32_t @@ -681,5 +682,5 @@ deflate_decompress(data, size, out) u_int32_t size; u_int8_t **out; { - return deflate_global(data, size, 1, out); + return (deflate_global(data, size, 1, out)); } Index: sys/netinet/ip_gre.c =================================================================== --- sys/netinet/ip_gre.c (revision 194233) +++ sys/netinet/ip_gre.c (working copy) @@ -51,6 +51,7 @@ #include #include +#include #include #include #include Index: sys/netinet/tcp_input.c =================================================================== --- sys/netinet/tcp_input.c (revision 194233) +++ sys/netinet/tcp_input.c (working copy) @@ -52,6 +52,7 @@ #include #include #include +#include #include /* before tcp_seq.h, for tcp_random18() */ Index: sys/netinet/in.c =================================================================== --- sys/netinet/in.c (revision 194233) +++ sys/netinet/in.c (working copy) @@ -35,6 +35,7 @@ #include #include +#include #include #include #include Index: sys/netinet/ip_carp.c =================================================================== --- sys/netinet/ip_carp.c (revision 194233) +++ sys/netinet/ip_carp.c (working copy) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include Index: sys/netinet/raw_ip.c =================================================================== --- sys/netinet/raw_ip.c (revision 194233) +++ sys/netinet/raw_ip.c (working copy) @@ -49,6 +49,7 @@ #include #include #include +#include #include Index: sys/netinet/tcp_subr.c =================================================================== --- sys/netinet/tcp_subr.c (revision 194233) +++ sys/netinet/tcp_subr.c (working copy) @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -930,7 +931,7 @@ tcp_notify(inp, error) } else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 && tp->t_softerror) { tcp_drop(tp, error); - return (struct inpcb *)0; + return ((struct inpcb *)0); } else { tp->t_softerror = error; return (inp); Index: sys/netinet/ip_divert.c =================================================================== --- sys/netinet/ip_divert.c (revision 194233) +++ sys/netinet/ip_divert.c (working copy) @@ -57,6 +57,7 @@ #include #include #include +#include #include Index: sys/netinet/tcp_timer.c =================================================================== --- sys/netinet/tcp_timer.c (revision 194233) +++ sys/netinet/tcp_timer.c (working copy) @@ -44,6 +44,7 @@ #include #include #include +#include #include Index: sys/netinet/tcp_sack.c =================================================================== --- sys/netinet/tcp_sack.c (revision 194233) +++ sys/netinet/tcp_sack.c (working copy) @@ -104,6 +104,7 @@ #include #include +#include #include #include #include @@ -114,6 +115,7 @@ #include #include #include +#include #include /* before tcp_seq.h, for tcp_random18() */ Index: sys/netinet/in_pcb.c =================================================================== --- sys/netinet/in_pcb.c (revision 194233) +++ sys/netinet/in_pcb.c (working copy) @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -737,7 +738,7 @@ in_sockaddr(in_port_t port, struct in_addr *addr_p sin->sin_addr = *addr_p; sin->sin_port = port; - return (struct sockaddr *)sin; + return ((struct sockaddr *)sin); } /* Index: sys/netinet/ip_divert.h =================================================================== --- sys/netinet/ip_divert.h (revision 194233) +++ sys/netinet/ip_divert.h (working copy) @@ -56,13 +56,13 @@ struct divert_tag { static __inline u_int16_t divert_cookie(struct m_tag *mtag) { - return ((struct divert_tag *)(mtag+1))->cookie; + return (((struct divert_tag *)(mtag+1))->cookie); } static __inline u_int16_t divert_find_cookie(struct mbuf *m) { struct m_tag *mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL); - return mtag ? divert_cookie(mtag) : 0; + return (mtag ? divert_cookie(mtag) : 0); } /* @@ -71,13 +71,13 @@ divert_find_cookie(struct mbuf *m) static __inline u_int32_t divert_info(struct m_tag *mtag) { - return ((struct divert_tag *)(mtag+1))->info; + return (((struct divert_tag *)(mtag+1))->info); } static __inline u_int32_t divert_find_info(struct mbuf *m) { struct m_tag *mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL); - return mtag ? divert_info(mtag) : 0; + return (mtag ? divert_info(mtag) : 0); } typedef void ip_divert_packet_t(struct mbuf *m, int incoming); Index: sys/netinet/ip_ecn.c =================================================================== --- sys/netinet/ip_ecn.c (revision 194233) +++ sys/netinet/ip_ecn.c (working copy) @@ -40,6 +40,7 @@ #include #include +#include #include #include Index: sys/netinet/tcp_output.c =================================================================== --- sys/netinet/tcp_output.c (revision 194233) +++ sys/netinet/tcp_output.c (working copy) @@ -39,6 +39,7 @@ #include #include +#include #include #include #include Index: sys/netinet/tcp_hostcache.c =================================================================== --- sys/netinet/tcp_hostcache.c (revision 194233) +++ sys/netinet/tcp_hostcache.c (working copy) @@ -69,6 +69,7 @@ #include #include +#include #include #include #include Index: sys/netinet/ip_encap.c =================================================================== --- sys/netinet/ip_encap.c (revision 194233) +++ sys/netinet/ip_encap.c (working copy) @@ -63,6 +63,7 @@ #include #include +#include #include #include #include @@ -260,7 +261,7 @@ encap6_input(mp, offp, proto) psw = (const struct ip6protosw *)match->psw; if (psw && psw->pr_input) { encap_fillarg(m, match); - return (*psw->pr_input)(mp, offp, proto); + return ((*psw->pr_input)(mp, offp, proto)); } else { m_freem(m); return IPPROTO_DONE; Index: sys/netinet/ip_output.c =================================================================== --- sys/netinet/ip_output.c (revision 194233) +++ sys/netinet/ip_output.c (working copy) @@ -37,6 +37,7 @@ #include #include +#include #include #include #include Index: sys/netinet/tcp_debug.c =================================================================== --- sys/netinet/tcp_debug.c (revision 194233) +++ sys/netinet/tcp_debug.c (working copy) @@ -48,6 +48,7 @@ #include #include +#include #include #include #include Index: sys/netinet/if_atm.c =================================================================== --- sys/netinet/if_atm.c (revision 194233) +++ sys/netinet/if_atm.c (working copy) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Index: sys/netinet/tcp_syncache.c =================================================================== --- sys/netinet/tcp_syncache.c (revision 194233) +++ sys/netinet/tcp_syncache.c (working copy) @@ -40,6 +40,7 @@ #include #include +#include #include #include #include Index: sys/netinet/tcp_usrreq.c =================================================================== --- sys/netinet/tcp_usrreq.c (revision 194233) +++ sys/netinet/tcp_usrreq.c (working copy) @@ -36,6 +36,7 @@ #include #include +#include #include #include #include Index: sys/netinet/ip_input.c =================================================================== --- sys/netinet/ip_input.c (revision 194233) +++ sys/netinet/ip_input.c (working copy) @@ -39,6 +39,7 @@ #include #include +#include #include #include #include Index: sys/netinet/ip_dummynet.c =================================================================== --- sys/netinet/ip_dummynet.c (revision 194233) +++ sys/netinet/ip_dummynet.c (working copy) @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -462,7 +463,7 @@ dn_tag_get(struct mbuf *m) mtag->m_tag_cookie == MTAG_ABI_COMPAT && mtag->m_tag_id == PACKET_TAG_DUMMYNET, ("packet on dummynet queue w/o dummynet tag!")); - return (struct dn_pkt_tag *)(mtag+1); + return ((struct dn_pkt_tag *)(mtag+1)); } /* @@ -2044,7 +2045,7 @@ dn_copy_set(struct dn_flow_set *set, char *bp) if (copied != set->rq_elements) printf("dummynet: ++ wrong count, have %d should be %d\n", copied, set->rq_elements); - return (char *)qp ; + return ((char *)qp); } static size_t Index: sys/netinet/in_gif.c =================================================================== --- sys/netinet/in_gif.c (revision 194233) +++ sys/netinet/in_gif.c (working copy) @@ -36,6 +36,7 @@ #include #include +#include #include #include #include Index: sys/netinet/ip_mroute.c =================================================================== --- sys/netinet/ip_mroute.c (revision 194233) +++ sys/netinet/ip_mroute.c (working copy) @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include Index: sys/netinet/ip_fw_pfil.c =================================================================== --- sys/netinet/ip_fw_pfil.c (revision 194233) +++ sys/netinet/ip_fw_pfil.c (working copy) @@ -38,6 +38,7 @@ #include #include +#include #include #include #include Index: sys/netinet/ip_icmp.c =================================================================== --- sys/netinet/ip_icmp.c (revision 194233) +++ sys/netinet/ip_icmp.c (working copy) @@ -35,6 +35,7 @@ #include #include +#include #include #include #include Index: sys/netinet/if_ether.c =================================================================== --- sys/netinet/if_ether.c (revision 194233) +++ sys/netinet/if_ether.c (working copy) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include Index: sys/netinet/ip_fw2.c =================================================================== --- sys/netinet/ip_fw2.c (revision 194233) +++ sys/netinet/ip_fw2.c (working copy) @@ -48,6 +48,7 @@ #include #include +#include #include #include #include Index: sys/netinet/ip_fastfwd.c =================================================================== --- sys/netinet/ip_fastfwd.c (revision 194233) +++ sys/netinet/ip_fastfwd.c (working copy) @@ -80,6 +80,7 @@ #include #include +#include #include #include #include Index: sys/netinet/in_proto.c =================================================================== --- sys/netinet/in_proto.c (revision 194233) +++ sys/netinet/in_proto.c (working copy) @@ -39,6 +39,7 @@ #include #include +#include #include #include #include Index: sys/netinet/udp_usrreq.c =================================================================== --- sys/netinet/udp_usrreq.c (revision 194233) +++ sys/netinet/udp_usrreq.c (working copy) @@ -37,6 +37,7 @@ #include #include +#include #include #include #include Index: sys/netinet/igmp.c =================================================================== --- sys/netinet/igmp.c (revision 194233) +++ sys/netinet/igmp.c (working copy) @@ -49,6 +49,7 @@ #include #include +#include #include #include #include Index: sys/netinet/in_rmx.c =================================================================== --- sys/netinet/in_rmx.c (revision 194233) +++ sys/netinet/in_rmx.c (working copy) @@ -44,6 +44,7 @@ #include #include +#include #include #include #include Index: sys/net/if.c =================================================================== --- sys/net/if.c (revision 194233) +++ sys/net/if.c (working copy) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include Index: sys/net/ppp_tty.c =================================================================== --- sys/net/ppp_tty.c (revision 194233) +++ sys/net/ppp_tty.c (working copy) @@ -79,6 +79,7 @@ #include #include +#include #include #include #include Index: sys/net/if_disc.c =================================================================== --- sys/net/if_disc.c (revision 194233) +++ sys/net/if_disc.c (working copy) @@ -37,6 +37,7 @@ #include #include +#include #include #include #include Index: sys/net/netisr.c =================================================================== --- sys/net/netisr.c (revision 194233) +++ sys/net/netisr.c (working copy) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include Index: sys/net/bpf.c =================================================================== --- sys/net/bpf.c (revision 194233) +++ sys/net/bpf.c (working copy) @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include Index: sys/net/if_stf.c =================================================================== --- sys/net/if_stf.c (revision 194233) +++ sys/net/if_stf.c (working copy) @@ -80,6 +80,7 @@ #include #include +#include #include #include #include @@ -419,7 +420,7 @@ stf_getsrcifa6(ifp) if (ia4 == NULL) continue; - return (struct in6_ifaddr *)ia; + return ((struct in6_ifaddr *)ia); } return NULL; Index: sys/net/if_ppp.c =================================================================== --- sys/net/if_ppp.c (revision 194233) +++ sys/net/if_ppp.c (working copy) @@ -88,6 +88,7 @@ #include #include +#include #include #include #include Index: sys/net/if_clone.c =================================================================== --- sys/net/if_clone.c (revision 194233) +++ sys/net/if_clone.c (working copy) @@ -36,6 +36,7 @@ #include #include #include +#include #include #include Index: sys/net/slcompress.c =================================================================== --- sys/net/slcompress.c (revision 194233) +++ sys/net/slcompress.c (working copy) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include Index: sys/net/if_atmsubr.c =================================================================== --- sys/net/if_atmsubr.c (revision 194233) +++ sys/net/if_atmsubr.c (working copy) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Index: sys/net/if_edsc.c =================================================================== --- sys/net/if_edsc.c (revision 194233) +++ sys/net/if_edsc.c (working copy) @@ -45,7 +45,8 @@ #include /* queue(3) to keep the list of interfaces */ #include /* struct ifreq */ #include /* socket ioctl's */ -/* #include if you need printf(9) or other all-purpose globals */ +/* #include +#include if you need printf(9) or other all-purpose globals */ #include /* bpf(9) */ #include /* Ethernet related constants and types */ Index: sys/net/route.c =================================================================== --- sys/net/route.c (revision 194233) +++ sys/net/route.c (working copy) @@ -35,6 +35,7 @@ #include #include +#include #include #include #include Index: sys/net/if_ef.c =================================================================== --- sys/net/if_ef.c (revision 194233) +++ sys/net/if_ef.c (working copy) @@ -32,6 +32,7 @@ #include #include +#include #include #include #include Index: sys/net/if_bridge.c =================================================================== --- sys/net/if_bridge.c (revision 194233) +++ sys/net/if_bridge.c (working copy) @@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include /* for net/if.h */ #include Index: sys/net/bridgestp.c =================================================================== --- sys/net/bridgestp.c (revision 194233) +++ sys/net/bridgestp.c (working copy) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Index: sys/net/if_fwsubr.c =================================================================== --- sys/net/if_fwsubr.c (revision 194233) +++ sys/net/if_fwsubr.c (working copy) @@ -36,6 +36,7 @@ #include #include +#include #include #include #include Index: sys/net/if_media.c =================================================================== --- sys/net/if_media.c (revision 194233) +++ sys/net/if_media.c (working copy) @@ -48,6 +48,7 @@ #include #include +#include #include #include #include Index: sys/net/raw_cb.c =================================================================== --- sys/net/raw_cb.c (revision 194233) +++ sys/net/raw_cb.c (working copy) @@ -39,6 +39,7 @@ #include #include #include +#include #include Index: sys/net/if_vlan.c =================================================================== --- sys/net/if_vlan.c (revision 194233) +++ sys/net/if_vlan.c (working copy) @@ -53,6 +53,7 @@ #include #include #include +#include #include #include Index: sys/net/if_arcsubr.c =================================================================== --- sys/net/if_arcsubr.c (revision 194233) +++ sys/net/if_arcsubr.c (working copy) @@ -44,6 +44,7 @@ #include #include +#include #include #include #include Index: sys/net/if_ethersubr.c =================================================================== --- sys/net/if_ethersubr.c (revision 194233) +++ sys/net/if_ethersubr.c (working copy) @@ -41,6 +41,7 @@ #include #include +#include #include #include #include Index: sys/net/if_gif.c =================================================================== --- sys/net/if_gif.c (revision 194233) +++ sys/net/if_gif.c (working copy) @@ -36,6 +36,7 @@ #include #include +#include #include #include #include Index: sys/net/if_mib.c =================================================================== --- sys/net/if_mib.c (revision 194233) +++ sys/net/if_mib.c (working copy) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include Index: sys/net/if_loop.c =================================================================== --- sys/net/if_loop.c (revision 194233) +++ sys/net/if_loop.c (working copy) @@ -41,6 +41,7 @@ #include #include +#include #include #include #include Index: sys/net/pfil.c =================================================================== --- sys/net/pfil.c (revision 194233) +++ sys/net/pfil.c (working copy) @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include Index: sys/net/if_tap.c =================================================================== --- sys/net/if_tap.c (revision 194233) +++ sys/net/if_tap.c (working copy) @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include Index: sys/net/rtsock.c =================================================================== --- sys/net/rtsock.c (revision 194233) +++ sys/net/rtsock.c (working copy) @@ -43,6 +43,7 @@ #include #include #include +#include #include #include Index: sys/net/radix.c =================================================================== --- sys/net/radix.c (revision 194233) +++ sys/net/radix.c (working copy) @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #else Index: sys/net/if_faith.c =================================================================== --- sys/net/if_faith.c (revision 194233) +++ sys/net/if_faith.c (working copy) @@ -44,6 +44,7 @@ #include #include +#include #include #include #include Index: sys/net/if_iso88025subr.c =================================================================== --- sys/net/if_iso88025subr.c (revision 194233) +++ sys/net/if_iso88025subr.c (working copy) @@ -47,6 +47,7 @@ #include #include +#include #include #include #include Index: sys/net/if_fddisubr.c =================================================================== --- sys/net/if_fddisubr.c (revision 194233) +++ sys/net/if_fddisubr.c (working copy) @@ -44,6 +44,7 @@ #include #include +#include #include #include #include Index: sys/net/if_enc.c =================================================================== --- sys/net/if_enc.c (revision 194233) +++ sys/net/if_enc.c (working copy) @@ -29,6 +29,7 @@ #include #include +#include #include #include #include Index: sys/net/if_tun.c =================================================================== --- sys/net/if_tun.c (revision 194233) +++ sys/net/if_tun.c (working copy) @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include Index: sys/net/if_spppfr.c =================================================================== --- sys/net/if_spppfr.c (revision 194233) +++ sys/net/if_spppfr.c (working copy) @@ -40,6 +40,7 @@ #endif #include +#include #include #include #include Index: sys/net/if_lagg.c =================================================================== --- sys/net/if_lagg.c (revision 194233) +++ sys/net/if_lagg.c (working copy) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Index: sys/net/ieee8023ad_lacp.c =================================================================== --- sys/net/ieee8023ad_lacp.c (revision 194233) +++ sys/net/ieee8023ad_lacp.c (working copy) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include /* hz */ #include /* for net/if.h */ Index: sys/net/raw_usrreq.c =================================================================== --- sys/net/raw_usrreq.c (revision 194233) +++ sys/net/raw_usrreq.c (working copy) @@ -42,6 +42,7 @@ #include #include #include +#include #include Index: sys/net/if_gre.c =================================================================== --- sys/net/if_gre.c (revision 194233) +++ sys/net/if_gre.c (working copy) @@ -62,6 +62,7 @@ #include #include #include +#include #include #include Index: sys/net/if_spppsubr.c =================================================================== --- sys/net/if_spppsubr.c (revision 194233) +++ sys/net/if_spppsubr.c (working copy) @@ -38,6 +38,7 @@ #endif #include +#include #include #include #include Index: sys/net/if_sl.c =================================================================== --- sys/net/if_sl.c (revision 194233) +++ sys/net/if_sl.c (working copy) @@ -66,6 +66,7 @@ #include #include +#include #include #include #include Index: sys/net/bridge.c =================================================================== --- sys/net/bridge.c (revision 194233) +++ sys/net/bridge.c (working copy) @@ -93,6 +93,7 @@ #include #include #include +#include #include /* for net/if.h */ #include /* string functions */ #include Index: sys/i386/conf/GENERIC =================================================================== --- sys/i386/conf/GENERIC (revision 194233) +++ sys/i386/conf/GENERIC (working copy) @@ -24,6 +24,12 @@ cpu I586_CPU cpu I686_CPU ident GENERIC +options FAST_IPSEC +device crypto + +options FAST_IPSEC #new IPsec (cannot define w/ IPSEC) +device crypto + # To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" # Default places to look for devices. Index: sys/netipsec/key_debug.c =================================================================== --- sys/netipsec/key_debug.c (revision 194233) +++ sys/netipsec/key_debug.c (working copy) @@ -40,6 +40,7 @@ #include #ifdef _KERNEL #include +#include #include #include #endif Index: sys/netipsec/xform_tcp.c =================================================================== --- sys/netipsec/xform_tcp.c (revision 194233) +++ sys/netipsec/xform_tcp.c (working copy) @@ -33,6 +33,7 @@ #include #include +#include #include #include #include Index: sys/netipsec/xform_ipcomp.c =================================================================== --- sys/netipsec/xform_ipcomp.c (revision 194233) +++ sys/netipsec/xform_ipcomp.c (working copy) @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -82,12 +83,12 @@ struct comp_algo * ipcomp_algorithm_lookup(int alg) { if (alg >= IPCOMP_ALG_MAX) - return NULL; + return (NULL); switch (alg) { case SADB_X_CALG_DEFLATE: - return &comp_algo_deflate; + return (&comp_algo_deflate); } - return NULL; + return (NULL); } /* @@ -104,7 +105,7 @@ ipcomp_init(struct secasvar *sav, struct xformsw * if (tcomp == NULL) { DPRINTF(("%s: unsupported compression algorithm %d\n", __func__, sav->alg_comp)); - return EINVAL; + return (EINVAL); } sav->alg_comp = sav->alg_enc; /* set for doing histogram */ sav->tdb_xform = xsp; @@ -114,7 +115,7 @@ ipcomp_init(struct secasvar *sav, struct xformsw * bzero(&cric, sizeof (cric)); cric.cri_alg = sav->tdb_compalgxform->type; - return crypto_newsession(&sav->tdb_cryptoid, &cric, crypto_support); + return (crypto_newsession(&sav->tdb_cryptoid, &cric, crypto_support)); } /* @@ -127,7 +128,7 @@ ipcomp_zeroize(struct secasvar *sav) err = crypto_freesession(sav->tdb_cryptoid); sav->tdb_cryptoid = 0; - return err; + return (err); } /* @@ -149,7 +150,7 @@ ipcomp_input(struct mbuf *m, struct secasvar *sav, m_freem(m); DPRINTF(("%s: no crypto descriptors\n", __func__)); ipcompstat.ipcomps_crypto++; - return ENOBUFS; + return (ENOBUFS); } /* Get IPsec-specific opaque pointer */ tc = (struct tdb_crypto *) malloc(sizeof (*tc), M_XDATA, M_NOWAIT|M_ZERO); @@ -158,7 +159,7 @@ ipcomp_input(struct mbuf *m, struct secasvar *sav, crypto_freereq(crp); DPRINTF(("%s: cannot allocate tdb_crypto\n", __func__)); ipcompstat.ipcomps_crypto++; - return ENOBUFS; + return (ENOBUFS); } crdc = crp->crp_desc; @@ -186,7 +187,7 @@ ipcomp_input(struct mbuf *m, struct secasvar *sav, tc->tc_protoff = protoff; tc->tc_skip = skip; - return crypto_dispatch(crp); + return (crypto_dispatch(crp)); } #ifdef INET6 @@ -253,7 +254,7 @@ ipcomp_input_cb(struct cryptop *crp) KEY_FREESAV(&sav); error = crypto_dispatch(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } ipcompstat.ipcomps_noxform++; @@ -307,7 +308,7 @@ ipcomp_input_cb(struct cryptop *crp) KEY_FREESAV(&sav); NET_UNLOCK_GIANT(); - return error; + return (error); bad: if (sav) KEY_FREESAV(&sav); @@ -318,7 +319,7 @@ bad: if (crp) crypto_freereq(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } /* @@ -480,7 +481,7 @@ ipcomp_output( crp->crp_opaque = (caddr_t) tc; crp->crp_sid = sav->tdb_cryptoid; - return crypto_dispatch(crp); + return (crypto_dispatch(crp)); bad: if (m) m_freem(m); @@ -529,7 +530,7 @@ ipcomp_output_cb(struct cryptop *crp) IPSECREQUEST_UNLOCK(isr); error = crypto_dispatch(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } ipcompstat.ipcomps_noxform++; DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype)); @@ -583,7 +584,7 @@ ipcomp_output_cb(struct cryptop *crp) KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); NET_UNLOCK_GIANT(); - return error; + return (error); bad: if (sav) KEY_FREESAV(&sav); @@ -593,7 +594,7 @@ bad: free(tc, M_XDATA); crypto_freereq(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } static struct xformsw ipcomp_xformsw = { Index: sys/netipsec/xform_esp.c =================================================================== --- sys/netipsec/xform_esp.c (revision 194233) +++ sys/netipsec/xform_esp.c (working copy) @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -97,26 +98,26 @@ struct enc_xform * esp_algorithm_lookup(int alg) { if (alg >= ESP_ALG_MAX) - return NULL; + return (NULL); switch (alg) { case SADB_EALG_DESCBC: - return &enc_xform_des; + return (&enc_xform_des); case SADB_EALG_3DESCBC: - return &enc_xform_3des; + return (&enc_xform_3des); case SADB_X_EALG_AES: - return &enc_xform_rijndael128; + return (&enc_xform_rijndael128); case SADB_X_EALG_BLOWFISHCBC: - return &enc_xform_blf; + return (&enc_xform_blf); case SADB_X_EALG_CAST128CBC: - return &enc_xform_cast5; + return (&enc_xform_cast5); case SADB_X_EALG_SKIPJACK: - return &enc_xform_skipjack; + return (&enc_xform_skipjack); case SADB_EALG_NULL: - return &enc_xform_null; + return (&enc_xform_null); case SADB_X_EALG_CAMELLIACBC: - return &enc_xform_camellia; + return (&enc_xform_camellia); } - return NULL; + return (NULL); } size_t @@ -147,7 +148,7 @@ esp_hdrsiz(struct secasvar *sav) */ size = sizeof (struct newesp) + esp_max_ivlen + 9 + 16; } - return size; + return (size); } /* @@ -165,17 +166,17 @@ esp_init(struct secasvar *sav, struct xformsw *xsp if (txform == NULL) { DPRINTF(("%s: unsupported encryption algorithm %d\n", __func__, sav->alg_enc)); - return EINVAL; + return (EINVAL); } if (sav->key_enc == NULL) { DPRINTF(("%s: no encoding key for %s algorithm\n", __func__, txform->name)); - return EINVAL; + return (EINVAL); } if ((sav->flags&(SADB_X_EXT_OLD|SADB_X_EXT_IV4B)) == SADB_X_EXT_IV4B) { DPRINTF(("%s: 4-byte IV not supported with protocol\n", __func__)); - return EINVAL; + return (EINVAL); } keylen = _KEYLEN(sav->key_enc); if (txform->minkey > keylen || keylen > txform->maxkey) { @@ -183,7 +184,7 @@ esp_init(struct secasvar *sav, struct xformsw *xsp "[%u..%u] for algorithm %s\n", __func__, keylen, txform->minkey, txform->maxkey, txform->name)); - return EINVAL; + return (EINVAL); } /* @@ -196,7 +197,7 @@ esp_init(struct secasvar *sav, struct xformsw *xsp sav->iv = (caddr_t) malloc(sav->ivlen, M_XDATA, M_WAITOK); if (sav->iv == NULL) { DPRINTF(("%s: no memory for IV\n", __func__)); - return EINVAL; + return (EINVAL); } key_randomfill(sav->iv, sav->ivlen); /*XXX*/ @@ -206,7 +207,7 @@ esp_init(struct secasvar *sav, struct xformsw *xsp if (sav->alg_auth != 0) { error = ah_init0(sav, xsp, &cria); if (error) - return error; + return (error); } /* NB: override anything set in ah_init0 */ @@ -237,7 +238,7 @@ esp_init(struct secasvar *sav, struct xformsw *xsp __func__)); error = EINVAL; } - return error; + return (error); } /* @@ -257,7 +258,7 @@ esp_zeroize(struct secasvar *sav) } sav->tdb_encalgxform = NULL; sav->tdb_xform = NULL; - return error; + return (error); } /* @@ -316,7 +317,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, in (u_long) ntohl(sav->spi))); espstat.esps_badilen++; m_freem(m); - return EINVAL; + return (EINVAL); } /* @@ -327,7 +328,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, in ipsec_logsastr(sav))); /*XXX*/ espstat.esps_replay++; m_freem(m); - return ENOBUFS; /*XXX*/ + return (ENOBUFS); /*XXX*/ } /* Update the counters */ @@ -352,7 +353,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, in __func__)); espstat.esps_crypto++; m_freem(m); - return ENOBUFS; + return (ENOBUFS); } /* Get IPsec-specific opaque pointer */ @@ -367,7 +368,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, in DPRINTF(("%s: failed to allocate tdb_crypto\n", __func__)); espstat.esps_crypto++; m_freem(m); - return ENOBUFS; + return (ENOBUFS); } tc->tc_ptr = (caddr_t) mtag; @@ -426,9 +427,9 @@ esp_input(struct mbuf *m, struct secasvar *sav, in } if (mtag == NULL) - return crypto_dispatch(crp); + return (crypto_dispatch(crp)); else - return esp_input_cb(crp); + return (esp_input_cb(crp)); } #ifdef INET6 @@ -502,7 +503,7 @@ esp_input_cb(struct cryptop *crp) KEY_FREESAV(&sav); error = crypto_dispatch(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } espstat.esps_noxform++; @@ -632,7 +633,7 @@ esp_input_cb(struct cryptop *crp) KEY_FREESAV(&sav); NET_UNLOCK_GIANT(); - return error; + return (error); bad: if (sav) KEY_FREESAV(&sav); @@ -643,7 +644,7 @@ bad: if (crp != NULL) crypto_freereq(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } /* @@ -870,7 +871,7 @@ esp_output( crda->crd_klen = _KEYBITS(sav->key_auth); } - return crypto_dispatch(crp); + return (crypto_dispatch(crp)); bad: if (m) m_freem(m); @@ -920,7 +921,7 @@ esp_output_cb(struct cryptop *crp) IPSECREQUEST_UNLOCK(isr); error = crypto_dispatch(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } espstat.esps_noxform++; @@ -949,7 +950,7 @@ esp_output_cb(struct cryptop *crp) KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); NET_UNLOCK_GIANT(); - return err; + return (err); bad: if (sav) KEY_FREESAV(&sav); @@ -959,7 +960,7 @@ bad: free(tc, M_XDATA); crypto_freereq(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } static struct xformsw esp_xformsw = { Index: sys/netipsec/ipsec_osdep.h =================================================================== --- sys/netipsec/ipsec_osdep.h (revision 194233) +++ sys/netipsec/ipsec_osdep.h (working copy) @@ -93,7 +93,7 @@ static __inline u_int read_random(void *p, u_int l static __inline u_int read_random(void *bufp, u_int len) { - return rnd_extract_data(bufp, len, RND_EXTRACT_ANY /*XXX FIXME */); + return (rnd_extract_data(bufp, len, RND_EXTRACT_ANY /*XXX FIXME */)); } #endif /* __NetBSD__ */ @@ -144,10 +144,10 @@ m_getcl(int how, short type, int flags) else MGET(mp, how, type); if (mp == NULL) - return NULL; + return (NULL); MCLGET(mp, how); - return mp; + return (mp); } #endif /* __NetBSD__ */ Index: sys/netipsec/xform_ah.c =================================================================== --- sys/netipsec/xform_ah.c (revision 194233) +++ sys/netipsec/xform_ah.c (working copy) @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -111,28 +112,28 @@ struct auth_hash * ah_algorithm_lookup(int alg) { if (alg >= AH_ALG_MAX) - return NULL; + return (NULL); switch (alg) { case SADB_X_AALG_NULL: - return &auth_hash_null; + return (&auth_hash_null); case SADB_AALG_MD5HMAC: - return &auth_hash_hmac_md5; + return (&auth_hash_hmac_md5); case SADB_AALG_SHA1HMAC: - return &auth_hash_hmac_sha1; + return (&auth_hash_hmac_sha1); case SADB_X_AALG_RIPEMD160HMAC: - return &auth_hash_hmac_ripemd_160; + return (&auth_hash_hmac_ripemd_160); case SADB_X_AALG_MD5: - return &auth_hash_key_md5; + return (&auth_hash_key_md5); case SADB_X_AALG_SHA: - return &auth_hash_key_sha1; + return (&auth_hash_key_sha1); case SADB_X_AALG_SHA2_256: - return &auth_hash_hmac_sha2_256; + return (&auth_hash_hmac_sha2_256); case SADB_X_AALG_SHA2_384: - return &auth_hash_hmac_sha2_384; + return (&auth_hash_hmac_sha2_384); case SADB_X_AALG_SHA2_512: - return &auth_hash_hmac_sha2_512; + return (&auth_hash_hmac_sha2_512); } - return NULL; + return (NULL); } size_t @@ -150,7 +151,7 @@ ah_hdrsiz(struct secasvar *sav) /* default guess */ size = sizeof (struct ah) + sizeof (u_int32_t) + 16; } - return size; + return (size); } /* @@ -166,7 +167,7 @@ ah_init0(struct secasvar *sav, struct xformsw *xsp if (thash == NULL) { DPRINTF(("%s: unsupported authentication algorithm %u\n", __func__, sav->alg_auth)); - return EINVAL; + return (EINVAL); } /* * Verify the replay state block allocation is consistent with @@ -179,19 +180,19 @@ ah_init0(struct secasvar *sav, struct xformsw *xsp "%s algorithm %s replay state\n", __func__, (sav->flags & SADB_X_EXT_OLD) ? "old" : "new", sav->replay == NULL ? "without" : "with")); - return EINVAL; + return (EINVAL); } if (sav->key_auth == NULL) { DPRINTF(("%s: no authentication key for %s algorithm\n", __func__, thash->name)); - return EINVAL; + return (EINVAL); } keylen = _KEYLEN(sav->key_auth); if (keylen != thash->keysize && thash->keysize != 0) { DPRINTF(("%s: invalid keylength %d, algorithm %s requires " "keysize %d\n", __func__, keylen, thash->name, thash->keysize)); - return EINVAL; + return (EINVAL); } sav->tdb_xform = xsp; @@ -204,7 +205,7 @@ ah_init0(struct secasvar *sav, struct xformsw *xsp cria->cri_key = _KEYBUF(sav->key_auth); cria->cri_mlen = AUTHSIZE(sav); - return 0; + return (0); } /* @@ -217,8 +218,8 @@ ah_init(struct secasvar *sav, struct xformsw *xsp) int error; error = ah_init0(sav, xsp, &cria); - return error ? error : - crypto_newsession(&sav->tdb_cryptoid, &cria, crypto_support); + return (error ? error : + crypto_newsession(&sav->tdb_cryptoid, &cria, crypto_support)); } /* @@ -238,7 +239,7 @@ ah_zeroize(struct secasvar *sav) sav->tdb_cryptoid = 0; sav->tdb_authalgxform = NULL; sav->tdb_xform = NULL; - return err; + return (err); } /* @@ -272,7 +273,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in *m0 = m = m_pullup(m, skip); if (m == NULL) { DPRINTF(("%s: m_pullup failed\n", __func__)); - return ENOBUFS; + return (ENOBUFS); } /* Fix the IP header */ @@ -312,7 +313,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in "option %d\n", __func__, ptr[off])); m_freem(m); - return EINVAL; + return (EINVAL); } switch (ptr[off]) { @@ -336,7 +337,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in __func__, ptr[off])); m_freem(m); - return EINVAL; + return (EINVAL); } off += ptr[off + 1]; @@ -351,7 +352,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in __func__, ptr[off])); m_freem(m); - return EINVAL; + return (EINVAL); } /* @@ -376,7 +377,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in "length for option %d\n", __func__, ptr[off])); m_freem(m); - return EINVAL; + return (EINVAL); } /* Zeroize all other options. */ @@ -392,7 +393,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in __func__)); m_freem(m); - return EINVAL; + return (EINVAL); } } @@ -408,7 +409,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in if (ip6.ip6_plen == 0) { DPRINTF(("%s: unsupported IPv6 jumbogram\n", __func__)); m_freem(m); - return EMSGSIZE; + return (EMSGSIZE); } ip6.ip6_flow = 0; @@ -435,7 +436,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in DPRINTF(("%s: failed to allocate memory" "for IPv6 headers\n",__func__)); m_freem(m); - return ENOBUFS; + return (ENOBUFS); } /* @@ -482,7 +483,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in /* Free, if we allocated. */ if (alloc) FREE(ptr, M_XDATA); - return EINVAL; + return (EINVAL); } ad = ptr[count + 1]; @@ -502,7 +503,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in /* Free, if we allocated. */ if (alloc) FREE(ptr, M_XDATA); - return EINVAL; + return (EINVAL); } } @@ -527,7 +528,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in if (alloc) FREE(ptr, M_XDATA); m_freem(m); - return EINVAL; + return (EINVAL); } /* Copyback and free, if we allocated. */ @@ -541,7 +542,7 @@ ah_massage_headers(struct mbuf **m0, int proto, in #endif /* INET6 */ } - return 0; + return (0); } /* @@ -577,7 +578,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int DPRINTF(("ah_input: cannot pullup header\n")); ahstat.ahs_hdrops++; /*XXX*/ m_freem(m); - return ENOBUFS; + return (ENOBUFS); } /* Check replay window, if applicable. */ @@ -586,7 +587,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int DPRINTF(("%s: packet replay failure: %s\n", __func__, ipsec_logsastr(sav))); m_freem(m); - return ENOBUFS; + return (ENOBUFS); } /* Verify AH header length. */ @@ -601,7 +602,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int (u_long) ntohl(sav->spi))); ahstat.ahs_badauthl++; m_freem(m); - return EACCES; + return (EACCES); } ahstat.ahs_ibytes += m->m_pkthdr.len - skip - hl; @@ -611,7 +612,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int DPRINTF(("%s: failed to acquire crypto descriptor\n",__func__)); ahstat.ahs_crypto++; m_freem(m); - return ENOBUFS; + return (ENOBUFS); } crda = crp->crp_desc; @@ -652,7 +653,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ahstat.ahs_crypto++; crypto_freereq(crp); m_freem(m); - return ENOBUFS; + return (ENOBUFS); } /* Only save information if crypto processing is needed. */ @@ -676,7 +677,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ahstat.ahs_hdrops++; free(tc, M_XDATA); crypto_freereq(crp); - return error; + return (error); } } @@ -698,9 +699,9 @@ ah_input(struct mbuf *m, struct secasvar *sav, int tc->tc_ptr = (caddr_t) mtag; /* Save the mtag we've identified. */ if (mtag == NULL) - return crypto_dispatch(crp); + return (crypto_dispatch(crp)); else - return ah_input_cb(crp); + return (ah_input_cb(crp)); } #ifdef INET6 @@ -770,7 +771,7 @@ ah_input_cb(struct cryptop *crp) if (crp->crp_etype == EAGAIN) { error = crypto_dispatch(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } ahstat.ahs_noxform++; @@ -864,7 +865,7 @@ ah_input_cb(struct cryptop *crp) KEY_FREESAV(&sav); NET_UNLOCK_GIANT(); - return error; + return (error); bad: if (sav) KEY_FREESAV(&sav); @@ -875,7 +876,7 @@ bad: if (crp != NULL) crypto_freereq(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } /* @@ -1100,7 +1101,7 @@ ah_output( tc->tc_skip = skip; tc->tc_protoff = protoff; - return crypto_dispatch(crp); + return (crypto_dispatch(crp)); bad: if (m) m_freem(m); @@ -1151,7 +1152,7 @@ ah_output_cb(struct cryptop *crp) IPSECREQUEST_UNLOCK(isr); error = crypto_dispatch(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } ahstat.ahs_noxform++; @@ -1184,7 +1185,7 @@ ah_output_cb(struct cryptop *crp) KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); NET_UNLOCK_GIANT(); - return err; + return (err); bad: if (sav) KEY_FREESAV(&sav); @@ -1194,7 +1195,7 @@ bad: free(tc, M_XDATA); crypto_freereq(crp); NET_UNLOCK_GIANT(); - return error; + return (error); } static struct xformsw ah_xformsw = { Index: sys/netipsec/ipsec.c =================================================================== --- sys/netipsec/ipsec.c (revision 194233) +++ sys/netipsec/ipsec.c (working copy) @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -225,7 +226,7 @@ key_allocsp_default(const char* where, int tag) KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP key_allocsp_default returns SP:%p (%u)\n", sp, sp->refcnt)); - return sp; + return (sp); } #define KEY_ALLOCSP_DEFAULT() \ key_allocsp_default(__FILE__, __LINE__) @@ -255,7 +256,7 @@ ipsec_getpolicy(struct tdb_ident *tdbi, u_int dir) if (sp == NULL) /*XXX????*/ sp = KEY_ALLOCSP_DEFAULT(); IPSEC_ASSERT(sp != NULL, ("null SP")); - return sp; + return (sp); } /* @@ -300,7 +301,7 @@ ipsec_getpolicybysock(m, dir, inp, error) pcbsp = inp->inp_sp; } if (*error) - return NULL; + return (NULL); IPSEC_ASSERT(pcbsp != NULL, ("null pcbsp")); switch (dir) { @@ -332,7 +333,7 @@ ipsec_getpolicybysock(m, dir, inp, error) ipseclog((LOG_ERR, "%s: Invalid policy for PCB %d\n", __func__, currsp->policy)); *error = EINVAL; - return NULL; + return (NULL); } } else { /* unpriv, SPD has policy */ sp = KEY_ALLOCSP(&currsp->spidx, dir); @@ -343,7 +344,7 @@ ipsec_getpolicybysock(m, dir, inp, error) "non-priviliged defined %d\n", __func__, currsp->policy)); *error = EINVAL; - return NULL; + return (NULL); case IPSEC_POLICY_ENTRUST: sp = KEY_ALLOCSP_DEFAULT(); @@ -358,7 +359,7 @@ ipsec_getpolicybysock(m, dir, inp, error) ipseclog((LOG_ERR, "%s: Invalid policy for " "PCB %d\n", __func__, currsp->policy)); *error = EINVAL; - return NULL; + return (NULL); } } } @@ -367,7 +368,7 @@ ipsec_getpolicybysock(m, dir, inp, error) KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s (priv %u policy %u) allocate SP:%p (refcnt %u)\n", __func__, pcbsp->priv, currsp->policy, sp, sp->refcnt)); - return sp; + return (sp); } /* @@ -403,7 +404,7 @@ ipsec_getpolicybyaddr(m, dir, flag, error) if (*error != 0) { DPRINTF(("%s: setpidx failed, dir %u flag %u\n", __func__, dir, flag)); - return NULL; + return (NULL); } spidx.dir = dir; @@ -412,7 +413,7 @@ ipsec_getpolicybyaddr(m, dir, flag, error) if (sp == NULL) /* no SP found, use system default */ sp = KEY_ALLOCSP_DEFAULT(); IPSEC_ASSERT(sp != NULL, ("null SP")); - return sp; + return (sp); } struct secpolicy * @@ -432,7 +433,7 @@ ipsec4_checkpolicy(m, dir, flag, error, inp) if (sp == NULL) { IPSEC_ASSERT(*error != 0, ("getpolicy failed w/o error")); newipsecstat.ips_out_inval++; - return NULL; + return (NULL); } IPSEC_ASSERT(*error == 0, ("sp w/ error set to %u", *error)); switch (sp->policy) { @@ -458,7 +459,7 @@ ipsec4_checkpolicy(m, dir, flag, error, inp) KEY_FREESP(&sp); sp = NULL; } - return sp; + return (sp); } static int @@ -484,7 +485,7 @@ ipsec4_setspidx_inpcb(m, pcb) bzero(&pcb->inp_sp->sp_out->spidx, sizeof (pcb->inp_sp->sp_in->spidx)); } - return error; + return (error); } #ifdef INET6 @@ -516,12 +517,12 @@ ipsec6_setspidx_in6pcb(m, pcb) goto bad; spidx->dir = IPSEC_DIR_OUTBOUND; - return 0; + return (0); bad: bzero(&pcb->in6p_sp->sp_in->spidx, sizeof(*spidx)); bzero(&pcb->in6p_sp->sp_out->spidx, sizeof(*spidx)); - return error; + return (error); } #endif @@ -557,14 +558,14 @@ ipsec_setspidx(m, spidx, needport) KEYDEBUG(KEYDEBUG_IPSEC_DUMP, printf("%s: pkthdr len(%d) mismatch (%d), ignored.\n", __func__, len, m->m_pkthdr.len)); - return EINVAL; + return (EINVAL); } if (m->m_pkthdr.len < sizeof(struct ip)) { KEYDEBUG(KEYDEBUG_IPSEC_DUMP, printf("%s: pkthdr len(%d) too small (v4), ignored.\n", __func__, m->m_pkthdr.len)); - return EINVAL; + return (EINVAL); } if (m->m_len >= sizeof(*ip)) @@ -582,28 +583,28 @@ ipsec_setspidx(m, spidx, needport) case 4: error = ipsec4_setspidx_ipaddr(m, spidx); if (error) - return error; + return (error); ipsec4_get_ulp(m, spidx, needport); - return 0; + return (0); #ifdef INET6 case 6: if (m->m_pkthdr.len < sizeof(struct ip6_hdr)) { KEYDEBUG(KEYDEBUG_IPSEC_DUMP, printf("%s: pkthdr len(%d) too small (v6), " "ignored\n", __func__, m->m_pkthdr.len)); - return EINVAL; + return (EINVAL); } error = ipsec6_setspidx_ipaddr(m, spidx); if (error) - return error; + return (error); ipsec6_get_ulp(m, spidx, needport); - return 0; + return (0); #endif default: KEYDEBUG(KEYDEBUG_IPSEC_DUMP, printf("%s: " "unknown IP version %u, ignored.\n", __func__, v)); - return EINVAL; + return (EINVAL); } } @@ -719,7 +720,7 @@ ipsec4_setspidx_ipaddr(struct mbuf *m, struct secp spidx->prefs = sizeof(struct in_addr) << 3; spidx->prefd = sizeof(struct in_addr) << 3; - return 0; + return (0); } #ifdef INET6 @@ -828,7 +829,7 @@ ipsec6_setspidx_ipaddr(m, spidx) } spidx->prefd = sizeof(struct in6_addr) << 3; - return 0; + return (0); } #endif @@ -855,14 +856,14 @@ ipsec_init_policy(so, pcb_sp) M_IPSEC_INPCB, M_NOWAIT|M_ZERO); if (new == NULL) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return ENOBUFS; + return (ENOBUFS); } new->priv = IPSEC_IS_PRIVILEGED_SO(so); if ((new->sp_in = KEY_NEWSP()) == NULL) { ipsec_delpcbpolicy(new); - return ENOBUFS; + return (ENOBUFS); } new->sp_in->state = IPSEC_SPSTATE_ALIVE; new->sp_in->policy = IPSEC_POLICY_ENTRUST; @@ -870,14 +871,14 @@ ipsec_init_policy(so, pcb_sp) if ((new->sp_out = KEY_NEWSP()) == NULL) { KEY_FREESP(&new->sp_in); ipsec_delpcbpolicy(new); - return ENOBUFS; + return (ENOBUFS); } new->sp_out->state = IPSEC_SPSTATE_ALIVE; new->sp_out->policy = IPSEC_POLICY_ENTRUST; *pcb_sp = new; - return 0; + return (0); } /* copy old ipsec policy into new */ @@ -892,18 +893,18 @@ ipsec_copy_policy(old, new) KEY_FREESP(&new->sp_in); new->sp_in = sp; } else - return ENOBUFS; + return (ENOBUFS); sp = ipsec_deepcopy_policy(old->sp_out); if (sp) { KEY_FREESP(&new->sp_out); new->sp_out = sp; } else - return ENOBUFS; + return (ENOBUFS); new->priv = old->priv; - return 0; + return (0); } struct ipsecrequest * @@ -914,7 +915,7 @@ ipsec_newisr(void) p = malloc(sizeof(struct ipsecrequest), M_IPSEC_SR, M_NOWAIT|M_ZERO); if (p != NULL) IPSECREQUEST_LOCK_INIT(p); - return p; + return (p); } void @@ -936,10 +937,10 @@ ipsec_deepcopy_policy(src) struct secpolicy *dst; if (src == NULL) - return NULL; + return (NULL); dst = KEY_NEWSP(); if (dst == NULL) - return NULL; + return (NULL); /* * deep-copy IPsec request chain. This is required since struct @@ -968,7 +969,7 @@ ipsec_deepcopy_policy(src) dst->policy = src->policy; /* do not touch the refcnt fields */ - return dst; + return (dst); fail: for (p = newchain; p; p = r) { @@ -976,7 +977,7 @@ fail: ipsec_delisr(p); p = NULL; } - return NULL; + return (NULL); } /* set policy and ipsec request if present. */ @@ -994,9 +995,9 @@ ipsec_set_policy(pcb_sp, optname, request, len, pr /* sanity check. */ if (pcb_sp == NULL || *pcb_sp == NULL || request == NULL) - return EINVAL; + return (EINVAL); if (len < sizeof(*xpl)) - return EINVAL; + return (EINVAL); xpl = (struct sadb_x_policy *)request; KEYDEBUG(KEYDEBUG_IPSEC_DUMP, @@ -1007,15 +1008,15 @@ ipsec_set_policy(pcb_sp, optname, request, len, pr /* ipsec_set_policy() accepts IPSEC, ENTRUST and BYPASS. */ if (xpl->sadb_x_policy_type == IPSEC_POLICY_DISCARD || xpl->sadb_x_policy_type == IPSEC_POLICY_NONE) - return EINVAL; + return (EINVAL); /* check privileged socket */ if (priv == 0 && xpl->sadb_x_policy_type == IPSEC_POLICY_BYPASS) - return EACCES; + return (EACCES); /* allocation new SP entry */ if ((newsp = key_msg2sp(xpl, len, &error)) == NULL) - return error; + return (error); newsp->state = IPSEC_SPSTATE_ALIVE; @@ -1026,7 +1027,7 @@ ipsec_set_policy(pcb_sp, optname, request, len, pr printf("%s: new policy\n", __func__); kdebug_secpolicy(newsp)); - return 0; + return (0); } static int @@ -1037,19 +1038,19 @@ ipsec_get_policy(pcb_sp, mp) /* sanity check. */ if (pcb_sp == NULL || mp == NULL) - return EINVAL; + return (EINVAL); *mp = key_sp2msg(pcb_sp); if (!*mp) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return ENOBUFS; + return (ENOBUFS); } (*mp)->m_type = MT_DATA; KEYDEBUG(KEYDEBUG_IPSEC_DUMP, printf("%s:\n", __func__); kdebug_mbuf(*mp)); - return 0; + return (0); } int @@ -1065,9 +1066,9 @@ ipsec4_set_policy(inp, optname, request, len, priv /* sanity check. */ if (inp == NULL || request == NULL) - return EINVAL; + return (EINVAL); if (len < sizeof(*xpl)) - return EINVAL; + return (EINVAL); xpl = (struct sadb_x_policy *)request; /* select direction */ @@ -1081,10 +1082,10 @@ ipsec4_set_policy(inp, optname, request, len, priv default: ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__, xpl->sadb_x_policy_dir)); - return EINVAL; + return (EINVAL); } - return ipsec_set_policy(pcb_sp, optname, request, len, priv); + return (ipsec_set_policy(pcb_sp, optname, request, len, priv)); } int @@ -1099,10 +1100,10 @@ ipsec4_get_policy(inp, request, len, mp) /* sanity check. */ if (inp == NULL || request == NULL || mp == NULL) - return EINVAL; + return (EINVAL); IPSEC_ASSERT(inp->inp_sp != NULL, ("null inp_sp")); if (len < sizeof(*xpl)) - return EINVAL; + return (EINVAL); xpl = (struct sadb_x_policy *)request; /* select direction */ @@ -1116,10 +1117,10 @@ ipsec4_get_policy(inp, request, len, mp) default: ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__, xpl->sadb_x_policy_dir)); - return EINVAL; + return (EINVAL); } - return ipsec_get_policy(pcb_sp, mp); + return (ipsec_get_policy(pcb_sp, mp)); } /* delete policy in PCB */ @@ -1130,7 +1131,7 @@ ipsec4_delete_pcbpolicy(inp) IPSEC_ASSERT(inp != NULL, ("null inp")); if (inp->inp_sp == NULL) - return 0; + return (0); if (inp->inp_sp->sp_in != NULL) KEY_FREESP(&inp->inp_sp->sp_in); @@ -1141,7 +1142,7 @@ ipsec4_delete_pcbpolicy(inp) ipsec_delpcbpolicy(inp->inp_sp); inp->inp_sp = NULL; - return 0; + return (0); } #ifdef INET6 @@ -1158,9 +1159,9 @@ ipsec6_set_policy(in6p, optname, request, len, pri /* sanity check. */ if (in6p == NULL || request == NULL) - return EINVAL; + return (EINVAL); if (len < sizeof(*xpl)) - return EINVAL; + return (EINVAL); xpl = (struct sadb_x_policy *)request; /* select direction */ @@ -1174,10 +1175,10 @@ ipsec6_set_policy(in6p, optname, request, len, pri default: ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__, xpl->sadb_x_policy_dir)); - return EINVAL; + return (EINVAL); } - return ipsec_set_policy(pcb_sp, optname, request, len, priv); + return (ipsec_set_policy(pcb_sp, optname, request, len, priv)); } int @@ -1192,10 +1193,10 @@ ipsec6_get_policy(in6p, request, len, mp) /* sanity check. */ if (in6p == NULL || request == NULL || mp == NULL) - return EINVAL; + return (EINVAL); IPSEC_ASSERT(in6p->in6p_sp != NULL, ("null in6p_sp")); if (len < sizeof(*xpl)) - return EINVAL; + return (EINVAL); xpl = (struct sadb_x_policy *)request; /* select direction */ @@ -1209,10 +1210,10 @@ ipsec6_get_policy(in6p, request, len, mp) default: ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__, xpl->sadb_x_policy_dir)); - return EINVAL; + return (EINVAL); } - return ipsec_get_policy(pcb_sp, mp); + return (ipsec_get_policy(pcb_sp, mp)); } int @@ -1222,7 +1223,7 @@ ipsec6_delete_pcbpolicy(in6p) IPSEC_ASSERT(in6p != NULL, ("null in6p")); if (in6p->in6p_sp == NULL) - return 0; + return (0); if (in6p->in6p_sp->sp_in != NULL) KEY_FREESP(&in6p->in6p_sp->sp_in); @@ -1233,7 +1234,7 @@ ipsec6_delete_pcbpolicy(in6p) ipsec_delpcbpolicy(in6p->in6p_sp); in6p->in6p_sp = NULL; - return 0; + return (0); } #endif @@ -1333,7 +1334,7 @@ ipsec_get_reqlevel(isr) panic("%s: Illegal IPsec level %u\n", __func__, isr->level); } - return level; + return (level); } /* @@ -1358,10 +1359,10 @@ ipsec_in_reject(struct secpolicy *sp, struct mbuf /* check policy */ switch (sp->policy) { case IPSEC_POLICY_DISCARD: - return 1; + return (1); case IPSEC_POLICY_BYPASS: case IPSEC_POLICY_NONE: - return 0; + return (0); } IPSEC_ASSERT(sp->policy == IPSEC_POLICY_IPSEC, @@ -1379,7 +1380,7 @@ ipsec_in_reject(struct secpolicy *sp, struct mbuf KEYDEBUG(KEYDEBUG_IPSEC_DUMP, printf("%s: ESP m_flags:%x\n", __func__, m->m_flags)); - return 1; + return (1); } if (!need_auth && @@ -1389,7 +1390,7 @@ ipsec_in_reject(struct secpolicy *sp, struct mbuf KEYDEBUG(KEYDEBUG_IPSEC_DUMP, printf("%s: ESP/AH m_flags:%x\n", __func__, m->m_flags)); - return 1; + return (1); } break; case IPPROTO_AH: @@ -1398,7 +1399,7 @@ ipsec_in_reject(struct secpolicy *sp, struct mbuf KEYDEBUG(KEYDEBUG_IPSEC_DUMP, printf("%s: AH m_flags:%x\n", __func__, m->m_flags)); - return 1; + return (1); } break; case IPPROTO_IPCOMP: @@ -1411,7 +1412,7 @@ ipsec_in_reject(struct secpolicy *sp, struct mbuf break; } } - return 0; /* valid */ + return (0); /* valid */ } /* @@ -1448,7 +1449,7 @@ ipsec4_in_reject(m, inp) result = 0; /* XXX should be panic ? * -> No, there may be error. */ } - return result; + return (result); } #ifdef INET6 @@ -1468,7 +1469,7 @@ ipsec6_in_reject(m, inp) /* sanity check */ if (m == NULL) - return 0; /* XXX should be panic ? */ + return (0); /* XXX should be panic ? */ /* get SP for this packet. * When we are called from ip_forward(), we call @@ -1487,7 +1488,7 @@ ipsec6_in_reject(m, inp) } else { result = 0; } - return result; + return (result); } #endif @@ -1509,7 +1510,7 @@ ipsec_hdrsiz(struct secpolicy *sp) case IPSEC_POLICY_DISCARD: case IPSEC_POLICY_BYPASS: case IPSEC_POLICY_NONE: - return 0; + return (0); } IPSEC_ASSERT(sp->policy == IPSEC_POLICY_IPSEC, @@ -1551,7 +1552,7 @@ ipsec_hdrsiz(struct secpolicy *sp) siz += clen; } - return siz; + return (siz); } /* This function is called from ip_forward() and ipsec4_hdrsize_tcp(). */ @@ -1586,7 +1587,7 @@ ipsec4_hdrsiz(m, dir, inp) } else { size = 0; /* XXX should be panic ? */ } - return size; + return (size); } #ifdef INET6 @@ -1615,13 +1616,13 @@ ipsec6_hdrsiz(m, dir, in6p) sp = ipsec_getpolicybysock(m, dir, in6p, &error); if (sp == NULL) - return 0; + return (0); size = ipsec_hdrsiz(sp); KEYDEBUG(KEYDEBUG_IPSEC_DATA, printf("%s: size:%lu.\n", __func__, (unsigned long)size)); KEY_FREESP(&sp); - return size; + return (size); } #endif /*INET6*/ @@ -1654,7 +1655,7 @@ ipsec_chkreplay(seq, sav) replay = sav->replay; if (replay->wsize == 0) - return 1; /* no need to check replay. */ + return (1); /* no need to check replay. */ /* constant */ frlast = replay->wsize - 1; @@ -1662,31 +1663,31 @@ ipsec_chkreplay(seq, sav) /* sequence number of 0 is invalid */ if (seq == 0) - return 0; + return (0); /* first time is always okay */ if (replay->count == 0) - return 1; + return (1); if (seq > replay->lastseq) { /* larger sequences are okay */ - return 1; + return (1); } else { /* seq is equal or less than lastseq. */ diff = replay->lastseq - seq; /* over range to check, i.e. too old or wrapped */ if (diff >= wsizeb) - return 0; + return (0); fr = frlast - diff / 8; /* this packet already seen ? */ if ((replay->bitmap)[fr] & (1 << (diff % 8))) - return 0; + return (0); /* out of order but good */ - return 1; + return (1); } } @@ -1722,7 +1723,7 @@ ipsec_updatereplay(seq, sav) /* sequence number of 0 is invalid */ if (seq == 0) - return 1; + return (1); /* first time */ if (replay->count == 0) { @@ -1756,13 +1757,13 @@ ipsec_updatereplay(seq, sav) /* over range to check, i.e. too old or wrapped */ if (diff >= wsizeb) - return 1; + return (1); fr = frlast - diff / 8; /* this packet already seen ? */ if ((replay->bitmap)[fr] & (1 << (diff % 8))) - return 1; + return (1); /* mark as seen */ (replay->bitmap)[fr] |= (1 << (diff % 8)); @@ -1778,7 +1779,7 @@ ok: /* don't increment, no more packets accepted */ if ((sav->flags & SADB_X_EXT_CYCSEQ) == 0) - return 1; + return (1); ipseclog((LOG_WARNING, "%s: replay counter made %d cycle. %s\n", __func__, replay->overflow, ipsec_logsastr(sav))); @@ -1786,7 +1787,7 @@ ok: replay->count++; - return 0; + return (0); } /* @@ -1837,16 +1838,16 @@ ipsec_address(union sockaddr_union* sa) switch (sa->sa.sa_family) { #ifdef INET case AF_INET: - return inet_ntoa4(sa->sin.sin_addr); + return (inet_ntoa4(sa->sin.sin_addr)); #endif /* INET */ #ifdef INET6 case AF_INET6: - return ip6_sprintf(&sa->sin6.sin6_addr); + return (ip6_sprintf(&sa->sin6.sin6_addr)); #endif /* INET6 */ default: - return "(unknown address family)"; + return ("(unknown address family)"); } } @@ -1873,7 +1874,7 @@ ipsec_logsastr(sav) snprintf(p, sizeof (buf) - (p - buf), "dst=%s)", ipsec_address(&saidx->dst)); - return buf; + return (buf); } void @@ -1936,6 +1937,6 @@ xform_init(struct secasvar *sav, int xftype) return 0; for (xsp = xforms; xsp; xsp = xsp->xf_next) if (xsp->xf_type == xftype) - return (*xsp->xf_init)(sav, xsp); + return ((*xsp->xf_init)(sav, xsp)); return EINVAL; } Index: sys/netipsec/keysock.c =================================================================== --- sys/netipsec/keysock.c (revision 194233) +++ sys/netipsec/keysock.c (working copy) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -124,7 +125,7 @@ key_output(struct mbuf *m, struct socket *so) end: if (m) m_freem(m); - return error; + return (error); } /* @@ -147,7 +148,7 @@ key_sendup0(rp, m, promisc) if (!m) { pfkeystat.in_nomem++; m_freem(m); - return ENOBUFS; + return (ENOBUFS); } m->m_pkthdr.len += sizeof(*pmsg); @@ -169,7 +170,7 @@ key_sendup0(rp, m, promisc) } else error = 0; sorwakeup(rp->rcb_socket); - return error; + return (error); } /* XXX this interface should be obsoleted. */ @@ -220,7 +221,7 @@ key_sendup(so, msg, len, target) } if (!n) { pfkeystat.in_nomem++; - return ENOBUFS; + return (ENOBUFS); } if (tlen >= MCLBYTES) { /*XXX better threshold? */ MCLGET(n, M_DONTWAIT); @@ -228,7 +229,7 @@ key_sendup(so, msg, len, target) m_free(n); m_freem(m); pfkeystat.in_nomem++; - return ENOBUFS; + return (ENOBUFS); } n->m_len = MCLBYTES; } @@ -254,7 +255,7 @@ key_sendup(so, msg, len, target) pfkeystat.in_bytes -= len; pfkeystat.in_msgtype[msg->sadb_msg_type]--; - return key_sendup_mbuf(so, m, target); + return (key_sendup_mbuf(so, m, target)); } /* so can be NULL if target != KEY_SENDUP_ONE */ @@ -282,7 +283,7 @@ key_sendup_mbuf(so, m, target) m = m_pullup(m, sizeof(struct sadb_msg)); if (m == NULL) { pfkeystat.in_nomem++; - return ENOBUFS; + return (ENOBUFS); } #else /* don't bother pulling it up just for stats */ @@ -344,12 +345,12 @@ key_sendup_mbuf(so, m, target) if ((n = m_copy(m, 0, (int)M_COPYALL)) == NULL) { m_freem(m); pfkeystat.in_nomem++; - return ENOBUFS; + return (ENOBUFS); } if ((error = key_sendup0(rp, n, 0)) != 0) { m_freem(m); - return error; + return (error); } n = NULL; @@ -362,7 +363,7 @@ key_sendup_mbuf(so, m, target) error = 0; m_freem(m); } - return error; + return (error); } /* @@ -376,7 +377,7 @@ key_abort(struct socket *so) s = splnet(); error = raw_usrreqs.pru_abort(so); splx(s); - return error; + return (error); } /* @@ -390,10 +391,10 @@ key_attach(struct socket *so, int proto, struct th int s, error; if (sotorawcb(so) != 0) - return EISCONN; /* XXX panic? */ + return (EISCONN); /* XXX panic? */ kp = (struct keycb *)malloc(sizeof *kp, M_PCB, M_WAITOK|M_ZERO); /* XXX */ if (kp == 0) - return ENOBUFS; + return (ENOBUFS); /* * The splnet() is necessary to block protocols from sending @@ -410,7 +411,7 @@ key_attach(struct socket *so, int proto, struct th free(kp, M_PCB); so->so_pcb = (caddr_t) 0; splx(s); - return error; + return (error); } kp->kp_promisc = kp->kp_registered = 0; @@ -424,7 +425,7 @@ key_attach(struct socket *so, int proto, struct th so->so_options |= SO_USELOOPBACK; splx(s); - return 0; + return (0); } /* @@ -438,7 +439,7 @@ key_bind(struct socket *so, struct sockaddr *nam, s = splnet(); error = raw_usrreqs.pru_bind(so, nam, td); /* xxx just EINVAL */ splx(s); - return error; + return (error); } /* @@ -452,7 +453,7 @@ key_connect(struct socket *so, struct sockaddr *na s = splnet(); error = raw_usrreqs.pru_connect(so, nam, td); /* XXX just EINVAL */ splx(s); - return error; + return (error); } /* @@ -476,7 +477,7 @@ key_detach(struct socket *so) } error = raw_usrreqs.pru_detach(so); splx(s); - return error; + return (error); } /* @@ -490,7 +491,7 @@ key_disconnect(struct socket *so) s = splnet(); error = raw_usrreqs.pru_disconnect(so); splx(s); - return error; + return (error); } /* @@ -504,7 +505,7 @@ key_peeraddr(struct socket *so, struct sockaddr ** s = splnet(); error = raw_usrreqs.pru_peeraddr(so, nam); splx(s); - return error; + return (error); } /* @@ -519,7 +520,7 @@ key_send(struct socket *so, int flags, struct mbuf s = splnet(); error = raw_usrreqs.pru_send(so, flags, m, nam, control, td); splx(s); - return error; + return (error); } /* @@ -533,7 +534,7 @@ key_shutdown(struct socket *so) s = splnet(); error = raw_usrreqs.pru_shutdown(so); splx(s); - return error; + return (error); } /* @@ -547,7 +548,7 @@ key_sockaddr(struct socket *so, struct sockaddr ** s = splnet(); error = raw_usrreqs.pru_sockaddr(so, nam); splx(s); - return error; + return (error); } struct pr_usrreqs key_usrreqs = { Index: sys/netipsec/ipsec_mbuf.c =================================================================== --- sys/netipsec/ipsec_mbuf.c (revision 194233) +++ sys/netipsec/ipsec_mbuf.c (working copy) @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -144,7 +145,7 @@ m_makespace(struct mbuf *m0, int skip, int hlen, i *off = skip; } m0->m_pkthdr.len += hlen; /* adjust packet length */ - return m; + return (m); } /* @@ -162,7 +163,7 @@ m_pad(struct mbuf *m, int n) if (n <= 0) { /* No stupid arguments. */ DPRINTF(("%s: pad length invalid (%d)\n", __func__, n)); m_freem(m); - return NULL; + return (NULL); } len = m->m_pkthdr.len; @@ -180,7 +181,7 @@ m_pad(struct mbuf *m, int n) m->m_pkthdr.len + m0->m_len - len)); m_freem(m); - return NULL; + return (NULL); } /* Check for zero-length trailing mbufs, and find the last one. */ @@ -192,7 +193,7 @@ m_pad(struct mbuf *m, int n) m->m_pkthdr.len + m1->m_next->m_len)); m_freem(m); - return NULL; + return (NULL); } m0 = m1->m_next; @@ -204,7 +205,7 @@ m_pad(struct mbuf *m, int n) if (m1 == 0) { m_freem(m0); DPRINTF(("%s: unable to get extra mbuf\n", __func__)); - return NULL; + return (NULL); } m0->m_next = m1; @@ -216,7 +217,7 @@ m_pad(struct mbuf *m, int n) m0->m_len += pad; m->m_pkthdr.len += pad; - return retval; + return (retval); } /* Index: sys/netipsec/xform_ipip.c =================================================================== --- sys/netipsec/xform_ipip.c (revision 194233) +++ sys/netipsec/xform_ipip.c (working copy) @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -121,7 +122,7 @@ ip4_input6(struct mbuf **m, int *offp, int proto) } #endif _ipip_input(*m, *offp, NULL); - return IPPROTO_DONE; + return (IPPROTO_DONE); } #endif /* INET6 */ @@ -599,7 +600,7 @@ nofamily: } #endif /* INET6 */ - return 0; + return (0); bad: if (m) m_freem(m); @@ -612,14 +613,14 @@ static int ipe4_init(struct secasvar *sav, struct xformsw *xsp) { sav->tdb_xform = xsp; - return 0; + return (0); } static int ipe4_zeroize(struct secasvar *sav) { sav->tdb_xform = NULL; - return 0; + return (0); } static int @@ -629,7 +630,7 @@ ipe4_input(struct mbuf *m, struct secasvar *sav, i printf("%s: should never be called\n", __func__); if (m) m_freem(m); - return EOPNOTSUPP; + return (EOPNOTSUPP); } static struct xformsw ipe4_xformsw = { Index: sys/netipsec/ipsec_input.c =================================================================== --- sys/netipsec/ipsec_input.c (revision 194233) +++ sys/netipsec/ipsec_input.c (working copy) @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -127,7 +128,7 @@ ipsec_common_input(struct mbuf *m, int skip, int p m_freem(m); IPSEC_ISTAT(sproto, espstat.esps_pdrops, ahstat.ahs_pdrops, ipcompstat.ipcomps_pdrops); - return EOPNOTSUPP; + return (EOPNOTSUPP); } if (m->m_pkthdr.len - skip < 2 * sizeof (u_int32_t)) { @@ -135,7 +136,7 @@ ipsec_common_input(struct mbuf *m, int skip, int p IPSEC_ISTAT(sproto, espstat.esps_hdrops, ahstat.ahs_hdrops, ipcompstat.ipcomps_hdrops); DPRINTF(("%s: packet too small\n", __func__)); - return EINVAL; + return (EINVAL); } /* Retrieve the SPI from the relevant IPsec header */ @@ -180,7 +181,7 @@ ipsec_common_input(struct mbuf *m, int skip, int p m_freem(m); IPSEC_ISTAT(sproto, espstat.esps_nopf, ahstat.ahs_nopf, ipcompstat.ipcomps_nopf); - return EPFNOSUPPORT; + return (EPFNOSUPPORT); } /* NB: only pass dst since key_allocsa follows RFC2401 */ @@ -192,7 +193,7 @@ ipsec_common_input(struct mbuf *m, int skip, int p IPSEC_ISTAT(sproto, espstat.esps_notdb, ahstat.ahs_notdb, ipcompstat.ipcomps_notdb); m_freem(m); - return ENOENT; + return (ENOENT); } if (sav->tdb_xform == NULL) { @@ -203,7 +204,7 @@ ipsec_common_input(struct mbuf *m, int skip, int p ipcompstat.ipcomps_noxform); KEY_FREESAV(&sav); m_freem(m); - return ENXIO; + return (ENXIO); } /* @@ -212,7 +213,7 @@ ipsec_common_input(struct mbuf *m, int skip, int p */ error = (*sav->tdb_xform->xf_input)(m, sav, skip, protoff); KEY_FREESAV(&sav); - return error; + return (error); } #ifdef INET @@ -230,8 +231,8 @@ ipsec4_common_input(struct mbuf *m, ...) nxt = va_arg(ap, int); va_end(ap); - return ipsec_common_input(m, off, offsetof(struct ip, ip_p), - AF_INET, nxt); + return (ipsec_common_input(m, off, offsetof(struct ip, ip_p), + AF_INET, nxt)); } void @@ -302,7 +303,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct seca IPSEC_ISTAT(sproto, espstat.esps_badkcr, ahstat.ahs_badkcr, ipcompstat.ipcomps_badkcr); KEY_FREESAV(&sav); - return EINVAL; + return (EINVAL); } if (skip != 0) { @@ -469,12 +470,12 @@ ipsec4_common_input_cb(struct mbuf *m, struct seca DPRINTF(("%s: queue full; proto %u packet dropped\n", __func__, sproto)); - return error; + return (error); } - return 0; + return (0); bad: m_freem(m); - return error; + return (error); } void @@ -495,7 +496,7 @@ ipsec6_common_input(struct mbuf **mp, int *offp, i if (*offp < sizeof(struct ip6_hdr)) { DPRINTF(("%s: bad offset %u\n", __func__, *offp)); - return IPPROTO_DONE; + return (IPPROTO_DONE); } else if (*offp == sizeof(struct ip6_hdr)) { protoff = offsetof(struct ip6_hdr, ip6_nxt); } else { @@ -523,12 +524,12 @@ ipsec6_common_input(struct mbuf **mp, int *offp, i ipcompstat.ipcomps_hdrops); m_freem(*mp); *mp = NULL; - return IPPROTO_DONE; + return (IPPROTO_DONE); } protoff += offsetof(struct ip6_ext, ip6e_nxt); } (void) ipsec_common_input(*mp, *offp, protoff, AF_INET6, proto); - return IPPROTO_DONE; + return (IPPROTO_DONE); } /* @@ -743,11 +744,11 @@ ipsec6_common_input_cb(struct mbuf *m, struct seca } nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &skip, nxt); } - return 0; + return (0); bad: if (m) m_freem(m); - return error; + return (error); } void Index: sys/netipsec/ipsec_output.c =================================================================== --- sys/netipsec/ipsec_output.c (revision 194233) +++ sys/netipsec/ipsec_output.c (working copy) @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -157,7 +158,7 @@ ipsec_process_done(struct mbuf *m, struct ipsecreq */ if (isr->next) { newipsecstat.ips_out_bundlesa++; - return ipsec4_process_packet(m, isr->next, 0, 0); + return (ipsec4_process_packet(m, isr->next, 0, 0)); } key_sa_recordxfer(sav, m); /* record data transfer */ @@ -174,7 +175,7 @@ ipsec_process_done(struct mbuf *m, struct ipsecreq ip->ip_len = ntohs(ip->ip_len); ip->ip_off = ntohs(ip->ip_off); - return ip_output(m, NULL, NULL, IP_RAWOUTPUT, NULL, NULL); + return (ip_output(m, NULL, NULL, IP_RAWOUTPUT, NULL, NULL)); #endif /* INET */ #ifdef INET6 case AF_INET6: @@ -182,7 +183,7 @@ ipsec_process_done(struct mbuf *m, struct ipsecreq * We don't need massage, IPv6 header fields are always in * net endian. */ - return ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL); + return (ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL)); #endif /* INET6 */ } panic("ipsec_process_done"); @@ -295,7 +296,7 @@ again: if (isr == NULL) { /*XXXstatistic??*/ *error = EINVAL; /*XXX*/ - return isr; + return (isr); } IPSECREQUEST_LOCK(isr); goto again; @@ -326,11 +327,11 @@ again: *error = EHOSTUNREACH; goto bad; } - return isr; + return (isr); bad: IPSEC_ASSERT(*error != 0, ("error return w/ no error code")); IPSECREQUEST_UNLOCK(isr); - return NULL; + return (NULL); #undef IPSEC_OSTAT } @@ -488,13 +489,13 @@ ipsec4_process_packet( error = ipsec_process_done(m, isr); } IPSECREQUEST_UNLOCK(isr); - return error; + return (error); bad: if (isr) IPSECREQUEST_UNLOCK(isr); if (m) m_freem(m); - return error; + return (error); } #endif @@ -517,7 +518,7 @@ ipsec6_splithdr(struct mbuf *m) MGETHDR(mh, M_DONTWAIT, MT_HEADER); if (!mh) { m_freem(m); - return NULL; + return (NULL); } M_MOVE_PKTHDR(mh, m); MH_ALIGN(mh, hlen); @@ -530,9 +531,9 @@ ipsec6_splithdr(struct mbuf *m) } else if (m->m_len < hlen) { m = m_pullup(m, hlen); if (!m) - return NULL; + return (NULL); } - return m; + return (m); } /* @@ -567,7 +568,7 @@ ipsec6_output_trans( if (isr->saidx.mode == IPSEC_MODE_TUNNEL) { /* the rest will be handled by ipsec6_output_tunnel() */ *tun = 1; /* need tunnel-mode processing */ - return 0; + return (0); } *tun = 0; @@ -592,9 +593,9 @@ ipsec6_output_trans( goto bad; } - return (*isr->sav->tdb_xform->xf_output)(m, isr, NULL, + return ((*isr->sav->tdb_xform->xf_output)(m, isr, NULL, sizeof (struct ip6_hdr), - offsetof(struct ip6_hdr, ip6_nxt)); + offsetof(struct ip6_hdr, ip6_nxt))); bad: if (m) m_freem(m); @@ -613,7 +614,7 @@ ipsec6_encapsulate(struct mbuf *m, struct secasvar if (sav->sah->saidx.src.sa.sa_family != AF_INET6 || sav->sah->saidx.dst.sa.sa_family != AF_INET6) { m_freem(m); - return EINVAL; + return (EINVAL); } IPSEC_ASSERT(m->m_len != sizeof (struct ip6_hdr), ("mbuf wrong size; len %u", m->m_len)); @@ -628,7 +629,7 @@ ipsec6_encapsulate(struct mbuf *m, struct secasvar MGET(n, M_DONTWAIT, MT_DATA); if (!n) { m_freem(m); - return ENOBUFS; + return (ENOBUFS); } n->m_len = sizeof(struct ip6_hdr); n->m_next = m->m_next; @@ -665,7 +666,7 @@ ipsec6_encapsulate(struct mbuf *m, struct secasvar /* XXX Should ip6_src be updated later ? */ - return 0; + return (0); } /* @@ -770,9 +771,9 @@ ipsec6_output_tunnel(struct ipsec_output_state *st goto bad; } ip6 = mtod(m, struct ip6_hdr *); - return (*isr->sav->tdb_xform->xf_output)(m, isr, NULL, + return ((*isr->sav->tdb_xform->xf_output)(m, isr, NULL, sizeof (struct ip6_hdr), - offsetof(struct ip6_hdr, ip6_nxt)); + offsetof(struct ip6_hdr, ip6_nxt))); bad: if (m) m_freem(m); Index: sys/netipsec/key.c =================================================================== --- sys/netipsec/key.c (revision 194233) +++ sys/netipsec/key.c (working copy) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -600,7 +601,7 @@ found: KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s return SP:%p (ID=%u) refcnt %u\n", __func__, sp, sp ? sp->id : 0, sp ? sp->refcnt : 0)); - return sp; + return (sp); } /* @@ -663,7 +664,7 @@ found: KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s return SP:%p (ID=%u) refcnt %u\n", __func__, sp, sp ? sp->id : 0, sp ? sp->refcnt : 0)); - return sp; + return (sp); } /* @@ -739,7 +740,7 @@ done: KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s return SP:%p (ID=%u) refcnt %u\n", __func__, sp, sp ? sp->id : 0, sp ? sp->refcnt : 0)); - return sp; + return (sp); } /* @@ -814,8 +815,8 @@ key_checkrequest(struct ipsecrequest *isr, const s if (isr->sav != NULL) { if (isr->sav->state != SADB_SASTATE_MATURE && isr->sav->state != SADB_SASTATE_DYING) - return EINVAL; - return 0; + return (EINVAL); + return (0); } /* there is no SA */ @@ -824,15 +825,15 @@ key_checkrequest(struct ipsecrequest *isr, const s /* XXX What should I do ? */ ipseclog((LOG_DEBUG, "%s: error %d returned from key_acquire\n", __func__, error)); - return error; + return (error); } if (level != IPSEC_LEVEL_REQUIRE) { /* XXX sigh, the interface to this routine is botched */ IPSEC_ASSERT(isr->sav == NULL, ("unexpected SA")); - return 0; + return (0); } else { - return ENOENT; + return (ENOENT); } } @@ -869,17 +870,17 @@ key_allocsa_policy(const struct secasindex *saidx) } SAHTREE_UNLOCK(); - return NULL; + return (NULL); found: /* search valid state */ for (stateidx = 0; stateidx < arraysize; stateidx++) { sav = key_do_allocsa_policy(sah, state_valid[stateidx]); if (sav != NULL) - return sav; + return (sav); } - return NULL; + return (NULL); #undef N } @@ -1013,7 +1014,7 @@ key_do_allocsa_policy(struct secashead *sah, u_int } SAHTREE_UNLOCK(); - return candidate; + return (candidate); } /* @@ -1097,7 +1098,7 @@ done: KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s return SA:%p; refcnt %u\n", __func__, sav, sav ? sav->refcnt : 0)); - return sav; + return (sav); } /* @@ -1273,7 +1274,7 @@ key_getsp(struct secpolicyindex *spidx) } SPTREE_UNLOCK(); - return sp; + return (sp); } /* @@ -1307,7 +1308,7 @@ key_getspbyid(u_int32_t id) done: SPTREE_UNLOCK(); - return sp; + return (sp); } struct secpolicy * @@ -1326,7 +1327,7 @@ key_newsp(const char* where, int tag) KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s from %s:%u return SP:%p\n", __func__, where, tag, newsp)); - return newsp; + return (newsp); } static void @@ -1355,12 +1356,12 @@ key_msg2sp(xpl0, len, error) if (len != PFKEY_EXTLEN(xpl0)) { ipseclog((LOG_DEBUG, "%s: Invalid msg length.\n", __func__)); *error = EINVAL; - return NULL; + return (NULL); } if ((newsp = KEY_NEWSP()) == NULL) { *error = ENOBUFS; - return NULL; + return (NULL); } newsp->spidx.dir = xpl0->sadb_x_policy_dir; @@ -1387,7 +1388,7 @@ key_msg2sp(xpl0, len, error) __func__)); KEY_FREESP(&newsp); *error = EINVAL; - return NULL; + return (NULL); } tlen = PFKEY_EXTLEN(xpl0) - sizeof(*xpl0); @@ -1400,7 +1401,7 @@ key_msg2sp(xpl0, len, error) "length.\n", __func__)); KEY_FREESP(&newsp); *error = EINVAL; - return NULL; + return (NULL); } /* allocate request buffer */ @@ -1411,7 +1412,7 @@ key_msg2sp(xpl0, len, error) "%s: No more memory.\n", __func__)); KEY_FREESP(&newsp); *error = ENOBUFS; - return NULL; + return (NULL); } /* set values */ @@ -1426,7 +1427,7 @@ key_msg2sp(xpl0, len, error) xisr->sadb_x_ipsecrequest_proto)); KEY_FREESP(&newsp); *error = EPROTONOSUPPORT; - return NULL; + return (NULL); } (*p_isr)->saidx.proto = xisr->sadb_x_ipsecrequest_proto; @@ -1441,7 +1442,7 @@ key_msg2sp(xpl0, len, error) xisr->sadb_x_ipsecrequest_mode)); KEY_FREESP(&newsp); *error = EINVAL; - return NULL; + return (NULL); } (*p_isr)->saidx.mode = xisr->sadb_x_ipsecrequest_mode; @@ -1472,7 +1473,7 @@ key_msg2sp(xpl0, len, error) if ((reqid = key_newreqid()) == 0) { KEY_FREESP(&newsp); *error = ENOBUFS; - return NULL; + return (NULL); } (*p_isr)->saidx.reqid = reqid; xisr->sadb_x_ipsecrequest_reqid = reqid; @@ -1489,7 +1490,7 @@ key_msg2sp(xpl0, len, error) xisr->sadb_x_ipsecrequest_level)); KEY_FREESP(&newsp); *error = EINVAL; - return NULL; + return (NULL); } (*p_isr)->level = xisr->sadb_x_ipsecrequest_level; @@ -1507,7 +1508,7 @@ key_msg2sp(xpl0, len, error) __func__)); KEY_FREESP(&newsp); *error = EINVAL; - return NULL; + return (NULL); } bcopy(paddr, &(*p_isr)->saidx.src, paddr->sa_len); @@ -1523,7 +1524,7 @@ key_msg2sp(xpl0, len, error) __func__)); KEY_FREESP(&newsp); *error = EINVAL; - return NULL; + return (NULL); } bcopy(paddr, &(*p_isr)->saidx.dst, paddr->sa_len); @@ -1541,7 +1542,7 @@ key_msg2sp(xpl0, len, error) __func__)); KEY_FREESP(&newsp); *error = EINVAL; - return NULL; + return (NULL); } xisr = (struct sadb_x_ipsecrequest *)((caddr_t)xisr @@ -1553,11 +1554,11 @@ key_msg2sp(xpl0, len, error) ipseclog((LOG_DEBUG, "%s: invalid policy type.\n", __func__)); KEY_FREESP(&newsp); *error = EINVAL; - return NULL; + return (NULL); } *error = 0; - return newsp; + return (newsp); } static u_int32_t @@ -1570,7 +1571,7 @@ key_newreqid() /* XXX should be unique check */ - return auto_reqid; + return (auto_reqid); } /* @@ -1593,7 +1594,7 @@ key_sp2msg(sp) if (!m || m->m_next) { /*XXX*/ if (m) m_freem(m); - return NULL; + return (NULL); } m->m_len = tlen; @@ -1635,7 +1636,7 @@ key_sp2msg(sp) } } - return m; + return (m); } /* m will not be freed nor modified */ @@ -1715,11 +1716,11 @@ key_gather_mbuf(m, mhp, ndeep, nitem, va_alist) result->m_pkthdr.len += n->m_len; } - return result; + return (result); fail: m_freem(result); - return NULL; + return (NULL); } /* @@ -1760,21 +1761,21 @@ key_spdadd(so, m, mhp) mhp->ext[SADB_EXT_ADDRESS_DST] == NULL || mhp->ext[SADB_X_EXT_POLICY] == NULL) { ipseclog((LOG_DEBUG, "key_spdadd: invalid message is passed.\n")); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) || mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address) || mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_EXT_LIFETIME_HARD] != NULL) { if (mhp->extlen[SADB_EXT_LIFETIME_HARD] < sizeof(struct sadb_lifetime)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } lft = (struct sadb_lifetime *)mhp->ext[SADB_EXT_LIFETIME_HARD]; } @@ -1801,7 +1802,7 @@ key_spdadd(so, m, mhp) default: ipseclog((LOG_DEBUG, "%s: Invalid SP direction.\n", __func__)); mhp->msg->sadb_msg_errno = EINVAL; - return 0; + return (0); } /* check policy */ @@ -1809,7 +1810,7 @@ key_spdadd(so, m, mhp) if (xpl0->sadb_x_policy_type == IPSEC_POLICY_ENTRUST || xpl0->sadb_x_policy_type == IPSEC_POLICY_BYPASS) { ipseclog((LOG_DEBUG, "%s: Invalid policy type.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* policy requests are mandatory when action is ipsec. */ @@ -1818,7 +1819,7 @@ key_spdadd(so, m, mhp) && mhp->extlen[SADB_X_EXT_POLICY] <= sizeof(*xpl0)) { ipseclog((LOG_DEBUG, "%s: some policy requests part required\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* @@ -1838,18 +1839,18 @@ key_spdadd(so, m, mhp) KEY_FREESP(&newsp); ipseclog((LOG_DEBUG, "%s: a SP entry exists already.\n", __func__)); - return key_senderror(so, m, EEXIST); + return (key_senderror(so, m, EEXIST)); } } /* allocation new SP entry */ if ((newsp = key_msg2sp(xpl0, PFKEY_EXTLEN(xpl0), &error)) == NULL) { - return key_senderror(so, m, error); + return (key_senderror(so, m, error)); } if ((newsp->id = key_getnewspid()) == 0) { _key_delsp(newsp); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } /* XXX boundary check against sa_len */ @@ -1865,12 +1866,12 @@ key_spdadd(so, m, mhp) if (((struct sockaddr *)(src0 + 1))->sa_family != ((struct sockaddr *)(dst0+ 1))->sa_family) { _key_delsp(newsp); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (((struct sockaddr *)(src0 + 1))->sa_len != ((struct sockaddr *)(dst0+ 1))->sa_len) { _key_delsp(newsp); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } #if 1 if (newsp->req && newsp->req->saidx.src.sa.sa_family) { @@ -1878,7 +1879,7 @@ key_spdadd(so, m, mhp) sa = (struct sockaddr *)(src0 + 1); if (sa->sa_family != newsp->req->saidx.src.sa.sa_family) { _key_delsp(newsp); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } } if (newsp->req && newsp->req->saidx.dst.sa.sa_family) { @@ -1886,7 +1887,7 @@ key_spdadd(so, m, mhp) sa = (struct sockaddr *)(dst0 + 1); if (sa->sa_family != newsp->req->saidx.dst.sa.sa_family) { _key_delsp(newsp); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } } #endif @@ -1927,12 +1928,12 @@ key_spdadd(so, m, mhp) SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST); } if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); if (n->m_len < sizeof(*newmsg)) { n = m_pullup(n, sizeof(*newmsg)); if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } newmsg = mtod(n, struct sadb_msg *); newmsg->sadb_msg_errno = 0; @@ -1943,17 +1944,17 @@ key_spdadd(so, m, mhp) sizeof(*xpl), &off); if (mpolicy == NULL) { /* n is already freed */ - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } xpl = (struct sadb_x_policy *)(mtod(mpolicy, caddr_t) + off); if (xpl->sadb_x_policy_exttype != SADB_X_EXT_POLICY) { m_freem(n); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } xpl->sadb_x_policy_id = newsp->id; m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ALL)); } } @@ -1983,10 +1984,10 @@ key_getnewspid() if (count == 0 || newid == 0) { ipseclog((LOG_DEBUG, "%s: to allocate policy id is failed.\n", __func__)); - return 0; + return (0); } - return newid; + return (newid); } /* @@ -2022,14 +2023,14 @@ key_spddelete(so, m, mhp) mhp->ext[SADB_X_EXT_POLICY] == NULL) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) || mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address) || mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } src0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_SRC]; @@ -2053,13 +2054,13 @@ key_spddelete(so, m, mhp) break; default: ipseclog((LOG_DEBUG, "%s: Invalid SP direction.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* Is there SP in SPD ? */ if ((sp = key_getsp(&spidx)) == NULL) { ipseclog((LOG_DEBUG, "%s: no SP found.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* save policy id to buffer to be returned. */ @@ -2076,14 +2077,14 @@ key_spddelete(so, m, mhp) n = key_gather_mbuf(m, mhp, 1, 4, SADB_EXT_RESERVED, SADB_X_EXT_POLICY, SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST); if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); newmsg = mtod(n, struct sadb_msg *); newmsg->sadb_msg_errno = 0; newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len); m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ALL)); } } @@ -2116,7 +2117,7 @@ key_spddelete2(so, m, mhp) if (mhp->ext[SADB_X_EXT_POLICY] == NULL || mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } id = ((struct sadb_x_policy *)mhp->ext[SADB_X_EXT_POLICY])->sadb_x_policy_id; @@ -2124,7 +2125,7 @@ key_spddelete2(so, m, mhp) /* Is there SP in SPD ? */ if ((sp = key_getspbyid(id)) == NULL) { ipseclog((LOG_DEBUG, "%s: no SP found id:%u.\n", __func__, id)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } sp->state = IPSEC_SPSTATE_DEAD; @@ -2139,7 +2140,7 @@ key_spddelete2(so, m, mhp) len = PFKEY_ALIGN8(sizeof(struct sadb_msg)); if (len > MCLBYTES) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); MGETHDR(n, M_DONTWAIT, MT_DATA); if (n && len > MHLEN) { MCLGET(n, M_DONTWAIT); @@ -2149,7 +2150,7 @@ key_spddelete2(so, m, mhp) } } if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); n->m_len = len; n->m_next = NULL; @@ -2165,7 +2166,7 @@ key_spddelete2(so, m, mhp) mhp->extlen[SADB_X_EXT_POLICY], M_DONTWAIT); if (!n->m_next) { m_freem(n); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } n->m_pkthdr.len = 0; @@ -2177,7 +2178,7 @@ key_spddelete2(so, m, mhp) newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len); m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ALL)); } } @@ -2212,7 +2213,7 @@ key_spdget(so, m, mhp) mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } id = ((struct sadb_x_policy *)mhp->ext[SADB_X_EXT_POLICY])->sadb_x_policy_id; @@ -2220,15 +2221,15 @@ key_spdget(so, m, mhp) /* Is there SP in SPD ? */ if ((sp = key_getspbyid(id)) == NULL) { ipseclog((LOG_DEBUG, "%s: no SP found id:%u.\n", __func__, id)); - return key_senderror(so, m, ENOENT); + return (key_senderror(so, m, ENOENT)); } n = key_setdumpsp(sp, SADB_X_SPDGET, 0, mhp->msg->sadb_msg_pid); if (n != NULL) { m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ONE); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ONE)); } else - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } /* @@ -2267,20 +2268,20 @@ key_spdacquire(sp) } else { /* increment counter and do nothing. */ newspacq->count++; - return 0; + return (0); } SPACQ_UNLOCK(); } else { /* make new entry for blocking to send SADB_ACQUIRE. */ newspacq = key_newspacq(&sp->spidx); if (newspacq == NULL) - return ENOBUFS; + return (ENOBUFS); } /* create new sadb_msg to reply. */ m = key_setsadbmsg(SADB_X_SPDACQUIRE, 0, 0, 0, 0, 0); if (!m) - return ENOBUFS; + return (ENOBUFS); result = m; @@ -2291,7 +2292,7 @@ key_spdacquire(sp) mtod(result, struct sadb_msg *)->sadb_msg_len = PFKEY_UNIT64(result->m_pkthdr.len); - return key_sendup_mbuf(NULL, m, KEY_SENDUP_REGISTERED); + return (key_sendup_mbuf(NULL, m, KEY_SENDUP_REGISTERED)); } /* @@ -2322,7 +2323,7 @@ key_spdflush(so, m, mhp) IPSEC_ASSERT(mhp->msg != NULL, ("null msg")); if (m->m_len != PFKEY_ALIGN8(sizeof(struct sadb_msg))) - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); for (dir = 0; dir < IPSEC_DIR_MAX; dir++) { SPTREE_LOCK(); @@ -2333,7 +2334,7 @@ key_spdflush(so, m, mhp) if (sizeof(struct sadb_msg) > m->m_len + M_TRAILINGSPACE(m)) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } if (m->m_next) @@ -2344,7 +2345,7 @@ key_spdflush(so, m, mhp) newmsg->sadb_msg_errno = 0; newmsg->sadb_msg_len = PFKEY_UNIT64(m->m_pkthdr.len); - return key_sendup_mbuf(so, m, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, m, KEY_SENDUP_ALL)); } /* @@ -2383,7 +2384,7 @@ key_spddump(so, m, mhp) } if (cnt == 0) - return key_senderror(so, m, ENOENT); + return (key_senderror(so, m, ENOENT)); for (dir = 0; dir < IPSEC_DIR_MAX; dir++) { LIST_FOREACH(sp, &sptree[dir], chain) { @@ -2397,7 +2398,7 @@ key_spddump(so, m, mhp) } m_freem(m); - return 0; + return (0); } static struct mbuf * @@ -2448,11 +2449,11 @@ key_setdumpsp(sp, type, seq, pid) mtod(result, struct sadb_msg *)->sadb_msg_len = PFKEY_UNIT64(result->m_pkthdr.len); - return result; + return (result); fail: m_freem(result); - return NULL; + return (NULL); } /* @@ -2468,7 +2469,7 @@ key_getspreqmsglen(sp) /* if is the policy for ipsec ? */ if (sp->policy != IPSEC_POLICY_IPSEC) - return tlen; + return (tlen); /* get length of ipsec requests */ { @@ -2484,7 +2485,7 @@ key_getspreqmsglen(sp) } } - return tlen; + return (tlen); } /* @@ -2591,12 +2592,12 @@ key_spdexpire(sp) mtod(result, struct sadb_msg *)->sadb_msg_len = PFKEY_UNIT64(result->m_pkthdr.len); - return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED); + return (key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED)); fail: if (result) m_freem(result); - return error; + return (error); } /* %%% SAD management */ @@ -2627,7 +2628,7 @@ key_newsah(saidx) LIST_INSERT_HEAD(&sahtree, newsah, chain); SAHTREE_UNLOCK(); } - return(newsah); + return (newsah); } /* @@ -2773,7 +2774,7 @@ done: printf("DP %s from %s:%u return SP:%p\n", __func__, where, tag, newsav)); - return newsav; + return (newsav); } /* @@ -2866,7 +2867,7 @@ key_getsah(saidx) } SAHTREE_UNLOCK(); - return sah; + return (sah); } /* @@ -2888,7 +2889,7 @@ key_checkspidup(saidx, spi) if (saidx->src.sa.sa_family != saidx->dst.sa.sa_family) { ipseclog((LOG_DEBUG, "%s: address family mismatched.\n", __func__)); - return NULL; + return (NULL); } sav = NULL; @@ -2903,7 +2904,7 @@ key_checkspidup(saidx, spi) } SAHTREE_UNLOCK(); - return sav; + return (sav); } /* @@ -2939,11 +2940,11 @@ key_getsavbyspi(sah, spi) } if (sav->spi == spi) - return sav; + return (sav); } } - return NULL; + return (NULL); } /* @@ -3174,13 +3175,13 @@ key_setsaval(sav, m, mhp) } } - return 0; + return (0); fail: /* initialization */ key_cleansav(sav); - return error; + return (error); } /* @@ -3205,7 +3206,7 @@ key_mature(struct secasvar *sav) if (ntohl(sav->spi) <= 255) { ipseclog((LOG_DEBUG, "%s: illegal range of SPI %u.\n", __func__, (u_int32_t)ntohl(sav->spi))); - return EINVAL; + return (EINVAL); } break; } @@ -3218,7 +3219,7 @@ key_mature(struct secasvar *sav) (SADB_X_EXT_OLD|SADB_X_EXT_DERIV)) { ipseclog((LOG_DEBUG, "%s: invalid flag (derived) " "given to old-esp.\n", __func__)); - return EINVAL; + return (EINVAL); } error = xform_init(sav, XF_ESP); break; @@ -3227,12 +3228,12 @@ key_mature(struct secasvar *sav) if (sav->flags & SADB_X_EXT_DERIV) { ipseclog((LOG_DEBUG, "%s: invalid flag (derived) " "given to AH SA.\n", __func__)); - return EINVAL; + return (EINVAL); } if (sav->alg_enc != SADB_EALG_NONE) { ipseclog((LOG_DEBUG, "%s: protocol and algorithm " "mismated.\n", __func__)); - return(EINVAL); + return (EINVAL); } error = xform_init(sav, XF_AH); break; @@ -3240,13 +3241,13 @@ key_mature(struct secasvar *sav) if (sav->alg_auth != SADB_AALG_NONE) { ipseclog((LOG_DEBUG, "%s: protocol and algorithm " "mismated.\n", __func__)); - return(EINVAL); + return (EINVAL); } if ((sav->flags & SADB_X_EXT_RAWCPI) == 0 && ntohl(sav->spi) >= 0x10000) { ipseclog((LOG_DEBUG, "%s: invalid cpi for IPComp.\n", __func__)); - return(EINVAL); + return (EINVAL); } error = xform_init(sav, XF_IPCOMP); break; @@ -3254,7 +3255,7 @@ key_mature(struct secasvar *sav) if (sav->alg_enc != SADB_EALG_NONE) { ipseclog((LOG_DEBUG, "%s: protocol and algorithm " "mismated.\n", __func__)); - return(EINVAL); + return (EINVAL); } error = xform_init(sav, XF_TCPSIGNATURE); break; @@ -3412,12 +3413,12 @@ key_setdumpsa(sav, type, satype, seq, pid) mtod(result, struct sadb_msg *)->sadb_msg_len = PFKEY_UNIT64(result->m_pkthdr.len); - return result; + return (result); fail: m_freem(result); m_freem(tres); - return NULL; + return (NULL); } /* @@ -3437,7 +3438,7 @@ key_setsadbmsg(type, tlen, satype, seq, pid, reser len = PFKEY_ALIGN8(sizeof(struct sadb_msg)); if (len > MCLBYTES) - return NULL; + return (NULL); MGETHDR(m, M_DONTWAIT, MT_DATA); if (m && len > MHLEN) { MCLGET(m, M_DONTWAIT); @@ -3447,7 +3448,7 @@ key_setsadbmsg(type, tlen, satype, seq, pid, reser } } if (!m) - return NULL; + return (NULL); m->m_pkthdr.len = m->m_len = len; m->m_next = NULL; @@ -3463,7 +3464,7 @@ key_setsadbmsg(type, tlen, satype, seq, pid, reser p->sadb_msg_seq = seq; p->sadb_msg_pid = (u_int32_t)pid; - return m; + return (m); } /* @@ -3482,7 +3483,7 @@ key_setsadbsa(sav) if (!m || m->m_next) { /*XXX*/ if (m) m_freem(m); - return NULL; + return (NULL); } p = mtod(m, struct sadb_sa *); @@ -3497,7 +3498,7 @@ key_setsadbsa(sav) p->sadb_sa_encrypt = sav->alg_enc; p->sadb_sa_flags = sav->flags; - return m; + return (m); } /* @@ -3520,7 +3521,7 @@ key_setsadbaddr(exttype, saddr, prefixlen, ul_prot if (!m || m->m_next) { /*XXX*/ if (m) m_freem(m); - return NULL; + return (NULL); } p = mtod(m, struct sadb_address *); @@ -3548,7 +3549,7 @@ key_setsadbaddr(exttype, saddr, prefixlen, ul_prot mtod(m, caddr_t) + PFKEY_ALIGN8(sizeof(struct sadb_address)), saddr->sa_len); - return m; + return (m); } /* @@ -3568,7 +3569,7 @@ key_setsadbxsa2(mode, seq, reqid) if (!m || m->m_next) { /*XXX*/ if (m) m_freem(m); - return NULL; + return (NULL); } p = mtod(m, struct sadb_x_sa2 *); @@ -3582,7 +3583,7 @@ key_setsadbxsa2(mode, seq, reqid) p->sadb_x_sa2_sequence = seq; p->sadb_x_sa2_reqid = reqid; - return m; + return (m); } /* @@ -3603,7 +3604,7 @@ key_setsadbxpolicy(type, dir, id) if (!m || m->m_next) { /*XXX*/ if (m) m_freem(m); - return NULL; + return (NULL); } p = mtod(m, struct sadb_x_policy *); @@ -3615,7 +3616,7 @@ key_setsadbxpolicy(type, dir, id) p->sadb_x_policy_dir = dir; p->sadb_x_policy_id = id; - return m; + return (m); } /* %%% utilities */ @@ -3633,7 +3634,7 @@ key_dup(const void *src, u_int len, struct malloc_ ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); } else bcopy(src, copy, len); - return copy; + return (copy); } /* compare my own address @@ -3662,18 +3663,18 @@ key_ismyaddr(sa) sin->sin_len == ia->ia_addr.sin_len && sin->sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr) { - return 1; + return (1); } } break; #endif #ifdef INET6 case AF_INET6: - return key_ismyaddr6((struct sockaddr_in6 *)sa); + return (key_ismyaddr6((struct sockaddr_in6 *)sa)); #endif } - return 0; + return (0); } #ifdef INET6 @@ -3695,7 +3696,7 @@ key_ismyaddr6(sin6) for (ia = in6_ifaddr; ia; ia = ia->ia_next) { if (key_sockaddrcmp((struct sockaddr *)&sin6, (struct sockaddr *)&ia->ia_addr, 0) == 0) - return 1; + return (1); /* * XXX Multicast @@ -3706,14 +3707,14 @@ key_ismyaddr6(sin6) in6m = NULL; IN6_LOOKUP_MULTI(sin6->sin6_addr, ia->ia_ifp, in6m); if (in6m) - return 1; + return (1); } /* loopback, just for safety */ if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)) - return 1; + return (1); - return 0; + return (0); } #endif /*INET6*/ @@ -3737,22 +3738,22 @@ key_cmpsaidx( { /* sanity */ if (saidx0 == NULL && saidx1 == NULL) - return 1; + return (1); if (saidx0 == NULL || saidx1 == NULL) - return 0; + return (0); if (saidx0->proto != saidx1->proto) - return 0; + return (0); if (flag == CMP_EXACTLY) { if (saidx0->mode != saidx1->mode) - return 0; + return (0); if (saidx0->reqid != saidx1->reqid) - return 0; + return (0); if (bcmp(&saidx0->src, &saidx1->src, saidx0->src.sa.sa_len) != 0 || bcmp(&saidx0->dst, &saidx1->dst, saidx0->dst.sa.sa_len) != 0) - return 0; + return (0); } else { /* CMP_MODE_REQID, CMP_REQID, CMP_HEAD */ @@ -3763,24 +3764,24 @@ key_cmpsaidx( * The result must be of same reqid in this case. */ if (saidx1->reqid != 0 && saidx0->reqid != saidx1->reqid) - return 0; + return (0); } if (flag == CMP_MODE_REQID) { if (saidx0->mode != IPSEC_MODE_ANY && saidx0->mode != saidx1->mode) - return 0; + return (0); } if (key_sockaddrcmp(&saidx0->src.sa, &saidx1->src.sa, 0) != 0) { - return 0; + return (0); } if (key_sockaddrcmp(&saidx0->dst.sa, &saidx1->dst.sa, 0) != 0) { - return 0; + return (0); } } - return 1; + return (1); } /* @@ -3799,18 +3800,18 @@ key_cmpspidx_exactly( { /* sanity */ if (spidx0 == NULL && spidx1 == NULL) - return 1; + return (1); if (spidx0 == NULL || spidx1 == NULL) - return 0; + return (0); if (spidx0->prefs != spidx1->prefs || spidx0->prefd != spidx1->prefd || spidx0->ul_proto != spidx1->ul_proto) - return 0; + return (0); - return key_sockaddrcmp(&spidx0->src.sa, &spidx1->src.sa, 1) == 0 && - key_sockaddrcmp(&spidx0->dst.sa, &spidx1->dst.sa, 1) == 0; + return (key_sockaddrcmp(&spidx0->src.sa, &spidx1->src.sa, 1) == 0 && + key_sockaddrcmp(&spidx0->dst.sa, &spidx1->dst.sa, 1) == 0); } /* @@ -3829,35 +3830,35 @@ key_cmpspidx_withmask( { /* sanity */ if (spidx0 == NULL && spidx1 == NULL) - return 1; + return (1); if (spidx0 == NULL || spidx1 == NULL) - return 0; + return (0); if (spidx0->src.sa.sa_family != spidx1->src.sa.sa_family || spidx0->dst.sa.sa_family != spidx1->dst.sa.sa_family || spidx0->src.sa.sa_len != spidx1->src.sa.sa_len || spidx0->dst.sa.sa_len != spidx1->dst.sa.sa_len) - return 0; + return (0); /* if spidx.ul_proto == IPSEC_ULPROTO_ANY, ignore. */ if (spidx0->ul_proto != (u_int16_t)IPSEC_ULPROTO_ANY && spidx0->ul_proto != spidx1->ul_proto) - return 0; + return (0); switch (spidx0->src.sa.sa_family) { case AF_INET: if (spidx0->src.sin.sin_port != IPSEC_PORT_ANY && spidx0->src.sin.sin_port != spidx1->src.sin.sin_port) - return 0; + return (0); if (!key_bbcmp(&spidx0->src.sin.sin_addr, &spidx1->src.sin.sin_addr, spidx0->prefs)) - return 0; + return (0); break; case AF_INET6: if (spidx0->src.sin6.sin6_port != IPSEC_PORT_ANY && spidx0->src.sin6.sin6_port != spidx1->src.sin6.sin6_port) - return 0; + return (0); /* * scope_id check. if sin6_scope_id is 0, we regard it * as a wildcard scope, which matches any scope zone ID. @@ -3865,15 +3866,15 @@ key_cmpspidx_withmask( if (spidx0->src.sin6.sin6_scope_id && spidx1->src.sin6.sin6_scope_id && spidx0->src.sin6.sin6_scope_id != spidx1->src.sin6.sin6_scope_id) - return 0; + return (0); if (!key_bbcmp(&spidx0->src.sin6.sin6_addr, &spidx1->src.sin6.sin6_addr, spidx0->prefs)) - return 0; + return (0); break; default: /* XXX */ if (bcmp(&spidx0->src, &spidx1->src, spidx0->src.sa.sa_len) != 0) - return 0; + return (0); break; } @@ -3881,15 +3882,15 @@ key_cmpspidx_withmask( case AF_INET: if (spidx0->dst.sin.sin_port != IPSEC_PORT_ANY && spidx0->dst.sin.sin_port != spidx1->dst.sin.sin_port) - return 0; + return (0); if (!key_bbcmp(&spidx0->dst.sin.sin_addr, &spidx1->dst.sin.sin_addr, spidx0->prefd)) - return 0; + return (0); break; case AF_INET6: if (spidx0->dst.sin6.sin6_port != IPSEC_PORT_ANY && spidx0->dst.sin6.sin6_port != spidx1->dst.sin6.sin6_port) - return 0; + return (0); /* * scope_id check. if sin6_scope_id is 0, we regard it * as a wildcard scope, which matches any scope zone ID. @@ -3897,21 +3898,21 @@ key_cmpspidx_withmask( if (spidx0->dst.sin6.sin6_scope_id && spidx1->dst.sin6.sin6_scope_id && spidx0->dst.sin6.sin6_scope_id != spidx1->dst.sin6.sin6_scope_id) - return 0; + return (0); if (!key_bbcmp(&spidx0->dst.sin6.sin6_addr, &spidx1->dst.sin6.sin6_addr, spidx0->prefd)) - return 0; + return (0); break; default: /* XXX */ if (bcmp(&spidx0->dst, &spidx1->dst, spidx0->dst.sa.sa_len) != 0) - return 0; + return (0); break; } /* XXX Do we check other field ? e.g. flowinfo */ - return 1; + return (1); } /* returns 0 on match */ @@ -3930,42 +3931,42 @@ key_sockaddrcmp( #endif #define satosin6(s) ((const struct sockaddr_in6 *)s) if (sa1->sa_family != sa2->sa_family || sa1->sa_len != sa2->sa_len) - return 1; + return (1); switch (sa1->sa_family) { case AF_INET: if (sa1->sa_len != sizeof(struct sockaddr_in)) - return 1; + return (1); if (satosin(sa1)->sin_addr.s_addr != satosin(sa2)->sin_addr.s_addr) { - return 1; + return (1); } if (port && satosin(sa1)->sin_port != satosin(sa2)->sin_port) - return 1; + return (1); break; case AF_INET6: if (sa1->sa_len != sizeof(struct sockaddr_in6)) - return 1; /*EINVAL*/ + return (1); /*EINVAL*/ if (satosin6(sa1)->sin6_scope_id != satosin6(sa2)->sin6_scope_id) { - return 1; + return (1); } if (!IN6_ARE_ADDR_EQUAL(&satosin6(sa1)->sin6_addr, &satosin6(sa2)->sin6_addr)) { - return 1; + return (1); } if (port && satosin6(sa1)->sin6_port != satosin6(sa2)->sin6_port) { - return 1; + return (1); } break; default: if (bcmp(sa1, sa2, sa1->sa_len) != 0) - return 1; + return (1); break; } - return 0; + return (0); #undef satosin #undef satosin6 } @@ -3995,16 +3996,16 @@ key_bbcmp(const void *a1, const void *a2, u_int bi while (bits >= 8) { if (*p1++ != *p2++) - return 0; + return (0); bits -= 8; } if (bits > 0) { u_int8_t mask = ~((1<<(8-bits))-1); if ((*p1 & mask) != (*p2 & mask)) - return 0; + return (0); } - return 1; /* Match! */ + return (1); /* Match! */ } static void @@ -4246,7 +4247,7 @@ key_random() u_long value; key_randomfill(&value, sizeof(value)); - return value; + return (value); } void @@ -4287,17 +4288,17 @@ key_satype2proto(satype) { switch (satype) { case SADB_SATYPE_UNSPEC: - return IPSEC_PROTO_ANY; + return (IPSEC_PROTO_ANY); case SADB_SATYPE_AH: - return IPPROTO_AH; + return (IPPROTO_AH); case SADB_SATYPE_ESP: - return IPPROTO_ESP; + return (IPPROTO_ESP); case SADB_X_SATYPE_IPCOMP: - return IPPROTO_IPCOMP; + return (IPPROTO_IPCOMP); case SADB_X_SATYPE_TCPSIGNATURE: - return IPPROTO_TCP; + return (IPPROTO_TCP); default: - return 0; + return (0); } /* NOTREACHED */ } @@ -4313,15 +4314,15 @@ key_proto2satype(proto) { switch (proto) { case IPPROTO_AH: - return SADB_SATYPE_AH; + return (SADB_SATYPE_AH); case IPPROTO_ESP: - return SADB_SATYPE_ESP; + return (SADB_SATYPE_ESP); case IPPROTO_IPCOMP: - return SADB_X_SATYPE_IPCOMP; + return (SADB_X_SATYPE_IPCOMP); case IPPROTO_TCP: - return SADB_X_SATYPE_TCPSIGNATURE; + return (SADB_X_SATYPE_TCPSIGNATURE); default: - return 0; + return (0); } /* NOTREACHED */ } @@ -4364,13 +4365,13 @@ key_getspi(so, m, mhp) mhp->ext[SADB_EXT_ADDRESS_DST] == NULL) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) || mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_X_EXT_SA2] != NULL) { mode = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_mode; @@ -4387,7 +4388,7 @@ key_getspi(so, m, mhp) if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) { ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* make sure if port number is zero. */ @@ -4395,13 +4396,13 @@ key_getspi(so, m, mhp) case AF_INET: if (((struct sockaddr *)(src0 + 1))->sa_len != sizeof(struct sockaddr_in)) - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); ((struct sockaddr_in *)(src0 + 1))->sin_port = 0; break; case AF_INET6: if (((struct sockaddr *)(src0 + 1))->sa_len != sizeof(struct sockaddr_in6)) - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); ((struct sockaddr_in6 *)(src0 + 1))->sin6_port = 0; break; default: @@ -4411,13 +4412,13 @@ key_getspi(so, m, mhp) case AF_INET: if (((struct sockaddr *)(dst0 + 1))->sa_len != sizeof(struct sockaddr_in)) - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); ((struct sockaddr_in *)(dst0 + 1))->sin_port = 0; break; case AF_INET6: if (((struct sockaddr *)(dst0 + 1))->sa_len != sizeof(struct sockaddr_in6)) - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); ((struct sockaddr_in6 *)(dst0 + 1))->sin6_port = 0; break; default: @@ -4431,14 +4432,14 @@ key_getspi(so, m, mhp) spi = key_do_getnewspi((struct sadb_spirange *)mhp->ext[SADB_EXT_SPIRANGE], &saidx); if (spi == 0) - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); /* get a SA index */ if ((newsah = key_getsah(&saidx)) == NULL) { /* create a new SA index */ if ((newsah = key_newsah(&saidx)) == NULL) { ipseclog((LOG_DEBUG, "%s: No more memory.\n",__func__)); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } } @@ -4447,7 +4448,7 @@ key_getspi(so, m, mhp) newsav = KEY_NEWSAV(m, mhp, newsah, &error); if (newsav == NULL) { /* XXX don't free new SA index allocated in above. */ - return key_senderror(so, m, error); + return (key_senderror(so, m, error)); } /* set spi */ @@ -4473,7 +4474,7 @@ key_getspi(so, m, mhp) len = PFKEY_ALIGN8(sizeof(struct sadb_msg)) + PFKEY_ALIGN8(sizeof(struct sadb_sa)); if (len > MCLBYTES) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); MGETHDR(n, M_DONTWAIT, MT_DATA); if (len > MHLEN) { @@ -4484,7 +4485,7 @@ key_getspi(so, m, mhp) } } if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); n->m_len = len; n->m_next = NULL; @@ -4506,13 +4507,13 @@ key_getspi(so, m, mhp) SADB_EXT_ADDRESS_DST); if (!n->m_next) { m_freem(n); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } if (n->m_len < sizeof(struct sadb_msg)) { n = m_pullup(n, sizeof(struct sadb_msg)); if (n == NULL) - return key_sendup_mbuf(so, m, KEY_SENDUP_ONE); + return (key_sendup_mbuf(so, m, KEY_SENDUP_ONE)); } n->m_pkthdr.len = 0; @@ -4525,7 +4526,7 @@ key_getspi(so, m, mhp) newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len); m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ONE); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ONE)); } } @@ -4569,7 +4570,7 @@ key_do_getnewspi(spirange, saidx) if (key_checkspidup(saidx, min) != NULL) { ipseclog((LOG_DEBUG, "%s: SPI %u exists already.\n", __func__, min)); - return 0; + return (0); } count--; /* taking one cost. */ @@ -4592,7 +4593,7 @@ key_do_getnewspi(spirange, saidx) if (count == 0 || newspi == 0) { ipseclog((LOG_DEBUG, "%s: to allocate spi is failed.\n", __func__)); - return 0; + return (0); } } @@ -4600,7 +4601,7 @@ key_do_getnewspi(spirange, saidx) keystat.getspi_count = (keystat.getspi_count + key_spi_trycnt - count) / 2; - return newspi; + return (newspi); } /* @@ -4641,7 +4642,7 @@ key_update(so, m, mhp) if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) { ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_EXT_SA] == NULL || @@ -4657,14 +4658,14 @@ key_update(so, m, mhp) mhp->ext[SADB_EXT_LIFETIME_SOFT] != NULL)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->extlen[SADB_EXT_SA] < sizeof(struct sadb_sa) || mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) || mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_X_EXT_SA2] != NULL) { mode = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_mode; @@ -4685,14 +4686,14 @@ key_update(so, m, mhp) /* get a SA header */ if ((sah = key_getsah(&saidx)) == NULL) { ipseclog((LOG_DEBUG, "%s: no SA index found.\n", __func__)); - return key_senderror(so, m, ENOENT); + return (key_senderror(so, m, ENOENT)); } /* set spidx if there */ /* XXX rewrite */ error = key_setident(sah, m, mhp); if (error) - return key_senderror(so, m, error); + return (key_senderror(so, m, error)); /* find a SA with sequence number. */ #ifdef IPSEC_DOSEQCHECK @@ -4700,7 +4701,7 @@ key_update(so, m, mhp) && (sav = key_getsavbyseq(sah, mhp->msg->sadb_msg_seq)) == NULL) { ipseclog((LOG_DEBUG, "%s: no larval SA with sequence %u " "exists.\n", __func__, mhp->msg->sadb_msg_seq)); - return key_senderror(so, m, ENOENT); + return (key_senderror(so, m, ENOENT)); } #else SAHTREE_LOCK(); @@ -4709,7 +4710,7 @@ key_update(so, m, mhp) if (sav == NULL) { ipseclog((LOG_DEBUG, "%s: no such a SA found (spi:%u)\n", __func__, (u_int32_t)ntohl(sa0->sadb_sa_spi))); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } #endif @@ -4718,7 +4719,7 @@ key_update(so, m, mhp) ipseclog((LOG_DEBUG, "%s: protocol mismatched " "(DB=%u param=%u)\n", __func__, sav->sah->saidx.proto, proto)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } #ifdef IPSEC_DOSEQCHECK if (sav->spi != sa0->sadb_sa_spi) { @@ -4726,26 +4727,26 @@ key_update(so, m, mhp) __func__, (u_int32_t)ntohl(sav->spi), (u_int32_t)ntohl(sa0->sadb_sa_spi))); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } #endif if (sav->pid != mhp->msg->sadb_msg_pid) { ipseclog((LOG_DEBUG, "%s: pid mismatched (DB:%u param:%u)\n", __func__, sav->pid, mhp->msg->sadb_msg_pid)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* copy sav values */ error = key_setsaval(sav, m, mhp); if (error) { KEY_FREESAV(&sav); - return key_senderror(so, m, error); + return (key_senderror(so, m, error)); } /* check SA values to be mature. */ if ((mhp->msg->sadb_msg_errno = key_mature(sav)) != 0) { KEY_FREESAV(&sav); - return key_senderror(so, m, 0); + return (key_senderror(so, m, 0)); } { @@ -4755,11 +4756,11 @@ key_update(so, m, mhp) n = key_getmsgbuf_x1(m, mhp); if (n == NULL) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ALL)); } } @@ -4791,11 +4792,11 @@ key_getsavbyseq(sah, seq) KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s cause refcnt++:%d SA:%p\n", __func__, sav->refcnt, sav)); - return sav; + return (sav); } } - return NULL; + return (NULL); } #endif @@ -4839,7 +4840,7 @@ key_add(so, m, mhp) if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) { ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_EXT_SA] == NULL || @@ -4855,7 +4856,7 @@ key_add(so, m, mhp) mhp->ext[SADB_EXT_LIFETIME_SOFT] != NULL)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->extlen[SADB_EXT_SA] < sizeof(struct sadb_sa) || mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) || @@ -4863,7 +4864,7 @@ key_add(so, m, mhp) /* XXX need more */ ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_X_EXT_SA2] != NULL) { mode = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_mode; @@ -4885,7 +4886,7 @@ key_add(so, m, mhp) /* create a new SA header */ if ((newsah = key_newsah(&saidx)) == NULL) { ipseclog((LOG_DEBUG, "%s: No more memory.\n",__func__)); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } } @@ -4893,7 +4894,7 @@ key_add(so, m, mhp) /* XXX rewrite */ error = key_setident(newsah, m, mhp); if (error) { - return key_senderror(so, m, error); + return (key_senderror(so, m, error)); } /* create new SA entry. */ @@ -4903,17 +4904,17 @@ key_add(so, m, mhp) SAHTREE_UNLOCK(); if (newsav != NULL) { ipseclog((LOG_DEBUG, "%s: SA already exists.\n", __func__)); - return key_senderror(so, m, EEXIST); + return (key_senderror(so, m, EEXIST)); } newsav = KEY_NEWSAV(m, mhp, newsah, &error); if (newsav == NULL) { - return key_senderror(so, m, error); + return (key_senderror(so, m, error)); } /* check SA values to be mature. */ if ((error = key_mature(newsav)) != 0) { KEY_FREESAV(&newsav); - return key_senderror(so, m, error); + return (key_senderror(so, m, error)); } /* @@ -4928,11 +4929,11 @@ key_add(so, m, mhp) n = key_getmsgbuf_x1(m, mhp); if (n == NULL) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ALL)); } } @@ -4956,13 +4957,13 @@ key_setident(sah, m, mhp) mhp->ext[SADB_EXT_IDENTITY_DST] == NULL) { sah->idents = NULL; sah->identd = NULL; - return 0; + return (0); } if (mhp->ext[SADB_EXT_IDENTITY_SRC] == NULL || mhp->ext[SADB_EXT_IDENTITY_DST] == NULL) { ipseclog((LOG_DEBUG, "%s: invalid identity.\n", __func__)); - return EINVAL; + return (EINVAL); } idsrc = (const struct sadb_ident *)mhp->ext[SADB_EXT_IDENTITY_SRC]; @@ -4973,7 +4974,7 @@ key_setident(sah, m, mhp) /* validity check */ if (idsrc->sadb_ident_type != iddst->sadb_ident_type) { ipseclog((LOG_DEBUG, "%s: ident type mismatch.\n", __func__)); - return EINVAL; + return (EINVAL); } switch (idsrc->sadb_ident_type) { @@ -4984,26 +4985,26 @@ key_setident(sah, m, mhp) /* XXX do nothing */ sah->idents = NULL; sah->identd = NULL; - return 0; + return (0); } /* make structure */ sah->idents = malloc(idsrclen, M_IPSEC_MISC, M_NOWAIT); if (sah->idents == NULL) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return ENOBUFS; + return (ENOBUFS); } sah->identd = malloc(iddstlen, M_IPSEC_MISC, M_NOWAIT); if (sah->identd == NULL) { free(sah->idents, M_IPSEC_MISC); sah->idents = NULL; ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return ENOBUFS; + return (ENOBUFS); } bcopy(idsrc, sah->idents, idsrclen); bcopy(iddst, sah->identd, iddstlen); - return 0; + return (0); } /* @@ -5028,18 +5029,18 @@ key_getmsgbuf_x1(m, mhp) SADB_EXT_LIFETIME_HARD, SADB_EXT_LIFETIME_SOFT, SADB_EXT_IDENTITY_SRC, SADB_EXT_IDENTITY_DST); if (!n) - return NULL; + return (NULL); if (n->m_len < sizeof(struct sadb_msg)) { n = m_pullup(n, sizeof(struct sadb_msg)); if (n == NULL) - return NULL; + return (NULL); } mtod(n, struct sadb_msg *)->sadb_msg_errno = 0; mtod(n, struct sadb_msg *)->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len); - return n; + return (n); } static int key_delete_all __P((struct socket *, struct mbuf *, @@ -5078,21 +5079,21 @@ key_delete(so, m, mhp) if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) { ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL || mhp->ext[SADB_EXT_ADDRESS_DST] == NULL) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) || mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_EXT_SA] == NULL) { @@ -5102,11 +5103,11 @@ key_delete(so, m, mhp) * IKE INITIAL-CONTACT. */ ipseclog((LOG_DEBUG, "%s: doing delete all.\n", __func__)); - return key_delete_all(so, m, mhp, proto); + return (key_delete_all(so, m, mhp, proto)); } else if (mhp->extlen[SADB_EXT_SA] < sizeof(struct sadb_sa)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } sa0 = (struct sadb_sa *)mhp->ext[SADB_EXT_SA]; @@ -5132,7 +5133,7 @@ key_delete(so, m, mhp) if (sah == NULL) { SAHTREE_UNLOCK(); ipseclog((LOG_DEBUG, "%s: no SA found.\n", __func__)); - return key_senderror(so, m, ENOENT); + return (key_senderror(so, m, ENOENT)); } key_sa_chgstate(sav, SADB_SASTATE_DEAD); @@ -5147,19 +5148,19 @@ key_delete(so, m, mhp) n = key_gather_mbuf(m, mhp, 1, 4, SADB_EXT_RESERVED, SADB_EXT_SA, SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST); if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); if (n->m_len < sizeof(struct sadb_msg)) { n = m_pullup(n, sizeof(struct sadb_msg)); if (n == NULL) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } newmsg = mtod(n, struct sadb_msg *); newmsg->sadb_msg_errno = 0; newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len); m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ALL)); } } @@ -5224,19 +5225,19 @@ key_delete_all(so, m, mhp, proto) n = key_gather_mbuf(m, mhp, 1, 3, SADB_EXT_RESERVED, SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST); if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); if (n->m_len < sizeof(struct sadb_msg)) { n = m_pullup(n, sizeof(struct sadb_msg)); if (n == NULL) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } newmsg = mtod(n, struct sadb_msg *); newmsg->sadb_msg_errno = 0; newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len); m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ALL)); } } @@ -5274,7 +5275,7 @@ key_get(so, m, mhp) if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) { ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_EXT_SA] == NULL || @@ -5282,14 +5283,14 @@ key_get(so, m, mhp) mhp->ext[SADB_EXT_ADDRESS_DST] == NULL) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->extlen[SADB_EXT_SA] < sizeof(struct sadb_sa) || mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) || mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } sa0 = (struct sadb_sa *)mhp->ext[SADB_EXT_SA]; @@ -5315,7 +5316,7 @@ key_get(so, m, mhp) SAHTREE_UNLOCK(); if (sah == NULL) { ipseclog((LOG_DEBUG, "%s: no SA found.\n", __func__)); - return key_senderror(so, m, ENOENT); + return (key_senderror(so, m, ENOENT)); } { @@ -5326,17 +5327,17 @@ key_get(so, m, mhp) if ((satype = key_proto2satype(sah->saidx.proto)) == 0) { ipseclog((LOG_DEBUG, "%s: there was invalid proto in SAD.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* create new sadb_msg to reply. */ n = key_setdumpsa(sav, SADB_GET, satype, mhp->msg->sadb_msg_seq, mhp->msg->sadb_msg_pid); if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_ONE); + return (key_sendup_mbuf(so, n, KEY_SENDUP_ONE)); } } @@ -5426,12 +5427,12 @@ key_getcomb_esp() m_cat(result, m); } - return result; + return (result); fail: if (result) m_freem(result); - return NULL; + return (NULL); } static void @@ -5499,7 +5500,7 @@ key_getcomb_ah() } else M_PREPEND(m, l, M_DONTWAIT); if (!m) - return NULL; + return (NULL); comb = mtod(m, struct sadb_comb *); bzero(comb, sizeof(*comb)); @@ -5509,7 +5510,7 @@ key_getcomb_ah() comb->sadb_comb_auth_maxbits = _BITS(maxkeysize); } - return m; + return (m); } /* @@ -5543,7 +5544,7 @@ key_getcomb_ipcomp() } else M_PREPEND(m, l, M_DONTWAIT); if (!m) - return NULL; + return (NULL); comb = mtod(m, struct sadb_comb *); bzero(comb, sizeof(*comb)); @@ -5552,7 +5553,7 @@ key_getcomb_ipcomp() /* what should we set into sadb_comb_*_{min,max}bits? */ } - return m; + return (m); } /* @@ -5580,14 +5581,14 @@ key_getprop(saidx) m = key_getcomb_ipcomp(); break; default: - return NULL; + return (NULL); } if (!m) - return NULL; + return (NULL); M_PREPEND(m, l, M_DONTWAIT); if (!m) - return NULL; + return (NULL); totlen = 0; for (n = m; n; n = n->m_next) @@ -5599,7 +5600,7 @@ key_getprop(saidx) prop->sadb_prop_exttype = SADB_EXT_PROPOSAL; prop->sadb_prop_replay = 32; /* XXX */ - return m; + return (m); } /* @@ -5649,12 +5650,12 @@ key_acquire(const struct secasindex *saidx, struct } else { /* increment counter and do nothing. */ newacq->count++; - return 0; + return (0); } } else { /* make new entry for blocking to send SADB_ACQUIRE. */ if ((newacq = key_newacq(saidx)) == NULL) - return ENOBUFS; + return (ENOBUFS); } @@ -5779,12 +5780,12 @@ key_acquire(const struct secasindex *saidx, struct mtod(result, struct sadb_msg *)->sadb_msg_len = PFKEY_UNIT64(result->m_pkthdr.len); - return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED); + return (key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED)); fail: if (result) m_freem(result); - return error; + return (error); } static struct secacq * @@ -5796,7 +5797,7 @@ key_newacq(const struct secasindex *saidx) newacq = malloc(sizeof(struct secacq), M_IPSEC_SAQ, M_NOWAIT|M_ZERO); if (newacq == NULL) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return NULL; + return (NULL); } /* copy secindex */ @@ -5810,7 +5811,7 @@ key_newacq(const struct secasindex *saidx) LIST_INSERT_HEAD(&acqtree, newacq, chain); ACQ_UNLOCK(); - return newacq; + return (newacq); } static struct secacq * @@ -5825,7 +5826,7 @@ key_getacq(const struct secasindex *saidx) } ACQ_UNLOCK(); - return acq; + return (acq); } static struct secacq * @@ -5841,7 +5842,7 @@ key_getacqbyseq(seq) } ACQ_UNLOCK(); - return acq; + return (acq); } static struct secspacq * @@ -5854,7 +5855,7 @@ key_newspacq(spidx) acq = malloc(sizeof(struct secspacq), M_IPSEC_SAQ, M_NOWAIT|M_ZERO); if (acq == NULL) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return NULL; + return (NULL); } /* copy secindex */ @@ -5867,7 +5868,7 @@ key_newspacq(spidx) LIST_INSERT_HEAD(&spacqtree, acq, chain); SPACQ_UNLOCK(); - return acq; + return (acq); } static struct secspacq * @@ -5880,12 +5881,12 @@ key_getspacq(spidx) LIST_FOREACH(acq, &spacqtree, chain) { if (key_cmpspidx_exactly(spidx, &acq->spidx)) { /* NB: return holding spacq_lock */ - return acq; + return (acq); } } SPACQ_UNLOCK(); - return NULL; + return (NULL); } /* @@ -5933,7 +5934,7 @@ key_acquire2(so, m, mhp) ipseclog((LOG_DEBUG, "%s: must specify sequence " "number.\n", __func__)); m_freem(m); - return 0; + return (0); } if ((acq = key_getacqbyseq(mhp->msg->sadb_msg_seq)) == NULL) { @@ -5942,14 +5943,14 @@ key_acquire2(so, m, mhp) * a bogus sequence number. we can silently ignore it. */ m_freem(m); - return 0; + return (0); } /* reset acq counter in order to deletion by timehander. */ acq->created = time_second; acq->count = 0; m_freem(m); - return 0; + return (0); } /* @@ -5960,7 +5961,7 @@ key_acquire2(so, m, mhp) if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) { ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL || @@ -5969,7 +5970,7 @@ key_acquire2(so, m, mhp) /* error */ ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) || mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address) || @@ -5977,7 +5978,7 @@ key_acquire2(so, m, mhp) /* error */ ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } src0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_SRC]; @@ -5997,17 +5998,17 @@ key_acquire2(so, m, mhp) SAHTREE_UNLOCK(); if (sah != NULL) { ipseclog((LOG_DEBUG, "%s: a SA exists already.\n", __func__)); - return key_senderror(so, m, EEXIST); + return (key_senderror(so, m, EEXIST)); } error = key_acquire(&saidx, NULL); if (error != 0) { ipseclog((LOG_DEBUG, "%s: error %d returned from key_acquire\n", __func__, mhp->msg->sadb_msg_errno)); - return key_senderror(so, m, error); + return (key_senderror(so, m, error)); } - return key_sendup_mbuf(so, m, KEY_SENDUP_REGISTERED); + return (key_sendup_mbuf(so, m, KEY_SENDUP_REGISTERED)); } /* @@ -6038,7 +6039,7 @@ key_register(so, m, mhp) /* check for invalid register message */ if (mhp->msg->sadb_msg_satype >= sizeof(regtree)/sizeof(regtree[0])) - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); /* When SATYPE_UNSPEC is specified, only return sabd_supported. */ if (mhp->msg->sadb_msg_satype == SADB_SATYPE_UNSPEC) @@ -6051,7 +6052,7 @@ key_register(so, m, mhp) REGTREE_UNLOCK(); ipseclog((LOG_DEBUG, "%s: socket exists already.\n", __func__)); - return key_senderror(so, m, EEXIST); + return (key_senderror(so, m, EEXIST)); } } @@ -6060,7 +6061,7 @@ key_register(so, m, mhp) if (newreg == NULL) { REGTREE_UNLOCK(); ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } newreg->so = so; @@ -6099,7 +6100,7 @@ key_register(so, m, mhp) len = sizeof(struct sadb_msg) + alen + elen; if (len > MCLBYTES) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); MGETHDR(n, M_DONTWAIT, MT_DATA); if (len > MHLEN) { @@ -6110,7 +6111,7 @@ key_register(so, m, mhp) } } if (!n) - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); n->m_pkthdr.len = n->m_len = len; n->m_next = NULL; @@ -6172,7 +6173,7 @@ key_register(so, m, mhp) ("length assumption failed (off %u len %u)", off, len)); m_freem(m); - return key_sendup_mbuf(so, n, KEY_SENDUP_REGISTERED); + return (key_sendup_mbuf(so, n, KEY_SENDUP_REGISTERED)); } } @@ -6322,13 +6323,13 @@ key_expire(struct secasvar *sav) PFKEY_UNIT64(result->m_pkthdr.len); splx(s); - return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED); + return (key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED)); fail: if (result) m_freem(result); splx(s); - return error; + return (error); } /* @@ -6364,7 +6365,7 @@ key_flush(so, m, mhp) if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) { ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* no SATYPE specified, i.e. flushing all SA. */ @@ -6400,7 +6401,7 @@ key_flush(so, m, mhp) if (m->m_len < sizeof(struct sadb_msg) || sizeof(struct sadb_msg) > m->m_len + M_TRAILINGSPACE(m)) { ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__)); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } if (m->m_next) @@ -6411,7 +6412,7 @@ key_flush(so, m, mhp) newmsg->sadb_msg_errno = 0; newmsg->sadb_msg_len = PFKEY_UNIT64(m->m_pkthdr.len); - return key_sendup_mbuf(so, m, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, m, KEY_SENDUP_ALL)); } /* @@ -6451,7 +6452,7 @@ key_dump(so, m, mhp) if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) { ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* count sav entries to be sent to the userland. */ @@ -6474,7 +6475,7 @@ key_dump(so, m, mhp) if (cnt == 0) { SAHTREE_UNLOCK(); - return key_senderror(so, m, ENOENT); + return (key_senderror(so, m, ENOENT)); } /* send this to the userland, one at a time. */ @@ -6489,7 +6490,7 @@ key_dump(so, m, mhp) SAHTREE_UNLOCK(); ipseclog((LOG_DEBUG, "%s: there was invalid proto in " "SAD.\n", __func__)); - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } for (stateidx = 0; @@ -6501,7 +6502,7 @@ key_dump(so, m, mhp) --cnt, mhp->msg->sadb_msg_pid); if (!n) { SAHTREE_UNLOCK(); - return key_senderror(so, m, ENOBUFS); + return (key_senderror(so, m, ENOBUFS)); } key_sendup_mbuf(so, n, KEY_SENDUP_ONE); } @@ -6510,7 +6511,7 @@ key_dump(so, m, mhp) SAHTREE_UNLOCK(); m_freem(m); - return 0; + return (0); } /* @@ -6535,17 +6536,17 @@ key_promisc(so, m, mhp) if (olen < sizeof(struct sadb_msg)) { #if 1 - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); #else m_freem(m); - return 0; + return (0); #endif } else if (olen == sizeof(struct sadb_msg)) { /* enable/disable promisc mode */ struct keycb *kp; if ((kp = (struct keycb *)sotorawcb(so)) == NULL) - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); mhp->msg->sadb_msg_errno = 0; switch (mhp->msg->sadb_msg_satype) { case 0: @@ -6553,19 +6554,19 @@ key_promisc(so, m, mhp) kp->kp_promisc = mhp->msg->sadb_msg_satype; break; default: - return key_senderror(so, m, EINVAL); + return (key_senderror(so, m, EINVAL)); } /* send the original message back to everyone */ mhp->msg->sadb_msg_errno = 0; - return key_sendup_mbuf(so, m, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, m, KEY_SENDUP_ALL)); } else { /* send packet as is */ m_adj(m, PFKEY_ALIGN8(sizeof(struct sadb_msg))); /* TODO: if sadb_msg_seq is specified, send to specific pid */ - return key_sendup_mbuf(so, m, KEY_SENDUP_ALL); + return (key_sendup_mbuf(so, m, KEY_SENDUP_ALL)); } } @@ -6630,7 +6631,7 @@ key_parse(m, so) if (m->m_len < sizeof(struct sadb_msg)) { m = m_pullup(m, sizeof(struct sadb_msg)); if (!m) - return ENOBUFS; + return (ENOBUFS); } msg = mtod(m, struct sadb_msg *); orglen = PFKEY_UNUNIT64(msg->sadb_msg_len); @@ -6663,7 +6664,7 @@ key_parse(m, so) /* for old-fashioned code - should be nuked */ if (m->m_pkthdr.len > MCLBYTES) { m_freem(m); - return ENOBUFS; + return (ENOBUFS); } if (m->m_next) { struct mbuf *n; @@ -6678,7 +6679,7 @@ key_parse(m, so) } if (!n) { m_freem(m); - return ENOBUFS; + return (ENOBUFS); } m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t)); n->m_pkthdr.len = n->m_len = m->m_pkthdr.len; @@ -6690,7 +6691,7 @@ key_parse(m, so) /* align the mbuf chain so that extensions are in contiguous region. */ error = key_align(m, &mh); if (error) - return error; + return (error); msg = mh.msg; @@ -6850,7 +6851,7 @@ key_parse(m, so) goto senderror; } - return (*key_typesw[msg->sadb_msg_type])(so, m, &mh); + return ((*key_typesw[msg->sadb_msg_type])(so, m, &mh)); senderror: msg->sadb_msg_errno = error; @@ -6870,7 +6871,7 @@ key_senderror(so, m, code) msg = mtod(m, struct sadb_msg *); msg->sadb_msg_errno = code; - return key_sendup_mbuf(so, m, KEY_SENDUP_ONE); + return (key_sendup_mbuf(so, m, KEY_SENDUP_ONE)); } /* @@ -6906,7 +6907,7 @@ key_align(m, mhp) n = m_pulldown(m, off, sizeof(struct sadb_ext), &toff); if (!n) { /* m is already freed */ - return ENOBUFS; + return (ENOBUFS); } ext = (struct sadb_ext *)(mtod(n, caddr_t) + toff); @@ -6940,7 +6941,7 @@ key_align(m, mhp) "%u\n", __func__, ext->sadb_ext_type)); m_freem(m); pfkeystat.out_dupext++; - return EINVAL; + return (EINVAL); } break; default: @@ -6948,7 +6949,7 @@ key_align(m, mhp) __func__, ext->sadb_ext_type)); m_freem(m); pfkeystat.out_invexttype++; - return EINVAL; + return (EINVAL); } extlen = PFKEY_UNUNIT64(ext->sadb_ext_len); @@ -6956,13 +6957,13 @@ key_align(m, mhp) if (key_validate_ext(ext, extlen)) { m_freem(m); pfkeystat.out_invlen++; - return EINVAL; + return (EINVAL); } n = m_pulldown(m, off, extlen, &toff); if (!n) { /* m is already freed */ - return ENOBUFS; + return (ENOBUFS); } ext = (struct sadb_ext *)(mtod(n, caddr_t) + toff); @@ -6974,10 +6975,10 @@ key_align(m, mhp) if (off != end) { m_freem(m); pfkeystat.out_invlen++; - return EINVAL; + return (EINVAL); } - return 0; + return (0); } static int @@ -6991,16 +6992,16 @@ key_validate_ext(ext, len) const int sal = offsetof(struct sockaddr, sa_len) + sizeof(sa->sa_len); if (len != PFKEY_UNUNIT64(ext->sadb_ext_len)) - return EINVAL; + return (EINVAL); /* if it does not match minimum/maximum length, bail */ if (ext->sadb_ext_type >= sizeof(minsize) / sizeof(minsize[0]) || ext->sadb_ext_type >= sizeof(maxsize) / sizeof(maxsize[0])) - return EINVAL; + return (EINVAL); if (!minsize[ext->sadb_ext_type] || len < minsize[ext->sadb_ext_type]) - return EINVAL; + return (EINVAL); if (maxsize[ext->sadb_ext_type] && len > maxsize[ext->sadb_ext_type]) - return EINVAL; + return (EINVAL); /* more checks based on sadb_ext_type XXX need more */ switch (ext->sadb_ext_type) { @@ -7030,13 +7031,13 @@ key_validate_ext(ext, len) case ADDR: sa = (const struct sockaddr *)(((const u_int8_t*)ext)+baselen); if (len < baselen + sal) - return EINVAL; + return (EINVAL); if (baselen + PFKEY_ALIGN8(sa->sa_len) != len) - return EINVAL; + return (EINVAL); break; } - return 0; + return (0); } void @@ -7096,7 +7097,7 @@ key_checktunnelsanity(sav, family, src, dst) /* XXX: check inner IP header */ - return 1; + return (1); } /* record data transfer on SA, and update timestamps */ @@ -7202,7 +7203,7 @@ key_alloc_mbuf(l) MCLGET(n, M_DONTWAIT); if (!n) { m_freem(m); - return NULL; + return (NULL); } n->m_next = NULL; @@ -7223,5 +7224,5 @@ key_alloc_mbuf(l) m = n; } - return m; + return (m); } Index: sys/sys/debugreturn.h =================================================================== --- sys/sys/debugreturn.h (revision 0) +++ sys/sys/debugreturn.h (revision 0) @@ -0,0 +1,22 @@ +#ifndef _SYS_DEBUGRETURN_H_ +#define _SYS_DEBUGRETURN_H_ + +#ifdef _KERNEL +#include +/* + * Zeby skompilowac kernel z tym makrem, nalezy ustawic WERROR="", + * na przyklad: + * + * WERROR="" make buildkernel + */ +#define return(X) do { \ + int _x = (int)(X); \ + if (_x == EAGAIN || _x == ENOBUFS) { \ + log(LOG_DEBUG, __FILE__ ":%d: returning" \ + " %d\n", __LINE__, _x); \ + } \ + return (_x); \ + } while (0) +#endif /* _KERNEL */ + +#endif /* !_SYS_DEBUGRETURN_H_ */