/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * Copyright (C) 2007 Cluster File Systems, Inc.
+ * GPL HEADER START
*
- * This file is part of Lustre, http://www.lustre.org.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
*
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
*
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
*/
#ifndef EXPORT_SYMTAB
* user supplied flavor string parsing *
****************************************/
+#ifdef HAVE_ADLER
+#define BULK_HASH_ALG_DEFAULT BULK_HASH_ALG_ADLER32
+#else
+#define BULK_HASH_ALG_DEFAULT BULK_HASH_ALG_CRC32
+#endif
+
typedef enum {
BULK_TYPE_N = 0,
BULK_TYPE_I = 1,
static void get_default_flavor(struct sptlrpc_flavor *sf)
{
sf->sf_rpc = SPTLRPC_FLVR_NULL;
- sf->sf_bulk_priv = BULK_PRIV_ALG_NULL;
- sf->sf_bulk_csum = BULK_CSUM_ALG_NULL;
+ sf->sf_bulk_ciph = BULK_CIPH_ALG_NULL;
+ sf->sf_bulk_hash = BULK_HASH_ALG_NULL;
sf->sf_flags = 0;
}
switch (rpc_flavor) {
case SPTLRPC_FLVR_NULL:
+ break;
case SPTLRPC_FLVR_PLAIN:
case SPTLRPC_FLVR_KRB5N:
case SPTLRPC_FLVR_KRB5A:
+ rule->sr_flvr.sf_bulk_hash = BULK_HASH_ALG_DEFAULT;
break;
case SPTLRPC_FLVR_KRB5P:
- rule->sr_flvr.sf_bulk_priv = BULK_PRIV_ALG_ARC4;
+ rule->sr_flvr.sf_bulk_ciph = BULK_CIPH_ALG_AES128;
/* fall through */
case SPTLRPC_FLVR_KRB5I:
- rule->sr_flvr.sf_bulk_csum = BULK_CSUM_ALG_SHA1;
+ rule->sr_flvr.sf_bulk_hash = BULK_HASH_ALG_SHA1;
break;
default:
LBUG();
}
}
-static void get_flavor_by_bulk(struct sptlrpc_rule *rule, bulk_type_t bulk_type)
+static void get_flavor_by_bulk(struct sptlrpc_rule *rule,
+ __u16 rpc_flavor, bulk_type_t bulk_type)
{
switch (bulk_type) {
case BULK_TYPE_N:
- rule->sr_flvr.sf_bulk_csum = BULK_CSUM_ALG_NULL;
- rule->sr_flvr.sf_bulk_priv = BULK_PRIV_ALG_NULL;
+ rule->sr_flvr.sf_bulk_hash = BULK_HASH_ALG_NULL;
+ rule->sr_flvr.sf_bulk_ciph = BULK_CIPH_ALG_NULL;
break;
case BULK_TYPE_I:
- rule->sr_flvr.sf_bulk_csum = BULK_CSUM_ALG_SHA1;
- rule->sr_flvr.sf_bulk_priv = BULK_PRIV_ALG_NULL;
+ switch (rpc_flavor) {
+ case SPTLRPC_FLVR_PLAIN:
+ case SPTLRPC_FLVR_KRB5N:
+ case SPTLRPC_FLVR_KRB5A:
+ rule->sr_flvr.sf_bulk_hash = BULK_HASH_ALG_DEFAULT;
+ break;
+ case SPTLRPC_FLVR_KRB5I:
+ case SPTLRPC_FLVR_KRB5P:
+ rule->sr_flvr.sf_bulk_hash = BULK_HASH_ALG_SHA1;
+ break;
+ default:
+ LBUG();
+ }
+ rule->sr_flvr.sf_bulk_ciph = BULK_CIPH_ALG_NULL;
break;
case BULK_TYPE_P:
- rule->sr_flvr.sf_bulk_csum = BULK_CSUM_ALG_SHA1;
- rule->sr_flvr.sf_bulk_priv = BULK_PRIV_ALG_ARC4;
+ rule->sr_flvr.sf_bulk_hash = BULK_HASH_ALG_SHA1;
+ rule->sr_flvr.sf_bulk_ciph = BULK_CIPH_ALG_AES128;
break;
default:
LBUG();
/* verify bulk section */
if (strcmp(bulk, "bulkn") == 0) {
- rule->sr_flvr.sf_bulk_csum = BULK_CSUM_ALG_NULL;
- rule->sr_flvr.sf_bulk_priv = BULK_PRIV_ALG_NULL;
+ rule->sr_flvr.sf_bulk_hash = BULK_HASH_ALG_NULL;
+ rule->sr_flvr.sf_bulk_ciph = BULK_CIPH_ALG_NULL;
bulk_type = BULK_TYPE_N;
} else if (strcmp(bulk, "bulki") == 0)
bulk_type = BULK_TYPE_I;
if (__flavors[i] == SPTLRPC_FLVR_PLAIN && bulk_type == BULK_TYPE_P)
GOTO(invalid, -EINVAL);
- get_flavor_by_bulk(rule, bulk_type);
+ get_flavor_by_bulk(rule, __flavors[i], bulk_type);
if (alg == NULL)
goto out;
*enc++ = '\0';
/* checksum algorithm */
- for (i = 0; i < BULK_CSUM_ALG_MAX; i++) {
- if (strcmp(alg, sptlrpc_bulk_csum_alg2name(i)) == 0) {
- rule->sr_flvr.sf_bulk_csum = i;
+ for (i = 0; i < BULK_HASH_ALG_MAX; i++) {
+ if (strcmp(alg, sptlrpc_get_hash_name(i)) == 0) {
+ rule->sr_flvr.sf_bulk_hash = i;
break;
}
}
- if (i >= BULK_CSUM_ALG_MAX)
+ if (i >= BULK_HASH_ALG_MAX)
GOTO(invalid, -EINVAL);
/* privacy algorithm */
if (enc) {
- for (i = 0; i < BULK_PRIV_ALG_MAX; i++) {
- if (strcmp(enc, sptlrpc_bulk_priv_alg2name(i)) == 0) {
- rule->sr_flvr.sf_bulk_priv = i;
+ for (i = 0; i < BULK_CIPH_ALG_MAX; i++) {
+ if (strcmp(enc, sptlrpc_get_ciph_name(i)) == 0) {
+ rule->sr_flvr.sf_bulk_ciph = i;
break;
}
}
- if (i >= BULK_PRIV_ALG_MAX)
+ if (i >= BULK_CIPH_ALG_MAX)
GOTO(invalid, -EINVAL);
}
* bulk combination sanity checks
*/
if (bulk_type == BULK_TYPE_P &&
- rule->sr_flvr.sf_bulk_priv == BULK_PRIV_ALG_NULL)
+ rule->sr_flvr.sf_bulk_ciph == BULK_CIPH_ALG_NULL)
GOTO(invalid, -EINVAL);
if (bulk_type == BULK_TYPE_I &&
- (rule->sr_flvr.sf_bulk_csum == BULK_CSUM_ALG_NULL ||
- rule->sr_flvr.sf_bulk_priv != BULK_PRIV_ALG_NULL))
+ (rule->sr_flvr.sf_bulk_hash == BULK_HASH_ALG_NULL ||
+ rule->sr_flvr.sf_bulk_ciph != BULK_CIPH_ALG_NULL))
GOTO(invalid, -EINVAL);
if (bulk_type == BULK_TYPE_N &&
- (rule->sr_flvr.sf_bulk_csum != BULK_CSUM_ALG_NULL ||
- rule->sr_flvr.sf_bulk_priv != BULK_PRIV_ALG_NULL))
+ (rule->sr_flvr.sf_bulk_hash != BULK_HASH_ALG_NULL ||
+ rule->sr_flvr.sf_bulk_ciph != BULK_CIPH_ALG_NULL))
GOTO(invalid, -EINVAL);
out: