From patchwork Fri Jul 28 20:21:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Adamson X-Patchwork-Id: 9869381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD4A060382 for ; Fri, 28 Jul 2017 20:22:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D23112892F for ; Fri, 28 Jul 2017 20:22:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5C562892B; Fri, 28 Jul 2017 20:22:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF78A28901 for ; Fri, 28 Jul 2017 20:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752603AbdG1UWG (ORCPT ); Fri, 28 Jul 2017 16:22:06 -0400 Received: from mx144.netapp.com ([216.240.21.25]:62496 "EHLO mx144.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752505AbdG1UWG (ORCPT ); Fri, 28 Jul 2017 16:22:06 -0400 X-IronPort-AV: E=Sophos;i="5.40,427,1496127600"; d="scan'208";a="207894568" Received: from vmwexchts03-prd.hq.netapp.com ([10.122.105.31]) by mx144-out.netapp.com with ESMTP; 28 Jul 2017 12:58:27 -0700 Received: from smtp1.corp.netapp.com (10.57.156.124) by VMWEXCHTS03-PRD.hq.netapp.com (10.122.105.31) with Microsoft SMTP Server id 15.0.1210.3; Fri, 28 Jul 2017 13:22:05 -0700 Received: from localhost.localdomain.localdomain (dros-16.vpn.netapp.com [10.55.79.21]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id v6SKM1lc007987; Fri, 28 Jul 2017 13:22:05 -0700 (PDT) From: To: CC: , , , , Andy Adamson Subject: [PATCH Version 6 03/12] SUNRPC AUTH_GSS get RPCSEC_GSS version from gssd downcall Date: Fri, 28 Jul 2017 16:21:49 -0400 Message-ID: <1501273318-14200-4-git-send-email-andros@netapp.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501273318-14200-1-git-send-email-andros@netapp.com> References: <1501273318-14200-1-git-send-email-andros@netapp.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andy Adamson Due to the addition of RPC_GSS3_VERSION. Assign RPC_GSS_VERSION (version 1) if GSS version is not part of the gssd downcall. Signed-off-by: Andy Adamson --- include/linux/sunrpc/auth_gss.h | 1 + net/sunrpc/auth_gss/auth_gss.c | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h index cf5e694..dbcdcc2 100644 --- a/include/linux/sunrpc/auth_gss.h +++ b/include/linux/sunrpc/auth_gss.h @@ -70,6 +70,7 @@ struct rpc_gss_init_res { struct gss_cl_ctx { atomic_t count; + u32 gc_v; enum rpc_gss_proc gc_proc; u32 gc_seq; spinlock_t gc_seq_lock; diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 4f16953..3c7fa5d 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -209,10 +209,11 @@ struct gss_auth { static const void * gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct gss_api_mech *gm) { - const void *q; + const void *q, *save; unsigned int seclen; unsigned int timeout; unsigned long now = jiffies; + unsigned int gss_v; u32 window_size; int ret; @@ -274,10 +275,22 @@ struct gss_auth { p = simple_get_netobj(q, end, &ctx->gc_acceptor); if (IS_ERR(p)) goto err; + + /** Pull in RPCSEC_GSS version if there is one. + * Assign RPC_GSS_VERSION (version 1) as the default. + */ + save = p; + p = simple_get_bytes(p, end, &gss_v, sizeof(gss_v)); + if (IS_ERR(p)) { + ctx->gc_v = RPC_GSS_VERSION; + p = save; + } else { + ctx->gc_v = gss_v; + } done: - dprintk("RPC: %s Success. gc_expiry %lu now %lu timeout %u acceptor %.*s\n", + dprintk("RPC: %s Success. gc_expiry %lu now %lu timeout %u acceptor %.*s gss version %d\n", __func__, ctx->gc_expiry, now, timeout, ctx->gc_acceptor.len, - ctx->gc_acceptor.data); + ctx->gc_acceptor.data, ctx->gc_v); return p; err: dprintk("RPC: %s returns error %ld\n", __func__, -PTR_ERR(p)); @@ -1511,10 +1524,10 @@ static void gss_pipe_free(struct gss_pipe *p) req->rq_seqno = ctx->gc_seq++; spin_unlock(&ctx->gc_seq_lock); - *p++ = htonl((u32) RPC_GSS_VERSION); - *p++ = htonl((u32) ctx->gc_proc); - *p++ = htonl((u32) req->rq_seqno); - *p++ = htonl((u32) gss_cred->gc_service); + *p++ = htonl((u32)ctx->gc_v); + *p++ = htonl((u32)ctx->gc_proc); + *p++ = htonl((u32)req->rq_seqno); + *p++ = htonl((u32)gss_cred->gc_service); p = xdr_encode_netobj(p, &ctx->gc_wire_ctx); *cred_len = htonl((p - (cred_len + 1)) << 2);