Skip to contentSkip to conversation

cifs: Move and expand MAX_SERVER_SIZE

PATCH In review [email protected] 6 participants 12 messages Jul 25, 2013 – Jul 30, 2013 7 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cifs: Move and expand MAX_SERVER_SIZE

From: Scott Lovenberg <[email protected]>

MAX_SERVER_SIZE has been moved to cifs_mount.h and renamed CIFS_NI_MAXHOST for clarity. It has been expanded to 1024 as the previous value of 16 was very short.

---
 fs/cifs/cifsglob.h                   | 3 +--
 include/uapi/linux/cifs/cifs_mount.h | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifsglob.h +1 -2
index b07b122..2227699 100644
@@ -42,8 +42,7 @@
 #define MAX_SES_INFO 2
 #define MAX_TCON_INFO 4
 
-#define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + CIFS_MAX_SHARE_LEN + 1)
-#define MAX_SERVER_SIZE 15
+#define MAX_TREE_SIZE (2 + CIFS_NI_MAXHOST + 1 + CIFS_MAX_SHARE_LEN + 1)
 
 #define CIFS_MIN_RCV_POOL 4
 
include/uapi/linux/cifs/cifs_mount.h +1 -0
index f7e4aee..a58fc6e 100644
@@ -21,5 +21,6 @@
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
+#define CIFS_NI_MAXHOST        1024 /* max host name length */
 
 #endif /* _CIFS_MOUNT_H */
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1374777285-25639-1-git-send-email-scott.lovenberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 2/2 cifs: Correct comment about domainname length

From: Scott Lovenberg <[email protected]>

CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.

---
 include/uapi/linux/cifs/cifs_mount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cifs/cifs_mount.h +1 -1
index a58fc6e..d2408ec 100644
@@ -17,7 +17,7 @@
 #define _CIFS_MOUNT_H
 
 /* Max string lengths for cifs mounting options. */
-#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1374777285-25639-2-git-send-email-scott.lovenberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

Quoted 15 lines · On 07/26/2013 02:34 AM, [email protected]…

From: Scott Lovenberg <[email protected]>

CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.

---
 include/uapi/linux/cifs/cifs_mount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cifs/cifs_mount.h +0 -0
index a58fc6e..d2408ec 100644

include/uapi/linux/cifs/cifs_mount.h line 23

Quoted 8 lines
include/uapi/linux/cifs/cifs_mount.h +1 -1
@@ -17,7 +17,7 @@
 #define _CIFS_MOUNT_H
 
 /* Max string lengths for cifs mounting options. */
-#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */

For our kernel implementation:

for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),

And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':

"The maximum length of ... the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot."

And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.

Do we also need consider about it in our definition comments ?

Thanks.

Signature · 1 line
Chen Gang

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

Quoted 36 lines · Chen Gang
Quoted 15 lines · On 07/26/2013 02:34 AM, [email protected]…

From: Scott Lovenberg <[email protected]>

CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.

---
 include/uapi/linux/cifs/cifs_mount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cifs/cifs_mount.h +0 -0
index a58fc6e..d2408ec 100644

include/uapi/linux/cifs/cifs_mount.h line 23

Quoted 8 lines
include/uapi/linux/cifs/cifs_mount.h +1 -1
@@ -17,7 +17,7 @@
 #define _CIFS_MOUNT_H
 
 /* Max string lengths for cifs mounting options. */
-#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */

For our kernel implementation:

for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),

And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':

"The maximum length of ... the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot."

Quoted 8 lines

And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.

Do we also need consider about it in our definition comments ?

Thanks.
--
Chen Gang

Sorry, I misunderstood; I figured that it had to be the domain name without the host since we were allowing a host name that's 1024 characters long. That documentation should probably be added to the cifs_mount.h as well then.

Still, how can we have a FQDN that's 256 characters long when the host name length can be 1024 characters long?

Signature · 2 lines
Peace and Blessings,
-Scott.

A message that is not in the archive (sent off-list or not yet received): CAFB9KM2zF9m4Y4vcDRkZpMfvWP8NQWYKQTeJTiwgVVVu=4M6Cw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

Quoted 46 lines · Scott Lovenberg
Quoted 36 lines · Chen Gang
Quoted 15 lines · On 07/26/2013 02:34 AM, [email protected]…

From: Scott Lovenberg <[email protected]>

CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.

---
 include/uapi/linux/cifs/cifs_mount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cifs/cifs_mount.h +0 -0
index a58fc6e..d2408ec 100644

