Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec sprinkle some "const", documenting that the SA ...



details:   https://anonhg.NetBSD.org/src/rev/89f63836c47a
branches:  trunk
changeset: 762281:89f63836c47a
user:      drochner <drochner%NetBSD.org@localhost>
date:      Fri Feb 18 19:06:45 2011 +0000

description:
sprinkle some "const", documenting that the SA is not supposed to
change during an xform operation

diffstat:

 sys/netipsec/ipsec.c        |  14 +++++++-------
 sys/netipsec/ipsec.h        |  10 +++++-----
 sys/netipsec/xform.h        |   4 ++--
 sys/netipsec/xform_ah.c     |   8 ++++----
 sys/netipsec/xform_esp.c    |   8 ++++----
 sys/netipsec/xform_ipcomp.c |   8 ++++----
 sys/netipsec/xform_ipip.c   |   8 ++++----
 sys/netipsec/xform_tcp.c    |   6 +++---
 8 files changed, 33 insertions(+), 33 deletions(-)

diffs (279 lines):

diff -r 01727669ef4c -r 89f63836c47a sys/netipsec/ipsec.c
--- a/sys/netipsec/ipsec.c      Fri Feb 18 18:00:52 2011 +0000
+++ b/sys/netipsec/ipsec.c      Fri Feb 18 19:06:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec.c,v 1.49 2011/02/11 17:53:35 drochner Exp $      */
+/*     $NetBSD: ipsec.c,v 1.50 2011/02/18 19:06:45 drochner Exp $      */
 /*     $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $       */
 /*     $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.49 2011/02/11 17:53:35 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.50 2011/02/18 19:06:45 drochner Exp $");
 
 /*
  * IPsec controller part.
@@ -1937,7 +1937,7 @@
  * based on RFC 2401.
  */
 int
