Source-Changes-HG archive

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

[src/netbsd-1-5]: src pullup (approved by releng-1-5)



details:   https://anonhg.NetBSD.org/src/rev/3a76be083e18
branches:  netbsd-1-5
changeset: 488801:3a76be083e18
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Jul 30 06:19:50 2000 +0000

description:
pullup (approved by releng-1-5)

 > make ipsec_strerror(3) to return const char *, not char *.  sync with kame.

1.7 -> 1.8      basesrc/lib/libipsec/ipsec_strerror.3
1.6 -> 1.7      basesrc/lib/libipsec/ipsec_strerror.c
1.6 -> 1.7      basesrc/lib/libipsec/ipsec_strerror.h
1.14 -> 1.15    syssrc/sys/netinet6/ipsec.h

diffstat:

 lib/libipsec/ipsec_strerror.3 |   8 +-
 lib/libipsec/ipsec_strerror.c |  10 ++--
 lib/libipsec/ipsec_strerror.h |   6 +-
 lib/libipsec/pfkey_dump.c     |  89 +++++++++++++++++++++++++++---------------
 sys/netinet6/ipsec.h          |   8 +-
 5 files changed, 72 insertions(+), 49 deletions(-)

diffs (290 lines):

diff -r a8d02c201654 -r 3a76be083e18 lib/libipsec/ipsec_strerror.3
--- a/lib/libipsec/ipsec_strerror.3     Sun Jul 30 05:45:30 2000 +0000
+++ b/lib/libipsec/ipsec_strerror.3     Sun Jul 30 06:19:50 2000 +0000
@@ -1,7 +1,7 @@
+.\"    $NetBSD: ipsec_strerror.3,v 1.7.2.1 2000/07/30 06:19:50 itojun Exp $
+.\"    $KAME: ipsec_strerror.3,v 1.7 2000/07/30 00:45:45 itojun Exp $
+.\"
 .\" Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
-.\"    $NetBSD: ipsec_strerror.3,v 1.7 2000/06/12 10:40:52 itojun Exp $
-.\"    $KAME: ipsec_strerror.3,v 1.6 2000/05/07 05:25:03 itojun Exp $
-.\"
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
 .\"
 .Sh SYNOPSIS
 .Fd #include <netinet6/ipsec.h>
-.Ft "char *"
+.Ft "const char *"
 .Fn ipsec_strerror
 .\"
 .Sh DESCRIPTION
diff -r a8d02c201654 -r 3a76be083e18 lib/libipsec/ipsec_strerror.c
--- a/lib/libipsec/ipsec_strerror.c     Sun Jul 30 05:45:30 2000 +0000
+++ b/lib/libipsec/ipsec_strerror.c     Sun Jul 30 06:19:50 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ipsec_strerror.c,v 1.6 2000/06/12 10:40:52 itojun Exp $        */
-/*     $KAME: ipsec_strerror.c,v 1.6 2000/05/07 05:25:03 itojun Exp $  */
+/*     $NetBSD: ipsec_strerror.c,v 1.6.2.1 2000/07/30 06:19:50 itojun Exp $    */
+/*     $KAME: ipsec_strerror.c,v 1.7 2000/07/30 00:45:12 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@@ -40,7 +40,7 @@
 
 int __ipsec_errcode;
 
-static char *ipsec_errlist[] = {
+static const char *ipsec_errlist[] = {
 "Success",                                     /*EIPSEC_NO_ERROR*/
 "Not supported",                               /*EIPSEC_NOT_SUPPORTED*/
 "Invalid argument",                            /*EIPSEC_INVAL_ARGUMENT*/
@@ -71,7 +71,7 @@
 "Unknown error",                               /*EIPSEC_MAX*/
 };
 
-char *ipsec_strerror(void)
+const char *ipsec_strerror(void)
 {
        if (__ipsec_errcode < 0 || __ipsec_errcode > EIPSEC_MAX)
                __ipsec_errcode = EIPSEC_MAX;
@@ -79,7 +79,7 @@
        return ipsec_errlist[__ipsec_errcode];
 }
 