include/uapi/linux/cifs/cifs_mount.h line 23

Quoted 8 lines
include/uapi/linux/cifs/cifs_mount.h +1 -1
@@ -17,7 +17,7 @@
 #define _CIFS_MOUNT_H
 
 /* Max string lengths for cifs mounting options. */
-#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */

For our kernel implementation:

for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),

And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':

"The maximum length of ... the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot."

Quoted 8 lines

And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.

Do we also need consider about it in our definition comments ?

Thanks.
--
Chen Gang

Quoted 8 lines

Sorry, I misunderstood; I figured that it had to be the domain name without the host since we were allowing a host name that's 1024 characters long. That documentation should probably be added to the cifs_mount.h as well then.

Still, how can we have a FQDN that's 256 characters long when the host name length can be 1024 characters long?

Excuse me, I am not quite familiar about cifs, so can not provide additional more information (I found it only by reading code).

But I feel, it really need additional discussion and check by the related experts (related members who are familiar with cifs).

Welcome any members' suggestions and completions.

Thanks.

Signature · 1 line
Chen Gang
#9 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

Quoted 59 lines · Chen Gang
Quoted 46 lines · Scott Lovenberg
Quoted 36 lines · Chen Gang
Quoted 15 lines · On 07/26/2013 02:34 AM, [email protected] wrote:

From: Scott Lovenberg <[email protected]>

CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.

---
 include/uapi/linux/cifs/cifs_mount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cifs/cifs_mount.h +0 -0
index a58fc6e..d2408ec 100644

include/uapi/linux/cifs/cifs_mount.h line 23

Quoted 8 lines
include/uapi/linux/cifs/cifs_mount.h +1 -1
@@ -17,7 +17,7 @@
 #define _CIFS_MOUNT_H
 
 /* Max string lengths for cifs mounting options. */
-#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */

For our kernel implementation:

for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),

And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':

"The maximum length of ... the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot."

Quoted 8 lines

And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.

Do we also need consider about it in our definition comments ?

Thanks.
--
Chen Gang

Quoted 8 lines

Sorry, I misunderstood; I figured that it had to be the domain name without the host since we were allowing a host name that's 1024 characters long. That documentation should probably be added to the cifs_mount.h as well then.

Still, how can we have a FQDN that's 256 characters long when the host name length can be 1024 characters long?

Excuse me, I am not quite familiar about cifs, so can not provide additional more information (I found it only by reading code).

Quoted 6 lines

But I feel, it really need additional discussion and check by the related experts (related members who are familiar with cifs).

Welcome any members' suggestions and completions.

Thanks.

Come on guys, enough already. As per here:
https://en.wikipedia.org/wiki/Domain_Name_System

and a comment above the max len of the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot.

Signature · 3 lines
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)

A message that is not in the archive (sent off-list or not yet received): CACyXjPxffbb8VQ55mCWTCP-GDivijXVkHNwtkVTwgAmi1XMyQQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#11 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

Quoted 70 lines · Richard Sharpe
Quoted 59 lines · Chen Gang
Quoted 46 lines · Scott Lovenberg
Quoted 36 lines · Chen Gang
Quoted 15 lines · On 07/26/2013 02:34 AM, [email protected]…

From: Scott Lovenberg <[email protected]>

CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.

---
 include/uapi/linux/cifs/cifs_mount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cifs/cifs_mount.h +0 -0
index a58fc6e..d2408ec 100644

include/uapi/linux/cifs/cifs_mount.h line 23

Quoted 8 lines
include/uapi/linux/cifs/cifs_mount.h +1 -1
@@ -17,7 +17,7 @@
 #define _CIFS_MOUNT_H
 
 /* Max string lengths for cifs mounting options. */
-#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */

For our kernel implementation:

for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),

And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':

"The maximum length of ... the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot."

Quoted 8 lines

And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.

Do we also need consider about it in our definition comments ?

Thanks.
--
Chen Gang

Quoted 8 lines

Sorry, I misunderstood; I figured that it had to be the domain name without the host since we were allowing a host name that's 1024 characters long. That documentation should probably be added to the cifs_mount.h as well then.

Still, how can we have a FQDN that's 256 characters long when the host name length can be 1024 characters long?

Excuse me, I am not quite familiar about cifs, so can not provide additional more information (I found it only by reading code).

Quoted 6 lines

But I feel, it really need additional discussion and check by the related experts (related members who are familiar with cifs).

Welcome any members' suggestions and completions.

Thanks.

Come on guys, enough already. As per here:
https://en.wikipedia.org/wiki/Domain_Name_System