-ipsec_chkreplay(u_int32_t seq, struct secasvar *sav)
+ipsec_chkreplay(u_int32_t seq, const struct secasvar *sav)
 {
        const struct secreplay *replay;
        u_int32_t diff;
@@ -1995,7 +1995,7 @@
  *     1:      NG
  */
 int
-ipsec_updatereplay(u_int32_t seq, struct secasvar *sav)
+ipsec_updatereplay(u_int32_t seq, const struct secasvar *sav)
 {
        struct secreplay *replay;
        u_int32_t diff;
@@ -2127,7 +2127,7 @@
 
 /* Return a printable string for the address. */
 const char *
-ipsec_address(union sockaddr_union* sa)
+ipsec_address(const union sockaddr_union* sa)
 {
        switch (sa->sa.sa_family) {
 #if INET
@@ -2146,11 +2146,11 @@
 }
 
 const char *
-ipsec_logsastr(struct secasvar *sav)
+ipsec_logsastr(const struct secasvar *sav)
 {
        static char buf[256];
        char *p;
-       struct secasindex *saidx = &sav->sah->saidx;
+       const struct secasindex *saidx = &sav->sah->saidx;
 
        IPSEC_ASSERT(saidx->src.sa.sa_family == saidx->dst.sa.sa_family,
                ("ipsec_logsastr: address family mismatch"));
diff -r 01727669ef4c -r 89f63836c47a sys/netipsec/ipsec.h
--- a/sys/netipsec/ipsec.h      Fri Feb 18 18:00:52 2011 +0000
+++ b/sys/netipsec/ipsec.h      Fri Feb 18 19:06:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec.h,v 1.24 2009/05/10 02:13:07 elad Exp $  */
+/*     $NetBSD: ipsec.h,v 1.25 2011/02/18 19:06:45 drochner Exp $      */
 /*     $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.h,v 1.2.4.2 2004/02/14 22:23:23 bms Exp $       */
 /*     $KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $  */
 
@@ -299,8 +299,8 @@
 
 struct secas;
 struct tcpcb;
-int ipsec_chkreplay (u_int32_t, struct secasvar *);
-int ipsec_updatereplay (u_int32_t, struct secasvar *);
+int ipsec_chkreplay (u_int32_t, const struct secasvar *);
+int ipsec_updatereplay (u_int32_t, const struct secasvar *);
 
 size_t ipsec4_hdrsiz (struct mbuf *, u_int, struct inpcb *);
 #ifdef __FreeBSD__
@@ -311,8 +311,8 @@
 #endif
 
 union sockaddr_union;
-const char *ipsec_address(union sockaddr_union* sa);
-const char *ipsec_logsastr (struct secasvar *);
+const char *ipsec_address(const union sockaddr_union* sa);
+const char *ipsec_logsastr (const struct secasvar *);
 
 void ipsec_dumpmbuf (struct mbuf *);
 
diff -r 01727669ef4c -r 89f63836c47a sys/netipsec/xform.h
--- a/sys/netipsec/xform.h      Fri Feb 18 18:00:52 2011 +0000
+++ b/sys/netipsec/xform.h      Fri Feb 18 19:06:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform.h,v 1.4 2007/03/04 06:03:30 christos Exp $       */
+/*     $NetBSD: xform.h,v 1.5 2011/02/18 19:06:45 drochner Exp $       */
 /*     $FreeBSD: src/sys/netipsec/xform.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $      */
 /*     $OpenBSD: ip_ipsp.h,v 1.119 2002/03/14 01:27:11 millert Exp $   */
 /*
@@ -91,7 +91,7 @@
        const char      *xf_name;               /* human-readable name */
        int     (*xf_init)(struct secasvar*, struct xformsw*);  /* setup */
        int     (*xf_zeroize)(struct secasvar*);                /* cleanup */
-       int     (*xf_input)(struct mbuf*, struct secasvar*,     /* input */
+       int     (*xf_input)(struct mbuf*, const struct secasvar*, /* input */
                        int, int);
        int     (*xf_output)(struct mbuf*,                      /* output */
                        struct ipsecrequest *, struct mbuf **, int, int);
diff -r 01727669ef4c -r 89f63836c47a sys/netipsec/xform_ah.c
--- a/sys/netipsec/xform_ah.c   Fri Feb 18 18:00:52 2011 +0000
+++ b/sys/netipsec/xform_ah.c   Fri Feb 18 19:06:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ah.c,v 1.29 2011/02/16 18:39:33 drochner Exp $   */
+/*     $NetBSD: xform_ah.c,v 1.30 2011/02/18 19:06:45 drochner Exp $   */
 /*     $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $   */
 /*     $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.29 2011/02/16 18:39:33 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.30 2011/02/18 19:06:45 drochner Exp $");
 
 #include "opt_inet.h"
 #ifdef __FreeBSD__
@@ -598,7 +598,7 @@
  * passes authentication.
  */
 static int
-ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
+ah_input(struct mbuf *m, const struct secasvar *sav, int skip, int protoff)
 {
        struct auth_hash *ahx;
        struct tdb_ident *tdbi;
@@ -993,7 +993,7 @@
     int protoff
 )
 {
-       struct secasvar *sav;
+       const struct secasvar *sav;
        struct auth_hash *ahx;
        struct cryptodesc *crda;
        struct tdb_crypto *tc;
diff -r 01727669ef4c -r 89f63836c47a sys/netipsec/xform_esp.c
--- a/sys/netipsec/xform_esp.c  Fri Feb 18 18:00:52 2011 +0000
+++ b/sys/netipsec/xform_esp.c  Fri Feb 18 19:06:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_esp.c,v 1.26 2011/02/14 18:49:31 drochner Exp $  */
+/*     $NetBSD: xform_esp.c,v 1.27 2011/02/18 19:06:45 drochner Exp $  */
 /*     $FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $  */
 /*     $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.26 2011/02/14 18:49:31 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.27 2011/02/18 19:06:45 drochner Exp $");
 
 #include "opt_inet.h"
 #ifdef __FreeBSD__
@@ -276,7 +276,7 @@
  * ESP input processing, called (eventually) through the protocol switch.
  */
 static int
-esp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
+esp_input(struct mbuf *m, const struct secasvar *sav, int skip, int protoff)
 {
        struct auth_hash *esph;
        struct enc_xform *espx;
@@ -701,7 +701,7 @@
        int hlen, rlen, plen, padding, blks, alen, i, roff;
        struct mbuf *mo = (struct mbuf *) NULL;
        struct tdb_crypto *tc;
-       struct secasvar *sav;
+       const struct secasvar *sav;
        struct secasindex *saidx;
        unsigned char *pad;
        u_int8_t prot;
diff -r 01727669ef4c -r 89f63836c47a sys/netipsec/xform_ipcomp.c
--- a/sys/netipsec/xform_ipcomp.c       Fri Feb 18 18:00:52 2011 +0000
+++ b/sys/netipsec/xform_ipcomp.c       Fri Feb 18 19:06:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ipcomp.c,v 1.22 2011/02/14 13:43:45 drochner Exp $       */
+/*     $NetBSD: xform_ipcomp.c,v 1.23 2011/02/18 19:06:45 drochner Exp $       */
 /*     $FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $       */
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.22 2011/02/14 13:43:45 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.23 2011/02/18 19:06:45 drochner Exp $");
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #include "opt_inet.h"
@@ -151,7 +151,7 @@
  * ipcomp_input() gets called to uncompress an input packet
  */
 static int
-ipcomp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
+ipcomp_input(struct mbuf *m, const struct secasvar *sav, int skip, int protoff)
 {
        struct tdb_crypto *tc;
        struct cryptodesc *crdc;
@@ -371,7 +371,7 @@
     int protoff
 )
 {
-       struct secasvar *sav;
+       const struct secasvar *sav;
        struct comp_algo *ipcompx;
        int error, ralen, hlen, maxpacketsize;
        struct cryptodesc *crdc;
diff -r 01727669ef4c -r 89f63836c47a sys/netipsec/xform_ipip.c
--- a/sys/netipsec/xform_ipip.c Fri Feb 18 18:00:52 2011 +0000
+++ b/sys/netipsec/xform_ipip.c Fri Feb 18 19:06:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ipip.c,v 1.24 2008/04/27 12:58:48 degroote Exp $ */
+/*     $NetBSD: xform_ipip.c,v 1.25 2011/02/18 19:06:45 drochner Exp $ */
 /*     $FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */
 /*     $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.24 2008/04/27 12:58:48 degroote Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.25 2011/02/18 19:06:45 drochner Exp $");
 
 /*
  * IP-inside-IP processing
@@ -429,7 +429,7 @@
     int protoff
 )
 {
-       struct secasvar *sav;
+       const struct secasvar *sav;
        u_int8_t tp, otos;
        struct secasindex *saidx;
        int error;
@@ -667,7 +667,7 @@
 static int
 ipe4_input(
     struct mbuf *m,
-    struct secasvar *sav,
+    const struct secasvar *sav,
     int skip,
     int protoff
 )
diff -r 01727669ef4c -r 89f63836c47a sys/netipsec/xform_tcp.c
--- a/sys/netipsec/xform_tcp.c  Fri Feb 18 18:00:52 2011 +0000
+++ b/sys/netipsec/xform_tcp.c  Fri Feb 18 19:06:45 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_tcp.c,v 1.5 2009/03/18 16:00:23 cegger Exp $ */
+/*     $NetBSD: xform_tcp.c,v 1.6 2011/02/18 19:06:45 drochner Exp $ */
 /*     $FreeBSD: sys/netipsec/xform_tcp.c,v 1.1.2.1 2004/02/14 22:24:09 bms Exp $ */
 
 /*
@@ -31,7 +31,7 @@
 /* TCP MD5 Signature Option (RFC2385) */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_tcp.c,v 1.5 2009/03/18 16:00:23 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_tcp.c,v 1.6 2011/02/18 19:06:45 drochner Exp $");
 
 #include "opt_inet.h"
 
@@ -137,7 +137,7 @@
  * We do this from within tcp itself, so this routine is just a stub.
  */
 static int
-tcpsignature_input(struct mbuf *m, struct secasvar *sav, int skip,
+tcpsignature_input(struct mbuf *m, const struct secasvar *sav, int skip,
     int protoff)
 {
 



Home | Main Index | Thread Index | Old Index