logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

cld.h (3122B)


  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Upcall description for nfsdcld communication
  4. *
  5. * Copyright (c) 2012 Red Hat, Inc.
  6. * Author(s): Jeff Layton <jlayton@redhat.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #ifndef _NFSD_CLD_H
  23. #define _NFSD_CLD_H
  24. #include <linux/types.h>
  25. /* latest upcall version available */
  26. #define CLD_UPCALL_VERSION 2
  27. /* defined by RFC3530 */
  28. #define NFS4_OPAQUE_LIMIT 1024
  29. #ifndef SHA256_DIGEST_SIZE
  30. #define SHA256_DIGEST_SIZE 32
  31. #endif
  32. enum cld_command {
  33. Cld_Create, /* create a record for this cm_id */
  34. Cld_Remove, /* remove record of this cm_id */
  35. Cld_Check, /* is this cm_id allowed? */
  36. Cld_GraceDone, /* grace period is complete */
  37. Cld_GraceStart, /* grace start (upload client records) */
  38. Cld_GetVersion, /* query max supported upcall version */
  39. };
  40. /* representation of long-form NFSv4 client ID */
  41. struct cld_name {
  42. __u16 cn_len; /* length of cm_id */
  43. unsigned char cn_id[NFS4_OPAQUE_LIMIT]; /* client-provided */
  44. } __attribute__((packed));
  45. /* sha256 hash of the kerberos principal */
  46. struct cld_princhash {
  47. __u8 cp_len; /* length of cp_data */
  48. unsigned char cp_data[SHA256_DIGEST_SIZE]; /* hash of principal */
  49. } __attribute__((packed));
  50. struct cld_clntinfo {
  51. struct cld_name cc_name;
  52. struct cld_princhash cc_princhash;
  53. } __attribute__((packed));
  54. /* message struct for communication with userspace */
  55. struct cld_msg {
  56. __u8 cm_vers; /* upcall version */
  57. __u8 cm_cmd; /* upcall command */
  58. __s16 cm_status; /* return code */
  59. __u32 cm_xid; /* transaction id */
  60. union {
  61. __s64 cm_gracetime; /* grace period start time */
  62. struct cld_name cm_name;
  63. __u8 cm_version; /* for getting max version */
  64. } __attribute__((packed)) cm_u;
  65. } __attribute__((packed));
  66. /* version 2 message can include hash of kerberos principal */
  67. struct cld_msg_v2 {
  68. __u8 cm_vers; /* upcall version */
  69. __u8 cm_cmd; /* upcall command */
  70. __s16 cm_status; /* return code */
  71. __u32 cm_xid; /* transaction id */
  72. union {
  73. struct cld_name cm_name;
  74. __u8 cm_version; /* for getting max version */
  75. struct cld_clntinfo cm_clntinfo; /* name & princ hash */
  76. } __attribute__((packed)) cm_u;
  77. } __attribute__((packed));
  78. struct cld_msg_hdr {
  79. __u8 cm_vers; /* upcall version */
  80. __u8 cm_cmd; /* upcall command */
  81. __s16 cm_status; /* return code */
  82. __u32 cm_xid; /* transaction id */
  83. } __attribute__((packed));
  84. #endif /* !_NFSD_CLD_H */