Quoted 8 lines

and a comment above the max len of the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot.

--
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)

OK, I'll respin this and resubmit.

Signature · 2 lines
Peace and Blessings,
-Scott.
#12 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

In reply to a message not in the archive
Quoted 65 lines · On Sun, 28 Jul 2013 17:36:56 -0700 Richard Sharpe…
Quoted 64 lines · Chen Gang
Quoted 46 lines · Scott Lovenberg
Quoted 36 lines · Chen Gang
Quoted 15 lines · On 07/26/2013 02:34 AM, [email protected]…

From: Scott Lovenberg <[email protected]>

CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.

---
 include/uapi/linux/cifs/cifs_mount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cifs/cifs_mount.h +0 -0
index a58fc6e..d2408ec 100644

include/uapi/linux/cifs/cifs_mount.h line 23

Quoted 8 lines
include/uapi/linux/cifs/cifs_mount.h +1 -1
@@ -17,7 +17,7 @@
 #define _CIFS_MOUNT_H
 
 /* Max string lengths for cifs mounting options. */
-#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */

For our kernel implementation:

for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),

And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':

"The maximum length of ... the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot."

Quoted 8 lines

And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.

Do we also need consider about it in our definition comments ?

Thanks.
--
Chen Gang

Quoted 8 lines

Sorry, I misunderstood; I figured that it had to be the domain name without the host since we were allowing a host name that's 1024 characters long. That documentation should probably be added to the cifs_mount.h as well then.

Still, how can we have a FQDN that's 256 characters long when the host name length can be 1024 characters long?

Excuse me, I am not quite familiar about cifs, so can not provide additional more information (I found it only by reading code).

But I feel, it really need additional discussion and check by the related experts (related members who are familiar with cifs).

Welcome any members' suggestions and completions.

Quoted 9 lines
Quoted 1 line

Thanks.

Come on guys, enough already. As per here:
https://en.wikipedia.org/wiki/Domain_Name_System

and a comment above the max len of the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot.

Ok, I think I knew that at one point and paged it out. It does make one wonder why NI_MAXHOST is so big though -- is that for some internationalization scheme?

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20130729161709.19c52e0f-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org

#14 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

Quoted 22 lines · Jeff Layton
Quoted 12 lines
Quoted 12 lines
Quoted 3 lines

Still, how can we have a FQDN that's 256 characters long when the host name length can be 1024 characters long?

Excuse me, I am not quite familiar about cifs, so can not provide additional more information (I found it only by reading code).

But I feel, it really need additional discussion and check by the related experts (related members who are familiar with cifs).

Welcome any members' suggestions and completions.

Quoted 9 lines
Quoted 1 line

Thanks.

Come on guys, enough already. As per here:
https://en.wikipedia.org/wiki/Domain_Name_System

and a comment above the max len of the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot.

Quoted 6 lines

Ok, I think I knew that at one point and paged it out. It does make one wonder why NI_MAXHOST is so big though -- is that for some internationalization scheme?

--
Jeff Layton <[email protected]>

I guess it works if you're storing as UTF-32 or wchar_t at 4 bytes per character. 256 characters * 4 bytes/char + 1 byte for NULL. Microsoft seems to use the same value for NI_MAXHOST ref:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738532(v=vs.85).aspx
.

Signature · 2 lines
Peace and Blessings,
-Scott.

A message that is not in the archive (sent off-list or not yet received): CAFB9KM3CxJcHdFPrGTW595hjNzvYnLgVA6F8J3EMdddz3n0ivw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#16 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

Quoted 27 lines · Scott Lovenberg
Quoted 26 lines · Jeff Layton
Quoted 12 lines
Quoted 12 lines
Quoted 3 lines

Still, how can we have a FQDN that's 256 characters long when the host name length can be 1024 characters long?

Excuse me, I am not quite familiar about cifs, so can not provide additional more information (I found it only by reading code).

But I feel, it really need additional discussion and check by the related experts (related members who are familiar with cifs).

Welcome any members' suggestions and completions.

Quoted 9 lines
Quoted 1 line

Thanks.

Come on guys, enough already. As per here:
https://en.wikipedia.org/wiki/Domain_Name_System

and a comment above the max len of the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot.

Ok, I think I knew that at one point and paged it out. It does make one wonder why NI_MAXHOST is so big though -- is that for some internationalization scheme?

Quoted 9 lines
Quoted 2 lines

--
Jeff Layton <[email protected]>