-void __ipsec_set_strerror(char *str)
+void __ipsec_set_strerror(const char *str)
 {
        __ipsec_errcode = EIPSEC_SYSTEM_ERROR;
        ipsec_errlist[EIPSEC_SYSTEM_ERROR] = str;
diff -r a8d02c201654 -r 3a76be083e18 lib/libipsec/ipsec_strerror.h
--- a/lib/libipsec/ipsec_strerror.h     Sun Jul 30 05:45:30 2000 +0000
+++ b/lib/libipsec/ipsec_strerror.h     Sun Jul 30 06:19:50 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ipsec_strerror.h,v 1.6 2000/06/12 10:40:52 itojun Exp $        */
-/*     $KAME: ipsec_strerror.h,v 1.7 2000/05/07 05:25:03 itojun Exp $  */
+/*     $NetBSD: ipsec_strerror.h,v 1.6.2.1 2000/07/30 06:19:50 itojun Exp $    */
+/*     $KAME: ipsec_strerror.h,v 1.8 2000/07/30 00:45:12 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@@ -31,7 +31,7 @@
  */
 
 extern int __ipsec_errcode;
-extern void __ipsec_set_strerror __P((char *));
+extern void __ipsec_set_strerror __P((const char *));
 
 #define EIPSEC_NO_ERROR                0       /*success*/
 #define EIPSEC_NOT_SUPPORTED   1       /*not supported*/
diff -r a8d02c201654 -r 3a76be083e18 lib/libipsec/pfkey_dump.c
--- a/lib/libipsec/pfkey_dump.c Sun Jul 30 05:45:30 2000 +0000
+++ b/lib/libipsec/pfkey_dump.c Sun Jul 30 06:19:50 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: pfkey_dump.c,v 1.7 2000/06/12 10:40:52 itojun Exp $    */
-/*     $KAME: pfkey_dump.c,v 1.19 2000/06/10 06:47:11 sakane Exp $     */
+/*     $NetBSD: pfkey_dump.c,v 1.7.2.1 2000/07/30 06:19:50 itojun Exp $        */
+/*     $KAME: pfkey_dump.c,v 1.20 2000/07/20 09:50:42 itojun Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@@ -63,15 +63,33 @@
                printf("%s ", (str)[(num)]); \
 } while (0)
 
+#define GETMSGV2S(v2s, num) \
+do { \
+       struct val2str *p;  \
+       for (p = (v2s); p && p->str; p++) { \
+               if (p->val == (num)) \
+                       break; \
+       } \
+       if (p && p->str) \
+               printf("%s ", p->str); \
+       else \
+               printf("%d ", (num)); \
+} while (0)
+
 static char *str_ipaddr __P((struct sockaddr *));
 static char *str_prefport __P((u_int, u_int, u_int));
 static char *str_time __P((time_t));
 static void str_lifetime_byte __P((struct sadb_lifetime *, char *));
 
+struct val2str {
+       int val;
+       const char *str;
+};
+
 /*
  * Must to be re-written about following strings.
  */
-static char *_str_satype[] = {
+static char *str_satype[] = {
        "unspec",
        "unknown",
        "ah",
@@ -84,13 +102,13 @@
        "ipcomp",
 };
 
-static char *_str_mode[] = {
+static char *str_mode[] = {
        "any",
        "transport",
        "tunnel",
 };
 
-static char *_str_upper[] = {
+static char *str_upper[] = {
 /*0*/  "ip", "icmp", "igmp", "ggp", "ip4",
        "", "tcp", "", "egp", "",
 /*10*/ "", "", "", "", "",
@@ -106,37 +124,42 @@
 /*60*/ "dst6",
 };
 
-static char *_str_state[] = {
+static char *str_state[] = {
        "larval",
        "mature",
        "dying",
        "dead",
 };
 
-static char *_str_alg_auth[] = {
-       "none",
-       "hmac-md5",
-       "hmac-sha1",
-       "md5",
-       "sha",
-       "null",
+static struct val2str str_alg_auth[] = {
+       { SADB_AALG_NONE, "none", },
+       { SADB_AALG_MD5HMAC, "hmac-md5", },
+       { SADB_AALG_SHA1HMAC, "hmac-sha1", },
+       { SADB_X_AALG_MD5, "md5", },
+       { SADB_X_AALG_SHA, "sha", },
+       { SADB_X_AALG_NULL, "null", },
+       { -1, NULL, },
 };
 
-static char *_str_alg_enc[] = {
-       "none",
-       "des-cbc",
-       "3des-cbc",
-       "null",
-       "blowfish-cbc",
-       "cast128-cbc",
-       "rc5-cbc",
+static struct val2str str_alg_enc[] = {
+       { SADB_EALG_NONE, "none", },
+       { SADB_EALG_DESCBC, "des-cbc", },
+       { SADB_EALG_3DESCBC, "3des-cbc", },
+       { SADB_EALG_NULL, "null", },
+#ifdef SADB_X_EALG_RC5CBC
+       { SADB_X_EALG_RC5CBC, "rc5-cbc", },
+#endif
+       { SADB_X_EALG_CAST128CBC, "cast128-cbc", },
+       { SADB_X_EALG_BLOWFISHCBC, "blowfish-cbc", },
+       { -1, NULL, },
 };
 
-static char *_str_alg_comp[] = {
-       "none",
-       "oui",
-       "deflate",
-       "lzs",
+static struct val2str str_alg_comp[] = {
+       { SADB_X_CALG_NONE, "none", },
+       { SADB_X_CALG_OUI, "oui", },
+       { SADB_X_CALG_DEFLATE, "deflate", },
+       { SADB_X_CALG_LZS, "lzs", },
+       { -1, NULL, },
 };
 
 /*
@@ -204,10 +227,10 @@
        }
        printf("\n\t");
 
-       GETMSGSTR(_str_satype, m->sadb_msg_satype);
+       GETMSGSTR(str_satype, m->sadb_msg_satype);
 
        printf("mode=");
-       GETMSGSTR(_str_mode, m_sa2->sadb_x_sa2_mode);
+       GETMSGSTR(str_mode, m_sa2->sadb_x_sa2_mode);
 
        printf("spi=%u(0x%08x) reqid=%u(0x%08x)\n",
                (u_int32_t)ntohl(m_sa->sadb_sa_spi),
@@ -218,11 +241,11 @@
        /* encryption key */
        if (m->sadb_msg_satype == SADB_X_SATYPE_IPCOMP) {
                printf("\tC: ");
-               GETMSGSTR(_str_alg_comp, m_sa->sadb_sa_encrypt);
+               GETMSGV2S(str_alg_comp, m_sa->sadb_sa_encrypt);
        } else if (m->sadb_msg_satype == SADB_SATYPE_ESP) {
                if (m_enc != NULL) {
                        printf("\tE: ");
-                       GETMSGSTR(_str_alg_enc, m_sa->sadb_sa_encrypt);
+                       GETMSGV2S(str_alg_enc, m_sa->sadb_sa_encrypt);
                        ipsec_hexdump((caddr_t)m_enc + sizeof(*m_enc),
                                      m_enc->sadb_key_bits / 8);
                        printf("\n");
@@ -232,7 +255,7 @@
        /* authentication key */
        if (m_auth != NULL) {
                printf("\tA: ");
-               GETMSGSTR(_str_alg_auth, m_sa->sadb_sa_auth);
+               GETMSGV2S(str_alg_auth, m_sa->sadb_sa_auth);
                ipsec_hexdump((caddr_t)m_auth + sizeof(*m_auth),
                              m_auth->sadb_key_bits / 8);
                printf("\n");
@@ -245,7 +268,7 @@
 
        /* state */
        printf("state=");
-       GETMSGSTR(_str_state, m_sa->sadb_sa_state);
+       GETMSGSTR(str_state, m_sa->sadb_sa_state);
 
        printf("seq=%lu pid=%lu\n",
                (u_long)m->sadb_msg_seq,
@@ -378,7 +401,7 @@
        if (m_saddr->sadb_address_proto == IPSEC_ULPROTO_ANY)
                printf("any");
        else
-               GETMSGSTR(_str_upper, m_saddr->sadb_address_proto);
+               GETMSGSTR(str_upper, m_saddr->sadb_address_proto);
 
        /* policy */
     {
diff -r a8d02c201654 -r 3a76be083e18 sys/netinet6/ipsec.h
--- a/sys/netinet6/ipsec.h      Sun Jul 30 05:45:30 2000 +0000
+++ b/sys/netinet6/ipsec.h      Sun Jul 30 06:19:50 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ipsec.h,v 1.14 2000/06/15 05:01:08 itojun Exp $        */
-/*     $KAME: ipsec.h,v 1.32 2000/06/15 04:08:54 itojun Exp $  */
+/*     $NetBSD: ipsec.h,v 1.14.2.1 2000/07/30 06:19:50 itojun Exp $    */
+/*     $KAME: ipsec.h,v 1.35 2000/07/30 00:45:11 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -48,7 +48,7 @@
 
 /*
  * Security Policy Index
- * NOTE: Encure to be same address family and upper layer protocol.
+ * NOTE: Ensure to be same address family and upper layer protocol.
  * NOTE: ul_proto, port number, uid, gid:
  *     ANY: reserved for waldcard.
  *     0 to (~0 - 1): is one of the number of each value.
@@ -384,7 +384,7 @@
 extern int ipsec_get_policylen __P((caddr_t));
 extern char *ipsec_dump_policy __P((caddr_t, char *));
 
-extern char *ipsec_strerror __P((void));
+extern const char *ipsec_strerror __P((void));
 #endif /*!_KERNEL*/
 
 #endif /*_NETINET6_IPSEC_H_*/



Home | Main Index | Thread Index | Old Index