I guess it works if you're storing as UTF-32 or wchar_t at 4 bytes per character. 256 characters * 4 bytes/char + 1 byte for NULL. Microsoft seems to use the same value for NI_MAXHOST ref:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738532(v=vs.85).aspx
.

As far as I know, the kernel implementation wants to use 255 + 1 as character count, not bytes count for FQDN (256 bytes for 8-bit, 512 bytes for 16-bit, ...), it can be translated into uni-code or other format within 255 + 1 character count.

May it be useful for our discussion ?

(BTW: if kernel really wants to do, I also suggest to check the kernel implementation for it whether correct or not).

Thanks.

Signature · 1 line
Chen Gang
#17 lore raw

Re: [PATCH 2/2] cifs: Correct comment about domainname length

Quoted 43 lines · Chen Gang
Quoted 27 lines · Scott Lovenberg
Quoted 26 lines · Jeff Layton
Quoted 12 lines
Quoted 12 lines
Quoted 3 lines

Still, how can we have a FQDN that's 256 characters long when the host name length can be 1024 characters long?

Excuse me, I am not quite familiar about cifs, so can not provide additional more information (I found it only by reading code).

But I feel, it really need additional discussion and check by the related experts (related members who are familiar with cifs).

Welcome any members' suggestions and completions.

Quoted 9 lines
Quoted 1 line

Thanks.

Come on guys, enough already. As per here:
https://en.wikipedia.org/wiki/Domain_Name_System

and a comment above the max len of the fully qualified domain name (FQDN) is 63 octets per label and 255 bytes per FQDN. This maximum includes 254 bytes for the FQDN and one byte for the ending dot.

Ok, I think I knew that at one point and paged it out. It does make one wonder why NI_MAXHOST is so big though -- is that for some internationalization scheme?

Quoted 9 lines
Quoted 2 lines

--
Jeff Layton <[email protected]>

I guess it works if you're storing as UTF-32 or wchar_t at 4 bytes per character. 256 characters * 4 bytes/char + 1 byte for NULL. Microsoft seems to use the same value for NI_MAXHOST ref:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738532(v=vs.85).aspx
.

As far as I know, the kernel implementation wants to use 255 + 1 as character count, not bytes count for FQDN (256 bytes for 8-bit, 512 bytes for 16-bit, ...), it can be translated into uni-code or other format within 255 + 1 character count.

Quoted 8 lines

May it be useful for our discussion ?

(BTW: if kernel really wants to do, I also suggest to check the kernel implementation for it whether correct or not).

Thanks.

OH, sorry, what I said above is incorrect. The kernel implementation use 255 + 1 as bytes, it can be translated into uni-code within 255 + 1 character count.

For NI_MAXHOST, I think we do not mind it: WIKI is more common than Microsoft. and Microsoft also says: "To simplify determining buffer requirements ..." (I guess, the "simplify determining" is "sizeof(UTF-32) * 256 + '\0'").

:-)

Thanks.

Signature · 1 line
Chen Gang
Reviewed-by
#18 lore raw
In reply to a message not in the archive
Quoted 31 lines · On Thu, 25 Jul 2013 14:34:44 -0400 scott.lovenberg-Re5JQEeQqe8AvxtiuMwx3w@publi…

From: Scott Lovenberg <[email protected]>

MAX_SERVER_SIZE has been moved to cifs_mount.h and renamed CIFS_NI_MAXHOST for clarity. It has been expanded to 1024 as the previous value of 16 was very short.

---
 fs/cifs/cifsglob.h                   | 3 +--
 include/uapi/linux/cifs/cifs_mount.h | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifsglob.h +1 -2
index b07b122..2227699 100644
@@ -42,8 +42,7 @@
 #define MAX_SES_INFO 2
 #define MAX_TCON_INFO 4
 
-#define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + CIFS_MAX_SHARE_LEN + 1)
-#define MAX_SERVER_SIZE 15
+#define MAX_TREE_SIZE (2 + CIFS_NI_MAXHOST + 1 + CIFS_MAX_SHARE_LEN + 1)
 
 #define CIFS_MIN_RCV_POOL 4
 
include/uapi/linux/cifs/cifs_mount.h +0 -0
index f7e4aee..a58fc6e 100644

include/uapi/linux/cifs/cifs_mount.h line 26

Quoted 6 lines
include/uapi/linux/cifs/cifs_mount.h +1 -0
@@ -21,5 +21,6 @@
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
+#define CIFS_NI_MAXHOST        1024 /* max host name length */
 
 #endif /* _CIFS_MOUNT_H */

Looks good.